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 |
|---|---|---|---|---|---|---|---|---|
d7d0dde5d27c84cfb2e7380158d1c4e26b1cd40a
|
use created storyboard to check for drawables instead
|
ppy/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu-new,NeoAdonis/osu,peppy/osu,UselessToucan/osu
|
osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.cs
|
osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Storyboards;
using osu.Game.Storyboards.Drawables;
namespace osu.Game.Graphics.Backgrounds
{
public class BeatmapBackgroundWithStoryboard : BeatmapBackground
{
public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTextureName = "Backgrounds/bg1")
: base(beatmap, fallbackTextureName)
{
}
[BackgroundDependencyLoader]
private void load()
{
var storyboard = new Storyboard { BeatmapInfo = Beatmap.BeatmapInfo };
foreach (var layer in storyboard.Layers)
{
if (layer.Name != "Fail")
layer.Elements = Beatmap.Storyboard.GetLayer(layer.Name).Elements.Where(e => !(e is StoryboardSampleInfo)).ToList();
}
if (!storyboard.HasDrawable)
return;
if (storyboard.ReplacesBackground)
{
Sprite.Texture = Texture.WhitePixel;
Sprite.Colour = Colour4.Black;
}
LoadComponentAsync(new DrawableStoryboard(storyboard) { Clock = new InterpolatingFramedClock(Beatmap.Track) }, AddInternal);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Storyboards;
using osu.Game.Storyboards.Drawables;
namespace osu.Game.Graphics.Backgrounds
{
public class BeatmapBackgroundWithStoryboard : BeatmapBackground
{
public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTextureName = "Backgrounds/bg1")
: base(beatmap, fallbackTextureName)
{
}
[BackgroundDependencyLoader]
private void load()
{
if (!Beatmap.Storyboard.HasDrawable)
return;
var storyboard = new Storyboard { BeatmapInfo = Beatmap.BeatmapInfo };
foreach (var layer in storyboard.Layers)
{
if (layer.Name != "Fail")
layer.Elements = Beatmap.Storyboard.GetLayer(layer.Name).Elements.Where(e => !(e is StoryboardSampleInfo)).ToList();
}
if (storyboard.ReplacesBackground)
{
Sprite.Texture = Texture.WhitePixel;
Sprite.Colour = Colour4.Black;
}
LoadComponentAsync(new DrawableStoryboard(storyboard) { Clock = new InterpolatingFramedClock(Beatmap.Track) }, AddInternal);
}
}
}
|
mit
|
C#
|
e211a6bf451d5c435ebec834aebc1087431dbc50
|
update sample
|
MarcBruins/TTGSnackbar-Xamarin-iOS
|
Sample/TTGSnackbarSample/ViewController.cs
|
Sample/TTGSnackbarSample/ViewController.cs
|
using System;
using TTGSnackBar;
using UIKit;
namespace TTGSnackbarSample
{
public partial class ViewController : UIViewController
{
protected ViewController(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
}
partial void buttonClicked(UIButton sender)
{
var snackbar = new TTGSnackbar("Hello Xamarin snackbar");
snackbar.Duration = TimeSpan.FromSeconds(3);
snackbar.AnimationType = TTGSnackbarAnimationType.FadeInFadeOut;
// Action 1
snackbar.ActionText = "Yes";
snackbar.ActionTextColor = UIColor.Green;
snackbar.ActionBlock = (t) =>
{
Console.WriteLine("clicked yes");
};
// Action 2
snackbar.SecondActionText = "No";
snackbar.SecondActionTextColor = UIColor.Magenta;
snackbar.SecondActionBlock = (t) => { Console.WriteLine("clicked no"); };
// Dismiss Callback
snackbar.DismissBlock = (t) => { Console.WriteLine("dismissed snackbar"); };
snackbar.Icon = UIImage.FromBundle("EmojiCool");
snackbar.LocationType = TTGSnackbarLocation.Top;
snackbar.Show();
}
public void cancel()
{
//do something
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
}
}
|
using System;
using TTGSnackBar;
using UIKit;
namespace TTGSnackbarSample
{
public partial class ViewController : UIViewController
{
protected ViewController(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
}
partial void buttonClicked(UIButton sender)
{
var snackbar = new TTGSnackbar("Hello Xamarin snackbar");
snackbar.Duration = TimeSpan.FromSeconds(3);
// snackbar.AnimationType = TTGSnackbarAnimationType.FadeInFadeOut;
// Action 1
snackbar.ActionText = "Undo";
snackbar.ActionTextColor = UIColor.Green;
snackbar.ActionBlock = (t) =>
{
Console.WriteLine("clicked yes");
};
//// Action 2
//snackbar.SecondActionText = "No";
//snackbar.SecondActionTextColor = UIColor.Magenta;
//snackbar.SecondActionBlock = (t) => { Console.WriteLine("clicked no"); };
// Dissmiss Callback
//snackbar.DismissBlock = (t) => { Console.WriteLine("dismissed snackbar"); };
//snackbar.Icon = UIImage.FromBundle("EmojiCool");
//snackbar.LocationType = TTGSnackbarLocation.Top;
snackbar.Show();
}
public void cancel()
{
//do something
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
}
}
|
mit
|
C#
|
8f465e4867c3e76f2d668294924531e5541c3d47
|
improve backwards compatibility
|
janjonas/OpenContent,janjonas/OpenContent,janjonas/OpenContent,janjonas/OpenContent,janjonas/OpenContent
|
AddEdit.ascx.cs
|
AddEdit.ascx.cs
|
#region Copyright
//
// Copyright (c) 2015
// by Satrabel
//
#endregion
#region Using Statements
using System;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Common;
using DotNetNuke.Framework.JavaScriptLibraries;
using DotNetNuke.Framework;
using DotNetNuke.Services.Localization;
using System.IO;
using DotNetNuke.Web.Client.ClientResourceManagement;
using DotNetNuke.Web.Client;
using DotNetNuke.Entities.Portals;
using Satrabel.OpenContent.Components;
using Satrabel.OpenContent.Components.Manifest;
#endregion
namespace Satrabel.OpenContent
{
public partial class AddEdit : PortalModuleBase
{
#region Event Handlers
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
var settings = ModuleContext.OpenContentSettings();
Manifest manifest = settings.Manifest;
if (settings.TemplateKey.Extention != ".manifest")
{
manifest = ManifestUtils.GetFileManifest(settings.TemplateKey.TemplateDir);
}
if (manifest != null)
{
string addEditControl = manifest.AdditionalEditControl;
if (!string.IsNullOrEmpty(addEditControl))
{
var contr = LoadControl(addEditControl);
PortalModuleBase mod = contr as PortalModuleBase;
if (mod != null)
{
mod.ModuleConfiguration = this.ModuleConfiguration;
mod.ModuleId = this.ModuleId;
mod.LocalResourceFile = this.LocalResourceFile;
}
this.Controls.Add(contr);
}
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!Page.IsPostBack)
{
}
}
#endregion
public string CurrentCulture
{
get
{
return LocaleController.Instance.GetCurrentLocale(PortalId).Code;
}
}
}
}
|
#region Copyright
//
// Copyright (c) 2015
// by Satrabel
//
#endregion
#region Using Statements
using System;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Common;
using DotNetNuke.Framework.JavaScriptLibraries;
using DotNetNuke.Framework;
using DotNetNuke.Services.Localization;
using System.IO;
using DotNetNuke.Web.Client.ClientResourceManagement;
using DotNetNuke.Web.Client;
using DotNetNuke.Entities.Portals;
using Satrabel.OpenContent.Components;
using Satrabel.OpenContent.Components.Manifest;
#endregion
namespace Satrabel.OpenContent
{
public partial class AddEdit : PortalModuleBase
{
#region Event Handlers
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
//string AddEditControl = PortalController.GetPortalSetting("OpenContent_AddEditControl", ModuleContext.PortalId, "");
var settings = ModuleContext.OpenContentSettings();
Manifest manifest = settings.Manifest;
if (manifest != null)
{
string addEditControl = manifest.AdditionalEditControl;
if (!string.IsNullOrEmpty(addEditControl))
{
var contr = LoadControl(addEditControl);
PortalModuleBase mod = contr as PortalModuleBase;
if (mod != null)
{
mod.ModuleConfiguration = this.ModuleConfiguration;
mod.ModuleId = this.ModuleId;
mod.LocalResourceFile = this.LocalResourceFile;
}
this.Controls.Add(contr);
}
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!Page.IsPostBack)
{
}
}
#endregion
public string CurrentCulture
{
get
{
return LocaleController.Instance.GetCurrentLocale(PortalId).Code;
}
}
}
}
|
mit
|
C#
|
6477ba3ebec2027ad32be8db1b47679b612be74b
|
Replace tabs with spaces
|
zeroc-ice/ice-builder-visualstudio
|
IceBuilder_VS2010/Package.cs
|
IceBuilder_VS2010/Package.cs
|
// **********************************************************************
//
// Copyright (c) 2009-2016 ZeroC, Inc. All rights reserved.
//
// **********************************************************************
using System;
using System.Reflection;
using System.IO;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Globalization;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.Win32;
namespace IceBuilder
{
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[ProvideAutoLoad("{ADFC4E64-0397-11D1-9F4E-00A0C911004F}")]
[Guid("D381D516-A7DA-4BFD-BD04-A649F2DB947F")]
public class Package : Microsoft.VisualStudio.Shell.Package
{
protected override void Initialize()
{
base.Initialize();
IVsShell shell = GetService(typeof(IVsShell)) as IVsShell;
object value;
shell.GetProperty((int)__VSSPROPID.VSSPROPID_IsInCommandLineMode, out value);
if (!(bool)value)
{
string installDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Registry.SetValue(@"HKEY_CURRENT_USER\Software\ZeroC\IceBuilder", "InstallDir.10.0", installDirectory,
RegistryValueKind.String);
}
}
}
}
|
// **********************************************************************
//
// Copyright (c) 2009-2016 ZeroC, Inc. All rights reserved.
//
// **********************************************************************
using System;
using System.Reflection;
using System.IO;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Globalization;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.Win32;
namespace IceBuilder
{
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[ProvideAutoLoad("{ADFC4E64-0397-11D1-9F4E-00A0C911004F}")]
[Guid("D381D516-A7DA-4BFD-BD04-A649F2DB947F")]
public class Package : Microsoft.VisualStudio.Shell.Package
{
protected override void Initialize()
{
base.Initialize();
IVsShell shell = GetService(typeof(IVsShell)) as IVsShell;
object value;
shell.GetProperty((int)__VSSPROPID.VSSPROPID_IsInCommandLineMode, out value);
if (!(bool)value)
{
string installDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Registry.SetValue(@"HKEY_CURRENT_USER\Software\ZeroC\IceBuilder", "InstallDir.10.0", installDirectory,
RegistryValueKind.String);
}
}
}
}
|
bsd-3-clause
|
C#
|
5b037b3c6baf27a222b2cacf51eab195d705500e
|
Update version to 1.3.3
|
anonymousthing/ListenMoeClient
|
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("Listen.moe Client")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")]
// 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("88b02799-425e-4622-a849-202adb19601b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.3.0")]
[assembly: AssemblyFileVersion("1.3.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("Listen.moe Client")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")]
// 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("88b02799-425e-4622-a849-202adb19601b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.2.0")]
[assembly: AssemblyFileVersion("1.3.2.0")]
|
mit
|
C#
|
7987598ee42077cafdee556e456cc7454caba400
|
Bump version to 0.1.4
|
sirmmo/FatturaElettronicaPA,FatturaElettronicaPA/FatturaElettronicaPA
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
// 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("FatturaElettronicaPA")]
[assembly: AssemblyDescription("Fattura Elettronica per la Pubblica Amministrazione")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronicaPA")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// 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.1.4.0")]
[assembly: AssemblyFileVersion("0.1.4.0")]
|
using System.Reflection;
using System.Resources;
// 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("FatturaElettronicaPA")]
[assembly: AssemblyDescription("Fattura Elettronica per la Pubblica Amministrazione")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronicaPA")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// 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.1.3.0")]
[assembly: AssemblyFileVersion("0.1.3.0")]
|
bsd-3-clause
|
C#
|
4a94cca41362c8c35d2db61adcd8382fd56a74f0
|
Add the missing `TestMethod`
|
justinyoo/EntityFramework.Testing,justinyoo/EntityFramework.Testing,scott-xu/EntityFramework.Testing
|
test/EntityFramework.Testing.Moq.Tests/FakeDbSetDataTests.cs
|
test/EntityFramework.Testing.Moq.Tests/FakeDbSetDataTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFramework.Testing.Moq.Tests
{
[TestClass]
public class FakeDbSetDataTests
{
[TestMethod]
public void Data_is_addded_to_set()
{
var data = new List<Blog> { new Blog(), new Blog() };
var set = new MockDbSet<Blog>()
.SetupSeedData(data);
var result = set.Data.ToArray();
Assert.AreEqual(2, result.Length);
Assert.AreSame(data[0], result[0]);
Assert.AreSame(data[1], result[1]);
}
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFramework.Testing.Moq.Tests
{
[TestClass]
public class FakeDbSetDataTests
{
public void Data_is_addded_to_set()
{
var data = new List<Blog> { new Blog(), new Blog() };
var set = new MockDbSet<Blog>()
.SetupSeedData(data);
var result = set.Data.ToArray();
Assert.AreEqual(2, result.Length);
Assert.AreSame(data[0], result[0]);
Assert.AreSame(data[1], result[1]);
}
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
}
}
}
|
apache-2.0
|
C#
|
25a6ba9412ce416766ec72a9ae7e002bef690ba7
|
change the access to constructors back to public
|
ecologylab/simplCSharp
|
Simpl.Serialization/Attributes/SimplMap.cs
|
Simpl.Serialization/Attributes/SimplMap.cs
|
using System;
namespace Simpl.Serialization.Attributes
{
/// <summary>
/// Annotation describes a class field as a collection.
/// This includes Lists which can be both mono-morphic and
/// poly-morphic
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class SimplMap : Attribute
{
private readonly String _tagName;
/// <summary>
///
/// </summary>
public SimplMap()
{
}
/// <summary>
///
/// </summary>
/// <param name="tagName"></param>
public SimplMap(String tagName)
{
this._tagName = tagName;
}
/// <summary>
///
/// </summary>
public String TagName
{
get
{
return _tagName;
}
}
}
}
|
using System;
namespace Simpl.Serialization.Attributes
{
/// <summary>
/// Annotation describes a class field as a collection.
/// This includes Lists which can be both mono-morphic and
/// poly-morphic
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class SimplMap : Attribute
{
private readonly String _tagName;
/// <summary>
///
/// </summary>
private SimplMap()
{
}
/// <summary>
///
/// </summary>
/// <param name="tagName"></param>
public SimplMap(String tagName)
{
this._tagName = tagName;
}
/// <summary>
///
/// </summary>
public String TagName
{
get
{
return _tagName;
}
}
}
}
|
apache-2.0
|
C#
|
815895f2f5b56f836255c930909cd06a68148523
|
Fix the proxy test, why the body was even there?
|
PKRoma/RestSharp,restsharp/RestSharp
|
test/RestSharp.IntegrationTests/ProxyTests.cs
|
test/RestSharp.IntegrationTests/ProxyTests.cs
|
using System;
using System.Net;
using NUnit.Framework;
using RestSharp.Tests.Shared.Fixtures;
namespace RestSharp.IntegrationTests
{
[TestFixture]
public class ProxyTests
{
[Test]
public void Set_Invalid_Proxy_Fails()
{
using var server = HttpServerFixture.StartServer((_, __) => { });
var client = new RestClient(server.Url) {Proxy = new WebProxy("non_existent_proxy", false)};
var request = new RestRequest();
var response = client.Get(request);
Assert.False(response.IsSuccessful);
Assert.IsInstanceOf<WebException>(response.ErrorException);
}
[Test]
public void Set_Invalid_Proxy_Fails_RAW()
{
using var server = HttpServerFixture.StartServer((_, __) => { });
var requestUri = new Uri(new Uri(server.Url), "");
var webRequest = (HttpWebRequest) WebRequest.Create(requestUri);
webRequest.Proxy = new WebProxy("non_existent_proxy", false);
Assert.Throws<WebException>(() => webRequest.GetResponse());
}
}
}
|
using System;
using System.Net;
using NUnit.Framework;
using RestSharp.Tests.Shared.Fixtures;
namespace RestSharp.IntegrationTests
{
[TestFixture]
public class ProxyTests
{
class RequestBodyCapturer
{
public const string RESOURCE = "Capture";
}
[Test]
public void Set_Invalid_Proxy_Fails()
{
using var server = HttpServerFixture.StartServer((_, __) => { });
var client = new RestClient(server.Url) {Proxy = new WebProxy("non_existent_proxy", false)};
var request = new RestRequest();
const string contentType = "text/plain";
const string bodyData = "abc123 foo bar baz BING!";
request.AddParameter(contentType, bodyData, ParameterType.RequestBody);
var response = client.Get(request);
Assert.False(response.IsSuccessful);
Assert.IsInstanceOf<WebException>(response.ErrorException);
}
[Test]
public void Set_Invalid_Proxy_Fails_RAW()
{
using var server = HttpServerFixture.StartServer((_, __) => { });
var requestUri = new Uri(new Uri(server.Url), "");
var webRequest = (HttpWebRequest) WebRequest.Create(requestUri);
webRequest.Proxy = new WebProxy("non_existent_proxy", false);
Assert.Throws<WebException>(() => webRequest.GetResponse());
}
}
}
|
apache-2.0
|
C#
|
707ec9571786db888dc01e804a30265b6f355931
|
Add SocketRole.Members property (#659)
|
RogueException/Discord.Net,Confruggy/Discord.Net,AntiTcb/Discord.Net
|
src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs
|
src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs
|
using Discord.Rest;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Model = Discord.API.Role;
namespace Discord.WebSocket
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketRole : SocketEntity<ulong>, IRole
{
public SocketGuild Guild { get; }
public Color Color { get; private set; }
public bool IsHoisted { get; private set; }
public bool IsManaged { get; private set; }
public bool IsMentionable { get; private set; }
public string Name { get; private set; }
public GuildPermissions Permissions { get; private set; }
public int Position { get; private set; }
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
public bool IsEveryone => Id == Guild.Id;
public string Mention => MentionUtils.MentionRole(Id);
public IEnumerable<SocketGuildUser> Members
=> Guild.Users.Where(x => x.Roles.Any(r => r.Id == Id));
internal SocketRole(SocketGuild guild, ulong id)
: base(guild.Discord, id)
{
Guild = guild;
}
internal static SocketRole Create(SocketGuild guild, ClientState state, Model model)
{
var entity = new SocketRole(guild, model.Id);
entity.Update(state, model);
return entity;
}
internal void Update(ClientState state, Model model)
{
Name = model.Name;
IsHoisted = model.Hoist;
IsManaged = model.Managed;
IsMentionable = model.Mentionable;
Position = model.Position;
Color = new Color(model.Color);
Permissions = new GuildPermissions(model.Permissions);
}
public Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null)
=> RoleHelper.ModifyAsync(this, Discord, func, options);
public Task DeleteAsync(RequestOptions options = null)
=> RoleHelper.DeleteAsync(this, Discord, options);
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Id})";
internal SocketRole Clone() => MemberwiseClone() as SocketRole;
public int CompareTo(IRole role) => RoleUtils.Compare(this, role);
//IRole
IGuild IRole.Guild => Guild;
}
}
|
using Discord.Rest;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Model = Discord.API.Role;
namespace Discord.WebSocket
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketRole : SocketEntity<ulong>, IRole
{
public SocketGuild Guild { get; }
public Color Color { get; private set; }
public bool IsHoisted { get; private set; }
public bool IsManaged { get; private set; }
public bool IsMentionable { get; private set; }
public string Name { get; private set; }
public GuildPermissions Permissions { get; private set; }
public int Position { get; private set; }
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
public bool IsEveryone => Id == Guild.Id;
public string Mention => MentionUtils.MentionRole(Id);
internal SocketRole(SocketGuild guild, ulong id)
: base(guild.Discord, id)
{
Guild = guild;
}
internal static SocketRole Create(SocketGuild guild, ClientState state, Model model)
{
var entity = new SocketRole(guild, model.Id);
entity.Update(state, model);
return entity;
}
internal void Update(ClientState state, Model model)
{
Name = model.Name;
IsHoisted = model.Hoist;
IsManaged = model.Managed;
IsMentionable = model.Mentionable;
Position = model.Position;
Color = new Color(model.Color);
Permissions = new GuildPermissions(model.Permissions);
}
public Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null)
=> RoleHelper.ModifyAsync(this, Discord, func, options);
public Task DeleteAsync(RequestOptions options = null)
=> RoleHelper.DeleteAsync(this, Discord, options);
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Id})";
internal SocketRole Clone() => MemberwiseClone() as SocketRole;
public int CompareTo(IRole role) => RoleUtils.Compare(this, role);
//IRole
IGuild IRole.Guild => Guild;
}
}
|
mit
|
C#
|
56ffa1d850ed3eec13c93f50a2d6a20e5e9d31f2
|
Add storage location
|
jasonmalinowski/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,physhi/roslyn,mavasani/roslyn,wvdd007/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,wvdd007/roslyn,dotnet/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,dotnet/roslyn,wvdd007/roslyn,physhi/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,weltkante/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,bartdesmet/roslyn,eriawan/roslyn,dotnet/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,weltkante/roslyn
|
src/Workspaces/Core/Portable/Storage/StorageOptions.cs
|
src/Workspaces/Core/Portable/Storage/StorageOptions.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.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Storage
{
internal static class StorageOptions
{
internal const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Features\";
public const string OptionName = "FeatureManager/Storage";
public static readonly Option<StorageDatabase> Database = new(
OptionName, nameof(Database), defaultValue: StorageDatabase.SQLite,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(Database)));
/// <summary>
/// Option that can be set in certain scenarios (like tests) to indicate that the client expects the DB to
/// succeed at all work and that it should not ever gracefully fall over. Should not be set in normal host
/// environments, where it is completely reasonable for things to fail (for example, if a client asks for a key
/// that hasn't been stored yet).
/// </summary>
public static readonly Option<bool> DatabaseMustSucceed = new(OptionName, nameof(DatabaseMustSucceed), defaultValue: false);
}
[ExportOptionProvider, Shared]
internal class RemoteHostOptionsProvider : IOptionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteHostOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
StorageOptions.Database,
StorageOptions.DatabaseMustSucceed);
}
}
|
// 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.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Storage
{
internal static class StorageOptions
{
internal const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Features\";
public const string OptionName = "FeatureManager/Storage";
public static readonly Option<StorageDatabase> Database = new(OptionName, nameof(Database), defaultValue: StorageDatabase.SQLite);
/// <summary>
/// Option that can be set in certain scenarios (like tests) to indicate that the client expects the DB to
/// succeed at all work and that it should not ever gracefully fall over. Should not be set in normal host
/// environments, where it is completely reasonable for things to fail (for example, if a client asks for a key
/// that hasn't been stored yet).
/// </summary>
public static readonly Option<bool> DatabaseMustSucceed = new(OptionName, nameof(DatabaseMustSucceed), defaultValue: false);
}
[ExportOptionProvider, Shared]
internal class RemoteHostOptionsProvider : IOptionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteHostOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
StorageOptions.Database,
StorageOptions.DatabaseMustSucceed);
}
}
|
mit
|
C#
|
f3c7856f0c4a401510fc879a9405c732334287a4
|
Remove Dispose from the Data Service class because Ninject handles that for us
|
brunck/crisischeckin,mheggeseth/crisischeckin,andrewhart098/crisischeckin,lloydfaulkner/crisischeckin,brunck/crisischeckin,pooran/crisischeckin,jplwood/crisischeckin,pottereric/crisischeckin,jsucupira/crisischeckin,HTBox/crisischeckin,brunck/crisischeckin,mjmilan/crisischeckin,lloydfaulkner/crisischeckin,RyanBetker/crisischeckin,pottereric/crisischeckin,mjmilan/crisischeckin,andrewhart098/crisischeckin,pooran/crisischeckin,mheggeseth/crisischeckin,djjlewis/crisischeckin,MobileRez/crisischeckin,djjlewis/crisischeckin,jplwood/crisischeckin,andrewhart098/crisischeckin,coridrew/crisischeckin,RyanBetker/crisischeckinUpdates,MobileRez/crisischeckin,RyanBetker/crisischeckinUpdates,coridrew/crisischeckin,mjmilan/crisischeckin,HTBox/crisischeckin,jsucupira/crisischeckin,RyanBetker/crisischeckin,HTBox/crisischeckin
|
crisischeckin/Services/DataService.cs
|
crisischeckin/Services/DataService.cs
|
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services
{
public class DataService : IDataService
{
// This class does not dispose of the context,
// because the Ninject librar takes care of that for us.
private readonly CrisisCheckin context;
public DataService(CrisisCheckin ctx)
{
context = ctx;
}
public IQueryable<Commitment> Commitments
{ get { return context.Commitments; } }
public IQueryable<Disaster> Disasters
{ get { return context.Disasters; } }
public IQueryable<Person> Persons
{ get { return context.Persons; } }
public IQueryable<User> Users
{ get { return context.Users; } }
public Person AddPerson(Person newPerson)
{
Person result = context.Persons.Add(newPerson);
context.SaveChanges();
return result;
}
public Person UpdatePerson(Person updatedPerson)
{
Person result = context.Persons.FirstOrDefault(a => a.Id == updatedPerson.Id);
result.FirstName = updatedPerson.FirstName;
result.LastName = updatedPerson.LastName;
result.Email = updatedPerson.Email;
result.PhoneNumber = updatedPerson.PhoneNumber;
context.SaveChanges();
return result;
}
public Commitment AddCommitment(Commitment newCommitment)
{
Commitment result = context.Commitments.Add(newCommitment);
context.SaveChanges();
return result;
}
public Disaster AddDisaster(Disaster newDisaster)
{
Disaster result = context.Disasters.Add(newDisaster);
context.SaveChanges();
return result;
}
public void SubmitChanges()
{
context.SaveChanges();
}
}
}
|
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services
{
public class DataService : IDisposable, IDataService
{
private readonly CrisisCheckin context;
public DataService(CrisisCheckin ctx)
{
context = ctx;
}
public IQueryable<Commitment> Commitments
{ get { return context.Commitments; } }
public IQueryable<Disaster> Disasters
{ get { return context.Disasters; } }
public IQueryable<Person> Persons
{ get { return context.Persons; } }
public IQueryable<User> Users
{ get { return context.Users; } }
public Person AddPerson(Person newPerson)
{
Person result = context.Persons.Add(newPerson);
context.SaveChanges();
return result;
}
public Person UpdatePerson(Person updatedPerson)
{
Person result = context.Persons.FirstOrDefault(a => a.Id == updatedPerson.Id);
result.FirstName = updatedPerson.FirstName;
result.LastName = updatedPerson.LastName;
result.Email = updatedPerson.Email;
result.PhoneNumber = updatedPerson.PhoneNumber;
context.SaveChanges();
return result;
}
public Commitment AddCommitment(Commitment newCommitment)
{
Commitment result = context.Commitments.Add(newCommitment);
context.SaveChanges();
return result;
}
public Disaster AddDisaster(Disaster newDisaster)
{
Disaster result = context.Disasters.Add(newDisaster);
context.SaveChanges();
return result;
}
public void SubmitChanges()
{
context.SaveChanges();
}
public void Dispose()
{
if (context != null)
context.Dispose();
}
}
}
|
apache-2.0
|
C#
|
1ac0b19dec8d75f8af82345e6a5e2dfb287b94c9
|
Fix build
|
mono/maccore
|
src/Foundation/NSUuid.cs
|
src/Foundation/NSUuid.cs
|
//
// NSUuid.cs: support code for the NSUUID binding
//
// Authors:
// MIguel de Icaza (miguel@xamarin.com)
//
// Copyright 2012-2013 Xamarin Inc
//
using System;
using System.Runtime.InteropServices;
using MonoMac.ObjCRuntime;
namespace MonoMac.Foundation {
partial class NSUuid {
static unsafe IntPtr GetIntPtr (byte [] bytes)
{
if (bytes == null)
throw new ArgumentNullException ("bytes");
if (bytes.Length < 16)
throw new ArgumentException ("length must be at least 16 bytes");
IntPtr ret;
fixed (byte *p = &bytes [0]){
ret = (IntPtr) p;
}
return ret;
}
unsafe public NSUuid (byte [] bytes) : base (NSObjectFlag.Empty)
{
IntPtr ptr = GetIntPtr (bytes);
if (IsDirectBinding) {
Handle = Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, Selector.GetHandle ("initWithUUIDBytes:"), ptr);
} else {
Handle = Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, Selector.GetHandle ("initWithUUIDBytes:"), ptr);
}
}
public byte [] GetBytes ()
{
byte [] ret = new byte [16];
IntPtr buf = Marshal.AllocHGlobal (16);
GetUuidBytes (buf);
Marshal.Copy (buf, ret, 0, 16);
Marshal.FreeHGlobal (buf);
return ret;
}
}
}
|
//
// NSUuid.cs: support code for the NSUUID binding
//
// Authors:
// MIguel de Icaza (miguel@xamarin.com)
//
// Copyright 2012-2013 Xamarin Inc
//
using System;
using System.Runtime.InteropServices;
using MonoMac.ObjCRuntime;
namespace MonoMac.Foundation {
partial class NSUuid {
static unsafe IntPtr GetIntPtr (byte [] bytes)
{
if (bytes == null)
throw new ArgumentNullException ("bytes");
if (bytes.Length < 16)
throw new ArgumentException ("length must be at least 16 bytes");
IntPtr ret;
fixed (byte *p = &bytes [0]){
ret = (IntPtr) p;
}
return ret;
}
unsafe public NSUuid (byte [] bytes) : base (NSObjectFlag.Empty)
{
IntPtr ptr = GetIntPtr (bytes);
if (IsDirectBinding) {
Handle = MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, Selector.GetHandle ("initWithUUIDBytes:"), ptr);
} else {
Handle = MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, Selector.GetHandle ("initWithUUIDBytes:"), ptr);
}
}
public byte [] GetBytes ()
{
byte [] ret = new byte [16];
IntPtr buf = Marshal.AllocHGlobal (16);
GetUuidBytes (buf);
Marshal.Copy (buf, ret, 0, 16);
Marshal.FreeHGlobal (buf);
return ret;
}
}
}
|
apache-2.0
|
C#
|
afab9800a8e0edae8955786829ce01b8c7820740
|
Make (unused) UnixMonoTransport internal too
|
openmedicus/dbus-sharp,mono/dbus-sharp,openmedicus/dbus-sharp,arfbtwn/dbus-sharp,Tragetaschen/dbus-sharp,Tragetaschen/dbus-sharp,mono/dbus-sharp,arfbtwn/dbus-sharp
|
src/UnixMonoTransport.cs
|
src/UnixMonoTransport.cs
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using Mono.Unix;
using Mono.Unix.Native;
namespace NDesk.DBus.Transports
{
class UnixMonoTransport : UnixTransport
{
protected Socket socket;
public override void Open (string path, bool @abstract)
{
if (@abstract)
socket = OpenAbstractUnix (path);
else
socket = OpenUnix (path);
socket.Blocking = true;
SocketHandle = (long)socket.Handle;
//Stream = new UnixStream ((int)socket.Handle);
Stream = new NetworkStream (socket);
}
//send peer credentials null byte. note that this might not be portable
//there are also selinux, BSD etc. considerations
public override void WriteCred ()
{
Stream.WriteByte (0);
}
protected Socket OpenAbstractUnix (string path)
{
AbstractUnixEndPoint ep = new AbstractUnixEndPoint (path);
Socket client = new Socket (AddressFamily.Unix, SocketType.Stream, 0);
client.Connect (ep);
return client;
}
public Socket OpenUnix (string path)
{
UnixEndPoint remoteEndPoint = new UnixEndPoint (path);
Socket client = new Socket (AddressFamily.Unix, SocketType.Stream, 0);
client.Connect (remoteEndPoint);
return client;
}
}
}
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using Mono.Unix;
using Mono.Unix.Native;
namespace NDesk.DBus.Transports
{
public class UnixMonoTransport : UnixTransport
{
protected Socket socket;
public override void Open (string path, bool @abstract)
{
if (@abstract)
socket = OpenAbstractUnix (path);
else
socket = OpenUnix (path);
socket.Blocking = true;
SocketHandle = (long)socket.Handle;
//Stream = new UnixStream ((int)socket.Handle);
Stream = new NetworkStream (socket);
}
//send peer credentials null byte. note that this might not be portable
//there are also selinux, BSD etc. considerations
public override void WriteCred ()
{
Stream.WriteByte (0);
}
protected Socket OpenAbstractUnix (string path)
{
AbstractUnixEndPoint ep = new AbstractUnixEndPoint (path);
Socket client = new Socket (AddressFamily.Unix, SocketType.Stream, 0);
client.Connect (ep);
return client;
}
public Socket OpenUnix (string path)
{
UnixEndPoint remoteEndPoint = new UnixEndPoint (path);
Socket client = new Socket (AddressFamily.Unix, SocketType.Stream, 0);
client.Connect (remoteEndPoint);
return client;
}
}
}
|
mit
|
C#
|
28cf5794ae51b574db1f4986c7a3b5512dd3125d
|
fix compilation
|
jefking/King.Service
|
King.Service.Tests/Data/QueueSimplifiedScalerTests.cs
|
King.Service.Tests/Data/QueueSimplifiedScalerTests.cs
|
namespace King.Service.Tests.Data
{
using King.Azure.Data;
using King.Service.Data;
using NSubstitute;
using NUnit.Framework;
using System;
using System.Collections.Generic;
[TestFixture]
public class QueueSimplifiedScalerTests
{
public class MyQScaler : QueueSimplifiedScaler
{
public MyQScaler(IQueueCount count, ITaskCreator creator)
: base(count, creator)
{
}
}
[Test]
public void Constructor()
{
var count = Substitute.For<IQueueCount>();
var creator = Substitute.For<ITaskCreator>();
new MyQScaler(count, creator);
}
[Test]
public void IsAutoScaler()
{
var count = Substitute.For<IQueueCount>();
var creator = Substitute.For<ITaskCreator>();
Assert.IsNotNull(new MyQScaler(count, creator) as QueueAutoScaler<ITaskCreator>);
}
}
}
|
namespace King.Service.Tests.Data
{
using King.Azure.Data;
using King.Service.Data;
using NSubstitute;
using NUnit.Framework;
using System;
using System.Collections.Generic;
[TestFixture]
public class QueueSimplifiedScalerTests
{
public class MyQScaler : QueueSimplifiedScaler
{
public MyQScaler(IQueueCount count)
: base(count)
{
}
}
[Test]
public void Constructor()
{
var c = Substitute.For<IQueueCount>();
new MyQScaler(c);
}
[Test]
public void IsAutoScaler()
{
var c = Substitute.For<IQueueCount>();
Assert.IsNotNull(new MyQScaler(c) as AutoScaler<object>);
}
}
}
|
mit
|
C#
|
4dcfd49f20e5866ccb1d6812fcb97f9b8a34cd51
|
Fix formatting warning
|
CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,dotnet/roslyn,bartdesmet/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,weltkante/roslyn,weltkante/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn
|
src/Features/Core/Portable/Common/DocumentNavigationOperation.cs
|
src/Features/Core/Portable/Common/DocumentNavigationOperation.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.Threading;
using Microsoft.CodeAnalysis.Navigation;
using Microsoft.CodeAnalysis.Shared.Utilities;
namespace Microsoft.CodeAnalysis.CodeActions
{
/// <summary>
/// A <see cref="CodeActionOperation"/> for navigating to a specific position in a document.
/// When <see cref="CodeAction.GetOperationsAsync(CancellationToken)"/> is called an implementation
/// of <see cref="CodeAction"/> can return an instance of this operation along with the other
/// operations they want to apply. For example, an implementation could generate a new <see cref="Document"/>
/// in one <see cref="CodeActionOperation"/> and then have the host editor navigate to that
/// <see cref="Document"/> using this operation.
/// </summary>
public class DocumentNavigationOperation : CodeActionOperation
{
internal DocumentId DocumentId { get; }
internal int Position { get; }
public DocumentNavigationOperation(DocumentId documentId, int position = 0)
{
DocumentId = documentId ?? throw new ArgumentNullException(nameof(documentId));
Position = position;
}
public override void Apply(Workspace workspace, CancellationToken cancellationToken)
{
// Intentionally empty. Handling of this operation is special cased in CodeActionEditHandlerService.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.Threading;
using Microsoft.CodeAnalysis.Navigation;
using Microsoft.CodeAnalysis.Shared.Utilities;
namespace Microsoft.CodeAnalysis.CodeActions
{
/// <summary>
/// A <see cref="CodeActionOperation"/> for navigating to a specific position in a document.
/// When <see cref="CodeAction.GetOperationsAsync(CancellationToken)"/> is called an implementation
/// of <see cref="CodeAction"/> can return an instance of this operation along with the other
/// operations they want to apply. For example, an implementation could generate a new <see cref="Document"/>
/// in one <see cref="CodeActionOperation"/> and then have the host editor navigate to that
/// <see cref="Document"/> using this operation.
/// </summary>
public class DocumentNavigationOperation : CodeActionOperation
{
internal DocumentId DocumentId { get; }
internal int Position { get; }
public DocumentNavigationOperation(DocumentId documentId!!, int position = 0)
{
DocumentId = documentId;
Position = position;
}
public override void Apply(Workspace workspace, CancellationToken cancellationToken)
{
}
}
}
|
mit
|
C#
|
22711e9623eb9e3b367758b3c3e3865962492ad1
|
Add a comment about when the MoE calculation will be wrong.
|
christopher-bimson/VstsMetrics
|
VstsMetrics/Commands/CycleTime/WorkItemCycleTimeExtensions.cs
|
VstsMetrics/Commands/CycleTime/WorkItemCycleTimeExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Statistics;
namespace VstsMetrics.Commands.CycleTime
{
public static class WorkItemCycleTimeExtensions
{
public static IEnumerable<WorkItemCycleTimeSummary> Summarise(this IEnumerable<WorkItemCycleTime> cycleTimes)
{
var elapsedAverage = cycleTimes.Average(ct => ct.ElapsedCycleTimeInHours);
var workingAverage = cycleTimes.Average(ct => ct.ApproximateWorkingCycleTimeInHours);
var elapsedMoe = cycleTimes.MarginOfError(ct => ct.ElapsedCycleTimeInHours);
var workingMoe = cycleTimes.MarginOfError(ct => ct.ApproximateWorkingCycleTimeInHours);
return new[] {
new WorkItemCycleTimeSummary("Elapsed", elapsedAverage, elapsedMoe),
new WorkItemCycleTimeSummary("Approximate Working Time", workingAverage, workingMoe)
};
}
private static double MarginOfError(this IEnumerable<WorkItemCycleTime> cycleTimes, Func<WorkItemCycleTime, double> getter)
{
// http://www.dummies.com/education/math/statistics/how-to-calculate-the-margin-of-error-for-a-sample-mean/
// If the central limit theorem does not apply, then this will be incorrect. This should be exposed somehow at some point.
return cycleTimes.Select(getter).PopulationStandardDeviation()
/ Math.Sqrt(cycleTimes.Count())
* 1.96;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Statistics;
namespace VstsMetrics.Commands.CycleTime
{
public static class WorkItemCycleTimeExtensions
{
public static IEnumerable<WorkItemCycleTimeSummary> Summarise(this IEnumerable<WorkItemCycleTime> cycleTimes)
{
var elapsedAverage = cycleTimes.Average(ct => ct.ElapsedCycleTimeInHours);
var workingAverage = cycleTimes.Average(ct => ct.ApproximateWorkingCycleTimeInHours);
var elapsedMoe = cycleTimes.MarginOfError(ct => ct.ElapsedCycleTimeInHours);
var workingMoe = cycleTimes.MarginOfError(ct => ct.ApproximateWorkingCycleTimeInHours);
return new[] {
new WorkItemCycleTimeSummary("Elapsed", elapsedAverage, elapsedMoe),
new WorkItemCycleTimeSummary("Approximate Working Time", workingAverage, workingMoe)
};
}
private static double MarginOfError(this IEnumerable<WorkItemCycleTime> cycleTimes, Func<WorkItemCycleTime, double> getter)
{
// http://www.dummies.com/education/math/statistics/how-to-calculate-the-margin-of-error-for-a-sample-mean/
return cycleTimes.Select(getter).PopulationStandardDeviation()
/ Math.Sqrt(cycleTimes.Count())
* 1.96;
}
}
}
|
agpl-3.0
|
C#
|
49b6f7b28c004a803cd2f27075b9afd46eb6b18a
|
Increment version number
|
roberthardy/Synthesis,kamsar/Synthesis
|
Source/SharedAssemblyInfo.cs
|
Source/SharedAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System;
[assembly: AssemblyCompany("ISITE Design")]
[assembly: AssemblyProduct("Synthesis")]
[assembly: AssemblyCopyright("Copyright © Kam Figy, ISITE Design")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("7.2.1.0")]
[assembly: AssemblyFileVersion("7.2.1.0")]
[assembly: AssemblyInformationalVersion("7.2.1")]
[assembly: CLSCompliant(false)]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System;
[assembly: AssemblyCompany("ISITE Design")]
[assembly: AssemblyProduct("Synthesis")]
[assembly: AssemblyCopyright("Copyright © Kam Figy, ISITE Design")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("7.2.0.0")]
[assembly: AssemblyFileVersion("7.2.0.0")]
[assembly: AssemblyInformationalVersion("7.2.0")]
[assembly: CLSCompliant(false)]
|
mit
|
C#
|
c1cd31a4b21d961979a77ba9c84c1385c3158590
|
Add a todo
|
mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,Derrick-/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,DogaOztuzun/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode
|
Stratis.Bitcoin/MemoryPool/MempoolModule.cs
|
Stratis.Bitcoin/MemoryPool/MempoolModule.cs
|
using System;
using Microsoft.Extensions.DependencyInjection;
using NBitcoin;
namespace Stratis.Bitcoin.MemoryPool
{
public class MempoolModule : Module
{
public override void Configure(FullNode node, ServiceCollection serviceCollection)
{
// TODO: some of this types are required and will move to a NodeBuilder implementations
// temporary types
serviceCollection.AddSingleton(node.Chain);
serviceCollection.AddSingleton(node.Args);
serviceCollection.AddSingleton(node.ConnectionManager);
serviceCollection.AddSingleton(node.CoinView);
serviceCollection.AddSingleton(node.ConsensusLoop.Validator);
serviceCollection.AddSingleton(node.DateTimeProvider);
serviceCollection.AddSingleton(node.ChainBehaviorState);
serviceCollection.AddSingleton(node.GlobalCancellation);
serviceCollection.AddSingleton<MempoolScheduler>();
serviceCollection.AddSingleton<TxMempool>();
serviceCollection.AddSingleton<FeeRate>(MempoolValidator.MinRelayTxFee);
serviceCollection.AddSingleton<MempoolValidator>();
serviceCollection.AddSingleton<MempoolOrphans>();
serviceCollection.AddSingleton<MempoolManager>();
serviceCollection.AddSingleton<MempoolBehavior>();
serviceCollection.AddSingleton<MempoolSignaled>();
}
public override void Start(FullNode node, IServiceProvider service)
{
node.ConnectionManager.Parameters.TemplateBehaviors.Add(service.GetService<MempoolBehavior>());
node.Signals.Blocks.Subscribe(service.GetService<MempoolSignaled>());
node.MempoolManager = service.GetService<MempoolManager>();
}
}
}
|
using System;
using Microsoft.Extensions.DependencyInjection;
using NBitcoin;
namespace Stratis.Bitcoin.MemoryPool
{
public class MempoolModule : Module
{
public override void Configure(FullNode node, ServiceCollection serviceCollection)
{
// temporary types
serviceCollection.AddSingleton(node.Chain);
serviceCollection.AddSingleton(node.Args);
serviceCollection.AddSingleton(node.ConnectionManager);
serviceCollection.AddSingleton(node.CoinView);
serviceCollection.AddSingleton(node.ConsensusLoop.Validator);
serviceCollection.AddSingleton(node.DateTimeProvider);
serviceCollection.AddSingleton(node.ChainBehaviorState);
serviceCollection.AddSingleton(node.GlobalCancellation);
serviceCollection.AddSingleton<MempoolScheduler>();
serviceCollection.AddSingleton<TxMempool>();
serviceCollection.AddSingleton<FeeRate>(MempoolValidator.MinRelayTxFee);
serviceCollection.AddSingleton<MempoolValidator>();
serviceCollection.AddSingleton<MempoolOrphans>();
serviceCollection.AddSingleton<MempoolManager>();
serviceCollection.AddSingleton<MempoolBehavior>();
serviceCollection.AddSingleton<MempoolSignaled>();
}
public override void Start(FullNode node, IServiceProvider service)
{
node.ConnectionManager.Parameters.TemplateBehaviors.Add(service.GetService<MempoolBehavior>());
node.Signals.Blocks.Subscribe(service.GetService<MempoolSignaled>());
node.MempoolManager = service.GetService<MempoolManager>();
}
}
}
|
mit
|
C#
|
b18559a0719b1611e922dcd7b4bfa2d4ef214535
|
check Connected in GetState()
|
TakeAsh/cs-TakeAshUtility
|
TakeAshUtility/TcpClientExtensionMethods.cs
|
TakeAshUtility/TcpClientExtensionMethods.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
namespace TakeAshUtility {
public static class TcpClientExtensionMethods {
/// <summary>
/// Get TCP connection state
/// </summary>
/// <param name="tcpClient">TCP Client</param>
/// <returns>TCP connection state</returns>
/// <remarks>
/// [c# - How to check if TcpClient Connection is closed? - Stack Overflow](http://stackoverflow.com/questions/1387459)
/// </remarks>
public static TcpState GetState(this TcpClient tcpClient) {
var socket = tcpClient.Client;
if (!socket.Connected) {
return TcpState.Unknown;
}
var connection = IPGlobalProperties.GetIPGlobalProperties()
.GetActiveTcpConnections()
.FirstOrDefault(info =>
info.RemoteEndPoint.Equals(socket.RemoteEndPoint) &&
info.LocalEndPoint.Equals(socket.LocalEndPoint));
return connection != null ?
connection.State :
TcpState.Unknown;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
namespace TakeAshUtility {
public static class TcpClientExtensionMethods {
/// <summary>
/// Get TCP connection state
/// </summary>
/// <param name="tcpClient">TCP Client</param>
/// <returns>TCP connection state</returns>
/// <remarks>
/// [c# - How to check if TcpClient Connection is closed? - Stack Overflow](http://stackoverflow.com/questions/1387459)
/// </remarks>
public static TcpState GetState(this TcpClient tcpClient) {
var socket = tcpClient.Client;
var connection = IPGlobalProperties.GetIPGlobalProperties()
.GetActiveTcpConnections()
.FirstOrDefault(info =>
info.RemoteEndPoint.Equals(socket.RemoteEndPoint) &&
info.LocalEndPoint.Equals(socket.LocalEndPoint));
return connection != null ?
connection.State :
TcpState.Unknown;
}
}
}
|
mit
|
C#
|
1bc58ab05aa03ca8158fb6f39dd7f069e7607d50
|
Add new file userAuth.cpl/Droid/Properties/AssemblyInfo.cs
|
ArcanaMagus/userAuth.cpl,ArcanaMagus/userAuth.cpl,ArcanaMagus/userAuth.cpl,ArcanaMagus/userAuth.cpl
|
userAuth.cpl/Droid/Properties/AssemblyInfo.cs
|
userAuth.cpl/Droid/Properties/AssemblyInfo.cs
|
�
using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("userAuth.cpl.Droid")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("RonThomas")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
� using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("userAuth.cpl.Droid")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("RonThomas")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
mit
|
C#
|
3644d8e86e6de314bd6fabcd1c02825c115977e3
|
modify Performance improvement
|
darkcrash/bjd5,darkcrash/bjd5,darkcrash/bjd5,darkcrash/bjd5,darkcrash/bjd5
|
Bjd.Common/Logs/LogFileWriter.cs
|
Bjd.Common/Logs/LogFileWriter.cs
|
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace Bjd.Logs
{
//生成時に1つのファイルをオープンしてset()で1行ずつ格納するクラス
public class LogFileWriter : IDisposable
{
private FileStream _fs;
private StreamWriter _sw;
private readonly string _fileName;
private int disposeCount = 0;
private object Lock = new object();
private int bufferSize = 16384;
private bool isAsync = false;
public LogFileWriter(string fileName)
{
_fileName = fileName;
_fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite, bufferSize, true);
_sw = new StreamWriter(_fs, Encoding.UTF8, bufferSize, true);
_fs.Seek(0, SeekOrigin.End);
isAsync = _fs.IsAsync;
FlushTask();
}
private void FlushTask()
{
if (_sw == null) return;
if (isAsync)
{
_sw.FlushAsync()
.ContinueWith(_ => Task.Delay(500).Wait())
.ContinueWith(_ => FlushTask());
}
else
{
_sw.Flush();
Task.Delay(500).ContinueWith(_ => FlushTask());
}
}
public void Dispose()
{
lock (Lock)
{
disposeCount++;
if (_sw != null)
{
_sw.Flush();
_sw.Dispose();
_sw = null;
}
if (_fs != null)
{
_fs.Flush();
_fs.Dispose();
_fs = null;
}
}
}
public void WriteLine(string message)
{
if (_isAsync)
{
_sw.WriteLineAsync(message);
}
else
{
_sw.WriteLine(message);
}
//_sw.Flush();
}
}
}
|
using System;
using System.IO;
using System.Text;
namespace Bjd.Logs
{
//生成時に1つのファイルをオープンしてset()で1行ずつ格納するクラス
public class LogFileWriter : IDisposable
{
private FileStream _fs;
private StreamWriter _sw;
private readonly string _fileName;
private int disposeCount = 0;
private object Lock = new object();
public LogFileWriter(String fileName)
{
_fileName = fileName;
_fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite);
_sw = new StreamWriter(_fs, Encoding.UTF8);
_fs.Seek(0, SeekOrigin.End);
}
public void Dispose()
{
lock (Lock)
{
disposeCount++;
if (_sw != null)
{
_sw.Flush();
_sw.Dispose();
_sw = null;
}
if (_fs != null)
{
_fs.Dispose();
_fs = null;
}
}
}
public void WriteLine(string message)
{
_sw.WriteLine(message);
_sw.Flush();
}
}
}
|
apache-2.0
|
C#
|
3a2763b3cdfb66369d69148ed84fd63c6e24ad76
|
Change location of the output ods
|
noahmorrison/genodf
|
test/GenodfTest.cs
|
test/GenodfTest.cs
|
using System;
using System.IO;
using System.Reflection;
using Genodf;
namespace GenodfTest
{
public class GenodfTest
{
public static void Main()
{
var path = Assembly.GetExecutingAssembly().Location;
var dir = Path.GetDirectoryName(path);
var filePath = Path.Combine(dir, "genodf.ods");
var sheet = new Spreadsheet();
sheet.SetCell("A1", "2.5");
sheet.SetCell("B1", "3.5");
sheet.SetCell("C4", "=SUM(A1:B1)");
sheet.GetCell("C4").Bg = "#ff0000";
sheet.GetCell("C4").Fg = "#0000ff";
sheet.GetCell("C4").TextAlign = "center";
sheet.GetCell("C4").Bold = true;
sheet.SetCell("B6", "I'm really big!");
sheet.GetCell("B6").SpannedColumns = 2;
sheet.GetCell("B6").SpannedRows = 2;
sheet.SetCell("B9", "all");
sheet.GetCell("B9").Border = true;
sheet.SetCell("D9", "top");
sheet.GetCell("D9").BorderTop = true;
sheet.SetCell("F9", "bottom");
sheet.GetCell("F9").BorderBottom = true;
sheet.SetCell("H9", "left");
sheet.GetCell("H9").BorderLeft = true;
sheet.SetCell("J9", "right");
sheet.GetCell("J9").BorderRight = true;
var notSet = sheet.GetCell("E1");
notSet.value = "hey!";
var neverSet = sheet.GetCell("F1");
neverSet.Bg = "#aa55aa";
sheet.GetColumn(5).Width = 0.5;
sheet.Write(filePath);
Console.WriteLine("Done with test");
}
}
}
|
using System;
using System.IO;
using Genodf;
namespace GenodfTest
{
public class GenodfTest
{
public static void Main()
{
var cwd = Directory.GetCurrentDirectory();
if (!cwd.EndsWith("build"))
cwd = Path.Combine(cwd, "build");
var filePath = Path.Combine(cwd, "genodf.ods");
var sheet = new Spreadsheet();
sheet.SetCell("A1", "2.5");
sheet.SetCell("B1", "3.5");
sheet.SetCell("C4", "=SUM(A1:B1)");
sheet.GetCell("C4").Bg = "#ff0000";
sheet.GetCell("C4").Fg = "#0000ff";
sheet.GetCell("C4").TextAlign = "center";
sheet.GetCell("C4").Bold = true;
sheet.SetCell("B6", "I'm really big!");
sheet.GetCell("B6").SpannedColumns = 2;
sheet.GetCell("B6").SpannedRows = 2;
sheet.SetCell("B9", "all");
sheet.GetCell("B9").Border = true;
sheet.SetCell("D9", "top");
sheet.GetCell("D9").BorderTop = true;
sheet.SetCell("F9", "bottom");
sheet.GetCell("F9").BorderBottom = true;
sheet.SetCell("H9", "left");
sheet.GetCell("H9").BorderLeft = true;
sheet.SetCell("J9", "right");
sheet.GetCell("J9").BorderRight = true;
var notSet = sheet.GetCell("E1");
notSet.value = "hey!";
var neverSet = sheet.GetCell("F1");
neverSet.Bg = "#aa55aa";
sheet.GetColumn(5).Width = 0.5;
sheet.Write(filePath);
Console.WriteLine("Done with test");
}
}
}
|
mit
|
C#
|
bd79539fed24b1f630c3d69d9dbac3a5ce9f2727
|
Update version for next release
|
lmagyar/Orleans.Activities,OrleansContrib/Orleans.Activities
|
src/GlobalAssemblyInfo.cs
|
src/GlobalAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("https://github.com/OrleansContrib")]
[assembly: AssemblyProduct("Orleans.Activities - https://github.com/OrleansContrib/Orleans.Activities")]
[assembly: AssemblyCopyright("Copyright https://github.com/OrleansContrib 2016")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0-alpha")]
|
using System.Reflection;
[assembly: AssemblyCompany("https://github.com/OrleansContrib")]
[assembly: AssemblyProduct("Orleans.Activities - https://github.com/OrleansContrib/Orleans.Activities")]
[assembly: AssemblyCopyright("Copyright https://github.com/OrleansContrib 2016")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
|
apache-2.0
|
C#
|
6bc9f5bb974607fbf0a0e6fdbec0325308e36b58
|
write to console if can't write to window
|
ZornTaov/ZIRC
|
ZIRC/Commands/CommandBase.cs
|
ZIRC/Commands/CommandBase.cs
|
using System;
namespace ZIRC.Commands
{
public abstract class CommandBase
{
public virtual bool Do( ServerWindow window, string channel, string[] args )
{
if ( args.Length < this.MinLength() || args.Length > this.MaxLength() )
{
this.ErrorLength( window, channel, args.Length, args.Length < this.MinLength() );
return false;
}
return true;
}
public CommandBase getCommand()
{
return this;
}
public override string ToString()
{
return Name();
}
public abstract string Name();
public abstract string Syntax();
public abstract string Help();
public virtual int MinLength()
{
return 0;
}
public virtual int MaxLength()
{
return int.MaxValue;
}
public virtual void ErrorLength( ServerWindow window, string channel, int length, bool small )
{
ChannelWindow chan = window.getChannel(channel);
if (chan != null)
{
chan.printText( "Error: " + Name() + " Args: " + length + ( small ? " Not Enough Arguments." : " Too Many Arguments" ) );
}
else
{
Console.WriteLine("Error: " + Name() + " Args: " + length + (small ? " Not Enough Arguments." : " Too Many Arguments"));
}
}
}
}
|
using System;
namespace ZIRC.Commands
{
public abstract class CommandBase
{
public virtual bool Do( ServerWindow window, string channel, string[] args )
{
if ( args.Length < this.MinLength() || args.Length > this.MaxLength() )
{
this.ErrorLength( window, channel, args.Length, args.Length < this.MinLength() );
return false;
}
return true;
}
public CommandBase getCommand()
{
return this;
}
public override string ToString()
{
return Name();
}
public abstract string Name();
public abstract string Syntax();
public abstract string Help();
public virtual int MinLength()
{
return 0;
}
public virtual int MaxLength()
{
return int.MaxValue;
}
public virtual void ErrorLength( ServerWindow window, string channel, int length, bool small )
{
window.getChannel( channel ).printText( "Error: " + Name() + " Args: " + length + ( small ? " Not Enough Arguments." : " Too Many Arguments" ) );
}
}
}
|
mit
|
C#
|
0a7e909708eba3135d683750732cc3e45f201e79
|
Update Program.cs
|
ershadnozari/GitTest
|
ConsoleApp/ConsoleApp/Program.cs
|
ConsoleApp/ConsoleApp/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
// Code updated in GitHub.
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
mit
|
C#
|
fabb3acc505014bd521a915a5abd8537d3974995
|
Move musig class in the musig namespace
|
MetacoSA/NBitcoin,MetacoSA/NBitcoin
|
NBitcoin/Secp256k1/Musig/MusigPartialSignature.cs
|
NBitcoin/Secp256k1/Musig/MusigPartialSignature.cs
|
#if HAS_SPAN
#nullable enable
using NBitcoin.Secp256k1.Musig;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Text;
namespace NBitcoin.Secp256k1.Musig
{
#if SECP256K1_LIB
public
#endif
class MusigPartialSignature
{
#if SECP256K1_LIB
public
#else
internal
#endif
readonly Scalar E;
public MusigPartialSignature(Scalar e)
{
this.E = e;
}
public MusigPartialSignature(ReadOnlySpan<byte> in32)
{
this.E = new Scalar(in32, out var overflow);
if (overflow != 0)
throw new ArgumentOutOfRangeException(nameof(in32), "in32 is overflowing");
}
public void WriteToSpan(Span<byte> in32)
{
E.WriteToSpan(in32);
}
public byte[] ToBytes()
{
byte[] b = new byte[32];
WriteToSpan(b);
return b;
}
}
}
#endif
|
#if HAS_SPAN
#nullable enable
using NBitcoin.Secp256k1.Musig;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Text;
namespace NBitcoin.Secp256k1
{
#if SECP256K1_LIB
public
#endif
class MusigPartialSignature
{
#if SECP256K1_LIB
public
#else
internal
#endif
readonly Scalar E;
public MusigPartialSignature(Scalar e)
{
this.E = e;
}
public MusigPartialSignature(ReadOnlySpan<byte> in32)
{
this.E = new Scalar(in32, out var overflow);
if (overflow != 0)
throw new ArgumentOutOfRangeException(nameof(in32), "in32 is overflowing");
}
public void WriteToSpan(Span<byte> in32)
{
E.WriteToSpan(in32);
}
public byte[] ToBytes()
{
byte[] b = new byte[32];
WriteToSpan(b);
return b;
}
}
}
#endif
|
mit
|
C#
|
e5b956635928ab8354977a9b0043b5ef423a89aa
|
Support PUT index operations
|
khalidabuhakmeh/NElasticsearch,synhershko/NElasticsearch
|
NElasticsearch/Commands/SingleDocumentCommands.cs
|
NElasticsearch/Commands/SingleDocumentCommands.cs
|
using System.Threading.Tasks;
using NElasticsearch.Models;
namespace NElasticsearch.Commands
{
/// <summary>
/// See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs.html
/// </summary>
public static class SingleDocumentCommands
{
public static async Task<GetResponse<T>> Get<T>(this ElasticsearchClient client,
string id, string typeName, string indexName = null) where T : new()
{
var url = (indexName ?? client.DefaultIndexName) + "/" + typeName + "/" + id;
return await client.Execute<GetResponse<T>>(RestMethod.GET, url);
}
// TODO remove requirement for ID, without type as well
public static async Task Index<T>(this ElasticsearchClient client,
T obj, string id, string typeName, string indexName = null)
{
var url = (indexName ?? client.DefaultIndexName) + "/" + typeName + (!string.IsNullOrWhiteSpace(id) ? "/" + id : string.Empty);
await client.Execute(string.IsNullOrWhiteSpace(id) ? RestMethod.POST : RestMethod.PUT, url, obj);
}
public static async Task Delete(this ElasticsearchClient client,
string id, string typeName, string indexName = null)
{
var url = (indexName ?? client.DefaultIndexName) + "/" + typeName + "/" + id;
await client.Execute(RestMethod.DELETE, url);
}
// TODO Update API
}
}
|
using System.Threading.Tasks;
using NElasticsearch.Models;
namespace NElasticsearch.Commands
{
/// <summary>
/// See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs.html
/// </summary>
public static class SingleDocumentCommands
{
public static async Task<GetResponse<T>> Get<T>(this ElasticsearchClient client,
string id, string typeName, string indexName = null) where T : new()
{
var url = (indexName ?? client.DefaultIndexName) + "/" + typeName + "/" + id;
return await client.Execute<GetResponse<T>>(RestMethod.GET, url);
}
// TODO remove requirement for ID, without type as well
public static async Task Index<T>(this ElasticsearchClient client,
T obj, string id, string typeName, string indexName = null)
{
var url = (indexName ?? client.DefaultIndexName) + "/" + typeName + (!string.IsNullOrWhiteSpace(id) ? "/" + id : string.Empty);
await client.Execute(RestMethod.POST, url, obj);
}
public static async Task Delete(this ElasticsearchClient client,
string id, string typeName, string indexName = null)
{
var url = (indexName ?? client.DefaultIndexName) + "/" + typeName + "/" + id;
await client.Execute(RestMethod.DELETE, url);
}
// TODO Update API
}
}
|
apache-2.0
|
C#
|
cc6598f6aa708f3f1f527553665c7fc9e15fd180
|
Remove unused lastOutputLine calculation
|
jlewin/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl,mmoening/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl,jlewin/MatterControl,jlewin/MatterControl
|
PartPreviewWindow/View3D/SliceProgressReporter.cs
|
PartPreviewWindow/View3D/SliceProgressReporter.cs
|
/*
Copyright (c) 2017, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. 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.
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.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Diagnostics;
using MatterHackers.GCodeVisualizer;
using MatterHackers.Agg;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class SliceProgressReporter : IProgress<ProgressStatus>
{
private double currentValue = 0;
private double destValue = 10;
private IProgress<ProgressStatus> parentProgress;
private PrinterConfig printer;
private Stopwatch timer = Stopwatch.StartNew();
private string progressSection = "";
public SliceProgressReporter(IProgress<ProgressStatus> progressStatus, PrinterConfig printer)
{
this.parentProgress = progressStatus;
this.printer = printer;
}
public void Report(ProgressStatus progressStatus)
{
string value = progressStatus.Status;
if (GCodeFile.GetFirstNumberAfter("", value, ref currentValue)
&& GCodeFile.GetFirstNumberAfter("/", value, ref destValue))
{
if (destValue == 0)
{
destValue = 1;
}
int pos = value.IndexOf(currentValue.ToString());
if (pos != -1)
{
progressSection = value.Substring(0, pos);
}
else
{
progressSection = value;
}
timer.Restart();
progressStatus.Status = progressStatus.Status.TrimEnd('.');
progressStatus.Progress0To1 = currentValue / destValue;
}
else
{
printer.Connection.TerminalLog.WriteLine(value);
}
parentProgress.Report(progressStatus);
}
}
}
|
/*
Copyright (c) 2017, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. 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.
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.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Diagnostics;
using MatterHackers.GCodeVisualizer;
using MatterHackers.Agg;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class SliceProgressReporter : IProgress<ProgressStatus>
{
private double currentValue = 0;
private double destValue = 10;
private string lastOutputLine = "";
private IProgress<ProgressStatus> parentProgress;
private PrinterConfig printer;
private Stopwatch timer = Stopwatch.StartNew();
private string progressSection = "";
public SliceProgressReporter(IProgress<ProgressStatus> progressStatus, PrinterConfig printer)
{
this.parentProgress = progressStatus;
this.printer = printer;
}
public void Report(ProgressStatus progressStatus)
{
string value = progressStatus.Status;
if (GCodeFile.GetFirstNumberAfter("", value, ref currentValue)
&& GCodeFile.GetFirstNumberAfter("/", value, ref destValue))
{
if (destValue == 0)
{
destValue = 1;
}
int pos = value.IndexOf(currentValue.ToString());
if (pos != -1)
{
progressSection = value.Substring(0, pos);
}
else
{
progressSection = value;
}
timer.Restart();
progressStatus.Status = progressStatus.Status.TrimEnd('.');
progressStatus.Progress0To1 = currentValue / destValue;
}
else
{
printer.Connection.TerminalLog.WriteLine(value);
}
int lengthBeforeNumber = value.IndexOfAny("0123456789".ToCharArray()) - 1;
lengthBeforeNumber = lengthBeforeNumber < 0 ? lengthBeforeNumber = value.Length : lengthBeforeNumber;
if (lastOutputLine != value.Substring(0, lengthBeforeNumber))
{
lastOutputLine = value.Substring(0, lengthBeforeNumber);
}
parentProgress.Report(progressStatus);
}
}
}
|
bsd-2-clause
|
C#
|
f950e6e378f4ff6ee1313f4aeac957e7f4b19735
|
Tweak commandline options just a bit
|
RadicalZephyr/DesktopNotifier
|
DesktopNotifier/Program.cs
|
DesktopNotifier/Program.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using CommandLine;
using CommandLine.Text;
using System.Threading;
namespace DesktopNotifier
{
class Program
{
[STAThreadAttribute]
static void Main(string[] args)
{
var options = new Options();
if (CommandLine.Parser.Default.ParseArguments(args, options))
{
DisplayNotification(options);
}
}
static void DisplayNotification(Options options)
{
var notifyIcon = new NotifyIcon();
if (options.iconPath != null)
notifyIcon.Icon = new Icon(options.iconPath);
else
notifyIcon.Icon = Properties.Resources.CommandPromptIcon;
notifyIcon.BalloonTipTitle = options.title;
notifyIcon.BalloonTipText = options.message;
notifyIcon.Visible = true;
notifyIcon.ShowBalloonTip(options.showTime);
}
}
class Options
{
// Required
[Option('m', "message", Required = true, DefaultValue = "Hello, World", HelpText = "The message to display.")]
public string message { get; set; }
// Optional
[Option('t', "title", Required = false, DefaultValue = "Terminal", HelpText = "The title text to display.")]
public string title { get; set; }
[Option('i', "icon", Required = false, HelpText = "(Default: This program's app icon) The path to a .ico file to display.")]
public string iconPath { get; set; }
[Option('s', "showTime", Required = false, DefaultValue = 10000, HelpText = "The length of time to show notification for in milliseconds.")]
public int showTime { get; set; }
[HelpOption]
public string GetUsage()
{
return HelpText.AutoBuild(this, (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using CommandLine;
using CommandLine.Text;
using System.Threading;
namespace DesktopNotifier
{
class Program
{
[STAThreadAttribute]
static void Main(string[] args)
{
var options = new Options();
if (CommandLine.Parser.Default.ParseArguments(args, options))
{
DisplayNotification(options);
}
}
static void DisplayNotification(Options options)
{
var notifyIcon = new NotifyIcon();
if (options.iconPath != null)
notifyIcon.Icon = new Icon(options.iconPath);
else
notifyIcon.Icon = Properties.Resources.CommandPromptIcon;
notifyIcon.BalloonTipTitle = options.title;
notifyIcon.BalloonTipText = options.message;
notifyIcon.Visible = true;
notifyIcon.ShowBalloonTip(options.showTime);
}
}
class Options
{
// Required
[Option('m', "message", Required = true, DefaultValue = "Hello, World", HelpText = "The message to display.")]
public string message { get; set; }
// Optional
[Option('t', "title", Required = true, DefaultValue = "Terminal", HelpText = "The title text to display.")]
public string title { get; set; }
[Option('i', "icon", Required = false, HelpText = "The path to a .ico file to display.")]
public string iconPath { get; set; }
[Option('s', "showTime", Required = false, DefaultValue = 10000, HelpText = "The length of time to show notification for in milliseconds.")]
public int showTime { get; set; }
[HelpOption]
public string GetUsage()
{
return HelpText.AutoBuild(this, (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
}
}
}
|
mit
|
C#
|
e6a8b4c4feabf9942845f89080082de255bb8fd2
|
move to .net standard 2.0
|
VictorScherbakov/SharpChannels
|
SharpChannels.Protobuf/Properties/AssemblyInfo.cs
|
SharpChannels.Protobuf/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Управление общими сведениями о сборке осуществляется с помощью
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("SharpChannels.Protobuf")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpChannels.Protobuf")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
// для COM-компонентов. Если требуется обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("bd281fd7-bbf9-401a-bdf4-7c635acdc2d5")]
// Сведения о версии сборки состоят из следующих четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Редакция
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
ea8cbe700cb2fba502c743456b7cb02fb8831b08
|
Update ErrorResponse.cs
|
bugfi5h/Alexa-Smart-Home
|
RKon.Alexa.NET/Response/ErrorResponses/ErrorResponse.cs
|
RKon.Alexa.NET/Response/ErrorResponses/ErrorResponse.cs
|
using System;
using RKon.Alexa.NET.Request;
using Newtonsoft.Json;
using RKon.Alexa.NET.Types;
namespace RKon.Alexa.NET.Response.ErrorResponses
{
/// <summary>
/// Exception, if this error response is for a DiscoverApplianceRequest
/// </summary>
public class UnvalidDiscoveryResponseException : Exception
{
/// <summary>
/// Constructor
/// </summary>
public UnvalidDiscoveryResponseException() : base("Discovery requests can not be answered by error responses") { }
}
/// <summary>
/// Abstract base class for error responses of SmartHomeRequests.
/// </summary>
public abstract class ErrorResponse : ISmartHomeResponse
{
/// <summary>
/// Header
/// </summary>
[JsonRequired]
[JsonProperty("header")]
public ResponseHeader Header
{
get; set;
}
/// <summary>
/// Payload
/// </summary>
[JsonRequired]
[JsonProperty("payload")]
public ResponsePayload Payload
{
get; set;
}
/// <summary>
/// returns the Type of a Payloads
/// </summary>
/// <returns>System.Type of the Payloads</returns>
public System.Type GetResponsePayloadType()
{
return Payload?.GetType();
}
/// <summary>
/// Sets the Header with the request header and the errorname.
/// </summary>
/// <param name="reqHeader">RequestHeader</param>
/// <param name="errorName">Name of the error</param>
/// <returns></returns>
protected ResponseHeader setHeader(RequestHeader reqHeader, string errorName)
{
ResponseHeader header = new ResponseHeader(reqHeader);
header.Name = errorName;
return header;
}
/// <summary>
/// Throws a UnvalidDiscoveryResponseException, if a Errorresponse is used as a response for DiscoverApplianceRequests.
/// </summary>
/// <param name="reqHeaderName"></param>
protected void throwExceptionOnDiscoveryRequest(string reqHeaderName)
{
if (reqHeaderName == HeaderNames.DISCOVERY_REQUEST)
{
throw new UnvalidDiscoveryResponseException();
}
}
}
}
|
using System;
using RKon.Alexa.NET.Request;
using Newtonsoft.Json;
using RKon.Alexa.NET.Types;
namespace RKon.Alexa.NET.Response.ErrorResponses
{
/// <summary>
/// Exception, if this error response is for a DiscoverApplianceRequest
/// </summary>
public class UnvalidDiscoveryResponseException : Exception
{
/// <summary>
/// Constructor
/// </summary>
public UnvalidDiscoveryResponseException() : base("Discovery requests can not be answered by error responses") { }
}
/// <summary>
/// Abstract base class for error responses of SmartHomeRequests.
/// </summary>
public abstract class ErrorResponse : ISmartHomeResponse
{
/// <summary>
/// Header
/// </summary>
[JsonRequired]
[JsonProperty("header")]
public ResponseHeader Header
{
get; set;
}
/// <summary>
/// Payload
/// </summary>
[JsonRequired]
[JsonProperty("payload")]
public ResponsePayload Payload
{
get; set;
}
/// <summary>
/// returns the Type of a Payloads
/// </summary>
/// <returns>System.Type of the Payloads</returns>
public System.Type GetResponsePayloadType()
{
return Payload?.GetType();
}
/// <summary>
/// Sets the Header with the request header and the errorname.
/// </summary>
/// <param name="reqHeader">RequestHeader</param>
/// <param name="errorName">Name of the error</param>
/// <returns></returns>
protected ResponseHeader setHeader(RequestHeader reqHeader, string errorName)
{
ResponseHeader header = new ResponseHeader(reqHeader);
header.Name = errorName;
return header;
}
/// <summary>
/// Schmeißt eine UnvalidDiscoveryResponseException, wenn versucht wird eine ErrorResponse für ein DiscoverApplianceRequest zu verwenden.
/// </summary>
/// <param name="reqHeaderName"></param>
protected void throwExceptionOnDiscoveryRequest(string reqHeaderName)
{
if (reqHeaderName == HeaderNames.DISCOVERY_REQUEST)
{
throw new UnvalidDiscoveryResponseException();
}
}
}
}
|
mit
|
C#
|
23bd8c0cb53f1d17c3555783c0806470e1b76737
|
bump 1.0.4
|
GangZhuo/BaiduPCS_NET
|
Sample/Sample_0_FileExplorer/Properties/AssemblyInfo.cs
|
Sample/Sample_0_FileExplorer/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("Explorer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Explorer")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5702020c-24f2-4c09-a92c-0a6d60bf6fbc")]
// 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.4.0")]
[assembly: AssemblyFileVersion("1.0.4.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("Explorer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Explorer")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5702020c-24f2-4c09-a92c-0a6d60bf6fbc")]
// 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.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
|
mit
|
C#
|
cdc9140e3d6d5b5e93afd9f27fd6c50c690faa84
|
Print x and y distance on touch events
|
villor/Styr
|
Droid/TouchPadGestureListener.cs
|
Droid/TouchPadGestureListener.cs
|
using Android.Views;
using System;
namespace StyrClient.Droid
{
public class TouchPadGestureListener : GestureDetector.SimpleOnGestureListener
{
public override void OnLongPress (MotionEvent e)
{
Console.WriteLine ("OnLongPress");
base.OnLongPress (e);
}
public override bool OnDoubleTap (MotionEvent e)
{
Console.WriteLine ("OnDoubleTap");
return base.OnDoubleTap (e);
}
public override bool OnDoubleTapEvent (MotionEvent e)
{
Console.WriteLine ("OnDoubleTapEvent");
return base.OnDoubleTapEvent (e);
}
public override bool OnSingleTapUp (MotionEvent e)
{
Console.WriteLine ("OnSingleTapUp");
return base.OnSingleTapUp (e);
}
public override bool OnDown (MotionEvent e)
{
Console.WriteLine ("OnDown");
return base.OnDown (e);
}
public override bool OnFling (MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
Console.WriteLine ("OnFling");
return base.OnFling (e1, e2, velocityX, velocityY);
}
public override bool OnScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
{
Console.WriteLine ("OnScroll x:{0} y:{1}", distanceX, distanceY);
return base.OnScroll (e1, e2, distanceX, distanceY);
}
public override void OnShowPress (MotionEvent e)
{
Console.WriteLine ("OnShowPress");
base.OnShowPress (e);
}
public override bool OnSingleTapConfirmed (MotionEvent e)
{
Console.WriteLine ("OnSingleTapConfirmed");
return base.OnSingleTapConfirmed (e);
}
}
}
|
using Android.Views;
using System;
namespace StyrClient.Droid
{
public class TouchPadGestureListener : GestureDetector.SimpleOnGestureListener
{
public override void OnLongPress (MotionEvent e)
{
Console.WriteLine ("OnLongPress");
base.OnLongPress (e);
}
public override bool OnDoubleTap (MotionEvent e)
{
Console.WriteLine ("OnDoubleTap");
return base.OnDoubleTap (e);
}
public override bool OnDoubleTapEvent (MotionEvent e)
{
Console.WriteLine ("OnDoubleTapEvent");
return base.OnDoubleTapEvent (e);
}
public override bool OnSingleTapUp (MotionEvent e)
{
Console.WriteLine ("OnSingleTapUp");
return base.OnSingleTapUp (e);
}
public override bool OnDown (MotionEvent e)
{
Console.WriteLine ("OnDown");
return base.OnDown (e);
}
public override bool OnFling (MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
Console.WriteLine ("OnFling");
return base.OnFling (e1, e2, velocityX, velocityY);
}
public override bool OnScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
{
Console.WriteLine ("OnScroll");
return base.OnScroll (e1, e2, distanceX, distanceY);
}
public override void OnShowPress (MotionEvent e)
{
Console.WriteLine ("OnShowPress");
base.OnShowPress (e);
}
public override bool OnSingleTapConfirmed (MotionEvent e)
{
Console.WriteLine ("OnSingleTapConfirmed");
return base.OnSingleTapConfirmed (e);
}
}
}
|
mit
|
C#
|
7e12c63190c5e6e11846ceec005df7a7084c7406
|
Fix native AdjustImei class path
|
adjust/unity_sdk,adjust/unity_sdk,adjust/unity_sdk
|
Assets/AdjustImei/Android/AdjustImeiAndroid.cs
|
Assets/AdjustImei/Android/AdjustImeiAndroid.cs
|
using System;
using System.Runtime.InteropServices;
using UnityEngine;
namespace com.adjust.sdk.imei
{
#if UNITY_ANDROID
public class AdjustImeiAndroid
{
private static AndroidJavaClass ajcAdjustImei = new AndroidJavaClass("com.adjust.sdk.imei.AdjustImei");
public static void ReadImei()
{
if (ajcAdjustImei == null)
{
ajcAdjustImei = new AndroidJavaClass("com.adjust.sdk.imei.AdjustImei");
}
ajcAdjustImei.CallStatic("readImei");
}
public static void DoNotReadImei()
{
if (ajcAdjustImei == null)
{
ajcAdjustImei = new AndroidJavaClass("com.adjust.sdk.imei.AdjustImei");
}
ajcAdjustImei.CallStatic("doNotReadImei");
}
}
#endif
}
|
using System;
using System.Runtime.InteropServices;
using UnityEngine;
namespace com.adjust.sdk.imei
{
#if UNITY_ANDROID
public class AdjustImeiAndroid
{
private static AndroidJavaClass ajcAdjustImei = new AndroidJavaClass("com.adjust.sdk.imei.AdjustImei");
public static void ReadImei()
{
if (ajcAdjustImei == null)
{
ajcAdjustImei = new AndroidJavaClass("com.adjust.sdk.Adjust");
}
ajcAdjustImei.CallStatic("readImei");
}
public static void DoNotReadImei()
{
if (ajcAdjustImei == null)
{
ajcAdjustImei = new AndroidJavaClass("com.adjust.sdk.Adjust");
}
ajcAdjustImei.CallStatic("doNotReadImei");
}
}
#endif
}
|
mit
|
C#
|
3b17db84578eb70ecc19aa1dfad90256b06fa634
|
Add comments
|
drazmazen/Hodorizer
|
Hodor.Scheduler/Program.cs
|
Hodor.Scheduler/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32.TaskScheduler;
using System.Threading;
using System.IO;
namespace Hodor.Scheduler
{
class Program
{
static void Main(string[] args)
{
using (TaskService ts = new TaskService())
{
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "Hodorizer service startup";
LogonTrigger lt = new LogonTrigger();
lt.Enabled = true;
lt.Id = Thread.CurrentPrincipal.Identity.Name;
lt.UserId = Thread.CurrentPrincipal.Identity.Name;
td.Triggers.Add(lt);
td.Principal.RunLevel = TaskRunLevel.Highest;
td.Principal.UserId = Thread.CurrentPrincipal.Identity.Name;
td.Principal.LogonType = TaskLogonType.InteractiveToken;
td.Settings.AllowDemandStart = true;
td.Settings.Enabled = true;
td.Settings.StartWhenAvailable = true;
td.Settings.MultipleInstances = TaskInstancesPolicy.IgnoreNew;
td.Settings.RestartInterval = new TimeSpan(0, 5, 0);
td.Settings.RestartCount = 3;
//create path
var pathToExecutable = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Hodor.ConsoleServiceHost.exe");
// Create an action that will launch the service host whenever the trigger fires
td.Actions.Add(new ExecAction(pathToExecutable));
// Register the task in the root folder
ts.RootFolder.RegisterTaskDefinition("Hodorizer Service Starter", td);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32.TaskScheduler;
using System.Threading;
using System.IO;
namespace Hodor.Scheduler
{
class Program
{
static void Main(string[] args)
{
using (TaskService ts = new TaskService())
{
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "Hodorizer service startup";
LogonTrigger lt = new LogonTrigger();
lt.Enabled = true;
lt.Id = Thread.CurrentPrincipal.Identity.Name;
lt.UserId = Thread.CurrentPrincipal.Identity.Name;
td.Triggers.Add(lt);
td.Principal.RunLevel = TaskRunLevel.Highest;
td.Principal.UserId = Thread.CurrentPrincipal.Identity.Name;
td.Principal.LogonType = TaskLogonType.InteractiveToken;
td.Settings.AllowDemandStart = true;
td.Settings.Enabled = true;
td.Settings.StartWhenAvailable = true;
td.Settings.MultipleInstances = TaskInstancesPolicy.IgnoreNew;
td.Settings.RestartInterval = new TimeSpan(0, 5, 0);
td.Settings.RestartCount = 3;
//create path
var pathToExecutable = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Hodor.ConsoleServiceHost.exe");
// Create an action that will launch Notepad whenever the trigger fires
td.Actions.Add(new ExecAction(pathToExecutable));
// Register the task in the root folder
ts.RootFolder.RegisterTaskDefinition("Hodorizer Service Starter", td);
}
}
}
}
|
mit
|
C#
|
e50bdef2cc01b764a7972cf25563dc5b7238ce0d
|
fix ConcurrentQueue Dequeue memory leak bug
|
sdgdsffdsfff/hermes.net
|
Arch.CMessaging.Client/Net/Core/Write/DefaultWriteRequestQueue.cs
|
Arch.CMessaging.Client/Net/Core/Write/DefaultWriteRequestQueue.cs
|
using System;
using System.Collections.Concurrent;
using Arch.CMessaging.Client.Net.Core.Session;
namespace Arch.CMessaging.Client.Net.Core.Write
{
class DefaultWriteRequestQueue : IWriteRequestQueue
{
private ConcurrentQueue<ItemWrapper<IWriteRequest>> q = new ConcurrentQueue<ItemWrapper<IWriteRequest>>();
public Int32 Size
{
get { return q.Count; }
}
public IWriteRequest Poll(IoSession session)
{
IWriteRequest request = null;
ItemWrapper<IWriteRequest> item;
if (q.TryDequeue(out item))
{
request = item.Value;
item.Value = null;
}
return request;
}
public void Offer(IoSession session, IWriteRequest writeRequest)
{
q.Enqueue(new ItemWrapper<IWriteRequest> { Value = writeRequest });
}
public Boolean IsEmpty(IoSession session)
{
return q.IsEmpty;
}
public void Clear(IoSession session)
{
q = new ConcurrentQueue<ItemWrapper<IWriteRequest>>();
}
public void Dispose(IoSession session)
{
// Do nothing
}
private struct ItemWrapper<T>
{
public T Value { get; set; }
}
}
}
|
using System;
using System.Collections.Concurrent;
using Arch.CMessaging.Client.Net.Core.Session;
namespace Arch.CMessaging.Client.Net.Core.Write
{
class DefaultWriteRequestQueue : IWriteRequestQueue
{
private ConcurrentQueue<IWriteRequest> q = new ConcurrentQueue<IWriteRequest>();
public Int32 Size
{
get { return q.Count; }
}
public IWriteRequest Poll(IoSession session)
{
IWriteRequest request;
q.TryDequeue(out request);
return request;
}
public void Offer(IoSession session, IWriteRequest writeRequest)
{
q.Enqueue(writeRequest);
}
public Boolean IsEmpty(IoSession session)
{
return q.IsEmpty;
}
public void Clear(IoSession session)
{
q = new ConcurrentQueue<IWriteRequest>();
}
public void Dispose(IoSession session)
{
// Do nothing
}
}
}
|
apache-2.0
|
C#
|
bf206aadb595225f75c109ef33d80ab5889295ee
|
Update version number and remove logging
|
ahockersten/ScrollsKeepChatOpen
|
KeepChatOpen.mod/KeepChatOpen.cs
|
KeepChatOpen.mod/KeepChatOpen.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using ScrollsModLoader.Interfaces;
using UnityEngine;
using Mono.Cecil;
namespace KeepChatOpen.mod {
public class KeepChatOpen : BaseMod {
public KeepChatOpen() {
}
public static string GetName() {
return "KeepChatOpen";
}
public static int GetVersion() {
return 2;
}
public static MethodDefinition[] GetHooks(TypeDefinitionCollection scrollsTypes, int version) {
try {
return new MethodDefinition[] {
scrollsTypes["ChatUI"].Methods.GetMethod("Show", new Type[]{typeof(bool)})
};
}
catch {
return new MethodDefinition[] { };
}
}
public override bool BeforeInvoke(InvocationInfo info, out object returnValue) {
returnValue = null;
if (info.target is ChatUI && info.targetMethod.Equals("Show")) {
foreach (StackFrame frame in info.stackTrace.GetFrames()) {
// Disallow all except for:
// ChatUI.OnGUI() - this gets called when the user clicks the open/close button
// Lobby.Start() - this gets called when the user moves to the "arena" tab
if ((frame.GetMethod().ReflectedType.Equals(typeof(ChatUI)) && frame.GetMethod().Name.Contains("OnGUI")) ||
(frame.GetMethod().ReflectedType.Equals(typeof(Lobby)) && frame.GetMethod().Name.Contains("Start"))) {
return false;
}
}
return true;
}
return false;
}
public override void AfterInvoke(InvocationInfo info, ref object returnValue) {
return;
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using ScrollsModLoader.Interfaces;
using UnityEngine;
using Mono.Cecil;
namespace KeepChatOpen.mod {
public class KeepChatOpen : BaseMod {
public KeepChatOpen() {
}
public static string GetName() {
return "KeepChatOpen";
}
public static int GetVersion() {
return 1;
}
public static MethodDefinition[] GetHooks(TypeDefinitionCollection scrollsTypes, int version) {
try {
return new MethodDefinition[] {
scrollsTypes["ChatUI"].Methods.GetMethod("Show", new Type[]{typeof(bool)})
};
}
catch {
Console.WriteLine("KeepChatOpen failed to connect to methods used.");
return new MethodDefinition[] { };
}
}
public override bool BeforeInvoke(InvocationInfo info, out object returnValue) {
returnValue = null;
if (info.target is ChatUI && info.targetMethod.Equals("Show")) {
foreach (StackFrame frame in info.stackTrace.GetFrames()) {
// Disallow all except for:
// ChatUI.OnGUI() - this gets called when the user clicks the open/close button
// Lobby.Start() - this gets called when the user moves to the "arena" tab
if ((frame.GetMethod().ReflectedType.Equals(typeof(ChatUI)) && frame.GetMethod().Name.Contains("OnGUI")) ||
(frame.GetMethod().ReflectedType.Equals(typeof(Lobby)) && frame.GetMethod().Name.Contains("Start"))) {
return false;
}
}
return true;
}
return false;
}
public override void AfterInvoke(InvocationInfo info, ref object returnValue) {
return;
}
}
}
|
bsd-2-clause
|
C#
|
650ff8fe98b7b77163aee56e12baad60bc3641fb
|
Fix name violation
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi/Crypto/ZeroKnowledge/SyntheticSecretNonceProvider.cs
|
WalletWasabi/Crypto/ZeroKnowledge/SyntheticSecretNonceProvider.cs
|
using NBitcoin.Secp256k1;
using System.Collections.Generic;
using System.Linq;
using WalletWasabi.Crypto.Randomness;
using WalletWasabi.Crypto.StrobeProtocol;
using WalletWasabi.Helpers;
namespace WalletWasabi.Crypto.ZeroKnowledge
{
public class SyntheticSecretNonceProvider
{
private readonly Strobe128 Strobe;
private readonly int SecretCount;
public SyntheticSecretNonceProvider(Strobe128 strobe, IEnumerable<Scalar> secrets, WasabiRandom random)
{
Guard.NotNullOrEmpty(nameof(secrets), secrets);
Strobe = strobe;
SecretCount = secrets.Count();
// add secret inputs as key material
foreach (var secret in secrets)
{
Strobe.Key(secret.ToBytes(), false);
}
Strobe.Key(random.GetBytes(32), false);
}
private IEnumerable<Scalar> Sequence()
{
while (true)
{
yield return new Scalar(Strobe.Prf(32, false));
}
}
public Scalar GetScalar() =>
Sequence().First();
public ScalarVector GetScalarVector() =>
new ScalarVector(Sequence().Take(SecretCount));
}
}
|
using NBitcoin.Secp256k1;
using System.Collections.Generic;
using System.Linq;
using WalletWasabi.Crypto.Randomness;
using WalletWasabi.Crypto.StrobeProtocol;
using WalletWasabi.Helpers;
namespace WalletWasabi.Crypto.ZeroKnowledge
{
public class SyntheticSecretNonceProvider
{
private readonly Strobe128 _strobe;
private readonly int _secretCount;
public SyntheticSecretNonceProvider(Strobe128 strobe, IEnumerable<Scalar> secrets, WasabiRandom random)
{
Guard.NotNullOrEmpty(nameof(secrets), secrets);
_strobe = strobe;
_secretCount = secrets.Count();
// add secret inputs as key material
foreach (var secret in secrets)
{
_strobe.Key(secret.ToBytes(), false);
}
_strobe.Key(random.GetBytes(32), false);
}
private IEnumerable<Scalar> Sequence()
{
while (true)
{
yield return new Scalar(_strobe.Prf(32, false));
}
}
public Scalar GetScalar() =>
Sequence().First();
public ScalarVector GetScalarVector() =>
new ScalarVector(Sequence().Take(_secretCount));
}
}
|
mit
|
C#
|
a2f48887901abae7b6d2bccd0000436559cb4cf4
|
Update frame method in elbgb_console to fix appveyor build
|
eightlittlebits/elbgb
|
elbgb_console/Program.cs
|
elbgb_console/Program.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using elbgb_core;
namespace elbgb_console
{
class Program
{
static void Main(string[] args)
{
string romPath = args[0];
//romPath = @"roms\cpu_instrs\cpu_instrs.gb";
//romPath = @"roms\cpu_instrs\individual\01-special.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\02-interrupts.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\03-op sp,hl.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\04-op r,imm.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\05-op rp.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\06-ld r,r.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\07-jr,jp,call,ret,rst.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\08-misc instrs.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\09-op r,r.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\10-bit ops.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\11-op a,(hl).gb"; // Passed
//romPath = @"roms\instr_timing\instr_timing.gb"; // Passed
//romPath = @"roms\mem_timing\mem_timing.gb"; // Passed
//romPath = @"roms\mem_timing\individual\01-read_timing.gb"; // Passed
//romPath = @"roms\mem_timing\individual\02-write_timing.gb"; // Passed
//romPath = @"roms\mem_timing\individual\03-modify_timing.gb"; // Passed
byte[] rom = File.ReadAllBytes(romPath);
GameBoy gb = new GameBoy();
//gb.Interface.SerialTransferComplete = OutputSerialValue;
gb.LoadRom(rom);
int frameCounter = 0;
Stopwatch stopwatch = new Stopwatch();
try
{
while (true)
{
stopwatch.Restart();
gb.StepFrame();
stopwatch.Stop();
frameCounter++;
double elapsedMilliseconds = stopwatch.ElapsedTicks / (double)(Stopwatch.Frequency / 1000);
Console.WriteLine("Frame {0} ran in {1}ms", frameCounter, elapsedMilliseconds);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
private static void OutputSerialValue(byte value)
{
Console.WriteLine("{0:X2}", value);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using elbgb_core;
namespace elbgb_console
{
class Program
{
static void Main(string[] args)
{
string romPath = args[0];
//romPath = @"roms\cpu_instrs\cpu_instrs.gb";
//romPath = @"roms\cpu_instrs\individual\01-special.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\02-interrupts.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\03-op sp,hl.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\04-op r,imm.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\05-op rp.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\06-ld r,r.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\07-jr,jp,call,ret,rst.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\08-misc instrs.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\09-op r,r.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\10-bit ops.gb"; // Passed
//romPath = @"roms\cpu_instrs\individual\11-op a,(hl).gb"; // Passed
//romPath = @"roms\instr_timing\instr_timing.gb"; // Passed
//romPath = @"roms\mem_timing\mem_timing.gb"; // Passed
//romPath = @"roms\mem_timing\individual\01-read_timing.gb"; // Passed
//romPath = @"roms\mem_timing\individual\02-write_timing.gb"; // Passed
//romPath = @"roms\mem_timing\individual\03-modify_timing.gb"; // Passed
byte[] rom = File.ReadAllBytes(romPath);
GameBoy gb = new GameBoy();
//gb.Interface.SerialTransferComplete = OutputSerialValue;
gb.LoadRom(rom);
int frameCounter = 0;
Stopwatch stopwatch = new Stopwatch();
try
{
while (true)
{
stopwatch.Restart();
gb.RunFrame();
stopwatch.Stop();
frameCounter++;
double elapsedMilliseconds = stopwatch.ElapsedTicks / (double)(Stopwatch.Frequency / 1000);
Console.WriteLine("Frame {0} ran in {1}ms", frameCounter, elapsedMilliseconds);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
private static void OutputSerialValue(byte value)
{
Console.WriteLine("{0:X2}", value);
}
}
}
|
mit
|
C#
|
8d5977d158f87068060c684cb9fc0efb52bf22f8
|
Include git information in json file
|
pdelvo/StyleCop.Analyzers.Status,sharwell/StyleCop.Analyzers.Status,pdelvo/StyleCop.Analyzers.Status,sharwell/StyleCop.Analyzers.Status,DotNetAnalyzers/StyleCopAnalyzers,sharwell/StyleCop.Analyzers.Status,pdelvo/StyleCop.Analyzers.Status
|
StyleCop.Analyzers.Status.Generator/Program.cs
|
StyleCop.Analyzers.Status.Generator/Program.cs
|
namespace StyleCop.Analyzers.Status.Generator
{
using System;
using System.IO;
using System.Linq;
using LibGit2Sharp;
using Newtonsoft.Json;
/// <summary>
/// The starting point of this application.
/// </summary>
internal class Program
{
/// <summary>
/// The starting point of this application.
/// </summary>
/// <param name="args">The command line parameters.</param>
internal static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("Path to sln file required.");
return;
}
SolutionReader reader = SolutionReader.CreateAsync(args[0]).Result;
var diagnostics = reader.GetDiagnosticsAsync().Result;
Commit commit;
string commitId;
using (Repository repository = new Repository(Path.GetDirectoryName(args[0])))
{
commitId = repository.Head.Tip.Sha;
commit = repository.Head.Tip;
var output = new
{
diagnostics,
git = new
{
commit.Sha,
commit.Message,
commit.Author,
commit.Committer,
Parents = commit.Parents.Select(x => x.Sha)
}
};
Console.WriteLine(JsonConvert.SerializeObject(output));
}
}
}
}
|
namespace StyleCop.Analyzers.Status.Generator
{
using System;
using System.IO;
using LibGit2Sharp;
using Newtonsoft.Json;
/// <summary>
/// The starting point of this application.
/// </summary>
internal class Program
{
/// <summary>
/// The starting point of this application.
/// </summary>
/// <param name="args">The command line parameters.</param>
internal static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("Path to sln file required.");
return;
}
SolutionReader reader = SolutionReader.CreateAsync(args[0]).Result;
var diagnostics = reader.GetDiagnosticsAsync().Result;
string commitId;
using (Repository repository = new Repository(Path.GetDirectoryName(args[0])))
{
commitId = repository.Head.Tip.Sha;
}
var output = new
{
diagnostics,
commitId
};
Console.WriteLine(JsonConvert.SerializeObject(output));
}
}
}
|
mit
|
C#
|
9be4715bd2eba1c5a135639d966ef4b3ca86b43b
|
Update RavenUnitOfWorkBase.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/RavenDB/RavenUnitOfWorkBase.cs
|
TIKSN.Core/Data/RavenDB/RavenUnitOfWorkBase.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Raven.Client.Documents;
using Raven.Client.Documents.Session;
namespace TIKSN.Data.RavenDB
{
public abstract class RavenUnitOfWorkBase : UnitOfWorkBase
{
protected readonly IAsyncDocumentSession _session;
protected RavenUnitOfWorkBase(IDocumentStore store)
{
if (store == null)
{
throw new ArgumentNullException(nameof(store));
}
this._session = store.OpenAsyncSession();
}
public override async Task CompleteAsync(CancellationToken cancellationToken)
{
await this._session.SaveChangesAsync(cancellationToken);
this._session.Advanced.Clear();
}
public override void Dispose()
{
this._session.Dispose();
base.Dispose();
}
protected override bool IsDirty() => false;
//return _session.Advanced.HasChanges;
}
}
|
using Raven.Client.Documents;
using Raven.Client.Documents.Session;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.RavenDB
{
public abstract class RavenUnitOfWorkBase : UnitOfWorkBase
{
protected readonly IAsyncDocumentSession _session;
protected RavenUnitOfWorkBase(IDocumentStore store)
{
if (store == null)
throw new ArgumentNullException(nameof(store));
_session = store.OpenAsyncSession();
}
public override async Task CompleteAsync(CancellationToken cancellationToken)
{
await _session.SaveChangesAsync(cancellationToken);
_session.Advanced.Clear();
}
public override void Dispose()
{
_session.Dispose();
base.Dispose();
}
protected override bool IsDirty()
{
return false;
//return _session.Advanced.HasChanges;
}
}
}
|
mit
|
C#
|
4fdff3ad31d0888a98acea60de4c3627d3a45121
|
Remove unused code
|
danielmundt/csremote
|
source/Remoting.Server/Server.cs
|
source/Remoting.Server/Server.cs
|
#region Header
// Copyright (C) 2012 Daniel Schubert
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
// AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endregion Header
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;
using System.Text;
using Remoting.Service;
namespace Remoting.Server
{
class Server
{
#region Methods
public void Create(MarshalByRefObject refObject)
{
// create and register the server channel
IpcChannel serverChannel = new IpcChannel("remote");
ChannelServices.RegisterChannel(serverChannel, false);
// expose an object for remote calls
RemotingConfiguration.RegisterWellKnownServiceType(
refObject.GetType(), "command", WellKnownObjectMode.Singleton);
RemotingServices.Marshal(refObject, "command");
}
#endregion Methods
}
}
|
#region Header
// Copyright (C) 2012 Daniel Schubert
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
// AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endregion Header
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;
using System.Text;
using Remoting.Service;
namespace Remoting.Server
{
class Server
{
#region Methods
public void Create(MarshalByRefObject refObject)
{
// create and register the server channel
IpcChannel serverChannel = new IpcChannel("remote");
ChannelServices.RegisterChannel(serverChannel, false);
// show the name of the channel
Console.WriteLine("The name of the channel is {0}.",
serverChannel.ChannelName);
// show the priority of the channel
Console.WriteLine("The priority of the channel is {0}.",
serverChannel.ChannelPriority);
// show the URIs associated with the channel
ChannelDataStore channelData = (ChannelDataStore)serverChannel.ChannelData;
foreach (string uri in channelData.ChannelUris)
{
Console.WriteLine("The channel URI is {0}.", uri);
}
// expose an object for remote calls
RemotingConfiguration.RegisterWellKnownServiceType(
refObject.GetType(), "command", WellKnownObjectMode.Singleton);
RemotingServices.Marshal(refObject, "command");
}
#endregion Methods
}
}
|
mit
|
C#
|
c532d5343760be0d4ba52cf0d34865327a7b9d87
|
Switch to Environment.NewLine
|
AmadeusW/roslyn,heejaechang/roslyn,heejaechang/roslyn,genlu/roslyn,jasonmalinowski/roslyn,jmarolf/roslyn,diryboy/roslyn,ErikSchierboom/roslyn,physhi/roslyn,panopticoncentral/roslyn,davkean/roslyn,aelij/roslyn,physhi/roslyn,panopticoncentral/roslyn,genlu/roslyn,mavasani/roslyn,davkean/roslyn,ErikSchierboom/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,jmarolf/roslyn,diryboy/roslyn,eriawan/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,mavasani/roslyn,aelij/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,sharwell/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,sharwell/roslyn,KirillOsenkov/roslyn,KevinRansom/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,stephentoub/roslyn,mgoertz-msft/roslyn,tmat/roslyn,brettfo/roslyn,wvdd007/roslyn,weltkante/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,KevinRansom/roslyn,jmarolf/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,brettfo/roslyn,aelij/roslyn,physhi/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,tmat/roslyn,panopticoncentral/roslyn,gafter/roslyn,shyamnamboodiripad/roslyn,tannergooding/roslyn,bartdesmet/roslyn,gafter/roslyn,dotnet/roslyn,mgoertz-msft/roslyn,gafter/roslyn,AlekseyTs/roslyn,eriawan/roslyn,KirillOsenkov/roslyn,mgoertz-msft/roslyn,davkean/roslyn,sharwell/roslyn,tmat/roslyn,tannergooding/roslyn,heejaechang/roslyn,mavasani/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn,weltkante/roslyn,eriawan/roslyn,tannergooding/roslyn
|
src/Features/Lsif/Generator/Writing/JsonModeLsifJsonWriter.cs
|
src/Features/Lsif/Generator/Writing/JsonModeLsifJsonWriter.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.IO;
using Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Writing
{
/// <summary>
/// An <see cref="ILsifJsonWriter"/> that writes in <see cref="LsifFormat.Json"/>.
/// </summary>
internal sealed class JsonModeLsifJsonWriter : ILsifJsonWriter, IDisposable
{
private readonly JsonTextWriter _jsonTextWriter;
private readonly JsonSerializer _jsonSerializer;
private readonly object _writeGate = new object();
public JsonModeLsifJsonWriter(TextWriter outputWriter)
{
var settings = new JsonSerializerSettings
{
Formatting = Newtonsoft.Json.Formatting.Indented,
NullValueHandling = NullValueHandling.Ignore,
ContractResolver = new CamelCasePropertyNamesContractResolver(),
TypeNameHandling = TypeNameHandling.None,
Converters = new[] { new LsifConverter() }
};
_jsonSerializer = JsonSerializer.Create(settings);
_jsonTextWriter = new JsonTextWriter(outputWriter);
_jsonTextWriter.WriteStartArray();
}
public void Write(Element element)
{
lock (_writeGate)
{
_jsonSerializer.Serialize(_jsonTextWriter, element);
_jsonTextWriter.WriteWhitespace(Environment.NewLine);
}
}
public void Dispose()
{
_jsonTextWriter.WriteEndArray();
_jsonTextWriter.Close();
}
}
}
|
// 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.IO;
using Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Writing
{
/// <summary>
/// An <see cref="ILsifJsonWriter"/> that writes in <see cref="LsifFormat.Json"/>.
/// </summary>
internal sealed class JsonModeLsifJsonWriter : ILsifJsonWriter, IDisposable
{
private readonly JsonTextWriter _jsonTextWriter;
private readonly JsonSerializer _jsonSerializer;
private readonly object _writeGate = new object();
public JsonModeLsifJsonWriter(TextWriter outputWriter)
{
var settings = new JsonSerializerSettings
{
Formatting = Newtonsoft.Json.Formatting.Indented,
NullValueHandling = NullValueHandling.Ignore,
ContractResolver = new CamelCasePropertyNamesContractResolver(),
TypeNameHandling = TypeNameHandling.None,
Converters = new[] { new LsifConverter() }
};
_jsonSerializer = JsonSerializer.Create(settings);
_jsonTextWriter = new JsonTextWriter(outputWriter);
_jsonTextWriter.WriteStartArray();
}
public void Write(Element element)
{
lock (_writeGate)
{
_jsonSerializer.Serialize(_jsonTextWriter, element);
_jsonTextWriter.WriteWhitespace("\r\n");
}
}
public void Dispose()
{
_jsonTextWriter.WriteEndArray();
_jsonTextWriter.Close();
}
}
}
|
mit
|
C#
|
91ca58037ee8337e43ab906b3a042f575a1271ec
|
bump to 1.15.1
|
Terradue/DotNetOpenSearch
|
Terradue.OpenSearch/Properties/AssemblyInfo.cs
|
Terradue.OpenSearch/Properties/AssemblyInfo.cs
|
/*
* Copyright (C) 2010-2014 Terradue S.r.l.
*
* This file is part of Terradue.OpenSearch.
*
* Foobar is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Terradue.OpenSearch.
* If not, see http://www.gnu.org/licenses/.
*/
/*!
\namespace Terradue.OpenSearch
@{
Terradue.OpenSearch is a .Net library that provides an engine perform OpenSearch query from a class or an URL to multiple and custom types of results
\xrefitem sw_version "Versions" "Software Package Version" 1.15.1
\xrefitem sw_link "Link" "Software Package Link" [DotNetOpenSearch](https://github.com/Terradue/DotNetOpenSearch)
\xrefitem sw_license "License" "Software License" [AGPL](https://github.com/DotNetOpenSearch/Terradue.OpenSearch/blob/master/LICENSE)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication
\ingroup OpenSearch
@}
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.OpenSearch")]
[assembly: AssemblyDescription("Terradue.OpenSearch is a library targeting .NET 4.0 and above that provides an easy way to perform OpenSearch query from a class or an URL to multiple and custom types of results (Atom, Rdf...)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("Terradue.OpenSearch")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyAuthors("Emmanuel Mathot")]
[assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetOpenSearch")]
[assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetOpenSearch/blob/master/LICENSE")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.15.1.*")]
[assembly: AssemblyInformationalVersion("1.15.1")]
|
/*
* Copyright (C) 2010-2014 Terradue S.r.l.
*
* This file is part of Terradue.OpenSearch.
*
* Foobar is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Terradue.OpenSearch.
* If not, see http://www.gnu.org/licenses/.
*/
/*!
\namespace Terradue.OpenSearch
@{
Terradue.OpenSearch is a .Net library that provides an engine perform OpenSearch query from a class or an URL to multiple and custom types of results
\xrefitem sw_version "Versions" "Software Package Version" 1.15
\xrefitem sw_link "Link" "Software Package Link" [DotNetOpenSearch](https://github.com/Terradue/DotNetOpenSearch)
\xrefitem sw_license "License" "Software License" [AGPL](https://github.com/DotNetOpenSearch/Terradue.OpenSearch/blob/master/LICENSE)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication
\ingroup OpenSearch
@}
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.OpenSearch")]
[assembly: AssemblyDescription("Terradue.OpenSearch is a library targeting .NET 4.0 and above that provides an easy way to perform OpenSearch query from a class or an URL to multiple and custom types of results (Atom, Rdf...)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("Terradue.OpenSearch")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyAuthors("Emmanuel Mathot")]
[assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetOpenSearch")]
[assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetOpenSearch/blob/master/LICENSE")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.15.0.*")]
[assembly: AssemblyInformationalVersion("1.15")]
|
agpl-3.0
|
C#
|
5c7e19d344f1da731f739e3f994a02dffa6d217b
|
Update FromCommandExtensions.cs
|
Flepper/flepper,Flepper/flepper
|
Flepper.QueryBuilder/Commands/Extensions/FromCommandExtensions.cs
|
Flepper.QueryBuilder/Commands/Extensions/FromCommandExtensions.cs
|
namespace Flepper.QueryBuilder
{
/// <summary>
/// From Command extensions
/// </summary>
public static class FromCommandExtensions
{
/// <summary>
/// Add Where to query
/// </summary>
/// <param name="fromCommand">From command instance</param>
/// <param name="column">Column name</param>
/// <returns></returns>
public static IWhereFilter Where(this IFromCommand fromCommand, string column)
=> fromCommand.To<WhereFilter>().Where(column);
/// <summary>
/// Add Inner Join to query
/// </summary>
/// <param name="fromCommand">From command instance</param>
/// <param name="table">Table name</param>
/// <returns></returns>
public static IJoin InnerJoin(this IFromCommand fromCommand, string table)
=> fromCommand.To<Join>().InnerJoin(table);
/// <summary>
/// Add Left Join to query
/// </summary>
/// <param name="fromCommand">From command instance</param>
/// <param name="table">Table name</param>
/// <returns></returns>
public static IJoin LeftJoin(this IFromCommand fromCommand, string table)
=> fromCommand.To<Join>().LeftJoin(table);
/// <summary>
/// Add As to query
/// </summary>
/// <param name="fromCommand">From command instance</param>
/// <param name="alias">Table alias</param>
/// <returns></returns>
public static IAliasOperator As(this IFromCommand fromCommand, string alias)
=> fromCommand.To<AliasOperator>().As(alias);
}
}
|
namespace Flepper.QueryBuilder
{
/// <summary>
/// From Command extensions
/// </summary>
public static class FromCommandExtensions
{
/// <summary>
/// Add Where to query
/// </summary>
/// <param name="fromCommand">From command instance</param>
/// <param name="column">Column name</param>
/// <returns></returns>
public static IWhereFilter Where(this IFromCommand fromCommand, string column)
=> fromCommand.To<WhereFilter>().Where(column);
/// <summary>
/// Add Inner Join to query
/// </summary>
/// <param name="fromCommand">From command instance</param>
/// <param name="table">Table name</param>
/// <returns></returns>
public static IJoin InnerJoin(this IFromCommand fromCommand, string table)
=> fromCommand.To<Join>().InnerJoin(table);
/// <summary>
/// Add Inner Join to query
/// </summary>
/// <param name="fromCommand">From command instance</param>
/// <param name="table">Table name</param>
/// <returns></returns>
public static IJoin LeftJoin(this IFromCommand fromCommand, string table)
=> fromCommand.To<Join>().LeftJoin(table);
/// <summary>
/// Add As to query
/// </summary>
/// <param name="fromCommand">From command instance</param>
/// <param name="alias">Table alias</param>
/// <returns></returns>
public static IAliasOperator As(this IFromCommand fromCommand, string alias)
=> fromCommand.To<AliasOperator>().As(alias);
}
}
|
mit
|
C#
|
90e0b3374e2a975e2df4e99cffebb520653d12c9
|
Add `#nullable enable`
|
NeoAdonis/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu-new,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,peppy/osu
|
osu.Game/Rulesets/Edit/BeatmapVerifierContext.cs
|
osu.Game/Rulesets/Edit/BeatmapVerifierContext.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;
#nullable enable
namespace osu.Game.Rulesets.Edit
{
/// <summary>
/// Represents the context provided by the beatmap verifier to the checks it runs.
/// Contains information about what is being checked and how it should be checked.
/// </summary>
public class BeatmapVerifierContext
{
/// <summary>
/// The playable beatmap instance of the current beatmap.
/// </summary>
public readonly IBeatmap Beatmap;
/// <summary>
/// The working beatmap instance of the current beatmap.
/// </summary>
public readonly IWorkingBeatmap WorkingBeatmap;
/// <summary>
/// The difficulty level which the current beatmap is considered to be.
/// </summary>
public DifficultyRating InterpretedDifficulty;
public BeatmapVerifierContext(IBeatmap beatmap, IWorkingBeatmap workingBeatmap, DifficultyRating difficultyRating = DifficultyRating.ExpertPlus)
{
Beatmap = beatmap;
WorkingBeatmap = workingBeatmap;
InterpretedDifficulty = difficultyRating;
}
}
}
|
// 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;
namespace osu.Game.Rulesets.Edit
{
/// <summary>
/// Represents the context provided by the beatmap verifier to the checks it runs.
/// Contains information about what is being checked and how it should be checked.
/// </summary>
public class BeatmapVerifierContext
{
/// <summary>
/// The playable beatmap instance of the current beatmap.
/// </summary>
public readonly IBeatmap Beatmap;
/// <summary>
/// The working beatmap instance of the current beatmap.
/// </summary>
public readonly IWorkingBeatmap WorkingBeatmap;
/// <summary>
/// The difficulty level which the current beatmap is considered to be.
/// </summary>
public DifficultyRating InterpretedDifficulty;
public BeatmapVerifierContext(IBeatmap beatmap, IWorkingBeatmap workingBeatmap, DifficultyRating difficultyRating = DifficultyRating.ExpertPlus)
{
Beatmap = beatmap;
WorkingBeatmap = workingBeatmap;
InterpretedDifficulty = difficultyRating;
}
}
}
|
mit
|
C#
|
e1b32162aabb4e91ac51d87ae9448473dff8d311
|
Fix the CommonAssemblyInfo file so build version substitutions work
|
ravengerUA/serilog-sinks-elasticsearch,mookid8000/serilog-sinks-elasticsearch,tilign/serilog-sinks-elasticsearch,serilog/serilog-sinks-elasticsearch
|
assets/CommonAssemblyInfo.cs
|
assets/CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.1.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
|
using System.Reflection;
[assembly: AssemblyVersion("0.0.0")]
[assembly: AssemblyFileVersion("0..0")]
[assembly: AssemblyInformationalVersion("0.")]
|
apache-2.0
|
C#
|
c5e59a39324a311b560caa1608bd957a5ea8f01a
|
correct grammer
|
wangkanai/Detection
|
src/Responsive.Core/src/ResponsiveOptionsBuilderExtensions.cs
|
src/Responsive.Core/src/ResponsiveOptionsBuilderExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using Wangkanai.Detection;
using Wangkanai.Responsive;
namespace Microsoft.AspNetCore.Builder
{
public static class ResponsiveOptionsBuilderExtensions
{
public static IResponsiveOptionsBuilder MapView(
this IResponsiveOptionsBuilder optionsBuilder,
DeviceType target,
DeviceType prefer)
{
throw new NotImplementedException();
}
[Obsolete]
public static IResponsiveOptionsBuilder DefaultTablet(
this IResponsiveOptionsBuilder optionsBuilder,
DeviceType preferred)
{
throw new NotImplementedException();
}
[Obsolete]
public static IResponsiveOptionsBuilder DefaultMobile(
this IResponsiveOptionsBuilder optionsBuilder,
DeviceType preferred)
{
throw new NotImplementedException();
}
[Obsolete]
public static IResponsiveOptionsBuilder DefaultDesktop(
this IResponsiveOptionsBuilder optionsBuilder,
DeviceType preferred)
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Wangkanai.Detection;
using Wangkanai.Responsive;
namespace Microsoft.AspNetCore.Builder
{
public static class ResponsiveOptionsBuilderExtensions
{
public static IResponsiveOptionsBuilder MapView(
this IResponsiveOptionsBuilder optionsBuilder,
DeviceType target,
DeviceType preferred)
{
throw new NotImplementedException();
}
[Obsolete]
public static IResponsiveOptionsBuilder DefaultTablet(
this IResponsiveOptionsBuilder optionsBuilder,
DeviceType preferred)
{
throw new NotImplementedException();
}
[Obsolete]
public static IResponsiveOptionsBuilder DefaultMobile(
this IResponsiveOptionsBuilder optionsBuilder,
DeviceType preferred)
{
throw new NotImplementedException();
}
[Obsolete]
public static IResponsiveOptionsBuilder DefaultDesktop(
this IResponsiveOptionsBuilder optionsBuilder,
DeviceType preferred)
{
throw new NotImplementedException();
}
}
}
|
apache-2.0
|
C#
|
533e109a267ff4b8be9ace16f116e8c06e502667
|
Update TomaszCielecki.cs
|
stvansolano/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin,MabroukENG/planetxamarin
|
src/Firehose.Web/Authors/TomaszCielecki.cs
|
src/Firehose.Web/Authors/TomaszCielecki.cs
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class TomaszCielecki : IAmAXamarinMVP
{
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://blog.ostebaronen.dk/feeds/posts/default"); }
}
public string FirstName => "Tomasz";
public string LastName => "Cielecki";
public string StateOrRegion => "Copenhagen, Denmark";
public string EmailAddress => "tomasz@ostebaronen.dk";
public string Title => "software engineer";
public Uri WebSite => new Uri("http://blog.ostebaronen.dk");
public string TwitterHandle => "Cheesebaron";
public DateTime FirstAwarded => new DateTime(2015, 1, 1);
public string GravatarHash => "f780d57997526876b0625e517c1e0884";
}
}
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class TomaszCielecki : IAmAXamarinMVP
{
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://blog.ostebaronen.dk/feeds/posts/default"); }
}
public string FirstName => "Tomasz";
public string LastName => "Cielecki";
public string StateOrRegion => "Copenhagen, Denmark";
public string EmailAddress => "tomasz@ostebaronen.dk";
public string Title => "Software Engineer";
public Uri WebSite => new Uri("http://blog.ostebaronen.dk");
public string TwitterHandle => "Cheesebaron";
public DateTime FirstAwarded => new DateTime(2015, 1, 1);
public string GravatarHash => "f780d57997526876b0625e517c1e0884";
}
}
|
mit
|
C#
|
011b14ca5cf162b87fd62ade83706de97b8842ef
|
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
|
caioproiete/Autofac.Wcf,autofac/Autofac.Wcf
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Integration.Wcf")]
[assembly: InternalsVisibleTo("Autofac.Tests.Integration.Wcf, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6")]
[assembly: ComVisible(false)]
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Integration.Wcf")]
[assembly: AssemblyDescription("Autofac WCF Integration")]
[assembly: InternalsVisibleTo("Autofac.Tests.Integration.Wcf, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6")]
[assembly: ComVisible(false)]
|
mit
|
C#
|
671c610ea37990734da8b966e13b4c15d7779933
|
Set version to 1.8.
|
xanotech/.net-XTools
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("XTools: common tools")]
[assembly: AssemblyCompany("Xanotech LLC")]
[assembly: AssemblyCopyright(" 2017 Xanotech LLC")]
[assembly: AssemblyProduct("XTools")]
[assembly: AssemblyFileVersion("1.8")]
[assembly: AssemblyVersion("1.8")]
|
using System.Reflection;
[assembly: AssemblyTitle("XTools: common tools")]
[assembly: AssemblyCompany("Xanotech LLC")]
[assembly: AssemblyCopyright(" 2016 Xanotech LLC")]
[assembly: AssemblyProduct("XTools")]
[assembly: AssemblyFileVersion("1.7")]
[assembly: AssemblyVersion("1.7")]
|
mit
|
C#
|
36e6146c2c18511b22dca4116c21a8693d40b711
|
Use fasterflect to reflect
|
HelloKitty/SceneJect,HelloKitty/SceneJect
|
src/SceneJect.Common/Injection/Injector.cs
|
src/SceneJect.Common/Injection/Injector.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Fasterflect;
namespace SceneJect.Common
{
public class Injector
{
private readonly IResolver resolver;
private readonly Type objectType;
private readonly object objectInstance;
public Injector(object instance, IResolver res)
{
if (instance == null)
throw new ArgumentNullException(nameof(instance), "Cannot inject into a null instance.");
if (res == null)
throw new ArgumentNullException(nameof(res), "Cannot resolve types for injection with a null resolver.");
objectInstance = instance;
objectType = instance.GetType();
resolver = res;
}
public void Inject()
{
try
{
//find fields that request injection
IEnumerable<FieldInfo> fields = objectType.Fields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
.Where(fi => fi.HasAttribute<InjectAttribute>());
foreach (FieldInfo fi in fields)
{
fi.Set(objectInstance, resolver.Resolve(fi.FieldType));
}
//find props that request injection
IEnumerable<PropertyInfo> props = objectType.Properties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
.Where(pi => pi.HasAttribute<InjectAttribute>());
foreach (PropertyInfo pi in props)
{
pi.Set(objectInstance, resolver.Resolve(pi.PropertyType));
}
}
catch (Exception e)
{
throw new Exception("Error: " + e.Message + " failed to inject for " + objectType.ToString() + " on instance: " + objectInstance.ToString(), e);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace SceneJect.Common
{
public class Injector
{
private readonly IResolver resolver;
private readonly Type objectType;
private readonly object objectInstance;
public Injector(object instance, IResolver res)
{
if (instance == null)
throw new ArgumentNullException(nameof(instance), "Cannot inject into a null instance.");
if (res == null)
throw new ArgumentNullException(nameof(res), "Cannot resolve types for injection with a null resolver.");
objectInstance = instance;
objectType = instance.GetType();
resolver = res;
}
public void Inject()
{
try
{
foreach (FieldInfo f in objectType.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public ))
{
if (f.GetCustomAttributes(typeof(InjectAttribute), false).Length > 0) //Means it is targeted by the attribute.
{
f.SetValue(objectInstance, resolver.Resolve(f.FieldType),
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField, null, null);
}
}
foreach (PropertyInfo p in objectType.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
{
if (p.GetCustomAttributes(typeof(InjectAttribute), false).Length > 0)
p.SetValue(objectInstance, resolver.Resolve(p.PropertyType),
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, null, null);
}
}
catch (Exception e)
{
throw new Exception("Error: " + e.Message + " failed to inject for " + objectType.ToString() + " on instance: " + objectInstance.ToString(), e);
}
}
}
}
|
mit
|
C#
|
718f9736f31c26d91d89f69f08d69e32d2f6002c
|
Update CarroDA.cs
|
cayodonatti/TopGearApi
|
TopGearApi.DataAccess/CarroDA.cs
|
TopGearApi.DataAccess/CarroDA.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TopGearApi.Domain.Models;
namespace TopGearApi.DataAccess
{
public class CarroDA : TopGearDA<Carro>
{
public static IEnumerable<Carro> GetByItem(int ItemId)
{
using (var context = GetContext())
{
return context.Set<Carro>().Where(c => c.Itens.Where(i => i.Id == ItemId).FirstOrDefault() != null).ToList();
}
}
public static IEnumerable<Carro> GetDisponiveis()
{
using (var context = GetContext())
{
return context.Set<Carro>()
.Join(context.Set<Locacao>(),
c => c,
l => l.Carro,
(c, l) => new { c, l }).DefaultIfEmpty()
.Where(x => x.l == null || x.l.Finalizada)
.Select(x => x.c).ToList();
}
}
public static IEnumerable<Carro> GetDisponiveisByAgencia(int AgenciaId)
{
using (var context = GetContext())
{
return context.Set<Carro>()
.Join(context.Set<Locacao>(),
c => c,
l => l.Carro,
(c, l) => new { c, l }).DefaultIfEmpty()
.Where(x => x.l == null || x.l.Finalizada)
.Select(x => x.c)
.Where(c => c.AgenciaId == AgenciaId).ToList();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TopGearApi.Domain.Models;
namespace TopGearApi.DataAccess
{
public class CarroDA : TopGearDA<Carro>
{
public IEnumerable<Carro> GetByItem(int ItemId)
{
using (var context = GetContext())
{
return context.Set<Carro>().Where(c => c.Itens.Where(i => i.Id == ItemId).FirstOrDefault() != null).ToList();
}
}
public IEnumerable<Carro> GetDisponiveis()
{
using (var context = GetContext())
{
return context.Set<Carro>()
.Join(context.Set<Locacao>(),
c => c,
l => l.Carro,
(c, l) => new { c, l }).DefaultIfEmpty()
.Where(x => x.l == null || x.l.Finalizada)
.Select(x => x.c).ToList();
}
}
public IEnumerable<Carro> GetDisponiveisByAgencia(int AgenciaId)
{
using (var context = GetContext())
{
return context.Set<Carro>()
.Join(context.Set<Locacao>(),
c => c,
l => l.Carro,
(c, l) => new { c, l }).DefaultIfEmpty()
.Where(x => x.l == null || x.l.Finalizada)
.Select(x => x.c)
.Where(c => c.AgenciaId == AgenciaId).ToList();
}
}
}
}
|
mit
|
C#
|
99aa25e4d8b362fba717753a44686be67548b9ad
|
Add Missing File Header (#1560)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
test/Microsoft.AspNetCore.SignalR.Tests/HttpHeaderEndPoint.cs
|
test/Microsoft.AspNetCore.SignalR.Tests/HttpHeaderEndPoint.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Http.Features;
namespace Microsoft.AspNetCore.SignalR.Tests
{
public class HttpHeaderEndPoint : EndPoint
{
public override async Task OnConnectedAsync(ConnectionContext connection)
{
var result = await connection.Transport.Input.ReadAsync();
var buffer = result.Buffer;
try
{
var headers = connection.Features.Get<IHttpContextFeature>().HttpContext.Request.Headers;
var headerName = Encoding.UTF8.GetString(buffer.ToArray());
var headerValues = headers.FirstOrDefault(h => string.Equals(h.Key, headerName, StringComparison.OrdinalIgnoreCase)).Value.ToArray();
var data = Encoding.UTF8.GetBytes(string.Join(",", headerValues));
await connection.Transport.Output.WriteAsync(data);
}
finally
{
connection.Transport.Input.AdvanceTo(buffer.End);
}
}
}
}
|
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Http.Features;
namespace Microsoft.AspNetCore.SignalR.Tests
{
public class HttpHeaderEndPoint : EndPoint
{
public override async Task OnConnectedAsync(ConnectionContext connection)
{
var result = await connection.Transport.Input.ReadAsync();
var buffer = result.Buffer;
try
{
var headers = connection.Features.Get<IHttpContextFeature>().HttpContext.Request.Headers;
var headerName = Encoding.UTF8.GetString(buffer.ToArray());
var headerValues = headers.FirstOrDefault(h => string.Equals(h.Key, headerName, StringComparison.OrdinalIgnoreCase)).Value.ToArray();
var data = Encoding.UTF8.GetBytes(string.Join(",", headerValues));
await connection.Transport.Output.WriteAsync(data);
}
finally
{
connection.Transport.Input.AdvanceTo(buffer.End);
}
}
}
}
|
apache-2.0
|
C#
|
4e3ca43d7b29e6d81a0700a20a5800f46a7bf3bf
|
Update IMapper.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/IMapper.cs
|
TIKSN.Core/Data/IMapper.cs
|
namespace TIKSN.Data
{
public interface IMapper<TSource, TDestination>
{
TDestination Map(TSource source);
}
}
|
namespace TIKSN.Data
{
public interface IMapper<TSource, TDestination>
{
TDestination Map(TSource source);
}
}
|
mit
|
C#
|
236943314621d1aaffdfca13d69744ed76c0d99b
|
Update CommentsDisqus.cshtml
|
Shazwazza/Articulate,Shazwazza/Articulate,readingdancer/Articulate,readingdancer/Articulate,Shazwazza/Articulate,readingdancer/Articulate
|
src/Articulate.Web/App_Plugins/Articulate/Themes/Material/Views/Partials/CommentsDisqus.cshtml
|
src/Articulate.Web/App_Plugins/Articulate/Themes/Material/Views/Partials/CommentsDisqus.cshtml
|
@model Articulate.Models.PostModel
@if (Model.DisqusShortName.IsNullOrWhiteSpace())
{
<p>
<em>
To enable comments sign up for a <a href="http://disqus.com" target="_blank">Disqus</a> account and
enter your Disqus shortname in the Articulate node settings.
</em>
</p>
}
else
{
<div id="disqus_thread">
<script type="text/javascript">
/** ENTER DISQUS SHORTNAME HERE **/
var disqus_shortname = '@Model.DisqusShortName';
/** DO NOT MODIFY BELOW THIS LINE **/
var disqus_identifier = '@Model.GetKey()';
var disqus_url = '@Model.UrlWithDomain()';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>
Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>
<a href="http://disqus.com" class="dsq-brlink">
comments powered by <span class="logo-disqus">Disqus</span>
</a>
</div>
}
|
@model Articulate.Models.PostModel
@if (Model.DisqusShortName.IsNullOrWhiteSpace())
{
<p>
<em>
To enable comments sign up for a <a href="http://disqus.com" target="_blank">Disqus</a> account and
enter your Disqus shortname in the Articulate node settings.
</em>
</p>
}
else
{
<div id="disqus_thread">
<script type="text/javascript">
/** ENTER DISQUS SHORTNAME HERE **/
var disqus_shortname = '@Model.DisqusShortName';
/** DO NOT MODIFY BELOW THIS LINE **/
var disqus_identifier = '@Model.Id';
var disqus_url = '@Model.UrlWithDomain()';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>
Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>
<a href="http://disqus.com" class="dsq-brlink">
comments powered by <span class="logo-disqus">Disqus</span>
</a>
</div>
}
|
mit
|
C#
|
1c0fb619327c014b92aece84ce1a659450b9c1fa
|
Change WCF timeout from 10 seconds to 2 seconds
|
Livit/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp
|
CefSharp/CefSharpSettings.cs
|
CefSharp/CefSharpSettings.cs
|
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
namespace CefSharp
{
/// <summary>
/// Use this static class to configure some CefSharp specific settings like WcfTimeout
/// </summary>
public static class CefSharpSettings
{
/// <summary>
/// Set default values for CefSharpSettings
/// </summary>
static CefSharpSettings()
{
ShutdownOnExit = true;
WcfTimeout = TimeSpan.FromSeconds(2);
}
/// <summary>
/// WCF is used by JavascriptBinding
/// Disabling effectively disables both of these features.
/// Defaults to true
/// </summary>
public static bool WcfEnabled { get; set; }
/// <summary>
/// Change the Close timeout for the WCF channel used by the sync JSB binding.
/// The default value is currently 2 seconds. Chaning this to <see cref="TimeSpan.Zero"/>
/// will result on Abort() being called on the WCF Channel Host
/// </summary>
public static TimeSpan WcfTimeout { get; set; }
/// <summary>
/// For the WinForms and WPF instances of ChromiumWebBrowser the relevant Application Exit event
/// is hooked and Cef.Shutdown() called by default. Set this to false to disable this behaviour.
/// This value needs to be set before the first instance of ChromiumWebBrowser is created as
/// the event handlers are hooked in the static constructor for the ChromiumWebBrowser class
/// </summary>
public static bool ShutdownOnExit { get; set; }
}
}
|
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
namespace CefSharp
{
/// <summary>
/// Use this static class to configure some CefSharp specific settings like WcfTimeout
/// </summary>
public static class CefSharpSettings
{
/// <summary>
/// Set default values for CefSharpSettings
/// </summary>
static CefSharpSettings()
{
ShutdownOnExit = true;
WcfTimeout = TimeSpan.FromSeconds(10);
}
/// <summary>
/// WCF is used by JavascriptBinding
/// Disabling effectively disables both of these features.
/// Defaults to true
/// </summary>
public static bool WcfEnabled { get; set; }
/// <summary>
/// Change the Close timeout for the WCF channel used by the sync JSB binding.
/// The default value is currently 10 seconds. Chaning this to <see cref="TimeSpan.Zero"/>
/// will result on Abort() being called on the WCF Channel Host
/// </summary>
public static TimeSpan WcfTimeout { get; set; }
/// <summary>
/// For the WinForms and WPF instances of ChromiumWebBrowser the relevant Application Exit event
/// is hooked and Cef.Shutdown() called by default. Set this to false to disable this behaviour.
/// This value needs to be set before the first instance of ChromiumWebBrowser is created as
/// the event handlers are hooked in the static constructor for the ChromiumWebBrowser class
/// </summary>
public static bool ShutdownOnExit { get; set; }
}
}
|
bsd-3-clause
|
C#
|
a8f4a22692e8566491584113474a0df3880eea73
|
Apply .EnsureTrailingSlash() to base URI
|
1and1/TypedRest-DotNet,TypedRest/TypedRest-DotNet,TypedRest/TypedRest-DotNet,1and1/TypedRest-DotNet
|
TypedRest/EntryEndpoint.cs
|
TypedRest/EntryEndpoint.cs
|
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace TypedRest
{
/// <summary>
/// Entry point to a REST interface. Derive from this class and add your own set of child-<see cref="IEndpoint"/>s as properties.
/// </summary>
public class EntryEndpoint : EndpointBase
{
/// <summary>
/// Creates a new REST interface.
/// </summary>
/// <param name="uri">The base URI of the REST interface. Missing trailing slash will be appended automatically.</param>
/// <param name="credentials">The credentials used to authenticate against the REST interface. Can be <c>null</c> for no authentication.</param>
public EntryEndpoint(Uri uri, ICredentials credentials = null)
: base(BuildHttpClient(credentials), uri.EnsureTrailingSlash())
{
}
private static HttpClient BuildHttpClient(ICredentials credentials)
{
return new HttpClient((credentials == null)
? new HttpClientHandler()
: new HttpClientHandler {PreAuthenticate = true, Credentials = credentials});
}
/// <summary>
/// Fetches meta data such as links from the server.
/// </summary>
/// <exception cref="UnauthorizedAccessException"><see cref="HttpStatusCode.Unauthorized"/> or <see cref="HttpStatusCode.Forbidden"/></exception>
/// <exception cref="KeyNotFoundException"><see cref="HttpStatusCode.NotFound"/> or <see cref="HttpStatusCode.Gone"/></exception>
/// <exception cref="HttpRequestException">Other non-success status code.</exception>
public Task ReadMetaAsync(CancellationToken cancellationToken = default(CancellationToken))
{
return HandleResponseAsync(HttpClient.GetAsync(Uri, cancellationToken));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace TypedRest
{
/// <summary>
/// Entry point to a REST interface. Derive from this class and add your own set of child-<see cref="IEndpoint"/>s as properties.
/// </summary>
public class EntryEndpoint : EndpointBase
{
/// <summary>
/// Creates a new REST interface.
/// </summary>
/// <param name="uri">The base URI of the REST interface. Missing trailing slash will be appended automatically.</param>
/// <param name="credentials">The credentials used to authenticate against the REST interface. Can be <c>null</c> for no authentication.</param>
public EntryEndpoint(Uri uri, ICredentials credentials = null)
: base(BuildHttpClient(credentials), uri)
{
}
private static HttpClient BuildHttpClient(ICredentials credentials)
{
return new HttpClient((credentials == null)
? new HttpClientHandler()
: new HttpClientHandler {PreAuthenticate = true, Credentials = credentials});
}
/// <summary>
/// Fetches meta data such as links from the server.
/// </summary>
/// <exception cref="UnauthorizedAccessException"><see cref="HttpStatusCode.Unauthorized"/> or <see cref="HttpStatusCode.Forbidden"/></exception>
/// <exception cref="KeyNotFoundException"><see cref="HttpStatusCode.NotFound"/> or <see cref="HttpStatusCode.Gone"/></exception>
/// <exception cref="HttpRequestException">Other non-success status code.</exception>
public Task ReadMetaAsync(CancellationToken cancellationToken = default(CancellationToken))
{
return HandleResponseAsync(HttpClient.GetAsync(Uri, cancellationToken));
}
}
}
|
mit
|
C#
|
5444a7bfe230ae9d8707f426fe563940f1cb16ff
|
add <br> to match the delete view
|
SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery
|
AstroPhotoGallery/AstroPhotoGallery/Views/Category/Edit.cshtml
|
AstroPhotoGallery/AstroPhotoGallery/Views/Category/Edit.cshtml
|
@model AstroPhotoGallery.Models.Category
@{
ViewBag.Title = "Admin - edit category";
}
<div class="container">
<div class="well">
<h2>@ViewBag.Title</h2>
<br />
<h3 style="color: #e74c3c; text-align: center">
Are you sure you want to edit the below category's name?
<br/>
<br/>
All pictures in that category will be edited too. This can take much time and resources, depending on their count.
</h3>
<br/>
@using (Html.BeginForm("Edit", "Category", FormMethod.Post, new {@class = "form-horizontal"}))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary("", new {@class = "text-danger"})
<div class="form-group">
@Html.LabelFor(m => m.Name, new {@class = "control-label col-sm-4"})
<div class="col-sm-4">
@Html.TextBoxFor(m => m.Name, new {@class = "form-control"})
</div>
</div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-4">
<input type="submit" value="Edit" class="btn btn-success"/>
@Html.ActionLink("Cancel", "Index", "Category", new {@class = "btn btn-default"})
</div>
</div>
}
</div>
</div>
|
@model AstroPhotoGallery.Models.Category
@{
ViewBag.Title = "Admin - edit category";
}
<div class="container">
<div class="well">
<h2>@ViewBag.Title</h2>
<h3 style="color: #e74c3c; text-align: center">
Are you sure you want to edit the below category's name?
<br/>
<br/>
All pictures in that category will be edited too. This can take much time and resources, depending on their count.
</h3>
<br/>
@using (Html.BeginForm("Edit", "Category", FormMethod.Post, new {@class = "form-horizontal"}))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary("", new {@class = "text-danger"})
<div class="form-group">
@Html.LabelFor(m => m.Name, new {@class = "control-label col-sm-4"})
<div class="col-sm-4">
@Html.TextBoxFor(m => m.Name, new {@class = "form-control"})
</div>
</div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-4">
<input type="submit" value="Edit" class="btn btn-success"/>
@Html.ActionLink("Cancel", "Index", "Category", new {@class = "btn btn-default"})
</div>
</div>
}
</div>
</div>
|
mit
|
C#
|
fb354ed1cc3dcefca803843882a087cb3417012e
|
remove other languages
|
DotNetRu/App,DotNetRu/App
|
DotNetRu.Android/Localize.cs
|
DotNetRu.Android/Localize.cs
|
using System.Globalization;
using System.Threading;
using Android.Content;
using Xamarin.Forms;
using XamarinEvolve.Clients.Portable.Helpers;
using XamarinEvolve.Clients.Portable.Interfaces;
[assembly: Dependency(typeof(DotNetRu.Droid.Localize))]
namespace DotNetRu.Droid
{
public class Localize : ILocalize
{
public void SetLocale(CultureInfo ci)
{
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
}
public CultureInfo GetCurrentCultureInfo()
{
var androidLocale = Java.Util.Locale.Default;
var language = (androidLocale.ToString().ToLower().Contains("ru"))? "ru" : "en";
return new CultureInfo(language);
}
}
}
|
using System.Globalization;
using System.Threading;
using Android.Content;
using Xamarin.Forms;
using XamarinEvolve.Clients.Portable.Helpers;
using XamarinEvolve.Clients.Portable.Interfaces;
[assembly: Dependency(typeof(DotNetRu.Droid.Localize))]
namespace DotNetRu.Droid
{
public class Localize : ILocalize
{
public void SetLocale(CultureInfo ci)
{
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
}
public CultureInfo GetCurrentCultureInfo()
{
var netLanguage = "en";
var androidLocale = Java.Util.Locale.Default;
netLanguage = AndroidToDotnetLanguage(androidLocale.ToString().Replace("_", "-"));
// this gets called a lot - try/catch can be expensive so consider caching or something
System.Globalization.CultureInfo ci = null;
try
{
ci = new System.Globalization.CultureInfo(netLanguage);
}
catch (CultureNotFoundException e1)
{
// iOS locale not valid .NET culture (eg. "en-ES" : English in Spain)
// fallback to first characters, in this case "en"
try
{
var fallback = ToDotnetFallbackLanguage(new PlatformCulture(netLanguage));
ci = new System.Globalization.CultureInfo(fallback);
}
catch (CultureNotFoundException e2)
{
// iOS language not valid .NET culture, falling back to English
ci = new System.Globalization.CultureInfo("en");
}
}
return ci;
}
string AndroidToDotnetLanguage(string androidLanguage)
{
var netLanguage = androidLanguage;
//certain languages need to be converted to CultureInfo equivalent
switch (androidLanguage)
{
case "ms-BN": // "Malaysian (Brunei)" not supported .NET culture
case "ms-MY": // "Malaysian (Malaysia)" not supported .NET culture
case "ms-SG": // "Malaysian (Singapore)" not supported .NET culture
netLanguage = "ms"; // closest supported
break;
case "in-ID": // "Indonesian (Indonesia)" has different code in .NET
netLanguage = "id-ID"; // correct code for .NET
break;
case "gsw-CH": // "Schwiizertüütsch (Swiss German)" not supported .NET culture
netLanguage = "de-CH"; // closest supported
break;
// add more application-specific cases here (if required)
// ONLY use cultures that have been tested and known to work
}
return netLanguage;
}
string ToDotnetFallbackLanguage(PlatformCulture platCulture)
{
var netLanguage = platCulture.LanguageCode; // use the first part of the identifier (two chars, usually);
switch (platCulture.LanguageCode)
{
case "gsw":
netLanguage = "de-CH"; // equivalent to German (Switzerland) for this app
break;
// add more application-specific cases here (if required)
// ONLY use cultures that have been tested and known to work
}
return netLanguage;
}
}
}
|
mit
|
C#
|
c04156deb01e0f3b1306e8b3cac152670f94dc86
|
Initialize CommandException with a message
|
appharbor/appharbor-cli
|
src/AppHarbor/CommandException.cs
|
src/AppHarbor/CommandException.cs
|
using System;
namespace AppHarbor
{
public class CommandException : Exception
{
public CommandException(string message)
: base(message)
{
}
}
}
|
using System;
namespace AppHarbor
{
public class CommandException : Exception
{
}
}
|
mit
|
C#
|
4fb93463f5d493c8c5939006ff4763026972c960
|
Add data contract attributes to ComparisionReport.cs
|
Ackara/Daterpillar
|
src/Daterpillar.Core/Compare/ComparisonReport.cs
|
src/Daterpillar.Core/Compare/ComparisonReport.cs
|
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Gigobyte.Daterpillar.Compare
{
[DataContract]
public class ComparisonReport : IEnumerable<Discrepancy>
{
public Counter Counters;
[DataMember]
public Outcome Summary { get; set; }
[DataMember]
public IList<Discrepancy> Discrepancies { get; set; }
public IEnumerator<Discrepancy> GetEnumerator()
{
foreach (var item in Discrepancies) { yield return item; }
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public struct Counter
{
public int SourceTables;
public int DestTables;
}
}
}
|
using System.Collections.Generic;
namespace Gigobyte.Daterpillar.Compare
{
public class ComparisonReport
{
public Counter Counters;
public Outcome Summary { get; set; }
public IList<Discrepancy> Discrepancies { get; set; }
public struct Counter
{
public int SourceTables;
public int DestTables;
}
}
}
|
mit
|
C#
|
44fce6beef95d7c5034aadb9cec261578a56c4f0
|
Remove unused Seq.Deconstruct
|
linqpadless/LinqPadless,linqpadless/LinqPadless
|
src/Seq.cs
|
src/Seq.cs
|
#region Copyright (c) 2016 Atif Aziz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
namespace LinqPadless
{
using System.Collections.Generic;
using System.Linq;
static partial class Seq
{
public static IEnumerable<T> Return<T>(params T[] items) => items;
public static IEnumerable<string> NonBlanks(this IEnumerable<string> source) =>
from s in source
where !string.IsNullOrEmpty(s)
select s;
}
}
|
#region Copyright (c) 2016 Atif Aziz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
namespace LinqPadless
{
using System.Collections.Generic;
using System.Linq;
static partial class Seq
{
public static IEnumerable<T> Return<T>(params T[] items) => items;
static void Read<T>(ref IEnumerator<T> e, out T item)
{
if (e != null && e.MoveNext())
{
item = e.Current;
}
else
{
if (e != null)
{
e.Dispose();
e = null;
}
item = default;
}
}
public static void Deconstruct<T>(this IEnumerable<T> source, out T item1, out T item2)
{
using (var e = source.GetEnumerator())
{
var ee = e;
Read(ref ee, out item1);
Read(ref ee, out item2);
}
}
public static IEnumerable<string> NonBlanks(this IEnumerable<string> source) =>
from s in source
where !string.IsNullOrEmpty(s)
select s;
}
}
|
apache-2.0
|
C#
|
4a8b4afcefff5ebb76f9ae137a1d8b07cf91b401
|
Clean up. Interview time.
|
fffej/codekatas,fffej/codekatas,fffej/codekatas
|
MineField/MineSweeperTest.cs
|
MineField/MineSweeperTest.cs
|
using NUnit.Framework;
using FluentAssertions;
namespace Fatvat.Katas.MineSweeper
{
[TestFixture]
public class MineSweeperTest
{
}
}
|
using NUnit.Framework;
using FluentAssertions;
namespace Fatvat.Katas.MineSweeper
{
[TestFixture]
public class MineSweeperTest
{
[Test]
public void EmptyMineField()
{
var mineField = new MineField(".");
Assert.That(mineField.Show(), Is.EqualTo("0"));
}
[Test]
public void OneMine()
{
var mineField = new MineField("*");
Assert.That(mineField.Show(), Is.EqualTo("*"));
}
[Test]
public void OneLine()
{
var mineField = new MineField(".*.");
Assert.That(mineField.Show(), Is.EqualTo("1*1"));
}
[Test]
public void EmptyMineFieldWithTwoRows()
{
var mineField = new MineField("...\n...");
Assert.That(mineField.Show(), Is.EqualTo("000\n000"));
}
[Test]
public void MineFieldWithTwoRows()
{
var mineField = new MineField(".*.\n*..");
Assert.That(mineField.Show(), Is.EqualTo("2*1\n*21"));
}
}
public class MineField
{
private readonly string[] m_MineField;
public MineField(string mineField)
{
m_MineField = mineField.Split('\n');
}
public string Show()
{
var result = "";
for (var line = 0; line < m_MineField.Length; ++line)
{
for (var column = 0; column < m_MineField[line].Length; ++column)
{
var surroundingMines = GetNumberOfSurroundingMines(line, column);
if (!IsMine(line, column))
{
result += surroundingMines;
}
else
{
result += '*';
}
}
result += "\n";
}
return result.TrimEnd();
}
private int GetNumberOfSurroundingMines(int line, int column)
{
int surroundingMines = 0;
for (var dx = -1; dx <= 1; dx++)
{
for (var dy = -1; dy <= 1; dy++)
{
if (dx == 0 && dy == 0)
{
continue;
}
if (IsMine(line + dx, column + dy))
{
surroundingMines++;
}
}
}
return surroundingMines;
}
private bool IsMine(int line, int index)
{
bool isInBounds = line >= 0 && line < m_MineField.Length &&
index >= 0 && index < m_MineField[line].Length;
return isInBounds && m_MineField[line][index] == '*';
}
}
}
|
mit
|
C#
|
57ce3918e934a5e6b2b39e09806363eaec1a5e76
|
add swap methods
|
pashchuk/Numerical-methods,pashchuk/Numerical-methods
|
CSharp/lab1/Matrix.cs
|
CSharp/lab1/Matrix.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace lab1
{
public class Matrix<T> where T : struct
{
#region Fields
private T[,] _matrix;
#endregion
#region Properties
public T this[int row, int column]
{
get { return _matrix[row, column]; }
set { _matrix[row, column] = value; }
}
public int Rows { get { return _matrix.GetLength(0); } }
public int Columns { get { return _matrix.GetLength(1); } }
#endregion
#region Costructors
public Matrix(int rows, int columns)
{
_matrix = new T[rows, columns];
}
public Matrix(int size) : this(size, size) { }
#endregion
#region private Methods
#endregion
#region public Methods
public void SwapRows(int row1, int row2)
{
T tempvariable;
for (int i = 0; i < Columns; i++)
{
tempvariable = _matrix[row1, i];
_matrix[row1, i] = _matrix[row2, i];
_matrix[row2, i] = tempvariable;
}
}
public void SwapColumns(int column1, int column2)
{
T tempvariable;
for (int i = 0; i < Rows; i++)
{
tempvariable = _matrix[i, column1];
_matrix[i, column1] = _matrix[i, column2];
_matrix[i, column2] = tempvariable;
}
}
#endregion
#region Events
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace lab1
{
public class Matrix<T> where T : struct
{
#region Fields
private T[,] _matrix;
#endregion
#region Properties
public T this[int row, int column]
{
get { return _matrix[row, column]; }
set { _matrix[row, column] = value; }
}
#endregion
#region Costructors
public Matrix(int rows, int columns)
{
_matrix = new T[rows, columns];
}
public Matrix(int size) : this(size, size) { }
#endregion
#region private Methods
#endregion
#region public Methods
#endregion
#region Events
#endregion
}
}
|
mit
|
C#
|
369dab053edf4a003fdf84cf17fbd5e5b0f9c505
|
fix book link
|
tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web
|
src/Tugberk.Web/Views/Shared/RightSection.cshtml
|
src/Tugberk.Web/Views/Shared/RightSection.cshtml
|
<div class="right-side-holder">
<div class="row">
<div class="col">
<iframe style="width: 120px; height: 240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//ws-eu.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=GB&source=ss&ref=as_ss_li_til&ad_type=product_link&tracking_id=tugugusblo-21&language=en_GB&marketplace=amazon®ion=GB&placement=B00J5T2EHE&asins=B00J5T2EHE&linkId=eea48b381f9572452f3780de89f06276&show_border=true&link_opens_in_new_window=true"></iframe>
</div>
</div>
<div class="row">
<div class="col">
<a href="https://mvp.microsoft.com/en-us/PublicProfile/4039968?fullName=ali%20tugberk%20ugurlu" target="_blank">
<img src="/images/mvp-logo-blue-sharp.gif" alt="Tugberk Ugurlu, ASP.NET MVP" />
</a>
</div>
</div>
<div class="row">
<div class="col">
<a href="https://stackexchange.com/users/211547" target="_blank">
<img src="https://stackexchange.com/users/flair/211547.png" width="208" height="58" alt="profile for tugberk on Stack Exchange, a network of free, community-driven Q&A sites" title="profile for tugberk on Stack Exchange, a network of free, community-driven Q&A sites">
</a>
</div>
</div>
<div class="row">
<div class="col">
<ul class="badge-list">
<li><a class="btn btn-info" href="https://twitter.com/tourismgeek" target="_blank"><i class="fa fa-twitter fa-lg"></i></a></li>
<li><a class="btn btn-info" href="https://www.linkedin.com/in/tugberk" target="_blank"><i class="fa fa-linkedin fa-lg"></i></a></li>
<li><a class="btn btn-info" href="https://github.com/tugberkugurlu" target="_blank"><i class="fa fa-github fa-lg"></i></a></li>
<li><a class="btn btn-info" href="https://stackoverflow.com/users/463785/tugberk" target="_blank"><i class="fa fa-stack-exchange fa-lg"></i></a></li>
</ul>
</div>
</div>
</div>
|
<div class="right-side-holder">
<div class="row">
<div class="col">
<iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ss&ref=ss_til&ad_type=product_link&tracking_id=tugsblo0c-20&marketplace=amazon®ion=US&placement=B00ACC69WO&asins=B00ACC69WO&linkId=JF65RPOVCRB7XJUS&show_border=true&link_opens_in_new_window=true"></iframe>
</div>
</div>
<div class="row">
<div class="col">
<a href="https://mvp.microsoft.com/en-us/PublicProfile/4039968?fullName=ali%20tugberk%20ugurlu" target="_blank">
<img src="/images/mvp-logo-blue-sharp.gif" alt="Tugberk Ugurlu, ASP.NET MVP" />
</a>
</div>
</div>
<div class="row">
<div class="col">
<a href="https://stackexchange.com/users/211547" target="_blank">
<img src="https://stackexchange.com/users/flair/211547.png" width="208" height="58" alt="profile for tugberk on Stack Exchange, a network of free, community-driven Q&A sites" title="profile for tugberk on Stack Exchange, a network of free, community-driven Q&A sites">
</a>
</div>
</div>
<div class="row">
<div class="col">
<ul class="badge-list">
<li><a class="btn btn-info" href="https://twitter.com/tourismgeek" target="_blank"><i class="fa fa-twitter fa-lg"></i></a></li>
<li><a class="btn btn-info" href="https://www.linkedin.com/in/tugberk" target="_blank"><i class="fa fa-linkedin fa-lg"></i></a></li>
<li><a class="btn btn-info" href="https://github.com/tugberkugurlu" target="_blank"><i class="fa fa-github fa-lg"></i></a></li>
<li><a class="btn btn-info" href="https://stackoverflow.com/users/463785/tugberk" target="_blank"><i class="fa fa-stack-exchange fa-lg"></i></a></li>
</ul>
</div>
</div>
</div>
|
agpl-3.0
|
C#
|
ee5c0b3aa70c5c210210033f19338292575fdb6b
|
Update Copyright
|
kgybels/git-tfs,pmiossec/git-tfs,git-tfs/git-tfs,guyboltonking/git-tfs,steveandpeggyb/Public,modulexcite/git-tfs,vzabavnov/git-tfs,WolfVR/git-tfs,andyrooger/git-tfs,adbre/git-tfs,steveandpeggyb/Public,guyboltonking/git-tfs,jeremy-sylvis-tmg/git-tfs,WolfVR/git-tfs,codemerlin/git-tfs,WolfVR/git-tfs,kgybels/git-tfs,NathanLBCooper/git-tfs,codemerlin/git-tfs,adbre/git-tfs,bleissem/git-tfs,kgybels/git-tfs,codemerlin/git-tfs,modulexcite/git-tfs,steveandpeggyb/Public,bleissem/git-tfs,jeremy-sylvis-tmg/git-tfs,NathanLBCooper/git-tfs,adbre/git-tfs,modulexcite/git-tfs,guyboltonking/git-tfs,NathanLBCooper/git-tfs,bleissem/git-tfs,jeremy-sylvis-tmg/git-tfs,PKRoma/git-tfs
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("SEP")]
[assembly: AssemblyProduct("GitTfs")]
[assembly: AssemblyCopyright("Copyright © 2009-2015")]
[assembly: AssemblyVersion(GitTfsProperties.Version)]
[assembly: AssemblyFileVersion(GitTfsProperties.Version)]
|
using System.Reflection;
[assembly: AssemblyCompany("SEP")]
[assembly: AssemblyProduct("GitTfs")]
[assembly: AssemblyCopyright("Copyright © 2009-2010")]
[assembly: AssemblyVersion(GitTfsProperties.Version)]
[assembly: AssemblyFileVersion(GitTfsProperties.Version)]
|
apache-2.0
|
C#
|
b91ac895b6866cc33f79fc47c06042a0c81d8a36
|
Make TimeZoneDemo work when running in different cultures
|
malcolmr/nodatime,malcolmr/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,nodatime/nodatime,BenJenkinson/nodatime,nodatime/nodatime,malcolmr/nodatime
|
src/NodaTime.Demo/TimeZoneDemo.cs
|
src/NodaTime.Demo/TimeZoneDemo.cs
|
// Copyright 2010 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using NodaTime.TimeZones;
using NUnit.Framework;
using System.Globalization;
namespace NodaTime.Demo
{
public class TimeZoneDemo
{
[Test]
public void EarlyParis()
{
// Yes, in 1900 Paris did (according to TZDB) have a UTC offset of 9 minutes, 21 seconds.
DateTimeZone paris = DateTimeZoneProviders.Tzdb["Europe/Paris"];
Offset offset = Snippet.For(paris.GetUtcOffset(Instant.FromUtc(1900, 1, 1, 0, 0)));
Assert.AreEqual("+00:09:21", offset.ToString("G", CultureInfo.InvariantCulture));
}
[Test]
public void BritishDoubleSummerTime()
{
DateTimeZone london = DateTimeZoneProviders.Tzdb["Europe/London"];
Offset offset = london.GetUtcOffset(Instant.FromUtc(1942, 7, 1, 0, 0));
Assert.AreEqual("+02", offset.ToString());
}
[Test]
public void ZoneInterval()
{
DateTimeZone london = DateTimeZoneProviders.Tzdb["Europe/London"];
ZoneInterval interval = Snippet.For(london.GetZoneInterval(Instant.FromUtc(2010, 6, 19, 0, 0)));
Assert.AreEqual("BST", interval.Name);
Assert.AreEqual(Instant.FromUtc(2010, 3, 28, 1, 0), interval.Start);
Assert.AreEqual(Instant.FromUtc(2010, 10, 31, 1, 0), interval.End);
Assert.AreEqual(Offset.FromHours(1), interval.WallOffset);
Assert.AreEqual(Offset.FromHours(1), interval.Savings);
}
}
}
|
// Copyright 2010 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using NUnit.Framework;
using NodaTime.TimeZones;
namespace NodaTime.Demo
{
public class TimeZoneDemo
{
[Test]
public void EarlyParis()
{
// Yes, in 1900 Paris did (according to TZDB) have a UTC offset of 9 minutes, 21 seconds.
DateTimeZone paris = DateTimeZoneProviders.Tzdb["Europe/Paris"];
Offset offset = Snippet.For(paris.GetUtcOffset(Instant.FromUtc(1900, 1, 1, 0, 0)));
Assert.AreEqual("+00:09:21", offset.ToString());
}
[Test]
public void BritishDoubleSummerTime()
{
DateTimeZone london = DateTimeZoneProviders.Tzdb["Europe/London"];
Offset offset = london.GetUtcOffset(Instant.FromUtc(1942, 7, 1, 0, 0));
Assert.AreEqual("+02", offset.ToString());
}
[Test]
public void ZoneInterval()
{
DateTimeZone london = DateTimeZoneProviders.Tzdb["Europe/London"];
ZoneInterval interval = Snippet.For(london.GetZoneInterval(Instant.FromUtc(2010, 6, 19, 0, 0)));
Assert.AreEqual("BST", interval.Name);
Assert.AreEqual(Instant.FromUtc(2010, 3, 28, 1, 0), interval.Start);
Assert.AreEqual(Instant.FromUtc(2010, 10, 31, 1, 0), interval.End);
Assert.AreEqual(Offset.FromHours(1), interval.WallOffset);
Assert.AreEqual(Offset.FromHours(1), interval.Savings);
}
}
}
|
apache-2.0
|
C#
|
d46ea35a81e3a0ff02253140515b7eed8eb8fa9d
|
Add comment
|
sharwell/roslyn,AmadeusW/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,physhi/roslyn,weltkante/roslyn,diryboy/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,AmadeusW/roslyn,bartdesmet/roslyn,wvdd007/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,sharwell/roslyn,mavasani/roslyn,mavasani/roslyn,sharwell/roslyn,eriawan/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,eriawan/roslyn,mavasani/roslyn,KevinRansom/roslyn,physhi/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn
|
src/VisualStudio/Core/Def/Implementation/ProjectSystem/CPS/IWorkspaceProjectContextFactory.cs
|
src/VisualStudio/Core/Def/Implementation/ProjectSystem/CPS/IWorkspaceProjectContextFactory.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.
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.LanguageServices.ProjectSystem
{
/// <summary>
/// Factory to create a project context for a new Workspace project that can be initialized on a background thread.
/// </summary>
internal interface IWorkspaceProjectContextFactory
{
/// <inheritdoc cref="CreateProjectContextAsync"/>
[Obsolete("Use CreateProjectContextAsync instead")]
IWorkspaceProjectContext CreateProjectContext(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath);
/// <summary>
/// Creates and initializes a new Workspace project and returns a <see
/// cref="IWorkspaceProjectContext"/> to lazily initialize the properties and items for the
/// project. This method guarantees that either the project is added (and the returned task
/// completes) or cancellation is observed and no project is added.
/// </summary>
/// <param name="languageName">Project language.</param>
/// <param name="projectUniqueName">Unique name for the project.</param>
/// <param name="projectFilePath">Full path to the project file for the project.</param>
/// <param name="projectGuid">Project guid.</param>
/// <param name="hierarchy">Obsolete. The argument is ignored.</param>
/// <param name="binOutputPath">Initial project binary output path.</param>
Task<IWorkspaceProjectContext> CreateProjectContextAsync(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath, CancellationToken cancellationToken);
}
}
|
// 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.
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.LanguageServices.ProjectSystem
{
/// <summary>
/// Factory to create a project context for a new Workspace project that can be initialized on a background thread.
/// </summary>
internal interface IWorkspaceProjectContextFactory
{
/// <inheritdoc cref="CreateProjectContextAsync"/>
[Obsolete("Use CreateProjectContextAsync instead")]
IWorkspaceProjectContext CreateProjectContext(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath);
/// <summary>
/// Creates and initializes a new Workspace project and returns a <see cref="IWorkspaceProjectContext"/> to
/// lazily initialize the properties and items for the project. Cancellation is supported and will not leave
/// the workspace in a partially completed state.
/// </summary>
/// <param name="languageName">Project language.</param>
/// <param name="projectUniqueName">Unique name for the project.</param>
/// <param name="projectFilePath">Full path to the project file for the project.</param>
/// <param name="projectGuid">Project guid.</param>
/// <param name="hierarchy">Obsolete. The argument is ignored.</param>
/// <param name="binOutputPath">Initial project binary output path.</param>
Task<IWorkspaceProjectContext> CreateProjectContextAsync(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath, CancellationToken cancellationToken);
}
}
|
mit
|
C#
|
baa555f769d7cbfd7b0d95f7bf80282ffb8669f0
|
Update Constants.cs
|
nProdanov/Team-French-75
|
TravelAgency/TravelAgency.Common/Constants.cs
|
TravelAgency/TravelAgency.Common/Constants.cs
|
namespace TravelAgency.Common
{
public class Constants
{
public const string MongoDbConnectionString = "mongodb://localhost";
public const string MongoDbDatabaseName = "travelagency";
public const string MongoDbCollectionName = "touroperators";
public const string MySQLConnectionString = "server=localhost;database=travelagency;uid=root;pwd=1234;";
public const string GeneratedReportsPath = "../../../../Generated-Reports/";
}
}
|
namespace TravelAgency.Common
{
public class Constants
{
public const string MongoDbConnectionString = "mongodb://localhost";
public const string MongoDbDatabaseName = "travelagency";
public const string MongoDbCollectionName = "touroperators";
public const string MySQLConnectionString = "server=localhost;database=travelagency;uid=root;pwd=Botev_1912;";
public const string GeneratedReportsPath = "../../../../Generated-Reports/";
}
}
|
mit
|
C#
|
1ec732611de9d891b8896f3fca8defdfe8c9107e
|
fix for child compress
|
BlarghLabs/MoarUtils
|
filters/Compress.cs
|
filters/Compress.cs
|
using System.IO.Compression;
using System.Web.Mvc;
namespace MoarUtils.filters {
public class Compress : ActionFilterAttribute {
public override void OnActionExecuting(ActionExecutingContext filterContext) {
//http://stackoverflow.com/questions/15067049/asp-net-mvc-response-filter-is-null-when-using-actionfilterattribute-in-regist
if (filterContext.IsChildAction) return;
var encodingsAccepted = filterContext.HttpContext.Request.Headers["Accept-Encoding"];
if (string.IsNullOrEmpty(encodingsAccepted)) return;
encodingsAccepted = encodingsAccepted.ToLowerInvariant();
var response = filterContext.HttpContext.Response;
if (encodingsAccepted.Contains("deflate")) {
response.AppendHeader("Content-encoding", "deflate");
response.Filter = new DeflateStream(response.Filter, CompressionMode.Compress);
} else if (encodingsAccepted.Contains("gzip")) {
response.AppendHeader("Content-encoding", "gzip");
response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
}
}
}
}
|
using System.IO.Compression;
using System.Web.Mvc;
namespace MoarUtils.filters {
public class Compress : ActionFilterAttribute {
public override void OnActionExecuting(ActionExecutingContext filterContext) {
var encodingsAccepted = filterContext.HttpContext.Request.Headers["Accept-Encoding"];
if (string.IsNullOrEmpty(encodingsAccepted)) return;
encodingsAccepted = encodingsAccepted.ToLowerInvariant();
var response = filterContext.HttpContext.Response;
if (encodingsAccepted.Contains("deflate")) {
response.AppendHeader("Content-encoding", "deflate");
response.Filter = new DeflateStream(response.Filter, CompressionMode.Compress);
} else if (encodingsAccepted.Contains("gzip")) {
response.AppendHeader("Content-encoding", "gzip");
response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
}
}
}
}
|
mit
|
C#
|
451207c6a8c522461c8d253fa5a8abc62b8c81ee
|
Fix metaData JSON property name case.
|
peeedge/mobile,eatskolnikov/mobile,ZhangLeiCharles/mobile,eatskolnikov/mobile,peeedge/mobile,eatskolnikov/mobile,masterrr/mobile,ZhangLeiCharles/mobile,masterrr/mobile
|
Phoebe/Bugsnag/Data/Event.cs
|
Phoebe/Bugsnag/Data/Event.cs
|
using System;
using Newtonsoft.Json;
using Toggl.Phoebe.Bugsnag.Json;
using System.Collections.Generic;
namespace Toggl.Phoebe.Bugsnag.Data
{
[JsonObject (MemberSerialization.OptIn)]
public class Event
{
[JsonProperty ("user", DefaultValueHandling = DefaultValueHandling.Ignore)]
public UserInfo User { get; set; }
[JsonProperty ("app")]
public ApplicationInfo App { get; set; }
[JsonProperty ("appState", DefaultValueHandling = DefaultValueHandling.Ignore)]
public ApplicationState AppState { get; set; }
[JsonProperty ("device", DefaultValueHandling = DefaultValueHandling.Ignore)]
public SystemInfo System { get; set; }
[JsonProperty ("deviceState", DefaultValueHandling = DefaultValueHandling.Ignore)]
public SystemState SystemState { get; set; }
[JsonProperty ("context")]
public string Context { get; set; }
[JsonProperty ("severity"), JsonConverter (typeof(ErrorSeverityConverter))]
public ErrorSeverity Severity { get; set; }
[JsonProperty ("exceptions")]
public List<ExceptionInfo> Exceptions { get; set; }
[JsonProperty ("metaData")]
public Metadata Metadata { get; set; }
}
}
|
using System;
using Newtonsoft.Json;
using Toggl.Phoebe.Bugsnag.Json;
using System.Collections.Generic;
namespace Toggl.Phoebe.Bugsnag.Data
{
[JsonObject (MemberSerialization.OptIn)]
public class Event
{
[JsonProperty ("user", DefaultValueHandling = DefaultValueHandling.Ignore)]
public UserInfo User { get; set; }
[JsonProperty ("app")]
public ApplicationInfo App { get; set; }
[JsonProperty ("appState", DefaultValueHandling = DefaultValueHandling.Ignore)]
public ApplicationState AppState { get; set; }
[JsonProperty ("device", DefaultValueHandling = DefaultValueHandling.Ignore)]
public SystemInfo System { get; set; }
[JsonProperty ("deviceState", DefaultValueHandling = DefaultValueHandling.Ignore)]
public SystemState SystemState { get; set; }
[JsonProperty ("context")]
public string Context { get; set; }
[JsonProperty ("severity"), JsonConverter (typeof(ErrorSeverityConverter))]
public ErrorSeverity Severity { get; set; }
[JsonProperty ("exceptions")]
public List<ExceptionInfo> Exceptions { get; set; }
[JsonProperty ("metadata")]
public Metadata Metadata { get; set; }
}
}
|
bsd-3-clause
|
C#
|
a287f61d603917662c0d5a74ad9ea020f878ef13
|
Add static fonts folder to UIConventions (#17)
|
bwatts/Totem,bwatts/Totem
|
Source/Totem.Web/WebUIApp.cs
|
Source/Totem.Web/WebUIApp.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Nancy;
using Nancy.Conventions;
namespace Totem.Web
{
/// <summary>
/// An HTTP-bound API serving a user interface
/// </summary>
public abstract class WebUIApp : WebApiApp, IRootPathProvider
{
protected WebUIApp(WebUIContext context) : base(context)
{}
public new WebUIContext Context => (WebUIContext) base.Context;
protected override IRootPathProvider RootPathProvider => this;
public string GetRootPath() => Context.ContentFolder.ToString();
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
base.ConfigureConventions(nancyConventions);
new UIConventions(this, nancyConventions).Configure();
}
private sealed class UIConventions
{
private readonly WebUIApp _app;
private readonly NancyConventions _conventions;
internal UIConventions(WebUIApp app, NancyConventions conventions)
{
_app = app;
_conventions = conventions;
}
internal void Configure()
{
LocateViews();
CoerceAcceptHeaders();
ServeStaticContent();
}
private void LocateViews()
{
_conventions.ViewLocationConventions.Clear();
_conventions.ViewLocationConventions.Add((viewName, model, context) =>
{
return "dist/" + viewName;
});
}
private void CoerceAcceptHeaders()
{
_conventions.AcceptHeaderCoercionConventions.Add((acceptHeaders, context) =>
{
return new[]
{
Tuple.Create("application/json", 1m),
Tuple.Create("text/html", 0.9m),
Tuple.Create("*/*", 0.8m)
};
});
}
private void ServeStaticContent()
{
_conventions.StaticContentsConventions.Clear();
ServeStaticContent("images");
ServeStaticContent("css", "dist/css");
ServeStaticContent("js", "dist/js");
ServeStaticContent("fonts", "dist/fonts");
}
private void ServeStaticContent(string requestedPath, string contentPath = null)
{
_conventions
.StaticContentsConventions
.Add(StaticContentConventionBuilder.AddDirectory(requestedPath, contentPath));
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Nancy;
using Nancy.Conventions;
namespace Totem.Web
{
/// <summary>
/// An HTTP-bound API serving a user interface
/// </summary>
public abstract class WebUIApp : WebApiApp, IRootPathProvider
{
protected WebUIApp(WebUIContext context) : base(context)
{}
public new WebUIContext Context => (WebUIContext) base.Context;
protected override IRootPathProvider RootPathProvider => this;
public string GetRootPath() => Context.ContentFolder.ToString();
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
base.ConfigureConventions(nancyConventions);
new UIConventions(this, nancyConventions).Configure();
}
private sealed class UIConventions
{
private readonly WebUIApp _app;
private readonly NancyConventions _conventions;
internal UIConventions(WebUIApp app, NancyConventions conventions)
{
_app = app;
_conventions = conventions;
}
internal void Configure()
{
LocateViews();
CoerceAcceptHeaders();
ServeStaticContent();
}
private void LocateViews()
{
_conventions.ViewLocationConventions.Clear();
_conventions.ViewLocationConventions.Add((viewName, model, context) =>
{
return "dist/" + viewName;
});
}
private void CoerceAcceptHeaders()
{
_conventions.AcceptHeaderCoercionConventions.Add((acceptHeaders, context) =>
{
return new[]
{
Tuple.Create("application/json", 1m),
Tuple.Create("text/html", 0.9m),
Tuple.Create("*/*", 0.8m)
};
});
}
private void ServeStaticContent()
{
_conventions.StaticContentsConventions.Clear();
ServeStaticContent("images");
ServeStaticContent("css", "dist/css");
ServeStaticContent("js", "dist/js");
}
private void ServeStaticContent(string requestedPath, string contentPath = null)
{
_conventions
.StaticContentsConventions
.Add(StaticContentConventionBuilder.AddDirectory(requestedPath, contentPath));
}
}
}
}
|
mit
|
C#
|
c7c7c00c412f5590644eeafebd9ac19fe26bec58
|
Add tests around ordering of public enum values
|
noobot/SlackConnector
|
tests/SlackConnector.Tests.Unit/Models/MessageSubTypeEnumTests.cs
|
tests/SlackConnector.Tests.Unit/Models/MessageSubTypeEnumTests.cs
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Shouldly;
using SlackConnector.Connections.Sockets.Messages.Inbound;
using SlackConnector.Models;
using Xunit;
namespace SlackConnector.Tests.Unit.Models
{
public class MessageSubTypeEnumTests
{
[Fact]
public void should_have_same_number_of_enum_values_as_internal_enum_type()
{
// given
int numberOfInternalEnumNames = Enum.GetNames(typeof(MessageSubType)).Length;
int numberOfPublicEnumNames = Enum.GetNames(typeof(SlackMessageSubType)).Length;
// then
numberOfPublicEnumNames.ShouldBe(numberOfInternalEnumNames);
}
[Fact]
public void should_have_same_message_types_as_internal_models()
{
// given
var internalEnumNames = Enum.GetNames(typeof(MessageSubType))
.Select(x => x.Replace("_", string.Empty))
.Select(x => x.ToLower());
var publicEnumNames = Enum.GetNames(typeof(SlackMessageSubType))
.Select(x => x.ToLower());
// then
publicEnumNames.All(x => internalEnumNames.Contains(x)).ShouldBeTrue();
}
[Fact]
public void should_have_same_message_type_values_as_internal_models()
{
// given
var internalEnumValues = GetEnumValues<MessageSubType>();
var publicEnumValues = GetEnumValues<SlackMessageSubType>();
// then
foreach (var publicEnumName in publicEnumValues.Keys)
{
publicEnumValues[publicEnumName].ShouldBe(internalEnumValues[publicEnumName]);
}
}
private static Dictionary<string, int> GetEnumValues<T>() where T : struct, IConvertible
{
var internalEnumNames = Enum.GetNames(typeof(T));
var vals = new Dictionary<string, int>();
foreach (var enumName in internalEnumNames)
{
T thingy;
Enum.TryParse(enumName, out thingy);
var name = enumName
.Replace("_", string.Empty)
.ToLower();
vals.Add(name, thingy.ToInt32(new NumberFormatInfo()));
}
return vals;
}
}
}
|
using System;
using System.Linq;
using Shouldly;
using SlackConnector.Connections.Sockets.Messages.Inbound;
using SlackConnector.Models;
using Xunit;
namespace SlackConnector.Tests.Unit.Models
{
public class MessageSubTypeEnumTests
{
[Fact]
public void should_have_same_number_of_enum_values_as_internal_enum_type()
{
// given
int numberOfInternalEnumValues = Enum.GetNames(typeof(MessageSubType)).Length;
int numberOfPublicEnumValues = Enum.GetNames(typeof(SlackMessageSubType)).Length;
// then
numberOfPublicEnumValues.ShouldBe(numberOfInternalEnumValues);
}
[Fact]
public void should_have_same_message_types_as_internal_model()
{
// given
var internalEnumValues = Enum.GetNames(typeof(MessageSubType))
.Select(x => x.Replace("_", string.Empty))
.Select(x => x.ToLower());
var publicEnumValues = Enum.GetNames(typeof(SlackMessageSubType))
.Select(x => x.ToLower());
// then
publicEnumValues.All(x => internalEnumValues.Contains(x)).ShouldBeTrue();
}
}
}
|
mit
|
C#
|
676473da784dc942b33b9455e21fa111f3840232
|
Resolve #AG169 - Fix URL encoding for labels
|
csf-dev/agiil,csf-dev/agiil,csf-dev/agiil,csf-dev/agiil
|
Agiil.Web.Models/Labels/LabelDto.cs
|
Agiil.Web.Models/Labels/LabelDto.cs
|
using System;
using System.Web;
namespace Agiil.Web.Models.Labels
{
public class LabelDto
{
public string Name { get; set; }
public string UrlEncodedName
{
get {
if(Name == null) return null;
// #AG169 - UrlEncode is replacing spaces with plus characters,
// but that's only good for query strings, not path strings.
return HttpUtility.UrlEncode(Name).Replace("+", "%20");
}
}
}
}
|
using System;
using System.Web;
namespace Agiil.Web.Models.Labels
{
public class LabelDto
{
public string Name { get; set; }
public string UrlEncodedName => HttpUtility.UrlEncode(Name);
}
}
|
mit
|
C#
|
300b311a3f644ed654b8c2bc751646d1a96af69a
|
Fix namespace
|
antony-liu/npoi,tonyqus/npoi
|
testcases/main/SS/Format/TestCellFormatResult.cs
|
testcases/main/SS/Format/TestCellFormatResult.cs
|
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for Additional information regarding copyright ownership.
The ASF licenses this file to You 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.
==================================================================== */
namespace NPOI.SS.Format
{
using NPOI.SS.Format;
using NUnit.Framework;
using System;
using System.Drawing;
[TestFixture]
public class TestCellFormatResult
{
[Test]
public void TestNullTextRaisesException()
{
try
{
bool applies = true;
String text = null;
Color textColor = Color.Black;
CellFormatResult result = new CellFormatResult(applies, text, textColor);
Assert.Fail("Cannot Initialize CellFormatResult with null text parameter");
}
catch (ArgumentException e)
{
//Expected
}
}
}
}
|
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for Additional information regarding copyright ownership.
The ASF licenses this file to You 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.
==================================================================== */
namespace NPOI.SS.format
{
using NPOI.SS.Format;
using NUnit.Framework;
using System;
using System.Drawing;
[TestFixture]
public class TestCellFormatResult
{
[Test]
public void TestNullTextRaisesException()
{
try
{
bool applies = true;
String text = null;
Color textColor = Color.Black;
CellFormatResult result = new CellFormatResult(applies, text, textColor);
Assert.Fail("Cannot Initialize CellFormatResult with null text parameter");
}
catch (ArgumentException e)
{
//Expected
}
}
}
}
|
apache-2.0
|
C#
|
0980cbca4d3d883b87420df97ab4ad4d6124fee5
|
fix for CorrectAi
|
kmarcell/ELTE-2015-Component-Team4
|
ArtificialIntelligence/CorrectAi.cs
|
ArtificialIntelligence/CorrectAi.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GTInterfacesLibrary;
namespace ArtificialIntelligence
{
using TaskReturnType = GTGameSpaceInterface<GTGameSpaceElementInterface, IPosition>;
public class CorrectAi : GTArtificialIntelligenceInterface<GTGameSpaceElementInterface, IPosition>, IGTArtificialIntelligenceInterface
{
async public Task<GTGameSpaceInterface<GTGameSpaceElementInterface, IPosition>>
calculateNextStep(TaskReturnType gameSpace,
GTGameStateGeneratorInterface<GTGameSpaceElementInterface, IPosition> generator,
GTGameStateHashInterface<GTGameSpaceElementInterface, IPosition> hash)
{
TaskReturnType best= null;
int bestValue = int.MinValue;
GTPlayerInterface<GTGameSpaceElementInterface, IPosition> actualPlayer = gameSpace.getNextPlayer();
Task<List<TaskReturnType>> listTask = generator.availableStatesFrom(gameSpace, gameSpace.getNextPlayer());
await listTask;
List<GTGameSpaceInterface<GTGameSpaceElementInterface, IPosition>> states = listTask.Result;
foreach (TaskReturnType item in states)
{
int current = hash.evaluateState(item, actualPlayer);
if (current > bestValue)
{
best = item;
bestValue = current;
}
}
return best;
}
public string Name
{
get { return "CorrectAi"; }
}
public string Description
{
get { return "A decent AI without any foresight"; }
}
public Difficulty Difficulty
{
get { return Difficulty.Normal; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GTInterfacesLibrary;
namespace ArtificialIntelligence
{
using TaskReturnType = GTGameSpaceInterface<GTGameSpaceElementInterface, IPosition>;
public class CorrectAi : GTArtificialIntelligenceInterface<GTGameSpaceElementInterface, IPosition>, IGTArtificialIntelligenceInterface
{
async public Task<GTGameSpaceInterface<GTGameSpaceElementInterface, IPosition>>
calculateNextStep(TaskReturnType gameSpace,
GTGameStateGeneratorInterface<GTGameSpaceElementInterface, IPosition> generator,
GTGameStateHashInterface<GTGameSpaceElementInterface, IPosition> hash)
{
TaskReturnType best= null;
int bestValue = int.MinValue;
Task<List<TaskReturnType>> listTask = generator.availableStatesFrom(gameSpace, gameSpace.getNextPlayer());
await listTask;
List<GTGameSpaceInterface<GTGameSpaceElementInterface, IPosition>> states = listTask.Result;
foreach (TaskReturnType item in states)
{
int current = hash.evaluateState(item, item.getNextPlayer());
if (current > bestValue)
{
best = item;
bestValue = current;
}
}
return best;
}
public string Name
{
get { return "CorrectAi"; }
}
public string Description
{
get { return "A decent AI without any foresight"; }
}
public Difficulty Difficulty
{
get { return Difficulty.Normal; }
}
}
}
|
mit
|
C#
|
28cc613515a420008dbb6c7c201b7820f3f83654
|
Update ILandscapeFactory.cs
|
LANDIS-II-Foundation/Landis-Spatial-Modeling-Library
|
src/api/ILandscapeFactory.cs
|
src/api/ILandscapeFactory.cs
|
// Contributors:
// James Domingo, Green Code LLC
namespace Landis.SpatialModeling
{
/// <summary>
/// A factory that produces data structures for landscapes.
/// </summary>
public interface ILandscapeFactory
{
/// <summary>
/// Creates a new landscape using an input grid of active sites.
/// </summary>
/// <param name="activeSites">
/// A grid that indicates which sites are active.
/// </param>
ILandscape CreateLandscape(IInputGrid<bool> activeSites);
//---------------------------------------------------------------------
/// <summary>
/// Creates a new landscape using an indexable grid of active sites.
/// </summary>
/// <param name="activeSites">
/// A grid that indicates which sites are active.
/// </param>
ILandscape CreateLandscape(IIndexableGrid<bool> activeSites);
}
}
|
// Copyright 2012 Green Code LLC
// All rights reserved.
//
// The copyright holders license this file under the New (3-clause) BSD
// License (the "License"). You may not use this file except in
// compliance with the License. A copy of the License is available at
//
// http://www.opensource.org/licenses/BSD-3-Clause
//
// and is included in the NOTICE.txt file distributed with this work.
//
// Contributors:
// James Domingo, Green Code LLC
namespace Landis.SpatialModeling
{
/// <summary>
/// A factory that produces data structures for landscapes.
/// </summary>
public interface ILandscapeFactory
{
/// <summary>
/// Creates a new landscape using an input grid of active sites.
/// </summary>
/// <param name="activeSites">
/// A grid that indicates which sites are active.
/// </param>
ILandscape CreateLandscape(IInputGrid<bool> activeSites);
//---------------------------------------------------------------------
/// <summary>
/// Creates a new landscape using an indexable grid of active sites.
/// </summary>
/// <param name="activeSites">
/// A grid that indicates which sites are active.
/// </param>
ILandscape CreateLandscape(IIndexableGrid<bool> activeSites);
}
}
|
apache-2.0
|
C#
|
5bd7913cfb6f187ac2df29d3cab7cc178aa245da
|
Make sure MercuryId do not get serialized.
|
gOOvaUY/Plexo.Models,gOOvaUY/Goova.Plexo.Models
|
Currency.cs
|
Currency.cs
|
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Plexo
{
[DataContract]
public class Currency
{
[DataMember]
public int CurrencyId { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public string Plural { get; set; }
[DataMember]
public string Symbol { get; set; }
//Mercury Id is for internal use, no serialization required
[JsonIgnore]
public int MercuryId { get; set; }
}
}
|
using System.Runtime.Serialization;
namespace Plexo
{
[DataContract]
public class Currency
{
[DataMember]
public int CurrencyId { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public string Plural { get; set; }
[DataMember]
public string Symbol { get; set; }
//Mercury Id is for internal use, no serialization required
public int MercuryId { get; set; }
}
}
|
agpl-3.0
|
C#
|
7b7c129c25268a3dfc5c735c9652184a1b95cb10
|
Remove empty navigation list in anydiff module (invalid HTML).
|
pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac
|
templates/anydiff.cs
|
templates/anydiff.cs
|
<?cs include "header.cs"?>
<div id="ctxtnav" class="nav"></div>
<div id="content" class="changeset">
<div id="title">
<h1>Select Base and Target for Diff:</h1>
</div>
<div id="anydiff">
<form action="<?cs var:anydiff.changeset_href ?>" method="get">
<table>
<tr>
<th><label for="old_path">From:</label></th>
<td>
<input type="text" id="old_path" name="old_path" value="<?cs
var:anydiff.old_path ?>" size="44" />
<label for="old_rev">at Revision:</label>
<input type="text" id="old_rev" name="old" value="<?cs
var:anydiff.old_rev ?>" size="4" />
</td>
</tr>
<tr>
<th><label for="new_path">To:</label></th>
<td>
<input type="text" id="new_path" name="new_path" value="<?cs
var:anydiff.new_path ?>" size="44" />
<label for="new_rev">at Revision:</label>
<input type="text" id="new_rev" name="new" value="<?cs
var:anydiff.new_rev ?>" size="4" />
</td>
</tr>
</table>
<div class="buttons">
<input type="submit" value="View changes" />
</div>
</form>
</div>
<div id="help">
<strong>Note:</strong> See <a href="<?cs var:trac.href.wiki
?>/TracChangeset#ExaminingArbitraryDifferences">TracChangeset</a> for help on using the arbitrary diff feature.
</div>
</div>
<?cs include "footer.cs"?>
|
<?cs include "header.cs"?>
<div id="ctxtnav" class="nav">
<h2>Navigation</h2><?cs
with:links = chrome.links ?>
<ul>
</ul><?cs
/with ?>
</div>
<div id="content" class="changeset">
<div id="title">
<h1>Select Base and Target for Diff:</h1>
</div>
<div id="anydiff">
<form action="<?cs var:anydiff.changeset_href ?>" method="get">
<table>
<tr>
<th><label for="old_path">From:</label></th>
<td>
<input type="text" id="old_path" name="old_path" value="<?cs
var:anydiff.old_path ?>" size="44" />
<label for="old_rev">at Revision:</label>
<input type="text" id="old_rev" name="old" value="<?cs
var:anydiff.old_rev ?>" size="4" />
</td>
</tr>
<tr>
<th><label for="new_path">To:</label></th>
<td>
<input type="text" id="new_path" name="new_path" value="<?cs
var:anydiff.new_path ?>" size="44" />
<label for="new_rev">at Revision:</label>
<input type="text" id="new_rev" name="new" value="<?cs
var:anydiff.new_rev ?>" size="4" />
</td>
</tr>
</table>
<div class="buttons">
<input type="submit" value="View changes" />
</div>
</form>
</div>
<div id="help">
<strong>Note:</strong> See <a href="<?cs var:trac.href.wiki
?>/TracChangeset#ExaminingArbitraryDifferences">TracChangeset</a> for help on using the arbitrary diff feature.
</div>
</div>
<?cs include "footer.cs"?>
|
bsd-3-clause
|
C#
|
e7664911fe097fb7b8565432b4a88c2d95420596
|
Use a different name for driver options in CleanUnitPass so it does not hide an inherited name.
|
nalkaro/CppSharp,mono/CppSharp,zillemarco/CppSharp,zillemarco/CppSharp,ddobrev/CppSharp,imazen/CppSharp,imazen/CppSharp,nalkaro/CppSharp,txdv/CppSharp,zillemarco/CppSharp,u255436/CppSharp,inordertotest/CppSharp,zillemarco/CppSharp,mono/CppSharp,txdv/CppSharp,xistoso/CppSharp,nalkaro/CppSharp,mohtamohit/CppSharp,txdv/CppSharp,mohtamohit/CppSharp,ddobrev/CppSharp,Samana/CppSharp,zillemarco/CppSharp,u255436/CppSharp,SonyaSa/CppSharp,genuinelucifer/CppSharp,ktopouzi/CppSharp,Samana/CppSharp,ktopouzi/CppSharp,mohtamohit/CppSharp,mydogisbox/CppSharp,mydogisbox/CppSharp,xistoso/CppSharp,txdv/CppSharp,Samana/CppSharp,genuinelucifer/CppSharp,u255436/CppSharp,inordertotest/CppSharp,ktopouzi/CppSharp,SonyaSa/CppSharp,SonyaSa/CppSharp,genuinelucifer/CppSharp,mohtamohit/CppSharp,ddobrev/CppSharp,inordertotest/CppSharp,KonajuGames/CppSharp,mono/CppSharp,mohtamohit/CppSharp,ktopouzi/CppSharp,KonajuGames/CppSharp,imazen/CppSharp,ktopouzi/CppSharp,KonajuGames/CppSharp,nalkaro/CppSharp,nalkaro/CppSharp,imazen/CppSharp,mydogisbox/CppSharp,xistoso/CppSharp,ddobrev/CppSharp,imazen/CppSharp,xistoso/CppSharp,genuinelucifer/CppSharp,SonyaSa/CppSharp,mono/CppSharp,ddobrev/CppSharp,mydogisbox/CppSharp,mono/CppSharp,inordertotest/CppSharp,u255436/CppSharp,KonajuGames/CppSharp,SonyaSa/CppSharp,genuinelucifer/CppSharp,mydogisbox/CppSharp,u255436/CppSharp,xistoso/CppSharp,mono/CppSharp,KonajuGames/CppSharp,Samana/CppSharp,Samana/CppSharp,txdv/CppSharp,inordertotest/CppSharp
|
src/Generator/Passes/CleanUnitPass.cs
|
src/Generator/Passes/CleanUnitPass.cs
|
namespace Cxxi.Passes
{
public class CleanUnitPass : TranslationUnitPass
{
public DriverOptions DriverOptions;
public PassBuilder Passes;
public CleanUnitPass(DriverOptions options)
{
DriverOptions = options;
}
public override bool VisitTranslationUnit(TranslationUnit unit)
{
// Try to get an include path that works from the original include
// directories paths.
unit.IncludePath = GetIncludePath(unit.FilePath);
return true;
}
string GetIncludePath(string filePath)
{
var includePath = filePath;
var shortestIncludePath = filePath;
foreach (var path in DriverOptions.IncludeDirs)
{
int idx = filePath.IndexOf(path, System.StringComparison.Ordinal);
if (idx == -1) continue;
string inc = filePath.Substring(path.Length);
if (inc.Length < includePath.Length && inc.Length < shortestIncludePath.Length)
shortestIncludePath = inc;
}
return DriverOptions.IncludePrefix
+ shortestIncludePath.TrimStart(new char[] { '\\', '/' });
}
}
public static class CleanUnitPassExtensions
{
public static void CleanUnit(this PassBuilder builder, DriverOptions options)
{
var pass = new CleanUnitPass(options);
builder.AddPass(pass);
}
}
}
|
namespace Cxxi.Passes
{
public class CleanUnitPass : TranslationUnitPass
{
public DriverOptions Options;
public PassBuilder Passes;
public CleanUnitPass(DriverOptions options)
{
Options = options;
}
public override bool VisitTranslationUnit(TranslationUnit unit)
{
// Try to get an include path that works from the original include
// directories paths.
unit.IncludePath = GetIncludePath(unit.FilePath);
return true;
}
string GetIncludePath(string filePath)
{
var includePath = filePath;
var shortestIncludePath = filePath;
foreach (var path in Options.IncludeDirs)
{
int idx = filePath.IndexOf(path, System.StringComparison.Ordinal);
if (idx == -1) continue;
string inc = filePath.Substring(path.Length);
if (inc.Length < includePath.Length && inc.Length < shortestIncludePath.Length)
shortestIncludePath = inc;
}
return Options.IncludePrefix + shortestIncludePath.TrimStart(new char[] { '\\', '/' });
}
}
public static class CleanUnitPassExtensions
{
public static void CleanUnit(this PassBuilder builder, DriverOptions options)
{
var pass = new CleanUnitPass(options);
builder.AddPass(pass);
}
}
}
|
mit
|
C#
|
1124dc90b88909a761640e9134db77e7abf7291f
|
use async name convention for Notes class
|
bartsaintgermain/SharpAgileCRM
|
AgileAPI/Notes.cs
|
AgileAPI/Notes.cs
|
// <copyright file="Notes.cs" company="Quamotion">
// Copyright (c) Quamotion. All rights reserved.
// </copyright>
namespace AgileAPI
{
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using AgileAPI.Models;
using Newtonsoft.Json;
/// <summary>
/// This class provides support to handle with notes in the <c>CRM</c>
/// </summary>
public class Notes
{
/// <summary>
/// Creates a note in the <c>CRM</c>
/// </summary>
/// <param name="crm">
/// The <see cref="AgileCRM"/> instance to be used.
/// </param>
/// <param name="subject">
/// The subject of the note.
/// </param>
/// <param name="description">
/// The description of the note.
/// </param>
/// <param name="contactIds">
/// The related contact identifiers.
/// </param>
/// <returns>
/// The created note
/// </returns>
public static async Task<Note> CreateContactNoteAsync(AgileCRM crm, string subject, string description, List<long> contactIds)
{
var createNoteRequest = new CreateNoteRequest()
{
Subject = subject,
Description = description,
ContactIds = contactIds,
};
var response = await crm.RequestAsync($"notes", HttpMethod.Post, null).ConfigureAwait(false);
return JsonConvert.DeserializeObject<Note>(response);
}
/// <summary>
/// Get all notes related to a contact.
/// </summary>
/// <param name="crm">
/// The <see cref="AgileCRM"/> instance to be used.
/// </param>
/// <param name="contactId">
/// The contact identifier for which to retrieve the note.
/// </param>
/// <returns>
/// The notes related to a contact.
/// </returns>
public static async Task<List<Note>> GetContactNotesAsync(AgileCRM crm, long contactId)
{
var response = await crm.RequestAsync($"contacts/{contactId}/notes", HttpMethod.Get, null).ConfigureAwait(false);
return JsonConvert.DeserializeObject<List<Note>>(response);
}
}
}
|
// <copyright file="Notes.cs" company="Quamotion">
// Copyright (c) Quamotion. All rights reserved.
// </copyright>
namespace AgileAPI
{
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using AgileAPI.Models;
using Newtonsoft.Json;
/// <summary>
/// This class provides support to handle with notes in the <c>CRM</c>
/// </summary>
public class Notes
{
/// <summary>
/// Creates a note in the <c>CRM</c>
/// </summary>
/// <param name="crm">
/// The <see cref="AgileCRM"/> instance to be used.
/// </param>
/// <param name="subject">
/// The subject of the note.
/// </param>
/// <param name="description">
/// The description of the note.
/// </param>
/// <param name="contactIds">
/// The related contact identifiers.
/// </param>
/// <returns>
/// The created note
/// </returns>
public static async Task<Note> CreateContactNote(AgileCRM crm, string subject, string description, List<long> contactIds)
{
var createNoteRequest = new CreateNoteRequest()
{
Subject = subject,
Description = description,
ContactIds = contactIds,
};
var response = await crm.RequestAsync($"notes", HttpMethod.Post, null).ConfigureAwait(false);
return JsonConvert.DeserializeObject<Note>(response);
}
/// <summary>
/// Get all notes related to a contact.
/// </summary>
/// <param name="crm">
/// The <see cref="AgileCRM"/> instance to be used.
/// </param>
/// <param name="contactId">
/// The contact identifier for which to retrieve the note.
/// </param>
/// <returns>
/// The notes related to a contact.
/// </returns>
public static async Task<List<Note>> GetContactNotes(AgileCRM crm, long contactId)
{
var response = await crm.RequestAsync($"contacts/{contactId}/notes", HttpMethod.Get, null).ConfigureAwait(false);
return JsonConvert.DeserializeObject<List<Note>>(response);
}
}
}
|
mit
|
C#
|
922ef365b0df8de1cc3084ad953472288145158f
|
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 close ssh tunnels on program exit
// TODO panel for quick reset, edit filters similar to EMS manager. Appers under table.
// 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 close ssh tunnels on program exit
// TODO panel for quick reset, edit filters similar to EMS manager. Appers under table.
// 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
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
}
}
|
mit
|
C#
|
d69e94740867b96d92548e4cfdade0f9d644d52d
|
add whitespaces
|
1MiKHalyCH1/tasks
|
Eval/EvalProgram.cs
|
Eval/EvalProgram.cs
|
using System;
using ExpressionEvaluator;
namespace EvalTask
{
class EvalProgram
{
static void Main(string[] args)
{
//string input = Console.In.ReadToEnd();
string input = Console.ReadLine();
input = input.Replace("-", " - ");
var expresion = new CompiledExpression(input);
var output = expresion.Eval();
Console.WriteLine(output);
}
}
}
|
using System;
using ExpressionEvaluator;
namespace EvalTask
{
class EvalProgram
{
static void Main(string[] args)
{
string input = Console.In.ReadToEnd();
// string input = Console.ReadLine();
var expresion = new CompiledExpression(input);
var output = expresion.Eval();
Console.WriteLine(output);
}
}
}
|
mit
|
C#
|
1096539ff789bf0b18e2bcc257aab5b54b110c08
|
Revert "cosmetic"
|
stormsw/ladm.rrr
|
Example1/Program.cs
|
Example1/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ladm.DataModel;
namespace Example1
{
class Program
{
static void Main(string[] args)
{
using (var ctx = new Ladm.DataModel.LadmDbContext())
{
Transaction transaction = new Transaction() { TransactionNumber = "TRN-0001", TransactionType = new TransactionMetaData() { Code="TRN" } };
ctx.Transactions.Add(transaction);
ctx.SaveChanges();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ladm.DataModel;
namespace Example1
{
class Program
{
static void Main(string[] args)
{
using (var context = new Ladm.DataModel.LadmDbContext())
{
Transaction transaction = new Transaction() { TransactionNumber = "TRN-0001", TransactionType = new TransactionMetaData() { Code="TRN" } };
context.Transactions.Add(transaction);
context.SaveChanges();
}
}
}
}
|
mit
|
C#
|
91b78710f8760d64ba50e2e9bfccaf9fff4f551d
|
Fix some tests that were failing on Linux
|
andrew-polk/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,JohnThomson/BloomDesktop,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop,andrew-polk/BloomDesktop,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,JohnThomson/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,andrew-polk/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork,gmartin7/myBloomFork
|
src/BloomTests/Book/TestBook.cs
|
src/BloomTests/Book/TestBook.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Bloom;
using Bloom.Book;
using Bloom.Collection;
using Bloom.Edit;
using BloomTemp;
using SIL.IO;
namespace BloomTests.Book
{
/// <summary>
/// This class supports book tests that need real books. A temporary folder is created and hangs around as long as this
/// TestBook class exists. This should be considered a work-in-progress, I just built as much as I needed for
/// one test. It might be useful to enhance it with more default state for the book (e.g., images) or static
/// create methods with various arguments. Could even be worth implementing a fluent language
/// so you can do something like TestBook.CreateBook().WithStyles(...).WithImage(name, content).WithContent(...).Book.
/// </summary>
public class TestBook : IDisposable
{
private TemporaryFolder _folder;
public Bloom.Book.Book Book;
public string BookFolder;
public string BookPath;
public TestBook(string testName, string content)
{
_folder = new TemporaryFolder(testName);
BookFolder = _folder.FolderPath;
BookPath = Path.Combine(_folder.FolderPath, testName + ".htm");
File.WriteAllText(BookPath, content);
var settings = CreateDefaultCollectionsSettings();
var codeBaseDir = BloomFileLocator.GetCodeBaseFolder();
// This is minimal...if the content doesn't specify xmatter Bloom defaults to Traditional
// and needs the file locator to know this folder so it can find it.
// May later need to include more folders or allow the individual tests to do so.
var locator = new FileLocator(new string[] { codeBaseDir + "/../browser/templates/xMatter"});
var storage = new BookStorage(BookFolder, locator, new BookRenamedEvent(), settings);
// very minimal...enhance if we need to test something that can really find source collections.
var templatefinder = new SourceCollectionsList();
Book = new Bloom.Book.Book(new BookInfo(BookFolder, true), storage, templatefinder, settings, new PageSelection(), new PageListChangedEvent(), new BookRefreshEvent() );
}
protected CollectionSettings CreateDefaultCollectionsSettings()
{
return new CollectionSettings(new NewCollectionSettings() { PathToSettingsFile = CollectionSettings.GetPathForNewSettings(BookFolder, "test"), Language1Iso639Code = "xyz", Language2Iso639Code = "en", Language3Iso639Code = "fr" });
}
// Since this is just for testing I didn't bother with the usual mess to catch/cleanup
// if someone forgets to dispose.
public void Dispose()
{
_folder.Dispose();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Bloom;
using Bloom.Book;
using Bloom.Collection;
using Bloom.Edit;
using BloomTemp;
using SIL.IO;
namespace BloomTests.Book
{
/// <summary>
/// This class supports book tests that need real books. A temporary folder is created and hangs around as long as this
/// TestBook class exists. This should be considered a work-in-progress, I just built as much as I needed for
/// one test. It might be useful to enhance it with more default state for the book (e.g., images) or static
/// create methods with various arguments. Could even be worth implementing a fluent language
/// so you can do something like TestBook.CreateBook().WithStyles(...).WithImage(name, content).WithContent(...).Book.
/// </summary>
public class TestBook : IDisposable
{
private TemporaryFolder _folder;
public Bloom.Book.Book Book;
public string BookFolder;
public string BookPath;
public TestBook(string testName, string content)
{
_folder = new TemporaryFolder(testName);
BookFolder = _folder.FolderPath;
BookPath = Path.Combine(_folder.FolderPath, testName + ".htm");
File.WriteAllText(BookPath, content);
var settings = CreateDefaultCollectionsSettings();
var codeBaseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Substring(8));
// This is minimal...if the content doesn't specify xmatter Bloom defaults to Traditional
// and needs the file locator to know this folder so it can find it.
// May later need to include more folders or allow the individual tests to do so.
var locator = new FileLocator(new string[] { codeBaseDir + "/../browser/templates/xmatter"});
var storage = new BookStorage(BookFolder, locator, new BookRenamedEvent(), settings);
// very minimal...enhance if we need to test something that can really find source collections.
var templatefinder = new SourceCollectionsList();
Book = new Bloom.Book.Book(new BookInfo(BookFolder, true), storage, templatefinder, settings, new PageSelection(), new PageListChangedEvent(), new BookRefreshEvent() );
}
protected CollectionSettings CreateDefaultCollectionsSettings()
{
return new CollectionSettings(new NewCollectionSettings() { PathToSettingsFile = CollectionSettings.GetPathForNewSettings(BookFolder, "test"), Language1Iso639Code = "xyz", Language2Iso639Code = "en", Language3Iso639Code = "fr" });
}
// Since this is just for testing I didn't bother with the usual mess to catch/cleanup
// if someone forgets to dispose.
public void Dispose()
{
_folder.Dispose();
}
}
}
|
mit
|
C#
|
4174f441aef91e72bd3ef1d8891e4cb31d2ad81a
|
Change Version
|
AyrA/fcfh
|
fcfh/Properties/AssemblyInfo.cs
|
fcfh/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("fcfh")]
[assembly: AssemblyDescription("Encodes and Decodes files into/from Images")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("/u/AyrA_ch")]
[assembly: AssemblyProduct("fcfh")]
[assembly: AssemblyCopyright("Copyright © /u/AyrA_ch 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("2c4b3a52-13f0-4183-a0b9-ad51c8ba22c3")]
// 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.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.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("fcfh")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("/u/AyrA_ch")]
[assembly: AssemblyProduct("fcfh")]
[assembly: AssemblyCopyright("Copyright © /u/AyrA_ch 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("2c4b3a52-13f0-4183-a0b9-ad51c8ba22c3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
b00a8cb069fc72cb33b6e4ccd42c8bdda9d5cbf7
|
Remove input/output interfaces for now
|
graphql-dotnet/graphql-dotnet,joemcbride/graphql-dotnet,graphql-dotnet/graphql-dotnet,graphql-dotnet/graphql-dotnet,joemcbride/graphql-dotnet
|
src/GraphQL/Types/IGraphType.cs
|
src/GraphQL/Types/IGraphType.cs
|
namespace GraphQL.Types
{
public interface INamedType
{
string Name { get; set; }
}
public interface IGraphType : IProvideMetadata, INamedType
{
string Description { get; set; }
string DeprecationReason { get; set; }
string CollectTypes(TypeCollectionContext context);
}
}
|
namespace GraphQL.Types
{
public interface INamedType
{
string Name { get; set; }
}
public interface IGraphType : IProvideMetadata, INamedType
{
string Description { get; set; }
string DeprecationReason { get; set; }
string CollectTypes(TypeCollectionContext context);
}
public interface IOutputGraphType : IGraphType
{
}
public interface IInputGraphType : IGraphType
{
}
}
|
mit
|
C#
|
4c9bbadab29ef8cd4f95909e25a3d9add0760d5c
|
Indent json formatting
|
timothyparez/net-ipfs-api,TrekDev/net-ipfs-api
|
src/Ipfs/Json/JsonSerializer.cs
|
src/Ipfs/Json/JsonSerializer.cs
|
using Newtonsoft.Json;
namespace Ipfs.Json
{
public class JsonSerializer : IJsonSerializer
{
private readonly JsonSerializerSettings _settings;
public JsonSerializer()
{
_settings = new JsonSerializerSettings
{
Formatting = Formatting.Indented
};
}
public T Deserialize<T>(string json)
{
return JsonConvert.DeserializeObject<T>(json, _settings);
}
public string Serialize(object obj)
{
return JsonConvert.SerializeObject(obj, _settings);
}
}
}
|
using Newtonsoft.Json;
namespace Ipfs.Json
{
public class JsonSerializer : IJsonSerializer
{
public T Deserialize<T>(string json)
{
return JsonConvert.DeserializeObject<T>(json);
}
public string Serialize(object obj)
{
return JsonConvert.SerializeObject(obj);
}
}
}
|
mit
|
C#
|
1b264a2dd0ec1a08bfd0662f3e47d792a40b91db
|
make user lookup string public
|
ppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu
|
osu.Game/Online/API/Requests/GetUserRequest.cs
|
osu.Game/Online/API/Requests/GetUserRequest.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.Users;
using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests
{
public class GetUserRequest : APIRequest<User>
{
public readonly string Lookup;
public readonly RulesetInfo Ruleset;
private readonly LookupType lookupType;
/// <summary>
/// Gets the currently logged-in user.
/// </summary>
public GetUserRequest()
{
}
/// <summary>
/// Gets a user from their ID.
/// </summary>
/// <param name="userId">The user to get.</param>
/// <param name="ruleset">The ruleset to get the user's info for.</param>
public GetUserRequest(long? userId = null, RulesetInfo ruleset = null)
{
Lookup = userId.ToString();
lookupType = LookupType.Id;
Ruleset = ruleset;
}
/// <summary>
/// Gets a user from their username.
/// </summary>
/// <param name="username">The user to get.</param>
/// <param name="ruleset">The ruleset to get the user's info for.</param>
public GetUserRequest(string username = null, RulesetInfo ruleset = null)
{
Lookup = username;
lookupType = LookupType.Username;
Ruleset = ruleset;
}
protected override string Target => Lookup != null ? $@"users/{Lookup}/{Ruleset?.ShortName}?key={lookupType.ToString().ToLower()}" : $@"me/{Ruleset?.ShortName}";
private enum LookupType
{
Id,
Username
}
}
}
|
// 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.Users;
using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests
{
public class GetUserRequest : APIRequest<User>
{
private readonly string lookup;
public readonly RulesetInfo Ruleset;
private readonly LookupType lookupType;
/// <summary>
/// Gets the currently logged-in user.
/// </summary>
public GetUserRequest()
{
}
/// <summary>
/// Gets a user from their ID.
/// </summary>
/// <param name="userId">The user to get.</param>
/// <param name="ruleset">The ruleset to get the user's info for.</param>
public GetUserRequest(long? userId = null, RulesetInfo ruleset = null)
{
lookup = userId.ToString();
lookupType = LookupType.Id;
Ruleset = ruleset;
}
/// <summary>
/// Gets a user from their username.
/// </summary>
/// <param name="username">The user to get.</param>
/// <param name="ruleset">The ruleset to get the user's info for.</param>
public GetUserRequest(string username = null, RulesetInfo ruleset = null)
{
lookup = username;
lookupType = LookupType.Username;
Ruleset = ruleset;
}
protected override string Target => lookup != null ? $@"users/{lookup}/{Ruleset?.ShortName}?key={lookupType.ToString().ToLower()}" : $@"me/{Ruleset?.ShortName}";
private enum LookupType
{
Id,
Username
}
}
}
|
mit
|
C#
|
c06e99ef82934f7f07f963ea8b59aa9c36bfffb1
|
Fix registration of tooltip only highlighter
|
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
|
resharper/resharper-unity/src/AsmDef/Feature/Services/Daemon/Attributes/AsmDefHighlightingAttributeIds.cs
|
resharper/resharper-unity/src/AsmDef/Feature/Services/Daemon/Attributes/AsmDefHighlightingAttributeIds.cs
|
using JetBrains.TextControl.DocumentMarkup;
namespace JetBrains.ReSharper.Plugins.Unity.AsmDef.Feature.Services.Daemon.Attributes
{
// Rider doesn't support an empty set of attributes (all the implementations of IRiderHighlighterModelCreator
// return null), so we must define something. If we define an EffectType, ReSharper throws if we don't define it
// properly. But this is just a tooltip, and should have EffectType.NONE. So define one dummy attribute, this keeps
// both Rider and ReSharper happy
[RegisterHighlighter(GUID_REFERENCE_TOOLTIP, FontFamily = "Unused")]
public static class AsmDefHighlightingAttributeIds
{
public const string GUID_REFERENCE_TOOLTIP = "ReSharper AsmDef GUID Reference Tooltip";
}
}
|
using JetBrains.TextControl.DocumentMarkup;
namespace JetBrains.ReSharper.Plugins.Unity.AsmDef.Feature.Services.Daemon.Attributes
{
[RegisterHighlighter(GUID_REFERENCE_TOOLTIP, EffectType = EffectType.TEXT)]
public static class AsmDefHighlightingAttributeIds
{
public const string GUID_REFERENCE_TOOLTIP = "ReSharper AsmDef GUID Reference Tooltip";
}
}
|
apache-2.0
|
C#
|
dc71a5198562ee821f4958810471457cc1b66fb2
|
allow cookies on demo
|
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
|
Demo/NakedObjects.Rest.App.Demo/App_Start/CorsConfig.cs
|
Demo/NakedObjects.Rest.App.Demo/App_Start/CorsConfig.cs
|
using System.Web.Http;
using Thinktecture.IdentityModel.Http.Cors.WebApi;
public class CorsConfig {
public static void RegisterCors(HttpConfiguration httpConfig) {
var corsConfig = new WebApiCorsConfiguration();
// this adds the CorsMessageHandler to the HttpConfiguration’s
// MessageHandlers collection
corsConfig.RegisterGlobal(httpConfig);
// this allow all CORS requests to the Products controller
// from the http://foo.com origin.
corsConfig.ForResources("RestfulObjects").ForOrigins("http://localhost:49998", "http://localhost:8080", "http://nakedobjectstest.azurewebsites.net").AllowAll().AllowResponseHeaders("Warning").AllowCookies();
}
}
|
using System.Web.Http;
using Thinktecture.IdentityModel.Http.Cors.WebApi;
public class CorsConfig {
public static void RegisterCors(HttpConfiguration httpConfig) {
var corsConfig = new WebApiCorsConfiguration();
// this adds the CorsMessageHandler to the HttpConfiguration’s
// MessageHandlers collection
corsConfig.RegisterGlobal(httpConfig);
// this allow all CORS requests to the Products controller
// from the http://foo.com origin.
corsConfig.ForResources("RestfulObjects").ForOrigins("http://localhost:49998", "http://localhost:8080", "http://nakedobjectstest.azurewebsites.net").AllowAll().AllowResponseHeaders("Warning");
}
}
|
apache-2.0
|
C#
|
5f010ba9ee004d78b1d64262fb06ae2b68c4cf23
|
test commit 2
|
abmes/UnityExtensions
|
Semba.UnityExtensions/UnityContainerExtensionMethods.cs
|
Semba.UnityExtensions/UnityContainerExtensionMethods.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Practices.Unity;
namespace Semba.UnityExtensions
{
public static class UnityContainerExtensionMethods
{
public static IUnityContainer RegisterTypeSingleton<TFrom, TTo>(this IUnityContainer container, params InjectionMember[] injectionMembers) where TTo : TFrom
{
return container.RegisterType<TFrom, TTo>(new ContainerControlledLifetimeManager(), injectionMembers);
}
public static IUnityContainer RegisterTypeSingleton<T>(this IUnityContainer container, params InjectionMember[] injectionMembers)
{
return container.RegisterType<T>(new ContainerControlledLifetimeManager(), injectionMembers);
}
public static IUnityContainer RegisterIEnumerable(this IUnityContainer container)
{
return container.RegisterType(typeof(IEnumerable<>), new InjectionFactory((c, t, n) => c.ResolveAll(t.GetGenericArguments().Single())));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Practices.Unity;
namespace Semba.UnityExtensions
{
public static class UnityContainerExtensionMethods
{
public static IUnityContainer RegisterTypeSingleton<TFrom, TTo>(this IUnityContainer container, params InjectionMember[] injectionMembers) where TTo : TFrom
{
return container.RegisterType<TFrom, TTo>(new ContainerControlledLifetimeManager(), injectionMembers);
}
public static IUnityContainer RegisterTypeSingleton<T>(this IUnityContainer container, params InjectionMember[] injectionMembers)
{
return container.RegisterType<T>(new ContainerControlledLifetimeManager(), injectionMembers);
}
public static IUnityContainer RegisterIEnumerable(this IUnityContainer container)
{
return container.RegisterType(typeof(IEnumerable<>), new InjectionFactory((c, t, n) => c.ResolveAll(t.GetGenericArguments().Single())));
}
}
}
|
mit
|
C#
|
c1d285932955aa58ac7575a9ae0872213cf47259
|
bump version to 1.7.2
|
Franiac/TwitchLeecher
|
TwitchLeecher/GlobalAssemblyInfo.cs
|
TwitchLeecher/GlobalAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Twitch Leecher")]
[assembly: AssemblyDescription("Twitch Broadcast Downloader")]
[assembly: AssemblyCompany("Franiac")]
[assembly: AssemblyCopyright("Copyright 2018 Dominik Rebitzer")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.7.2")]
[assembly: ComVisible(false)]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Twitch Leecher")]
[assembly: AssemblyDescription("Twitch Broadcast Downloader")]
[assembly: AssemblyCompany("Franiac")]
[assembly: AssemblyCopyright("Copyright 2018 Dominik Rebitzer")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.7.1")]
[assembly: ComVisible(false)]
|
mit
|
C#
|
51ea5876fcc18ca27d25e1d6e78de8bced0403b9
|
Make json keys match data
|
QuantumLeap/Vi3W,QuantumLeap/Vi3W
|
Assets/Helpers/HTML.cs
|
Assets/Helpers/HTML.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Assets.Helpers;
using Assets.Models;
using System.Globalization;
public class HTMLInterface : MonoBehaviour {
private bool fetching = true;
public JSONObject data;
public List<List<W3Object>> lists;
public IEnumerator getJSON(Dictionary<string,string> query, string url) {
string queryString = "?";
foreach(KeyValuePair<string,string> item in query) {
queryString += item.Key + "=" + item.Value + "&";
}
if(queryString == "?") {
queryString = "";
}
var www = new WWW(url + queryString);
yield return www;
data = new JSONObject(www.text);
fetching = false;
}
public IEnumerator getLists() {
while(fetching)
yield return new WaitForSeconds(0.1f);
int indicatorCount = 0;
if(data != null && data.list.Count > 0) {
var first = data.list[0];
var keys = first["d"].keys;
indicatorCount = keys.Count;
}
var res = new List<List<W3Object>>();
for(int i = 0;i < indicatorCount; i++) {
res.Add(new List<W3Object>());
}
foreach(var item in data.list) {
for(int i = 0;i < indicatorCount; i++) {
var obj = new W3Number();
obj.value = double.Parse(item["d"][item["d"].keys[i]].str, CultureInfo.InvariantCulture);
obj.type = item["type"].str;
obj.tag = item["tag"].str;
obj.indicator = item["d"].keys[i];
obj.name = item["Name"].str;
obj.longitude = double.Parse(item["long"].str, CultureInfo.InvariantCulture);
obj.latitude = double.Parse(item["lat"].str, CultureInfo.InvariantCulture);
res[i].Add(obj);
}
}
this.lists = res;
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Assets.Helpers;
using Assets.Models;
using System.Globalization;
public class HTMLInterface : MonoBehaviour {
private bool fetching = true;
public JSONObject data;
public List<List<W3Object>> lists;
public IEnumerator getJSON(Dictionary<string,string> query, string url) {
string queryString = "?";
foreach(KeyValuePair<string,string> item in query) {
queryString += item.Key + "=" + item.Value + "&";
}
if(queryString == "?") {
queryString = "";
}
var www = new WWW(url + queryString);
yield return www;
data = new JSONObject(www.text);
fetching = false;
}
public IEnumerator getLists() {
while(fetching)
yield return new WaitForSeconds(0.1f);
int indicatorCount = 0;
if(data != null && data.list.Count > 0) {
var first = data.list[0];
var keys = first["d"].keys;
indicatorCount = keys.Count;
}
var res = new List<List<W3Object>>();
for(int i = 0;i < indicatorCount; i++) {
res.Add(new List<W3Object>());
}
foreach(var item in data.list) {
for(int i = 0;i < indicatorCount; i++) {
var obj = new W3Number();
obj.value = double.Parse(item["d"][item["d"].keys[i]].str, CultureInfo.InvariantCulture);
obj.type = item["type"].str;
obj.tag = item["tag"].str;
obj.indicator = item["d"].keys[i];
obj.name = item["name"].str;
obj.longitude = double.Parse(item["longitude"].str, CultureInfo.InvariantCulture);
obj.latitude = double.Parse(item["latitude"].str, CultureInfo.InvariantCulture);
res[i].Add(obj);
}
}
this.lists = res;
}
}
|
mit
|
C#
|
a07ef8c34ac1ed3cb15494a90c11504b4c807e52
|
add descriptions
|
Recognos/CodeChalenges
|
Challenge2/Challenge2/Program.cs
|
Challenge2/Challenge2/Program.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Challenge2
{
/// <summary>
/// Intro:
/// You need to execute a potentially large number of operations that are IO and CPU intensive (like OCRing a document) and you need to
/// limit the level of concurrency at which the operations are executed. Scheduling to many CPU intensive operations is bad for performance.
///
/// Challenge:
/// Modify the code below so that the concurrency level at which RealOperation() is executed never exceeds the value of MaxConcurrency.
/// - RealOperation() must be executed TotalNumberOfExecutions times.
/// - RealOperation() the max number of concurrent calls to RealOperation() must be MaxConcurrency
/// </summary>
class Program
{
const int MaxConcurrency = 5;
const int TotalNumberOfExecutions = 20;
static int currentlyActiveOperations = 0;
static int startedOperations = 0;
static void Main(string[] args)
{
Task[] tasks = new Task[TotalNumberOfExecutions];
for (int i = 0; i < TotalNumberOfExecutions; i++)
{
tasks[i] = Task.Factory.StartNew(() => LongRunningCpuIntensiveOperationAsync()).Unwrap();
}
Task.WhenAll(tasks).Wait();
Console.WriteLine("done");
Console.ReadKey();
}
private static async Task LongRunningCpuIntensiveOperationAsync()
{
await RealOpeartion();
}
// Simulates async work. You can't modify tis method
private static async Task RealOpeartion()
{
Interlocked.Increment(ref currentlyActiveOperations);
if (currentlyActiveOperations > 5)
{
throw new InvalidOperationException("Too much concurrency");
}
var number = Interlocked.Increment(ref startedOperations);
Console.WriteLine("Starting {0}", number);
await Task.Delay(1000);
Console.WriteLine("Completed {0}", number);
Interlocked.Decrement(ref currentlyActiveOperations);
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Challenge2
{
class Program
{
static int counter = 0;
static void Main(string[] args)
{
const int totalCount = 20;
Task[] tasks = new Task[totalCount];
for (int i = 0; i < totalCount; i++)
{
tasks[i] = Task.Factory.StartNew(() => LongRunningCpuIntensiveOperation()).Unwrap();
}
Task.WhenAll(tasks).Wait();
Console.WriteLine("done");
Console.ReadKey();
}
private static async Task LongRunningCpuIntensiveOperation()
{
var number = Interlocked.Increment(ref counter);
Console.WriteLine("Starting {0}", number);
await Task.Delay(1000); // simulate long running
Console.WriteLine("Completed {0}", number);
}
}
}
|
apache-2.0
|
C#
|
2820492248bc46d4716ef4cb4961e43683380d3b
|
Use IEnumerable
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/ViewModels/Dialogs/DialogScreenViewModel.cs
|
WalletWasabi.Fluent/ViewModels/Dialogs/DialogScreenViewModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
public class DialogScreenViewModel : ViewModelBase, IScreen
{
private bool _isDialogOpen;
public DialogScreenViewModel()
{
Observable.FromEventPattern(Router.NavigationStack, nameof(Router.NavigationStack.CollectionChanged))
.Subscribe(_ =>
{
IsDialogOpen = Router.NavigationStack.Count >= 1;
});
this.WhenAnyValue(x => x.IsDialogOpen)
.Skip(1) // Skip the initial value change (which is false).
.DistinctUntilChanged()
.Subscribe(x =>
{
if (!x)
{
CloseScreen();
}
});
}
public RoutingState Router { get; } = new RoutingState();
public ReactiveCommand<Unit, Unit> GoBack => Router.NavigateBack;
public bool IsDialogOpen
{
get => _isDialogOpen;
set => this.RaiseAndSetIfChanged(ref _isDialogOpen, value);
}
private void CloseDialogs(IEnumerable<IRoutableViewModel> navigationStack)
{
// Close all dialogs so the awaited tasks can complete.
// - DialogViewModelBase.ShowDialogAsync()
// - DialogViewModelBase.GetDialogResultAsync()
foreach (var routable in navigationStack)
{
if (routable is DialogViewModelBase dialog)
{
dialog.IsDialogOpen = false;
}
}
}
private void CloseScreen()
{
// Save Router.NavigationStack as it can be modified when closing Dialog.
var navigationStack = Router.NavigationStack.ToList();
// Reset navigation when Dialog is using IScreen for navigation instead of the default IDialogHost.
if (Router.NavigationStack.Count > 0)
{
Router.NavigationStack.Clear();
}
CloseDialogs(navigationStack);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
public class DialogScreenViewModel : ViewModelBase, IScreen
{
private bool _isDialogOpen;
public DialogScreenViewModel()
{
Observable.FromEventPattern(Router.NavigationStack, nameof(Router.NavigationStack.CollectionChanged))
.Subscribe(_ =>
{
IsDialogOpen = Router.NavigationStack.Count >= 1;
});
this.WhenAnyValue(x => x.IsDialogOpen)
.Skip(1) // Skip the initial value change (which is false).
.DistinctUntilChanged()
.Subscribe(x =>
{
if (!x)
{
CloseScreen();
}
});
}
public RoutingState Router { get; } = new RoutingState();
public ReactiveCommand<Unit, Unit> GoBack => Router.NavigateBack;
public bool IsDialogOpen
{
get => _isDialogOpen;
set => this.RaiseAndSetIfChanged(ref _isDialogOpen, value);
}
private void CloseDialogs(IList<IRoutableViewModel> navigationStack)
{
// Close all dialogs so the awaited tasks can complete.
// - DialogViewModelBase.ShowDialogAsync()
// - DialogViewModelBase.GetDialogResultAsync()
foreach (var routable in navigationStack)
{
if (routable is DialogViewModelBase dialog)
{
dialog.IsDialogOpen = false;
}
}
}
private void CloseScreen()
{
// Save Router.NavigationStack as it can be modified when closing Dialog.
var navigationStack = Router.NavigationStack.ToList();
// Reset navigation when Dialog is using IScreen for navigation instead of the default IDialogHost.
if (Router.NavigationStack.Count > 0)
{
Router.NavigationStack.Clear();
}
CloseDialogs(navigationStack);
}
}
}
|
mit
|
C#
|
a2b79cda829a58f98d09d016d0696f9826e8981a
|
Update CorsExtensions.cs
|
koistya/aspnet-starter-kit,kriasoft/AspNet-Server-Template,kriasoft/aspnet-starter-kit,hcngo/craft-exercise-intuit,giokats/AspNet-Server-Template,kriasoft/aspnet-starter-kit,jmptrader/AspNet-Server-Template,koistya/aspnet-starter-kit,hcngo/craft-exercise-intuit,jmptrader/AspNet-Server-Template
|
src/App.Server/Http/Cors/CorsExtensions.cs
|
src/App.Server/Http/Cors/CorsExtensions.cs
|
// Copyright (c) KriaSoft, LLC. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE.txt in the project root for license information.
using System.Threading;
using System.Threading.Tasks;
using System.Web.Configuration;
using System.Web.Cors;
using System.Web.Http;
using System.Web.Http.Cors;
using Microsoft.Owin.Cors;
namespace Owin
{
public static class CorsExtensions
{
private static readonly EnableCorsAttribute Cors;
static CorsExtensions()
{
Cors = string.IsNullOrWhiteSpace(WebConfigurationManager.AppSettings["cors:Origins"]) ?
null :
new EnableCorsAttribute(
WebConfigurationManager.AppSettings["cors:Origins"],
WebConfigurationManager.AppSettings["cors:Headers"],
WebConfigurationManager.AppSettings["cors:Methods"]);
}
public static IAppBuilder UseCorsFromAppSettings(this IAppBuilder app, string path)
{
if (Cors != null)
{
app.UseCors(new CorsOptions
{
PolicyProvider = new CorsPolicyProvider
{
PolicyResolver = request =>
request.Path.Value == path ?
Cors.GetCorsPolicyAsync(null, CancellationToken.None) :
Task.FromResult<CorsPolicy>(null)
}
});
}
return app;
}
public static void UseCorsFromAppSettings(this HttpConfiguration httpConfiguration)
{
if (Cors != null)
{
httpConfiguration.EnableCors(Cors);
}
}
}
}
|
// Copyright (c) KriaSoft, LLC. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE.txt in the project root for license information.
using System.Threading;
using System.Threading.Tasks;
using System.Web.Configuration;
using System.Web.Cors;
using System.Web.Http;
using System.Web.Http.Cors;
using Microsoft.Owin.Cors;
namespace Owin
{
public static class CorsExtensions
{
private static readonly EnableCorsAttribute Cors;
static CorsExtensions()
{
Cors = string.IsNullOrWhiteSpace(WebConfigurationManager.AppSettings["cors:Origin"]) ?
null :
new EnableCorsAttribute(
WebConfigurationManager.AppSettings["cors:Origins"],
WebConfigurationManager.AppSettings["cors:Headers"],
WebConfigurationManager.AppSettings["cors:Methods"]);
}
public static IAppBuilder UseCorsFromAppSettings(this IAppBuilder app, string path)
{
if (Cors != null)
{
app.UseCors(new CorsOptions
{
PolicyProvider = new CorsPolicyProvider
{
PolicyResolver = request =>
request.Path.Value == path ?
Cors.GetCorsPolicyAsync(null, CancellationToken.None) :
Task.FromResult<CorsPolicy>(null)
}
});
}
return app;
}
public static void UseCorsFromAppSettings(this HttpConfiguration httpConfiguration)
{
if (Cors != null)
{
httpConfiguration.EnableCors(Cors);
}
}
}
}
|
mit
|
C#
|
01406f3b5ff43140dfee753304914d46c5188768
|
Verify that scoped command is matched
|
appharbor/appharbor-cli
|
src/AppHarbor.Tests/TypeNameMatcherTest.cs
|
src/AppHarbor.Tests/TypeNameMatcherTest.cs
|
using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;
namespace AppHarbor.Tests
{
public class TypeNameMatcherTest
{
interface IFoo
{
}
class FooCommand : IFoo { }
class FooBarCommand : IFoo { }
private static Type FooCommandType = typeof(FooCommand);
private static Type FooBarCommandType = typeof(FooBarCommand);
[Fact]
public void ShouldThrowIfInitializedWithUnnasignableType()
{
var exception = Assert.Throws<ArgumentException>(() => new TypeNameMatcher<IFoo>(new List<Type> { typeof(string) }));
}
[Theory]
[InlineData("Foo")]
[InlineData("foo")]
public void ShouldGetTypeStartingWithCommandName(string commandName)
{
var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooCommandType });
Assert.Equal(FooCommandType, matcher.GetMatchedType(commandName, null));
}
[Theory]
[InlineData("Foo")]
public void ShouldThrowWhenMoreThanOneTypeMatches(string commandName)
{
var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooCommandType, FooBarCommandType });
Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName, null));
}
[Theory]
[InlineData("Bar")]
public void ShouldThrowWhenNoTypesMatches(string commandName)
{
var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooCommandType });
Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName, null));
}
[Theory]
[InlineData("Bar")]
public void ShouldReturnScopedCommand(string scope)
{
var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooCommandType, FooBarCommandType });
matcher.GetMatchedType("foo", scope);
}
}
}
|
using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;
namespace AppHarbor.Tests
{
public class TypeNameMatcherTest
{
interface IFoo
{
}
class FooCommand : IFoo { }
class FooBarCommand : IFoo { }
private static Type FooCommandType = typeof(FooCommand);
private static Type FooBarCommandType = typeof(FooBarCommand);
[Fact]
public void ShouldThrowIfInitializedWithUnnasignableType()
{
var exception = Assert.Throws<ArgumentException>(() => new TypeNameMatcher<IFoo>(new List<Type> { typeof(string) }));
}
[Theory]
[InlineData("Foo")]
[InlineData("foo")]
public void ShouldGetTypeStartingWithCommandName(string commandName)
{
var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooCommandType });
Assert.Equal(FooCommandType, matcher.GetMatchedType(commandName, null));
}
[Theory]
[InlineData("Foo")]
public void ShouldThrowWhenMoreThanOneTypeMatches(string commandName)
{
var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooCommandType, FooBarCommandType });
Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName, null));
}
[Theory]
[InlineData("Bar")]
public void ShouldThrowWhenNoTypesMatches(string commandName)
{
var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooCommandType });
Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName, null));
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.