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 |
|---|---|---|---|---|---|---|---|---|
ade82398d73e85072d61b4b0add3331d385abf2b
|
Update IApp.cs
|
ivan-prodanov/DotNet.Startup
|
Contracts/IApp.cs
|
Contracts/IApp.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DotNet.Startup.Contracts
{
public interface IApp
{
string[] Args { get; }
IServiceProvider ApplicationServices { get; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DotNet.Startup.Contracts
{
public interface IApp
{
string[] Args { get; }
IServiceProvider ApplicationServices { get; }
}
}
|
unlicense
|
C#
|
e3d6a91fd4202f754e806ab5aa7c383ccbbc1520
|
Bump version to 0.6.3
|
FatturaElettronicaPA/FatturaElettronicaPA.Forms
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronica.Forms")]
[assembly: AssemblyDescription("Windows.Forms per FatturaElettronica.NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronica.Forms")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a82cf38b-b7fe-42ae-b114-dc8fed8bd718")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.3.0")]
[assembly: AssemblyFileVersion("0.6.3.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronica.Forms")]
[assembly: AssemblyDescription("Windows.Forms per FatturaElettronica.NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronica.Forms")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a82cf38b-b7fe-42ae-b114-dc8fed8bd718")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.2.0")]
[assembly: AssemblyFileVersion("0.6.2.0")]
|
bsd-3-clause
|
C#
|
183afb57fd36bde5180858f8d3897dabf6de8181
|
Define Text.IsEmpty
|
jonathanvdc/Pixie,jonathanvdc/Pixie
|
Pixie/Markup/Text.cs
|
Pixie/Markup/Text.cs
|
using System;
namespace Pixie.Markup
{
/// <summary>
/// A markup node that renders a string of text.
/// </summary>
public sealed class Text : MarkupNode
{
/// <summary>
/// Creates a text node from a string.
/// </summary>
/// <param name="text">A text string.</param>
public Text(string text)
{
this.Contents = text;
}
/// <summary>
/// Gets the text this node consists of.
/// </summary>
/// <returns>A text string.</returns>
public string Contents { get; private set; }
/// <summary>
/// Tells if a markup node is certainly an empty node.
/// </summary>
/// <param name="node">The markup node to examine.</param>
/// <returns>
/// <c>true</c> if the node is certainly an empty node; otherwise, <c>false</c>.
/// </returns>
public static bool IsEmpty(MarkupNode node)
{
if (node is Text)
{
return string.IsNullOrEmpty(((Text)node).Contents);
}
else if (node is Sequence)
{
var seq = (Sequence)node;
if (seq.Contents.Count == 0)
return true;
else if (seq.Contents.Count == 1)
return IsEmpty(seq.Contents[0]);
else
return false;
}
else
{
return false;
}
}
/// <inheritdoc/>
public override MarkupNode Fallback => null;
/// <inheritdoc/>
public override MarkupNode Map(Func<MarkupNode, MarkupNode> mapping)
{
return this;
}
}
}
|
using System;
namespace Pixie.Markup
{
/// <summary>
/// A markup node that renders a string of text.
/// </summary>
public sealed class Text : MarkupNode
{
/// <summary>
/// Creates a text node from a string.
/// </summary>
/// <param name="text">A text string.</param>
public Text(string text)
{
this.Contents = text;
}
/// <summary>
/// Gets the text this node consists of.
/// </summary>
/// <returns>A text string.</returns>
public string Contents { get; private set; }
/// <inheritdoc/>
public override MarkupNode Fallback => null;
/// <inheritdoc/>
public override MarkupNode Map(Func<MarkupNode, MarkupNode> mapping)
{
return this;
}
}
}
|
mit
|
C#
|
7c09973a52c30e33a045ef477d408a5ca74fc577
|
remove trial check-in comment.
|
ishrahoar/penrosetiles
|
PenroseTiles/Program.cs
|
PenroseTiles/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PenroseTiles
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PenroseTiles
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
// this is just a trial
}
}
}
|
bsd-2-clause
|
C#
|
f53fd6e4bcfce9b22eb692c223bdf0cb30332e09
|
Fix status capitalisation
|
peppy/osu,ppy/osu,peppy/osu-new,ppy/osu,NeoAdonis/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,2yangk23/osu,peppy/osu,EVAST9919/osu,smoogipooo/osu,johnneijzen/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu
|
osu.Game/Users/UserActivity.cs
|
osu.Game/Users/UserActivity.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.Game.Beatmaps;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Users
{
public abstract class UserActivity
{
public abstract string Status { get; }
public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker;
public class Modding : UserActivity
{
public override string Status => "Modding a map";
public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark;
}
public class ChoosingBeatmap : UserActivity
{
public override string Status => "Choosing a beatmap";
}
public class MultiplayerGame : UserActivity
{
public override string Status => "Playing with others";
}
public class Editing : UserActivity
{
public BeatmapInfo Beatmap { get; }
public Editing(BeatmapInfo info)
{
Beatmap = info;
}
public override string Status => @"Editing a beatmap";
}
public class SoloGame : UserActivity
{
public BeatmapInfo Beatmap { get; }
public Rulesets.RulesetInfo Ruleset { get; }
public SoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset)
{
Beatmap = info;
Ruleset = ruleset;
}
public override string Status => @"Playing alone";
}
public class Spectating : UserActivity
{
public override string Status => @"Spectating a game";
}
public class InLobby : UserActivity
{
public override string Status => @"In a multiplayer lobby";
}
}
}
|
// 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.Game.Beatmaps;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Users
{
public abstract class UserActivity
{
public abstract string Status { get; }
public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker;
public class Modding : UserActivity
{
public override string Status => "Modding a map";
public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark;
}
public class ChoosingBeatmap : UserActivity
{
public override string Status => "Choosing a beatmap";
}
public class MultiplayerGame : UserActivity
{
public override string Status => "Playing with others";
}
public class Editing : UserActivity
{
public BeatmapInfo Beatmap { get; }
public Editing(BeatmapInfo info)
{
Beatmap = info;
}
public override string Status => @"Editing a beatmap";
}
public class SoloGame : UserActivity
{
public BeatmapInfo Beatmap { get; }
public Rulesets.RulesetInfo Ruleset { get; }
public SoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset)
{
Beatmap = info;
Ruleset = ruleset;
}
public override string Status => @"Playing alone";
}
public class Spectating : UserActivity
{
public override string Status => @"Spectating a game";
}
public class InLobby : UserActivity
{
public override string Status => @"In a Multiplayer Lobby";
}
}
}
|
mit
|
C#
|
1a80d944f723b664e6bba883f6141563d8fa4dd1
|
add TODO
|
dimaaan/pgEdit
|
PgEdit/Program.cs
|
PgEdit/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PgEdit
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// TODO what table currently open?
// TODO table Fields: more details
// TODO navigation: clicking by foreight key cell send user to row with primary key
// TODO navigation: clicking by primary key cell opens menu with depend tables. selecting table send user to table with dependent rows filtered
// TODO navigation: forward and backward buttons, support mouse additional buttons
// TODO SQL editor
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PgEdit
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// TODO table Fields: more details
// TODO navigation: clicking by foreight key cell send user to row with primary key
// TODO navigation: clicking by primary key cell opens menu with depend tables. selecting table send user to table with dependent rows filtered
// TODO navigation: forward and backward buttons, support mouse additional buttons
// TODO SQL editor
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
}
}
|
mit
|
C#
|
68745ef662f0f27e64bfc9fbbebd12ab9e0ae0d8
|
Update copyright year span to include 2014. This change was generated by the build script.
|
fixie/fixie,Duohong/fixie,KevM/fixie,EliotJones/fixie,bardoloi/fixie,JakeGinnivan/fixie,bardoloi/fixie
|
src/CommonAssemblyInfo.cs
|
src/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: AssemblyProduct("Fixie")]
[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyCopyright("Copyright (c) 2013-2014 Patrick Lioi")]
[assembly: AssemblyCompany("Patrick Lioi")]
[assembly: AssemblyDescription("A convention-based test framework.")]
[assembly: AssemblyConfiguration("Release")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: AssemblyProduct("Fixie")]
[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyCopyright("Copyright (c) 2013 Patrick Lioi")]
[assembly: AssemblyCompany("Patrick Lioi")]
[assembly: AssemblyDescription("A convention-based test framework.")]
[assembly: AssemblyConfiguration("Release")]
|
mit
|
C#
|
c9499a55949e0b16b0fa4b05d06d131588be0061
|
Update version to 2.1.7
|
Azure/amqpnetlite
|
src/Properties/Version.cs
|
src/Properties/Version.cs
|
// ------------------------------------------------------------------------------------
// Copyright (c) Microsoft 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
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR
// NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing permissions and
// limitations under the License.
// ------------------------------------------------------------------------------------
using System.Reflection;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.8")]
[assembly: AssemblyInformationalVersion("2.1.8")]
|
// ------------------------------------------------------------------------------------
// Copyright (c) Microsoft 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
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR
// NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing permissions and
// limitations under the License.
// ------------------------------------------------------------------------------------
using System.Reflection;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.7")]
[assembly: AssemblyInformationalVersion("2.1.7")]
|
apache-2.0
|
C#
|
2a8a679b0d4711c84609760d73cbaffedf20f2bc
|
Add address permission constants for permissions card
|
timheuer/alexa-skills-dotnet,stoiveyp/alexa-skills-dotnet
|
Alexa.NET/Response/RequestedPermission.cs
|
Alexa.NET/Response/RequestedPermission.cs
|
using System;
namespace Alexa.NET.Response
{
public static class RequestedPermission
{
public const string ReadHouseholdList = "read::alexa:household:list";
public const string WriteHouseholdList = "write::alexa:household:list";
public const string FullAddress = "read::alexa:device:all:address";
public const string AddressCountryAndPostalCode = "read::alexa:device:all:address:country_and_postal_code";
}
}
|
using System;
namespace Alexa.NET.Response
{
public static class RequestedPermission
{
public const string ReadHouseholdList = "read::alexa:household:list";
public const string WriteHouseholdList = "write::alexa:household:list";
}
}
|
mit
|
C#
|
9356298038d7a219af6c1fa2a7140b144c2ef892
|
Fix probing for git on non-Windows machines
|
terrajobst/git-istage,terrajobst/git-istage
|
src/git-istage/Program.cs
|
src/git-istage/Program.cs
|
using System;
using System.IO;
using System.Linq;
using LibGit2Sharp;
namespace GitIStage
{
internal static class Program
{
private static void Main()
{
var repositoryPath = ResolveRepositoryPath();
if (!Repository.IsValid(repositoryPath))
{
Console.WriteLine("fatal: Not a git repository");
return;
}
var pathToGit = ResolveGitPath();
if (string.IsNullOrEmpty(pathToGit))
{
Console.WriteLine("fatal: git is not in your path");
return;
}
var application = new Application(repositoryPath, pathToGit);
application.Run();
}
private static string ResolveRepositoryPath()
{
return Directory.GetCurrentDirectory();
}
private static string ResolveGitPath()
{
var path = Environment.GetEnvironmentVariable("PATH");
if (string.IsNullOrEmpty(path))
return null;
var paths = path.Split(Path.PathSeparator);
// In order to have this work across all operating systems, we
// need to include other extensions.
//
// NOTE: On .NET Core, we should use RuntimeInformation in order
// to limit the extensions based on operating system.
var fileNames = new[] { "git.exe", "git" };
var searchPaths = paths.SelectMany(p => fileNames.Select(f => Path.Combine(p, f)));
return searchPaths.FirstOrDefault(File.Exists);
}
}
}
|
using System;
using System.IO;
using System.Linq;
using LibGit2Sharp;
namespace GitIStage
{
internal static class Program
{
private static void Main()
{
var repositoryPath = ResolveRepositoryPath();
if (!Repository.IsValid(repositoryPath))
{
Console.WriteLine("fatal: Not a git repository");
return;
}
var pathToGit = ResolveGitPath();
if (string.IsNullOrEmpty(pathToGit))
{
Console.WriteLine("fatal: git is not in your path");
return;
}
var application = new Application(repositoryPath, pathToGit);
application.Run();
}
private static string ResolveRepositoryPath()
{
return Directory.GetCurrentDirectory();
}
private static string ResolveGitPath()
{
var path = Environment.GetEnvironmentVariable("PATH");
if (string.IsNullOrEmpty(path))
return null;
var paths = path.Split(Path.PathSeparator);
var searchPaths = paths.Select(p => Path.Combine(p, "git.exe"));
return searchPaths.FirstOrDefault(File.Exists);
}
}
}
|
mit
|
C#
|
8d735fee04fd50b213f372167508d0fbdee63364
|
reset Explicit attribute for BrowserTest tests
|
TestStack/TestStack.Seleno,dennisroche/TestStack.Seleno,bendetat/TestStack.Seleno,dennisroche/TestStack.Seleno,random82/TestStack.Seleno,bendetat/TestStack.Seleno,TestStack/TestStack.Seleno,random82/TestStack.Seleno
|
src/TestStack.Seleno.AcceptanceTests/Browsers/BrowserTests.cs
|
src/TestStack.Seleno.AcceptanceTests/Browsers/BrowserTests.cs
|
using NUnit.Framework;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Remote;
using TestStack.Seleno.Configuration;
using TestStack.Seleno.Configuration.WebServers;
using TestStack.Seleno.PageObjects;
namespace TestStack.Seleno.AcceptanceTests.Browsers
{
abstract class BrowserTest
{
protected abstract RemoteWebDriver WebDriver { get; }
[Explicit]
[Test]
public void RunTest()
{
using (var host = new SelenoHost())
{
host.Run(
x =>
x.WithRemoteWebDriver(() => WebDriver)
.WithWebServer(new InternetWebServer("http://www.google.com/")));
var title = host.NavigateToInitialPage<Page>().Title;
Assert.That(title, Is.EqualTo("Google"));
}
}
}
class SafariTest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.Safari(); }
}
}
class PhantomJSTest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.PhantomJS(); }
}
}
class FirefoxTest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.FireFox(); }
}
}
class ChromeTest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.Chrome(); }
}
}
class IETest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.InternetExplorer(); }
}
}
class IETestWithOptions : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get
{
var options = new InternetExplorerOptions { IntroduceInstabilityByIgnoringProtectedModeSettings = true };
return BrowserFactory.InternetExplorer(options);
}
}
}
}
|
using NUnit.Framework;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Remote;
using TestStack.Seleno.Configuration;
using TestStack.Seleno.Configuration.WebServers;
using TestStack.Seleno.PageObjects;
namespace TestStack.Seleno.AcceptanceTests.Browsers
{
abstract class BrowserTest
{
protected abstract RemoteWebDriver WebDriver { get; }
// [Explicit]
[Test]
public void RunTest()
{
using (var host = new SelenoHost())
{
host.Run(
x =>
x.WithRemoteWebDriver(() => WebDriver)
.WithWebServer(new InternetWebServer("http://www.google.com/")));
var title = host.NavigateToInitialPage<Page>().Title;
Assert.That(title, Is.EqualTo("Google"));
}
}
}
class SafariTest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.Safari(); }
}
}
class PhantomJSTest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.PhantomJS(); }
}
}
class FirefoxTest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.FireFox(); }
}
}
class ChromeTest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.Chrome(); }
}
}
class IETest : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get { return BrowserFactory.InternetExplorer(); }
}
}
class IETestWithOptions : BrowserTest
{
protected override RemoteWebDriver WebDriver
{
get
{
var options = new InternetExplorerOptions { IntroduceInstabilityByIgnoringProtectedModeSettings = true };
return BrowserFactory.InternetExplorer(options);
}
}
}
}
|
mit
|
C#
|
92b4671678e5af2117e71306b3fcf5ef93380945
|
Fix null event
|
yanyiyun/LockstepFramework,erebuswolf/LockstepFramework,SnpM/Lockstep-Framework
|
Core/Game/Abilities/Essential/Health.cs
|
Core/Game/Abilities/Essential/Health.cs
|
using System;
using Lockstep.UI;
using UnityEngine;
namespace Lockstep
{
public class Health : Ability
{
[SerializeField, FixedNumber]
private long _maxHealth = FixedMath.One * 100;
public long MaxHealth
{
get { return _maxHealth; }
set { _maxHealth = value; }
}
public event Action onHealthChange;
private long _healthAmount;
public long HealthAmount {
get {
return _healthAmount;
}
set {
_healthAmount = value;
if (onHealthChange != null)
onHealthChange ();
}
}
protected override void OnSetup()
{
}
protected override void OnInitialize()
{
HealthAmount = MaxHealth;
OnTakeProjectile = null;
}
public void TakeProjectile(LSProjectile projectile)
{
if (Agent.IsActive && HealthAmount >= 0) {
if (OnTakeProjectile .IsNotNull ())
{
OnTakeProjectile (projectile);
}
TakeRawDamage (projectile.CheckExclusiveDamage (Agent.Tag));
}
}
public void TakeRawDamage (long damage) {
HealthAmount -= damage;
// don't let the health go below zero
if (HealthAmount <= 0) {
HealthAmount = 0;
if (HealthAmount <= 0) {
Die ();
return;
}
}
if (Agent.StatsBarer != null)
Agent.StatsBarer.SetFill (StatBarType.Health, (float)(HealthAmount / (double)MaxHealth));
}
public void Die () {
AgentController.DestroyAgent(Agent);
if (Agent.Animator.IsNotNull ()) {
Agent.SetState(AnimState.Dying);
Agent.Animator.Visualize();
}
}
protected override void OnDeactivate() {
OnTakeProjectile = null;
}
public event Action<LSProjectile> OnTakeProjectile;
public int shieldIndex {get; set;}
public bool Protected {
get {return CoveringShield .IsNotNull () && CoveringShield.IsShielding;}
}
public Shield CoveringShield {get; private set;}
public void Protect (Shield shield) {
CoveringShield = shield;
}
public void Unprotect (Shield shield) {
CoveringShield = null;
}
}
}
|
using System;
using Lockstep.UI;
using UnityEngine;
namespace Lockstep
{
public class Health : Ability
{
[SerializeField, FixedNumber]
private long _maxHealth = FixedMath.One * 100;
public long MaxHealth
{
get { return _maxHealth; }
set { _maxHealth = value; }
}
public event Action onHealthChange;
private long _healthAmount;
public long HealthAmount {
get {
return _healthAmount;
}
set {
_healthAmount = value;
onHealthChange ();
}
}
protected override void OnSetup()
{
}
protected override void OnInitialize()
{
HealthAmount = MaxHealth;
OnTakeProjectile = null;
}
public void TakeProjectile(LSProjectile projectile)
{
if (Agent.IsActive && HealthAmount >= 0) {
if (OnTakeProjectile .IsNotNull ())
{
OnTakeProjectile (projectile);
}
TakeRawDamage (projectile.CheckExclusiveDamage (Agent.Tag));
}
}
public void TakeRawDamage (long damage) {
HealthAmount -= damage;
// don't let the health go below zero
if (HealthAmount <= 0) {
HealthAmount = 0;
if (HealthAmount <= 0) {
Die ();
return;
}
}
if (Agent.StatsBarer != null)
Agent.StatsBarer.SetFill (StatBarType.Health, (float)(HealthAmount / (double)MaxHealth));
}
public void Die () {
AgentController.DestroyAgent(Agent);
if (Agent.Animator.IsNotNull ()) {
Agent.SetState(AnimState.Dying);
Agent.Animator.Visualize();
}
}
protected override void OnDeactivate() {
OnTakeProjectile = null;
}
public event Action<LSProjectile> OnTakeProjectile;
public int shieldIndex {get; set;}
public bool Protected {
get {return CoveringShield .IsNotNull () && CoveringShield.IsShielding;}
}
public Shield CoveringShield {get; private set;}
public void Protect (Shield shield) {
CoveringShield = shield;
}
public void Unprotect (Shield shield) {
CoveringShield = null;
}
}
}
|
mit
|
C#
|
e8bed7ce3eca394728784a304e20c6f81aeac7a2
|
Add missing From property init
|
MaxDeg/NinthChevron
|
BlueBoxSharp.Data/Expressions/UnionQueryExpression.cs
|
BlueBoxSharp.Data/Expressions/UnionQueryExpression.cs
|
/**
* Copyright 2013
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using BlueBoxSharp.Data.Converters;
namespace BlueBoxSharp.Data.Expressions
{
public class UnionQueryExpression : QueryExpression
{
public QueryExpression LeftQuery { get; internal set; }
public QueryExpression RightQuery { get; internal set; }
public string Alias { get; private set; }
internal UnionQueryExpression(QueryExpression left, QueryExpression right)
: base(left.Context)
{
if (left.Context != right.Context)
throw new InvalidOperationException("Cannot create an union between DataContext");
this.RightQuery = right;
this.LeftQuery = left;
this.From = this.LeftQuery.From; // Need to set from property if we want being able to Select after union
this.Alias = this.GetNewTableAlias();
this.Projection = new UnionProjectionExpression(left.Projection);
this.IsDefaultProjection = left.IsDefaultProjection;
}
internal override void Project(ExpressionConverter converter, LambdaExpression lambda)
{
if (this.LeftQuery.IsDefaultProjection)
this.LeftQuery.Project(converter, lambda);
if (this.RightQuery.IsDefaultProjection)
this.RightQuery.Project(converter, lambda);
this.Projection = new UnionProjectionExpression(converter.Convert(lambda.Body, new Binding(lambda.Parameters[0], this)));
this.IsDefaultProjection = false;
foreach (OrderByExpression orderBy in this.OrderBy)
{
ProjectionItem item;
if (this.Projection.TryFindMember(orderBy.Expression, out item))
orderBy.Alias = item.Alias;
}
}
public override ExpressionType NodeType
{
get { return (ExpressionType)ExtendedExpressionType.Union; }
}
}
}
|
/**
* Copyright 2013
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using BlueBoxSharp.Data.Converters;
namespace BlueBoxSharp.Data.Expressions
{
public class UnionQueryExpression : QueryExpression
{
public QueryExpression LeftQuery { get; internal set; }
public QueryExpression RightQuery { get; internal set; }
public string Alias { get; private set; }
internal UnionQueryExpression(QueryExpression left, QueryExpression right)
: base(left.Context)
{
if (left.Context != right.Context)
throw new InvalidOperationException("Cannot create an union between DataContext");
this.RightQuery = right;
this.LeftQuery = left;
this.Alias = this.GetNewTableAlias();
this.Projection = new UnionProjectionExpression(left.Projection);
this.IsDefaultProjection = left.IsDefaultProjection;
}
internal override void Project(ExpressionConverter converter, LambdaExpression lambda)
{
if (this.LeftQuery.IsDefaultProjection)
this.LeftQuery.Project(converter, lambda);
if (this.RightQuery.IsDefaultProjection)
this.RightQuery.Project(converter, lambda);
this.Projection = new UnionProjectionExpression(converter.Convert(lambda.Body, new Binding(lambda.Parameters[0], this)));
this.IsDefaultProjection = false;
foreach (OrderByExpression orderBy in this.OrderBy)
{
ProjectionItem item;
if (this.Projection.TryFindMember(orderBy.Expression, out item))
orderBy.Alias = item.Alias;
}
}
public override ExpressionType NodeType
{
get { return (ExpressionType)ExtendedExpressionType.Union; }
}
}
}
|
apache-2.0
|
C#
|
7bc75cc900ee3f475ec4e40d03af5d98013ac1de
|
Remove unnecessary InternalsVisibleTo
|
NickLargen/Junctionizer
|
Junctionizer/Properties/AssemblyInfo.cs
|
Junctionizer/Properties/AssemblyInfo.cs
|
using System.Reflection;
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("Junctionizer")]
[assembly: AssemblyProduct("Junctionizer")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US English
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: AssemblyInformationalVersion("Alpha")]
|
using System.Reflection;
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("Junctionizer")]
[assembly: AssemblyProduct("Junctionizer")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US English
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: AssemblyInformationalVersion("Alpha")]
[assembly: InternalsVisibleTo("Junctionizer.Tests")]
|
mit
|
C#
|
a980cb7ba02202d92816d84bed80b9251e3771d6
|
delete custom field definition
|
gregsdennis/Manatee.Trello,gregsdennis/Manatee.Trello
|
Manatee.Trello/CustomFieldDefinition.cs
|
Manatee.Trello/CustomFieldDefinition.cs
|
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Manatee.Trello.Internal;
using Manatee.Trello.Internal.Synchronization;
using Manatee.Trello.Json;
namespace Manatee.Trello
{
public class CustomFieldDefinition : ICustomFieldDefinition, IMergeJson<IJsonCustomFieldDefinition>
{
private readonly Field<IBoard> _board;
private readonly Field<string> _fieldGroup;
private readonly Field<string> _name;
private readonly Field<Position> _position;
private readonly Field<CustomFieldType?> _type;
private readonly CustomFieldDefinitionContext _context;
public IBoard Board => _board.Value;
public string FieldGroup => _fieldGroup.Value;
public string Id => Json.Id;
public string Name
{
get { return _name.Value; }
set { _name.Value = value; }
}
public IReadOnlyCollection<DropDownOption> Options => _context.DropDownOptions;
public Position Position => _position.Value;
public CustomFieldType? Type => _type.Value;
internal IJsonCustomFieldDefinition Json
{
get { return _context.Data; }
set { _context.Merge(value); }
}
internal CustomFieldDefinition(IJsonCustomFieldDefinition json, TrelloAuthorization auth)
{
_context = new CustomFieldDefinitionContext(auth);
_context.Merge(json);
_board = new Field<IBoard>(_context, nameof(Board));
_fieldGroup = new Field<string>(_context, nameof(FieldGroup));
_name = new Field<string>(_context, nameof(Name));
_position = new Field<Position>(_context, nameof(Position));
_type = new Field<CustomFieldType?>(_context, nameof(Type));
TrelloConfiguration.Cache.Add(this);
// we need to enumerate the collection to cache all of the values
// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
Options?.ToList();
}
public async Task Delete(CancellationToken ct = default(CancellationToken))
{
await _context.Delete(ct);
}
public override string ToString()
{
return $"{Name} ({Type})";
}
void IMergeJson<IJsonCustomFieldDefinition>.Merge(IJsonCustomFieldDefinition json)
{
_context.Merge(json);
}
}
}
|
using System.Linq;
using System.Threading.Tasks;
using Manatee.Trello.Internal;
using Manatee.Trello.Internal.Synchronization;
using Manatee.Trello.Json;
namespace Manatee.Trello
{
public class CustomFieldDefinition : ICustomFieldDefinition, IMergeJson<IJsonCustomFieldDefinition>
{
private readonly Field<IBoard> _board;
private readonly Field<string> _fieldGroup;
private readonly Field<string> _name;
private readonly Field<Position> _position;
private readonly Field<CustomFieldType?> _type;
private readonly CustomFieldDefinitionContext _context;
public IBoard Board => _board.Value;
public string FieldGroup => _fieldGroup.Value;
public string Id => Json.Id;
public string Name
{
get { return _name.Value; }
set { _name.Value = value; }
}
public IReadOnlyCollection<DropDownOption> Options => _context.DropDownOptions;
public Position Position => _position.Value;
public CustomFieldType? Type => _type.Value;
internal IJsonCustomFieldDefinition Json
{
get { return _context.Data; }
set { _context.Merge(value); }
}
internal CustomFieldDefinition(IJsonCustomFieldDefinition json, TrelloAuthorization auth)
{
_context = new CustomFieldDefinitionContext(auth);
_context.Merge(json);
_board = new Field<IBoard>(_context, nameof(Board));
_fieldGroup = new Field<string>(_context, nameof(FieldGroup));
_name = new Field<string>(_context, nameof(Name));
_position = new Field<Position>(_context, nameof(Position));
_type = new Field<CustomFieldType?>(_context, nameof(Type));
TrelloConfiguration.Cache.Add(this);
// we need to enumerate the collection to cache all of the values
// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
Options?.ToList();
}
public async Task Delete()
{
await _context.Delete();
}
public override string ToString()
{
return $"{Name} ({Type})";
}
void IMergeJson<IJsonCustomFieldDefinition>.Merge(IJsonCustomFieldDefinition json)
{
_context.Merge(json);
}
}
}
|
mit
|
C#
|
1f0dfb68b39859870a77e29d8ea9619313612a77
|
Fix indentation.
|
igrali/PropertyDescriptions
|
PropertyDescriptions/EffectViewModel.cs
|
PropertyDescriptions/EffectViewModel.cs
|
using System.Collections.Generic;
using Lumia.Imaging;
using Lumia.Imaging.Adjustments;
using System;
namespace PropertyDescriptions
{
public class EffectViewModel
{
public BlurEffect blur { get; set; }
public EffectViewModel()
{
this.blur = new BlurEffect();
DetectPropertyDescriptions();
}
private void DetectPropertyDescriptions()
{
IPropertyDescriptions blurPropertyDescriptions = this.blur as IPropertyDescriptions;
if (blurPropertyDescriptions != null)
{
var propertyDescription = blurPropertyDescriptions.PropertyDescriptions[nameof(this.blur.KernelSize)];
this.DefaultValue = (int) propertyDescription.DefaultValue;
this.MinValue = (int) propertyDescription.MinValue;
this.MaxValue = (int) propertyDescription.MaxValue;
}
}
public int DefaultValue { get; set; }
public int MaxValue { get; set; }
public int MinValue { get; set; }
}
}
|
using System.Collections.Generic;
using Lumia.Imaging;
using Lumia.Imaging.Adjustments;
using System;
namespace PropertyDescriptions
{
public class EffectViewModel
{
public BlurEffect blur { get; set; }
public EffectViewModel()
{
this.blur = new BlurEffect();
DetectPropertyDescriptions();
}
private void DetectPropertyDescriptions()
{
IPropertyDescriptions blurPropertyDescriptions = this.blur as IPropertyDescriptions;
if (blurPropertyDescriptions != null)
{
var propertyDescription = blurPropertyDescriptions.PropertyDescriptions[nameof(this.blur.KernelSize)];
this.DefaultValue = (int) propertyDescription.DefaultValue;
this.MinValue = (int) propertyDescription.MinValue;
this.MaxValue = (int) propertyDescription.MaxValue;
}
}
public int DefaultValue { get; set; }
public int MaxValue { get; set; }
public int MinValue { get; set; }
}
}
|
mit
|
C#
|
a4f7eb83c7baa4b847600fcca112b219abe71287
|
Fix overlined participants test scene not working
|
ppy/osu,smoogipoo/osu,peppy/osu,peppy/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu
|
osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedParticipants.cs
|
osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedParticipants.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Multi.Components;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneOverlinedParticipants : MultiplayerTestScene
{
[SetUp]
public new void Setup() => Schedule(() =>
{
Room.RoomID.Value = 7;
for (int i = 0; i < 50; i++)
{
Room.RecentParticipants.Add(new User
{
Username = "peppy",
Id = 2
});
}
});
[Test]
public void TestHorizontalLayout()
{
AddStep("create component", () =>
{
Child = new ParticipantsDisplay(Direction.Horizontal)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 0.2f,
};
});
}
[Test]
public void TestVerticalLayout()
{
AddStep("create component", () =>
{
Child = new ParticipantsDisplay(Direction.Vertical)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 0.2f,
Height = 0.2f,
};
});
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Multi.Components;
using osuTK;
namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneOverlinedParticipants : MultiplayerTestScene
{
protected override bool UseOnlineAPI => true;
[SetUp]
public new void Setup() => Schedule(() =>
{
Room.RoomID.Value = 7;
});
[Test]
public void TestHorizontalLayout()
{
AddStep("create component", () =>
{
Child = new ParticipantsDisplay(Direction.Horizontal)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 500,
};
});
}
[Test]
public void TestVerticalLayout()
{
AddStep("create component", () =>
{
Child = new ParticipantsDisplay(Direction.Vertical)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(500)
};
});
}
}
}
|
mit
|
C#
|
556c97bc5510a5c1de39245a7f4cc2816e306cbb
|
Create indexes when creating table.
|
SilkStack/Silk.Data.SQL.ORM
|
Silk.Data.SQL.ORM/NewModelling/Table.cs
|
Silk.Data.SQL.ORM/NewModelling/Table.cs
|
using Silk.Data.SQL.Expressions;
using Silk.Data.SQL.ORM.Expressions;
using Silk.Data.SQL.ORM.Queries;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Silk.Data.SQL.ORM.NewModelling
{
/// <summary>
/// A table in a data domain.
/// </summary>
public class Table
{
public string TableName { get; }
public bool IsEntityTable { get; }
public Type EntityType { get; }
public IDataField[] Fields { get; }
public Table(string tableName, bool isEntityTable, IDataField[] dataFields, Type entityType)
{
if (isEntityTable && entityType == null)
throw new ArgumentNullException(nameof(entityType), "Entity tables must specify an entity type.");
TableName = tableName;
IsEntityTable = isEntityTable;
EntityType = entityType;
Fields = dataFields;
}
/// <summary>
/// Creates an <see cref="ORMQuery"/> that will create the table when executed.
/// </summary>
/// <returns></returns>
public ORMQuery CreateTable()
{
var queryExpression = new CompositeQueryExpression();
var columnDefinitions = new List<ColumnDefinitionExpression>();
foreach (var field in Fields)
{
if (field.IsMappedObject)
continue;
var autoIncrement = false;
if (field.AutoGenerate && (field.ClrType == typeof(short) ||
field.ClrType == typeof(int) ||
field.ClrType == typeof(long)))
autoIncrement = true;
columnDefinitions.Add(
QueryExpression.DefineColumn(field.Name, field.SqlType, field.IsNullable, autoIncrement, field.IsPrimaryKey)
);
}
queryExpression.Queries.Add(QueryExpression.CreateTable(TableName, columnDefinitions.ToArray()));
foreach (var field in Fields.Where(q => q.IsIndex))
{
queryExpression.Queries.Add(
QueryExpression.CreateIndex(TableName, uniqueConstraint: field.IsUnique, columns: field.Name)
);
}
return new NoResultORMQuery(queryExpression);
}
/// <summary>
/// Creates an <see cref="ORMQuery"/> that will drop the table when executed.
/// </summary>
/// <returns></returns>
public ORMQuery DropTable()
{
return new NoResultORMQuery(
QueryExpression.DropTable(TableName)
);
}
/// <summary>
/// Creates an <see cref="ORMQuery"/> that will test if the table exists when executed.
/// </summary>
/// <returns></returns>
public ORMQuery TableExists()
{
return new ScalarResultORMQuery<int>(
QueryExpression.TableExists(TableName)
);
}
}
}
|
using Silk.Data.SQL.Expressions;
using Silk.Data.SQL.ORM.Queries;
using System;
using System.Collections.Generic;
namespace Silk.Data.SQL.ORM.NewModelling
{
/// <summary>
/// A table in a data domain.
/// </summary>
public class Table
{
public string TableName { get; }
public bool IsEntityTable { get; }
public Type EntityType { get; }
public IDataField[] Fields { get; }
public Table(string tableName, bool isEntityTable, IDataField[] dataFields, Type entityType)
{
if (isEntityTable && entityType == null)
throw new ArgumentNullException(nameof(entityType), "Entity tables must specify an entity type.");
TableName = tableName;
IsEntityTable = isEntityTable;
EntityType = entityType;
Fields = dataFields;
}
/// <summary>
/// Creates an <see cref="ORMQuery"/> that will create the table when executed.
/// </summary>
/// <returns></returns>
public ORMQuery CreateTable()
{
var columnDefinitions = new List<ColumnDefinitionExpression>();
foreach (var field in Fields)
{
if (field.IsMappedObject)
continue;
var autoIncrement = false;
if (field.AutoGenerate && (field.ClrType == typeof(short) ||
field.ClrType == typeof(int) ||
field.ClrType == typeof(long)))
autoIncrement = true;
columnDefinitions.Add(
QueryExpression.DefineColumn(field.Name, field.SqlType, field.IsNullable, autoIncrement, field.IsPrimaryKey)
);
}
return new NoResultORMQuery(
QueryExpression.CreateTable(TableName, columnDefinitions.ToArray())
);
}
/// <summary>
/// Creates an <see cref="ORMQuery"/> that will drop the table when executed.
/// </summary>
/// <returns></returns>
public ORMQuery DropTable()
{
return new NoResultORMQuery(
QueryExpression.DropTable(TableName)
);
}
/// <summary>
/// Creates an <see cref="ORMQuery"/> that will test if the table exists when executed.
/// </summary>
/// <returns></returns>
public ORMQuery TableExists()
{
return new ScalarResultORMQuery<int>(
QueryExpression.TableExists(TableName)
);
}
}
}
|
mit
|
C#
|
6d360668db8895f2ae38711d5b19c2f9dffe672d
|
Implement mouse drag event as IObservable
|
sakapon/Samples-2014,sakapon/Samples-2014,sakapon/Samples-2014
|
RxSample/MouseRx2Wpf/MainWindow.xaml.cs
|
RxSample/MouseRx2Wpf/MainWindow.xaml.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MouseRx2Wpf
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public IObservable<IObservable<Vector>> MouseDrag { get; }
public MainWindow()
{
InitializeComponent();
// Replace events with IObservable objects.
var mouseDown = Observable.FromEventPattern<MouseButtonEventArgs>(this, nameof(MouseDown)).Select(e => e.EventArgs);
var mouseUp = Observable.FromEventPattern<MouseButtonEventArgs>(this, nameof(MouseUp)).Select(e => e.EventArgs);
var mouseLeave = Observable.FromEventPattern<MouseEventArgs>(this, nameof(MouseLeave)).Select(e => e.EventArgs);
var mouseMove = Observable.FromEventPattern<MouseEventArgs>(this, nameof(MouseMove)).Select(e => e.EventArgs);
var mouseEnd = mouseUp.Merge(mouseLeave.Select(e => default(MouseButtonEventArgs)));
MouseDrag = mouseDown
.Select(e => e.GetPosition(this))
.Select(p0 => mouseMove
.Select(e => e.GetPosition(this) - p0)
.TakeUntil(mouseEnd));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MouseRx2Wpf
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
|
mit
|
C#
|
ba55c7045798da1f6ad37049c140b79e9c8417ec
|
remove center style
|
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
|
Anlab.Mvc/Views/Home/Index.cshtml
|
Anlab.Mvc/Views/Home/Index.cshtml
|
@{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
<p><a href="/media/pdf/UC-Davis-Analytical-Laboratory-Handout.pdf" target="_blank" title="Anlab Flyer"><div><img src="~/Images/AnlabFlyerThumb.png"/><br/>Lab Flyer</div> </a></p>
</div>
|
@{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
<p><a href="/media/pdf/UC-Davis-Analytical-Laboratory-Handout.pdf" target="_blank" title="Anlab Flyer"><div style="text-align: center"><img src="~/Images/AnlabFlyerThumb.png"/><br/>Lab Flyer</div> </a></p>
</div>
|
mit
|
C#
|
a3c729b5ded846d76355360b7f542e2e308b6d0d
|
Move most of Patient class body to Contact class
|
SICU-Stress-Measurement-System/frontend-cs
|
StressMeasurementSystem/Models/Contact.cs
|
StressMeasurementSystem/Models/Contact.cs
|
using System.Collections.Generic;
using System.Net.Mail;
namespace StressMeasurementSystem.Models
{
public class Contact
{
#region Structs
public struct NameInfo
{
public string Prefix { get; set; }
public string First { get; set; }
public string Middle { get; set; }
public string Last { get; set; }
public string Suffix { get; set; }
public override string ToString()
{
return Prefix + " " + First + " " + Middle + " " + Last + ", " + Suffix;
}
}
public struct OrganizationInfo
{
public string Company { get; set; }
public string JobTitle { get; set; }
}
public struct PhoneInfo
{
public enum Type { Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other }
public string Number { get; set; }
public Type T { get; set; }
}
public struct EmailInfo
{
public enum Type { Home, Work, Other }
public MailAddress Address { get; set; }
public Type T { get; set; }
}
#endregion
#region Properties
public NameInfo Name { get; set; }
public OrganizationInfo Organization { get; set; }
public List<PhoneInfo> PhoneNumbers { get; set; }
public List<EmailInfo> EmailAddresses { get; set; }
#endregion
#region Constructors
public Contact()
{
Name = new NameInfo();
Organization = new OrganizationInfo();
PhoneNumbers = new List<PhoneInfo>();
EmailAddresses = new List<EmailInfo>();
}
public Contact(NameInfo nameInfo, OrganizationInfo organizationInfo,
List<PhoneInfo> phoneNumbers, List<EmailInfo> emailAddresses)
{
Name = nameInfo;
Organization = organizationInfo;
PhoneNumbers = phoneNumbers;
EmailAddresses = emailAddresses;
}
#endregion
}
}
|
namespace StressMeasurementSystem.Models
{
public class Contact
{
}
}
|
apache-2.0
|
C#
|
a2ad7d72e93a0ca50d7b587f0bc52449c4525317
|
update SpriteDivider
|
RyotaMurohoshi/character_animator_creator
|
unity/Assets/Editor/CharacterAnimatorCreator/SpriteDivider.cs
|
unity/Assets/Editor/CharacterAnimatorCreator/SpriteDivider.cs
|
using UnityEditor;
using UnityEngine;
using System.Linq;
public static class SpriteDivider
{
public static void DividSprite(string texturePath, int horizontalCount, int verticalCount)
{
var texture = AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture)) as Texture;
var pixelPerUnit = Mathf.Min(texture.width / horizontalCount, texture.height / verticalCount);
DividSprite(texturePath, horizontalCount, verticalCount, pixelPerUnit);
}
public static void DividSprite(string texturePath, int horizontalCount, int verticalCount, int pixelPerUnit)
{
var importer = TextureImporter.GetAtPath(texturePath) as TextureImporter;
importer.textureType = TextureImporterType.Sprite;
importer.spriteImportMode = SpriteImportMode.Multiple;
importer.filterMode = FilterMode.Point;
importer.mipmapEnabled = false;
Texture texture = AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture)) as Texture;
importer.spritePixelsPerUnit = pixelPerUnit;
importer.spritesheet = CreateSpriteMetaDataArray(texture, horizontalCount, verticalCount);
AssetDatabase.ImportAsset(texturePath, ImportAssetOptions.ForceUpdate);
}
static SpriteMetaData[] CreateSpriteMetaDataArray(Texture texture, int horizontalCount, int verticalCount)
{
float spriteWidth = texture.width / horizontalCount;
float spriteHeight = texture.height / verticalCount;
return Enumerable
.Range(0, horizontalCount * verticalCount)
.Select(index =>
{
int x = index % horizontalCount;
int y = index / horizontalCount;
return new SpriteMetaData
{
name = string.Format("{0}_{1}", texture.name, index),
rect = new Rect(spriteWidth * x, texture.height - spriteHeight * (y + 1), spriteWidth, spriteHeight)
};
})
.ToArray();
}
}
|
using UnityEditor;
using UnityEngine;
using System.Linq;
public static class SpriteDivider
{
public static void DividSprite(string texturePath, int horizontalCount, int verticalCount)
{
TextureImporter importer = TextureImporter.GetAtPath(texturePath) as TextureImporter;
importer.textureType = TextureImporterType.Sprite;
importer.spriteImportMode = SpriteImportMode.Multiple;
importer.filterMode = FilterMode.Point;
EditorUtility.SetDirty(importer);
AssetDatabase.ImportAsset(texturePath, ImportAssetOptions.ForceUpdate);
Texture texture = AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture)) as Texture;
importer.spritePixelsPerUnit = Mathf.Max(texture.width / horizontalCount, texture.height / verticalCount);
importer.spritesheet = CreateSpriteMetaDataArray(texture, horizontalCount, verticalCount);
EditorUtility.SetDirty(importer);
AssetDatabase.ImportAsset(texturePath, ImportAssetOptions.ForceUpdate);
}
static SpriteMetaData[] CreateSpriteMetaDataArray(Texture texture, int horizontalCount, int verticalCount)
{
float spriteWidth = texture.width / horizontalCount;
float spriteHeight = texture.height / verticalCount;
return Enumerable
.Range(0, horizontalCount * verticalCount)
.Select(index =>
{
int x = index % horizontalCount;
int y = index / horizontalCount;
return new SpriteMetaData
{
name = string.Format("{0}_{1}", texture.name, index),
rect = new Rect(spriteWidth * x, texture.height - spriteHeight * (y + 1), spriteWidth, spriteHeight)
};
})
.ToArray();
}
}
|
mit
|
C#
|
1a93813d4c20e5f87a99146e88cf1d85452c98ab
|
Update SeasonConverter.cs to include PRESEASON2015
|
Challengermode/RiotSharp,frederickrogan/RiotSharp,JanOuborny/RiotSharp,Shidesu/RiotSharp,florinciubotariu/RiotSharp,oisindoherty/RiotSharp,aktai0/RiotSharp,RodrigoArantes23/RiotSharp,Qinusty/RiotSharp,jono-90/RiotSharp,jessehallam/RiotSharp,BenFradet/RiotSharp,Oucema90/RiotSharp
|
RiotSharp/MatchEndpoint/Converters/SeasonConverter.cs
|
RiotSharp/MatchEndpoint/Converters/SeasonConverter.cs
|
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
namespace RiotSharp.MatchEndpoint
{
class SeasonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(string).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
JsonSerializer serializer)
{
var token = JToken.Load(reader);
if (token.Value<string>() == null) return null;
var str = token.Value<string>();
switch (str)
{
case "PRESEASON3":
return Season.PreSeason3;
case "SEASON3":
return Season.Season3;
case "PRESEASON2014":
return Season.PreSeason2014;
case "SEASON2014":
return Season.Season2014;
case "PRESEASON2015":
return Season.PreSeason2015;
default:
return null;
}
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
serializer.Serialize(writer, ((Season)value).ToString().ToUpper());
}
}
}
|
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
namespace RiotSharp.MatchEndpoint
{
class SeasonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(string).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
JsonSerializer serializer)
{
var token = JToken.Load(reader);
if (token.Value<string>() == null) return null;
var str = token.Value<string>();
switch (str)
{
case "PRESEASON3":
return Season.PreSeason3;
case "SEASON3":
return Season.Season3;
case "PRESEASON2014":
return Season.PreSeason2014;
case "SEASON2014":
return Season.Season2014;
default:
return null;
}
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
serializer.Serialize(writer, ((Season)value).ToString().ToUpper());
}
}
}
|
mit
|
C#
|
3ff2e87d18c3ca5d91f37a56458e6ded101e5a6a
|
Reduce a line length
|
vbfox/KitsuneRoslyn
|
TestDiagnostics/NoStringEmpty/NoStringEmptyCodeFix.cs
|
TestDiagnostics/NoStringEmpty/NoStringEmptyCodeFix.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
using BlackFox.Roslyn.TestDiagnostics.RoslynExtensions.SyntaxFactoryAdditions;
using BlackFox.Roslyn.TestDiagnostics.RoslynExtensions;
namespace BlackFox.Roslyn.TestDiagnostics.NoStringEmpty
{
[ExportCodeFixProvider(NoStringEmptyAnalyzer.DiagnosticId, LanguageNames.CSharp)]
public class NoStringEmptyCodeFix : ICodeFixProvider
{
public IEnumerable<string> GetFixableDiagnosticIds()
{
return new[] { NoStringEmptyAnalyzer.DiagnosticId };
}
LiteralExpressionSyntax emptyStringLiteralExpression = StringLiteralExpression("");
public async Task<IEnumerable<CodeAction>> GetFixesAsync(Document document, TextSpan span,
IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken)
{
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var stringEmptyExpression = diagnostics.First()
.GetAncestorSyntaxNode<MemberAccessExpressionSyntax>(root);
var action = CodeAction.Create(
"Use \"\"",
ReplaceWithEmptyStringLiteral(document, root, stringEmptyExpression));
return new[] { action };
}
private Solution ReplaceWithEmptyStringLiteral(Document document, SyntaxNode root,
MemberAccessExpressionSyntax stringEmptyExpression)
{
var finalExpression = emptyStringLiteralExpression.WithSameTriviaAs(stringEmptyExpression);
var newRoot = root.ReplaceNode<SyntaxNode, SyntaxNode>(stringEmptyExpression, finalExpression);
return document.WithSyntaxRoot(newRoot).Project.Solution;
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
using BlackFox.Roslyn.TestDiagnostics.RoslynExtensions.SyntaxFactoryAdditions;
using BlackFox.Roslyn.TestDiagnostics.RoslynExtensions;
namespace BlackFox.Roslyn.TestDiagnostics.NoStringEmpty
{
[ExportCodeFixProvider(NoStringEmptyAnalyzer.DiagnosticId, LanguageNames.CSharp)]
public class NoStringEmptyCodeFix : ICodeFixProvider
{
public IEnumerable<string> GetFixableDiagnosticIds()
{
return new[] { NoStringEmptyAnalyzer.DiagnosticId };
}
LiteralExpressionSyntax emptyStringLiteralExpression = StringLiteralExpression("");
public async Task<IEnumerable<CodeAction>> GetFixesAsync(Document document, TextSpan span,
IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken)
{
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var stringEmptyExpression = diagnostics.First().GetAncestorSyntaxNode<MemberAccessExpressionSyntax>(root);
var action = CodeAction.Create(
"Use \"\"",
ReplaceWithEmptyStringLiteral(document, root, stringEmptyExpression));
return new[] { action };
}
private Solution ReplaceWithEmptyStringLiteral(Document document, SyntaxNode root,
MemberAccessExpressionSyntax stringEmptyExpression)
{
var finalExpression = emptyStringLiteralExpression.WithSameTriviaAs(stringEmptyExpression);
var newRoot = root.ReplaceNode<SyntaxNode, SyntaxNode>(stringEmptyExpression, finalExpression);
return document.WithSyntaxRoot(newRoot).Project.Solution;
}
}
}
|
bsd-2-clause
|
C#
|
6d0ad74156041f0f74d0b35d31a5b76b25dcb6a7
|
Make sample app more helpful
|
abstractspoon/ToDoList_Plugins,abstractspoon/ToDoList_Plugins,abstractspoon/ToDoList_Plugins
|
ImportExport/SampleImpExp/SampleImpExpCore/SampleImpExpCore.cs
|
ImportExport/SampleImpExp/SampleImpExpCore/SampleImpExpCore.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Abstractspoon.Tdl.PluginHelpers;
namespace SampleImpExp
{
public class SampleImpExpCore
{
public bool Export(TaskList srcTasks, string sDestFilePath, bool bSilent, Preferences prefs, string sKey)
{
// Possibly display a dialog to get input on how to
// map ToDoList task attributes to the output format
// TODO
// Process the tasks
Task task = srcTasks.GetFirstTask();
while (task.IsValid())
{
if (!ExportTask(task /*, probably with some additional parameters*/ ))
{
// Decide whether to stop or not
// TODO
}
task = task.GetNextTask();
}
return true;
}
protected bool ExportTask(Task task /*, probably with some additional parameters*/)
{
// TODO
return true;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Abstractspoon.Tdl.PluginHelpers;
namespace SampleImpExp
{
public class SampleImpExpCore
{
public bool Export(TaskList srcTasks, string sDestFilePath, bool bSilent, Preferences prefs, string sKey)
{
int nVal = prefs.GetProfileInt("bob", "dave", 20);
int nVal2 = prefs.GetProfileInt("bob", "phil", 20);
// add some dummy values to prefs
prefs.WriteProfileInt("bob", "dave", 10);
Task task = srcTasks.GetFirstTask();
String sTitle = task.GetTitle();
return true;
}
}
}
|
epl-1.0
|
C#
|
5ce9dc84e6c761152e5cb293b5501ce09f40c372
|
Fix the deserializatio
|
flagbug/Espera.Network
|
Espera.Network/NetworkPlaylist.cs
|
Espera.Network/NetworkPlaylist.cs
|
using System.Collections.ObjectModel;
namespace Espera.Network
{
public class NetworkPlaylist
{
public int? CurrentIndex { get; set; }
public string Name { get; set; }
public int? RemainingVotes { get; set; }
public ReadOnlyCollection<NetworkSong> Songs { get; set; }
}
}
|
using System.Collections.Generic;
namespace Espera.Network
{
public class NetworkPlaylist
{
public int? CurrentIndex { get; set; }
public string Name { get; set; }
public int? RemainingVotes { get; set; }
public IReadOnlyList<NetworkSong> Songs { get; set; }
}
}
|
mit
|
C#
|
d7d825ca4a4884c3feaa5267e6ee0729ae786c97
|
Update Base62CorrelationService.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Integration/Correlation/Base62CorrelationService.cs
|
TIKSN.Core/Integration/Correlation/Base62CorrelationService.cs
|
using Base62;
using Microsoft.Extensions.Options;
using System;
using System.Globalization;
using System.Numerics;
using TIKSN.Serialization.Numerics;
namespace TIKSN.Integration.Correlation
{
public class Base62CorrelationService : ICorrelationService
{
private readonly Base62Converter _base62Converter;
private readonly IOptions<Base62CorrelationServiceOptions> _base62CorrelationServiceOptions;
private readonly Random _random;
private readonly UnsignedBigIntegerBinaryDeserializer _unsignedBigIntegerBinaryDeserializer;
private readonly UnsignedBigIntegerBinarySerializer _unsignedBigIntegerBinarySerializer;
public Base62CorrelationService(
Random random,
IOptions<Base62CorrelationServiceOptions> base62CorrelationServiceOptions,
Base62Converter base62Converter,
UnsignedBigIntegerBinarySerializer unsignedBigIntegerBinarySerializer,
UnsignedBigIntegerBinaryDeserializer unsignedBigIntegerBinaryDeserializer)
{
_random = random ?? throw new ArgumentNullException(nameof(random));
_base62CorrelationServiceOptions = base62CorrelationServiceOptions ?? throw new ArgumentNullException(nameof(base62CorrelationServiceOptions));
_base62Converter = base62Converter ?? throw new ArgumentNullException(nameof(base62Converter));
_unsignedBigIntegerBinarySerializer = unsignedBigIntegerBinarySerializer ?? throw new ArgumentNullException(nameof(unsignedBigIntegerBinarySerializer));
_unsignedBigIntegerBinaryDeserializer = unsignedBigIntegerBinaryDeserializer ?? throw new ArgumentNullException(nameof(unsignedBigIntegerBinaryDeserializer));
}
public CorrelationID Create(string stringRepresentation)
{
var number = BigInteger.Parse(stringRepresentation, CultureInfo.InvariantCulture);
byte[] byteArrayRepresentation = _unsignedBigIntegerBinarySerializer.Serialize(number);
return new CorrelationID(stringRepresentation, byteArrayRepresentation);
}
public CorrelationID Create(byte[] byteArrayRepresentation)
{
_random.NextBytes(byteArrayRepresentation);
var number = _unsignedBigIntegerBinaryDeserializer.Deserialize(byteArrayRepresentation);
string stringRepresentation = _base62Converter.Encode(number.ToString(CultureInfo.InvariantCulture));
return new CorrelationID(stringRepresentation, byteArrayRepresentation);
}
public CorrelationID Generate()
{
var byteArrayRepresentation = new byte[_base62CorrelationServiceOptions.Value.ByteLength];
_random.NextBytes(byteArrayRepresentation);
var number = _unsignedBigIntegerBinaryDeserializer.Deserialize(byteArrayRepresentation);
string stringRepresentation = _base62Converter.Encode(number.ToString(CultureInfo.InvariantCulture));
return new CorrelationID(stringRepresentation, byteArrayRepresentation);
}
}
}
|
using Microsoft.Extensions.Options;
using System;
namespace TIKSN.Integration.Correlation
{
public class Base62CorrelationService
{
private readonly Random _random;
private readonly IOptions<Base62CorrelationServiceOptions> _base62CorrelationServiceOptions;
public Base62CorrelationService(Random random, IOptions<Base62CorrelationServiceOptions> base62CorrelationServiceOptions)
{
_random = random ?? throw new ArgumentNullException(nameof(random));
_base62CorrelationServiceOptions = base62CorrelationServiceOptions ?? throw new ArgumentNullException(nameof(base62CorrelationServiceOptions));
}
}
}
|
mit
|
C#
|
99e46cd26b30007f1f919840711814a58bbbc51d
|
Fix missing `BeatmapMetadata.ToString`
|
NeoAdonis/osu,ppy/osu,ppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,peppy/osu
|
osu.Game/Beatmaps/BeatmapMetadata.cs
|
osu.Game/Beatmaps/BeatmapMetadata.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 Newtonsoft.Json;
using osu.Framework.Testing;
using osu.Game.Models;
using osu.Game.Users;
using Realms;
#nullable enable
namespace osu.Game.Beatmaps
{
[ExcludeFromDynamicCompile]
[Serializable]
[MapTo("BeatmapMetadata")]
public class BeatmapMetadata : RealmObject, IBeatmapMetadataInfo
{
public string Title { get; set; } = string.Empty;
[JsonProperty("title_unicode")]
public string TitleUnicode { get; set; } = string.Empty;
public string Artist { get; set; } = string.Empty;
[JsonProperty("artist_unicode")]
public string ArtistUnicode { get; set; } = string.Empty;
public RealmUser Author { get; set; } = new RealmUser();
public string Source { get; set; } = string.Empty;
[JsonProperty(@"tags")]
public string Tags { get; set; } = string.Empty;
/// <summary>
/// The time in milliseconds to begin playing the track for preview purposes.
/// If -1, the track should begin playing at 40% of its length.
/// </summary>
public int PreviewTime { get; set; }
public string AudioFile { get; set; } = string.Empty;
public string BackgroundFile { get; set; } = string.Empty;
IUser IBeatmapMetadataInfo.Author => Author;
#region Compatibility properties
public string AuthorString
{
get => Author.Username;
set => Author.Username = value;
}
#endregion
public override string ToString() => this.GetDisplayTitle();
}
}
|
// 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 Newtonsoft.Json;
using osu.Framework.Testing;
using osu.Game.Models;
using osu.Game.Users;
using Realms;
#nullable enable
namespace osu.Game.Beatmaps
{
[ExcludeFromDynamicCompile]
[Serializable]
[MapTo("BeatmapMetadata")]
public class BeatmapMetadata : RealmObject, IBeatmapMetadataInfo
{
public string Title { get; set; } = string.Empty;
[JsonProperty("title_unicode")]
public string TitleUnicode { get; set; } = string.Empty;
public string Artist { get; set; } = string.Empty;
[JsonProperty("artist_unicode")]
public string ArtistUnicode { get; set; } = string.Empty;
public RealmUser Author { get; set; } = new RealmUser();
public string Source { get; set; } = string.Empty;
[JsonProperty(@"tags")]
public string Tags { get; set; } = string.Empty;
/// <summary>
/// The time in milliseconds to begin playing the track for preview purposes.
/// If -1, the track should begin playing at 40% of its length.
/// </summary>
public int PreviewTime { get; set; }
public string AudioFile { get; set; } = string.Empty;
public string BackgroundFile { get; set; } = string.Empty;
IUser IBeatmapMetadataInfo.Author => Author;
#region Compatibility properties
public string AuthorString
{
get => Author.Username;
set => Author.Username = value;
}
#endregion
}
}
|
mit
|
C#
|
9d0a6de26e6039cf87dfd8c64f1f0ffb7f3643d1
|
Fix SkinnableSprite initialising a drawable even when the texture is not available
|
smoogipoo/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,peppy/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,ppy/osu,UselessToucan/osu
|
osu.Game/Skinning/SkinnableSprite.cs
|
osu.Game/Skinning/SkinnableSprite.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Skinning
{
/// <summary>
/// A skinnable element which uses a stable sprite and can therefore share implementation logic.
/// </summary>
public class SkinnableSprite : SkinnableDrawable
{
protected override bool ApplySizeRestrictionsToDefault => true;
[Resolved]
private TextureStore textures { get; set; }
public SkinnableSprite(string textureName, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.NoScaling)
: base(new SpriteComponent(textureName), allowFallback, confineMode)
{
}
protected override Drawable CreateDefault(ISkinComponent component)
{
var texture = textures.Get(component.LookupName);
if (texture == null)
return null;
return new Sprite { Texture = texture };
}
private class SpriteComponent : ISkinComponent
{
public SpriteComponent(string textureName)
{
LookupName = textureName;
}
public string LookupName { get; }
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Skinning
{
/// <summary>
/// A skinnable element which uses a stable sprite and can therefore share implementation logic.
/// </summary>
public class SkinnableSprite : SkinnableDrawable
{
protected override bool ApplySizeRestrictionsToDefault => true;
[Resolved]
private TextureStore textures { get; set; }
public SkinnableSprite(string textureName, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.NoScaling)
: base(new SpriteComponent(textureName), allowFallback, confineMode)
{
}
protected override Drawable CreateDefault(ISkinComponent component) => new Sprite { Texture = textures.Get(component.LookupName) };
private class SpriteComponent : ISkinComponent
{
public SpriteComponent(string textureName)
{
LookupName = textureName;
}
public string LookupName { get; }
}
}
}
|
mit
|
C#
|
3418f94a9e72ced41b677b6454f32f9c61997b73
|
Remove caching layer
|
adamcaudill/libsodium-net,deckar01/libsodium-net,tabrath/libsodium-core,BurningEnlightenment/libsodium-net,fraga/libsodium-net,bitbeans/libsodium-net,BurningEnlightenment/libsodium-net,fraga/libsodium-net,bitbeans/libsodium-net,deckar01/libsodium-net,adamcaudill/libsodium-net
|
libsodium-net/DynamicInvoke.cs
|
libsodium-net/DynamicInvoke.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
namespace Sodium
{
internal static class DynamicInvoke
{
//shamelessly copied from https://stackoverflow.com/a/1660807/230543
public static T GetDynamicInvoke<T>(string function, string library)
{
// create in-memory assembly, module and type
var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
new AssemblyName("DynamicDllInvoke"),
AssemblyBuilderAccess.Run);
var modBuilder = assemblyBuilder.DefineDynamicModule("DynamicDllModule");
// note: without TypeBuilder, you can create global functions
// on the module level, but you cannot create delegates to them
var typeBuilder = modBuilder.DefineType(
"DynamicDllInvokeType",
TypeAttributes.Public | TypeAttributes.UnicodeClass);
// get params from delegate dynamically (!), trick from Eric Lippert
var delegateMi = typeof(T).GetMethod("Invoke");
var delegateParams = (from param in delegateMi.GetParameters()
select param.ParameterType).ToArray();
// automatically create the correct signagure for PInvoke
var methodBuilder = typeBuilder.DefinePInvokeMethod(
function,
library,
MethodAttributes.Public |
MethodAttributes.Static |
MethodAttributes.PinvokeImpl,
CallingConventions.Standard,
delegateMi.ReturnType, /* the return type */
delegateParams, /* array of parameters from delegate T */
CallingConvention.Cdecl,
CharSet.Ansi);
// needed according to MSDN
methodBuilder.SetImplementationFlags(methodBuilder.GetMethodImplementationFlags() | MethodImplAttributes.PreserveSig);
var dynamicType = typeBuilder.CreateType();
var methodInfo = dynamicType.GetMethod(function);
// create the delegate of type T, double casting is necessary
return (T)(object)Delegate.CreateDelegate(typeof(T), methodInfo, true);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
namespace Sodium
{
internal static class DynamicInvoke
{
private static readonly Dictionary<string, Delegate> _cache = new Dictionary<string, Delegate>();
public static T GetDynamicInvoke<T>(string function, string library)
{
var key = string.Format("{0}@{1}", function, library);
if (!_cache.ContainsKey(key))
{
_cache.Add(key, (Delegate)(object)_CreateDynamicDllInvoke<T>(function, library));
}
return (T)(object)_cache[key];
}
//shamelessly copied from https://stackoverflow.com/a/1660807/230543
private static T _CreateDynamicDllInvoke<T>(string functionName, string library)
{
// create in-memory assembly, module and type
var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
new AssemblyName("DynamicDllInvoke"),
AssemblyBuilderAccess.Run);
var modBuilder = assemblyBuilder.DefineDynamicModule("DynamicDllModule");
// note: without TypeBuilder, you can create global functions
// on the module level, but you cannot create delegates to them
var typeBuilder = modBuilder.DefineType(
"DynamicDllInvokeType",
TypeAttributes.Public | TypeAttributes.UnicodeClass);
// get params from delegate dynamically (!), trick from Eric Lippert
var delegateMi = typeof(T).GetMethod("Invoke");
var delegateParams = (from param in delegateMi.GetParameters()
select param.ParameterType).ToArray();
// automatically create the correct signagure for PInvoke
var methodBuilder = typeBuilder.DefinePInvokeMethod(
functionName,
library,
MethodAttributes.Public |
MethodAttributes.Static |
MethodAttributes.PinvokeImpl,
CallingConventions.Standard,
delegateMi.ReturnType, /* the return type */
delegateParams, /* array of parameters from delegate T */
CallingConvention.Cdecl,
CharSet.Ansi);
// needed according to MSDN
methodBuilder.SetImplementationFlags(methodBuilder.GetMethodImplementationFlags() | MethodImplAttributes.PreserveSig);
var dynamicType = typeBuilder.CreateType();
var methodInfo = dynamicType.GetMethod(functionName);
// create the delegate of type T, double casting is necessary
return (T)(object)Delegate.CreateDelegate(typeof(T), methodInfo, true);
}
}
}
|
mit
|
C#
|
f7b5ce0d12ff78c98fbf866c6b04a5837bd3ca8b
|
Fix for issue 96 Home link does not work from Volunteer Home screen
|
andrewhart098/crisischeckin,djjlewis/crisischeckin,lloydfaulkner/crisischeckin,mjmilan/crisischeckin,pottereric/crisischeckin,brunck/crisischeckin,brunck/crisischeckin,mjmilan/crisischeckin,andrewhart098/crisischeckin,jplwood/crisischeckin,pooran/crisischeckin,RyanBetker/crisischeckinUpdates,HTBox/crisischeckin,andrewhart098/crisischeckin,MobileRez/crisischeckin,RyanBetker/crisischeckin,djjlewis/crisischeckin,coridrew/crisischeckin,HTBox/crisischeckin,mjmilan/crisischeckin,mheggeseth/crisischeckin,RyanBetker/crisischeckin,HTBox/crisischeckin,brunck/crisischeckin,jsucupira/crisischeckin,jplwood/crisischeckin,pooran/crisischeckin,MobileRez/crisischeckin,coridrew/crisischeckin,jsucupira/crisischeckin,mheggeseth/crisischeckin,pottereric/crisischeckin,RyanBetker/crisischeckinUpdates,lloydfaulkner/crisischeckin
|
crisischeckin/crisicheckinweb/Views/Shared/_AdminLayout.cshtml
|
crisischeckin/crisicheckinweb/Views/Shared/_AdminLayout.cshtml
|
@using System.Web.Optimization
@using crisicheckinweb.Controllers
@{
Layout = "/Views/Shared/_Layout.cshtml";
}
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="/Disaster/List">Crisis Check-In Admin</a>
<div class="nav-collapse collapse">
<ul class="nav">
@Html.MenuItem("Home (Disaster List)", "List", "Disaster")
@Html.MenuItem("View Volunteers", "ListbyDisaster", "Volunteer")
</ul>
<div id="loginStatus" class="navbar-form pull-right" style="font-weight:300; color:white; padding-top:10px;">
@Html.Partial("_LoginStatus")
</div>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container">
@RenderBody()
</div>
|
@using System.Web.Optimization
@using crisicheckinweb.Controllers
@{
Layout = "/Views/Shared/_Layout.cshtml";
}
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="/Disaster/List">Crisis Check-In Admin</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a href="/">Home</a></li>
@Html.MenuItem("Disaster List", "List", "Disaster")
@Html.MenuItem("View Volunteers", "ListbyDisaster", "Volunteer")
</ul>
<div id="loginStatus" class="navbar-form pull-right" style="font-weight:300; color:white; padding-top:10px;">
@Html.Partial("_LoginStatus")
</div>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container">
@RenderBody()
</div>
|
apache-2.0
|
C#
|
ed943007b8a4c7445feb29773ede500becf5334c
|
fix Upgrade_20211219_Microsoft
|
signumsoftware/framework,signumsoftware/framework
|
Signum.Upgrade/Upgrades/Upgrade_20211219_Microsoft.Data.SqlClient.cs
|
Signum.Upgrade/Upgrades/Upgrade_20211219_Microsoft.Data.SqlClient.cs
|
namespace Signum.Upgrade.Upgrades;
//https://techcommunity.microsoft.com/t5/sql-server-blog/released-general-availability-of-microsoft-data-sqlclient-4-0/ba-p/2983346
class Upgrade_20211219_MicrosoftDataSqlClient : CodeUpgradeBase
{
public override string Description => "Microsoft.Data.SqlClient (Encrypt = true by default)";
public override void Execute(UpgradeContext uctx)
{
uctx.ForeachCodeFile(@"*.csproj", file =>
{
file.UpdateNugetReference("Microsoft.Data.SqlClient", "4.0.0");
file.UpdateNugetReference("DocumentFormat.OpenXml", "2.14.0");
file.UpdateNugetReference("Microsoft.Graph", "4.11.0");
});
uctx.ForeachCodeFile(@"*.json", file =>
{
file.Replace("Integrated Security=true", "Integrated Security=true;TrustServerCertificate=true");
});
}
}
|
namespace Signum.Upgrade.Upgrades;
//https://techcommunity.microsoft.com/t5/sql-server-blog/released-general-availability-of-microsoft-data-sqlclient-4-0/ba-p/2983346
class Upgrade_20211219_MicrosoftDataSqlClient : CodeUpgradeBase
{
public override string Description => "Microsoft.Data.SqlClient (Encrypt = true by default)";
public override void Execute(UpgradeContext uctx)
{
uctx.ForeachCodeFile(@"*.csproj", file =>
{
file.UpdateNugetReference("Microsoft.Data.SqlClient", "4.0.0");
file.UpdateNugetReference("DocumentFormat.OpenXml", "2.14.0");
});
uctx.ForeachCodeFile(@"*.json", file =>
{
file.Replace("Integrated Security=true", "Integrated Security=true;TrustServerCertificate=true");
});
}
}
|
mit
|
C#
|
fcf83c35c8f6199a4077d9bf589c40e4c286ae16
|
Make transaction roll back per default until we figure out what to do
|
Shaddix/realm-dotnet,Shaddix/realm-dotnet,realm/realm-dotnet,realm/realm-dotnet,Shaddix/realm-dotnet,realm/realm-dotnet,Shaddix/realm-dotnet
|
realm/RealmNet.Shared/Transaction.cs
|
realm/RealmNet.Shared/Transaction.cs
|
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace RealmNet
{
public class Transaction : IDisposable
{
private SharedRealmHandle _sharedRealmHandle;
private bool _isOpen;
internal Transaction(SharedRealmHandle sharedRealmHandle)
{
this._sharedRealmHandle = sharedRealmHandle;
NativeSharedRealm.begin_transaction(sharedRealmHandle);
_isOpen = true;
}
public void Dispose()
{
if (!_isOpen)
return;
//var exceptionOccurred = Marshal.GetExceptionPointers() != IntPtr.Zero || Marshal.GetExceptionCode() != 0;
var exceptionOccurred = true; // TODO: Can we find this out on iOS? Otherwise, we have to remove it!
if (exceptionOccurred)
Rollback();
else
Commit();
}
public void Rollback()
{
if (!_isOpen)
throw new Exception("Transaction was already closed. Cannot roll back");
NativeSharedRealm.cancel_transaction(_sharedRealmHandle);
_isOpen = false;
}
public void Commit()
{
if (!_isOpen)
throw new Exception("Transaction was already closed. Cannot commit");
NativeSharedRealm.commit_transaction(_sharedRealmHandle);
_isOpen = false;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace RealmNet
{
public class Transaction : IDisposable
{
private SharedRealmHandle _sharedRealmHandle;
private bool _isOpen;
internal Transaction(SharedRealmHandle sharedRealmHandle)
{
this._sharedRealmHandle = sharedRealmHandle;
NativeSharedRealm.begin_transaction(sharedRealmHandle);
_isOpen = true;
}
public void Dispose()
{
if (!_isOpen)
return;
var exceptionOccurred = Marshal.GetExceptionPointers() != IntPtr.Zero || Marshal.GetExceptionCode() != 0;
if (exceptionOccurred)
Rollback();
else
Commit();
}
public void Rollback()
{
if (!_isOpen)
throw new Exception("Transaction was already closed. Cannot roll back");
NativeSharedRealm.cancel_transaction(_sharedRealmHandle);
_isOpen = false;
}
public void Commit()
{
if (!_isOpen)
throw new Exception("Transaction was already closed. Cannot commit");
NativeSharedRealm.commit_transaction(_sharedRealmHandle);
_isOpen = false;
}
}
}
|
apache-2.0
|
C#
|
d4ec7939c56ce2033f716c4e1cddfa04659e9bc4
|
Add RemoveComponent<T>
|
florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho
|
bindings/src/Node.cs
|
bindings/src/Node.cs
|
//
// Node C# sugar
//
// Authors:
// Miguel de Icaza (miguel@xamarin.com)
//
// Copyrigh 2015 Xamarin INc
//
using System;
using static System.Console;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Reflection;
namespace Urho {
internal partial class NodeHelper {
[DllImport ("mono-urho")]
internal extern static IntPtr urho_node_get_components(IntPtr node, int code, int recursive, out int count);
}
public partial class Node {
static Node[] ZeroArray = new Node[0];
public Node[] GetChildrenWithComponent<T> (bool recursive = false) where T: Component
{
var stringhash = Runtime.LookupStringHash (typeof (T));
int count;
var ptr = NodeHelper.urho_node_get_components (handle, stringhash.Code, recursive ? 1 : 0, out count);
if (ptr == IntPtr.Zero)
return ZeroArray;
var res = new Node[count];
for (int i = 0; i < count; i++){
var node = Marshal.ReadIntPtr (ptr, i);
res [i] = Runtime.LookupObject<Node> (node);
}
return res;
}
public T CreateComponent<T> (StringHash type, CreateMode mode = CreateMode.REPLICATED, uint id = 0) where T:Component
{
var ptr = Node_CreateComponent (handle, type.Code, mode, id);
return Runtime.LookupObject<T> (ptr);
}
public void RemoveComponent<T> ()
{
var stringHash = Runtime.LookupStringHash (typeof (T));
RemoveComponent (stringHash);
}
public T CreateComponent<T> (CreateMode mode = CreateMode.REPLICATED, uint id = 0) where T:Component
{
var stringhash = Runtime.LookupStringHash (typeof (T));
var ptr = Node_CreateComponent (handle, stringhash.Code, mode, id);
return Runtime.LookupObject<T> (ptr);
}
public void AddComponent (Component component, uint id = 0)
{
AddComponent (component, id, CreateMode.REPLICATED);
}
// Parameters are swapped, so I can use default parameters vs the other method signature
public Node CreateChild (string name = "", uint id = 0, CreateMode mode = CreateMode.REPLICATED)
{
return CreateChild (name, mode, id);
}
public T GetComponent<T> () where T:Component
{
var stringHash = Runtime.LookupStringHash (typeof (T));
var ptr = Node_GetComponent (handle, stringHash.Code);
return Runtime.LookupObject<T> (ptr);
}
}
}
|
//
// Node C# sugar
//
// Authors:
// Miguel de Icaza (miguel@xamarin.com)
//
// Copyrigh 2015 Xamarin INc
//
using System;
using static System.Console;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Reflection;
namespace Urho {
internal partial class NodeHelper {
[DllImport ("mono-urho")]
internal extern static IntPtr urho_node_get_components(IntPtr node, int code, int recursive, out int count);
}
public partial class Node {
static Node[] ZeroArray = new Node[0];
public Node[] GetChildrenWithComponent<T> (bool recursive = false) where T: Component
{
var stringhash = Runtime.LookupStringHash (typeof (T));
int count;
var ptr = NodeHelper.urho_node_get_components (handle, stringhash.Code, recursive ? 1 : 0, out count);
if (ptr == IntPtr.Zero)
return ZeroArray;
var res = new Node[count];
for (int i = 0; i < count; i++){
var node = Marshal.ReadIntPtr (ptr, i);
res [i] = Runtime.LookupObject<Node> (node);
}
return res;
}
public T CreateComponent<T> (StringHash type, CreateMode mode = CreateMode.REPLICATED, uint id = 0) where T:Component
{
var ptr = Node_CreateComponent (handle, type.Code, mode, id);
return Runtime.LookupObject<T> (ptr);
}
public T CreateComponent<T> (CreateMode mode = CreateMode.REPLICATED, uint id = 0) where T:Component
{
var stringhash = Runtime.LookupStringHash (typeof (T));
var ptr = Node_CreateComponent (handle, stringhash.Code, mode, id);
return Runtime.LookupObject<T> (ptr);
}
public void AddComponent (Component component, uint id = 0)
{
AddComponent (component, id, CreateMode.REPLICATED);
}
// Parameters are swapped, so I can use default parameters vs the other method signature
public Node CreateChild (string name = "", uint id = 0, CreateMode mode = CreateMode.REPLICATED)
{
return CreateChild (name, mode, id);
}
public T GetComponent<T> () where T:Component
{
var stringHash = Runtime.LookupStringHash (typeof (T));
var ptr = Node_GetComponent (handle, stringHash.Code);
return Runtime.LookupObject<T> (ptr);
}
}
}
|
mit
|
C#
|
2a31a3ae4d85d990a22b48846258c9d38eb3735c
|
Disable VS ZoneMarker for Rider
|
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
|
resharper/src/resharper-unity/VisualStudio/ZoneMarker.cs
|
resharper/src/resharper-unity/VisualStudio/ZoneMarker.cs
|
using JetBrains.Application.BuildScript.Application.Zones;
using JetBrains.VsIntegration.Shell.Zones;
// It would be nice to use zones properly here, but
// a) it's really hard :(
// b) Code Cleanup uses XAML serialisers that don't respect zones and try
// to resolve all types causing problems for Rider, which doesn't have
// any VS libraries, such as VS.Platform.Core
#if !RIDER
namespace JetBrains.ReSharper.Plugins.Unity.VisualStudio
{
[ZoneMarker]
public class ZoneMarker : IRequire<IVisualStudioZone>
{
}
}
#endif
|
using JetBrains.Application.BuildScript.Application.Zones;
using JetBrains.VsIntegration.Shell.Zones;
namespace JetBrains.ReSharper.Plugins.Unity.VisualStudio
{
[ZoneMarker]
public class ZoneMarker : IRequire<IVisualStudioZone>
{
}
}
|
apache-2.0
|
C#
|
11eb6a86bcc2acdeee5ab3581e4c16e32862b4ec
|
Edit plug
|
CosmosOS/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos
|
source/Cosmos.System2_Plugs/Interop/System.NativeImpl.cs
|
source/Cosmos.System2_Plugs/Interop/System.NativeImpl.cs
|
using IL2CPU.API.Attribs;
using System;
using System.IO;
namespace Cosmos.System_Plugs.Interop
{
[Plug("Interop+Sys, System.Private.CoreLib")]
class SysImpl
{
[PlugMethod(Signature = "System_Void__Interop_Sys_GetNonCryptographicallySecureRandomBytes_System_Byte___System_Int32_")]
public static unsafe void GetNonCryptographicallySecureRandomBytes(byte* buffer, int length)
{
throw new NotImplementedException();
}
}
}
|
using IL2CPU.API.Attribs;
using System;
using System.IO;
namespace Cosmos.System_Plugs.Interop
{
[Plug("Interop+Sys", IsOptional = true)]
class SysImpl
{
[PlugMethod(Signature = "System_Void__Interop_Sys_GetNonCryptographicallySecureRandomBytes_System_Byte#__System_Int32_")]
public static unsafe void GetNonCryptographicallySecureRandomBytes(byte* buffer, int length)
{
throw new NotImplementedException();
}
}
}
|
bsd-3-clause
|
C#
|
2e5d3d2bea021f330fd209c053bc09839a53a125
|
Remove obsolete delivery model names
|
SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments
|
src/CommitmentsV2/SFA.DAS.CommitmentsV2.Types/DeliveryModel.cs
|
src/CommitmentsV2/SFA.DAS.CommitmentsV2.Types/DeliveryModel.cs
|
using System.Text.Json.Serialization;
namespace SFA.DAS.CommitmentsV2.Types
{
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum DeliveryModel : byte
{
Regular = 0,
PortableFlexiJob = 1,
}
}
|
using System;
using System.Text.Json.Serialization;
namespace SFA.DAS.CommitmentsV2.Types
{
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum DeliveryModel : byte
{
Regular = 0,
PortableFlexiJob = 1,
[Obsolete("Use `Regular` instead of `Normal`", true)]
Normal = Regular,
[Obsolete("Use `PortableFlexiJob` instead of `Flexible`", true)]
Flexible = PortableFlexiJob,
}
}
|
mit
|
C#
|
a6cafd3b44f53c14683e2dfbcc4cd86eb0f1d222
|
Change AssemblyCompany to .NET Foundation
|
kali786516/kudu,shibayan/kudu,juvchan/kudu,sitereactor/kudu,projectkudu/kudu,mauricionr/kudu,kali786516/kudu,duncansmart/kudu,duncansmart/kudu,kenegozi/kudu,projectkudu/kudu,juvchan/kudu,puneet-gupta/kudu,YOTOV-LIMITED/kudu,badescuga/kudu,barnyp/kudu,uQr/kudu,puneet-gupta/kudu,bbauya/kudu,projectkudu/kudu,barnyp/kudu,badescuga/kudu,juvchan/kudu,uQr/kudu,YOTOV-LIMITED/kudu,juoni/kudu,badescuga/kudu,MavenRain/kudu,barnyp/kudu,mauricionr/kudu,projectkudu/kudu,juoni/kudu,dev-enthusiast/kudu,MavenRain/kudu,uQr/kudu,kenegozi/kudu,bbauya/kudu,shibayan/kudu,shibayan/kudu,chrisrpatterson/kudu,YOTOV-LIMITED/kudu,dev-enthusiast/kudu,juvchan/kudu,shrimpy/kudu,MavenRain/kudu,oliver-feng/kudu,duncansmart/kudu,shrimpy/kudu,barnyp/kudu,shrimpy/kudu,puneet-gupta/kudu,bbauya/kudu,puneet-gupta/kudu,chrisrpatterson/kudu,kenegozi/kudu,juoni/kudu,EricSten-MSFT/kudu,oliver-feng/kudu,projectkudu/kudu,kali786516/kudu,sitereactor/kudu,sitereactor/kudu,shrimpy/kudu,badescuga/kudu,chrisrpatterson/kudu,duncansmart/kudu,mauricionr/kudu,juoni/kudu,badescuga/kudu,sitereactor/kudu,dev-enthusiast/kudu,MavenRain/kudu,mauricionr/kudu,shibayan/kudu,puneet-gupta/kudu,EricSten-MSFT/kudu,EricSten-MSFT/kudu,YOTOV-LIMITED/kudu,chrisrpatterson/kudu,kenegozi/kudu,uQr/kudu,sitereactor/kudu,EricSten-MSFT/kudu,oliver-feng/kudu,oliver-feng/kudu,shibayan/kudu,kali786516/kudu,juvchan/kudu,bbauya/kudu,EricSten-MSFT/kudu,dev-enthusiast/kudu
|
Common/CommonAssemblyInfo.cs
|
Common/CommonAssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany(".NET Foundation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]
// If you change this version, make sure to change Build\build.proj accordingly
[assembly: AssemblyVersion("45.0.0.0")]
[assembly: AssemblyFileVersion("45.0.0.0")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Outercurve Foundation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]
// If you change this version, make sure to change Build\build.proj accordingly
[assembly: AssemblyVersion("45.0.0.0")]
[assembly: AssemblyFileVersion("45.0.0.0")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
|
apache-2.0
|
C#
|
ca441db076dfc5229ae9cb36eeb10499664c191f
|
修正笔误。 :hankey: :hatched_chick:
|
huoxudong125/Zongsoft.CoreLibrary,Zongsoft/Zongsoft.CoreLibrary
|
src/Runtime/Serialization/SerializationMemberBehavior.cs
|
src/Runtime/Serialization/SerializationMemberBehavior.cs
|
/*
* Authors:
* 钟峰(Popeye Zhong) <zongsoft@gmail.com>
*
* Copyright (C) 2015 Zongsoft Corporation <http://www.zongsoft.com>
*
* This file is part of Zongsoft.CoreLibrary.
*
* Zongsoft.CoreLibrary is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Zongsoft.CoreLibrary is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Zongsoft.CoreLibrary; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.ComponentModel;
namespace Zongsoft.Runtime.Serialization
{
public enum SerializationMemberBehavior
{
Ignored,
Required,
}
}
|
/*
* Authors:
* 钟峰(Popeye Zhong) <zongsoft@gmail.com>
*
* Copyright (C) 2015 Zongsoft Corporation <http://www.zongsoft.com>
*
* This file is part of Zongsoft.CoreLibrary.
*
* Zongsoft.CoreLibrary is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Zongsoft.CoreLibrary is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Zongsoft.CoreLibrary; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.ComponentModel;
namespace Zongsoft.Runtime.Serialization
{
public enum SerializationMemberBehavior
{
Ignore,
Required,
}
}
|
lgpl-2.1
|
C#
|
6e32557be3d36f8c867e95d1f7527fcc2bbb95ca
|
Fix spelling error
|
UselessToucan/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,EVAST9919/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,peppy/osu,2yangk23/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu,UselessToucan/osu,johnneijzen/osu,2yangk23/osu,johnneijzen/osu,NeoAdonis/osu,UselessToucan/osu,EVAST9919/osu
|
osu.Android/OsuGameActivity.cs
|
osu.Android/OsuGameActivity.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 Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;
using osu.Framework.Android;
namespace osu.Android
{
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullSensor, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = true)]
public class OsuGameActivity : AndroidGameActivity
{
protected override Framework.Game CreateGame() => new OsuGameAndroid();
protected override void OnCreate(Bundle savedInstanceState)
{
// The default current directory on android is '/'.
// On some devices '/' maps to the app data directory. On others it maps to the root of the internal storage.
// In order to have a consistent current directory on all devices the full path of the app data directory is set as the current directory.
System.Environment.CurrentDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
base.OnCreate(savedInstanceState);
Window.AddFlags(WindowManagerFlags.Fullscreen);
Window.AddFlags(WindowManagerFlags.KeepScreenOn);
}
}
}
|
// 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 Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;
using osu.Framework.Android;
namespace osu.Android
{
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullSensor, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = true)]
public class OsuGameActivity : AndroidGameActivity
{
protected override Framework.Game CreateGame() => new OsuGameAndroid();
protected override void OnCreate(Bundle savedInstanceState)
{
// The default current directory on android is '/'.
// On some devices '/' maps to the app data directory. On others it maps to the root of the internal storage.
// In order to have a consitend current directory on all devices the full path of the app data directory is set as the current directory.
System.Environment.CurrentDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
base.OnCreate(savedInstanceState);
Window.AddFlags(WindowManagerFlags.Fullscreen);
Window.AddFlags(WindowManagerFlags.KeepScreenOn);
}
}
}
|
mit
|
C#
|
2961a96fa87af5c96772c7062fd9aefaeec74f3a
|
Build fix
|
rds1983/Myra
|
src/Myra/Utility/CrossEngineStuff.cs
|
src/Myra/Utility/CrossEngineStuff.cs
|
using System;
#if MONOGAME || FNA
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#elif STRIDE
using Stride.Core.Mathematics;
using Stride.Graphics;
using Texture2D = Stride.Graphics.Texture;
#else
using System.Drawing;
using Color = FontStashSharp.FSColor;
#endif
namespace Myra.Utility
{
internal static class CrossEngineStuff
{
public static Point ViewSize
{
get
{
#if MONOGAME || FNA
var device = MyraEnvironment.GraphicsDevice;
return new Point(device.Viewport.Width, device.Viewport.Height);
#elif STRIDE
var device = MyraEnvironment.GraphicsDevice;
return new Point(device.Presenter.BackBuffer.Width, device.Presenter.BackBuffer.Height);
#else
return MyraEnvironment.Platform.ViewSize;
#endif
}
}
public static Color MultiplyColor(Color color, float value)
{
#if MONOGAME || FNA || STRIDE
return color * value;
#else
if (value < 0)
{
value = 0;
}
if (value > 1)
{
value = 1;
}
return new Color((int)(color.R * value),
(int)(color.G * value),
(int)(color.B * value),
(int)(color.A * value));
#endif
}
#if MONOGAME || FNA || STRIDE
public static Texture2D CreateTexture(GraphicsDevice device, int width, int height)
{
#if MONOGAME || FNA
var texture2d = new Texture2D(device, width, height);
#elif STRIDE
var texture2d = Texture2D.New2D(device, width, height, false, PixelFormat.R8G8B8A8_UNorm_SRgb, TextureFlags.ShaderResource);
#endif
return texture2d;
}
public static void SetTextureData(Texture2D texture, Rectangle bounds, byte[] data)
{
#if MONOGAME || FNA
texture.SetData(0, bounds, data, 0, bounds.Width * bounds.Height * 4);
#elif STRIDE
var size = bounds.Width * bounds.Height * 4;
byte[] temp;
if (size == data.Length)
{
temp = data;
}
else
{
// Since Stride requres buffer size to match exactly, copy data in the temporary buffer
temp = new byte[bounds.Width * bounds.Height * 4];
Array.Copy(data, temp, temp.Length);
}
var context = MyraEnvironment.Game.GraphicsContext;
texture.SetData(context.CommandList, temp, 0, 0, new ResourceRegion(bounds.Left, bounds.Top, 0, bounds.Right, bounds.Bottom, 1));
#endif
}
#endif
}
}
|
#if MONOGAME || FNA
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#elif STRIDE
using Stride.Core.Mathematics;
using Stride.Graphics;
using Texture2D = Stride.Graphics.Texture;
#else
using System.Drawing;
using Color = FontStashSharp.FSColor;
#endif
namespace Myra.Utility
{
internal static class CrossEngineStuff
{
public static Point ViewSize
{
get
{
#if MONOGAME || FNA
var device = MyraEnvironment.GraphicsDevice;
return new Point(device.Viewport.Width, device.Viewport.Height);
#elif STRIDE
var device = MyraEnvironment.GraphicsDevice;
return new Point(device.Presenter.BackBuffer.Width, device.Presenter.BackBuffer.Height);
#else
return MyraEnvironment.Platform.ViewSize;
#endif
}
}
public static Color MultiplyColor(Color color, float value)
{
#if MONOGAME || FNA || STRIDE
return color * value;
#else
if (value < 0)
{
value = 0;
}
if (value > 1)
{
value = 1;
}
return new Color((int)(color.R * value),
(int)(color.G * value),
(int)(color.B * value),
(int)(color.A * value));
#endif
}
#if MONOGAME || FNA || STRIDE
public static Texture2D CreateTexture(GraphicsDevice device, int width, int height)
{
#if MONOGAME || FNA
var texture2d = new Texture2D(device, width, height);
#elif STRIDE
var texture2d = Texture2D.New2D(device, width, height, false, PixelFormat.R8G8B8A8_UNorm_SRgb, TextureFlags.ShaderResource);
#endif
return texture2d;
}
public static void SetTextureData(Texture2D texture, Rectangle bounds, byte[] data)
{
#if MONOGAME || FNA
texture.SetData(0, bounds, data, 0, bounds.Width * bounds.Height * 4);
#elif STRIDE
var size = bounds.Width * bounds.Height * 4;
byte[] temp;
if (size == data.Length)
{
temp = data;
}
else
{
// Since Stride requres buffer size to match exactly, copy data in the temporary buffer
temp = new byte[bounds.Width * bounds.Height * 4];
Array.Copy(data, temp, temp.Length);
}
var context = MyraEnvironment.Game.GraphicsContext;
texture.SetData(context.CommandList, temp, 0, 0, new ResourceRegion(bounds.Left, bounds.Top, 0, bounds.Right, bounds.Bottom, 1));
#endif
}
#endif
}
}
|
mit
|
C#
|
426a3238a451ab233371a2f886f42da02d18a7a7
|
Remove trailing spaces from <br>
|
mysticmind/reversemarkdown-net
|
src/ReverseMarkdown/Converters/Br.cs
|
src/ReverseMarkdown/Converters/Br.cs
|
using System;
using HtmlAgilityPack;
namespace ReverseMarkdown.Converters
{
public class Br
: ConverterBase
{
public Br(Converter converter)
: base(converter)
{
this.Converter.Register("br", this);
}
public override string Convert(HtmlNode node)
{
return Environment.NewLine;
}
}
}
|
using System;
using HtmlAgilityPack;
namespace ReverseMarkdown.Converters
{
public class Br
: ConverterBase
{
public Br(Converter converter)
: base(converter)
{
this.Converter.Register("br", this);
}
public override string Convert(HtmlNode node)
{
return " " + Environment.NewLine;
}
}
}
|
mit
|
C#
|
c176274c6ae5f1b6e0bb77a1299922078a2a2233
|
add StyleScope at PrefsGUIEditorBase
|
fuqunaga/PrefsGUI
|
Editor/PrefsGUIEditorBase.cs
|
Editor/PrefsGUIEditorBase.cs
|
using System;
using UnityEditor;
using UnityEngine;
namespace PrefsGUI
{
public abstract class PrefsGUIEditorBase : EditorWindow
{
// GUI.skin is not same in Editor and runtime.
// StyleScope set style like runtime in Editor;
public class StyleScope : IDisposable
{
static GUIStyle label;
static GUIStyle button;
static StyleScope()
{
label = new GUIStyle(GUI.skin.label);
label.wordWrap = true;
button = new GUIStyle(GUI.skin.button);
button.richText = true;
}
GUIStyle labelOrig;
GUIStyle buttonOrig;
public StyleScope()
{
labelOrig = GUI.skin.label;
buttonOrig = GUI.skin.button;
GUI.skin.label = label;
GUI.skin.button = button;
}
public void Dispose()
{
GUI.skin.label = labelOrig;
GUI.skin.button = buttonOrig;
}
}
protected void Update()
{
GameObjectPrefsUtility.UpdateGoPrefs();
}
void OnGUI()
{
using (new StyleScope())
{
OnGUIInternal();
}
}
protected abstract void OnGUIInternal();
protected bool? ToggleMixed(int count, int maxCount)
{
var mixedFlag = (count == 0) ? false : ((count == maxCount) ? (bool?)true : null);
return ToggleMixed(mixedFlag);
}
protected bool? ToggleMixed(bool? mixedFlag)
{
var value = (mixedFlag == null) || mixedFlag.Value;
if (value != GUILayout.Toggle(value, "", (mixedFlag==null) ? "ToggleMixed" : GUI.skin.toggle, GUILayout.Width(16f)))
{
return !value;
}
return null;
}
}
}
|
using UnityEditor;
using UnityEngine;
namespace PrefsGUI
{
public abstract class PrefsGUIEditorBase : EditorWindow
{
protected void Update()
{
GameObjectPrefsUtility.UpdateGoPrefs();
}
void OnGUI()
{
var buttunStyleOrig = GUI.skin.button;
var buttonStyle = new GUIStyle(buttunStyleOrig);
buttonStyle.richText = true;
GUI.skin.button = buttonStyle;
OnGUIInternal();
GUI.skin.button = buttunStyleOrig;
}
protected abstract void OnGUIInternal();
protected bool? ToggleMixed(int count, int maxCount)
{
var mixedFlag = (count == 0) ? false : ((count == maxCount) ? (bool?)true : null);
return ToggleMixed(mixedFlag);
}
protected bool? ToggleMixed(bool? mixedFlag)
{
var value = (mixedFlag == null) || mixedFlag.Value;
if (value != GUILayout.Toggle(value, "", (mixedFlag==null) ? "ToggleMixed" : GUI.skin.toggle, GUILayout.Width(16f)))
{
return !value;
}
return null;
}
}
}
|
mit
|
C#
|
f7e2bd1971819155f91b5730f08293172fbd4dde
|
Add log for null or empty ControllerCode;
|
SnpM/Lockstep-Framework
|
Core/Game/Agents/AgentControllerSystem/AgentControllerHelper.cs
|
Core/Game/Agents/AgentControllerSystem/AgentControllerHelper.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Lockstep.Data;
using FastCollections;
namespace Lockstep {
/// <summary>
/// At the moment a simple script that automatically creates AgentControllers at the start of games
/// </summary>
public class AgentControllerHelper : BehaviourHelper {
[SerializeField,DataCodeAttribute("AgentControllers")]
private string _environmentController;
public string EnvironmentController { get { return _environmentController; } }
[SerializeField,DataCodeAttribute("AgentControllers")]
private string _defaultController;
public string DefaultController {get {return _defaultController;}}
public static AgentControllerHelper Instance {get; private set;}
BiDictionary<string,byte> CodeIDMap = new BiDictionary<string, byte>();
protected override void OnInitialize ()
{
Instance = this;
IAgentControllerDataProvider database;
if (!LSDatabaseManager.TryGetDatabase<IAgentControllerDataProvider> (out database)) {
Debug.LogError ("IAgentControllerDataProvider unavailable.");
}
//TODO: Re-implement cammander system. Putting on hold for now.
//Also think of other settings for AgentController to be set in database
AgentControllerDataItem[] controllerItems = database.AgentControllerData;
for (int i = 0; i < controllerItems.Length; i++) {
var item = controllerItems [i];
var controller = AgentController.Create (item.DefaultAllegiance);
if (item.PlayerManaged) {
PlayerManager.AddController (controller);
}
CodeIDMap.Add (item.Name, controller.ControllerID);
}
}
public AgentController GetInstanceManager (string controllerCode) {
if (string.IsNullOrEmpty (controllerCode)) {
Debug.Log ("controllerCode is null or empty.");
return null;
}
byte id;
if (!CodeIDMap.TryGetValue (controllerCode, out id)) {
Debug.Log ("Controller name " + controllerCode + " is not valid.");
}
return AgentController.GetInstanceManager (id);
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Lockstep.Data;
using FastCollections;
namespace Lockstep {
/// <summary>
/// At the moment a simple script that automatically creates AgentControllers at the start of games
/// </summary>
public class AgentControllerHelper : BehaviourHelper {
[SerializeField,DataCodeAttribute("AgentControllers")]
private string _environmentController;
public string EnvironmentController { get { return _environmentController; } }
[SerializeField,DataCodeAttribute("AgentControllers")]
private string _defaultController;
public string DefaultController {get {return _defaultController;}}
public static AgentControllerHelper Instance {get; private set;}
BiDictionary<string,byte> CodeIDMap = new BiDictionary<string, byte>();
protected override void OnInitialize ()
{
Instance = this;
IAgentControllerDataProvider database;
if (!LSDatabaseManager.TryGetDatabase<IAgentControllerDataProvider> (out database)) {
Debug.LogError ("IAgentControllerDataProvider unavailable.");
}
//TODO: Re-implement cammander system. Putting on hold for now.
//Also think of other settings for AgentController to be set in database
AgentControllerDataItem[] controllerItems = database.AgentControllerData;
for (int i = 0; i < controllerItems.Length; i++) {
var item = controllerItems [i];
var controller = AgentController.Create (item.DefaultAllegiance);
if (item.PlayerManaged) {
PlayerManager.AddController (controller);
}
CodeIDMap.Add (item.Name, controller.ControllerID);
}
}
public AgentController GetInstanceManager (string controllerCode) {
byte id;
if (!CodeIDMap.TryGetValue (controllerCode, out id)) {
Debug.Log ("Controller name " + controllerCode + " is not valid.");
}
return AgentController.GetInstanceManager (id);
}
}
}
|
mit
|
C#
|
295875c9b209b812c33c3e54690d8723d17b451d
|
Fix CC reflection method
|
DMagic1/KSP_Contract_Parser
|
Source/contractReflection.cs
|
Source/contractReflection.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Contracts;
using UnityEngine;
namespace ContractParser
{
public static class contractReflection
{
internal static void loadMethods()
{
ccLoaded = loadCCPendingMethod();
}
private static bool ccLoaded;
public static bool CCLoaded
{
get { return ccLoaded; }
}
private const string CCType = "ContractConfigurator.ConfiguredContract";
private const string PendingName = "CurrentContracts";
private delegate IEnumerable CCPendingContracts();
private static CCPendingContracts _CCPendingContracts;
internal static List<Contract> pendingContracts()
{
IEnumerable generic = _CCPendingContracts();
List<Contract> pendingContractList = new List<Contract>();
foreach (System.Object obj in generic)
{
if (obj == null)
continue;
Contract c = obj as Contract;
pendingContractList.Add(c);
}
return pendingContractList;
}
private static bool loadCCPendingMethod()
{
try
{
Type CConfigType = null;
AssemblyLoader.loadedAssemblies.TypeOperation(t =>
{
if (t.FullName == CCType)
{
CConfigType = t;
}
});
if (CConfigType == null)
{
Debug.Log(string.Format("[Contract Parser] Contract Configurator Type [{0}] Not Found", CCType));
return false;
}
PropertyInfo CCPending = CConfigType.GetProperty(PendingName);
if (CCPending == null)
{
Debug.Log(string.Format("[Contract Parser] Contract Configurator Property [{0}] Not Loaded", PendingName));
return false;
}
_CCPendingContracts = (CCPendingContracts)Delegate.CreateDelegate(typeof(CCPendingContracts), CCPending.GetGetMethod());
Debug.Log("[Contract Parser] Contract Configurator Pending Contracts Method Assigned");
return _CCPendingContracts != null;
}
catch (Exception e)
{
Debug.Log(string.Format("[Contract Parser] Error in loading Contract Configurator methods\n{0}", e));
return false;
}
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Contracts;
using UnityEngine;
namespace ContractParser
{
public static class contractReflection
{
internal static void loadMethods()
{
ccLoaded = loadCCPendingMethod();
}
private static bool ccLoaded;
public static bool CCLoaded
{
get { return ccLoaded; }
}
private const string CCType = "ContractConfigurator.ConfiguredContract";
private const string PendingName = "CurrentContracts";
private delegate IEnumerable CCPendingContracts();
private static CCPendingContracts _CCPendingContracts;
internal static List<Contract> pendingContracts()
{
IEnumerable generic = _CCPendingContracts();
List<Contract> pendingContractList = new List<Contract>();
foreach (System.Object obj in generic)
{
if (obj == null)
continue;
Contract c = obj as Contract;
pendingContractList.Add(c);
}
return pendingContractList;
}
private static bool loadCCPendingMethod()
{
try
{
Type CConfigType = AssemblyLoader.loadedAssemblies.SelectMany(a => a.assembly.GetExportedTypes())
.SingleOrDefault(t => t.FullName == CCType);
if (CConfigType == null)
{
Debug.Log(string.Format("[Contract Parser] Contract Configurator Type [{0}] Not Found", CCType));
return false;
}
PropertyInfo CCPending = CConfigType.GetProperty(PendingName);
if (CCPending == null)
{
Debug.Log(string.Format("[Contract Parser] Contract Configurator Property [{0}] Not Loaded", PendingName));
return false;
}
_CCPendingContracts = (CCPendingContracts)Delegate.CreateDelegate(typeof(CCPendingContracts), CCPending.GetGetMethod());
Debug.Log("[Contract Parser] Contract Configurator Pending Contracts Method Assigned");
return _CCPendingContracts != null;
}
catch (Exception e)
{
Debug.Log(string.Format("[Contract Parser] Error in loading Contract Configurator methods\n{0}", e));
return false;
}
}
}
}
|
mit
|
C#
|
4b2b8bf52dc2e1cfa251edcdf81b77cc05b5cce2
|
Fix JobHandlerTypeSerializerTest
|
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
|
InfinniPlatform.Scheduler.Tests/JobHandlerTypeSerializerTest.cs
|
InfinniPlatform.Scheduler.Tests/JobHandlerTypeSerializerTest.cs
|
using System;
using System.Linq;
using System.Threading.Tasks;
using InfinniPlatform.IoC;
using InfinniPlatform.Tests;
using Moq;
using NUnit.Framework;
namespace InfinniPlatform.Scheduler
{
[TestFixture(Category = TestCategories.UnitTest)]
public class JobHandlerTypeSerializerTest
{
private static readonly string HandlerType = string.Join(",", typeof(MyJobHandler).AssemblyQualifiedName.Split(new[] { ", " }, StringSplitOptions.None).Take(2));
[Test]
public void ShouldCheckIfCanSerialize()
{
// Given
var resolver = new Mock<IContainerResolver>();
resolver.Setup(i => i.Services).Returns(new[] { typeof(MyJobHandler) });
var target = new JobHandlerTypeSerializer(resolver.Object);
// When
var result1 = target.CanSerialize(typeof(MyJobHandler));
var result2 = target.CanSerialize(typeof(JobHandlerTypeSerializerTest));
// Then
Assert.IsTrue(result1);
Assert.IsFalse(result2);
}
[Test]
public void ShouldSerialize()
{
// Given
var resolver = new Mock<IContainerResolver>();
var target = new JobHandlerTypeSerializer(resolver.Object);
// When
var result = target.Serialize(typeof(MyJobHandler));
// Then
Assert.AreEqual(HandlerType, result);
}
[Test]
public void ShouldDeserialize()
{
// Given
var resolver = new Mock<IContainerResolver>();
resolver.Setup(i => i.Services).Returns(new[] { typeof(MyJobHandler) });
resolver.Setup(i => i.Resolve(typeof(MyJobHandler))).Returns(new MyJobHandler());
var target = new JobHandlerTypeSerializer(resolver.Object);
// When
var result = target.Deserialize(HandlerType);
// Then
Assert.IsInstanceOf<MyJobHandler>(result);
}
private class MyJobHandler : IJobHandler
{
public Task Handle(IJobInfo jobInfo, IJobHandlerContext context)
{
throw new NotImplementedException();
}
}
}
}
|
using System;
using System.Threading.Tasks;
using InfinniPlatform.IoC;
using InfinniPlatform.Tests;
using Moq;
using NUnit.Framework;
namespace InfinniPlatform.Scheduler
{
[TestFixture(Category = TestCategories.UnitTest)]
public class JobHandlerTypeSerializerTest
{
private const string HandlerType = "InfinniPlatform.Scheduler.Common.JobHandlerTypeSerializerTest+MyJobHandler,InfinniPlatform.Scheduler.Tests";
[Test]
public void ShouldCheckIfCanSerialize()
{
// Given
var resolver = new Mock<IContainerResolver>();
resolver.Setup(i => i.Services).Returns(new[] { typeof(MyJobHandler) });
var target = new JobHandlerTypeSerializer(resolver.Object);
// When
var result1 = target.CanSerialize(typeof(MyJobHandler));
var result2 = target.CanSerialize(typeof(JobHandlerTypeSerializerTest));
// Then
Assert.IsTrue(result1);
Assert.IsFalse(result2);
}
[Test]
public void ShouldSerialize()
{
// Given
var resolver = new Mock<IContainerResolver>();
var target = new JobHandlerTypeSerializer(resolver.Object);
// When
var result = target.Serialize(typeof(MyJobHandler));
// Then
Assert.AreEqual(HandlerType, result);
}
[Test]
public void ShouldDeserialize()
{
// Given
var resolver = new Mock<IContainerResolver>();
resolver.Setup(i => i.Services).Returns(new[] { typeof(MyJobHandler) });
resolver.Setup(i => i.Resolve(typeof(MyJobHandler))).Returns(new MyJobHandler());
var target = new JobHandlerTypeSerializer(resolver.Object);
// When
var result = target.Deserialize(HandlerType);
// Then
Assert.IsInstanceOf<MyJobHandler>(result);
}
private class MyJobHandler : IJobHandler
{
public Task Handle(IJobInfo jobInfo, IJobHandlerContext context)
{
throw new NotImplementedException();
}
}
}
}
|
agpl-3.0
|
C#
|
f1ce465ac3a73ffe81ac174c9e378c2653e2fd5a
|
Use existing extension method to get default value for a type.
|
mthamil/PlantUMLStudio,mthamil/PlantUMLStudio
|
Unit.Tests/MethodRecorder.cs
|
Unit.Tests/MethodRecorder.cs
|
using System;
using System.Reflection;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using Utilities.Reflection;
namespace Unit.Tests
{
/// <summary>
/// Proxy that records method invocations.
/// </summary>
public class MethodRecorder<T> : RealProxy
{
/// <summary>
/// Creates a new interceptor that records method invocations.
/// </summary>
public MethodRecorder()
: base(typeof(T))
{
_proxy = new Lazy<T>(() => (T)base.GetTransparentProxy());
}
/// <summary>
/// The underlying proxy.
/// </summary>
public T Proxy
{
get { return _proxy.Value; }
}
/// <summary>
/// The most recent invocation made on the proxy.
/// </summary>
public IMethodCallMessage LastInvocation { get; private set; }
/// <see cref="RealProxy.Invoke"/>
public override IMessage Invoke(IMessage msg)
{
var methodCall = msg as IMethodCallMessage;
LastInvocation = methodCall;
object returnValue = null;
var method = methodCall.MethodBase as MethodInfo;
if (method != null)
returnValue = method.ReturnType.GetDefaultValue();
return new ReturnMessage(returnValue, new object[0], 0, methodCall.LogicalCallContext, methodCall);
}
private readonly Lazy<T> _proxy;
}
}
|
using System;
using System.Reflection;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
namespace Unit.Tests
{
/// <summary>
/// Proxy that records method invocations.
/// </summary>
public class MethodRecorder<T> : RealProxy
{
/// <summary>
/// Creates a new interceptor that records method invocations.
/// </summary>
public MethodRecorder()
: base(typeof(T))
{
_proxy = new Lazy<T>(() => (T)base.GetTransparentProxy());
}
/// <summary>
/// The underlying proxy.
/// </summary>
public T Proxy
{
get { return _proxy.Value; }
}
/// <summary>
/// The most recent invocation made on the proxy.
/// </summary>
public IMethodCallMessage LastInvocation { get; private set; }
/// <see cref="RealProxy.Invoke"/>
public override IMessage Invoke(IMessage msg)
{
var methodCall = msg as IMethodCallMessage;
LastInvocation = methodCall;
object returnValue = null;
var method = methodCall.MethodBase as MethodInfo;
if (method != null)
{
Type returnType = method.ReturnType;
if (returnType.IsValueType && returnType != typeof(void)) // can't create an instance of Void
returnValue = Activator.CreateInstance(returnType);
}
return new ReturnMessage(returnValue, new object[0], 0, methodCall.LogicalCallContext, methodCall);
}
private readonly Lazy<T> _proxy;
}
}
|
apache-2.0
|
C#
|
73ab90eb582d705f2b1080122768140e17c5c011
|
Remove unncessary PMLs
|
jogonzal/UWNLPAssignment1,jogonzal-msft/UWNLPAssignment1
|
UWNLPAssignment1/Pml.cs
|
UWNLPAssignment1/Pml.cs
|
namespace UWNLPAssignment1
{
public static class PmlExtensions
{
public static double Pml(this CorpusParsingResult result, string word)
{
int countForUnigram = result.GetCountForUnigram(word);
return 1.0 * countForUnigram/result.TotalUnigrams;
}
public static double Pml(this CorpusParsingResult result, string wordminus1, string word)
{
int countForBigram = result.GetCountForBigram(wordminus1, word);
int countForUnigram = result.GetCountForUnigram(wordminus1);
return 1.0 * countForBigram / countForUnigram;
}
public static double Pml(this CorpusParsingResult result, string wordminus2, string wordminus1, string word)
{
int countForTrigram = result.GetCountForTrigram(wordminus2, wordminus1, word);
int countForBigram = result.GetCountForBigram(wordminus2, wordminus1);
return 1.0 * countForTrigram / countForBigram;
}
public static double PmlRedefined(this CorpusParsingResult result, string wordminus2, string wordminus1, string word)
{
double countForTrigram = result.GetCountForTrigram(wordminus2, wordminus1, word) - Configs.Beta;
int countForBigram = result.GetCountForBigram(wordminus2, wordminus1);
return 1.0 * countForTrigram / countForBigram;
}
}
}
|
namespace UWNLPAssignment1
{
public static class PmlExtensions
{
public static double Pml(this CorpusParsingResult result, string word)
{
int countForUnigram = result.GetCountForUnigram(word);
return 1.0 * countForUnigram/result.TotalUnigrams;
}
public static double Pml(this CorpusParsingResult result, string wordminus1, string word)
{
int countForBigram = result.GetCountForBigram(wordminus1, word);
int countForUnigram = result.GetCountForUnigram(wordminus1);
return 1.0 * countForBigram / countForUnigram;
}
public static double Pml(this CorpusParsingResult result, string wordminus2, string wordminus1, string word)
{
int countForTrigram = result.GetCountForTrigram(wordminus2, wordminus1, word);
int countForBigram = result.GetCountForBigram(wordminus2, wordminus1);
return 1.0 * countForTrigram / countForBigram;
}
public static double PmlRedefined(this CorpusParsingResult result, string word)
{
double countForUnigram = result.GetCountForUnigram(word) - Configs.Beta;
return 1.0 * countForUnigram / result.TotalUnigrams;
}
public static double PmlRedefined(this CorpusParsingResult result, string wordminus1, string word)
{
double countForBigram = result.GetCountForBigram(wordminus1, word) - Configs.Beta;
int countForUnigram = result.GetCountForUnigram(wordminus1);
return 1.0 * countForBigram / countForUnigram;
}
public static double PmlRedefined(this CorpusParsingResult result, string wordminus2, string wordminus1, string word)
{
double countForTrigram = result.GetCountForTrigram(wordminus2, wordminus1, word) - Configs.Beta;
int countForBigram = result.GetCountForBigram(wordminus2, wordminus1);
return 1.0 * countForTrigram / countForBigram;
}
}
}
|
mit
|
C#
|
8a4065cf4345bd25a51527dfb1e36e972890f6db
|
Build Manager ready
|
neurospeech/iis-ci
|
IISCI.Build/ProcessHelper.cs
|
IISCI.Build/ProcessHelper.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace IISCI.Build
{
public class ProcessHelper
{
public static void Execute(
string program,
string arguements,
StringWriter console,
StringWriter errors)
{
ProcessStartInfo info = new ProcessStartInfo(program, arguements);
info.CreateNoWindow = true;
info.UseShellExecute = false;
info.RedirectStandardError = true;
info.RedirectStandardOutput = true;
Process p = new Process();
p.StartInfo = info;
p.EnableRaisingEvents = true;
AutoResetEvent wait = new AutoResetEvent(false);
p.Exited += (s, e) =>
{
wait.Set();
};
p.OutputDataReceived += (s, e) =>
{
console.WriteLine(e.Data);
};
p.ErrorDataReceived += (s, e) =>
{
errors.WriteLine(e.Data);
};
p.Start();
p.BeginErrorReadLine();
p.BeginOutputReadLine();
wait.WaitOne(5 * 60 * 1000);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace IISCI.Build
{
public class ProcessHelper
{
public static void Execute(
string program,
string arguements,
StringWriter console,
StringWriter errors)
{
ProcessStartInfo info = new ProcessStartInfo(program, arguements);
info.CreateNoWindow = true;
info.UseShellExecute = false;
info.RedirectStandardError = true;
info.RedirectStandardOutput = true;
Process p = new Process();
p.StartInfo = info;
p.EnableRaisingEvents = true;
AutoResetEvent wait = new AutoResetEvent(false);
p.Exited += (s, e) =>
{
wait.Set();
};
p.OutputDataReceived += (s, e) =>
{
console.Write(e.Data);
};
p.ErrorDataReceived += (s, e) =>
{
errors.Write(e.Data);
};
p.Start();
p.BeginErrorReadLine();
p.BeginOutputReadLine();
wait.WaitOne(5 * 60 * 1000);
}
}
}
|
mit
|
C#
|
c1e283afcfa12d66ae3ceb98d3c771a8ff1e19bb
|
Make VendorRecipe implement IReadOnlyList<PoEItem>
|
jcmoyer/Yeena
|
Yeena/Recipe/VendorRecipe.cs
|
Yeena/Recipe/VendorRecipe.cs
|
// Copyright 2013 J.C. Moyer
//
// 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;
using System.Collections.Generic;
using System.ComponentModel;
using Yeena.PathOfExile;
namespace Yeena.Recipe {
/// <summary>
/// A Recipe is simply a list of items.
/// </summary>
class VendorRecipe : IReadOnlyList<PoEItem> {
private readonly List<PoEItem> _items;
public VendorRecipe(PoEItem item) {
_items = new List<PoEItem> {
item
};
}
public VendorRecipe(IEnumerable<PoEItem> items) {
_items = new List<PoEItem>(items);
}
public int ItemCount {
get { return _items.Count; }
}
public string Ingredients {
get { return string.Join(", ", _items); }
}
[Browsable(false)]
public IReadOnlyList<PoEItem> Items {
get { return _items; }
}
public IEnumerator<PoEItem> GetEnumerator() {
return _items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() {
return GetEnumerator();
}
public int Count {
get { return Items.Count; }
}
public PoEItem this[int index] {
get { return Items[index]; }
}
}
}
|
// Copyright 2013 J.C. Moyer
//
// 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;
using System.Collections.Generic;
using System.ComponentModel;
using Yeena.PathOfExile;
namespace Yeena.Recipe {
/// <summary>
/// A Recipe is simply a list of items.
/// </summary>
class VendorRecipe : IEnumerable<PoEItem> {
private readonly List<PoEItem> _items;
public VendorRecipe(PoEItem item) {
_items = new List<PoEItem> {
item
};
}
public VendorRecipe(IEnumerable<PoEItem> items) {
_items = new List<PoEItem>(items);
}
public int ItemCount {
get { return _items.Count; }
}
public string Ingredients {
get { return string.Join(", ", _items); }
}
[Browsable(false)]
public IReadOnlyList<PoEItem> Items {
get { return _items; }
}
public IEnumerator<PoEItem> GetEnumerator() {
return _items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() {
return GetEnumerator();
}
}
}
|
apache-2.0
|
C#
|
5ae3d0eb274785ac3bb55cf26e8860ca7e35456e
|
Fix wording of ui scale screen description
|
peppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu
|
osu.Game/Localisation/FirstRunSetupOverlayStrings.cs
|
osu.Game/Localisation/FirstRunSetupOverlayStrings.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
namespace osu.Game.Localisation
{
public static class FirstRunSetupOverlayStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.FirstRunSetupOverlay";
/// <summary>
/// "Get started"
/// </summary>
public static LocalisableString GetStarted => new TranslatableString(getKey(@"get_started"), @"Get started");
/// <summary>
/// "Click to resume first-run setup at any point"
/// </summary>
public static LocalisableString ClickToResumeFirstRunSetupAtAnyPoint => new TranslatableString(getKey(@"click_to_resume_first_run_setup_at_any_point"), @"Click to resume first-run setup at any point");
/// <summary>
/// "First-run setup"
/// </summary>
public static LocalisableString FirstRunSetup => new TranslatableString(getKey(@"first_run_setup"), @"First-run setup");
/// <summary>
/// "Setup osu! to suit you"
/// </summary>
public static LocalisableString SetupOsuToSuitYou => new TranslatableString(getKey(@"setup_osu_to_suit_you"), @"Setup osu! to suit you");
/// <summary>
/// "Welcome"
/// </summary>
public static LocalisableString Welcome => new TranslatableString(getKey(@"welcome"), @"Welcome");
/// <summary>
/// "Welcome to the first-run setup guide!
///
/// osu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!"
/// </summary>
public static LocalisableString WelcomeDescription => new TranslatableString(getKey(@"welcome_description"), @"Welcome to the first-run setup guide!
osu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!");
/// <summary>
/// "The size of the osu! user interface can be adjusted to your liking."
/// </summary>
public static LocalisableString UIScaleDescription => new TranslatableString(getKey(@"ui_scale_description"), @"The size of the osu! user interface can be adjusted to your liking.");
/// <summary>
/// "Next ({0})"
/// </summary>
public static LocalisableString Next(LocalisableString nextStepDescription) => new TranslatableString(getKey(@"next"), @"Next ({0})", nextStepDescription);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
namespace osu.Game.Localisation
{
public static class FirstRunSetupOverlayStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.FirstRunSetupOverlay";
/// <summary>
/// "Get started"
/// </summary>
public static LocalisableString GetStarted => new TranslatableString(getKey(@"get_started"), @"Get started");
/// <summary>
/// "Click to resume first-run setup at any point"
/// </summary>
public static LocalisableString ClickToResumeFirstRunSetupAtAnyPoint => new TranslatableString(getKey(@"click_to_resume_first_run_setup_at_any_point"), @"Click to resume first-run setup at any point");
/// <summary>
/// "First-run setup"
/// </summary>
public static LocalisableString FirstRunSetup => new TranslatableString(getKey(@"first_run_setup"), @"First-run setup");
/// <summary>
/// "Setup osu! to suit you"
/// </summary>
public static LocalisableString SetupOsuToSuitYou => new TranslatableString(getKey(@"setup_osu_to_suit_you"), @"Setup osu! to suit you");
/// <summary>
/// "Welcome"
/// </summary>
public static LocalisableString Welcome => new TranslatableString(getKey(@"welcome"), @"Welcome");
/// <summary>
/// "Welcome to the first-run setup guide!
///
/// osu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!"
/// </summary>
public static LocalisableString WelcomeDescription => new TranslatableString(getKey(@"welcome_description"), @"Welcome to the first-run setup guide!
osu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!");
/// <summary>
/// "The size of the osu! user interface size can be adjusted to your liking."
/// </summary>
public static LocalisableString UIScaleDescription => new TranslatableString(getKey(@"ui_scale_description"), @"The size of the osu! user interface size can be adjusted to your liking.");
/// <summary>
/// "Next ({0})"
/// </summary>
public static LocalisableString Next(LocalisableString nextStepDescription) => new TranslatableString(getKey(@"next"), @"Next ({0})", nextStepDescription);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
|
mit
|
C#
|
39e637795ecb07a2aadf5ae541ea2a78100f3c8b
|
improve exception message when handling connection errors (#1302)
|
chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet
|
Source/MQTTnet/Exceptions/MqttCommunicationTimedOutException.cs
|
Source/MQTTnet/Exceptions/MqttCommunicationTimedOutException.cs
|
using System;
namespace MQTTnet.Exceptions
{
public class MqttCommunicationTimedOutException : MqttCommunicationException
{
public MqttCommunicationTimedOutException()
{
}
public MqttCommunicationTimedOutException(Exception innerException) : base("The operation has timed out.", innerException)
{
}
}
}
|
using System;
namespace MQTTnet.Exceptions
{
public class MqttCommunicationTimedOutException : MqttCommunicationException
{
public MqttCommunicationTimedOutException()
{
}
public MqttCommunicationTimedOutException(Exception innerException) : base(innerException)
{
}
}
}
|
mit
|
C#
|
e0cb93ecdd522370e03f9d984f89ca76b9f55739
|
Change formatting to match C# style
|
versionone/VersionOne.Integration.Bugzilla,versionone/VersionOne.Integration.Bugzilla,versionone/VersionOne.Integration.Bugzilla
|
VersionOne.ServiceHost.Core/Configuration/VersionOneSettings.cs
|
VersionOne.ServiceHost.Core/Configuration/VersionOneSettings.cs
|
using System;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
namespace VersionOne.ServiceHost.Core.Configuration
{
[XmlRoot("Settings")]
public class VersionOneSettings
{
private const string DefaultApiVersion = "6.5.0.0";
[XmlElement("ApplicationUrl")]
public string Url { get; set; }
public string Username { get; set; }
public string Password { get; set; }
[XmlElement("APIVersion")]
public string ApiVersion { get; set; }
public bool IntegratedAuth { get; set; }
public ProxySettings ProxySettings { get; set; }
public VersionOneSettings()
{
ApiVersion = DefaultApiVersion;
ProxySettings = new ProxySettings { Enabled = false, };
}
public XmlElement ToXmlElement()
{
var xmlSerializer = new XmlSerializer(GetType());
var namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, string.Empty);
using (var memoryStream = new MemoryStream())
{
try
{
xmlSerializer.Serialize(memoryStream, this, namespaces);
}
catch (InvalidOperationException)
{
return null;
}
memoryStream.Position = 0;
var serializationDoc = new XmlDocument();
serializationDoc.Load(memoryStream);
return serializationDoc.DocumentElement;
}
}
public static VersionOneSettings FromXmlElement(XmlElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
var xmlSerializer = new XmlSerializer(typeof(VersionOneSettings));
var namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, string.Empty);
return (VersionOneSettings)xmlSerializer.Deserialize(new XmlNodeReader(element));
}
}
}
|
using System;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
namespace VersionOne.ServiceHost.Core.Configuration {
[XmlRoot("Settings")]
public class VersionOneSettings {
private const string DefaultApiVersion = "6.5.0.0";
[XmlElement("ApplicationUrl")]
public string Url { get; set; }
public string Username { get; set; }
public string Password { get; set; }
[XmlElement("APIVersion")]
public string ApiVersion { get; set; }
public bool IntegratedAuth { get; set; }
public ProxySettings ProxySettings { get; set; }
public VersionOneSettings() {
ApiVersion = DefaultApiVersion;
ProxySettings = new ProxySettings {Enabled = false, };
}
public XmlElement ToXmlElement() {
var xmlSerializer = new XmlSerializer(GetType());
var namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, string.Empty);
using (var memoryStream = new MemoryStream()) {
try {
xmlSerializer.Serialize(memoryStream, this, namespaces);
} catch (InvalidOperationException) {
return null;
}
memoryStream.Position = 0;
var serializationDoc = new XmlDocument();
serializationDoc.Load(memoryStream);
return serializationDoc.DocumentElement;
}
}
public static VersionOneSettings FromXmlElement(XmlElement element) {
if(element == null) {
throw new ArgumentNullException("element");
}
var xmlSerializer = new XmlSerializer(typeof(VersionOneSettings));
var namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, string.Empty);
return (VersionOneSettings) xmlSerializer.Deserialize(new XmlNodeReader(element));
}
}
}
|
bsd-3-clause
|
C#
|
91460f27daf5adabeb1fe40347f6121263998001
|
Fix incorrect isForCurrentRuleset value
|
NeoAdonis/osu,ZLima12/osu,johnneijzen/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,EVAST9919/osu,peppy/osu-new,peppy/osu,2yangk23/osu,naoey/osu,UselessToucan/osu,peppy/osu,ZLima12/osu,NeoAdonis/osu,DrabWeb/osu,johnneijzen/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,naoey/osu,Frontear/osuKyzer,ppy/osu,2yangk23/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,DrabWeb/osu,Nabile-Rahmani/osu,DrabWeb/osu,naoey/osu
|
osu.Game.Tests/Visual/TestCaseReplay.cs
|
osu.Game.Tests/Visual/TestCaseReplay.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual
{
[Description("Player instantiated with a replay.")]
public class TestCaseReplay : TestCasePlayer
{
protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
{
// We create a dummy RulesetContainer just to get the replay - we don't want to use mods here
// to simulate setting a replay rather than having the replay already set for us
beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
var dummyRulesetContainer = ruleset.CreateRulesetContainerWith(beatmap, beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo));
// We have the replay
var replay = dummyRulesetContainer.Replay;
// Reset the mods
beatmap.Mods.Value = beatmap.Mods.Value.Where(m => !(m is ModAutoplay));
return new ReplayPlayer(replay)
{
InitialBeatmap = beatmap
};
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual
{
[Description("Player instantiated with a replay.")]
public class TestCaseReplay : TestCasePlayer
{
protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
{
// We create a dummy RulesetContainer just to get the replay - we don't want to use mods here
// to simulate setting a replay rather than having the replay already set for us
beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
var dummyRulesetContainer = ruleset.CreateRulesetContainerWith(beatmap, false);
// We have the replay
var replay = dummyRulesetContainer.Replay;
// Reset the mods
beatmap.Mods.Value = beatmap.Mods.Value.Where(m => !(m is ModAutoplay));
return new ReplayPlayer(replay)
{
InitialBeatmap = beatmap
};
}
}
}
|
mit
|
C#
|
de6cb9c4d76b8acb2d970ffafa06f54386d73207
|
Support ReturnUrl to public pages
|
projectkudu/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,KuduApps/NuGetGallery,JetBrains/ReSharperGallery,skbkontur/NuGetGallery,mtian/SiteExtensionGallery,KuduApps/NuGetGallery,projectkudu/SiteExtensionGallery,JetBrains/ReSharperGallery,KuduApps/NuGetGallery,KuduApps/NuGetGallery,ScottShingler/NuGetGallery,skbkontur/NuGetGallery,skbkontur/NuGetGallery,mtian/SiteExtensionGallery,JetBrains/ReSharperGallery,mtian/SiteExtensionGallery,projectkudu/SiteExtensionGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,KuduApps/NuGetGallery
|
Website/Views/Shared/UserDisplay.cshtml
|
Website/Views/Shared/UserDisplay.cshtml
|
<div class="user-display">
@if (!User.Identity.IsAuthenticated)
{
<span class="welcome">@Html.ActionLink("Log On", "LogOn", "Authentication", new { returnUrl = Request.RequestContext.HttpContext.Request.RawUrl }, null)</span>
<a href="@Url.Action(MVC.Users.Register())" class="register">Register</a>
}
else
{
<span class="welcome"><a href="@Url.Action(MVC.Users.Account())">@User.Identity.Name</a></span>
<span class="user-actions">
<a href="@Url.LogOff()">Log Off</a>
</span>
}
</div>
|
<div class="user-display">
@if (!User.Identity.IsAuthenticated)
{
<span class="welcome"><a href="@Url.LogOn()">Log On</a></span>
<a href="@Url.Action(MVC.Users.Register())" class="register">Register</a>
}
else
{
<span class="welcome"><a href="@Url.Action(MVC.Users.Account())">@User.Identity.Name</a></span>
<span class="user-actions">
<a href="@Url.LogOff()">Log Off</a>
</span>
}
</div>
|
apache-2.0
|
C#
|
2a9b350be80583b7d3ef2bea646c325a82521aac
|
add setting key AzureStoreEnabled
|
colbylwilliams/XWeather,colbylwilliams/XWeather
|
XWeather/Shared/Settings/SettingKeys.cs
|
XWeather/Shared/Settings/SettingKeys.cs
|
/* This file was generated by Settings Studio
*
* Copyright © 2015 Colby Williams. All Rights Reserved.
*/
namespace SettingsStudio
{
public static class SettingsKeys
{
#region Visible Settings
public const string VersionNumber = "VersionNumber";
public const string BuildNumber = "BuildNumber";
public const string GitCommitHash = "GitCommitHash";
public const string UserReferenceKey = "UserReferenceKey";
public const string RandomBackgrounds = "RandomBackgrounds";
public const string UomTemperature = "UomTemperature";
public const string UomDistance = "UomDistance";
public const string UomPressure = "UomPressure";
public const string UomLength = "UomLength";
public const string UomSpeed = "UomSpeed";
#endregion
#region Hidden Settings
public const string AzureStoreEnabled = "AzureStoreEnabled";
public const string LocationsJson = "LocationsJson";
public const string WeatherPage = "WeatherPage";
public const string HighLowGraph = "HighLowGraph";
#endregion
}
}
|
/* This file was generated by Settings Studio
*
* Copyright © 2015 Colby Williams. All Rights Reserved.
*/
namespace SettingsStudio
{
public static class SettingsKeys
{
#region Visible Settings
public const string VersionNumber = "VersionNumber";
public const string BuildNumber = "BuildNumber";
public const string GitCommitHash = "GitCommitHash";
public const string UserReferenceKey = "UserReferenceKey";
public const string RandomBackgrounds = "RandomBackgrounds";
public const string UomTemperature = "UomTemperature";
public const string UomDistance = "UomDistance";
public const string UomPressure = "UomPressure";
public const string UomLength = "UomLength";
public const string UomSpeed = "UomSpeed";
#endregion
#region Hidden Settings
public const string LocationsJson = "LocationsJson";
public const string WeatherPage = "WeatherPage";
public const string HighLowGraph = "HighLowGraph";
#endregion
}
}
|
mit
|
C#
|
ac1fe71766019bd79ed516d4aaf6bfee0d282621
|
Bump version to 0.7.0
|
sqt/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot,sqt/cactbot,sqt/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot
|
CactbotOverlay/Properties/AssemblyInfo.cs
|
CactbotOverlay/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.6.6.0")]
[assembly: AssemblyFileVersion("0.6.6.0")]
|
apache-2.0
|
C#
|
6628192d9cc2c04edf7662d7eb705dea39423a90
|
bump version for next release
|
azarkevich/VSS3WayMerge
|
VSS3WayMerge/Properties/AssemblyInfo.cs
|
VSS3WayMerge/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("VSS 3-Way Merge tool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VSS 3-Way Merge tool")]
[assembly: AssemblyCopyright("Copyright © Sergey Azarkevich 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("3adb2df9-a853-4e33-8c4f-333704e7463a")]
// 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("0.9.4")]
[assembly: AssemblyFileVersion("0.9.4")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("VSS 3-Way Merge tool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VSS 3-Way Merge tool")]
[assembly: AssemblyCopyright("Copyright © Sergey Azarkevich 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("3adb2df9-a853-4e33-8c4f-333704e7463a")]
// 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("0.9.3")]
[assembly: AssemblyFileVersion("0.9.3")]
|
mit
|
C#
|
70401d286cc6eba34d2673658cc590531106ae30
|
Update AssemblyInfo.cs
|
mcintyre321/Noodles,mcintyre321/Noodles
|
Noodles.AspMvc/Properties/AssemblyInfo.cs
|
Noodles.AspMvc/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("Noodles.AspMvc")]
[assembly: AssemblyDescription("Noodles transforms your object model into a web app. This assembly contains stuff to make Noodles work with ASP MVC")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Noodles.AspMvc")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[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("637871ba-7248-4918-96d1-c782532ec45b")]
// 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("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Noodles.AspMvc")]
[assembly: AssemblyDescription("Noodles transforms your object model into a web app. This assembly contains stuff to make Noodles work with ASP MVC")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Noodles.AspMvc")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[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("637871ba-7248-4918-96d1-c782532ec45b")]
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
3b8a12b711470f692ba1bf5f1559691f93901227
|
Set system timer resolution for the sleep call in the wait loop
|
eightlittlebits/elbsms
|
elbsms_ui/Program.cs
|
elbsms_ui/Program.cs
|
using System;
using System.Windows.Forms;
using elb_utilities.NativeMethods;
namespace elbsms_ui
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// set timer resolution to 1ms to try and get the sleep accurate in the wait loop
WinMM.TimeBeginPeriod(1);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
|
using System;
using System.Windows.Forms;
namespace elbsms_ui
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
|
mit
|
C#
|
73fb67277c4e863d376bcd0994f2f09772b00fa9
|
Use Toggle() in ToggleButton but added a comment for the Click
|
Roemer/FlaUI,maxinfet/FlaUI
|
src/FlaUI.Core/AutomationElements/ToggleButton.cs
|
src/FlaUI.Core/AutomationElements/ToggleButton.cs
|
using FlaUI.Core.AutomationElements.Infrastructure;
using FlaUI.Core.AutomationElements.PatternElements;
namespace FlaUI.Core.AutomationElements
{
/// <summary>
/// Class to interact with a toggle button element.
/// </summary>
public class ToggleButton : ToggleAutomationElement
{
/// <summary>
/// Creates a <see cref="ToggleButton"/> element.
/// </summary>
public ToggleButton(BasicAutomationElementBase basicAutomationElement) : base(basicAutomationElement)
{
}
/// <summary>
/// Toggles the toggle button.
/// Note: In some WPF scenarios, the bounded command might not be fired. Use <see cref="AutomationElement.Click"/> instead in that case.
/// </summary>
public override void Toggle()
{
base.Toggle();
}
}
}
|
using FlaUI.Core.AutomationElements.Infrastructure;
using FlaUI.Core.AutomationElements.PatternElements;
using FlaUI.Core.Patterns;
namespace FlaUI.Core.AutomationElements
{
/// <summary>
/// Class to interact with a toggle button element.
/// </summary>
public class ToggleButton : ToggleAutomationElement
{
/// <summary>
/// Creates a <see cref="ToggleButton"/> element.
/// </summary>
public ToggleButton(BasicAutomationElementBase basicAutomationElement) : base(basicAutomationElement)
{
}
/// <summary>
/// Toggles the toggle button. Uses <see cref="AutomationElement.Click"/> as <see cref="ITogglePattern.Toggle"/> does not fire commands.
/// </summary>
public override void Toggle()
{
Click();
}
}
}
|
mit
|
C#
|
12f5f8d14f2ddabeef0ad7ab1053122d045e2a27
|
Update AssemblyInfo
|
marska/habitrpg-quick-todo
|
src/HabitRPG.QuickToDo/Properties/AssemblyInfo.cs
|
src/HabitRPG.QuickToDo/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("QuickToDo")]
[assembly: AssemblyDescription("Quick create to-do task in HabitRPG")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mariusz Skarupiński")]
[assembly: AssemblyProduct("QuickToDo")]
[assembly: AssemblyCopyright("Copyright © Mariusz Skarupiński 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.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("HabitRPG.QuickToDo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HabitRPG.QuickToDo")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
94b24f4775a1bde71ac5f0053e7a4c3ac40cc09c
|
add url vaildation on creating a client
|
ZA-PT/Obsidian,ZA-PT/Obsidian,ZA-PT/Obsidian,ZA-PT/Obsidian
|
src/Obsidian.Application/Dto/ClientCreationDto.cs
|
src/Obsidian.Application/Dto/ClientCreationDto.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Obsidian.Application.Dto
{
public class ClientCreationDto
{
public string DisplayName { get; set; }
[Url]
public string RedirectUri { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Obsidian.Application.Dto
{
public class ClientCreationDto
{
public string DisplayName { get; set; }
public string RedirectUri { get; set; }
}
}
|
apache-2.0
|
C#
|
a3b2677699c565881f99bd51945dd582aabfacbc
|
add crawl info to search page
|
kreeben/resin,kreeben/resin
|
src/Sir.HttpServer/Views/Shared/SearchForm.cshtml
|
src/Sir.HttpServer/Views/Shared/SearchForm.cshtml
|
@{
string query = Context.Request.Query.ContainsKey("q") ? Context.Request.Query["q"].ToString() : null;
var expiresInDays = (int)ViewData["index_expires_in_days"];
var expired = false;
if (expiresInDays < 0)
{
expired = true;
expiresInDays = Math.Abs(expiresInDays);
}
}
@using (Html.BeginRouteForm("default", new { controller = "Search" }, FormMethod.Get))
{
<div class="input-wrapper">
<div class="q">
<input type="text" id="q" name="q" class="q" placeholder="Search (keywords or phrase)" value="@query" tabindex="0" />
<button type="submit" value="OR" name="OR" id="or" title="OR">Go</button>
</div>
<br style="clear:both;" />
@if (query == null)
{
<div style="padding: 5px 5px 5px 5px;">
<h3>Information about your search index:</h3>
<p>
We're constantly crawling the web to to ensure that the URLs in user indices are updated.
If you don't see all the content here that you expected, wait a couple of minutes and come back.
</p>
<p>Pro tip: bookmark this page, so that you won't forget how to find your search index.</p>
<p>Manage URLs and update frequency by clicking <a style="color:white;" href="/options?queryId=@Context.Request.Query["queryId"]" title="Options">☰</a>.</p>
@if (expired)
{
<p>This index expired in @expiresInDays days ago and will soon be removed from our system.</p>
}
else
{
<p>Index expires in @expiresInDays days.</p>
}
</div>
}
<input type="hidden" value="0" name="skip" id="skip" />
<input type="hidden" value="100" name="take" id="take" />
<input type="hidden" value="@Context.Request.Query["queryId"]" name="queryId" id="queryId" />
</div>
}
|
@{
string query = Context.Request.Query.ContainsKey("q") ? Context.Request.Query["q"].ToString() : null;
var expiresInDays = (int)ViewData["index_expires_in_days"];
var expired = false;
if (expiresInDays < 0)
{
expired = true;
expiresInDays = Math.Abs(expiresInDays);
}
}
@using (Html.BeginRouteForm("default", new { controller = "Search" }, FormMethod.Get))
{
<div class="input-wrapper">
<div class="q">
<input type="text" id="q" name="q" class="q" placeholder="Search (keywords or phrase)" value="@query" tabindex="0" />
<button type="submit" value="OR" name="OR" id="or" title="OR">Go</button>
</div>
<br style="clear:both;" />
@if (query == null)
{
<div style="padding: 5px 5px 5px 5px;">
<h2>This is your search index.</h2>
<p>Bookmark this page.</p>
<p>Manage URLs and update frequency by clicking <a style="color:white;" href="/options?queryId=@Context.Request.Query["queryId"]" title="Options">☰</a>.</p>
@if (expired)
{
<p>This index expired in @expiresInDays days ago and will soon be removed from our system.</p>
}
else
{
<p>Index expires in @expiresInDays days.</p>
}
</div>
}
<input type="hidden" value="0" name="skip" id="skip" />
<input type="hidden" value="100" name="take" id="take" />
<input type="hidden" value="@Context.Request.Query["queryId"]" name="queryId" id="queryId" />
</div>
}
|
mit
|
C#
|
354e4f97e75177d5676d9819d9c0108c374ef820
|
Update 40.WriteFileFixed.cs
|
MarcosMeli/FileHelpers
|
FileHelpers.Examples/Examples/10.QuickStart/40.WriteFileFixed.cs
|
FileHelpers.Examples/Examples/10.QuickStart/40.WriteFileFixed.cs
|
using System;
using System.Collections.Generic;
using FileHelpers;
namespace ExamplesFx
{
//-> Name:Write Fixed File
//-> Description:Example of how to write a Fixed Record file
//-> AutoRun:true
public class WriteFileFixed
: ExampleBase
{
//-> To write a fixed length file like this:
//-> FileOut: Output.txt
// -> You define the Record Mapping class:
//-> File:RecordClass.cs
[FixedLengthRecord()]
public class Customer
{
[FieldFixedLength(5)]
public int CustId;
[FieldFixedLength(30)]
[FieldTrim(TrimMode.Both)]
public string Name;
[FieldFixedLength(8)]
[FieldConverter(ConverterKind.Date, "ddMMyyyy")]
public DateTime AddedDate;
}
//-> /File
//-> Now just create some records and write them with the Engine:
public override void Run()
{
//-> File:Example.cs
var engine = new FileHelperEngine<Customer>();
var customers = new List<Customer>();
var order1 = new Customer() {
CustId = 1,
Name = "Antonio Moreno Taquería",
AddedDate = new DateTime(2009, 05, 01)
};
var order2 = new Customer() {
CustId = 2,
Name = "Berglunds snabbköp",
AddedDate = new DateTime(2009, 05, 02)
};
customers.Add(order1);
customers.Add(order2);
engine.WriteFile("Output.Txt", customers);
//-> /File
Console.WriteLine(engine.WriteString(customers));
}
}
}
|
using System;
using System.Collections.Generic;
using FileHelpers;
namespace ExamplesFx
{
//-> Name:Write Fixed File
//-> Description:Example of how to write a Fixed Record File
//-> AutoRun:true
public class WriteFileFixed
: ExampleBase
{
//-> To write a fixed length file like this:
//-> FileOut: Output.txt
// -> You define the Record Mapping class:
//-> File:RecordClass.cs
[FixedLengthRecord()]
public class Customer
{
[FieldFixedLength(5)]
public int CustId;
[FieldFixedLength(30)]
[FieldTrim(TrimMode.Both)]
public string Name;
[FieldFixedLength(8)]
[FieldConverter(ConverterKind.Date, "ddMMyyyy")]
public DateTime AddedDate;
}
//-> /File
//-> Now just create some records and write them with the Engine:
public override void Run()
{
//-> File:Example.cs
var engine = new FileHelperEngine<Customer>();
var customers = new List<Customer>();
var order1 = new Customer() {
CustId = 1,
Name = "Antonio Moreno Taquería",
AddedDate = new DateTime(2009, 05, 01)
};
var order2 = new Customer() {
CustId = 2,
Name = "Berglunds snabbköp",
AddedDate = new DateTime(2009, 05, 02)
};
customers.Add(order1);
customers.Add(order2);
engine.WriteFile("Output.Txt", customers);
//-> /File
Console.WriteLine(engine.WriteString(customers));
}
}
}
|
mit
|
C#
|
8fafd041feda8c450cdfa18e632555d3e2583839
|
Set Magenta as a default color for shapes
|
florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho
|
bindings/src/Shapes/Shape.cs
|
bindings/src/Shapes/Shape.cs
|
using Urho.Resources;
namespace Urho.Shapes
{
public abstract class Shape : StaticModel
{
Material material;
public override void OnAttachedToNode(Node node)
{
Model = Application.ResourceCache.GetModel(ModelResource);
Color = color;
}
protected abstract string ModelResource { get; }
Color color = Color.Magenta;
public Color Color
{
set
{
if (material == null)
{
//try to restore material (after deserialization)
material = GetMaterial(0);
if (material == null)
{
material = new Material();
material.SetTechnique(0, Application.ResourceCache.GetTechnique("Techniques/NoTextureAlpha.xml"), 1, 1);
}
SetMaterial(material);
}
material.SetShaderParameter("MatDiffColor", value);
color = value;
}
get
{
return color;
}
}
public override void OnDeserialize(IComponentDeserializer d)
{
color = d.Deserialize<Color>(nameof(Color));
}
public override void OnSerialize(IComponentSerializer s)
{
s.Serialize(nameof(Color), Color);
}
}
}
|
using Urho.Resources;
namespace Urho.Shapes
{
public abstract class Shape : StaticModel
{
Material material;
public override void OnAttachedToNode(Node node)
{
Model = Application.ResourceCache.GetModel(ModelResource);
Color = color;
}
protected abstract string ModelResource { get; }
Color color;
public Color Color
{
set
{
if (material == null)
{
//try to restore material (after deserialization)
material = GetMaterial(0);
if (material == null)
{
material = new Material();
material.SetTechnique(0, Application.ResourceCache.GetTechnique("Techniques/NoTextureAlpha.xml"), 1, 1);
}
SetMaterial(material);
}
material.SetShaderParameter("MatDiffColor", value);
color = value;
}
get
{
return color;
}
}
public override void OnDeserialize(IComponentDeserializer d)
{
color = d.Deserialize<Color>(nameof(Color));
}
public override void OnSerialize(IComponentSerializer s)
{
s.Serialize(nameof(Color), Color);
}
}
}
|
mit
|
C#
|
4171a6407fa5d8424ac96598f5e2b6a08724d92c
|
use a generic name for python dir
|
20tab/UnrealEnginePython,20tab/UnrealEnginePython,Orav/UnrealEnginePython,getnamo/UnrealEnginePython,20tab/UnrealEnginePython,kitelightning/UnrealEnginePython,getnamo/UnrealEnginePython,getnamo/UnrealEnginePython,Orav/UnrealEnginePython,getnamo/UnrealEnginePython,Orav/UnrealEnginePython,kitelightning/UnrealEnginePython,Orav/UnrealEnginePython,kitelightning/UnrealEnginePython,20tab/UnrealEnginePython,kitelightning/UnrealEnginePython,kitelightning/UnrealEnginePython,getnamo/UnrealEnginePython,20tab/UnrealEnginePython
|
Source/UnrealEnginePython/UnrealEnginePython.Build.cs
|
Source/UnrealEnginePython/UnrealEnginePython.Build.cs
|
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.IO;
public class UnrealEnginePython : ModuleRules
{
private const string pythonHome = "python35";
protected string PythonHome
{
get
{
return Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", pythonHome));
}
}
public UnrealEnginePython(TargetInfo Target)
{
System.Console.WriteLine("Using Python at: " + PythonHome);
PublicIncludePaths.AddRange(
new string[] {
"UnrealEnginePython/Public",
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
"UnrealEnginePython/Private",
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"InputCore",
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
PublicIncludePaths.Add(PythonHome);
PublicAdditionalLibraries.Add(Path.Combine(PythonHome, "libs", "python35.lib"));
}
}
|
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.IO;
public class UnrealEnginePython : ModuleRules
{
private const string pythonHome = "python-3.5.2-embed-amd64";
protected string PythonHome
{
get
{
return Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", pythonHome));
}
}
public UnrealEnginePython(TargetInfo Target)
{
System.Console.WriteLine("Using Python at: " + PythonHome);
PublicIncludePaths.AddRange(
new string[] {
"UnrealEnginePython/Public",
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
"UnrealEnginePython/Private",
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"InputCore",
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
PublicIncludePaths.Add(PythonHome);
PublicAdditionalLibraries.Add(Path.Combine(PythonHome, "libs", "python35.lib"));
}
}
|
mit
|
C#
|
90255d30b739425f8c7845dcea64c979b2c9c5af
|
Use new KeenConstants values for environment variables
|
keenlabs/keen-sdk-net
|
Keen.NetStandard.Test/ProjectSettingsProviderTest.cs
|
Keen.NetStandard.Test/ProjectSettingsProviderTest.cs
|
using System;
using NUnit.Framework;
namespace Keen.NetStandard.Tests
{
[TestFixture]
class ProjectSettingsProviderTest
{
[Test]
public void Settings_DefaultInputs_Success()
{
Assert.DoesNotThrow(() => new ProjectSettingsProvider("X", null));
}
[Test]
public void Settings_AllNull_Success()
{
Assert.DoesNotThrow(() => new ProjectSettingsProvider(null));
}
[Test]
public void SettingsProviderEnv_VarsNotSet_Throws()
{
var ProjectId = Environment.GetEnvironmentVariable(KeenConstants.KeenProjectId);
var MasterKey = Environment.GetEnvironmentVariable(KeenConstants.KeenMasterKey);
var WriteKey = Environment.GetEnvironmentVariable(KeenConstants.KeenWriteKey);
var ReadKey = Environment.GetEnvironmentVariable(KeenConstants.KeenReadKey);
try
{
Environment.SetEnvironmentVariable(KeenConstants.KeenProjectId, null);
Environment.SetEnvironmentVariable(KeenConstants.KeenMasterKey, null);
Environment.SetEnvironmentVariable(KeenConstants.KeenWriteKey, null);
Environment.SetEnvironmentVariable(KeenConstants.KeenReadKey, null);
var settings = new ProjectSettingsProviderEnv();
Assert.Throws<KeenException>(() => new KeenClient(settings));
}
finally
{
Environment.SetEnvironmentVariable(KeenConstants.KeenProjectId, ProjectId);
Environment.SetEnvironmentVariable(KeenConstants.KeenMasterKey, MasterKey);
Environment.SetEnvironmentVariable(KeenConstants.KeenWriteKey, WriteKey);
Environment.SetEnvironmentVariable(KeenConstants.KeenReadKey, ReadKey);
}
}
[Test]
public void SettingsProviderEnv_VarsSet_Success()
{
var ProjectId = Environment.GetEnvironmentVariable(KeenConstants.KeenProjectId);
var MasterKey = Environment.GetEnvironmentVariable(KeenConstants.KeenMasterKey);
var WriteKey = Environment.GetEnvironmentVariable(KeenConstants.KeenWriteKey);
var ReadKey = Environment.GetEnvironmentVariable(KeenConstants.KeenReadKey);
try
{
Environment.SetEnvironmentVariable(KeenConstants.KeenProjectId, "X");
Environment.SetEnvironmentVariable(KeenConstants.KeenMasterKey, "X");
Environment.SetEnvironmentVariable(KeenConstants.KeenWriteKey, "X");
Environment.SetEnvironmentVariable(KeenConstants.KeenReadKey, "X");
var settings = new ProjectSettingsProviderEnv();
Assert.DoesNotThrow(() => new KeenClient(settings));
}
finally
{
Environment.SetEnvironmentVariable(KeenConstants.KeenProjectId, ProjectId);
Environment.SetEnvironmentVariable(KeenConstants.KeenMasterKey, MasterKey);
Environment.SetEnvironmentVariable(KeenConstants.KeenWriteKey, WriteKey);
Environment.SetEnvironmentVariable(KeenConstants.KeenReadKey, ReadKey);
}
}
}
}
|
using System;
using NUnit.Framework;
namespace Keen.NetStandard.Tests
{
[TestFixture]
class ProjectSettingsProviderTest
{
[Test]
public void Settings_DefaultInputs_Success()
{
Assert.DoesNotThrow(() => new ProjectSettingsProvider("X", null));
}
[Test]
public void Settings_AllNull_Success()
{
Assert.DoesNotThrow(() => new ProjectSettingsProvider(null));
}
[Test]
public void SettingsProviderEnv_VarsNotSet_Throws()
{
var ProjectId = Environment.GetEnvironmentVariable("KEEN_PROJECT_ID");
var MasterKey = Environment.GetEnvironmentVariable("KEEN_MASTER_KEY");
var WriteKey = Environment.GetEnvironmentVariable("KEEN_WRITE_KEY");
var ReadKey = Environment.GetEnvironmentVariable("KEEN_READ_KEY");
try
{
Environment.SetEnvironmentVariable("KEEN_PROJECT_ID", null);
Environment.SetEnvironmentVariable("KEEN_MASTER_KEY", null);
Environment.SetEnvironmentVariable("KEEN_WRITE_KEY", null);
Environment.SetEnvironmentVariable("KEEN_READ_KEY", null);
var settings = new ProjectSettingsProviderEnv();
Assert.Throws<KeenException>(() => new KeenClient(settings));
}
finally
{
Environment.SetEnvironmentVariable("KEEN_PROJECT_ID", ProjectId);
Environment.SetEnvironmentVariable("KEEN_MASTER_KEY", MasterKey);
Environment.SetEnvironmentVariable("KEEN_WRITE_KEY", WriteKey);
Environment.SetEnvironmentVariable("KEEN_READ_KEY", ReadKey);
}
}
[Test]
public void SettingsProviderEnv_VarsSet_Success()
{
var ProjectId = Environment.GetEnvironmentVariable("KEEN_PROJECT_ID");
var MasterKey = Environment.GetEnvironmentVariable("KEEN_MASTER_KEY");
var WriteKey = Environment.GetEnvironmentVariable("KEEN_WRITE_KEY");
var ReadKey = Environment.GetEnvironmentVariable("KEEN_READ_KEY");
try
{
Environment.SetEnvironmentVariable("KEEN_PROJECT_ID", "X");
Environment.SetEnvironmentVariable("KEEN_MASTER_KEY", "X");
Environment.SetEnvironmentVariable("KEEN_WRITE_KEY", "X");
Environment.SetEnvironmentVariable("KEEN_READ_KEY", "X");
var settings = new ProjectSettingsProviderEnv();
Assert.DoesNotThrow(() => new KeenClient(settings));
}
finally
{
Environment.SetEnvironmentVariable("KEEN_PROJECT_ID", ProjectId);
Environment.SetEnvironmentVariable("KEEN_MASTER_KEY", MasterKey);
Environment.SetEnvironmentVariable("KEEN_WRITE_KEY", WriteKey);
Environment.SetEnvironmentVariable("KEEN_READ_KEY", ReadKey);
}
}
}
}
|
mit
|
C#
|
1a31bd140f5257a07a40317e15410f29e6a7268e
|
Return File() result (file on the server).
|
mrwizard82d1/building_mvc4,mrwizard82d1/building_mvc4
|
OdeToFood/OdeToFood/Controllers/CuisineController.cs
|
OdeToFood/OdeToFood/Controllers/CuisineController.cs
|
using System.Net;
using System.Web.Mvc;
namespace OdeToFood.Controllers
{
public class CuisineController : Controller
{
//
// GET: /Cuisine/
// Including parameter named "name" causes MVC framework to try to
// find a parameter named "name" in ANY of the web request (routing
// data, query string or posted form data).
public ActionResult Search(string name = "french")
{
// Server.MapPath() converts from virtual path to actual path on
// the **server** filesystem. The symbol ~ identifies the
// application root (OdeToFood).
var encodedName = Server.HtmlEncode(name);
return File(Server.MapPath("~/Content/Site.css"), "text/css");
}
}
}
|
using System.Web.Mvc;
namespace OdeToFood.Controllers
{
public class CuisineController : Controller
{
//
// GET: /Cuisine/
// Including parameter named "name" causes MVC framework to try to
// find a parameter named "name" in ANY of the web request (routing
// data, query string or posted form data).
public ActionResult Search(string name = "french")
{
// HtmlEncode prevents cross-site scripting attack. (Razor will
// prevent this but a call to Content() assumes you know what
// you are doing. You have been warned!
var encodedName = Server.HtmlEncode(name);
return RedirectToRoute("Default", new {controller = "Home", action = "About"});
}
}
}
|
isc
|
C#
|
c86770c1a623635b8b266bb8d3a365f2c0994dca
|
Make the delayed factory repo cache a concurrent dictionary, dict is not thread safe
|
volak/Aggregates.NET,volak/Aggregates.NET
|
src/Aggregates.NET.Domain/Internal/DefaultRepositoryFactory.cs
|
src/Aggregates.NET.Domain/Internal/DefaultRepositoryFactory.cs
|
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Aggregates.Contracts;
using NServiceBus.ObjectBuilder;
namespace Aggregates.Internal
{
class DefaultRepositoryFactory : IRepositoryFactory
{
private static readonly ConcurrentDictionary<Type, Type> RepoCache = new ConcurrentDictionary<Type, Type>();
public IRepository<T> ForAggregate<T>(IBuilder builder) where T : Aggregate<T>
{
var repoType = RepoCache.GetOrAdd(typeof(T), (key) => typeof(Repository<>).MakeGenericType(typeof(T)));
return (IRepository<T>)Activator.CreateInstance(repoType, builder);
}
public IRepository<TParent, T> ForEntity<TParent, T>(TParent parent, IBuilder builder) where T : Entity<T, TParent> where TParent : Entity<TParent>
{
var repoType = RepoCache.GetOrAdd(typeof(T), (key) => typeof(Repository<,>).MakeGenericType(typeof(TParent), typeof(T)));
return (IRepository<TParent, T>)Activator.CreateInstance(repoType, parent, builder);
}
public IPocoRepository<T> ForPoco<T>(IBuilder builder) where T : class, new()
{
var repoType = RepoCache.GetOrAdd(typeof(T), (key) => typeof(PocoRepository<>).MakeGenericType(typeof(T)));
return (IPocoRepository<T>)Activator.CreateInstance(repoType, builder);
}
public IPocoRepository<TParent, T> ForPoco<TParent, T>(TParent parent, IBuilder builder) where T : class, new() where TParent : Entity<TParent>
{
var repoType = RepoCache.GetOrAdd(typeof(T), (key) => typeof(PocoRepository<,>).MakeGenericType(typeof(TParent), typeof(T)));
return (IPocoRepository<TParent, T>)Activator.CreateInstance(repoType, parent, builder);
}
}
}
|
using System;
using System.Collections.Generic;
using Aggregates.Contracts;
using NServiceBus.ObjectBuilder;
namespace Aggregates.Internal
{
class DefaultRepositoryFactory : IRepositoryFactory
{
private static readonly IDictionary<Type, Type> RepoCache = new Dictionary<Type, Type>();
public IRepository<T> ForAggregate<T>(IBuilder builder) where T : Aggregate<T>
{
Type repoType;
if (!RepoCache.TryGetValue(typeof(T), out repoType))
repoType = RepoCache[typeof(T)] = typeof(Repository<>).MakeGenericType(typeof(T));
return (IRepository<T>)Activator.CreateInstance(repoType, builder);
}
public IRepository<TParent, T> ForEntity<TParent, T>(TParent parent, IBuilder builder) where T : Entity<T, TParent> where TParent : Entity<TParent>
{
// Is it possible to have an entity type with multiple different types of parents? Nope
Type repoType;
if (!RepoCache.TryGetValue(typeof(T), out repoType))
repoType = RepoCache[typeof(T)] = typeof(Repository<,>).MakeGenericType(typeof(TParent), typeof(T));
return (IRepository<TParent, T>)Activator.CreateInstance(repoType, parent, builder);
}
public IPocoRepository<T> ForPoco<T>(IBuilder builder) where T : class, new()
{
Type repoType;
if (!RepoCache.TryGetValue(typeof(T), out repoType))
repoType = RepoCache[typeof(T)] = typeof(PocoRepository<>).MakeGenericType(typeof(T));
return (IPocoRepository<T>)Activator.CreateInstance(repoType, builder);
}
public IPocoRepository<TParent, T> ForPoco<TParent, T>(TParent parent, IBuilder builder) where T : class, new() where TParent : Entity<TParent>
{
Type repoType;
if (!RepoCache.TryGetValue(typeof(T), out repoType))
repoType = RepoCache[typeof(T)] = typeof(PocoRepository<,>).MakeGenericType(typeof(TParent), typeof(T));
return (IPocoRepository<TParent, T>)Activator.CreateInstance(repoType, parent, builder);
}
}
}
|
mit
|
C#
|
d79156668b40a4105ffd3bb4a5e43fd83bc68cfa
|
create directory before save
|
isukces/isukces.code
|
isukces.code/Features/IO/CodeFileUtils.cs
|
isukces.code/Features/IO/CodeFileUtils.cs
|
using System.IO;
using System.Linq;
using System.Text;
namespace isukces.code.IO
{
public class CodeFileUtils
{
public static bool AreEqual(byte[] a, byte[] b)
{
a = a ?? new byte[0];
b = b ?? new byte[0];
var al = a.Length;
var bl = b.Length;
if (al != bl) return false;
if (al == 0)
return true;
for (var i = 0; i < al; i++)
{
if (a[i] != b[i])
return false;
}
return true;
}
public static byte[] Encode(string txt, bool addBom)
{
var bytes = Encoding.UTF8.GetBytes(txt);
if (!addBom)
return bytes;
using (var stream = new MemoryStream())
{
stream.Write(Bom, 0, Bom.Length);
stream.Write(bytes, 0, bytes.Length);
return stream.ToArray();
}
}
public static bool SaveIfDifferent(string content, string filename, bool addBom)
{
byte[] existing = null;
if (File.Exists(filename))
existing = File.ReadAllBytes(filename);
var newCodeBytes = Encode(content, addBom);
if (AreEqual(existing, newCodeBytes))
return false;
new FileInfo(filename).Directory?.Create();
File.WriteAllBytes(filename, newCodeBytes);
return true;
}
private static readonly byte[] Bom = { 0xEF, 0xBB, 0xBF };
}
}
|
using System.IO;
using System.Linq;
using System.Text;
namespace isukces.code.IO
{
public class CodeFileUtils
{
public static bool AreEqual(byte[] a, byte[] b)
{
a = a ?? new byte[0];
b = b ?? new byte[0];
var al = a.Length;
var bl = b.Length;
if (al != bl) return false;
if (al == 0)
return true;
for (var i = 0; i < al; i++)
{
if (a[i] != b[i])
return false;
}
return true;
}
public static byte[] Encode(string txt, bool addBom)
{
var bytes = Encoding.UTF8.GetBytes(txt);
if (!addBom)
return bytes;
using (var stream = new MemoryStream())
{
stream.Write(Bom, 0, Bom.Length);
stream.Write(bytes, 0, bytes.Length);
return stream.ToArray();
}
}
public static bool SaveIfDifferent(string content, string filename, bool addBom)
{
byte[] existing = null;
if (File.Exists(filename))
existing = File.ReadAllBytes(filename);
var newCodeBytes = Encode(content, addBom);
if (AreEqual(existing, newCodeBytes))
return false;
File.WriteAllBytes(filename, newCodeBytes);
return true;
}
private static readonly byte[] Bom = { 0xEF, 0xBB, 0xBF };
}
}
|
mit
|
C#
|
e5f0b123ca58a2490adc24c5c054d0a6b3bd1c7a
|
Add more reporters by default
|
droyad/Assent
|
src/Assent/Reporters/DiffReporter.cs
|
src/Assent/Reporters/DiffReporter.cs
|
using System;
using System.Collections.Generic;
using Assent.Reporters.DiffPrograms;
namespace Assent.Reporters
{
public class DiffReporter : IReporter
{
#if NET45
internal static readonly bool IsWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
#else
internal static readonly bool IsWindows = System.Runtime.InteropServices.RuntimeInformation
.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
#endif
static DiffReporter()
{
DefaultDiffPrograms = IsWindows
? new IDiffProgram[]
{
new BeyondCompareDiffProgram(),
new KDiff3DiffProgram(),
new XdiffDiffProgram(),
new P4MergeDiffProgram(),
new VsCodeDiffProgram()
}
: new IDiffProgram[]
{
new VsCodeDiffProgram()
};
}
public static readonly IReadOnlyList<IDiffProgram> DefaultDiffPrograms;
private readonly IReadOnlyList<IDiffProgram> _diffPrograms;
public DiffReporter() : this(DefaultDiffPrograms)
{
}
public DiffReporter(IReadOnlyList<IDiffProgram> diffPrograms)
{
_diffPrograms = diffPrograms;
}
public void Report(string receivedFile, string approvedFile)
{
foreach (var program in _diffPrograms)
if (program.Launch(receivedFile, approvedFile))
return;
throw new Exception("Could not find a diff program to use");
}
}
}
|
using System;
using System.Collections.Generic;
using Assent.Reporters.DiffPrograms;
namespace Assent.Reporters
{
public class DiffReporter : IReporter
{
#if NET45
internal static readonly bool IsWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
#else
internal static readonly bool IsWindows = System.Runtime.InteropServices.RuntimeInformation
.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
#endif
static DiffReporter()
{
DefaultDiffPrograms = IsWindows
? new IDiffProgram[]
{
new BeyondCompareDiffProgram(),
new KDiff3DiffProgram(),
new XdiffDiffProgram()
}
: new IDiffProgram[]
{
new VsCodeDiffProgram(),
};
}
public static readonly IReadOnlyList<IDiffProgram> DefaultDiffPrograms;
private readonly IReadOnlyList<IDiffProgram> _diffPrograms;
public DiffReporter() : this(DefaultDiffPrograms)
{
}
public DiffReporter(IReadOnlyList<IDiffProgram> diffPrograms)
{
_diffPrograms = diffPrograms;
}
public void Report(string receivedFile, string approvedFile)
{
foreach (var program in _diffPrograms)
if (program.Launch(receivedFile, approvedFile))
return;
throw new Exception("Could not find a diff program to use");
}
}
}
|
mit
|
C#
|
765adbf2111f5de97dfb0a81ce9dacec0f73c672
|
Fix test failing due to work on BL-2932
|
StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,JohnThomson/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop
|
src/BloomTests/PretendRequestInfo.cs
|
src/BloomTests/PretendRequestInfo.cs
|
// Copyright (c) 2014 SIL International
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System.Collections.Specialized;
using System.IO;
using System.Text;
namespace Bloom.web
{
public class PretendRequestInfo : IRequestInfo
{
public string ReplyContents;
public string ReplyImagePath;
//public HttpListenerContext Context; //todo: could we mock a context and then all but do away with this pretend class by subclassing the real one?
public long StatusCode;
public string StatusDescription;
public PretendRequestInfo(string url, bool forPrinting = false, bool forSrcAttr = false)
{
if (forPrinting)
url = url.Replace("/bloom/", "/bloom/OriginalImages/");
// In the real request, RawUrl does not include this prefix
RawUrl = url.Replace("http://localhost:8089", "");
// When JavaScript inserts a real path into the html it replaces the three magic html characters with these substitutes.
// For this PretendRequestInfo we simulate that by doing the replace here in the url.
if (forSrcAttr)
url = EnhancedImageServer.SimulateJavaScriptHandlingOfHtml(url);
// Reducing the /// emulates a behavior of the real HttpListener
LocalPathWithoutQuery = url.Replace("http://localhost:8089", "").Replace("/bloom/OriginalImages///", "/bloom/OriginalImages/").Replace("/bloom///", "/bloom/").UnescapeCharsForHttp();
}
public string LocalPathWithoutQuery { get; set; }
public string ContentType { get; set; }
/// <summary>
/// wrap so that it is easily consumed by our standard xml unit test stuff, which can't handled fragments
/// </summary>
public string ReplyContentsAsXml
{
get { return "<root>" + ReplyContents + "</root>"; }
}
public void WriteCompleteOutput(string s)
{
var buffer = Encoding.UTF8.GetBytes(s);
ReplyContents = Encoding.UTF8.GetString(buffer);
}
public void ReplyWithFileContent(string path)
{
ReplyImagePath = path;
WriteCompleteOutput(File.ReadAllText(path));
}
public void ReplyWithImage(string path)
{
ReplyImagePath = path;
}
public void WriteError(int errorCode, string errorDescription)
{
StatusCode = errorCode;
StatusDescription = errorDescription;
}
public void WriteError(int errorCode)
{
StatusCode = errorCode;
}
public NameValueCollection GetQueryString()
{
return new NameValueCollection();
}
public NameValueCollection GetPostData()
{
return new NameValueCollection();
}
public string RawUrl { get; private set; }
}
}
|
// Copyright (c) 2014 SIL International
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System.Collections.Specialized;
using System.IO;
using System.Text;
namespace Bloom.web
{
public class PretendRequestInfo : IRequestInfo
{
public string ReplyContents;
public string ReplyImagePath;
//public HttpListenerContext Context; //todo: could we mock a context and then all but do away with this pretend class by subclassing the real one?
public long StatusCode;
public string StatusDescription;
public PretendRequestInfo(string url, bool forPrinting = false, bool forSrcAttr = false)
{
if (forPrinting)
url = url.Replace("/bloom/", "/bloom/OriginalImages/");
// In the real request, RawUrl does not include this prefix
RawUrl = url.Replace("http://localhost:8089", "");
// When JavaScript inserts a real path into the html it replaces the three magic html characters with these substitutes.
// For this PretendRequestInfo we simulate that by doing the replace here in the url.
if (forSrcAttr)
url = EnhancedImageServer.SimulateJavaScriptHandlingOfHtml(url);
// Reducing the /// emulates a behavior of the real HttpListener
LocalPathWithoutQuery = RawUrl.Replace("/bloom/OriginalImages///", "/bloom/OriginalImages/").Replace("/bloom///", "/bloom/").UnescapeCharsForHttp();
}
public string LocalPathWithoutQuery { get; set; }
public string ContentType { get; set; }
/// <summary>
/// wrap so that it is easily consumed by our standard xml unit test stuff, which can't handled fragments
/// </summary>
public string ReplyContentsAsXml
{
get { return "<root>" + ReplyContents + "</root>"; }
}
public void WriteCompleteOutput(string s)
{
var buffer = Encoding.UTF8.GetBytes(s);
ReplyContents = Encoding.UTF8.GetString(buffer);
}
public void ReplyWithFileContent(string path)
{
ReplyImagePath = path;
WriteCompleteOutput(File.ReadAllText(path));
}
public void ReplyWithImage(string path)
{
ReplyImagePath = path;
}
public void WriteError(int errorCode, string errorDescription)
{
StatusCode = errorCode;
StatusDescription = errorDescription;
}
public void WriteError(int errorCode)
{
StatusCode = errorCode;
}
public NameValueCollection GetQueryString()
{
return new NameValueCollection();
}
public NameValueCollection GetPostData()
{
return new NameValueCollection();
}
public string RawUrl { get; private set; }
}
}
|
mit
|
C#
|
91836f3a01c3e0194a39839cc28525a86ea4d189
|
enable dnu on osx/linux if dnu in path
|
andycmaj/cake,UnbelievablyRitchie/cake,phenixdotnet/cake,vlesierse/cake,andycmaj/cake,DixonD-git/cake,UnbelievablyRitchie/cake,thomaslevesque/cake,robgha01/cake,gep13/cake,patriksvensson/cake,SharpeRAD/Cake,robgha01/cake,devlead/cake,cake-build/cake,vlesierse/cake,Julien-Mialon/cake,Sam13/cake,daveaglick/cake,ferventcoder/cake,phenixdotnet/cake,cake-build/cake,phrusher/cake,michael-wolfenden/cake,adamhathcock/cake,daveaglick/cake,RehanSaeed/cake,RehanSaeed/cake,devlead/cake,Julien-Mialon/cake,SharpeRAD/Cake,RichiCoder1/cake,adamhathcock/cake,ferventcoder/cake,Sam13/cake,gep13/cake,michael-wolfenden/cake,phrusher/cake,mholo65/cake,mholo65/cake,thomaslevesque/cake,RichiCoder1/cake,patriksvensson/cake
|
src/Cake.Common/Tools/DNU/DNUTool.cs
|
src/Cake.Common/Tools/DNU/DNUTool.cs
|
using System.Collections.Generic;
using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;
namespace Cake.Common.Tools.DNU
{
/// <summary>
/// Base class for all DNU related tools
/// </summary>
/// <typeparam name="TSettings">The settings type</typeparam>
public abstract class DNUTool<TSettings> : Tool<TSettings>
where TSettings : ToolSettings
{
/// <summary>
/// Initializes a new instance of the <see cref="DNUTool{TSettings}" /> class.
/// </summary>
/// <param name="fileSystem">The file system.</param>
/// <param name="environment">The environment.</param>
/// <param name="processRunner">The process runner.</param>
/// <param name="globber">The globber.</param>
protected DNUTool(
IFileSystem fileSystem,
ICakeEnvironment environment,
IProcessRunner processRunner,
IGlobber globber)
: base(fileSystem, environment, processRunner, globber)
{
}
/// <summary>
/// Gets the name of the tool.
/// </summary>
/// <returns>The name of the tool.</returns>
protected override string GetToolName()
{
return "DNU";
}
/// <summary>
/// Gets the possible names of the tool executable.
/// </summary>
/// <returns>The tool executable name.</returns>
protected override IEnumerable<string> GetToolExecutableNames()
{
return new[] { "dnu.cmd", "dnu" };
}
}
}
|
using System.Collections.Generic;
using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;
namespace Cake.Common.Tools.DNU
{
/// <summary>
/// Base class for all DNU related tools
/// </summary>
/// <typeparam name="TSettings">The settings type</typeparam>
public abstract class DNUTool<TSettings> : Tool<TSettings>
where TSettings : ToolSettings
{
/// <summary>
/// Initializes a new instance of the <see cref="DNUTool{TSettings}" /> class.
/// </summary>
/// <param name="fileSystem">The file system.</param>
/// <param name="environment">The environment.</param>
/// <param name="processRunner">The process runner.</param>
/// <param name="globber">The globber.</param>
protected DNUTool(
IFileSystem fileSystem,
ICakeEnvironment environment,
IProcessRunner processRunner,
IGlobber globber)
: base(fileSystem, environment, processRunner, globber)
{
}
/// <summary>
/// Gets the name of the tool.
/// </summary>
/// <returns>The name of the tool.</returns>
protected override string GetToolName()
{
return "DNU";
}
/// <summary>
/// Gets the possible names of the tool executable.
/// </summary>
/// <returns>The tool executable name.</returns>
protected override IEnumerable<string> GetToolExecutableNames()
{
return new[] { "dnu.cmd" };
}
}
}
|
mit
|
C#
|
4a9c4517b65298c730edd9c3663635c813efe79c
|
exclude documentation attr from coverage
|
tohosnet/NLog,kevindaub/NLog,snakefoot/NLog,MoaidHathot/NLog,nazim9214/NLog,hubo0831/NLog,FeodorFitsner/NLog,MoaidHathot/NLog,Niklas-Peter/NLog,NLog/NLog,ie-zero/NLog,pwelter34/NLog,MartinTherriault/NLog,304NotModified/NLog,hubo0831/NLog,UgurAldanmaz/NLog,AndreGleichner/NLog,michaeljbaird/NLog,ArsenShnurkov/NLog,ie-zero/NLog,tohosnet/NLog,FeodorFitsner/NLog,bhaeussermann/NLog,bryjamus/NLog,BrutalCode/NLog,ilya-g/NLog,breyed/NLog,Niklas-Peter/NLog,ilya-g/NLog,tetrodoxin/NLog,kevindaub/NLog,pwelter34/NLog,bjornbouetsmith/NLog,bryjamus/NLog,luigiberrettini/NLog,MartinTherriault/NLog,bjornbouetsmith/NLog,bhaeussermann/NLog,ArsenShnurkov/NLog,luigiberrettini/NLog,michaeljbaird/NLog,littlesmilelove/NLog,UgurAldanmaz/NLog,AndreGleichner/NLog,tetrodoxin/NLog,BrutalCode/NLog,littlesmilelove/NLog,breyed/NLog,sean-gilliam/NLog,nazim9214/NLog
|
src/NLog/Config/AdvancedAttribute.cs
|
src/NLog/Config/AdvancedAttribute.cs
|
//
// Copyright (c) 2004-2011 Jaroslaw Kowalski <jaak@jkowalski.net>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of Jaroslaw Kowalski nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//
namespace NLog.Config
{
using System;
/// <summary>
/// Marks the class or a member as advanced. Advanced classes and members are hidden by
/// default in generated documentation.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
#if NET4_0 || NET4_5
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
#endif
public sealed class AdvancedAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="AdvancedAttribute" /> class.
/// </summary>
public AdvancedAttribute()
{
}
}
}
|
//
// Copyright (c) 2004-2011 Jaroslaw Kowalski <jaak@jkowalski.net>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of Jaroslaw Kowalski nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//
namespace NLog.Config
{
using System;
/// <summary>
/// Marks the class or a member as advanced. Advanced classes and members are hidden by
/// default in generated documentation.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public sealed class AdvancedAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="AdvancedAttribute" /> class.
/// </summary>
public AdvancedAttribute()
{
}
}
}
|
bsd-3-clause
|
C#
|
e639e991524eb4386f2a54b1a5904f196ca0fc04
|
Put Squirrel updater behind conditional compilation flag
|
willduff/OpenLiveWriter-1,willduff/OpenLiveWriter-1,hashhar/OpenLiveWriter,willduff/OpenLiveWriter-1,willduff/OpenLiveWriter-1,hashhar/OpenLiveWriter,hashhar/OpenLiveWriter,hashhar/OpenLiveWriter,hashhar/OpenLiveWriter,willduff/OpenLiveWriter-1
|
src/managed/OpenLiveWriter.PostEditor/Updates/UpdateManager.cs
|
src/managed/OpenLiveWriter.PostEditor/Updates/UpdateManager.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
using OpenLiveWriter.CoreServices;
using OpenLiveWriter.CoreServices.ResourceDownloading;
using Squirrel;
using System;
using System.Collections;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Threading;
using System.Xml;
namespace OpenLiveWriter.PostEditor.Updates
{
public class UpdateManager
{
public static DateTime Expires = DateTime.MaxValue;
public static void CheckforUpdates(bool forceCheck = false)
{
#if !DesktopUWP
// Update using Squirrel if not a Desktop UWP package
var checkNow = forceCheck || UpdateSettings.AutoUpdate;
var downloadUrl = UpdateSettings.CheckForBetaUpdates ?
UpdateSettings.BetaUpdateDownloadUrl : UpdateSettings.UpdateDownloadUrl;
// Schedule Open Live Writer 10 seconds after the launch
var delayUpdate = new DelayUpdateHelper(UpdateOpenLiveWriter(downloadUrl, checkNow), UPDATELAUNCHDELAY);
delayUpdate.StartBackgroundUpdate("Background OpenLiveWriter application update");
#endif
}
private static ThreadStart UpdateOpenLiveWriter(string downloadUrl, bool checkNow)
{
return async () =>
{
if (checkNow)
{
try
{
using (var manager = new Squirrel.UpdateManager(downloadUrl))
{
await manager.UpdateApp();
}
}
catch (Exception ex)
{
Trace.WriteLine("Unexpected error while updating Open Live Writer. " + ex);
}
}
};
}
private const int UPDATELAUNCHDELAY = 10000;
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
using OpenLiveWriter.CoreServices;
using OpenLiveWriter.CoreServices.ResourceDownloading;
using Squirrel;
using System;
using System.Collections;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Threading;
using System.Xml;
namespace OpenLiveWriter.PostEditor.Updates
{
public class UpdateManager
{
public static DateTime Expires = DateTime.MaxValue;
public static void CheckforUpdates(bool forceCheck = false)
{
var checkNow = forceCheck || UpdateSettings.AutoUpdate;
var downloadUrl = UpdateSettings.CheckForBetaUpdates ?
UpdateSettings.BetaUpdateDownloadUrl : UpdateSettings.UpdateDownloadUrl;
// Schedule Open Live Writer 10 seconds after the launch
var delayUpdate = new DelayUpdateHelper(UpdateOpenLiveWriter(downloadUrl, checkNow), UPDATELAUNCHDELAY);
delayUpdate.StartBackgroundUpdate("Background OpenLiveWriter application update");
}
private static ThreadStart UpdateOpenLiveWriter(string downloadUrl, bool checkNow)
{
return async () =>
{
if (checkNow)
{
try
{
using (var manager = new Squirrel.UpdateManager(downloadUrl))
{
await manager.UpdateApp();
}
}
catch (Exception ex)
{
Trace.WriteLine("Unexpected error while updating Open Live Writer. " + ex);
}
}
};
}
private const int UPDATELAUNCHDELAY = 10000;
}
}
|
mit
|
C#
|
e627ba9cc600ebbc908adf390f72218ea52eb66c
|
Add AddItem extension method to ListControl
|
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
|
R7.University/ControlExtensions/ListControlExtensions.cs
|
R7.University/ControlExtensions/ListControlExtensions.cs
|
//
// ListControlExtensions.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2016 Roman M. Yagodin
//
// 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.WebControls;
namespace R7.University.ControlExtensions
{
public static class ListControlExtensions
{
public static bool SelectByText (this ListControl listControl, string text, StringComparison comparison)
{
if (!string.IsNullOrWhiteSpace (text)) {
foreach (ListItem item in listControl.Items) {
if (string.Compare (item.Text, text, comparison) == 0) {
item.Selected = true;
return true;
}
}
}
return false;
}
public static void AddItem (this ListControl listControl, string text, string value)
{
listControl.Items.Add (new ListItem (text, value));
}
}
}
|
//
// ListControlExtensions.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2016 Roman M. Yagodin
//
// 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.WebControls;
namespace R7.University.ControlExtensions
{
public static class ListControlExtensions
{
public static bool SelectByText (this ListControl listControl, string text, StringComparison comparison)
{
if (!string.IsNullOrWhiteSpace (text)) {
foreach (ListItem item in listControl.Items) {
if (string.Compare (item.Text, text, comparison) == 0) {
item.Selected = true;
return true;
}
}
}
return false;
}
}
}
|
agpl-3.0
|
C#
|
cf933bdd420c16b93b16381eb9e0d02948298fab
|
Stop using [Timeout] so that there should be no thread abort on the test thread
|
ggeurts/nunit,mjedrzejek/nunit,NikolayPianikov/nunit,JustinRChou/nunit,nunit/nunit,appel1/nunit,ggeurts/nunit,appel1/nunit,agray/nunit,mikkelbu/nunit,jadarnel27/nunit,JustinRChou/nunit,mikkelbu/nunit,nunit/nunit,mjedrzejek/nunit,OmicronPersei/nunit,agray/nunit,NikolayPianikov/nunit,agray/nunit,OmicronPersei/nunit,jadarnel27/nunit
|
src/NUnitFramework/tests/Internal/ThreadUtilityTests.cs
|
src/NUnitFramework/tests/Internal/ThreadUtilityTests.cs
|
#if !NETSTANDARD1_3 && !NETSTANDARD1_6
using System.Runtime.InteropServices;
using System.Threading;
namespace NUnit.Framework.Internal
{
[TestFixture]
public class ThreadUtilityTests
{
[Platform("Win")]
[TestCase(false, TestName = "Abort")]
[TestCase(true, TestName = "Kill")]
public void AbortOrKillThreadWithMessagePump(bool kill)
{
using (var isThreadAboutToWait = new ManualResetEvent(false))
{
var nativeId = 0;
var thread = new Thread(() =>
{
nativeId = ThreadUtility.GetCurrentThreadNativeId();
isThreadAboutToWait.Set();
while (true)
WaitMessage();
});
thread.Start();
isThreadAboutToWait.WaitOne();
Thread.Sleep(1);
if (kill)
ThreadUtility.Kill(thread, nativeId);
else
ThreadUtility.Abort(thread, nativeId);
Assert.That(thread.Join(1000), "Native message pump was not able to be interrupted to enable a managed thread abort.");
}
}
[DllImport("user32.dll")]
private static extern bool WaitMessage();
}
}
#endif
|
#if !NETSTANDARD1_3 && !NETSTANDARD1_6
using System.Runtime.InteropServices;
using System.Threading;
namespace NUnit.Framework.Internal
{
[TestFixture]
public class ThreadUtilityTests
{
[Platform("Win")]
[Timeout(1000)]
[TestCase(false, TestName = "Abort")]
[TestCase(true, TestName = "Kill")]
public void AbortOrKillThreadWithMessagePump(bool kill)
{
using (var isThreadAboutToWait = new ManualResetEvent(false))
{
var nativeId = 0;
var thread = new Thread(() =>
{
nativeId = ThreadUtility.GetCurrentThreadNativeId();
isThreadAboutToWait.Set();
while (true)
WaitMessage();
});
thread.Start();
isThreadAboutToWait.WaitOne();
Thread.Sleep(1);
if (kill)
ThreadUtility.Kill(thread, nativeId);
else
ThreadUtility.Abort(thread, nativeId);
thread.Join();
}
}
[DllImport("user32.dll")]
private static extern bool WaitMessage();
}
}
#endif
|
mit
|
C#
|
92176a781f95efe755dc3df62499e130a2c976ed
|
make Uri property's setter internal
|
AnthonySteele/SevenDigital.Api.Wrapper,raoulmillais/SevenDigital.Api.Wrapper,actionshrimp/SevenDigital.Api.Wrapper,mattgray/SevenDigital.Api.Wrapper,luiseduardohdbackup/SevenDigital.Api.Wrapper,bettiolo/SevenDigital.Api.Wrapper,emashliles/SevenDigital.Api.Wrapper,knocte/SevenDigital.Api.Wrapper,minkaotic/SevenDigital.Api.Wrapper,gregsochanik/SevenDigital.Api.Wrapper,danbadge/SevenDigital.Api.Wrapper,bnathyuw/SevenDigital.Api.Wrapper,danhaller/SevenDigital.Api.Wrapper
|
src/SevenDigital.Api.Wrapper/Exceptions/ApiException.cs
|
src/SevenDigital.Api.Wrapper/Exceptions/ApiException.cs
|
using System;
using System.Net;
using System.Runtime.Serialization;
using SevenDigital.Api.Wrapper.Utility.Http;
namespace SevenDigital.Api.Wrapper.Exceptions
{
public abstract class ApiException : Exception
{
public string Uri { get; internal set; }
public HttpStatusCode StatusCode { get; private set; }
public string ResponseBody { get; private set; }
protected ApiException()
{
}
protected ApiException(string message)
: base(message)
{
}
protected ApiException(string message, Exception innerException)
: base(message, innerException)
{
}
protected ApiException(string message, Exception innerException, Response response)
: base(message, innerException)
{
ResponseBody = response.Body;
StatusCode = response.StatusCode;
}
protected ApiException(string message, Response response)
: base(message)
{
ResponseBody = response.Body;
StatusCode = response.StatusCode;
}
protected ApiException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
|
using System;
using System.Net;
using System.Runtime.Serialization;
using SevenDigital.Api.Wrapper.Utility.Http;
namespace SevenDigital.Api.Wrapper.Exceptions
{
public abstract class ApiException : Exception
{
public string Uri { get; set; }
public HttpStatusCode StatusCode { get; private set; }
public string ResponseBody { get; private set; }
protected ApiException()
{
}
protected ApiException(string message)
: base(message)
{
}
protected ApiException(string message, Exception innerException)
: base(message, innerException)
{
}
protected ApiException(string message, Exception innerException, Response response)
: base(message, innerException)
{
ResponseBody = response.Body;
StatusCode = response.StatusCode;
}
protected ApiException(string message, Response response)
: base(message)
{
ResponseBody = response.Body;
StatusCode = response.StatusCode;
}
protected ApiException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
|
mit
|
C#
|
fc8586ca177e5285e67413c8963e1f70f2cfc348
|
Use switch expression
|
inputfalken/Sharpy
|
src/Sharpy.Builder/Implementation/ArgumentRandomizer.cs
|
src/Sharpy.Builder/Implementation/ArgumentRandomizer.cs
|
using System;
using Sharpy.Builder.IProviders;
namespace Sharpy.Builder.Implementation
{
/// <summary>
/// Randomizes from the arguments.
/// </summary>
public sealed class ArgumentRandomizer : IArgumentProvider
{
private readonly Random _random;
/// <summary>
/// The <see cref="Random" /> for randomizing arguments.
/// </summary>
public ArgumentRandomizer(Random random) => _random = random ?? throw new ArgumentNullException(nameof(random));
/// <summary>
/// Returns a randomized element from the arguments supplied.
/// </summary>
/// <typeparam name="T">
/// The type of the arguments.
/// </typeparam>
/// <param name="first">
/// First argument.
/// </param>
/// <param name="second">
/// Second argument.
/// </param>
/// <param name="additional">
/// Additional arguments after argument <paramref name="first" /> and argument <paramref name="second" /> has been
/// supplied.
/// </param>
/// <returns>
/// One of the arguments supplied.
/// </returns>
public T Argument<T>(T first, T second, params T[] additional)
{
return _random.Next(-2, additional.Length) switch
{
-2 => first,
-1 => second,
{} x => additional[x]
};
}
}
}
|
using System;
using Sharpy.Builder.IProviders;
namespace Sharpy.Builder.Implementation {
/// <summary>
/// Randomizes from the arguments.
/// </summary>
public sealed class ArgumentRandomizer : IArgumentProvider {
private readonly Random _random;
/// <summary>
/// The <see cref="Random" /> for randomizing arguments.
/// </summary>
public ArgumentRandomizer(Random random) => _random = random ?? throw new ArgumentNullException(nameof(random));
/// <summary>
/// Returns a randomized element from the arguments supplied.
/// </summary>
/// <typeparam name="T">
/// The type of the arguments.
/// </typeparam>
/// <param name="first">
/// First argument.
/// </param>
/// <param name="second">
/// Second argument.
/// </param>
/// <param name="additional">
/// Additional arguments after argument <paramref name="first" /> and argument <paramref name="second" /> has been
/// supplied.
/// </param>
/// <returns>
/// One of the arguments supplied.
/// </returns>
public T Argument<T>(T first, T second, params T[] additional) {
var res = _random.Next(-2, additional.Length);
switch (res) {
case -2: return first;
case -1: return second;
default: return additional[res];
}
}
}
}
|
mit
|
C#
|
c5873e96f17eaddf7e41268062bf3aafea518ebf
|
fix build
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModelBase.cs
|
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModelBase.cs
|
using ReactiveUI;
using System;
using WalletWasabi.Gui.ViewModels;
using System.Diagnostics.CodeAnalysis;
using WalletWasabi.Wallets;
using WalletWasabi.Helpers;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class WalletViewModelBase : ViewModelBase, IComparable<WalletViewModelBase>
{
private bool _isExpanded;
private bool _isBusy;
public WalletViewModelBase(Wallet wallet)
{
Wallet = Guard.NotNull(nameof(wallet), wallet);
Wallet = wallet;
}
protected Wallet Wallet { get; }
public bool IsExpanded
{
get => _isExpanded;
set => this.RaiseAndSetIfChanged(ref _isExpanded, value);
}
public string Title => Wallet.WalletName;
public bool IsBusy
{
get { return _isBusy; }
set { this.RaiseAndSetIfChanged(ref _isBusy, value); }
}
public int CompareTo([AllowNull] WalletViewModelBase other)
{
return Title.CompareTo(other.Title);
}
}
}
|
using ReactiveUI;
using System;
using WalletWasabi.Gui.ViewModels;
using System.Diagnostics.CodeAnalysis;
using WalletWasabi.Wallets;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class WalletViewModelBase : ViewModelBase, IComparable<WalletViewModelBase>
{
private bool _isExpanded;
private bool _isBusy;
public WalletViewModelBase(Wallet wallet)
{
Wallet = Guard.NotNull(nameof(wallet), wallet);
Wallet = wallet;
}
protected Wallet Wallet { get; }
public bool IsExpanded
{
get => _isExpanded;
set => this.RaiseAndSetIfChanged(ref _isExpanded, value);
}
public string Title => Wallet.WalletName;
public bool IsBusy
{
get { return _isBusy; }
set { this.RaiseAndSetIfChanged(ref _isBusy, value); }
}
public int CompareTo([AllowNull] WalletViewModelBase other)
{
return Title.CompareTo(other.Title);
}
}
}
|
mit
|
C#
|
5da6c25aff545bbfb401635da9e5cfb9bdb6ea5a
|
Fix RedisCache tests
|
ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,devigned/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,devigned/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,devigned/azure-powershell
|
src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/Utilitytests.cs
|
src/ResourceManager/RedisCache/Commands.RedisCache.Test/ScenarioTests/Utilitytests.cs
|
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using System;
using Xunit;
namespace Microsoft.Azure.Commands.RedisCache.Test.ScenarioTests
{
public class UtilityTests
{
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ValidateResourceGroupAndResourceName_InvalidResourceGroup()
{
string resourceGroup = "subscriptions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/resourceGroups/Default-Storage-NorthEurope";
string name = "cache-name";
var ex = Assert.Throws<ArgumentException>(() => Utility.ValidateResourceGroupAndResourceName(resourceGroup, name));
Assert.Contains("ResourceGroupName should not contain '/'. Name should be the plain, short name of the resource group, e.g. 'myResourceGroup'. (Not an Azure resource identifier.)", ex.Message);
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ValidateResourceGroupAndResourceName_InvalidRedisCacheName_FullName()
{
string resourceGroup = "Default-Storage-NorthEurope";
string name = "cache-name.redis.cache.windows.net";
var ex = Assert.Throws<ArgumentException>(() => Utility.ValidateResourceGroupAndResourceName(resourceGroup, name));
Assert.Contains("Name should not contain '/' or '.'. Name should be the plain, short name of the redis cache, e.g. 'mycache'. (Not a fully qualified DNS name, and not an Azure resource identifier.)", ex.Message);
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ValidateResourceGroupAndResourceName_InvalidRedisCacheName_ID()
{
string resourceGroup = "Default-Storage-NorthEurope";
string name = "subscriptions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/resourceGroups/Default-Storage-NorthEurope/cache-name";
var ex = Assert.Throws<ArgumentException>(() => Utility.ValidateResourceGroupAndResourceName(resourceGroup, name));
Assert.Contains("Name should not contain '/' or '.'. Name should be the plain, short name of the redis cache, e.g. 'mycache'. (Not a fully qualified DNS name, and not an Azure resource identifier.)", ex.Message);
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ValidateResourceGroupAndResourceName_Success()
{
string resourceGroup = "Default-Storage-NorthEurope";
string name = "cache-name";
Utility.ValidateResourceGroupAndResourceName(resourceGroup, name);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.Azure.Commands.RedisCache.Test.ScenarioTests
{
public class UtilityTests
{
[Fact]
public void ValidateResourceGroupAndResourceName_InvalidResourceGroup()
{
string resourceGroup = "subscriptions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/resourceGroups/Default-Storage-NorthEurope";
string name = "cache-name";
var ex = Assert.Throws<ArgumentException>(() => Utility.ValidateResourceGroupAndResourceName(resourceGroup, name));
Assert.Contains("ResourceGroupName should not contain '/'. Name should be the plain, short name of the resource group, e.g. 'myResourceGroup'. (Not an Azure resource identifier.)", ex.Message);
}
[Fact]
public void ValidateResourceGroupAndResourceName_InvalidRedisCacheName_FullName()
{
string resourceGroup = "Default-Storage-NorthEurope";
string name = "cache-name.redis.cache.windows.net";
var ex = Assert.Throws<ArgumentException>(() => Utility.ValidateResourceGroupAndResourceName(resourceGroup, name));
Assert.Contains("Name should not contain '/' or '.'. Name should be the plain, short name of the redis cache, e.g. 'mycache'. (Not a fully qualified DNS name, and not an Azure resource identifier.)", ex.Message);
}
[Fact]
public void ValidateResourceGroupAndResourceName_InvalidRedisCacheName_ID()
{
string resourceGroup = "Default-Storage-NorthEurope";
string name = "subscriptions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/resourceGroups/Default-Storage-NorthEurope/cache-name";
var ex = Assert.Throws<ArgumentException>(() => Utility.ValidateResourceGroupAndResourceName(resourceGroup, name));
Assert.Contains("Name should not contain '/' or '.'. Name should be the plain, short name of the redis cache, e.g. 'mycache'. (Not a fully qualified DNS name, and not an Azure resource identifier.)", ex.Message);
}
[Fact]
public void ValidateResourceGroupAndResourceName_Success()
{
string resourceGroup = "Default-Storage-NorthEurope";
string name = "cache-name";
Utility.ValidateResourceGroupAndResourceName(resourceGroup, name);
}
}
}
|
apache-2.0
|
C#
|
fcfbb675343c116b2699768597e09b29171bf332
|
Remove redundant nesting.
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Tests/NodeBuilding/NodeBuilder.cs
|
WalletWasabi.Tests/NodeBuilding/NodeBuilder.cs
|
using NBitcoin;
using NBitcoin.RPC;
using Nito.AsyncEx;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.Tests.XunitConfiguration;
namespace WalletWasabi.Tests.NodeBuilding
{
public static class NodeBuilder
{
public static async Task<CoreNode> CreateNodeAsync([CallerMemberName]string caller = null)
{
var dataDir = Path.Combine(Global.Instance.DataDir, caller);
var cfgPath = Path.Combine(dataDir, "bitcoin.conf");
if (File.Exists(cfgPath))
{
var config = await NodeConfigParameters.LoadAsync(cfgPath);
var rpcPort = config["regtest.rpcport"];
var rpcUser = config["regtest.rpcuser"];
var rpcPassword = config["regtest.rpcpassword"];
var pidFileName = config["regtest.pid"];
var credentials = new NetworkCredential(rpcUser, rpcPassword);
try
{
var rpc = new RPCClient(credentials, new Uri("http://127.0.0.1:" + rpcPort + "/"), Network.RegTest);
await rpc.StopAsync();
var pidFile = Path.Combine(dataDir, "regtest", pidFileName);
if (File.Exists(pidFile))
{
var pid = await File.ReadAllTextAsync(pidFile);
using var process = Process.GetProcessById(int.Parse(pid));
await process.WaitForExitAsync(CancellationToken.None);
}
else
{
var allProcesses = Process.GetProcesses();
var bitcoindProcesses = allProcesses.Where(x => x.ProcessName.Contains("bitcoind"));
if (bitcoindProcesses.Count() == 1)
{
var bitcoind = bitcoindProcesses.First();
await bitcoind.WaitForExitAsync(CancellationToken.None);
}
}
}
catch (Exception)
{
}
}
await IoHelpers.DeleteRecursivelyWithMagicDustAsync(dataDir);
var node = new CoreNode(dataDir);
await node.StartAsync();
return node;
}
}
}
|
using NBitcoin;
using NBitcoin.RPC;
using Nito.AsyncEx;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.Tests.XunitConfiguration;
namespace WalletWasabi.Tests.NodeBuilding
{
public static class NodeBuilder
{
private static int Last { get; set; }
public static async Task<CoreNode> CreateNodeAsync([CallerMemberName]string caller = null)
{
var root = Path.Combine(Global.Instance.DataDir, caller);
var child = Path.Combine(root, Last.ToString());
Last++;
try
{
var cfgPath = Path.Combine(child, "data", "bitcoin.conf");
if (File.Exists(cfgPath))
{
var config = await NodeConfigParameters.LoadAsync(cfgPath);
var rpcPort = config["regtest.rpcport"];
var rpcUser = config["regtest.rpcuser"];
var rpcPassword = config["regtest.rpcpassword"];
var pidFileName = config["regtest.pid"];
var credentials = new NetworkCredential(rpcUser, rpcPassword);
try
{
var rpc = new RPCClient(credentials, new Uri("http://127.0.0.1:" + rpcPort + "/"), Network.RegTest);
await rpc.StopAsync();
var pidFile = Path.Combine(child, "data", "regtest", pidFileName);
if (File.Exists(pidFile))
{
var pid = await File.ReadAllTextAsync(pidFile);
using var process = Process.GetProcessById(int.Parse(pid));
await process.WaitForExitAsync(CancellationToken.None);
}
else
{
var allProcesses = Process.GetProcesses();
var bitcoindProcesses = allProcesses.Where(x => x.ProcessName.Contains("bitcoind"));
if (bitcoindProcesses.Count() == 1)
{
var bitcoind = bitcoindProcesses.First();
await bitcoind.WaitForExitAsync(CancellationToken.None);
}
}
}
catch (Exception)
{
}
}
await IoHelpers.DeleteRecursivelyWithMagicDustAsync(child);
await IoHelpers.DeleteRecursivelyWithMagicDustAsync(root);
IoHelpers.EnsureDirectoryExists(root);
}
catch (DirectoryNotFoundException)
{
}
var node = new CoreNode(child);
await node.StartAsync();
return node;
}
}
}
|
mit
|
C#
|
a77c24cbb1740ba6c65aa39ae017f5994df88f02
|
Update AbstractMapLayer.cs
|
vchelaru/FlatRedBall,vchelaru/FlatRedBall,vchelaru/FlatRedBall,vchelaru/FlatRedBall,vchelaru/FlatRedBall
|
Tests/GlueTestProject/GlueTestProject/GlueTestProject/TileGraphics/AbstractMapLayer.cs
|
Tests/GlueTestProject/GlueTestProject/GlueTestProject/TileGraphics/AbstractMapLayer.cs
|
using System;
using System.Xml.Serialization;
namespace TMXGlueLib
{
#if !UWP
[Serializable]
#endif
[XmlInclude(typeof (MapLayer))]
[XmlInclude(typeof (MapImageLayer))]
[XmlInclude(typeof (mapObjectgroup))]
public abstract class AbstractMapLayer
{
[XmlAttribute("name")]
public string Name { get; set; }
}
}
|
using System;
using System.Xml.Serialization;
namespace TMXGlueLib
{
#if !UWP
[Serializable]
#endif
[XmlInclude(typeof (MapLayer))]
[XmlInclude(typeof (mapImageLayer))]
[XmlInclude(typeof (mapObjectgroup))]
public abstract class AbstractMapLayer
{
[XmlAttribute("name")]
public string Name { get; set; }
}
}
|
mit
|
C#
|
be27fac1b070b6197f59e5d701bcae7fa3de00fe
|
Allow AbstractDataContextBindingExtension to work for non-FrameworkElement DependencyObjects as well.
|
Whathecode/Framework-Class-Library-Extension,Whathecode/Framework-Class-Library-Extension
|
Whathecode.PresentationFramework/Windows/Markup/AbstractDataContextBindingExtension.cs
|
Whathecode.PresentationFramework/Windows/Markup/AbstractDataContextBindingExtension.cs
|
using System.Windows;
using System.Xaml;
namespace Whathecode.System.Windows.Markup
{
/// <summary>
/// A MarkupExtension which allows binding from the DataContext of a FrameworkElement
/// to a dependency property.
/// </summary>
/// <author>Steven Jeuris</author>
public abstract class AbstractDataContextBindingExtension : AbstractDependencyPropertyBindingExtension
{
FrameworkElement _frameworkElement;
bool _dataContextChangedHooked;
~AbstractDataContextBindingExtension()
{
if ( _dataContextChangedHooked )
{
_frameworkElement.DataContextChanged -= DataContextChanged;
}
}
/// <summary>
/// Provide a value from a given data context.
/// </summary>
/// <param name = "dataContext">The data context.</param>
/// <returns>A value from the data context.</returns>
protected abstract object ProvideValue( object dataContext );
protected override object ProvideValue(
DependencyObject dependencyObject,
DependencyProperty dependencyProperty )
{
// Attempt to find a FrameworkElement from which the DataContext can be accessed.
if ( dependencyObject is FrameworkElement )
{
_frameworkElement = dependencyObject as FrameworkElement;
}
else
{
// Use the root object in case the DependencyObject isn't a FrameworkElement. (e.g. Freezable)
// TODO: This might be an overly simplistic implementation. What about custom DataContext's lower in the tree?
var rootProvider = (IRootObjectProvider)ServiceProvider.GetService( typeof( IRootObjectProvider ) );
_frameworkElement = rootProvider.RootObject as FrameworkElement;
}
if ( _frameworkElement == null )
{
throw new InvalidImplementationException(
"The DataContextBinding may only be used in a context where DataContext can be obtained." );
}
// Listen to DataContext changes.
if ( !_dataContextChangedHooked )
{
_frameworkElement.DataContextChanged += DataContextChanged;
_dataContextChangedHooked = true;
}
return ProvideValue( _frameworkElement.DataContext );
}
void DataContextChanged( object sender, DependencyPropertyChangedEventArgs e )
{
// When the data context changes, get the new value.
UpdateProperty( ProvideValue( _frameworkElement.DataContext ) );
}
}
}
|
using System.Windows;
namespace Whathecode.System.Windows.Markup
{
/// <summary>
/// A MarkupExtension which allows binding from the DataContext of a FrameworkElement
/// to a dependency property.
/// </summary>
/// <author>Steven Jeuris</author>
public abstract class AbstractDataContextBindingExtension : AbstractDependencyPropertyBindingExtension
{
FrameworkElement _frameworkElement;
bool _dataContextChangedHooked;
~AbstractDataContextBindingExtension()
{
_frameworkElement.DataContextChanged -= DataContextChanged;
}
/// <summary>
/// Provide a value from a given data context.
/// </summary>
/// <param name = "dataContext">The data context.</param>
/// <returns>A value from the data context.</returns>
protected abstract object ProvideValue( object dataContext );
protected override object ProvideValue(
DependencyObject dependencyObject,
DependencyProperty dependencyProperty )
{
_frameworkElement = dependencyObject as FrameworkElement;
if ( _frameworkElement == null )
{
throw new InvalidImplementationException( "The DataContextBinding may only be used on framework elements." );
}
if ( !_dataContextChangedHooked )
{
_frameworkElement.DataContextChanged += DataContextChanged;
_dataContextChangedHooked = true;
}
return ProvideValue( _frameworkElement.DataContext );
}
void DataContextChanged( object sender, DependencyPropertyChangedEventArgs e )
{
// When the data context changes, get the new value.
UpdateProperty( ProvideValue( _frameworkElement.DataContext ) );
}
}
}
|
mit
|
C#
|
18dbdbfcbc9b257d43dfc7ee1e151b4577f75dec
|
improve help
|
huoxudong125/bau,bau-build/bau,huoxudong125/bau,modulexcite/bau,bau-build/bau,modulexcite/bau,modulexcite/bau,adamralph/bau,huoxudong125/bau,aarondandy/bau,aarondandy/bau,modulexcite/bau,bau-build/bau,eatdrinksleepcode/bau,aarondandy/bau,adamralph/bau,eatdrinksleepcode/bau,eatdrinksleepcode/bau,huoxudong125/bau,bau-build/bau,adamralph/bau,eatdrinksleepcode/bau,adamralph/bau,aarondandy/bau
|
src/test/Bau.Test.Acceptance/Help.cs
|
src/test/Bau.Test.Acceptance/Help.cs
|
// <copyright file="Help.cs" company="Bau contributors">
// Copyright (c) Bau contributors. (baubuildch@gmail.com)
// </copyright>
namespace Bau.Test.Acceptance
{
using System.Reflection;
using Bau.Test.Acceptance.Support;
using FluentAssertions;
using Xbehave;
public static class Help
{
[Scenario]
[Example("-?")]
[Example("-h")]
[Example("-help")]
[Example("-Help")]
public static void SpecifiyingLogLevel(string arg, Baufile baufile, string output)
{
var scenario = MethodBase.GetCurrentMethod().GetFullName();
"Given a no-op baufile"
.f(() => baufile = Baufile.Create(scenario).WriteLine(@"Require<Bau>().Run();"));
"When I execute the baufile with argument '{0}'"
.f(() => output = baufile.Run(arg));
"Then help should be displayed"
.f(() =>
{
var help =
@"Copyright (c) Bau contributors (baubuildch@gmail.com)
Usage: scriptcs <filename> -- [tasks|default*] [options]
Options:
-l|-loglevel <level> Log at the specified level
(a|all|t|trace|d|debug|i*|info|w|warn|e|error|f|fatal|o|off).
-t Alias for -loglevel trace.
-d Alias for -loglevel debug.
-q Alias for -loglevel warn.
-qq Alias for -loglevel error.
-s Alias for -loglevel off.
-?|-h|-help Show help.
One and two character option aliases are case-sensitive.
Examples:
scriptcs baufile.csx Run the 'default' task.
scriptcs baufile.csx -- build test Run the 'build' and 'test' tasks.
scriptcs baufile.csx -- -l d Run the 'default' task and log at debug level.
* Default value.
";
output.Should().Contain(help);
});
}
}
}
|
// <copyright file="Help.cs" company="Bau contributors">
// Copyright (c) Bau contributors. (baubuildch@gmail.com)
// </copyright>
namespace Bau.Test.Acceptance
{
using System.Reflection;
using Bau.Test.Acceptance.Support;
using FluentAssertions;
using Xbehave;
public static class Help
{
[Scenario]
[Example("-?")]
[Example("-h")]
[Example("-help")]
[Example("-Help")]
public static void SpecifiyingLogLevel(string arg, Baufile baufile, string output)
{
var scenario = MethodBase.GetCurrentMethod().GetFullName();
"Given a no-op baufile"
.f(() => baufile = Baufile.Create(scenario).WriteLine(@"Require<Bau>().Run();"));
"When I execute the baufile with argument '{0}'"
.f(() => output = baufile.Run(arg));
"Then help should be displayed"
.f(() =>
{
var help =
@"
Usage: scriptcs <baufile.csx> -- [tasks] [options]
Options:
-l|-loglevel a|all|t|trace|d|debug|i*|info|w|warn|e|error|f|fatal|o|off
Set the logging level.
-t Alias for -loglevel trace.
-d Alias for -loglevel debug.
-q Alias for -loglevel warn.
-qq Alias for -loglevel error.
-s Alias for -loglevel off.
-?|-h|-help Show help.
One and two character option aliases are case-sensitive.
Examples: scriptcs baufile.csx
scriptcs baufile.csx -- task1 task2
scriptcs baufile.csx -- -d
";
output.Should().Contain(help);
});
}
}
}
|
mit
|
C#
|
005398e52d715165fa88e47d125ed394cb1e7184
|
Fix test break part XX
|
ErikEJ/EntityFramework.SqlServerCompact,ErikEJ/EntityFramework7.SqlServerCompact
|
test/EntityFramework.SqlServerCompact.FunctionalTests/FunkyDataQuerySqlCeFixture.cs
|
test/EntityFramework.SqlServerCompact.FunctionalTests/FunkyDataQuerySqlCeFixture.cs
|
using Microsoft.EntityFrameworkCore.Specification.Tests;
using Microsoft.EntityFrameworkCore.Specification.Tests.TestModels.FunkyDataModel;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore.Specification.Tests.Utilities;
namespace Microsoft.EntityFrameworkCore.SqlCe.FunctionalTests
{
public class FunkyDataQuerySqlCeFixture : FunkyDataQueryFixtureBase<SqlCeTestStore>
{
public const string DatabaseName = "FunkyDataQueryTest";
private readonly DbContextOptions _options;
private readonly string _connectionString = SqlCeTestStore.CreateConnectionString(DatabaseName);
public FunkyDataQuerySqlCeFixture()
{
var serviceProvider = new ServiceCollection()
.AddEntityFrameworkSqlCe()
.AddSingleton(TestModelSource.GetFactory(OnModelCreating))
.AddSingleton<ILoggerFactory>(new TestSqlLoggerFactory())
.BuildServiceProvider();
_options = new DbContextOptionsBuilder()
.EnableSensitiveDataLogging()
.UseInternalServiceProvider(serviceProvider)
.Options;
}
public override SqlCeTestStore CreateTestStore()
{
return SqlCeTestStore.GetOrCreateShared(DatabaseName, () =>
{
var optionsBuilder = new DbContextOptionsBuilder(_options)
.UseSqlCe(_connectionString, b => b.ApplyConfiguration());
using (var context = new FunkyDataContext(optionsBuilder.Options))
{
context.Database.EnsureClean();
FunkyDataModelInitializer.Seed(context);
TestSqlLoggerFactory.Reset();
}
});
}
public override FunkyDataContext CreateContext(SqlCeTestStore testStore)
{
var options = new DbContextOptionsBuilder(_options)
.UseSqlCe(testStore.Connection, b => b.ApplyConfiguration())
.Options;
var context = new FunkyDataContext(options);
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
context.Database.UseTransaction(testStore.Transaction);
return context;
}
}
}
|
using Microsoft.EntityFrameworkCore.Specification.Tests;
using Microsoft.EntityFrameworkCore.Specification.Tests.TestModels.FunkyDataModel;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore.Specification.Tests.Utilities;
namespace Microsoft.EntityFrameworkCore.SqlCe.FunctionalTests
{
public class FunkyDataQuerySqlCeFixture : FunkyDataQueryFixtureBase<SqlCeTestStore>
{
public const string DatabaseName = "FunkyDataQueryTest";
private readonly DbContextOptions _options;
private readonly string _connectionString = SqlCeTestStore.CreateConnectionString(DatabaseName);
public FunkyDataQuerySqlCeFixture()
{
var serviceProvider = new ServiceCollection()
.AddEntityFrameworkSqlCe()
.AddSingleton(TestModelSource.GetFactory(OnModelCreating))
.AddSingleton<ILoggerFactory>(new TestSqlLoggerFactory())
.BuildServiceProvider();
_options = new DbContextOptionsBuilder()
.EnableSensitiveDataLogging()
.UseInternalServiceProvider(serviceProvider)
.Options;
}
public override SqlCeTestStore CreateTestStore()
{
return SqlCeTestStore.GetOrCreateShared(DatabaseName, () =>
{
var optionsBuilder = new DbContextOptionsBuilder()
.UseSqlCe(_connectionString, b => b.ApplyConfiguration());
using (var context = new FunkyDataContext(optionsBuilder.Options))
{
context.Database.EnsureClean();
FunkyDataModelInitializer.Seed(context);
TestSqlLoggerFactory.Reset();
}
});
}
public override FunkyDataContext CreateContext(SqlCeTestStore testStore)
{
var options = new DbContextOptionsBuilder(_options)
.UseSqlCe(testStore.Connection, b => b.ApplyConfiguration())
.Options;
var context = new FunkyDataContext(options);
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
context.Database.UseTransaction(testStore.Transaction);
return context;
}
}
}
|
apache-2.0
|
C#
|
0e71f29fa102b28947d6adfec7e2eb32a41aa2df
|
Fix radiobuttongroup validity for firefox
|
kjac/FormEditor,kjac/FormEditor,kjac/FormEditor
|
Source/Umbraco/Views/Partials/FormEditor/FieldsNoScript/core.radiobuttongroup.cshtml
|
Source/Umbraco/Views/Partials/FormEditor/FieldsNoScript/core.radiobuttongroup.cshtml
|
@inherits Umbraco.Web.Mvc.UmbracoViewPage<FormEditor.Fields.RadioButtonGroupField>
<div class="form-group @(Model.Mandatory ? "required" : null) @(Model.Invalid ? "has-error" : null)">
<label>@Model.Label</label>
@foreach (var fieldValue in Model.FieldValues)
{
<div class="radio">
<label>
<input type="radio" name="@Model.FormSafeName" value="@fieldValue.Value" @(fieldValue.Selected ? "checked" : "") @(Model.Mandatory ? "required" : null) oninvalid='setCustomValidity("@HttpUtility.JavaScriptStringEncode(Model.ErrorMessage)");' onchange="[].forEach.call(form.elements['@Model.FormSafeName'], function (e) { e.setCustomValidity(''); })" />
@fieldValue.Value
</label>
</div>
}
@Html.Partial("FormEditor/FieldsNoScript/core.utils.helptext")
@Html.Partial("FormEditor/FieldsNoScript/core.utils.validationerror")
</div>
|
@inherits Umbraco.Web.Mvc.UmbracoViewPage<FormEditor.Fields.RadioButtonGroupField>
<div class="form-group @(Model.Mandatory ? "required" : null) @(Model.Invalid ? "has-error" : null)">
<label>@Model.Label</label>
@foreach (var fieldValue in Model.FieldValues)
{
<div class="radio">
<label>
<input type="radio" name="@Model.FormSafeName" value="@fieldValue.Value" @(fieldValue.Selected ? "checked" : "") @(Model.Mandatory ? "required" : null) oninvalid='setCustomValidity("@HttpUtility.JavaScriptStringEncode(Model.ErrorMessage)");' onchange="form.elements['@Model.FormSafeName'].forEach(function (e) { e.setCustomValidity(''); })" />
@fieldValue.Value
</label>
</div>
}
@Html.Partial("FormEditor/FieldsNoScript/core.utils.helptext")
@Html.Partial("FormEditor/FieldsNoScript/core.utils.validationerror")
</div>
|
mit
|
C#
|
1d850066b38d3071e76b17ed4ada5a20220d7f5e
|
remove extraneous code that was accidentally committed.
|
likesea/spring-net,spring-projects/spring-net,kvr000/spring-net,likesea/spring-net,djechelon/spring-net,yonglehou/spring-net,dreamofei/spring-net,spring-projects/spring-net,dreamofei/spring-net,spring-projects/spring-net,djechelon/spring-net,zi1jing/spring-net,yonglehou/spring-net,zi1jing/spring-net,yonglehou/spring-net,kvr000/spring-net,likesea/spring-net,kvr000/spring-net
|
test/Spring/Spring.Core.Tests/Objects/Factory/Config/EnvironmentVariableSourceTests.cs
|
test/Spring/Spring.Core.Tests/Objects/Factory/Config/EnvironmentVariableSourceTests.cs
|
#region License
/*
* Copyright 2002-2005 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#region Imports
using System;
using Microsoft.Win32;
using NUnit.Framework;
#endregion
namespace Spring.Objects.Factory.Config
{
/// <summary>
/// Unit tests for the EnvironmentVariableSource class.
/// </summary>
/// <author>Aleksandar Seovic</author>
[TestFixture]
public sealed class EnvironmentVariableSourceTests
{
[Test]
public void TestVariablesResolution()
{
EnvironmentVariableSource vs = new EnvironmentVariableSource();
// existing vars
Assert.AreEqual(Environment.GetEnvironmentVariable("path"), vs.ResolveVariable("PATH"));
Assert.AreEqual(Environment.GetEnvironmentVariable("PATH"), vs.ResolveVariable("path"));
Assert.AreEqual(Environment.GetEnvironmentVariable("ComputerName"), vs.ResolveVariable("computerName"));
// non-existant variable
Assert.IsNull(vs.ResolveVariable("dummy"));
}
}
}
|
#region License
/*
* Copyright 2002-2005 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#region Imports
using System;
using Microsoft.Win32;
using NUnit.Framework;
#endregion
namespace Spring.Objects.Factory.Config
{
/// <summary>
/// Unit tests for the EnvironmentVariableSource class.
/// </summary>
/// <author>Aleksandar Seovic</author>
[TestFixture]
public sealed class EnvironmentVariableSourceTests
{
[Test]
public void TestVariablesResolution()
{
EnvironmentVariableSource vs = new EnvironmentVariableSource();
// existing vars
Assert.AreEqual(Environment.GetEnvironmentVariable("path"), vs.ResolveVariable("PATH"));
Assert.AreEqual(Environment.GetEnvironmentVariable("PATH"), vs.ResolveVariable("path"));
Assert.AreEqual(Environment.GetEnvironmentVariable("ComputerName"), vs.ResolveVariable("computerName"));
// non-existant variable
Assert.IsNull(vs.ResolveVariable("dummy"));
}
[Test]
public void EnviornmentStuff()
{
long size = Environment.WorkingSet;
int procCount = Environment.ProcessorCount;
Console.WriteLine("working set : " + size);
Console.WriteLine("Processor count : " + procCount);
}
}
}
|
apache-2.0
|
C#
|
88f208d15221caf358f718ce38d8ea3bc4d28f68
|
update task
|
zhouyongtao/my_aspnetmvc_learning,zhouyongtao/my_aspnetmvc_learning
|
my_aspnetmvc_learning/Controllers/TaskController.cs
|
my_aspnetmvc_learning/Controllers/TaskController.cs
|
using NLog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
namespace my_aspnetmvc_learning.Controllers
{
public class TaskController : Controller
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
// GET: Task
public ActionResult Index()
{
// Get a folder path whose directories should throw an UnauthorizedAccessException.
string path = Directory.GetParent(
Environment.GetFolderPath(
Environment.SpecialFolder.UserProfile)).FullName;
// Use this line to throw UnauthorizedAccessException, which we handle.
Task<string[]> task1 = Task<string[]>.Factory.StartNew(() => GetAllFiles(path));
try
{
task1.Wait();
}
catch (AggregateException ae)
{
ae.Handle((x) =>
{
if (x is UnauthorizedAccessException) // This we know how to handle.
{
logger.Info("You do not have permission to access all folders in this path.");
logger.Info("See your network administrator or try another path.");
return true;
}
return false; // Let anything else stop the application.
});
}
logger.Info("task1 Status: {0}{1}", task1.IsCompleted ? "Completed," : "", task1.Status);
return View();
}
public static string[] GetAllFiles(string str)
{
// Should throw an UnauthorizedAccessException exception.
return Directory.GetFiles(str, "*.txt", SearchOption.AllDirectories);
}
public static string Test()
{
return string.Empty;
}
}
}
|
using NLog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
namespace my_aspnetmvc_learning.Controllers
{
public class TaskController : Controller
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
// GET: Task
public ActionResult Index()
{
// Get a folder path whose directories should throw an UnauthorizedAccessException.
string path = Directory.GetParent(
Environment.GetFolderPath(
Environment.SpecialFolder.UserProfile)).FullName;
// Use this line to throw UnauthorizedAccessException, which we handle.
Task<string[]> task1 = Task<string[]>.Factory.StartNew(() => GetAllFiles(path));
try
{
task1.Wait();
}
catch (AggregateException ae)
{
ae.Handle((x) =>
{
if (x is UnauthorizedAccessException) // This we know how to handle.
{
logger.Info("You do not have permission to access all folders in this path.");
logger.Info("See your network administrator or try another path.");
return true;
}
return false; // Let anything else stop the application.
});
}
logger.Info("task1 Status: {0}{1}", task1.IsCompleted ? "Completed," : "", task1.Status);
return View();
}
public static string[] GetAllFiles(string str)
{
// Should throw an UnauthorizedAccessException exception.
return Directory.GetFiles(str, "*.txt", SearchOption.AllDirectories);
}
}
}
|
mit
|
C#
|
7819be7957c3d78932f94dba178533760914d6f7
|
Remove unused using.
|
DrabWeb/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,DrabWeb/osu,naoey/osu,DrabWeb/osu,smoogipoo/osu,ppy/osu,ZLima12/osu,peppy/osu,naoey/osu,2yangk23/osu,UselessToucan/osu,peppy/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,smoogipooo/osu,johnneijzen/osu,ppy/osu,peppy/osu,NeoAdonis/osu,naoey/osu,smoogipoo/osu,2yangk23/osu,ZLima12/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu-new
|
osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs
|
osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class BeatmapSetDownloader : Component
{
private readonly BeatmapSetInfo set;
private readonly bool noVideo;
private BeatmapManager beatmaps;
public readonly BindableBool Downloaded = new BindableBool();
public BeatmapSetDownloader(BeatmapSetInfo set, bool noVideo = false)
{
this.set = set;
this.noVideo = noVideo;
}
[BackgroundDependencyLoader]
private void load(BeatmapManager beatmaps)
{
this.beatmaps = beatmaps;
beatmaps.ItemAdded += setAdded;
beatmaps.ItemRemoved += setRemoved;
// initial value
if (set.OnlineBeatmapSetID != null)
Downloaded.Value = beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending).Count() != 0;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (beatmaps != null)
{
beatmaps.ItemAdded -= setAdded;
beatmaps.ItemRemoved -= setRemoved;
}
}
public bool Download()
{
if (Downloaded.Value)
return false;
if (beatmaps.GetExistingDownload(set) != null)
return false;
beatmaps.Download(set, noVideo);
return true;
}
private void setAdded(BeatmapSetInfo s)
{
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
Downloaded.Value = true;
}
private void setRemoved(BeatmapSetInfo s)
{
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
Downloaded.Value = false;
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class BeatmapSetDownloader : Component
{
private readonly BeatmapSetInfo set;
private readonly bool noVideo;
private BeatmapManager beatmaps;
public readonly BindableBool Downloaded = new BindableBool();
public BeatmapSetDownloader(BeatmapSetInfo set, bool noVideo = false)
{
this.set = set;
this.noVideo = noVideo;
}
[BackgroundDependencyLoader]
private void load(BeatmapManager beatmaps)
{
this.beatmaps = beatmaps;
beatmaps.ItemAdded += setAdded;
beatmaps.ItemRemoved += setRemoved;
// initial value
if (set.OnlineBeatmapSetID != null)
Downloaded.Value = beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending).Count() != 0;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (beatmaps != null)
{
beatmaps.ItemAdded -= setAdded;
beatmaps.ItemRemoved -= setRemoved;
}
}
public bool Download()
{
if (Downloaded.Value)
return false;
if (beatmaps.GetExistingDownload(set) != null)
return false;
beatmaps.Download(set, noVideo);
return true;
}
private void setAdded(BeatmapSetInfo s)
{
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
Downloaded.Value = true;
}
private void setRemoved(BeatmapSetInfo s)
{
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
Downloaded.Value = false;
}
}
}
|
mit
|
C#
|
698994484308bbf12f76c70fd7c1029496231edc
|
Update Program.cs
|
postsharp/PostSharp.Samples,postsharp/PostSharp.Samples,postsharp/PostSharp.Samples,postsharp/PostSharp.Samples,postsharp/PostSharp.Samples
|
Diagnostics/PostSharp.Samples.Logging.Loupe/Program.cs
|
Diagnostics/PostSharp.Samples.Logging.Loupe/Program.cs
|
{using System;
using Gibraltar.Agent;
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends.Loupe;
using PostSharp.Samples.Logging.BusinessLogic;
[assembly: Log]
namespace PostSharp.Samples.Logging.Loupe
{
[Log(AttributeExclude = true)]
class Program
{
static void Main(string[] args)
{
try
{
// Initialize Loupe.
Log.StartSession();
// Configure PostSharp Logging to use Loupe.
LoggingServices.DefaultBackend = new LoupeLoggingBackend();
// Simulate some business logic.
QueueProcessor.ProcessQueue(@".\Private$\SyncRequestQueue");
Console.WriteLine("Press Enter to finish.");
Console.ReadLine();
}
catch (Exception ex)
{
//Optional but recommended - write fatal exceptions to loupe this way so the session is marked as crashed.
Log.RecordException(ex, "Program", false);
throw;
}
finally
{
// Close Loupe.
Log.EndSession();
}
}
}
}
|
using System;
using Gibraltar.Agent;
using PostSharp.Patterns.Diagnostics;
using PostSharp.Patterns.Diagnostics.Backends.Loupe;
using PostSharp.Samples.Logging.BusinessLogic;
[assembly: Log]
namespace PostSharp.Samples.Logging.Loupe
{
[Log(AttributeExclude = true)]
class Program
{
static void Main(string[] args)
{
// Initialize Loupe.
Log.StartSession();
// Configure PostSharp Logging to use Loupe.
LoggingServices.DefaultBackend = new LoupeLoggingBackend();
// Simulate some business logic.
QueueProcessor.ProcessQueue(@".\Private$\SyncRequestQueue");
Console.WriteLine("Press Enter to finish.");
Console.ReadLine();
// Close Loupe.
Log.EndSession();
}
}
}
|
unlicense
|
C#
|
b47c2db0bd9f07d109426c04fa9c16892e0a63aa
|
Implement InventorySpaceValidator
|
ethanmoffat/EndlessClient
|
EndlessClient/HUD/Inventory/InventorySpaceValidator.cs
|
EndlessClient/HUD/Inventory/InventorySpaceValidator.cs
|
using AutomaticTypeMapper;
using EOLib.Domain.Map;
using EOLib.IO;
using EOLib.IO.Map;
using EOLib.IO.Repositories;
using Optional;
namespace EndlessClient.HUD.Inventory
{
[AutoMappedType]
public class InventorySpaceValidator : IInventorySpaceValidator
{
private readonly IEIFFileProvider _eifFileProvider;
private readonly IInventorySlotProvider _inventorySlotProvider;
private readonly IInventoryService _inventoryService;
public InventorySpaceValidator(IEIFFileProvider eifFileProvider,
IInventorySlotProvider inventorySlotProvider,
IInventoryService inventoryService)
{
_eifFileProvider = eifFileProvider;
_inventorySlotProvider = inventorySlotProvider;
_inventoryService = inventoryService;
}
public bool ItemFits(IItem item)
{
return ItemFits(_eifFileProvider.EIFFile[item.ItemID].Size);
}
public bool ItemFits(ItemSize itemSize)
{
return _inventoryService
.GetNextOpenSlot((Matrix<bool>)_inventorySlotProvider.FilledSlots, itemSize, Option.None<int>())
.HasValue;
}
}
public interface IInventorySpaceValidator
{
bool ItemFits(IItem item);
bool ItemFits(ItemSize itemSize);
// need "ItemsFit" method for trading
}
}
|
using AutomaticTypeMapper;
using EOLib.Domain.Map;
using EOLib.IO;
using EOLib.IO.Repositories;
namespace EndlessClient.HUD.Inventory
{
[AutoMappedType]
public class InventorySpaceValidator : IInventorySpaceValidator
{
private readonly IEIFFileProvider _eifFileProvider;
public InventorySpaceValidator(IEIFFileProvider eifFileProvider)
{
_eifFileProvider = eifFileProvider;
}
public bool ItemFits(IItem item)
{
return ItemFits(_eifFileProvider.EIFFile[item.ItemID].Size);
}
public bool ItemFits(ItemSize itemSize)
{
// todo: inventory grid management
return true;
}
}
public interface IInventorySpaceValidator
{
bool ItemFits(IItem item);
bool ItemFits(ItemSize itemSize);
// need "ItemsFit" method for trading
}
}
|
mit
|
C#
|
038f0886e7ea44e99b18d644412fb65f010df66f
|
Fix test deadlock (#11353)
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
Content.IntegrationTests/Tests/Cleanup/EuiManagerTest.cs
|
Content.IntegrationTests/Tests/Cleanup/EuiManagerTest.cs
|
using System.Linq;
using System.Threading.Tasks;
using Content.Server.Administration.UI;
using Content.Server.EUI;
using NUnit.Framework;
using Robust.Server.Player;
using Robust.Shared.IoC;
namespace Content.IntegrationTests.Tests.Cleanup;
public sealed class EuiManagerTest
{
[Test]
public async Task EuiManagerRecycleWithOpenWindowTest()
{
// Even though we are using the server EUI here, we actually want to see if the client EUIManager crashes
for (int i = 0; i < 2; i++)
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{Dirty = true});
var server = pairTracker.Pair.Server;
var sPlayerManager = server.ResolveDependency<IPlayerManager>();
await server.WaitAssertion(() =>
{
var clientSession = sPlayerManager.ServerSessions.Single();
var eui = IoCManager.Resolve<EuiManager>();
var ui = new AdminAnnounceEui();
eui.OpenEui(ui, clientSession);
});
await pairTracker.CleanReturnAsync();
}
}
}
|
using System.Linq;
using System.Threading.Tasks;
using Content.Server.Administration.UI;
using Content.Server.EUI;
using NUnit.Framework;
using Robust.Server.Player;
using Robust.Shared.IoC;
namespace Content.IntegrationTests.Tests.Cleanup;
public sealed class EuiManagerTest
{
[Test]
public async Task EuiManagerRecycleWithOpenWindowTest()
{
// Even though we are using the server EUI here, we actually want to see if the client EUIManager crashes
for (int i = 0; i < 2; i++)
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{Dirty = true});
var server = pairTracker.Pair.Server;
var sPlayerManager = server.ResolveDependency<IPlayerManager>();
await server.WaitAssertion(async () =>
{
var clientSession = sPlayerManager.ServerSessions.Single();
var eui = IoCManager.Resolve<EuiManager>();
var ui = new AdminAnnounceEui();
eui.OpenEui(ui, clientSession);
});
await pairTracker.CleanReturnAsync();
}
}
}
|
mit
|
C#
|
3db81d6de439e250196721629e78c65f922cdb37
|
Disable local hover in cloud env
|
CyrusNajmabadi/roslyn,mavasani/roslyn,sharwell/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,wvdd007/roslyn,tannergooding/roslyn,genlu/roslyn,tannergooding/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,diryboy/roslyn,heejaechang/roslyn,brettfo/roslyn,dotnet/roslyn,stephentoub/roslyn,genlu/roslyn,panopticoncentral/roslyn,ErikSchierboom/roslyn,mgoertz-msft/roslyn,physhi/roslyn,AlekseyTs/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,sharwell/roslyn,jmarolf/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,wvdd007/roslyn,weltkante/roslyn,aelij/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,physhi/roslyn,tmat/roslyn,aelij/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,jasonmalinowski/roslyn,AmadeusW/roslyn,AmadeusW/roslyn,wvdd007/roslyn,weltkante/roslyn,eriawan/roslyn,weltkante/roslyn,KirillOsenkov/roslyn,panopticoncentral/roslyn,dotnet/roslyn,diryboy/roslyn,mavasani/roslyn,bartdesmet/roslyn,brettfo/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,gafter/roslyn,AlekseyTs/roslyn,tannergooding/roslyn,gafter/roslyn,dotnet/roslyn,tmat/roslyn,genlu/roslyn,diryboy/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,physhi/roslyn,AmadeusW/roslyn,heejaechang/roslyn,tmat/roslyn,jmarolf/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,brettfo/roslyn,mgoertz-msft/roslyn,KevinRansom/roslyn,gafter/roslyn,ErikSchierboom/roslyn,mavasani/roslyn,aelij/roslyn,jmarolf/roslyn
|
src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider.cs
|
src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo
{
[ContentType(ContentTypeNames.RoslynContentType)]
[Export(typeof(IAsyncQuickInfoSourceProvider))]
[Name("RoslynQuickInfoProvider")]
internal partial class QuickInfoSourceProvider : IAsyncQuickInfoSourceProvider
{
private readonly IThreadingContext _threadingContext;
private readonly Lazy<IStreamingFindUsagesPresenter> _streamingPresenter;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public QuickInfoSourceProvider(
IThreadingContext threadingContext,
Lazy<IStreamingFindUsagesPresenter> streamingPresenter)
{
_threadingContext = threadingContext;
_streamingPresenter = streamingPresenter;
}
public IAsyncQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
{
if (textBuffer.IsInCloudEnvironmentClientContext())
{
return null;
}
return new QuickInfoSource(textBuffer, _threadingContext, _streamingPresenter);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo
{
[ContentType(ContentTypeNames.RoslynContentType)]
[Export(typeof(IAsyncQuickInfoSourceProvider))]
[Name("RoslynQuickInfoProvider")]
internal partial class QuickInfoSourceProvider : IAsyncQuickInfoSourceProvider
{
private readonly IThreadingContext _threadingContext;
private readonly Lazy<IStreamingFindUsagesPresenter> _streamingPresenter;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public QuickInfoSourceProvider(
IThreadingContext threadingContext,
Lazy<IStreamingFindUsagesPresenter> streamingPresenter)
{
_threadingContext = threadingContext;
_streamingPresenter = streamingPresenter;
}
public IAsyncQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
=> new QuickInfoSource(textBuffer, _threadingContext, _streamingPresenter);
}
}
|
mit
|
C#
|
6d609c4981f576fca5ba6430cc7b61f0340ef18c
|
Add required popper.js (#2807)
|
petedavis/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,petedavis/Orchard2
|
src/OrchardCore.Modules/OrchardCore.ContentFields/Views/TextField-IconPicker.Edit.cshtml
|
src/OrchardCore.Modules/OrchardCore.ContentFields/Views/TextField-IconPicker.Edit.cshtml
|
@model OrchardCore.ContentFields.ViewModels.EditTextFieldViewModel
@using OrchardCore.ContentManagement.Metadata.Models
@using OrchardCore.ContentFields.Settings;
@{
var settings = Model.PartFieldDefinition.Settings.ToObject<TextFieldSettings>();
}
<style name="fontpickerStyle" at="Head" asp-src="/OrchardCore.ContentFields/Styles/fontawesome-iconpicker-min.css" debug-src="/OrchardCore.ContentFields/Styles/fontawesome-iconpicker.css"></style>
<style name="fontpickerCustomStyle" at="Head" asp-src="/OrchardCore.ContentFields/Styles/iconpicker-custom.css"></style>
<script asp-name="popper" at="Foot"></script>
<script asp-name="bootstrap" at="Foot" depends-on="popper"></script>
<script name="fontpickerScript" asp-src="/OrchardCore.ContentFields/Scripts/fontawesome-iconpicker.min.js" debug-src="/OrchardCore.ContentFields/Scripts/fontawesome-iconpicker.js" at="Foot"></script>
<script name="iconpickerCustomScript" asp-src="/OrchardCore.ContentFields/Scripts/iconpicker-custom.js" at="Foot"></script>
<fieldset class="form-group">
<label asp-for="Text">@Model.PartFieldDefinition.DisplayName()</label>
<input type="hidden" asp-for="Text" id="@Html.IdFor(m=>m.Text)" />
<div class="btn-group input-group">
<button type="button" class="btn btn-primary iconpicker-component">
<i class="fa fa-fw fa-heart"></i>
</button>
<button type="button" id="@Html.IdForModel()" class="icp icp-dd btn btn-primary dropdown-toggle" data-selected="fa-car" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu"></div>
</div>
@if (!String.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
</fieldset>
<script at="Foot">
$(function () {
$('#@Html.IdForModel()').iconpicker();
var storedIcon = $('#@Html.IdFor(m=>m.Text)').val();
if (storedIcon.length > 0) {
$('#@Html.IdForModel()').data('iconpicker').update(storedIcon);
}
$('#@Html.IdForModel()').on('iconpickerSelected', function (e) {
$('#@Html.IdFor(m=>m.Text)').val(e.iconpickerInstance.options.fullClassFormatter(e.iconpickerValue));
});
});
</script>
|
@model OrchardCore.ContentFields.ViewModels.EditTextFieldViewModel
@using OrchardCore.ContentManagement.Metadata.Models
@using OrchardCore.ContentFields.Settings;
@{
var settings = Model.PartFieldDefinition.Settings.ToObject<TextFieldSettings>();
}
<style name="fontpickerStyle" at="Head" asp-src="/OrchardCore.ContentFields/Styles/fontawesome-iconpicker-min.css" debug-src="/OrchardCore.ContentFields/Styles/fontawesome-iconpicker.css"></style>
<style name="fontpickerCustomStyle" at="Head" asp-src="/OrchardCore.ContentFields/Styles/iconpicker-custom.css"></style>
<script asp-name="bootstrap" at="Foot"></script>
<script name="fontpickerScript" asp-src="/OrchardCore.ContentFields/Scripts/fontawesome-iconpicker.min.js" debug-src="/OrchardCore.ContentFields/Scripts/fontawesome-iconpicker.js" at="Foot"></script>
<script name="iconpickerCustomScript" asp-src="/OrchardCore.ContentFields/Scripts/iconpicker-custom.js" at="Foot"></script>
<fieldset class="form-group">
<label asp-for="Text">@Model.PartFieldDefinition.DisplayName()</label>
<input type="hidden" asp-for="Text" id="@Html.IdFor(m=>m.Text)" />
<div class="btn-group input-group">
<button type="button" class="btn btn-primary iconpicker-component">
<i class="fa fa-fw fa-heart"></i>
</button>
<button type="button" id="@Html.IdForModel()" class="icp icp-dd btn btn-primary dropdown-toggle" data-selected="fa-car" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu"></div>
</div>
@if (!String.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
</fieldset>
<script at="Foot">
$(function () {
$('#@Html.IdForModel()').iconpicker();
var storedIcon = $('#@Html.IdFor(m=>m.Text)').val();
if (storedIcon.length > 0) {
$('#@Html.IdForModel()').data('iconpicker').update(storedIcon);
}
$('#@Html.IdForModel()').on('iconpickerSelected', function (e) {
$('#@Html.IdFor(m=>m.Text)').val(e.iconpickerInstance.options.fullClassFormatter(e.iconpickerValue));
});
});
</script>
|
bsd-3-clause
|
C#
|
059c5fc7dc37a231d8f87c5cb76107085c8e82d6
|
fix runtime issue
|
oracle/Accelerators,oracle/Accelerators,oracle/Accelerators,oracle/Accelerators
|
casemgmt/siebel/cx/projects/Accelerator.Siebel.ServiceStatusBarAddIn/Logs/DefaultLog.cs
|
casemgmt/siebel/cx/projects/Accelerator.Siebel.ServiceStatusBarAddIn/Logs/DefaultLog.cs
|
/* *********************************************************************************************
* This file is part of the Oracle Service Cloud Accelerator Reference Integration set published
* by Oracle Service Cloud under the MIT license (MIT) included in the original distribution.
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
***********************************************************************************************
* Accelerator Package: OSVC Contact Center + Siebel Case Management Accelerator
* link: http://www.oracle.com/technetwork/indexes/samplecode/accelerator-osvc-2525361.html
* OSvC release: 15.8 (August 2015)
* Siebel release: 8.1.1.15
* reference: 150520-000047
* date: Thu Nov 21 00:55:36 PST 2015
* revision: rnw-15-11-fixes-release-1
* SHA1: $Id: 08d9b348ab8391e7fd626f2f4125749f475c0df7 $
* *********************************************************************************************
* File: DefaultLog.cs
* *********************************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Accelerator.Siebel.SharedServices.RightNowServiceReference;
namespace Accelerator.Siebel.SharedServices.Logs
{
internal class DefaultLog : Log
{
public DefaultLog(string param1 = null, string param2 = null, string param3 = null)
{
}
public void ErrorLog(Incident incident = null, RightNowServiceReference.Contact contact = null, string LogMessage = null, string LogNote = null, string source = null, int timeElapsed = 0)
{
}
public void DebugLog(Incident incident = null, RightNowServiceReference.Contact contact = null, string LogMessage = null, string LogNote = null, string source = null, int timeElapsed = 0)
{
}
public void NoticeLog(Incident incident = null, RightNowServiceReference.Contact contact = null, string LogMessage = null, string LogNote = null, string source = null, int timeElapsed = 0)
{
}
}
}
|
/* *********************************************************************************************
* This file is part of the Oracle Service Cloud Accelerator Reference Integration set published
* by Oracle Service Cloud under the MIT license (MIT) included in the original distribution.
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
***********************************************************************************************
* Accelerator Package: OSVC Contact Center + Siebel Case Management Accelerator
* link: http://www.oracle.com/technetwork/indexes/samplecode/accelerator-osvc-2525361.html
* OSvC release: 15.8 (August 2015)
* Siebel release: 8.1.1.15
* reference: 150520-000047
* date: Thu Nov 12 00:55:36 PST 2015
* revision: rnw-15-11-fixes-release-1
* SHA1: $Id: 08d9b348ab8391e7fd626f2f4125749f475c0df7 $
* *********************************************************************************************
* File: DefaultLog.cs
* *********************************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Accelerator.Siebel.SharedServices.RightNowServiceReference;
namespace Accelerator.Siebel.SharedServices.Logs
{
internal class DefaultLog : Log
{
public void ErrorLog(Incident incident = null, RightNowServiceReference.Contact contact = null, string LogMessage = null, string LogNote = null, string source = null, int timeElapsed = 0)
{
}
public void DebugLog(Incident incident = null, RightNowServiceReference.Contact contact = null, string LogMessage = null, string LogNote = null, string source = null, int timeElapsed = 0)
{
}
public void NoticeLog(Incident incident = null, RightNowServiceReference.Contact contact = null, string LogMessage = null, string LogNote = null, string source = null, int timeElapsed = 0)
{
}
}
}
|
mit
|
C#
|
588b5976612579183a6b3a122d9b38cc038819af
|
Fix chainedresult to actually chain the results if there are more than 2
|
Logicalshift/Reason
|
LogicalShift.Reason/Solvers/ChainedResult.cs
|
LogicalShift.Reason/Solvers/ChainedResult.cs
|
using LogicalShift.Reason.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LogicalShift.Reason.Solvers
{
/// <summary>
/// A query result where the next result is retrieved by a function
/// </summary>
public class ChainedResult : IQueryResult
{
/// <summary>
/// A query result that stores the results for this query
/// </summary>
private readonly IQueryResult _basicResult;
/// <summary>
/// A function that retrieves the next query result
/// </summary>
private readonly Func<Task<IQueryResult>> _nextResult;
public ChainedResult(IQueryResult basicResult, Func<Task<IQueryResult>> nextResult)
{
if (basicResult == null) throw new ArgumentNullException("basicResult");
if (nextResult == null) throw new ArgumentNullException("nextResult");
_basicResult = basicResult;
_nextResult = nextResult;
}
public bool Success
{
get { return _basicResult.Success; }
}
public IBindings Bindings
{
get { return _basicResult.Bindings; }
}
public async Task<IQueryResult> Next()
{
return new ChainedResult(await _nextResult(), _nextResult);
}
}
}
|
using LogicalShift.Reason.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LogicalShift.Reason.Solvers
{
/// <summary>
/// A query result where the next result is retrieved by a function
/// </summary>
public class ChainedResult : IQueryResult
{
/// <summary>
/// A query result that stores the results for this query
/// </summary>
private readonly IQueryResult _basicResult;
/// <summary>
/// A function that retrieves the next query result
/// </summary>
private readonly Func<Task<IQueryResult>> _nextResult;
public ChainedResult(IQueryResult basicResult, Func<Task<IQueryResult>> nextResult)
{
if (basicResult == null) throw new ArgumentNullException("basicResult");
if (nextResult == null) throw new ArgumentNullException("nextResult");
_basicResult = basicResult;
_nextResult = nextResult;
}
public bool Success
{
get { return _basicResult.Success; }
}
public IBindings Bindings
{
get { return _basicResult.Bindings; }
}
public Task<IQueryResult> Next()
{
return _nextResult();
}
}
}
|
apache-2.0
|
C#
|
0788585d40bba085427b711420a5509e68cbb245
|
Update comment about when a section view can't be removed
|
Weingartner/SolidworksAddinFramework
|
SolidworksAddinFramework/ModelViewManagerExtensions.cs
|
SolidworksAddinFramework/ModelViewManagerExtensions.cs
|
using System;
using System.Reactive.Disposables;
using SolidWorks.Interop.sldworks;
namespace SolidworksAddinFramework
{
public static class ModelViewManagerExtensions
{
public static IDisposable CreateSectionView(this IModelViewManager modelViewManager, Action<SectionViewData> config)
{
var data = modelViewManager.CreateSectionViewData();
config(data);
if (!modelViewManager.CreateSectionView(data))
{
throw new Exception("Error while creating section view.");
}
// TODO `modelViewManager.RemoveSectionView` returns `false` and doesn't remove the section view
// when `SectionViewData::GraphicsOnlySection` is `true`
return Disposable.Create(() => modelViewManager.RemoveSectionView());
}
}
}
|
using System;
using System.Reactive.Disposables;
using SolidWorks.Interop.sldworks;
namespace SolidworksAddinFramework
{
public static class ModelViewManagerExtensions
{
public static IDisposable CreateSectionView(this IModelViewManager modelViewManager, Action<SectionViewData> config)
{
var data = modelViewManager.CreateSectionViewData();
config(data);
if (!modelViewManager.CreateSectionView(data))
{
throw new Exception("Error while creating section view.");
}
// TODO `modelViewManager.RemoveSectionView` always returns `false` and doesn't remove the section view
// In 2011 this seems to have worked (see https://forum.solidworks.com/thread/47641)
return Disposable.Create(() => modelViewManager.RemoveSectionView());
}
}
}
|
mit
|
C#
|
865d0914bee34727fe4d2a6774f7c0ed810f49b4
|
change AsyncMethodBuilderAttribute accessibility
|
ufcpp/ContextFreeTask
|
src/ContextFreeTasks.Shared/AsyncMethodBuilderAttribute.cs
|
src/ContextFreeTasks.Shared/AsyncMethodBuilderAttribute.cs
|
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)]
internal sealed class AsyncMethodBuilderAttribute : Attribute
{
public AsyncMethodBuilderAttribute(Type builderType) => BuilderType = builderType;
public Type BuilderType { get; }
}
}
|
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)]
public sealed class AsyncMethodBuilderAttribute : Attribute
{
public AsyncMethodBuilderAttribute(Type builderType) => BuilderType = builderType;
public Type BuilderType { get; }
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.