commit
stringlengths 40
40
| old_file
stringlengths 4
237
| new_file
stringlengths 4
237
| old_contents
stringlengths 1
4.24k
| new_contents
stringlengths 1
4.87k
| subject
stringlengths 15
778
| message
stringlengths 15
8.75k
| lang
stringclasses 266
values | license
stringclasses 13
values | repos
stringlengths 5
127k
|
|---|---|---|---|---|---|---|---|---|---|
1a3679b8b938c2a976538c345cb29e3fcbda7d7c
|
Source/TimesheetParser.Win10/Services/PasswordService.cs
|
Source/TimesheetParser.Win10/Services/PasswordService.cs
|
using System;
using System.Linq;
using System.Runtime.InteropServices;
using Windows.Security.Credentials;
using TimesheetParser.Business.Services;
namespace TimesheetParser.Win10.Services
{
internal class PasswordService : IPasswordService
{
private readonly string pluginName;
private readonly PasswordVault vault = new PasswordVault();
public PasswordService(string pluginName)
{
this.pluginName = pluginName;
}
public string Login { get; set; }
public string Password { get; set; }
public void LoadCredential()
{
try
{
var credential = vault.FindAllByResource(GetResource()).FirstOrDefault();
if (credential != null)
{
Login = credential.UserName;
Password = credential.Password;
}
}
catch (COMException)
{
// No passwords are saved for this resource.
}
}
public void SaveCredential()
{
vault.Add(new PasswordCredential(GetResource(), Login, Password));
}
public void DeleteCredential()
{
vault.Remove(vault.Retrieve(GetResource(), Login));
}
private string GetResource()
{
return $"TimesheetParser/{pluginName}";
}
}
}
|
using System;
using System.Linq;
using Windows.Security.Credentials;
using TimesheetParser.Business.Services;
namespace TimesheetParser.Win10.Services
{
internal class PasswordService : IPasswordService
{
private readonly string pluginName;
private readonly PasswordVault vault = new PasswordVault();
public PasswordService(string pluginName)
{
this.pluginName = pluginName;
}
public string Login { get; set; }
public string Password { get; set; }
public void LoadCredential()
{
try
{
var credential = vault.FindAllByResource(GetResource()).FirstOrDefault();
if (credential != null)
{
Login = credential.UserName;
Password = credential.Password;
}
}
catch (Exception)
{
// No passwords are saved for this resource.
}
}
public void SaveCredential()
{
vault.Add(new PasswordCredential(GetResource(), Login, Password));
}
public void DeleteCredential()
{
vault.Remove(vault.Retrieve(GetResource(), Login));
}
private string GetResource()
{
return $"TimesheetParser/{pluginName}";
}
}
}
|
Fix exception handling on .NET Native.
|
Fix exception handling on .NET Native.
|
C#
|
mit
|
dermeister0/TimesheetParser,dermeister0/TimesheetParser
|
c99df62990002d1bfa14751508be3c63197371ce
|
Scripts/Utils/LiteNetLibScene.cs
|
Scripts/Utils/LiteNetLibScene.cs
|
using UnityEngine;
namespace LiteNetLibManager
{
[System.Serializable]
public class LiteNetLibScene
{
[SerializeField]
public Object sceneAsset;
[SerializeField]
public string sceneName = string.Empty;
public string SceneName
{
get { return sceneName; }
set { sceneName = value; }
}
public static implicit operator string(LiteNetLibScene unityScene)
{
return unityScene.SceneName;
}
public bool IsSet()
{
return !string.IsNullOrEmpty(sceneName);
}
}
}
|
using UnityEngine;
namespace LiteNetLibManager
{
[System.Serializable]
public class LiteNetLibScene
{
[SerializeField]
private Object sceneAsset;
[SerializeField]
private string sceneName = string.Empty;
public string SceneName
{
get { return sceneName; }
set { sceneName = value; }
}
public static implicit operator string(LiteNetLibScene unityScene)
{
return unityScene.SceneName;
}
public bool IsSet()
{
return !string.IsNullOrEmpty(sceneName);
}
}
}
|
Make scene asset / scene name deprecated
|
Make scene asset / scene name deprecated
|
C#
|
mit
|
insthync/LiteNetLibManager,insthync/LiteNetLibManager
|
a8809e04f95bf7c68fb96d0e708ee99592865883
|
src/Avalonia.FreeDesktop/NativeMethods.cs
|
src/Avalonia.FreeDesktop/NativeMethods.cs
|
using System.Buffers;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace Avalonia.FreeDesktop
{
internal static class NativeMethods
{
[DllImport("libc", SetLastError = true)]
private static extern long readlink([MarshalAs(UnmanagedType.LPArray)] byte[] filename,
[MarshalAs(UnmanagedType.LPArray)] byte[] buffer,
long len);
public static string ReadLink(string path)
{
var symlinkMaxSize = Encoding.ASCII.GetMaxByteCount(path.Length);
var bufferSize = 4097; // PATH_MAX is (usually?) 4096, but we need to know if the result was truncated
var symlink = ArrayPool<byte>.Shared.Rent(symlinkMaxSize + 1);
var buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
try
{
var symlinkSize = Encoding.UTF8.GetBytes(path, 0, path.Length, symlink, 0);
symlink[symlinkSize] = 0;
var size = readlink(symlink, buffer, bufferSize);
Debug.Assert(size < bufferSize); // if this fails, we need to increase the buffer size (dynamically?)
return Encoding.UTF8.GetString(buffer, 0, (int)size);
}
finally
{
ArrayPool<byte>.Shared.Return(symlink);
ArrayPool<byte>.Shared.Return(buffer);
}
}
}
}
|
using System.Buffers;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace Avalonia.FreeDesktop
{
internal static class NativeMethods
{
[DllImport("libc", SetLastError = true)]
private static extern long readlink([MarshalAs(UnmanagedType.LPArray)] byte[] filename,
[MarshalAs(UnmanagedType.LPArray)] byte[] buffer,
long len);
public static string ReadLink(string path)
{
var symlinkSize = Encoding.UTF8.GetByteCount(path);
var bufferSize = 4097; // PATH_MAX is (usually?) 4096, but we need to know if the result was truncated
var symlink = ArrayPool<byte>.Shared.Rent(symlinkSize + 1);
var buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
try
{
Encoding.UTF8.GetBytes(path, 0, path.Length, symlink, 0);
symlink[symlinkSize] = 0;
var size = readlink(symlink, buffer, bufferSize);
Debug.Assert(size < bufferSize); // if this fails, we need to increase the buffer size (dynamically?)
return Encoding.UTF8.GetString(buffer, 0, (int)size);
}
finally
{
ArrayPool<byte>.Shared.Return(symlink);
ArrayPool<byte>.Shared.Return(buffer);
}
}
}
}
|
Use the correct size for the symlink path buffer
|
Use the correct size for the symlink path buffer
This fixes crashes when the path has non-ASCII characters
|
C#
|
mit
|
AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,grokys/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex
|
7f902496f8fd6a93ff7d66cfdf006edfd70d187e
|
src/Utils/Metadata.cs
|
src/Utils/Metadata.cs
|
using Hyena;
using TagLib;
using System;
using GLib;
namespace FSpot.Utils
{
public static class Metadata
{
public static TagLib.Image.File Parse (SafeUri uri)
{
// Detect mime-type
var gfile = FileFactory.NewForUri (uri);
var info = gfile.QueryInfo ("standard::content-type", FileQueryInfoFlags.None, null);
var mime = info.ContentType;
// Parse file
var res = new GIOTagLibFileAbstraction () { Uri = uri };
var sidecar_uri = uri.ReplaceExtension (".xmp");
var sidecar_res = new GIOTagLibFileAbstraction () { Uri = sidecar_uri };
TagLib.Image.File file = null;
try {
file = TagLib.File.Create (res, mime, ReadStyle.Average) as TagLib.Image.File;
} catch (Exception e) {
Hyena.Log.Exception (String.Format ("Loading of Metadata failed for file: {0}", uri.ToString ()), e);
return null;
}
// Load XMP sidecar
var sidecar_file = GLib.FileFactory.NewForUri (sidecar_uri);
if (sidecar_file.Exists) {
file.ParseXmpSidecar (sidecar_res);
}
return file;
}
}
}
|
using Hyena;
using TagLib;
using System;
using GLib;
namespace FSpot.Utils
{
public static class Metadata
{
public static TagLib.Image.File Parse (SafeUri uri)
{
// Detect mime-type
var gfile = FileFactory.NewForUri (uri);
var info = gfile.QueryInfo ("standard::content-type", FileQueryInfoFlags.None, null);
var mime = info.ContentType;
if (mime.StartsWith ("application/x-extension-")) {
// Works around broken metadata detection - https://bugzilla.gnome.org/show_bug.cgi?id=624781
mime = String.Format ("taglib/{0}", mime.Substring (24));
}
// Parse file
var res = new GIOTagLibFileAbstraction () { Uri = uri };
var sidecar_uri = uri.ReplaceExtension (".xmp");
var sidecar_res = new GIOTagLibFileAbstraction () { Uri = sidecar_uri };
TagLib.Image.File file = null;
try {
file = TagLib.File.Create (res, mime, ReadStyle.Average) as TagLib.Image.File;
} catch (Exception e) {
Hyena.Log.Exception (String.Format ("Loading of Metadata failed for file: {0}", uri.ToString ()), e);
return null;
}
// Load XMP sidecar
var sidecar_file = GLib.FileFactory.NewForUri (sidecar_uri);
if (sidecar_file.Exists) {
file.ParseXmpSidecar (sidecar_res);
}
return file;
}
}
}
|
Work around broken mime-type detection.
|
Work around broken mime-type detection.
https://bugzilla.gnome.org/show_bug.cgi?id=624781
|
C#
|
mit
|
nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,dkoeb/f-spot,Sanva/f-spot,dkoeb/f-spot,dkoeb/f-spot,mono/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,Yetangitu/f-spot,GNOME/f-spot,mono/f-spot,mono/f-spot,mans0954/f-spot,Yetangitu/f-spot,GNOME/f-spot,mono/f-spot,Yetangitu/f-spot,mans0954/f-spot,mono/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,Yetangitu/f-spot,GNOME/f-spot,Sanva/f-spot,nathansamson/F-Spot-Album-Exporter,dkoeb/f-spot,dkoeb/f-spot,Yetangitu/f-spot,dkoeb/f-spot,mans0954/f-spot,mans0954/f-spot,mono/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,Sanva/f-spot
|
9fbc32ecea224cd153ef0eff91bfc1cc759e4584
|
Content.Server/Atmos/Commands/AddAtmosCommand.cs
|
Content.Server/Atmos/Commands/AddAtmosCommand.cs
|
using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Atmos.Commands
{
[AdminCommand(AdminFlags.Debug)]
public sealed class AddAtmosCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "addatmos";
public string Description => "Adds atmos support to a grid.";
public string Help => $"{Command} <GridId>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length < 1)
{
shell.WriteLine(Help);
return;
}
var entMan = IoCManager.Resolve<IEntityManager>();
if(EntityUid.TryParse(args[0], out var euid))
{
shell.WriteError($"Failed to parse euid '{args[0]}'.");
return;
}
if (!entMan.HasComponent<IMapGridComponent>(euid))
{
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return;
}
if (_entities.HasComponent<IAtmosphereComponent>(euid))
{
shell.WriteLine("Grid already has an atmosphere.");
return;
}
_entities.AddComponent<GridAtmosphereComponent>(euid);
shell.WriteLine($"Added atmosphere to grid {euid}.");
}
}
}
|
using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Atmos.Commands
{
[AdminCommand(AdminFlags.Debug)]
public sealed class AddAtmosCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "addatmos";
public string Description => "Adds atmos support to a grid.";
public string Help => $"{Command} <GridId>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length < 1)
{
shell.WriteLine(Help);
return;
}
var entMan = IoCManager.Resolve<IEntityManager>();
if (!EntityUid.TryParse(args[0], out var euid))
{
shell.WriteError($"Failed to parse euid '{args[0]}'.");
return;
}
if (!entMan.HasComponent<IMapGridComponent>(euid))
{
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return;
}
if (_entities.HasComponent<IAtmosphereComponent>(euid))
{
shell.WriteLine("Grid already has an atmosphere.");
return;
}
_entities.AddComponent<GridAtmosphereComponent>(euid);
shell.WriteLine($"Added atmosphere to grid {euid}.");
}
}
}
|
Fix addatmos from griduid artifact
|
Fix addatmos from griduid artifact
|
C#
|
mit
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
5f6050593a4ae1c14d563c040b7b0199b1e50c06
|
FaqTemplate.Bot/PlainTextMessageReceiver.cs
|
FaqTemplate.Bot/PlainTextMessageReceiver.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Lime.Protocol;
using Takenet.MessagingHub.Client;
using Takenet.MessagingHub.Client.Listener;
using Takenet.MessagingHub.Client.Sender;
using System.Diagnostics;
using FaqTemplate.Core.Services;
using FaqTemplate.Core.Domain;
namespace FaqTemplate.Bot
{
public class PlainTextMessageReceiver : IMessageReceiver
{
private readonly IFaqService<string> _faqService;
private readonly IMessagingHubSender _sender;
private readonly Settings _settings;
public PlainTextMessageReceiver(IMessagingHubSender sender, IFaqService<string> faqService, Settings settings)
{
_sender = sender;
_faqService = faqService;
_settings = settings;
}
public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
{
Trace.TraceInformation($"From: {message.From} \tContent: {message.Content}");
var request = new FaqRequest { Ask = message.Content.ToString() };
var result = await _faqService.AskThenIAnswer(request);
await _sender.SendMessageAsync($"{result.Score}: {result.Answer}", message.From, cancellationToken);
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Lime.Protocol;
using Takenet.MessagingHub.Client;
using Takenet.MessagingHub.Client.Listener;
using Takenet.MessagingHub.Client.Sender;
using System.Diagnostics;
using FaqTemplate.Core.Services;
using FaqTemplate.Core.Domain;
namespace FaqTemplate.Bot
{
public class PlainTextMessageReceiver : IMessageReceiver
{
private readonly IFaqService<string> _faqService;
private readonly IMessagingHubSender _sender;
private readonly Settings _settings;
public PlainTextMessageReceiver(IMessagingHubSender sender, IFaqService<string> faqService, Settings settings)
{
_sender = sender;
_faqService = faqService;
_settings = settings;
}
public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
{
Trace.TraceInformation($"From: {message.From} \tContent: {message.Content}");
var request = new FaqRequest { Ask = message.Content.ToString() };
var response = await _faqService.AskThenIAnswer(request);
if (response.Score >= 0.8)
{
await _sender.SendMessageAsync($"{response.Answer}", message.From, cancellationToken);
}
else if(response.Score >= 0.5)
{
await _sender.SendMessageAsync($"Eu acho que a resposta para o que voc precisa :", message.From, cancellationToken);
cancellationToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(1));
await _sender.SendMessageAsync($"{response.Answer}", message.From, cancellationToken);
}
else
{
await _sender.SendMessageAsync($"Infelizmente eu ainda no sei isso! Mas vou me aprimorar, prometo!", message.From, cancellationToken);
}
await _sender.SendMessageAsync($"{response.Score}: {response.Answer}", message.From, cancellationToken);
}
}
}
|
Add multiple response handling for diferente score levels
|
Add multiple response handling for diferente score levels
|
C#
|
mit
|
iperoyg/faqtemplatebot
|
979a7284ce2b9983653c7aee2647ed76fbcfbdc0
|
SimpleWAWS/Models/WebsiteTemplate.cs
|
SimpleWAWS/Models/WebsiteTemplate.cs
|
using System;
using System.Collections.Generic;
using System.EnterpriseServices.Internal;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace SimpleWAWS.Models
{
public class WebsiteTemplate : BaseTemplate
{
[JsonProperty(PropertyName="fileName")]
public string FileName { get; set; }
[JsonProperty(PropertyName="language")]
public string Language { get; set; }
public static WebsiteTemplate EmptySiteTemplate
{
get { return new WebsiteTemplate() { Name = "Empty Site", Language = "Empty Site", SpriteName = "sprite-Large" }; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.EnterpriseServices.Internal;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace SimpleWAWS.Models
{
public class WebsiteTemplate : BaseTemplate
{
[JsonProperty(PropertyName="fileName")]
public string FileName { get; set; }
[JsonProperty(PropertyName="language")]
public string Language { get; set; }
public static WebsiteTemplate EmptySiteTemplate
{
get { return new WebsiteTemplate() { Name = "Empty Site", Language = "Default", SpriteName = "sprite-Large" }; }
}
}
}
|
Move 'Empty Website' template to Default language
|
Move 'Empty Website' template to Default language
|
C#
|
apache-2.0
|
projectkudu/TryAppService,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/TryAppService,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,fashaikh/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/TryAppService,fashaikh/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/TryAppService
|
e27bd15f080242857e4c62d854628c24df235de9
|
src/Telegram.Bot/Helpers/Extensions.cs
|
src/Telegram.Bot/Helpers/Extensions.cs
|
using System;
namespace Telegram.Bot.Helpers
{
/// <summary>
/// Extension Methods
/// </summary>
public static class Extensions
{
private static readonly DateTime UnixStart = new DateTime(1970, 1, 1);
/// <summary>
/// Convert a long into a DateTime
/// </summary>
public static DateTime FromUnixTime(this long dateTime)
=> UnixStart.AddSeconds(dateTime).ToLocalTime();
/// <summary>
/// Convert a DateTime into a long
/// </summary>
/// <exception cref="ArgumentOutOfRangeException"></exception>
/// <exception cref="OverflowException"></exception>
public static long ToUnixTime(this DateTime dateTime)
{
var utcDateTime = dateTime.ToUniversalTime();
if (utcDateTime == DateTime.MinValue)
return 0;
var delta = dateTime - UnixStart;
if (delta.TotalSeconds < 0)
throw new ArgumentOutOfRangeException(nameof(dateTime), "Unix epoch starts January 1st, 1970");
return Convert.ToInt64(delta.TotalSeconds);
}
}
}
|
using System;
namespace Telegram.Bot.Helpers
{
/// <summary>
/// Extension Methods
/// </summary>
public static class Extensions
{
private static readonly DateTime UnixStart = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// Convert a long into a DateTime
/// </summary>
public static DateTime FromUnixTime(this long unixTime)
=> UnixStart.AddSeconds(unixTime).ToLocalTime();
/// <summary>
/// Convert a DateTime into a long
/// </summary>
/// <exception cref="ArgumentOutOfRangeException"></exception>
/// <exception cref="OverflowException"></exception>
public static long ToUnixTime(this DateTime dateTime)
{
if (dateTime == DateTime.MinValue)
return 0;
var utcDateTime = dateTime.ToUniversalTime();
var delta = (utcDateTime - UnixStart).TotalSeconds;
if (delta < 0)
throw new ArgumentOutOfRangeException(nameof(dateTime), "Unix epoch starts January 1st, 1970");
return Convert.ToInt64(delta);
}
}
}
|
Fix minor issue with unix time calculation.
|
Fix minor issue with unix time calculation.
|
C#
|
mit
|
TelegramBots/telegram.bot,MrRoundRobin/telegram.bot,AndyDingo/telegram.bot
|
cfb42037cff74a3db3dbcf80cb176003f428c7ae
|
osu.Game/Online/API/Requests/GetUsersRequest.cs
|
osu.Game/Online/API/Requests/GetUsersRequest.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
namespace osu.Game.Online.API.Requests
{
public class GetUsersRequest : APIRequest<GetUsersResponse>
{
private readonly int[] userIds;
private const int max_ids_per_request = 50;
public GetUsersRequest(int[] userIds)
{
if (userIds.Length > max_ids_per_request)
throw new ArgumentException($"{nameof(GetUsersRequest)} calls only support up to {max_ids_per_request} IDs at once");
this.userIds = userIds;
}
protected override string Target => $@"users/?{userIds.Select(u => $"ids[]={u}&").Aggregate((a, b) => a + b)}";
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
namespace osu.Game.Online.API.Requests
{
public class GetUsersRequest : APIRequest<GetUsersResponse>
{
private readonly int[] userIds;
private const int max_ids_per_request = 50;
public GetUsersRequest(int[] userIds)
{
if (userIds.Length > max_ids_per_request)
throw new ArgumentException($"{nameof(GetUsersRequest)} calls only support up to {max_ids_per_request} IDs at once");
this.userIds = userIds;
}
protected override string Target => "users/?ids[]=" + string.Join("&ids[]=", userIds);
}
}
|
Refactor request string logic to avoid linq usage
|
Refactor request string logic to avoid linq usage
|
C#
|
mit
|
smoogipooo/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,ppy/osu
|
9abd0dc16414d9bdeeec898d79bed3c4010258f3
|
Bonobo.Git.Server/Configuration/AuthenticationSettings.cs
|
Bonobo.Git.Server/Configuration/AuthenticationSettings.cs
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
namespace Bonobo.Git.Server.Configuration
{
public class AuthenticationSettings
{
public static string MembershipService { get; private set; }
public static string RoleProvider { get; private set; }
static AuthenticationSettings()
{
MembershipService = ConfigurationManager.AppSettings["MembershipService"];
RoleProvider = ConfigurationManager.AppSettings["RoleProvider"];
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
namespace Bonobo.Git.Server.Configuration
{
public class AuthenticationSettings
{
public static string MembershipService { get; private set; }
static AuthenticationSettings()
{
MembershipService = ConfigurationManager.AppSettings["MembershipService"];
}
}
}
|
Remove unused RoleProvider setting from authentication configuration
|
Remove unused RoleProvider setting from authentication configuration
|
C#
|
mit
|
crowar/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,lkho/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,NipponSysits/IIS.Git-Connector,willdean/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,braegelno5/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,willdean/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,larshg/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,gencer/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,lkho/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,willdean/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,willdean/Bonobo-Git-Server,gencer/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,lkho/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,crowar/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,kfarnung/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,gencer/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,willdean/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,gencer/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,larshg/Bonobo-Git-Server,larshg/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,larshg/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,padremortius/Bonobo-Git-Server,crowar/Bonobo-Git-Server,lkho/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,braegelno5/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,NipponSysits/IIS.Git-Connector,RedX2501/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,crowar/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,crowar/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,PGM-NipponSysits/IIS.Git-Connector,kfarnung/Bonobo-Git-Server,crowar/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector
|
a27c502ebaae34ef6355942caaaaeff44fa08c01
|
Durwella.UrlShortening.Tests/WebClientUrlUnwrapperTest.cs
|
Durwella.UrlShortening.Tests/WebClientUrlUnwrapperTest.cs
|
using System.Net;
using FluentAssertions;
using NUnit.Framework;
namespace Durwella.UrlShortening.Tests
{
public class WebClientUrlUnwrapperTest
{
[Test]
public void ShouldGetResourceLocation()
{
var wrappedUrl = "http://goo.gl/mSkqOi";
var subject = new WebClientUrlUnwrapper();
var directUrl = subject.GetDirectUrl(wrappedUrl);
directUrl.Should().Be("http://example.com/");
}
[Test]
public void ShouldReturnGivenLocationIfAuthenticationRequired()
{
var givenUrl = "http://durwella.com/testing/does-not-exist";
var subject = new WebClientUrlUnwrapper
{
IgnoreErrorCodes = new[] { HttpStatusCode.NotFound }
};
var directUrl = subject.GetDirectUrl(givenUrl);
directUrl.Should().Be(givenUrl);
}
}
}
|
using System.Net;
using FluentAssertions;
using NUnit.Framework;
namespace Durwella.UrlShortening.Tests
{
public class WebClientUrlUnwrapperTest
{
[Test]
public void ShouldGetResourceLocation()
{
var wrappedUrl = "http://goo.gl/mSkqOi";
var subject = new WebClientUrlUnwrapper();
WebClientUrlUnwrapper.ResolveUrls = true;
var directUrl = subject.GetDirectUrl(wrappedUrl);
directUrl.Should().Be("http://example.com/");
WebClientUrlUnwrapper.ResolveUrls = false;
}
[Test]
public void ShouldReturnGivenLocationIfAuthenticationRequired()
{
var givenUrl = "http://durwella.com/testing/does-not-exist";
var subject = new WebClientUrlUnwrapper
{
IgnoreErrorCodes = new[] { HttpStatusCode.NotFound }
};
WebClientUrlUnwrapper.ResolveUrls = true;
var directUrl = subject.GetDirectUrl(givenUrl);
directUrl.Should().Be(givenUrl);
WebClientUrlUnwrapper.ResolveUrls = false;
}
}
}
|
Update tests for new url resolution behavior
|
Update tests for new url resolution behavior
|
C#
|
mit
|
Durwella/UrlShortening,Durwella/UrlShortening
|
38e336fa9f7a3f730771a958f7ccde61a22bbedd
|
UaClient.UnitTests/UnitTests/UaApplicationOptionsTests.cs
|
UaClient.UnitTests/UnitTests/UaApplicationOptionsTests.cs
|
using FluentAssertions;
using System;
using System.Collections.Generic;
using System.Text;
using Workstation.ServiceModel.Ua;
using Xunit;
namespace Workstation.UaClient.UnitTests
{
public class UaApplicationOptionsTests
{
[Fact]
public void UaTcpTransportChannelOptionsDefaults()
{
var lowestBufferSize = 1024u;
var options = new UaTcpTransportChannelOptions();
options.LocalMaxChunkCount
.Should().BeGreaterOrEqualTo(lowestBufferSize);
options.LocalMaxMessageSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
options.LocalReceiveBufferSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
options.LocalSendBufferSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
}
[Fact]
public void UaTcpSecureChannelOptionsDefaults()
{
var shortestTimespan = TimeSpan.FromMilliseconds(100);
var options = new UaTcpSecureChannelOptions();
TimeSpan.FromMilliseconds(options.TimeoutHint)
.Should().BeGreaterOrEqualTo(shortestTimespan);
options.DiagnosticsHint
.Should().Be(0);
}
[Fact]
public void UaTcpSessionChannelOptionsDefaults()
{
var shortestTimespan = TimeSpan.FromMilliseconds(100);
var options = new UaTcpSessionChannelOptions();
TimeSpan.FromMilliseconds(options.SessionTimeout)
.Should().BeGreaterOrEqualTo(shortestTimespan);
}
}
}
|
using FluentAssertions;
using System;
using System.Collections.Generic;
using System.Text;
using Workstation.ServiceModel.Ua;
using Xunit;
namespace Workstation.UaClient.UnitTests
{
public class UaApplicationOptionsTests
{
[Fact]
public void UaTcpTransportChannelOptionsDefaults()
{
var lowestBufferSize = 8192u;
var options = new UaTcpTransportChannelOptions();
options.LocalReceiveBufferSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
options.LocalSendBufferSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
}
[Fact]
public void UaTcpSecureChannelOptionsDefaults()
{
var shortestTimespan = TimeSpan.FromMilliseconds(100);
var options = new UaTcpSecureChannelOptions();
TimeSpan.FromMilliseconds(options.TimeoutHint)
.Should().BeGreaterOrEqualTo(shortestTimespan);
options.DiagnosticsHint
.Should().Be(0);
}
[Fact]
public void UaTcpSessionChannelOptionsDefaults()
{
var shortestTimespan = TimeSpan.FromMilliseconds(100);
var options = new UaTcpSessionChannelOptions();
TimeSpan.FromMilliseconds(options.SessionTimeout)
.Should().BeGreaterOrEqualTo(shortestTimespan);
}
}
}
|
Use 8192u as lowestBufferSize; Remove tests for LocalMaxChunkCount and MaxMessageSize
|
Use 8192u as lowestBufferSize; Remove tests for LocalMaxChunkCount and MaxMessageSize
|
C#
|
mit
|
convertersystems/opc-ua-client
|
d028119cf799e0f7007850b3a811613696b158bd
|
DesktopWidgets/Helpers/FullScreenHelper.cs
|
DesktopWidgets/Helpers/FullScreenHelper.cs
|
using System.Linq;
using System.Windows;
using System.Windows.Forms;
using DesktopWidgets.Classes;
namespace DesktopWidgets.Helpers
{
internal static class FullScreenHelper
{
private static bool DoesMonitorHaveFullscreenApp(Screen screen) => Win32Helper.GetForegroundApp()
.IsFullScreen(screen);
private static bool DoesMonitorHaveFullscreenApp(Screen screen, Win32App ignoreApp)
{
var foregroundApp = Win32Helper.GetForegroundApp();
return foregroundApp.Hwnd != ignoreApp.Hwnd && foregroundApp.IsFullScreen(screen);
}
public static bool DoesMonitorHaveFullscreenApp(Rect bounds)
=> DoesMonitorHaveFullscreenApp(ScreenHelper.GetScreen(bounds));
public static bool DoesMonitorHaveFullscreenApp(Rect bounds, Win32App ignoreApp)
=> DoesMonitorHaveFullscreenApp(ScreenHelper.GetScreen(bounds), ignoreApp);
public static bool DoesAnyMonitorHaveFullscreenApp() => Screen.AllScreens.Any(DoesMonitorHaveFullscreenApp);
}
}
|
using System.Linq;
using System.Windows;
using System.Windows.Forms;
using DesktopWidgets.Classes;
namespace DesktopWidgets.Helpers
{
internal static class FullScreenHelper
{
private static bool DoesMonitorHaveFullscreenApp(Screen screen) => Win32Helper.GetForegroundApp()
.IsFullScreen(screen);
private static bool DoesMonitorHaveFullscreenApp(Screen screen, Win32App ignoreApp)
{
var foregroundApp = Win32Helper.GetForegroundApp();
return foregroundApp.Hwnd != ignoreApp?.Hwnd && foregroundApp.IsFullScreen(screen);
}
public static bool DoesMonitorHaveFullscreenApp(Rect bounds)
=> DoesMonitorHaveFullscreenApp(ScreenHelper.GetScreen(bounds));
public static bool DoesMonitorHaveFullscreenApp(Rect bounds, Win32App ignoreApp)
=> DoesMonitorHaveFullscreenApp(ScreenHelper.GetScreen(bounds), ignoreApp);
public static bool DoesAnyMonitorHaveFullscreenApp() => Screen.AllScreens.Any(DoesMonitorHaveFullscreenApp);
}
}
|
Fix potential fullscreen checking error
|
Fix potential fullscreen checking error
|
C#
|
apache-2.0
|
danielchalmers/DesktopWidgets
|
b270e4ae22bee7005c1a9d26f6d5309a82b4ff67
|
SharpHaven.Common/Resources/ResourceRef.cs
|
SharpHaven.Common/Resources/ResourceRef.cs
|
using System;
namespace SharpHaven.Resources
{
public struct ResourceRef
{
public ResourceRef(string name, ushort version)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
this.Name = name;
this.Version = version;
}
public string Name { get; }
public ushort Version { get; }
public override int GetHashCode()
{
return Name.GetHashCode() ^ Version.GetHashCode();
}
public override bool Equals(object obj)
{
if (!(obj is ResourceRef))
return false;
var other = (ResourceRef)obj;
return string.Equals(Name, other.Name) && Version == other.Version;
}
}
}
|
using System;
namespace SharpHaven.Resources
{
public struct ResourceRef
{
public ResourceRef(string name, ushort version)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
Name = name;
Version = version;
}
public string Name { get; }
public ushort Version { get; }
public override int GetHashCode()
{
return Name.GetHashCode() ^ Version.GetHashCode();
}
public override bool Equals(object obj)
{
if (!(obj is ResourceRef))
return false;
var other = (ResourceRef)obj;
return string.Equals(Name, other.Name) && Version == other.Version;
}
}
}
|
Revert "Fix mono compilation error"
|
Revert "Fix mono compilation error"
This reverts commit be3d841e576a83354476c905b51882159daba5cc.
|
C#
|
mit
|
k-t/SharpHaven
|
647aa345f7547f66c19cf7ece10cba5e08d17218
|
Gu.Wpf.Geometry.Tests/NamespacesTests.cs
|
Gu.Wpf.Geometry.Tests/NamespacesTests.cs
|
namespace Gu.Wpf.Geometry.Tests
{
using System;
using System.Linq;
using System.Reflection;
using System.Windows.Markup;
using NUnit.Framework;
public class NamespacesTests
{
private const string Uri = "http://gu.se/Geometry";
private readonly Assembly assembly;
public NamespacesTests()
{
this.assembly = typeof(GradientPath).Assembly;
}
[Test]
public void XmlnsDefinitions()
{
string[] skip = { ".Annotations", ".Properties", "XamlGeneratedNamespace" };
var strings = this.assembly.GetTypes()
.Select(x => x.Namespace)
.Distinct()
.Where(x => x != null && !skip.Any(x.EndsWith))
.OrderBy(x => x)
.ToArray();
var attributes = this.assembly.CustomAttributes.Where(x => x.AttributeType == typeof(XmlnsDefinitionAttribute))
.ToArray();
var actuals = attributes.Select(a => a.ConstructorArguments[1].Value)
.OrderBy(x => x);
foreach (var s in strings)
{
Console.WriteLine(@"[assembly: XmlnsDefinition(""{0}"", ""{1}"")]", Uri, s);
}
Assert.AreEqual(strings, actuals);
foreach (var attribute in attributes)
{
Assert.AreEqual(Uri, attribute.ConstructorArguments[0].Value);
}
}
[Test]
public void XmlnsPrefix()
{
var attributes = this.assembly.CustomAttributes.Where(x => x.AttributeType == typeof(XmlnsPrefixAttribute));
foreach (var attribute in attributes)
{
Assert.AreEqual(Uri, attribute.ConstructorArguments[0].Value);
}
}
}
}
|
namespace Gu.Wpf.Geometry.Tests
{
using System;
using System.Linq;
using System.Reflection;
using System.Windows.Markup;
using NUnit.Framework;
public class NamespacesTests
{
private const string Uri = "http://gu.se/Geometry";
private readonly Assembly assembly;
public NamespacesTests()
{
this.assembly = typeof(GradientPath).Assembly;
}
[Test]
public void XmlnsPrefix()
{
var attributes = this.assembly.CustomAttributes.Where(x => x.AttributeType == typeof(XmlnsPrefixAttribute));
foreach (var attribute in attributes)
{
Assert.AreEqual(Uri, attribute.ConstructorArguments[0].Value);
}
}
}
}
|
Remove test that is checked by analyzer.
|
Remove test that is checked by analyzer.
|
C#
|
mit
|
JohanLarsson/Gu.Wpf.Geometry
|
74cbf9f91972fc26244bb008cf20fee432999bfd
|
OMF/Program.cs
|
OMF/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OMF
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string baseDir = System.AppDomain.CurrentDomain.BaseDirectory;
string file = System.IO.Path.Combine(baseDir, "..\\..\\test.omf");
if (System.IO.File.Exists(file) == false)
{
Console.WriteLine(string.Format("File '{0}' does not exist.", file));
Console.ReadLine();
return;
}
OMF torun = new OMF();
torun.Execute(file);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OMF
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string baseDir = System.AppDomain.CurrentDomain.BaseDirectory;
string file = System.IO.Path.Combine(baseDir, "..", "..", "test.omf");
if (System.IO.File.Exists(file) == false)
{
Console.WriteLine(string.Format("File '{0}' does not exist.", file));
Console.ReadLine();
return;
}
OMF torun = new OMF();
torun.Execute(file);
}
}
}
|
Make test file path OS-agnostic
|
Make test file path OS-agnostic
|
C#
|
mit
|
GMSGDataExchange/omf_csharp
|
4274cc401f9522bea1aa88190718981b03381a19
|
PS.Mothership.Core/PS.Mothership.Core.Common/SignalRConnectionHandling/IClientsCollection.cs
|
PS.Mothership.Core/PS.Mothership.Core.Common/SignalRConnectionHandling/IClientsCollection.cs
|
namespace PS.Mothership.Core.Common.SignalRConnectionHandling
{
public interface IClientsCollection
{
ISignalRUser Get(string machineName, string username);
ISignalRUser GetOrAdd(string machineName, string username);
void AddOrReplace(ISignalRUser inputUser);
}
}
|
namespace PS.Mothership.Core.Common.SignalRConnectionHandling
{
public interface IClientsCollection
{
ISignalRUser Get(string username);
ISignalRUser GetOrAdd(string username);
void AddOrReplace(ISignalRUser inputUser);
}
}
|
Remove machine name from method calls since it is no longer needed after refactoring implementation
|
Remove machine name from method calls since it is no longer needed after refactoring implementation
|
C#
|
mit
|
Paymentsense/Dapper.SimpleSave
|
373b4d6a8ecc320eb14d09c476e1a6161b0641f1
|
Src/AjErl.Console/Program.cs
|
Src/AjErl.Console/Program.cs
|
namespace AjErl.Console
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AjErl.Compiler;
using AjErl.Expressions;
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("AjErl alfa 0.0.1");
Lexer lexer = new Lexer(Console.In);
Parser parser = new Parser(lexer);
Machine machine = new Machine();
while (true)
try
{
ProcessExpression(parser, machine.RootContext);
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
Console.Error.WriteLine(ex.StackTrace);
}
}
private static void ProcessExpression(Parser parser, Context context)
{
IExpression expression = parser.ParseExpression();
object result = expression.Evaluate(context);
if (result == null)
return;
Console.Write("> ");
Console.WriteLine(result);
}
}
}
|
namespace AjErl.Console
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AjErl.Compiler;
using AjErl.Expressions;
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("AjErl alfa 0.0.1");
Lexer lexer = new Lexer(Console.In);
Parser parser = new Parser(lexer);
Machine machine = new Machine();
while (true)
try
{
ProcessExpression(parser, machine.RootContext);
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
Console.Error.WriteLine(ex.StackTrace);
}
}
private static void ProcessExpression(Parser parser, Context context)
{
IExpression expression = parser.ParseExpression();
object result = Machine.ExpandDelayedCall(expression.Evaluate(context));
if (result == null)
return;
Console.Write("> ");
Console.WriteLine(result);
}
}
}
|
Expand delayed calls in console interpreter
|
Expand delayed calls in console interpreter
|
C#
|
mit
|
ajlopez/AjErl,ajlopez/ErlSharp
|
0cea0185767d71d7a94538c9127d2fb49ef158d4
|
osu.Game/Screens/Select/ImportFromStablePopup.cs
|
osu.Game/Screens/Select/ImportFromStablePopup.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.Select
{
public class ImportFromStablePopup : PopupDialog
{
public ImportFromStablePopup(Action importFromStable)
{
HeaderText = @"You have no beatmaps!";
BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps?";
Icon = FontAwesome.fa_trash_o;
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes please!",
Action = importFromStable
},
new PopupDialogCancelButton
{
Text = @"No, I'd like to start from scratch",
},
};
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.Select
{
public class ImportFromStablePopup : PopupDialog
{
public ImportFromStablePopup(Action importFromStable)
{
HeaderText = @"You have no beatmaps!";
BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps?";
Icon = FontAwesome.fa_plane;
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes please!",
Action = importFromStable
},
new PopupDialogCancelButton
{
Text = @"No, I'd like to start from scratch",
},
};
}
}
}
|
Use a more suiting (?) icon for import dialog
|
Use a more suiting (?) icon for import dialog
Closes #1763.
|
C#
|
mit
|
NeoAdonis/osu,smoogipooo/osu,smoogipoo/osu,ZLima12/osu,smoogipoo/osu,ppy/osu,Frontear/osuKyzer,peppy/osu-new,johnneijzen/osu,johnneijzen/osu,peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,EVAST9919/osu,EVAST9919/osu,ppy/osu,ZLima12/osu,2yangk23/osu,UselessToucan/osu,naoey/osu,peppy/osu,naoey/osu,DrabWeb/osu,smoogipoo/osu,UselessToucan/osu,DrabWeb/osu,UselessToucan/osu,naoey/osu,Nabile-Rahmani/osu,DrabWeb/osu,peppy/osu
|
fd4bc059a2b35f1b1d05eea263599f10b5a0d6f9
|
Common/Properties/SharedAssemblyInfo.cs
|
Common/Properties/SharedAssemblyInfo.cs
|
using System.Reflection;
// common assembly attributes
[assembly: AssemblyDescription("Lean Engine is an open-source, plataform agnostic C# and Python algorithmic trading engine. " +
"Allows strategy research, backtesting and live trading with Equities, FX, CFD, Crypto, Options and Futures Markets.")]
[assembly: AssemblyCopyright("QuantConnect™ 2018. All Rights Reserved")]
[assembly: AssemblyCompany("QuantConnect Corporation")]
[assembly: AssemblyVersion("2.4")]
// Configuration used to build the assembly is by defaulting 'Debug'.
// To create a package using a Release configuration, -properties Configuration=Release on the command line must be use.
// source: https://docs.microsoft.com/en-us/nuget/reference/nuspec#replacement-tokens
|
using System.Reflection;
// common assembly attributes
[assembly: AssemblyDescription("Lean Engine is an open-source, platform agnostic C# and Python algorithmic trading engine. " +
"Allows strategy research, backtesting and live trading with Equities, FX, CFD, Crypto, Options and Futures Markets.")]
[assembly: AssemblyCopyright("QuantConnect™ 2018. All Rights Reserved")]
[assembly: AssemblyCompany("QuantConnect Corporation")]
[assembly: AssemblyVersion("2.4")]
// Configuration used to build the assembly is by defaulting 'Debug'.
// To create a package using a Release configuration, -properties Configuration=Release on the command line must be use.
// source: https://docs.microsoft.com/en-us/nuget/reference/nuspec#replacement-tokens
|
Fix typo in assembly description
|
Fix typo in assembly description
|
C#
|
apache-2.0
|
QuantConnect/Lean,jameschch/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,QuantConnect/Lean,jameschch/Lean,StefanoRaggi/Lean,JKarathiya/Lean,JKarathiya/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,jameschch/Lean,jameschch/Lean,JKarathiya/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,jameschch/Lean,QuantConnect/Lean,JKarathiya/Lean,AlexCatarino/Lean,AlexCatarino/Lean,QuantConnect/Lean
|
26f501f86401d1ad54b196e020a4430561569e95
|
src/OmniSharp.Abstractions/Configuration.cs
|
src/OmniSharp.Abstractions/Configuration.cs
|
namespace OmniSharp
{
internal static class Configuration
{
public static bool ZeroBasedIndices = false;
public const string RoslynVersion = "2.1.0.0";
public const string RoslynPublicKeyToken = "31bf3856ad364e35";
public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features");
public readonly static string RoslynCSharpFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.CSharp.Features");
public readonly static string RoslynWorkspaces = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Workspaces");
private static string GetRoslynAssemblyFullName(string name)
{
return $"{name}, Version={RoslynVersion}, Culture=neutral, PublicKeyToken={RoslynPublicKeyToken}";
}
}
}
|
namespace OmniSharp
{
internal static class Configuration
{
public static bool ZeroBasedIndices = false;
public const string RoslynVersion = "2.3.0.0";
public const string RoslynPublicKeyToken = "31bf3856ad364e35";
public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features");
public readonly static string RoslynCSharpFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.CSharp.Features");
public readonly static string RoslynWorkspaces = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Workspaces");
private static string GetRoslynAssemblyFullName(string name)
{
return $"{name}, Version={RoslynVersion}, Culture=neutral, PublicKeyToken={RoslynPublicKeyToken}";
}
}
}
|
Update Roslyn version number for assembly loading
|
Update Roslyn version number for assembly loading
|
C#
|
mit
|
DustinCampbell/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn
|
f6dec186e9bb20707c477ac79ce27a5ec225380f
|
projects/ProcessSample/source/ProcessSample.App/Program.cs
|
projects/ProcessSample/source/ProcessSample.App/Program.cs
|
//-----------------------------------------------------------------------
// <copyright file="Program.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace ProcessSample
{
using System;
using System.Diagnostics;
using System.Threading;
internal sealed class Program
{
private static void Main(string[] args)
{
int exitCode;
DateTime exitTime;
using (Process process = Process.Start("notepad.exe"))
using (ProcessExitWatcher watcher = new ProcessExitWatcher(new ProcessExit(process)))
{
Console.WriteLine("Waiting for Notepad to exit...");
watcher.WaitForExitAsync(CancellationToken.None).Wait();
exitCode = watcher.Status.ExitCode;
exitTime = watcher.Status.ExitTime;
}
Console.WriteLine("Done, exited with code {0} at {1}.", exitCode, exitTime);
}
}
}
|
//-----------------------------------------------------------------------
// <copyright file="Program.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace ProcessSample
{
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
internal sealed class Program
{
private static void Main(string[] args)
{
using (CancellationTokenSource cts = new CancellationTokenSource())
{
Task task = StartAndWaitForProcessAsync(cts.Token);
Console.WriteLine("Press ENTER to quit.");
Console.ReadLine();
cts.Cancel();
try
{
task.Wait();
}
catch (AggregateException ae)
{
ae.Handle(e => e is OperationCanceledException);
Console.WriteLine("(Canceled.)");
}
}
}
private static async Task StartAndWaitForProcessAsync(CancellationToken token)
{
int exitCode;
DateTime exitTime;
using (Process process = await Task.Factory.StartNew(() => Process.Start("notepad.exe")))
using (ProcessExitWatcher watcher = new ProcessExitWatcher(new ProcessExit(process)))
{
Console.WriteLine("Waiting for Notepad to exit...");
await watcher.WaitForExitAsync(token);
exitCode = watcher.Status.ExitCode;
exitTime = watcher.Status.ExitTime;
}
Console.WriteLine("Done, exited with code {0} at {1}.", exitCode, exitTime);
}
}
}
|
Use async method in main program
|
Use async method in main program
|
C#
|
unlicense
|
brian-dot-net/writeasync,brian-dot-net/writeasync,brian-dot-net/writeasync
|
69c1dd61d2143bc4697c7da94b6b98ffd948427e
|
ProgressBarComponent/Views/Home/Index.cshtml
|
ProgressBarComponent/Views/Home/Index.cshtml
|
@{
ViewData["Title"] = "Home Page";
}
.<div class="row">
<div class="col-xs-12">
<div bs-progress-min="1"
bs-progress-max="5"
bs-progress-value="4">
</div>
</div>
</div>
|
@{
ViewData["Title"] = "Home Page";
}
<div class="row">
<div class="col-xs-6 col-md-4">
<div href="#" class="thumbnail">
<h3>Progress Bar Default</h3>
<p>
<code>progress-bar</code>
</p>
<div bs-progress-min="1"
bs-progress-max="100"
bs-progress-value="45">
</div>
<pre class="pre-scrollable">
<div bs-progress-min="1"
bs-progress-max="100"
bs-progress-value="45">
</div></pre>
</div>
</div>
<div class="col-xs-6 col-md-4">
<div href="#" class="thumbnail">
<h3>Progress Bar Animated</h3>
<p>
<code>progress-bar progress-bar-success progress-bar-striped active</code>
</p>
<div bs-progress-style="success"
bs-progress-min="1"
bs-progress-max="5"
bs-progress-value="4"
bs-progress-active="true">
</div>
<pre class="pre-scrollable">
<div bs-progress-style="success"
bs-progress-min="1"
bs-progress-max="5"
bs-progress-value="4"
bs-progress-active="true">
</div></pre>
</div>
</div>
<div class="col-xs-6 col-md-4">
<div href="#" class="thumbnail">
<h3>Progress Bar Striped</h3>
<p>
<code>progress-bar progress-bar-danger progress-bar-striped</code>
</p>
<div bs-progress-min="1"
bs-progress-max="100"
bs-progress-value="80"
bs-progress-style="danger"
bs-progress-striped="true"
bs-progress-label-visible="false">
</div>
<pre class="pre-scrollable">
<div bs-progress-min="1"
bs-progress-max="100"
bs-progress-value="80"
bs-progress-style="danger"
bs-progress-striped="true"
bs-progress-label-visible="false">
</div></pre>
</div>
</div>
</div>
|
Use updated TagHelper on home page
|
Use updated TagHelper on home page
|
C#
|
mit
|
peterblazejewicz/asp5-mvc6-examples,peterblazejewicz/asp5-mvc6-examples,peterblazejewicz/asp5-mvc6-examples,peterblazejewicz/asp5-mvc6-examples
|
77f0b9b78c19a5eaf2dd63218b3f56272106b3b4
|
game.cs
|
game.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Hangman {
public class Game {
public string Word;
private List<char> GuessedLetters;
private string StatusMessage;
public Game(string word) {
Word = word;
GuessedLetters = new List<char>();
StatusMessage = "Press any letter to guess!";
}
public string ShownWord() {
var obscuredWord = new StringBuilder();
foreach (char letter in Word) {
obscuredWord.Append(ShownLetterFor(letter));
}
return obscuredWord.ToString();
}
public string Status() {
return StatusMessage;
}
public bool GuessLetter(char letter) {
GuessedLetters.Add(letter);
return LetterIsCorrect(letter);
}
private char ShownLetterFor(char originalLetter) {
if (LetterWasGuessed(originalLetter) || originalLetter == ' ') {
return originalLetter;
} else {
return '_';
}
}
private bool LetterWasGuessed(char letter) {
return GuessedLetters.Contains(letter);
}
private bool LetterIsCorrect(char letter) {
return Word.Contains(letter.ToString());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Hangman {
public class Game {
public string Word;
private List<char> GuessedLetters;
private string StatusMessage;
public Game(string word) {
Word = word;
GuessedLetters = new List<char>();
StatusMessage = "Press any letter to guess!";
}
public string ShownWord() {
var obscuredWord = new StringBuilder();
foreach (char letter in Word) {
obscuredWord.Append(ShownLetterFor(letter));
}
return obscuredWord.ToString();
}
public string Status() {
return StatusMessage;
}
public bool GuessLetter(char letter) {
GuessedLetters.Add(letter);
bool correct = LetterIsCorrect(letter);
if (correct) {
StatusMessage = "Correct! Guess again!";
} else {
StatusMessage = "Incorrect! Try again!";
}
// CheckGameOver();
return correct;
}
private char ShownLetterFor(char originalLetter) {
if (LetterWasGuessed(originalLetter) || originalLetter == ' ') {
return originalLetter;
} else {
return '_';
}
}
private bool LetterWasGuessed(char letter) {
return GuessedLetters.Contains(letter);
}
private bool LetterIsCorrect(char letter) {
return Word.Contains(letter.ToString());
}
}
}
|
Update status message for last guess
|
Update status message for last guess
|
C#
|
unlicense
|
12joan/hangman
|
5b44b6efce0556b0c58742696ba0e7bd3e541c3c
|
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/Users/OAuth/TraktUserCustomListAddRequestTests.cs
|
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/Users/OAuth/TraktUserCustomListAddRequestTests.cs
|
namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TraktApiSharp.Experimental.Requests.Base.Post;
using TraktApiSharp.Experimental.Requests.Users.OAuth;
using TraktApiSharp.Objects.Get.Users.Lists;
using TraktApiSharp.Objects.Post.Users;
[TestClass]
public class TraktUserCustomListAddRequestTests
{
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListAddRequestIsNotAbstract()
{
typeof(TraktUserCustomListAddRequest).IsAbstract.Should().BeFalse();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListAddRequestIsSealed()
{
typeof(TraktUserCustomListAddRequest).IsSealed.Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListAddRequestIsSubclassOfATraktSingleItemPostRequest()
{
typeof(TraktUserCustomListAddRequest).IsSubclassOf(typeof(ATraktSingleItemPostRequest<TraktList, TraktUserCustomListPost>)).Should().BeTrue();
}
}
}
|
namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TraktApiSharp.Experimental.Requests.Base.Post;
using TraktApiSharp.Experimental.Requests.Users.OAuth;
using TraktApiSharp.Objects.Get.Users.Lists;
using TraktApiSharp.Objects.Post.Users;
using TraktApiSharp.Requests;
[TestClass]
public class TraktUserCustomListAddRequestTests
{
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListAddRequestIsNotAbstract()
{
typeof(TraktUserCustomListAddRequest).IsAbstract.Should().BeFalse();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListAddRequestIsSealed()
{
typeof(TraktUserCustomListAddRequest).IsSealed.Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListAddRequestIsSubclassOfATraktSingleItemPostRequest()
{
typeof(TraktUserCustomListAddRequest).IsSubclassOf(typeof(ATraktSingleItemPostRequest<TraktList, TraktUserCustomListPost>)).Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListAddRequestHasAuthorizationRequired()
{
var request = new TraktUserCustomListAddRequest(null);
request.AuthorizationRequirement.Should().Be(TraktAuthorizationRequirement.Required);
}
}
}
|
Add test for authorization requirement in TraktUserCustomListAddRequest
|
Add test for authorization requirement in TraktUserCustomListAddRequest
|
C#
|
mit
|
henrikfroehling/TraktApiSharp
|
ab8481215c11df4c2f76a46ec193b8cb69e3ae41
|
JustSaying.IntegrationTests/WhenRegisteringHandlersViaResolver/WhenRegisteringABlockingHandlerViaContainer.cs
|
JustSaying.IntegrationTests/WhenRegisteringHandlersViaResolver/WhenRegisteringABlockingHandlerViaContainer.cs
|
using System.Linq;
using NUnit.Framework;
using Shouldly;
using StructureMap;
namespace JustSaying.IntegrationTests.WhenRegisteringHandlersViaResolver
{
public class WhenRegisteringABlockingHandlerViaContainer : GivenAPublisher
{
private BlockingOrderProcessor _resolvedHandler;
protected override void Given()
{
var container = new Container(x => x.AddRegistry(new BlockingHandlerRegistry()));
var handlerResolver = new StructureMapHandlerResolver(container);
var handlers = handlerResolver.ResolveHandlers<OrderPlaced>().ToList();
Assert.That(handlers.Count, Is.EqualTo(1));
_resolvedHandler = (BlockingOrderProcessor)handlers[0];
DoneSignal = _resolvedHandler.DoneSignal.Task;
var subscriber = CreateMeABus.InRegion("eu-west-1")
.WithSqsTopicSubscriber()
.IntoQueue("container-test")
.WithMessageHandler<OrderPlaced>(handlerResolver);
subscriber.StartListening();
}
[Test]
public void ThenHandlerWillReceiveTheMessage()
{
_resolvedHandler.ReceivedMessageCount.ShouldBeGreaterThan(0);
}
}
}
|
using System.Linq;
using JustSaying.Messaging.MessageHandling;
using NUnit.Framework;
using Shouldly;
using StructureMap;
namespace JustSaying.IntegrationTests.WhenRegisteringHandlersViaResolver
{
public class WhenRegisteringABlockingHandlerViaContainer : GivenAPublisher
{
private BlockingOrderProcessor _resolvedHandler;
protected override void Given()
{
var container = new Container(x => x.AddRegistry(new BlockingHandlerRegistry()));
var handlerResolver = new StructureMapHandlerResolver(container);
var handlers = handlerResolver.ResolveHandlers<OrderPlaced>().ToList();
Assert.That(handlers.Count, Is.EqualTo(1));
var blockingHandler = (BlockingHandler<OrderPlaced>)handlers[0];
_resolvedHandler = (BlockingOrderProcessor)blockingHandler.Inner;
DoneSignal = _resolvedHandler.DoneSignal.Task;
var subscriber = CreateMeABus.InRegion("eu-west-1")
.WithSqsTopicSubscriber()
.IntoQueue("container-test")
.WithMessageHandler<OrderPlaced>(handlerResolver);
subscriber.StartListening();
}
[Test]
public void ThenHandlerWillReceiveTheMessage()
{
_resolvedHandler.ReceivedMessageCount.ShouldBeGreaterThan(0);
}
}
}
|
Fix to dodgy cast in test
|
Fix to dodgy cast in test
|
C#
|
apache-2.0
|
eric-davis/JustSaying,Intelliflo/JustSaying,Intelliflo/JustSaying
|
72a58731bb7ddfaf35c14cb4362b49451d4dfdbf
|
src/ReadLine/ReadLine.cs
|
src/ReadLine/ReadLine.cs
|
using System;
namespace ReadLine
{
public static class ReadLine
{
private static KeyHandler _keyHandler;
static ReadLine()
{
_keyHandler = new KeyHandler();
}
public static string Read()
{
ConsoleKeyInfo keyInfo = Console.ReadKey(true);
while (keyInfo.Key != ConsoleKey.Enter)
{
_keyHandler.Handle(keyInfo);
keyInfo = Console.ReadKey(true);
}
return _keyHandler.Text;
}
}
}
|
using System;
namespace ReadLine
{
public static class ReadLine
{
private static KeyHandler _keyHandler;
public static string Read()
{
_keyHandler = new KeyHandler();
ConsoleKeyInfo keyInfo = Console.ReadKey(true);
while (keyInfo.Key != ConsoleKey.Enter)
{
_keyHandler.Handle(keyInfo);
keyInfo = Console.ReadKey(true);
}
return _keyHandler.Text;
}
}
}
|
Create new instance of KeyHandler on every call to Read method
|
Create new instance of KeyHandler on every call to Read method
|
C#
|
mit
|
tsolarin/readline,tsolarin/readline
|
ff4f9861369a0669c99f00aa41c29c785f6e6ced
|
UsageExample.cs
|
UsageExample.cs
|
// Unzip class usage example
// Written by Alexey Yakovlev <yallie@yandex.ru>
// https://github.com/yallie/unzip
using System;
using System.Linq;
namespace Internals
{
internal struct Program
{
private static void Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Syntax: unzip Archive.zip TargetDirectory");
return;
}
var archiveName = args.First();
var outputDirectory = args.Last();
using (var unzip = new Unzip(archiveName))
{
ListFiles(unzip);
unzip.ExtractToDirectory(outputDirectory);
}
}
private static void ListFiles(Unzip unzip)
{
var tab = unzip.Entries.Any(e => e.IsDirectory) ? "\t" : string.Empty;
foreach (var entry in unzip.Entries.OrderBy(e => e.Name))
{
if (entry.IsFile)
{
Console.WriteLine(tab + "{0}: {1} -> {2}", entry.Name, entry.CompressedSize, entry.OriginalSize);
}
else if (entry.IsDirectory)
{
Console.WriteLine(entry.Name);
}
}
}
}
}
|
// Unzip class usage example
// Written by Alexey Yakovlev <yallie@yandex.ru>
// https://github.com/yallie/unzip
using System;
using System.Linq;
namespace Internals
{
internal struct Program
{
private static void Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Syntax: unzip Archive.zip TargetDirectory");
return;
}
var archiveName = args.First();
var outputDirectory = args.Last();
using (var unzip = new Unzip(archiveName))
{
ListFiles(unzip);
unzip.ExtractToDirectory(outputDirectory);
}
}
private static void ListFiles(Unzip unzip)
{
var tab = unzip.Entries.Any(e => e.IsDirectory) ? "\t" : string.Empty;
foreach (var entry in unzip.Entries.OrderBy(e => e.Name))
{
if (entry.IsFile)
{
Console.WriteLine(tab + "{0}: {1} -> {2}", entry.Name, entry.CompressedSize, entry.OriginalSize);
}
else if (entry.IsDirectory)
{
Console.WriteLine(entry.Name);
}
}
}
}
}
|
Use tabs instead of spaces.
|
Use tabs instead of spaces.
|
C#
|
mit
|
yallie/unzip
|
c457ecf07a29718acca8c18098af9f504df48949
|
Source/Totem/Tracking/TrackedEvent.cs
|
Source/Totem/Tracking/TrackedEvent.cs
|
using System;
namespace Totem.Tracking
{
/// <summary>
/// A timeline event tracked by an index
/// </summary>
public class TrackedEvent
{
public TrackedEvent(string eventType, long eventPosition, Id userId, DateTime eventWhen, string keyType, string keyValue)
{
EventType = eventType;
EventPosition = eventPosition;
UserId = userId;
EventWhen = eventWhen;
KeyType = keyType;
KeyValue = keyValue;
}
public string EventType;
public long EventPosition;
public Id UserId;
public DateTime EventWhen;
public string KeyType;
public string KeyValue;
}
}
|
using System;
namespace Totem.Tracking
{
/// <summary>
/// A timeline event tracked by an index
/// </summary>
public class TrackedEvent
{
protected TrackedEvent()
{}
public TrackedEvent(string eventType, long eventPosition, Id userId, DateTime eventWhen, string keyType, string keyValue)
{
EventType = eventType;
EventPosition = eventPosition;
UserId = userId;
EventWhen = eventWhen;
KeyType = keyType;
KeyValue = keyValue;
}
public string EventType;
public long EventPosition;
public Id UserId;
public DateTime EventWhen;
public string KeyType;
public string KeyValue;
}
}
|
Add missing constructor for derived tracking events
|
Add missing constructor for derived tracking events
|
C#
|
mit
|
bwatts/Totem,bwatts/Totem
|
714fa6c2fc6b22cfb23f4a2ae1f43e2cebf197ed
|
CoCo/NLog.cs
|
CoCo/NLog.cs
|
using NLog;
using NLog.Config;
using NLog.Targets;
namespace CoCo
{
internal static class NLog
{
internal static void Initialize()
{
LoggingConfiguration config = new LoggingConfiguration();
FileTarget fileTarget = new FileTarget("File");
FileTarget fileDebugTarget = new FileTarget("File debug");
fileTarget.Layout = "${date}___${level}___${message}";
fileTarget.FileName = @"${nlogdir}\file.log";
fileDebugTarget.Layout = "${date}___${level}___${message}${newline}${stacktrace}";
fileDebugTarget.FileName = @"${nlogdir}\file_debug.log";
config.AddTarget(fileTarget);
config.AddTarget(fileDebugTarget);
config.AddRule(LogLevel.Debug, LogLevel.Debug, fileDebugTarget, "*");
config.AddRule(LogLevel.Info, LogLevel.Fatal, fileTarget, "*");
//LogManager.ThrowConfigExceptions = true;
//LogManager.ThrowExceptions = true;
LogManager.Configuration = config;
}
}
}
|
using System;
using System.IO;
using NLog;
using NLog.Config;
using NLog.Targets;
namespace CoCo
{
internal static class NLog
{
internal static void Initialize()
{
string appDataLocal = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\CoCo";
if (!Directory.Exists(appDataLocal))
{
Directory.CreateDirectory(appDataLocal);
}
LoggingConfiguration config = new LoggingConfiguration();
FileTarget fileTarget = new FileTarget("File");
FileTarget fileDebugTarget = new FileTarget("File debug");
fileTarget.Layout = "${date}___${level}___${message}";
fileTarget.FileName = $"{appDataLocal}\\file.log";
fileDebugTarget.Layout = "${date}___${level}___${message}${newline}${stacktrace}";
fileDebugTarget.FileName = $"{appDataLocal}\\file_debug.log";
config.AddTarget(fileTarget);
config.AddTarget(fileDebugTarget);
config.AddRule(LogLevel.Debug, LogLevel.Debug, fileDebugTarget, "*");
config.AddRule(LogLevel.Info, LogLevel.Fatal, fileTarget, "*");
//LogManager.ThrowConfigExceptions = true;
//LogManager.ThrowExceptions = true;
LogManager.Configuration = config;
}
}
}
|
Move log files to local application data.
|
Move log files to local application data.
|
C#
|
mit
|
GeorgeAlexandria/CoCo
|
381bc7d8c2ecfb5c24c75520480ad67983139e3e
|
source/Cosmos.Build.Tasks/CreateGrubConfig.cs
|
source/Cosmos.Build.Tasks/CreateGrubConfig.cs
|
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Cosmos.Build.Tasks
{
public class CreateGrubConfig: Task
{
[Required]
public string TargetDirectory { get; set; }
[Required]
public string BinName { get; set; }
private string Indentation = " ";
public override bool Execute()
{
if (!Directory.Exists(TargetDirectory))
{
Log.LogError($"Invalid target directory! Target directory: '{TargetDirectory}'");
return false;
}
var xBinName = BinName;
var xLabelName = Path.GetFileNameWithoutExtension(xBinName);
using (var xWriter = File.CreateText(Path.Combine(TargetDirectory + "/boot/grub/", "grub.cfg")))
{
xWriter.WriteLine("insmod vbe");
xWriter.WriteLine("insmod vga");
xWriter.WriteLine("insmod video_bochs");
xWriter.WriteLine("insmod video_cirrus");
xWriter.WriteLine("set root='(hd0,msdos1)'");
xWriter.WriteLine();
xWriter.WriteLine("menuentry '" + xLabelName + "' {");
WriteIndentedLine(xWriter, "multiboot /boot/" + xBinName + " vid=preset,1024,768 hdd=0");
WriteIndentedLine(xWriter, "set gfxpayload=800x600x32");
WriteIndentedLine(xWriter, "boot");
xWriter.WriteLine("}");
}
return true;
}
private void WriteIndentedLine(TextWriter aWriter, string aText)
{
aWriter.WriteLine(Indentation + aText);
}
}
}
|
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Cosmos.Build.Tasks
{
public class CreateGrubConfig: Task
{
[Required]
public string TargetDirectory { get; set; }
[Required]
public string BinName { get; set; }
private string Indentation = " ";
public override bool Execute()
{
if (!Directory.Exists(TargetDirectory))
{
Log.LogError($"Invalid target directory! Target directory: '{TargetDirectory}'");
return false;
}
var xBinName = BinName;
var xLabelName = Path.GetFileNameWithoutExtension(xBinName);
using (var xWriter = File.CreateText(Path.Combine(TargetDirectory + "/boot/grub/", "grub.cfg")))
{
xWriter.WriteLine("menuentry '" + xLabelName + "' {");
WriteIndentedLine(xWriter, "multiboot /boot/" + xBinName);
xWriter.WriteLine("}");
}
return true;
}
private void WriteIndentedLine(TextWriter aWriter, string aText)
{
aWriter.WriteLine(Indentation + aText);
}
}
}
|
Update grubconfig according to osdev.org
|
Update grubconfig according to osdev.org
https://wiki.osdev.org/Bare_Bones
|
C#
|
bsd-3-clause
|
CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos
|
95b1997c14bb6fb7e2e68dd156f4feee3d139fec
|
src/Microsoft.AspNet.Hosting/Program.cs
|
src/Microsoft.AspNet.Hosting/Program.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Hosting.Internal;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Runtime;
namespace Microsoft.AspNet.Hosting
{
public class Program
{
private const string HostingIniFile = "Microsoft.AspNet.Hosting.ini";
private readonly IServiceProvider _serviceProvider;
public Program(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public void Main(string[] args)
{
var config = new Configuration();
if (File.Exists(HostingIniFile))
{
config.AddIniFile(HostingIniFile);
}
config.AddEnvironmentVariables();
config.AddCommandLine(args);
var host = new WebHostBuilder(_serviceProvider, config).Build();
var serverShutdown = host.Start();
var loggerFactory = host.ApplicationServices.GetRequiredService<ILoggerFactory>();
var appShutdownService = host.ApplicationServices.GetRequiredService<IApplicationShutdown>();
var shutdownHandle = new ManualResetEvent(false);
appShutdownService.ShutdownRequested.Register(() =>
{
try
{
serverShutdown.Dispose();
}
catch (Exception ex)
{
var logger = loggerFactory.CreateLogger<Program>();
logger.LogError("Dispose threw an exception.", ex);
}
shutdownHandle.Set();
});
var ignored = Task.Run(() =>
{
Console.WriteLine("Started");
Console.ReadLine();
appShutdownService.RequestShutdown();
});
shutdownHandle.WaitOne();
}
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using Microsoft.AspNet.Hosting.Internal;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime;
namespace Microsoft.AspNet.Hosting
{
public class Program
{
private const string HostingIniFile = "Microsoft.AspNet.Hosting.ini";
private readonly IServiceProvider _serviceProvider;
public Program(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public void Main(string[] args)
{
var config = new Configuration();
if (File.Exists(HostingIniFile))
{
config.AddIniFile(HostingIniFile);
}
config.AddEnvironmentVariables();
config.AddCommandLine(args);
var host = new WebHostBuilder(_serviceProvider, config).Build();
using (host.Start())
{
var appShutdownService = host.ApplicationServices.GetRequiredService<IApplicationShutdown>();
Console.CancelKeyPress += delegate { appShutdownService.RequestShutdown(); };
appShutdownService.ShutdownRequested.WaitHandle.WaitOne();
}
}
}
}
|
Simplify Hosting's shutdown handling. Don't require a TTY on Unix.
|
Simplify Hosting's shutdown handling.
Don't require a TTY on Unix.
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
23f7710ff746c8731b2b4fed021fcffe799db1b3
|
src/Serilog/Core/ForContextExtension.cs
|
src/Serilog/Core/ForContextExtension.cs
|
using System;
using Serilog.Events;
namespace Serilog
{
/// <summary>
/// Extension method 'ForContext' for ILogger.
/// </summary>
public static class ForContextExtension
{
/// <summary>
/// Create a logger that enriches log events with the specified property based on log event level.
/// </summary>
/// <typeparam name="TValue"> The type of the property value. </typeparam>
/// <param name="logger">The logger</param>
/// <param name="level">The log event level used to determine if log is enriched with property.</param>
/// <param name="propertyName">The name of the property. Must be non-empty.</param>
/// <param name="value">The property value.</param>
/// <param name="destructureObjects">If true, the value will be serialized as a structured
/// object if possible; if false, the object will be recorded as a scalar or simple array.</param>
/// <returns>A logger that will enrich log events as specified.</returns>
/// <returns></returns>
public static ILogger ForContext<TValue>(
this ILogger logger,
LogEventLevel level,
string propertyName,
TValue value,
bool destructureObjects = false)
{
if (logger == null)
throw new ArgumentNullException(nameof(logger));
return !logger.IsEnabled(level)
? logger
: logger.ForContext(propertyName, value, destructureObjects);
}
}
}
|
using System;
using Serilog.Events;
namespace Serilog
{
/// <summary>
/// Extension method 'ForContext' for ILogger.
/// </summary>
public static class ForContextExtension
{
/// <summary>
/// Create a logger that enriches log events with the specified property based on log event level.
/// </summary>
/// <typeparam name="TValue"> The type of the property value. </typeparam>
/// <param name="logger">The logger</param>
/// <param name="level">The log event level used to determine if log is enriched with property.</param>
/// <param name="propertyName">The name of the property. Must be non-empty.</param>
/// <param name="value">The property value.</param>
/// <param name="destructureObjects">If true, the value will be serialized as a structured
/// object if possible; if false, the object will be recorded as a scalar or simple array.</param>
/// <returns>A logger that will enrich log events as specified.</returns>
/// <returns></returns>
public static ILogger ForContext<TValue>(
this ILogger logger,
LogEventLevel level,
string propertyName,
TValue value,
bool destructureObjects = false)
{
if (logger == null)
throw new ArgumentNullException(nameof(logger));
return logger.IsEnabled(level)
? logger.ForContext(propertyName, value, destructureObjects)
: logger;
}
}
}
|
Simplify ternary operation (not !)
|
Simplify ternary operation (not !)
Relates to #1002
|
C#
|
apache-2.0
|
serilog/serilog,CaioProiete/serilog,merbla/serilog,serilog/serilog,merbla/serilog
|
451ab41583ea2b9f144939f75994281402dbd61f
|
osu.Framework/Input/GameWindowTextInput.cs
|
osu.Framework/Input/GameWindowTextInput.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Extensions;
using osu.Framework.Platform;
namespace osu.Framework.Input
{
public class GameWindowTextInput : ITextInputSource
{
private readonly IWindow window;
private string pending = string.Empty;
public GameWindowTextInput(IWindow window)
{
this.window = window;
}
protected virtual void HandleKeyPress(object sender, osuTK.KeyPressEventArgs e) => pending += e.KeyChar;
public bool ImeActive => false;
public string GetPendingText()
{
try
{
return pending;
}
finally
{
pending = string.Empty;
}
}
public void Deactivate(object sender)
{
window.AsLegacyWindow().KeyPress -= HandleKeyPress;
}
public void Activate(object sender)
{
window.AsLegacyWindow().KeyPress += HandleKeyPress;
}
private void imeCompose()
{
//todo: implement
OnNewImeComposition?.Invoke(string.Empty);
}
private void imeResult()
{
//todo: implement
OnNewImeResult?.Invoke(string.Empty);
}
public event Action<string> OnNewImeComposition;
public event Action<string> OnNewImeResult;
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Extensions;
using osu.Framework.Platform;
namespace osu.Framework.Input
{
public class GameWindowTextInput : ITextInputSource
{
private readonly IWindow window;
private string pending = string.Empty;
public GameWindowTextInput(IWindow window)
{
this.window = window;
}
protected virtual void HandleKeyPress(object sender, osuTK.KeyPressEventArgs e) => pending += e.KeyChar;
protected virtual void HandleKeyTyped(char c) => pending += c;
public bool ImeActive => false;
public string GetPendingText()
{
try
{
return pending;
}
finally
{
pending = string.Empty;
}
}
public void Deactivate(object sender)
{
if (window is Window win)
win.KeyTyped -= HandleKeyTyped;
else
window.AsLegacyWindow().KeyPress -= HandleKeyPress;
}
public void Activate(object sender)
{
if (window is Window win)
win.KeyTyped += HandleKeyTyped;
else
window.AsLegacyWindow().KeyPress += HandleKeyPress;
}
private void imeCompose()
{
//todo: implement
OnNewImeComposition?.Invoke(string.Empty);
}
private void imeResult()
{
//todo: implement
OnNewImeResult?.Invoke(string.Empty);
}
public event Action<string> OnNewImeComposition;
public event Action<string> OnNewImeResult;
}
}
|
Fix text input for SDL
|
Fix text input for SDL
|
C#
|
mit
|
ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework
|
7f12f87e78073917594e46b5b32425ad1a863196
|
Albireo.Otp.ConsoleApplication/Program.cs
|
Albireo.Otp.ConsoleApplication/Program.cs
|
namespace Albireo.Otp.ConsoleApplication
{
using System;
public static class Program
{
public static void Main()
{
Console.Title = "One-Time Password Generator";
}
}
}
|
namespace Albireo.Otp.ConsoleApplication
{
using System;
public static class Program
{
public static void Main()
{
Console.Title = "C# One-Time Password";
}
}
}
|
Fix console application window title
|
Fix console application window title
|
C#
|
mit
|
kappa7194/otp
|
bd4662f635217c373ca8297876887e10e10baa03
|
Algorithms/Search/BinarySearch.cs
|
Algorithms/Search/BinarySearch.cs
|
using System;
using System.Security.Cryptography;
using Algorithms.Utils;
namespace Algorithms.Search
{
public class BinarySearch
{
public static int IndexOf<T>(T[] a, T v) where T: IComparable<T>
{
var lo = 0;
var hi = a.Length - 1;
int comparison(T a1, T a2) => a1.CompareTo(a2);
while (lo <= hi)
{
int mid = lo + (hi - lo) / 2;
if (SortUtil.IsLessThan(a[mid], v, comparison)) lo = mid;
else if (SortUtil.IsGreaterThan(a[mid], v, comparison)) hi = mid;
}
return -1;
}
}
}
|
using System;
using System.Security.Cryptography;
using Algorithms.Utils;
namespace Algorithms.Search
{
public class BinarySearch
{
public static int IndexOf<T>(T[] a, T v) where T: IComparable<T>
{
var lo = 0;
var hi = a.Length - 1;
int comparison(T a1, T a2) => a1.CompareTo(a2);
while (lo <= hi)
{
int mid = lo + (hi - lo) / 2;
if (SortUtil.IsLessThan(a[mid], v, comparison)) lo = mid+1;
else if (SortUtil.IsGreaterThan(a[mid], v, comparison)) hi = mid - 1;
else return mid;
}
return -1;
}
}
}
|
Fix the bug in the binary search
|
Fix the bug in the binary search
|
C#
|
mit
|
cschen1205/cs-algorithms,cschen1205/cs-algorithms
|
8b0b29717b8ba1c5cd0142c9975040260b105bac
|
GitReview/Controllers/ReviewController.cs
|
GitReview/Controllers/ReviewController.cs
|
// -----------------------------------------------------------------------
// <copyright file="ReviewController.cs" company="(none)">
// Copyright © 2015 John Gietzen. All Rights Reserved.
// This source is subject to the MIT license.
// Please see license.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace GitReview.Controllers
{
using System.Web.Http;
using GitReview.Models;
/// <summary>
/// Provides an API for working with reviews.
/// </summary>
public class ReviewController : ApiController
{
/// <summary>
/// Gets the specified review.
/// </summary>
/// <param name="id">The ID of the review to find.</param>
/// <returns>The specified review.</returns>
[Route("reviews/{id}")]
public object Get(string id)
{
return new
{
Reviews = new[]
{
new Review { Id = id },
}
};
}
}
}
|
// -----------------------------------------------------------------------
// <copyright file="ReviewController.cs" company="(none)">
// Copyright © 2015 John Gietzen. All Rights Reserved.
// This source is subject to the MIT license.
// Please see license.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace GitReview.Controllers
{
using System.Net;
using System.Threading.Tasks;
using System.Web.Http;
/// <summary>
/// Provides an API for working with reviews.
/// </summary>
public class ReviewController : ApiController
{
/// <summary>
/// Gets the specified review.
/// </summary>
/// <param name="id">The ID of the review to find.</param>
/// <returns>The specified review.</returns>
[Route("reviews/{id}")]
public async Task<object> Get(string id)
{
using (var ctx = new ReviewContext())
{
var review = await ctx.Reviews.FindAsync(id);
if (review == null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
return new
{
Reviews = new[] { review },
};
}
}
}
}
|
Read reviews from the database.
|
Read reviews from the database.
|
C#
|
mit
|
otac0n/GitReview,otac0n/GitReview,otac0n/GitReview
|
a3e3b18663d62326559dd5a72a1c74921bacda3e
|
CSharpEx.Forms/ControlEx.cs
|
CSharpEx.Forms/ControlEx.cs
|
using System;
using System.Windows.Forms;
namespace CSharpEx.Forms
{
/// <summary>
/// Control extensions
/// </summary>
public static class ControlEx
{
/// <summary>
/// Invoke action if Invoke is requiered.
/// </summary>
public static void InvokeIfRequired<T>(this T c, Action<T> action) where T : Control
{
if (c.InvokeRequired)
{
c.Invoke(new Action(() => action(c)));
}
else
{
action(c);
}
}
}
}
|
using System;
using System.Windows.Forms;
namespace CSharpEx.Forms
{
/// <summary>
/// Control extensions
/// </summary>
public static class ControlEx
{
/// <summary>
/// Invoke action if Invoke is requiered.
/// </summary>
public static void InvokeIfRequired<T>(this T c, Action<T> action) where T : Control
{
if (c.InvokeRequired)
{
c.Invoke(new Action(() => action(c)));
}
else
{
action(c);
}
}
/// <summary>
/// Set DoubleBuffered property using reflection.
/// Call this in the constructor just after InitializeComponent().
/// </summary>
public static void SetDoubleBuffered(this Control control, bool enabled)
{
typeof (Control).InvokeMember("DoubleBuffered",
System.Reflection.BindingFlags.SetProperty |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic,
null,
control,
new object[] {enabled});
}
}
}
|
Set DoubleBuffered property via reflection
|
Set DoubleBuffered property via reflection
|
C#
|
apache-2.0
|
imasm/CSharpExtensions
|
04f61480cab638c4fb4f7087b4fa40056bbb48b5
|
DAQ/Gigatronics7100Synth.cs
|
DAQ/Gigatronics7100Synth.cs
|
using System;
using DAQ.Environment;
namespace DAQ.HAL
{
/// <summary>
/// This class represents a GPIB controlled Gigatronics 7100 arbitrary waveform generator. It conforms to the Synth
/// interface.
/// </summary>
class Gigatronics7100Synth : Synth
{
public Gigatronics7100Synth(String visaAddress)
: base(visaAddress)
{ }
override public double Frequency
{
set
{
if (!Environs.Debug) Write("CW" + value + "MZ"); // the value is entered in MHz
}
}
public override double Amplitude
{
set
{
if (!Environs.Debug) Write("PL" + value + "DM"); // the value is entered in MHz
} // do nothing
}
public override double DCFM
{
set { } // do nothing
}
public override bool DCFMEnabled
{
set { } // do nothing
}
public override bool Enabled
{
set { } // do nothing
}
public double PulseDuration
{
set
{
if (!Environs.Debug)
{
Write("PM4");
Write("PW" + value + "US");
}
}
}
}
}
|
using System;
using DAQ.Environment;
namespace DAQ.HAL
{
/// <summary>
/// This class represents a GPIB controlled Gigatronics 7100 arbitrary waveform generator. It conforms to the Synth
/// interface.
/// </summary>
public class Gigatronics7100Synth : Synth
{
public Gigatronics7100Synth(String visaAddress)
: base(visaAddress)
{ }
override public double Frequency
{
set
{
if (!Environs.Debug) Write("CW" + value + "MZ"); // the value is entered in MHz
}
}
public override double Amplitude
{
set
{
if (!Environs.Debug) Write("PL" + value + "DM"); // the value is entered in dBm
} // do nothing
}
public override double DCFM
{
set { } // do nothing
}
public override bool DCFMEnabled
{
set { } // do nothing
}
public override bool Enabled
{
set
{
if (value)
{
if (!Environs.Debug) Write("RF1");
}
else
{
if (!Environs.Debug) Write("RF0");
}
}
}
public double PulseDuration
{
set
{
if (!Environs.Debug)
{
Write("PM4");
Write("PW" + value + "US");
}
}
}
}
}
|
Add remote rf enable function
|
Add remote rf enable function
|
C#
|
mit
|
Stok/EDMSuite,ColdMatter/EDMSuite,jstammers/EDMSuite,ColdMatter/EDMSuite,ColdMatter/EDMSuite,ColdMatter/EDMSuite,jstammers/EDMSuite,jstammers/EDMSuite,Stok/EDMSuite,jstammers/EDMSuite,jstammers/EDMSuite
|
c7c7115dedbd2d967a18cb8fbeb349792e262251
|
ProtoScript/Dialogs/SelectBundleDialog.cs
|
ProtoScript/Dialogs/SelectBundleDialog.cs
|
using System;
using System.Windows.Forms;
namespace ProtoScript.Dialogs
{
class SelectBundleDialog : IDisposable
{
private const string kResourceBundleExtension = ".bun";
private readonly OpenFileDialog m_fileDialog;
public SelectBundleDialog()
{
m_fileDialog = new OpenFileDialog
{
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
Filter = "Bundle files|*" + kResourceBundleExtension
};
}
public void ShowDialog()
{
if (m_fileDialog.ShowDialog() == DialogResult.OK)
FileName = m_fileDialog.FileName;
}
public string FileName { get; private set; }
public void Dispose()
{
m_fileDialog.Dispose();
}
}
}
|
using System;
using System.Windows.Forms;
namespace ProtoScript.Dialogs
{
class SelectBundleDialog : IDisposable
{
private const string kResourceBundleExtension = ".zip";
private readonly OpenFileDialog m_fileDialog;
public SelectBundleDialog()
{
m_fileDialog = new OpenFileDialog
{
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
Filter = "Zip files|*" + kResourceBundleExtension
};
}
public void ShowDialog()
{
if (m_fileDialog.ShowDialog() == DialogResult.OK)
FileName = m_fileDialog.FileName;
}
public string FileName { get; private set; }
public void Dispose()
{
m_fileDialog.Dispose();
}
}
}
|
Select Bundle dialog looks for zip files
|
Select Bundle dialog looks for zip files
|
C#
|
mit
|
sillsdev/Glyssen,sillsdev/Glyssen
|
a06c2fc96f4fc9f1591d823eecec67bd135a1822
|
ExampleGenerator/Misc/BindingExamples.cs
|
ExampleGenerator/Misc/BindingExamples.cs
|
namespace ExampleGenerator
{
using OxyPlot;
public static class BindingExamples
{
[Export(@"BindingExamples\Example1")]
public static PlotModel Example1()
{
return null;
}
}
}
|
namespace ExampleGenerator
{
using OxyPlot;
public static class BindingExamples
{
[Export(@"BindingExamples\Example1")]
public static PlotModel Example1()
{
return new PlotModel { Title = "TODO" };
}
}
}
|
Fix example that caused exception
|
Fix example that caused exception
|
C#
|
mit
|
oxyplot/documentation-examples
|
f2df98c513610fd2089b2f2e5caf68c5b9c1ba4e
|
GoldenAnvil.Utility/EnumerableUtility.cs
|
GoldenAnvil.Utility/EnumerableUtility.cs
|
using System.Collections.Generic;
using System.Linq;
namespace GoldenAnvil.Utility
{
public static class EnumerableUtility
{
public static IEnumerable<T> Append<T>(this IEnumerable<T> items, T value)
{
foreach (T item in items)
yield return item;
yield return value;
}
public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> items)
{
return items ?? Enumerable.Empty<T>();
}
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> items)
{
return items.Where(x => x != null);
}
public static IEnumerable<T> Enumerate<T>(params T[] items)
{
return items;
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace GoldenAnvil.Utility
{
public static class EnumerableUtility
{
public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> items)
{
return items ?? Enumerable.Empty<T>();
}
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> items)
{
return items.Where(x => x != null);
}
public static IEnumerable<T> Enumerate<T>(params T[] items)
{
return items;
}
public static IReadOnlyList<T> AsReadOnlyList<T>(this IEnumerable<T> items)
{
return items as IReadOnlyList<T> ??
(items is IList<T> list ? (IReadOnlyList<T>) new ReadOnlyListAdapter<T>(list) : items.ToList().AsReadOnly());
}
private sealed class ReadOnlyListAdapter<T> : IReadOnlyList<T>
{
public ReadOnlyListAdapter(IList<T> list) => m_list = list ?? throw new ArgumentNullException(nameof(list));
public int Count => m_list.Count;
public T this[int index] => m_list[index];
public IEnumerator<T> GetEnumerator() => m_list.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable) m_list).GetEnumerator();
readonly IList<T> m_list;
}
}
}
|
Add AsReadOnlyList; Remove obsolete method
|
Add AsReadOnlyList; Remove obsolete method
|
C#
|
mit
|
SaberSnail/GoldenAnvil.Utility
|
c6947507c674dbcbc77cb42038c45bc78896a009
|
EvoNet/Forms/MainForm.cs
|
EvoNet/Forms/MainForm.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using EvoNet.Controls;
using Graph;
using EvoNet.Map;
namespace EvoNet.Forms
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
foodValueList.Color = Color.Green;
FoodGraph.Add("Food", foodValueList);
evoSimControl1.OnUpdate += EvoSimControl1_OnUpdate;
}
private void EvoSimControl1_OnUpdate(Microsoft.Xna.Framework.GameTime obj)
{
}
GraphValueList foodValueList = new GraphValueList();
int lastFoodIndex = 0;
private void exitToolStripMenuItem1_Click(object sender, EventArgs e)
{
Close();
}
private TileMap TileMap
{
get
{
return evoSimControl1.sim.TileMap;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
float Value = TileMap.FoodRecord.Skip(lastFoodIndex).Average();
lastFoodIndex = TileMap.FoodRecord.Count;
foodValueList.Add(new GraphTimeDoubleValue(DateTime.Now, Value));
FoodGraph.Refresh();
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using EvoNet.Controls;
using Graph;
using EvoNet.Map;
namespace EvoNet.Forms
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
foodValueList.Color = Color.Green;
FoodGraph.Add("Food", foodValueList);
evoSimControl1.OnUpdate += EvoSimControl1_OnUpdate;
}
private void EvoSimControl1_OnUpdate(Microsoft.Xna.Framework.GameTime obj)
{
}
GraphValueList foodValueList = new GraphValueList();
int lastFoodIndex = 0;
private void exitToolStripMenuItem1_Click(object sender, EventArgs e)
{
Close();
}
private TileMap TileMap
{
get
{
return evoSimControl1.sim.TileMap;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (TileMap.FoodRecord.Count > lastFoodIndex)
{
float Value = TileMap.FoodRecord.Skip(lastFoodIndex).Average();
lastFoodIndex = TileMap.FoodRecord.Count;
foodValueList.Add(new GraphTimeDoubleValue(DateTime.Now, Value));
FoodGraph.Refresh();
}
}
}
}
|
Check for empty array on food record
|
Check for empty array on food record
|
C#
|
mit
|
pampersrocker/EvoNet
|
f07b4c7c10770df9618989a30cdff7794ca4820b
|
RedGate.AppHost.Client/ParentProcessMonitor.cs
|
RedGate.AppHost.Client/ParentProcessMonitor.cs
|
using System;
using System.Diagnostics;
using System.Threading;
namespace RedGate.AppHost.Client
{
internal class ParentProcessMonitor
{
private readonly Action m_OnParentMissing;
private readonly int m_PollingIntervalInSeconds;
private Thread m_PollingThread;
public ParentProcessMonitor(Action onParentMissing, int pollingIntervalInSeconds = 10)
{
if (onParentMissing == null)
{
throw new ArgumentNullException("onParentMissing");
}
m_OnParentMissing = onParentMissing;
m_PollingIntervalInSeconds = pollingIntervalInSeconds;
}
public void Start()
{
m_PollingThread = new Thread(PollForParentProcess);
m_PollingThread.Start();
}
private void PollForParentProcess()
{
var currentProcess = Process.GetCurrentProcess();
var parentProcessId = currentProcess.GetParentProcessId();
try
{
while (true)
{
Process.GetProcessById(parentProcessId);
Thread.Sleep(m_PollingIntervalInSeconds * 1000);
}
}
catch
{
m_OnParentMissing();
}
}
}
}
|
using System;
using System.Diagnostics;
using System.Runtime.Remoting.Channels;
using System.Threading;
namespace RedGate.AppHost.Client
{
internal class ParentProcessMonitor
{
private readonly Action m_OnParentMissing;
public ParentProcessMonitor(Action onParentMissing)
{
if (onParentMissing == null)
{
throw new ArgumentNullException("onParentMissing");
}
m_OnParentMissing = onParentMissing;
}
public void Start()
{
var currentProcess = Process.GetCurrentProcess();
var parentProcessId = currentProcess.GetParentProcessId();
var parentProcess = Process.GetProcessById(parentProcessId);
parentProcess.EnableRaisingEvents = true;
parentProcess.Exited += (sender, e) => { m_OnParentMissing(); };
}
}
}
|
Replace the polling with an event handler
|
Replace the polling with an event handler
|
C#
|
apache-2.0
|
nycdotnet/RedGate.AppHost,red-gate/RedGate.AppHost
|
83350116d923f2ed78c84fd1409ebf36970c6ce2
|
alert-roster.web/Views/Home/Index.cshtml
|
alert-roster.web/Views/Home/Index.cshtml
|
@model IEnumerable<alert_roster.web.Models.Message>
@{
ViewBag.Title = "Messages";
}
<div class="jumbotron">
<h1>@ViewBag.Title</h1>
</div>
@foreach (var message in Model)
{
<div class="row">
<div class="col-md-4">
<fieldset>
<legend>
<script>var d = moment.utc('@message.PostedDate').local(); document.write(d);</script>
</legend>
@message.Content
</fieldset>
</div>
</div>
}
|
@model IEnumerable<alert_roster.web.Models.Message>
@{
ViewBag.Title = "Notices";
}
<h2>@ViewBag.Title</h2>
@foreach (var message in Model)
{
<div class="row">
<div class="col-md-5">
<fieldset>
<legend>
Posted <script>var d = moment.utc('@message.PostedDate').local(); document.write(d);</script>
</legend>
@message.Content
</fieldset>
</div>
</div>
}
|
Tweak some of the list page formatting
|
Tweak some of the list page formatting
|
C#
|
mit
|
mattgwagner/alert-roster
|
7f61f27be1e3031266110c0f64a812bc2a787829
|
osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs
|
osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Updater;
namespace osu.Game.Overlays.Settings.Sections.General
{
public class UpdateSettings : SettingsSubsection
{
[Resolved(CanBeNull = true)]
private UpdateManager updateManager { get; set; }
protected override string Header => "Updates";
[BackgroundDependencyLoader]
private void load(Storage storage, OsuConfigManager config, OsuGameBase game)
{
Add(new SettingsEnumDropdown<ReleaseStream>
{
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
});
// We should only display the button for UpdateManagers that do update the client
if (updateManager != null && updateManager.CanPerformUpdate)
{
Add(new SettingsButton
{
Text = "Check for updates",
Action = updateManager.CheckForUpdate,
Enabled = { Value = game.IsDeployedBuild }
});
}
if (RuntimeInfo.IsDesktop)
{
Add(new SettingsButton
{
Text = "Open osu! folder",
Action = storage.OpenInNativeExplorer,
});
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Updater;
namespace osu.Game.Overlays.Settings.Sections.General
{
public class UpdateSettings : SettingsSubsection
{
[Resolved(CanBeNull = true)]
private UpdateManager updateManager { get; set; }
protected override string Header => "Updates";
[BackgroundDependencyLoader]
private void load(Storage storage, OsuConfigManager config, OsuGameBase game)
{
Add(new SettingsEnumDropdown<ReleaseStream>
{
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
});
// We should only display the button for UpdateManagers that do update the client
if (updateManager?.CanPerformUpdate == true)
{
Add(new SettingsButton
{
Text = "Check for updates",
Action = updateManager.CheckForUpdate,
Enabled = { Value = game.IsDeployedBuild }
});
}
if (RuntimeInfo.IsDesktop)
{
Add(new SettingsButton
{
Text = "Open osu! folder",
Action = storage.OpenInNativeExplorer,
});
}
}
}
}
|
Use null-conditional operator when checking against UpdateManager
|
Use null-conditional operator when checking against UpdateManager
Co-authored-by: Dean Herbert <1db828bcd41de75377dce59825af73ae7fca5651@ppy.sh>
|
C#
|
mit
|
smoogipoo/osu,UselessToucan/osu,peppy/osu,peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,smoogipoo/osu
|
6230764402df2ac188fef708fa3eb3fc4e6c7da6
|
DWriteCairoTest/UnitTestTextFromat.cs
|
DWriteCairoTest/UnitTestTextFromat.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ZWCloud.DWriteCairo;
namespace DWriteCairoTest
{
[TestClass]
public class UnitTestTextFromat
{
[TestMethod]
public void TestTextFormat()
{
const string fontFamilyName = "SimSun";
const FontWeight fontWeight = FontWeight.Bold;
const FontStyle fontStyle = FontStyle.Normal;
const FontStretch fontStretch = FontStretch.Normal;
const float fontSize = 32f;
var textFormat = DWriteCairo.CreateTextFormat(fontFamilyName, fontWeight, fontStyle, fontStretch, fontSize);
Assert.IsNotNull(textFormat, "TextFormat creating failed.");
Assert.AreEqual(fontFamilyName, textFormat.FontFamilyName);
Assert.AreEqual(fontWeight, textFormat.FontWeight);
Assert.AreEqual(fontStyle, textFormat.FontStyle);
Assert.AreEqual(fontStretch, textFormat.FontStretch);
Assert.AreEqual(fontSize, textFormat.FontSize);
textFormat.TextAlignment = TextAlignment.Center;
Assert.AreEqual(textFormat.TextAlignment, TextAlignment.Center);
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ZWCloud.DWriteCairo;
namespace DWriteCairoTest
{
[TestClass]
public class UnitTestTextFromat
{
[TestMethod]
public void TestTextFormat()
{
const string fontFamilyName = "SimSun";
const FontWeight fontWeight = FontWeight.Bold;
const FontStyle fontStyle = FontStyle.Normal;
const FontStretch fontStretch = FontStretch.Normal;
const float fontSize = 32f;
var textFormat = DWriteCairo.CreateTextFormat(fontFamilyName, fontWeight, fontStyle, fontStretch, fontSize);
Assert.IsNotNull(textFormat, "TextFormat creating failed.");
Assert.AreEqual(fontFamilyName, textFormat.FontFamilyName);
Assert.AreEqual(fontWeight, textFormat.FontWeight);
Assert.AreEqual(fontStyle, textFormat.FontStyle);
Assert.AreEqual(fontStretch, textFormat.FontStretch);
Assert.AreEqual(fontSize, textFormat.FontSize);
textFormat.TextAlignment = TextAlignment.Center;
Assert.AreEqual(textFormat.TextAlignment, TextAlignment.Center);
textFormat.TextAlignment = TextAlignment.Leading;
Assert.AreEqual(textFormat.TextAlignment, TextAlignment.Leading);
}
}
}
|
Add a test for text alignment.
|
Add a test for text alignment.
|
C#
|
apache-2.0
|
zwcloud/ZWCloud.DwriteCairo,zwcloud/ZWCloud.DwriteCairo,zwcloud/ZWCloud.DwriteCairo
|
a4aa8eec0ec7f0c0e5fae40dfe391b9f0c74b958
|
src/PatentSpoiler/Views/Account/Login.cshtml
|
src/PatentSpoiler/Views/Account/Login.cshtml
|
@model dynamic
@{
ViewBag.Title = "login";
}
<h2>Log in!</h2>
<form method="POST">
@Html.AntiForgeryToken()
Username: @Html.TextBox("Username")<br/>
Password: @Html.Password("Password")<br/>
Remember me @Html.CheckBox("RememberMe")<br />
<input type="submit" value="Log in"/>
</form>
|
@model dynamic
@{
ViewBag.Title = "login";
}
<h2>Log in!</h2>
<form method="POST" role="form" id="loginForm" name="loginForm">
@Html.AntiForgeryToken()
<div class="form-group" ng-class="{'has-error': addForm.name.$invalid && addForm.name.$pristine && submitted}">
<label class="col-sm-2 control-label" for="Username">Username</label>
@Html.TextBox("Username", "", new { required = "required", @class = "form-control" })
<span class="help-block" ng-show="loginForm.Username.$error.required && loginform.Username.$pristine">Required</span>
</div>
<div class="form-group" ng-class="{'has-error': addForm.name.$invalid && addForm.name.$pristine && submitted}">
<label class="col-sm-2 control-label" for="Password">Password</label>
@Html.Password("Password", "", new { required = "required", @class = "form-control" })
<span class="help-block" ng-show="loginForm.Password.$error.required && loginform.Password.$pristine">Required</span>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
@Html.CheckBox("RememberMe") Remember me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button class="btn btn-default" type="submit">Log in</button>
</div>
</div>
</form>
|
Tidy of the login page
|
Tidy of the login page
|
C#
|
apache-2.0
|
spadger/patent-spoiler,spadger/patent-spoiler,spadger/patent-spoiler
|
d7afc2753824807caaa9d0412099600852add82d
|
src/Premotion.Mansion.Web.Portal/ScriptTags/RenderBlockTag.cs
|
src/Premotion.Mansion.Web.Portal/ScriptTags/RenderBlockTag.cs
|
using System;
using Premotion.Mansion.Core;
using Premotion.Mansion.Core.Scripting.TagScript;
using Premotion.Mansion.Web.Portal.Service;
namespace Premotion.Mansion.Web.Portal.ScriptTags
{
/// <summary>
/// Renders the specified block.
/// </summary>
[ScriptTag(Constants.TagNamespaceUri, "renderBlock")]
public class RenderBlockTag : ScriptTag
{
#region Constructors
/// <summary>
///
/// </summary>
/// <param name="context"></param>
protected override void DoExecute(IMansionContext context)
{
if (context == null)
throw new ArgumentNullException("context");
var blockProperties = GetAttributes(context);
string targetField;
if (!blockProperties.TryGetAndRemove(context, "targetField", out targetField) || string.IsNullOrEmpty(targetField))
throw new InvalidOperationException("The target attribute is manditory");
var portalService = context.Nucleus.ResolveSingle<IPortalService>();
portalService.RenderBlockToOutput(context, blockProperties, targetField);
}
#endregion
}
}
|
using System;
using Premotion.Mansion.Core;
using Premotion.Mansion.Core.Scripting.TagScript;
using Premotion.Mansion.Web.Portal.Service;
namespace Premotion.Mansion.Web.Portal.ScriptTags
{
/// <summary>
/// Renders the specified block.
/// </summary>
[ScriptTag(Constants.TagNamespaceUri, "renderBlock")]
public class RenderBlockTag : ScriptTag
{
#region Constructors
/// <summary>
///
/// </summary>
/// <param name="context"></param>
protected override void DoExecute(IMansionContext context)
{
if (context == null)
throw new ArgumentNullException("context");
var blockProperties = GetAttributes(context);
string targetField;
if (!blockProperties.TryGetAndRemove(context, "targetField", out targetField) || string.IsNullOrEmpty(targetField))
throw new AttributeNullException("targetField", this);
var portalService = context.Nucleus.ResolveSingle<IPortalService>();
portalService.RenderBlockToOutput(context, blockProperties, targetField);
}
#endregion
}
}
|
Use AttributeNullException instead of an InvalidOperationException.
|
Use AttributeNullException instead of an InvalidOperationException.
|
C#
|
mit
|
Erikvl87/Premotion-Mansion,devatwork/Premotion-Mansion,devatwork/Premotion-Mansion,devatwork/Premotion-Mansion,Erikvl87/Premotion-Mansion,devatwork/Premotion-Mansion,Erikvl87/Premotion-Mansion,Erikvl87/Premotion-Mansion
|
f9dc7b1dd8c36d24c1a4928d2dbd9c71b60745b8
|
Tools.Test.Database/Model/Tasks/DropDatabaseTask.cs
|
Tools.Test.Database/Model/Tasks/DropDatabaseTask.cs
|
namespace Tools.Test.Database.Model.Tasks
{
public class DropDatabaseTask : DatabaseTask
{
private readonly string _connectionString;
public DropDatabaseTask(string connectionString)
: base(connectionString)
{
_connectionString = connectionString;
}
public override bool Execute()
{
System.Data.Entity.Database.Delete(_connectionString);
return true;
}
}
}
|
using System.Data.Entity;
using Infrastructure.DataAccess;
namespace Tools.Test.Database.Model.Tasks
{
public class DropDatabaseTask : DatabaseTask
{
private readonly string _connectionString;
public DropDatabaseTask(string connectionString)
: base(connectionString)
{
_connectionString = connectionString;
}
public override bool Execute()
{
System.Data.Entity.Database.SetInitializer(new DropCreateDatabaseAlways<KitosContext>());
using (var context = CreateKitosContext())
{
context.Database.Initialize(true);
}
return true;
}
}
}
|
Change back to use EF initializer to drop db
|
Change back to use EF initializer to drop db
|
C#
|
mpl-2.0
|
os2kitos/kitos,os2kitos/kitos,os2kitos/kitos,os2kitos/kitos
|
a3dc548600eb808023d5a89125f0d62f9dc02da9
|
Source/Csla.Web.Mvc/ViewModelBase.cs
|
Source/Csla.Web.Mvc/ViewModelBase.cs
|
//-----------------------------------------------------------------------
// <copyright file="ViewModelBase.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: http://www.lhotka.net/cslanet/
// </copyright>
// <summary>Base class used to create ViewModel objects that contain the Model object and related elements.</summary>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Csla.Web.Mvc
{
/// <summary>
/// Base class used to create ViewModel objects that
/// contain the Model object and related elements.
/// </summary>
/// <typeparam name="T">Type of the Model object.</typeparam>
public abstract class ViewModelBase<T> : IViewModel where T : class
{
object IViewModel.ModelObject
{
get { return ModelObject; }
set { ModelObject = (T)value; }
}
/// <summary>
/// Gets or sets the Model object.
/// </summary>
public T ModelObject { get; set; }
}
}
|
//-----------------------------------------------------------------------
// <copyright file="ViewModelBase.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: http://www.lhotka.net/cslanet/
// </copyright>
// <summary>Base class used to create ViewModel objects that contain the Model object and related elements.</summary>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
namespace Csla.Web.Mvc
{
/// <summary>
/// Base class used to create ViewModel objects that
/// contain the Model object and related elements.
/// </summary>
/// <typeparam name="T">Type of the Model object.</typeparam>
public abstract class ViewModelBase<T> : IViewModel where T : class
{
object IViewModel.ModelObject
{
get { return ModelObject; }
set { ModelObject = (T)value; }
}
/// <summary>
/// Gets or sets the Model object.
/// </summary>
public T ModelObject { get; set; }
/// <summary>
/// Saves the current Model object if the object
/// implements Csla.Core.ISavable.
/// </summary>
/// <param name="modelState">Controller's ModelState object.</param>
/// <returns>true if the save succeeds.</returns>
public virtual bool Save(ModelStateDictionary modelState, bool forceUpdate)
{
try
{
var savable = ModelObject as Csla.Core.ISavable;
if (savable == null)
throw new InvalidOperationException("Save");
ModelObject = (T)savable.Save(forceUpdate);
return true;
}
catch (Csla.DataPortalException ex)
{
if (ex.BusinessException != null)
modelState.AddModelError("", ex.BusinessException.Message);
else
modelState.AddModelError("", ex.Message);
return false;
}
catch (Exception ex)
{
modelState.AddModelError("", ex.Message);
return false;
}
}
}
}
|
Add Save method. bugid: 928
|
Add Save method.
bugid: 928
|
C#
|
mit
|
MarimerLLC/csla,MarimerLLC/csla,BrettJaner/csla,JasonBock/csla,JasonBock/csla,BrettJaner/csla,rockfordlhotka/csla,ronnymgm/csla-light,ronnymgm/csla-light,MarimerLLC/csla,BrettJaner/csla,rockfordlhotka/csla,ronnymgm/csla-light,jonnybee/csla,rockfordlhotka/csla,jonnybee/csla,jonnybee/csla,JasonBock/csla
|
4c33f394a8871f48a922f60ee56c50b472d84fcd
|
XPNet.CLR.Template/content/Plugin.cs
|
XPNet.CLR.Template/content/Plugin.cs
|
using System;
using XPNet;
namespace XPNet.CLR.Template
{
[XPlanePlugin(
name: "My Plugin",
signature: "you.plugins.name",
description: "Describe your plugin here."
)]
public class Plugin : IXPlanePlugin
{
private readonly IXPlaneApi m_api;
public Plugin(IXPlaneApi api)
{
m_api = api ?? throw new ArgumentNullException("api");
}
public void Dispose()
{
// Clean up whatever we attached / registered for / etc.
}
public void Enable()
{
// Called when the plugin is enabled in X-Plane.
}
public void Disable()
{
// Called when the plugin is disabled in X-Plane.
}
}
}
|
using System;
using XPNet;
namespace XPNet.CLR.Template
{
[XPlanePlugin(
name: "My Plugin",
signature: "you.plugins.name",
description: "Describe your plugin here."
)]
public class Plugin : IXPlanePlugin
{
private readonly IXPlaneApi m_api;
public Plugin(IXPlaneApi api)
{
m_api = api ?? throw new ArgumentNullException(nameof(api));
}
public void Dispose()
{
// Clean up whatever we attached / registered for / etc.
}
public void Enable()
{
// Called when the plugin is enabled in X-Plane.
}
public void Disable()
{
// Called when the plugin is disabled in X-Plane.
}
}
}
|
Use nameof on argument check in the template project.
|
Use nameof on argument check in the template project.
|
C#
|
mit
|
jaurenq/XPNet,jaurenq/XPNet,jaurenq/XPNet
|
43d7f14204ce60a4987516e01dec15ca9ec2e3f9
|
Alexa.NET/Response/PlainTextOutputSpeech.cs
|
Alexa.NET/Response/PlainTextOutputSpeech.cs
|
using Newtonsoft.Json;
namespace Alexa.NET.Response
{
public class PlainTextOutputSpeech : IOutputSpeech
{
/// <summary>
/// A string containing the type of output speech to render. Valid types are:
/// - "PlainText" - Indicates that the output speech is defined as plain text.
/// - "SSML" - Indicates that the output speech is text marked up with SSML.
/// </summary>
[JsonProperty("type")]
[JsonRequired]
public string Type
{
get { return "PlainText"; }
}
/// <summary>
/// A string containing the speech to render to the user. Use this when type is "PlainText"
/// </summary>
[JsonRequired]
[JsonProperty("text")]
public string Text { get; set; }
}
}
|
using Newtonsoft.Json;
namespace Alexa.NET.Response
{
public class PlainTextOutputSpeech : IOutputSpeech
{
[JsonProperty("type")]
[JsonRequired]
public string Type
{
get { return "PlainText"; }
}
[JsonRequired]
[JsonProperty("text")]
public string Text { get; set; }
}
}
|
Comment removal in prep for newer commenting
|
Comment removal in prep for newer commenting
|
C#
|
mit
|
stoiveyp/alexa-skills-dotnet,timheuer/alexa-skills-dotnet
|
34c2961ae6402a003f5257f795414fbebfdd496b
|
Nustache.Core/FileSystemTemplateLocator.cs
|
Nustache.Core/FileSystemTemplateLocator.cs
|
using System.IO;
namespace Nustache.Core
{
public class FileSystemTemplateLocator
{
private readonly string _extension;
private readonly string _directory;
public FileSystemTemplateLocator(string extension, string directory)
{
_extension = extension;
_directory = directory;
}
public Template GetTemplate(string name)
{
string path = Path.Combine(_directory, name + _extension);
if (File.Exists(path))
{
string text = File.ReadAllText(path);
var reader = new StringReader(text);
var template = new Template();
template.Load(reader);
return template;
}
return null;
}
}
}
|
using System.IO;
namespace Nustache.Core
{
public class FileSystemTemplateLocator
{
private readonly string _extension;
private readonly string[] _directories;
public FileSystemTemplateLocator(string extension, params string[] directories)
{
_extension = extension;
_directories = directories;
}
public Template GetTemplate(string name)
{
foreach (var directory in _directories)
{
var path = Path.Combine(directory, name + _extension);
if (File.Exists(path))
{
var text = File.ReadAllText(path);
var reader = new StringReader(text);
var template = new Template();
template.Load(reader);
return template;
}
}
return null;
}
}
}
|
Use an array of directories instead of just one.
|
Use an array of directories instead of just one.
|
C#
|
mit
|
mediafreakch/Nustache,mediafreakch/Nustache,jdiamond/Nustache,jdiamond/Nustache
|
a7bcc32cc21151ff4817e260b73c8f1d1a75b185
|
osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs
|
osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Filter;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Rulesets.Mania
{
public class ManiaFilterCriteria : IRulesetFilterCriteria
{
private FilterCriteria.OptionalRange<float> keys;
public bool Matches(BeatmapInfo beatmapInfo)
{
return !keys.HasFilter || (beatmapInfo.Ruleset.OnlineID == new ManiaRuleset().LegacyID && keys.IsInRange(ManiaBeatmapConverter.GetColumnCountForNonConvert(beatmapInfo)));
}
public bool TryParseCustomKeywordCriteria(string key, Operator op, string value)
{
switch (key)
{
case "key":
case "keys":
return FilterQueryParser.TryUpdateCriteriaRange(ref keys, op, value);
}
return false;
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Filter;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Rulesets.Mania
{
public class ManiaFilterCriteria : IRulesetFilterCriteria
{
private FilterCriteria.OptionalRange<float> keys;
public bool Matches(BeatmapInfo beatmapInfo)
{
return !keys.HasFilter || (beatmapInfo.Ruleset.OnlineID == new ManiaRuleset().LegacyID && keys.IsInRange(ManiaBeatmapConverter.GetColumnCountForNonConvert(beatmapInfo)));
}
public bool TryParseCustomKeywordCriteria(string key, Operator op, string value)
{
switch (key)
{
case "key":
case "keys":
return FilterQueryParser.TryUpdateCriteriaRange(ref keys, op, value);
}
return false;
}
}
}
|
Remove the nullable disable annotation in the mania ruleset.
|
Remove the nullable disable annotation in the mania ruleset.
|
C#
|
mit
|
ppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu
|
0dbd1a773b6e6398019675628d48c39166932353
|
tests/tests/classes/tests/SchedulerTest/SchedulerAutoremove.cs
|
tests/tests/classes/tests/SchedulerTest/SchedulerAutoremove.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CocosSharp;
namespace tests
{
public class SchedulerAutoremove : SchedulerTestLayer
{
public virtual void onEnter()
{
base.OnEnter();
Schedule(autoremove, 0.5f);
Schedule(tick, 0.5f);
accum = 0;
}
public override string title()
{
return "Self-remove an scheduler";
}
public override string subtitle()
{
return "1 scheduler will be autoremoved in 3 seconds. See console";
}
public void autoremove(float dt)
{
accum += dt;
CCLog.Log("Time: %f", accum);
if (accum > 3)
{
Unschedule(autoremove);
CCLog.Log("scheduler removed");
}
}
public void tick(float dt)
{
CCLog.Log("This scheduler should not be removed");
}
private float accum;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CocosSharp;
namespace tests
{
public class SchedulerAutoremove : SchedulerTestLayer
{
private float accum;
public override void OnEnter ()
{
base.OnEnter();
Schedule(autoremove, 0.5f);
Schedule(tick, 0.5f);
accum = 0;
}
public override string title()
{
return "Self-remove an scheduler";
}
public override string subtitle()
{
return "1 scheduler will be autoremoved in 3 seconds. See console";
}
public void autoremove(float dt)
{
accum += dt;
CCLog.Log("Time: {0}", accum);
if (accum > 3)
{
Unschedule(autoremove);
CCLog.Log("scheduler removed");
}
}
public void tick(float dt)
{
CCLog.Log("This scheduler should not be removed");
}
}
}
|
Fix SchedulerAutorRemove to work correctly.
|
Fix SchedulerAutorRemove to work correctly.
|
C#
|
mit
|
haithemaraissia/CocosSharp,MSylvia/CocosSharp,MSylvia/CocosSharp,mono/CocosSharp,TukekeSoft/CocosSharp,netonjm/CocosSharp,netonjm/CocosSharp,zmaruo/CocosSharp,TukekeSoft/CocosSharp,hig-ag/CocosSharp,haithemaraissia/CocosSharp,hig-ag/CocosSharp,mono/CocosSharp,zmaruo/CocosSharp
|
ec616e27f8c88d62c4ad96af0c83b902c4b5cc65
|
Iced/Intel/InstructionListDebugView.cs
|
Iced/Intel/InstructionListDebugView.cs
|
/*
Copyright (C) 2018 de4dot@gmail.com
This file is part of Iced.
Iced is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Iced is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Iced. If not, see <https://www.gnu.org/licenses/>.
*/
using System;
using System.Diagnostics;
namespace Iced.Intel {
sealed class InstructionListDebugView {
readonly InstructionList list;
public InstructionListDebugView(InstructionList list) =>
this.list = list ?? throw new ArgumentNullException(nameof(list));
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public Instruction[] Items {
get {
var instructions = new Instruction[list.Count];
list.CopyTo(instructions, 0);
return instructions;
}
}
}
}
|
/*
Copyright (C) 2018 de4dot@gmail.com
This file is part of Iced.
Iced is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Iced is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Iced. If not, see <https://www.gnu.org/licenses/>.
*/
using System;
using System.Diagnostics;
namespace Iced.Intel {
sealed class InstructionListDebugView {
readonly InstructionList list;
public InstructionListDebugView(InstructionList list) =>
this.list = list ?? throw new ArgumentNullException(nameof(list));
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public Instruction[] Items => list.ToArray();
}
}
|
Simplify debug view prop body
|
Simplify debug view prop body
|
C#
|
mit
|
0xd4d/iced,0xd4d/iced,0xd4d/iced,0xd4d/iced,0xd4d/iced
|
30ceb2ed91637076d2cb7a024c1ecc74a5000657
|
CoCo/VsPackage.cs
|
CoCo/VsPackage.cs
|
using System;
using System.Runtime.InteropServices;
using System.Windows;
using CoCo.UI;
using CoCo.UI.ViewModels;
using Microsoft.VisualStudio.Shell;
namespace CoCo
{
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading =true)]
[ProvideOptionPage(typeof(DialogOption), "CoCo", "CoCo", 0, 0, true)]
[Guid("b933474d-306e-434f-952d-a820c849ed07")]
public sealed class VsPackage : Package
{
}
public class DialogOption : UIElementDialogPage
{
private OptionViewModel _view;
private OptionControl _child;
protected override UIElement Child
{
get
{
if (_child != null) return _child;
_view = new OptionViewModel(new OptionProvider());
_child = new OptionControl
{
DataContext = _view
};
return _child;
}
}
protected override void OnClosed(EventArgs e)
{
_view.SaveOption();
base.OnClosed(e);
}
}
}
|
using System;
using System.Runtime.InteropServices;
using System.Windows;
using CoCo.UI;
using CoCo.UI.ViewModels;
using Microsoft.VisualStudio.Shell;
namespace CoCo
{
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[ProvideOptionPage(typeof(DialogOption), "CoCo", "CoCo", 0, 0, true)]
[Guid("b933474d-306e-434f-952d-a820c849ed07")]
public sealed class VsPackage : Package
{
}
public class DialogOption : UIElementDialogPage
{
private OptionViewModel _view;
private OptionControl _child;
protected override UIElement Child
{
get
{
if (_child != null) return _child;
_view = new OptionViewModel(new OptionProvider());
_child = new OptionControl
{
DataContext = _view
};
return _child;
}
}
protected override void OnApply(PageApplyEventArgs e)
{
if (e.ApplyBehavior == ApplyKind.Apply)
{
_view.SaveOption();
}
base.OnApply(e);
}
}
}
|
Apply a saving option only at it needed.
|
Apply a saving option only at it needed.
|
C#
|
mit
|
GeorgeAlexandria/CoCo
|
ebb2eb6f51205a6f370ed8fa614cbea7750ebb46
|
Source/HelixToolkit.SharpDX.Shared/Model/OrderKey.cs
|
Source/HelixToolkit.SharpDX.Shared/Model/OrderKey.cs
|
using System;
using System.Runtime.CompilerServices;
#if NETFX_CORE
namespace HelixToolkit.UWP.Model
#else
namespace HelixToolkit.Wpf.SharpDX.Model
#endif
{
/// <summary>
/// Render order key
/// </summary>
public struct OrderKey : IComparable<OrderKey>
{
public uint Key;
public OrderKey(uint key)
{
Key = key;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static OrderKey Create(ushort order, ushort materialID)
{
return new OrderKey(((uint)order << 32) | materialID);
}
public int CompareTo(OrderKey other)
{
return Key.CompareTo(other.Key);
}
}
}
|
using System;
using System.Runtime.CompilerServices;
#if NETFX_CORE
namespace HelixToolkit.UWP.Model
#else
namespace HelixToolkit.Wpf.SharpDX.Model
#endif
{
/// <summary>
/// Render order key
/// </summary>
public struct OrderKey : IComparable<OrderKey>
{
public uint Key;
public OrderKey(uint key)
{
Key = key;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static OrderKey Create(ushort order, ushort materialID)
{
return new OrderKey(((uint)order << 16) | materialID);
}
public int CompareTo(OrderKey other)
{
return Key.CompareTo(other.Key);
}
}
}
|
Fix wrong render order key bit shift
|
Fix wrong render order key bit shift
|
C#
|
mit
|
helix-toolkit/helix-toolkit,holance/helix-toolkit,chrkon/helix-toolkit,JeremyAnsel/helix-toolkit
|
905f9707314cc608ce8f6b6782e10de6d9ed2551
|
DspAdpcm/DspAdpcm.Cli/DspAdpcmCli.cs
|
DspAdpcm/DspAdpcm.Cli/DspAdpcmCli.cs
|
using System;
using System.Diagnostics;
using System.IO;
using DspAdpcm.Lib.Adpcm;
using DspAdpcm.Lib.Adpcm.Formats;
using DspAdpcm.Lib.Pcm;
using DspAdpcm.Lib.Pcm.Formats;
namespace DspAdpcm.Cli
{
public static class DspAdpcmCli
{
public static int Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Usage: dspadpcm <wavIn> <brstmOut>\n");
return 0;
}
PcmStream wave;
try
{
using (var file = new FileStream(args[0], FileMode.Open))
{
wave = new Wave(file).AudioStream;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return -1;
}
Stopwatch watch = new Stopwatch();
watch.Start();
AdpcmStream adpcm = Lib.Adpcm.Encode.PcmToAdpcmParallel(wave);
watch.Stop();
Console.WriteLine($"DONE! {adpcm.NumSamples} samples processed\n");
Console.WriteLine($"Time elapsed: {watch.Elapsed.TotalSeconds}");
Console.WriteLine($"Processed {(adpcm.NumSamples / watch.Elapsed.TotalMilliseconds):N} samples per millisecond.");
var brstm = new Brstm(adpcm);
using (var stream = File.Open(args[1], FileMode.Create))
foreach (var b in brstm.GetFile())
stream.WriteByte(b);
return 0;
}
}
}
|
using System;
using System.Diagnostics;
using System.IO;
using DspAdpcm.Lib.Adpcm;
using DspAdpcm.Lib.Adpcm.Formats;
using DspAdpcm.Lib.Pcm;
using DspAdpcm.Lib.Pcm.Formats;
namespace DspAdpcm.Cli
{
public static class DspAdpcmCli
{
public static int Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Usage: dspadpcm <wavIn> <brstmOut>\n");
return 0;
}
PcmStream wave;
try
{
using (var file = new FileStream(args[0], FileMode.Open))
{
wave = new Wave(file).AudioStream;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return -1;
}
Stopwatch watch = new Stopwatch();
watch.Start();
AdpcmStream adpcm = Lib.Adpcm.Encode.PcmToAdpcmParallel(wave);
watch.Stop();
Console.WriteLine($"DONE! {adpcm.NumSamples} samples processed\n");
Console.WriteLine($"Time elapsed: {watch.Elapsed.TotalSeconds}");
Console.WriteLine($"Processed {(adpcm.NumSamples / watch.Elapsed.TotalMilliseconds):N} samples per millisecond.");
var brstm = new Brstm(adpcm);
using (FileStream stream = File.Open(args[1], FileMode.Create))
{
brstm.WriteFile(stream);
}
return 0;
}
}
}
|
Write directly to a FileStream when writing the output file
|
CLI: Write directly to a FileStream when writing the output file
|
C#
|
mit
|
Thealexbarney/LibDspAdpcm,Thealexbarney/VGAudio,Thealexbarney/LibDspAdpcm,Thealexbarney/VGAudio
|
a1c60447ec69949ea9b5ece04f7fec23c4827849
|
Battery-Commander.Tests/AirTableServiceTests.cs
|
Battery-Commander.Tests/AirTableServiceTests.cs
|
using BatteryCommander.Web.Models;
using BatteryCommander.Web.Services;
using Microsoft.Extensions.Options;
using System;
using System.Threading.Tasks;
using Xunit;
namespace BatteryCommander.Tests
{
public class AirTableServiceTests
{
private const String AppKey = "";
private const String BaseId = "";
[Fact]
public async Task Try_Get_Records()
{
if (String.IsNullOrWhiteSpace(AppKey)) return;
// Arrange
var options = Options.Create(new AirTableSettings { AppKey = AppKey, BaseId = BaseId });
var service = new AirTableService(options);
// Act
var records = await service.GetRecords();
// Assert
Assert.NotEmpty(records);
}
}
}
|
using BatteryCommander.Web.Models;
using BatteryCommander.Web.Services;
using Microsoft.Extensions.Options;
using System;
using System.Threading.Tasks;
using Xunit;
namespace BatteryCommander.Tests
{
public class AirTableServiceTests
{
private const String AppKey = "";
private const String BaseId = "";
[Fact]
public async Task Try_Get_Records()
{
if (String.IsNullOrWhiteSpace(AppKey)) return;
// Arrange
var options = Options.Create(new AirTableSettings { AppKey = AppKey, BaseId = BaseId });
var service = new AirTableService(options);
// Act
var records = await service.GetRecords();
// Assert
Assert.NotEmpty(records);
}
[Fact]
public async Task Get_Purchase_Order()
{
if (String.IsNullOrWhiteSpace(AppKey)) return;
// Arrange
var options = Options.Create(new AirTableSettings { AppKey = AppKey, BaseId = BaseId });
var service = new AirTableService(options);
// Act
var order = await service.GetPurchaseOrder(id: "reclJK6G3IFjFlXE1");
// Assert
// TODO
}
}
}
|
Add placeholder for testing retrieving POs
|
Add placeholder for testing retrieving POs
|
C#
|
mit
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
cb01f0b0bdf86afe42145eeea857be43caa2a959
|
src/Test/Utilities/Portable/Extensions/SemanticModelExtensions.cs
|
src/Test/Utilities/Portable/Extensions/SemanticModelExtensions.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.Test.Extensions
{
public static class SemanticModelExtensions
{
public static IOperation GetOperationInternal(this SemanticModel model, SyntaxNode node)
{
return model.GetOperationInternal(node);
}
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.Test.Extensions
{
public static class SemanticModelExtensions
{
public static IOperation GetOperationInternal(this SemanticModel model, SyntaxNode node)
{
// Invoke the GetOperationInternal API to by-pass the IOperation feature flag check.
return model.GetOperationInternal(node);
}
}
}
|
Address PR feedback and add comment
|
Address PR feedback and add comment
|
C#
|
apache-2.0
|
reaction1989/roslyn,TyOverby/roslyn,ErikSchierboom/roslyn,robinsedlaczek/roslyn,ErikSchierboom/roslyn,heejaechang/roslyn,nguerrera/roslyn,ErikSchierboom/roslyn,tmeschter/roslyn,abock/roslyn,CaptainHayashi/roslyn,xasx/roslyn,pdelvo/roslyn,bartdesmet/roslyn,MichalStrehovsky/roslyn,pdelvo/roslyn,zooba/roslyn,AnthonyDGreen/roslyn,Giftednewt/roslyn,srivatsn/roslyn,bkoelman/roslyn,nguerrera/roslyn,sharwell/roslyn,weltkante/roslyn,DustinCampbell/roslyn,xasx/roslyn,jmarolf/roslyn,paulvanbrenk/roslyn,cston/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,mavasani/roslyn,robinsedlaczek/roslyn,agocke/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,zooba/roslyn,panopticoncentral/roslyn,Hosch250/roslyn,KevinRansom/roslyn,yeaicc/roslyn,MichalStrehovsky/roslyn,AmadeusW/roslyn,brettfo/roslyn,orthoxerox/roslyn,bkoelman/roslyn,jkotas/roslyn,AmadeusW/roslyn,jeffanders/roslyn,diryboy/roslyn,mattscheffer/roslyn,physhi/roslyn,yeaicc/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,kelltrick/roslyn,MattWindsor91/roslyn,reaction1989/roslyn,yeaicc/roslyn,CaptainHayashi/roslyn,jcouv/roslyn,stephentoub/roslyn,nguerrera/roslyn,agocke/roslyn,jamesqo/roslyn,brettfo/roslyn,dotnet/roslyn,khyperia/roslyn,Hosch250/roslyn,jcouv/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,jkotas/roslyn,mmitche/roslyn,OmarTawfik/roslyn,dpoeschl/roslyn,cston/roslyn,physhi/roslyn,gafter/roslyn,sharwell/roslyn,genlu/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,mattscheffer/roslyn,mmitche/roslyn,jasonmalinowski/roslyn,davkean/roslyn,mmitche/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,bartdesmet/roslyn,paulvanbrenk/roslyn,diryboy/roslyn,Giftednewt/roslyn,lorcanmooney/roslyn,VSadov/roslyn,orthoxerox/roslyn,mattwar/roslyn,mgoertz-msft/roslyn,tannergooding/roslyn,pdelvo/roslyn,panopticoncentral/roslyn,weltkante/roslyn,dotnet/roslyn,jamesqo/roslyn,TyOverby/roslyn,robinsedlaczek/roslyn,srivatsn/roslyn,kelltrick/roslyn,VSadov/roslyn,OmarTawfik/roslyn,tmat/roslyn,davkean/roslyn,jasonmalinowski/roslyn,drognanar/roslyn,mavasani/roslyn,reaction1989/roslyn,orthoxerox/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,CyrusNajmabadi/roslyn,akrisiun/roslyn,tannergooding/roslyn,swaroop-sridhar/roslyn,aelij/roslyn,eriawan/roslyn,tmat/roslyn,mattwar/roslyn,mgoertz-msft/roslyn,khyperia/roslyn,akrisiun/roslyn,KevinRansom/roslyn,tvand7093/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,amcasey/roslyn,amcasey/roslyn,AlekseyTs/roslyn,mavasani/roslyn,VSadov/roslyn,CyrusNajmabadi/roslyn,dpoeschl/roslyn,gafter/roslyn,cston/roslyn,MattWindsor91/roslyn,kelltrick/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,DustinCampbell/roslyn,swaroop-sridhar/roslyn,lorcanmooney/roslyn,jmarolf/roslyn,sharwell/roslyn,CaptainHayashi/roslyn,jamesqo/roslyn,drognanar/roslyn,lorcanmooney/roslyn,abock/roslyn,eriawan/roslyn,jeffanders/roslyn,bkoelman/roslyn,DustinCampbell/roslyn,tmeschter/roslyn,physhi/roslyn,wvdd007/roslyn,srivatsn/roslyn,khyperia/roslyn,Giftednewt/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,zooba/roslyn,dpoeschl/roslyn,OmarTawfik/roslyn,gafter/roslyn,genlu/roslyn,wvdd007/roslyn,Hosch250/roslyn,weltkante/roslyn,agocke/roslyn,AmadeusW/roslyn,bartdesmet/roslyn,amcasey/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,mattscheffer/roslyn,TyOverby/roslyn,heejaechang/roslyn,tmeschter/roslyn,tvand7093/roslyn,AnthonyDGreen/roslyn,tvand7093/roslyn,davkean/roslyn,drognanar/roslyn,shyamnamboodiripad/roslyn,MattWindsor91/roslyn,abock/roslyn,jcouv/roslyn,jeffanders/roslyn,swaroop-sridhar/roslyn,stephentoub/roslyn,paulvanbrenk/roslyn,stephentoub/roslyn,aelij/roslyn,MattWindsor91/roslyn,panopticoncentral/roslyn,MichalStrehovsky/roslyn,jmarolf/roslyn,tmat/roslyn,aelij/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,jkotas/roslyn,xasx/roslyn,eriawan/roslyn,akrisiun/roslyn,AnthonyDGreen/roslyn,mattwar/roslyn
|
e056e6b5a4bbc90535a970cfb30ac2ca4ec258fd
|
templates/log_rss.cs
|
templates/log_rss.cs
|
<?xml version="1.0"?>
<!-- RSS generated by Trac v<?cs var:trac.version ?> on <?cs var:trac.time ?> -->
<rss version="2.0">
<channel><?cs
if:project.name_encoded ?>
<title><?cs var:project.name_encoded ?>: Revisions of <?cs var:log.path ?></title><?cs
else ?>
<title>Revisions of <?cs var:log.path ?></title><?cs
/if ?>
<link><?cs var:base_host ?><?cs var:log.log_href ?></link>
<description>Trac Log - Revisions of <?cs var:log.path ?></description>
<language>en-us</language>
<generator>Trac v<?cs var:trac.version ?></generator><?cs
each:item = log.items ?><?cs
with:change = log.changes[item.rev] ?>
<item>
<author><?cs var:change.author ?></author>
<pubDate><?cs var:change.date ?></pubDate>
<title>Revision <?cs var:item.rev ?>: <?cs var:change.shortlog ?></title>
<link><?cs var:base_host ?><?cs var:item.changeset_href ?></link>
<description><?cs var:change.message ?></description>
<category>Report</category>
</item><?cs
/with ?><?cs
/each ?>
</channel>
</rss>
|
<?xml version="1.0"?>
<!-- RSS generated by Trac v<?cs var:trac.version ?> on <?cs var:trac.time ?> -->
<rss version="2.0">
<channel><?cs
if:project.name_encoded ?>
<title><?cs var:project.name_encoded ?>: Revisions of <?cs var:log.path ?></title><?cs
else ?>
<title>Revisions of <?cs var:log.path ?></title><?cs
/if ?>
<link><?cs var:base_host ?><?cs var:log.log_href ?></link>
<description>Trac Log - Revisions of <?cs var:log.path ?></description>
<language>en-us</language>
<generator>Trac v<?cs var:trac.version ?></generator><?cs
each:item = log.items ?><?cs
with:change = log.changes[item.rev] ?>
<item>
<author><?cs var:change.author ?></author>
<pubDate><?cs var:change.date ?></pubDate>
<title>Revision <?cs var:item.rev ?>: <?cs var:change.shortlog ?></title>
<link><?cs var:base_host ?><?cs var:item.changeset_href ?></link>
<description><?cs var:change.message ?></description>
<category>Log</category>
</item><?cs
/with ?><?cs
/each ?>
</channel>
</rss>
|
Fix category of revision log RSS feeds.
|
Fix category of revision log RSS feeds.
|
C#
|
bsd-3-clause
|
pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac
|
54f33523c161803d0d421d0b651814204df02b79
|
CakeMail.RestClient/Properties/AssemblyInfo.cs
|
CakeMail.RestClient/Properties/AssemblyInfo.cs
|
using System.Reflection;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CakeMail.RestClient")]
[assembly: AssemblyDescription("CakeMail.RestClient is a .NET wrapper for the CakeMail API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jeremie Desautels")]
[assembly: AssemblyProduct("CakeMail.RestClient")]
[assembly: AssemblyCopyright("Copyright Jeremie Desautels © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the 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")]
[assembly: AssemblyInformationalVersion("1.0.0-beta01")]
|
using System.Reflection;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CakeMail.RestClient")]
[assembly: AssemblyDescription("CakeMail.RestClient is a .NET wrapper for the CakeMail API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jeremie Desautels")]
[assembly: AssemblyProduct("CakeMail.RestClient")]
[assembly: AssemblyCopyright("Copyright Jeremie Desautels © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the 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")]
[assembly: AssemblyInformationalVersion("1.0.0-beta02")]
|
Update nuget package version to beta02
|
Update nuget package version to beta02
|
C#
|
mit
|
Jericho/CakeMail.RestClient
|
ce7a5e8914af475684e95d6420d6aa2ff8ff7055
|
osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs
|
osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
{
public class NoteMask : HitObjectMask
{
public NoteMask(DrawableNote note)
: base(note)
{
Scale = note.Scale;
AddInternal(new NotePiece());
note.HitObject.ColumnChanged += _ => Position = note.Position;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.Yellow;
}
protected override void Update()
{
base.Update();
Size = HitObject.DrawSize;
Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft);
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
{
public class NoteMask : HitObjectMask
{
public NoteMask(DrawableNote note)
: base(note)
{
Scale = note.Scale;
CornerRadius = 5;
Masking = true;
AddInternal(new NotePiece());
note.HitObject.ColumnChanged += _ => Position = note.Position;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.Yellow;
}
protected override void Update()
{
base.Update();
Size = HitObject.DrawSize;
Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft);
}
}
}
|
Update visual style to match new notes
|
Update visual style to match new notes
|
C#
|
mit
|
ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,DrabWeb/osu,ZLima12/osu,UselessToucan/osu,DrabWeb/osu,smoogipooo/osu,naoey/osu,EVAST9919/osu,ppy/osu,smoogipoo/osu,EVAST9919/osu,ZLima12/osu,2yangk23/osu,UselessToucan/osu,johnneijzen/osu,smoogipoo/osu,peppy/osu-new,naoey/osu,peppy/osu,smoogipoo/osu,naoey/osu,NeoAdonis/osu,2yangk23/osu,johnneijzen/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,DrabWeb/osu
|
e2194f3e9e32bb221cb35fa9cc59a043300d603a
|
src/Glimpse.Server.Web/GlimpseServerServiceCollectionExtensions.cs
|
src/Glimpse.Server.Web/GlimpseServerServiceCollectionExtensions.cs
|
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
using System;
namespace Glimpse
{
public static class GlimpseServerServiceCollectionExtensions
{
public static IServiceCollection RunningServer(this IServiceCollection services)
{
UseSignalR(services, null);
return services.Add(GlimpseServerServices.GetDefaultServices());
}
public static IServiceCollection RunningServer(this IServiceCollection services, IConfiguration configuration)
{
UseSignalR(services, configuration);
return services.Add(GlimpseServerServices.GetDefaultServices(configuration));
}
public static IServiceCollection WithLocalAgent(this IServiceCollection services)
{
return services.Add(GlimpseServerServices.GetPublisherServices());
}
public static IServiceCollection WithLocalAgent(this IServiceCollection services, IConfiguration configuration)
{
return services.Add(GlimpseServerServices.GetPublisherServices(configuration));
}
// TODO: Confirm that this is where this should be registered
private static void UseSignalR(IServiceCollection services, IConfiguration configuration)
{
// TODO: Config isn't currently being handled - https://github.com/aspnet/SignalR-Server/issues/51
services.AddSignalR(options =>
{
options.Hubs.EnableDetailedErrors = true;
});
}
}
}
|
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
using System;
namespace Glimpse
{
public static class GlimpseServerServiceCollectionExtensions
{
public static IServiceCollection RunningServer(this IServiceCollection services)
{
services.Add(GlimpseServerServices.GetDefaultServices());
UseSignalR(services, null);
return services;
}
public static IServiceCollection RunningServer(this IServiceCollection services, IConfiguration configuration)
{
services.Add(GlimpseServerServices.GetDefaultServices(configuration));
UseSignalR(services, configuration);
return services;
}
public static IServiceCollection WithLocalAgent(this IServiceCollection services)
{
return services.Add(GlimpseServerServices.GetPublisherServices());
}
public static IServiceCollection WithLocalAgent(this IServiceCollection services, IConfiguration configuration)
{
return services.Add(GlimpseServerServices.GetPublisherServices(configuration));
}
// TODO: Confirm that this is where this should be registered
private static void UseSignalR(IServiceCollection services, IConfiguration configuration)
{
// TODO: Config isn't currently being handled - https://github.com/aspnet/SignalR-Server/issues/51
services.AddSignalR(options =>
{
options.Hubs.EnableDetailedErrors = true;
});
}
}
}
|
Switch around registration order for signalr
|
Switch around registration order for signalr
|
C#
|
mit
|
mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype
|
e8987fdc17d726ad4f3cac3be0120319cb8057b6
|
Game/GameInit.cs
|
Game/GameInit.cs
|
using UnityEngine;
using System.Collections;
using DG.Tweening;
public class GameInit : MonoBehaviour
{
void Awake()
{
// seed Random with current seconds;
Random.seed = (int)System.DateTime.Now.Ticks;
// initialize DOTween before first use.
DOTween.Init(true, true, LogBehaviour.Verbose).SetCapacity(200, 10);
DOTween.SetTweensCapacity(2000, 100);
// ignore collisions between
Physics2D.IgnoreLayerCollision(LayerID("BodyCollider"), LayerID("One-Way Platform"), true);
Physics2D.IgnoreLayerCollision(LayerID("WeaponCollider"), LayerID("Enemies"), true);
Physics2D.IgnoreLayerCollision(LayerID("WeaponCollider"), LayerID("Collectables"), true);
}
int LayerID(string layerName)
{
return LayerMask.NameToLayer(layerName);
}
}
|
using UnityEngine;
using System.Collections;
using DG.Tweening;
using Matcha.Lib;
public class GameInit : MonoBehaviour
{
void Awake()
{
// seed Random with current seconds;
Random.seed = (int)System.DateTime.Now.Ticks;
// initialize DOTween before first use.
DOTween.Init(true, true, LogBehaviour.Verbose).SetCapacity(200, 10);
DOTween.SetTweensCapacity(2000, 100);
// ignore collisions between
MLib.IgnoreLayerCollision2D("BodyCollider", "One-Way Platform", true);
MLib.IgnoreLayerCollision2D("WeaponCollider", "Enemies", true);
MLib.IgnoreLayerCollision2D("WeaponCollider", "Collectables", true);
}
}
|
Swap out IgnoreLayerCollisions for new custom version.
|
Swap out IgnoreLayerCollisions for new custom version.
|
C#
|
mit
|
cmilr/Unity2D-Components,jguarShark/Unity2D-Components
|
c4a528d6a4e565c41d7490a59f59148690fe0f54
|
ReverseWords/SearchingBinaryTree/BinarySearchTree.cs
|
ReverseWords/SearchingBinaryTree/BinarySearchTree.cs
|
namespace SearchingBinaryTree
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class BinarySearchTree
{
public Node Root { get; private set; }
public void Add(Node node) {
if(Root!=null) {
Node current = Root;
while(current != null) {
if (current.Value > node.Value)
{
if (current.Right != null) {
current = current.Right;
continue;
}
Root.Right = node;
current = null;
}
else
{
if (current.Left != null) {
current = current.Left;
continue;
}
Root.Left = node;
current = null;
}
}
} else {
Root = node;
}
}
}
}
|
namespace SearchingBinaryTree
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class BinarySearchTree
{
public Node Root { get; private set; }
public void Add(Node node) {
if(Root!=null) {
Node current = Root;
while(current != null) {
if (current.Value > node.Value)
{
if (current.Right != null) {
current = current.Right;
continue;
}
current.Right = node;
current = null;
}
else
{
if (current.Left != null) {
current = current.Left;
continue;
}
current.Left = node;
current = null;
}
}
} else {
Root = node;
}
}
}
}
|
Fix operation on wrong node
|
Fix operation on wrong node
|
C#
|
apache-2.0
|
ozim/CakeStuff
|
02310d2555bccacd2b3410a163a4d1dc688b0636
|
src/TestApplication/Migrations/ShowTitle.cs
|
src/TestApplication/Migrations/ShowTitle.cs
|
using System;
using IonFar.SharePoint.Migration;
using Microsoft.SharePoint.Client;
namespace TestApplication.Migrations
{
[Migration(10001)]
public class ShowTitle : IMigration
{
public void Up(ClientContext clientContext, ILogger logger)
{
clientContext.Load(clientContext.Web, w => w.Title);
clientContext.ExecuteQuery();
Console.WriteLine("Your site title is: " + clientContext.Web.Title);
}
}
}
|
using System;
using IonFar.SharePoint.Migration;
using Microsoft.SharePoint.Client;
namespace TestApplication.Migrations
{
[Migration(10001, true)]
public class ShowTitle : IMigration
{
public void Up(ClientContext clientContext, ILogger logger)
{
clientContext.Load(clientContext.Web, w => w.Title);
clientContext.ExecuteQuery();
Console.WriteLine("Your site title is: " + clientContext.Web.Title);
}
}
}
|
Add override to test migration, so it happens every time
|
Add override to test migration, so it happens every time
|
C#
|
mit
|
jackawatts/ionfar-sharepoint-migration,jackawatts/ionfar-sharepoint-migration,sgryphon/ionfar-sharepoint-migration,sgryphon/ionfar-sharepoint-migration
|
e6c470de3f772c6bd35ef32e255b4d16dad7ef98
|
src/Microsoft.Azure.WebJobs/FunctionNameAttribute.cs
|
src/Microsoft.Azure.WebJobs/FunctionNameAttribute.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Text.RegularExpressions;
namespace Microsoft.Azure.WebJobs
{
/// <summary>
/// Attribute used to indicate the name to use for a job function.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class FunctionNameAttribute : Attribute
{
private string _name;
/// <summary>
/// Initializes a new instance of the <see cref="FunctionNameAttribute"/> class with a given name.
/// </summary>
/// <param name="name">Name of the function.</param>
public FunctionNameAttribute(string name)
{
this._name = name;
}
/// <summary>
/// Gets the function name.
/// </summary>
public string Name => _name;
/// <summary>
/// Validation for name.
/// </summary>
public static readonly Regex FunctionNameValidationRegex = new Regex(@"^[a-z][a-z0-9_\-]{0,127}$(?<!^host$)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Text.RegularExpressions;
namespace Microsoft.Azure.WebJobs
{
/// <summary>
/// Attribute used to indicate the name to use for a job function.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class FunctionNameAttribute : Attribute
{
private string _name;
/// <summary>
/// Initializes a new instance of the <see cref="FunctionNameAttribute"/> class with a given name.
/// </summary>
/// <param name="name">Name of the function.</param>
public FunctionNameAttribute(string name)
{
this._name = name;
}
/// <summary>
/// Gets the function name.
/// </summary>
public string Name => _name;
/// <summary>
/// Validation for name.
/// RegexOptions.Compiled is specifically removed as it impacts the cold start.
/// </summary>
public static readonly Regex FunctionNameValidationRegex = new Regex(@"^[a-z][a-z0-9_\-]{0,127}$(?<!^host$)", RegexOptions.IgnoreCase);
}
}
|
Remove RegexOptions.Compiled for code paths executed during cold start
|
Remove RegexOptions.Compiled for code paths executed during cold start
|
C#
|
mit
|
Azure/azure-webjobs-sdk,Azure/azure-webjobs-sdk
|
3ab7c9f18b6621f77200e5d9eaa4a03297d72029
|
src/Startup.cs
|
src/Startup.cs
|
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace AustinSite
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}
|
using AustinSite.Repositories;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace AustinSite
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
services.AddScoped<ArticlesRepository>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}
|
Add Articles rep into DI scope
|
Add Articles rep into DI scope
|
C#
|
mit
|
AustinFelipe/website,AustinFelipe/website,AustinFelipe/website
|
78a10d9c20d2284e2848534c82447d7c7fa604a0
|
tests/TestUtility/TestAssets.TestProject.cs
|
tests/TestUtility/TestAssets.TestProject.cs
|
using System;
namespace TestUtility
{
public partial class TestAssets
{
private class TestProject : ITestProject
{
private bool _disposed;
public string Name { get; }
public string BaseDirectory { get; }
public string Directory { get; }
public bool ShadowCopied { get; }
public TestProject(string name, string baseDirectory, string directory, bool shadowCopied)
{
this.Name = name;
this.BaseDirectory = baseDirectory;
this.Directory = directory;
this.ShadowCopied = shadowCopied;
}
~TestProject()
{
throw new InvalidOperationException($"{nameof(ITestProject)}.{nameof(Dispose)}() not called for {this.Name}");
}
public virtual void Dispose()
{
if (_disposed)
{
throw new InvalidOperationException($"{nameof(ITestProject)} for {this.Name} already disposed.");
}
if (this.ShadowCopied)
{
System.IO.Directory.Delete(this.BaseDirectory, recursive: true);
if (System.IO.Directory.Exists(this.BaseDirectory))
{
throw new InvalidOperationException($"{nameof(ITestProject)} directory still exists: '{this.BaseDirectory}'");
}
}
this._disposed = true;
GC.SuppressFinalize(this);
}
}
}
}
|
using System;
using System.Threading;
namespace TestUtility
{
public partial class TestAssets
{
private class TestProject : ITestProject
{
private bool _disposed;
public string Name { get; }
public string BaseDirectory { get; }
public string Directory { get; }
public bool ShadowCopied { get; }
public TestProject(string name, string baseDirectory, string directory, bool shadowCopied)
{
this.Name = name;
this.BaseDirectory = baseDirectory;
this.Directory = directory;
this.ShadowCopied = shadowCopied;
}
~TestProject()
{
throw new InvalidOperationException($"{nameof(ITestProject)}.{nameof(Dispose)}() not called for {this.Name}");
}
public virtual void Dispose()
{
if (_disposed)
{
throw new InvalidOperationException($"{nameof(ITestProject)} for {this.Name} already disposed.");
}
if (this.ShadowCopied)
{
var retries = 0;
while (retries <= 5)
{
try
{
System.IO.Directory.Delete(this.BaseDirectory, recursive: true);
break;
}
catch
{
Thread.Sleep(1000);
retries++;
}
}
if (System.IO.Directory.Exists(this.BaseDirectory))
{
throw new InvalidOperationException($"{nameof(ITestProject)} directory still exists: '{this.BaseDirectory}'");
}
}
this._disposed = true;
GC.SuppressFinalize(this);
}
}
}
}
|
Add retry logic for test clean up
|
Add retry logic for test clean up
|
C#
|
mit
|
OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn
|
7938528070d5d1af2c3c186999f26c493b76367d
|
Telerik.JustMock/Core/Context/AsyncContextResolver.cs
|
Telerik.JustMock/Core/Context/AsyncContextResolver.cs
|
/*
JustMock Lite
Copyright © 2019 Progress Software Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.ComponentModel;
using System.Reflection;
namespace Telerik.JustMock.Core.Context
{
public static class AsyncContextResolver
{
#if NETCORE
static IAsyncContextResolver resolver = new AsyncLocalWrapper();
#else
static IAsyncContextResolver resolver = new CallContextWrapper();
#endif
[EditorBrowsable(EditorBrowsableState.Never)]
public static MethodBase GetContext()
{
return resolver.GetContext();
}
[EditorBrowsable(EditorBrowsableState.Never)]
public static void CaptureContext()
{
resolver.CaptureContext();
}
}
}
|
/*
JustMock Lite
Copyright © 2019 Progress Software Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.ComponentModel;
using System.Reflection;
namespace Telerik.JustMock.Core.Context
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class AsyncContextResolver
{
#if NETCORE
static IAsyncContextResolver resolver = new AsyncLocalWrapper();
#else
static IAsyncContextResolver resolver = new CallContextWrapper();
#endif
public static MethodBase GetContext()
{
return resolver.GetContext();
}
public static void CaptureContext()
{
resolver.CaptureContext();
}
}
}
|
Move EditorBrowsable to class level
|
Move EditorBrowsable to class level
|
C#
|
apache-2.0
|
telerik/JustMockLite
|
ecd03b8bb358954ff85b78ebaaa86de841fbdcb9
|
tools/Build/Build.cs
|
tools/Build/Build.cs
|
using System;
using Faithlife.Build;
internal static class Build
{
public static int Main(string[] args) => BuildRunner.Execute(args, build =>
{
build.AddDotNetTargets(
new DotNetBuildSettings
{
DocsSettings = new DotNetDocsSettings
{
GitLogin = new GitLoginInfo("ejball", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
GitAuthor = new GitAuthorInfo("ejball", "ejball@gmail.com"),
SourceCodeUrl = "https://github.com/ejball/ArgsReading/tree/master/src",
},
});
build.Target("default")
.DependsOn("build");
});
}
|
using System;
using Faithlife.Build;
internal static class Build
{
public static int Main(string[] args) => BuildRunner.Execute(args, build =>
{
build.AddDotNetTargets(
new DotNetBuildSettings
{
DocsSettings = new DotNetDocsSettings
{
GitLogin = new GitLoginInfo("ejball", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
GitAuthor = new GitAuthorInfo("ejball", "ejball@gmail.com"),
SourceCodeUrl = "https://github.com/ejball/ArgsReading/tree/master/src",
ToolVersion = "1.5.1",
},
});
build.Target("default")
.DependsOn("build");
});
}
|
Use latest xmldocmd to fix publish.
|
Use latest xmldocmd to fix publish.
|
C#
|
mit
|
ejball/ArgsReading
|
3ed1f15a1053ac45e9cbd3f9f3cfe6c15f4abf20
|
Raven.TimeZones/ZoneShapesIndex.cs
|
Raven.TimeZones/ZoneShapesIndex.cs
|
using System.Linq;
using Raven.Client.Indexes;
namespace Raven.TimeZones
{
public class ZoneShapesIndex : AbstractIndexCreationTask<ZoneShape>
{
public ZoneShapesIndex()
{
Map = shapes => from shape in shapes
select new
{
shape.Zone,
_ = SpatialGenerate("location", shape.Shape)
};
}
}
}
|
using System.Linq;
using Raven.Abstractions.Indexing;
using Raven.Client.Indexes;
namespace Raven.TimeZones
{
public class ZoneShapesIndex : AbstractIndexCreationTask<ZoneShape>
{
public ZoneShapesIndex()
{
Map = shapes => from shape in shapes
select new
{
shape.Zone,
_ = SpatialGenerate("location", shape.Shape, SpatialSearchStrategy.GeohashPrefixTree, 3)
};
}
}
}
|
Use a lower maxTreeLevel precision
|
Use a lower maxTreeLevel precision
https://groups.google.com/d/topic/ravendb/a6xFRI8nKZc/discussion
|
C#
|
mit
|
mj1856/RavenDB-TimeZones
|
a09373721bbb953571c77b1cb55e30333c424c09
|
src/SJP.Schematic.Reporting/Html/TemplateProvider.cs
|
src/SJP.Schematic.Reporting/Html/TemplateProvider.cs
|
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using EnumsNET;
using Microsoft.Extensions.FileProviders;
namespace SJP.Schematic.Reporting.Html
{
internal class TemplateProvider : ITemplateProvider
{
public string GetTemplate(ReportTemplate template)
{
if (!template.IsValid())
throw new ArgumentException($"The { nameof(ReportTemplate) } provided must be a valid enum.", nameof(template));
var resource = GetResource(template);
return GetResourceAsString(resource);
}
private static IFileInfo GetResource(ReportTemplate template)
{
var templateKey = template.ToString();
var templateFileName = templateKey + TemplateExtension;
var resourceFiles = _fileProvider.GetDirectoryContents("/");
var templateResource = resourceFiles.FirstOrDefault(r => r.Name.EndsWith(templateFileName));
if (templateResource == null)
throw new NotSupportedException($"The given template: { templateKey } is not a supported template.");
return templateResource;
}
private static string GetResourceAsString(IFileInfo fileInfo)
{
if (fileInfo == null)
throw new ArgumentNullException(nameof(fileInfo));
using (var stream = new MemoryStream())
using (var reader = fileInfo.CreateReadStream())
{
reader.CopyTo(stream);
return Encoding.UTF8.GetString(stream.GetBuffer(), 0, (int)stream.Length);
}
}
private static readonly IFileProvider _fileProvider = new EmbeddedFileProvider(Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name + ".Html.Templates");
private const string TemplateExtension = ".cshtml";
}
}
|
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using EnumsNET;
using Microsoft.Extensions.FileProviders;
namespace SJP.Schematic.Reporting.Html
{
internal class TemplateProvider : ITemplateProvider
{
public string GetTemplate(ReportTemplate template)
{
if (!template.IsValid())
throw new ArgumentException($"The { nameof(ReportTemplate) } provided must be a valid enum.", nameof(template));
var resource = GetResource(template);
return GetResourceAsString(resource);
}
private static IFileInfo GetResource(ReportTemplate template)
{
var templateKey = template.ToString();
var templateFileName = templateKey + TemplateExtension;
var resourceFiles = _fileProvider.GetDirectoryContents("/");
var templateResource = resourceFiles.FirstOrDefault(r => r.Name.EndsWith(templateFileName));
if (templateResource == null)
throw new NotSupportedException($"The given template: { templateKey } is not a supported template.");
return templateResource;
}
private static string GetResourceAsString(IFileInfo fileInfo)
{
if (fileInfo == null)
throw new ArgumentNullException(nameof(fileInfo));
using (var stream = fileInfo.CreateReadStream())
using (var reader = new StreamReader(stream))
return reader.ReadToEnd();
}
private static readonly IFileProvider _fileProvider = new EmbeddedFileProvider(Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name + ".Html.Templates");
private const string TemplateExtension = ".cshtml";
}
}
|
Clean up reading templates from embedded resources.
|
Clean up reading templates from embedded resources.
Use a StreamReader instead of a MemoryStream that assumes UTF-8.
|
C#
|
mit
|
sjp/Schematic,sjp/Schematic,sjp/Schematic,sjp/SJP.Schema,sjp/Schematic
|
44ea7cee53973e95b04ca280b45758747e10dde8
|
Alexa.NET.Management/Package/ImportStatus.cs
|
Alexa.NET.Management/Package/ImportStatus.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Alexa.NET.Management.Package
{
public enum ImportStatus
{
FAILED,
IN_PROGRESS,
SUCCEEEDED
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Alexa.NET.Management.Package
{
public enum ImportStatus
{
FAILED,
IN_PROGRESS,
SUCCEEDED
}
}
|
Fix import status succeeded spelling error
|
Fix import status succeeded spelling error
|
C#
|
mit
|
stoiveyp/Alexa.NET.Management
|
6b2a286083c3cbf21cd4fa14a480b7b5164a155b
|
Assets/Scripts/Global/UnlockCursorOnStart.cs
|
Assets/Scripts/Global/UnlockCursorOnStart.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UnlockCursorOnStart : MonoBehaviour
{
void Start()
{
Invoke("unlockCursor", .1f);
}
void unlockCursor()
{
Cursor.lockState = GameController.DefaultCursorMode;
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UnlockCursorOnStart : MonoBehaviour
{
[SerializeField]
bool forceOnUpdate = true;
void Start()
{
Invoke("unlockCursor", .1f);
}
void unlockCursor()
{
Cursor.lockState = GameController.DefaultCursorMode;
}
private void Update()
{
if (Cursor.lockState != GameController.DefaultCursorMode)
Cursor.lockState = GameController.DefaultCursorMode;
}
}
|
Make cursor redundancy more redundant
|
Make cursor redundancy more redundant
|
C#
|
mit
|
Barleytree/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare
|
64127341ab80353baf82d7fd0470d8ac52a25972
|
Views/Price.cshtml
|
Views/Price.cshtml
|
@if (Model.DiscountedPrice != Model.Price)
{
<b class="inactive-price" style="text-decoration:line-through" title="@T("Was {0}", Model.Price.ToString("c"))">@Model.Price.ToString("c")</b>
<b class="discounted-price" title="@T("Now {0}", Model.DiscountedPrice.ToString("c"))">@Model.DiscountedPrice.ToString("c")</b>
<span class="discount-comment">@Model.DiscountComment</span>
}
else
{
<b>@Model.Price.ToString("c")</b>
}
|
@if (Model.DiscountedPrice != Model.Price)
{
<b class="inactive-price" style="text-decoration:line-through" title="@T("Was {0:c}", Model.Price)">@Model.Price.ToString("c")</b>
<b class="discounted-price" title="@T("Now {0:c}", Model.DiscountedPrice)">@Model.DiscountedPrice.ToString("c")</b>
<span class="discount-comment">@Model.DiscountComment</span>
}
else
{
<b>@Model.Price.ToString("c")</b>
}
|
Use {0:c} rather than ToString("c") where possible.
|
Use {0:c} rather than ToString("c") where possible.
--HG--
branch : currency_string_format
|
C#
|
bsd-3-clause
|
bleroy/Nwazet.Commerce,bleroy/Nwazet.Commerce
|
84950e5ce3c91f170438d25373baec35c380f9b8
|
src/RawRabbit/Common/BasicPropertiesProvider.cs
|
src/RawRabbit/Common/BasicPropertiesProvider.cs
|
using System;
using System.Collections.Generic;
using RabbitMQ.Client;
using RabbitMQ.Client.Framing;
namespace RawRabbit.Common
{
public interface IBasicPropertiesProvider
{
IBasicProperties GetProperties<TMessage>(Action<IBasicProperties> custom = null);
}
public class BasicPropertiesProvider : IBasicPropertiesProvider
{
public IBasicProperties GetProperties<TMessage>(Action<IBasicProperties> custom = null)
{
var properties = new BasicProperties
{
MessageId = Guid.NewGuid().ToString(),
Persistent = true,
Headers = new Dictionary<string, object>
{
{ PropertyHeaders.Sent, DateTime.UtcNow.ToString("u") },
{ PropertyHeaders.MessageType, typeof(TMessage).FullName }
}
};
custom?.Invoke(properties);
return properties;
}
}
}
|
using System;
using System.Collections.Generic;
using RabbitMQ.Client;
using RabbitMQ.Client.Framing;
using RawRabbit.Configuration;
namespace RawRabbit.Common
{
public interface IBasicPropertiesProvider
{
IBasicProperties GetProperties<TMessage>(Action<IBasicProperties> custom = null);
}
public class BasicPropertiesProvider : IBasicPropertiesProvider
{
private readonly RawRabbitConfiguration _config;
public BasicPropertiesProvider(RawRabbitConfiguration config)
{
_config = config;
}
public IBasicProperties GetProperties<TMessage>(Action<IBasicProperties> custom = null)
{
var properties = new BasicProperties
{
MessageId = Guid.NewGuid().ToString(),
Persistent = _config.PersistentDeliveryMode,
Headers = new Dictionary<string, object>
{
{ PropertyHeaders.Sent, DateTime.UtcNow.ToString("u") },
{ PropertyHeaders.MessageType, typeof(TMessage).FullName }
}
};
custom?.Invoke(properties);
return properties;
}
}
}
|
Use Persist value from config.
|
Use Persist value from config.
|
C#
|
mit
|
northspb/RawRabbit,pardahlman/RawRabbit
|
e1ba1b6fbb65ed6681c990c5070e85512afb3c7f
|
Emotion.Plugins.ImGuiNet/ImGuiExtensions.cs
|
Emotion.Plugins.ImGuiNet/ImGuiExtensions.cs
|
#region Using
using System;
using System.Numerics;
using Emotion.Graphics.Objects;
using Emotion.Primitives;
#endregion
namespace Emotion.Plugins.ImGuiNet
{
public static class ImGuiExtensions
{
public static Tuple<Vector2, Vector2> GetImGuiUV(this Texture t, Rectangle? uv = null)
{
Rectangle reqUv;
if (uv == null)
reqUv = new Rectangle(0, 0, t.Size);
else
reqUv = (Rectangle) uv;
Vector2 uvOne = new Vector2(
reqUv.X / t.Size.X,
reqUv.Y / t.Size.Y * -1
);
Vector2 uvTwo = new Vector2(
(reqUv.X + reqUv.Size.X) / t.Size.X,
(reqUv.Y + reqUv.Size.Y) / t.Size.Y * -1
);
return new Tuple<Vector2, Vector2>(uvOne, uvTwo);
}
}
}
|
#region Using
using System;
using System.Numerics;
using Emotion.Graphics;
using Emotion.Graphics.Objects;
using Emotion.Primitives;
using ImGuiNET;
#endregion
namespace Emotion.Plugins.ImGuiNet
{
public static class ImGuiExtensions
{
public static Tuple<Vector2, Vector2> GetImGuiUV(this Texture t, Rectangle? uv = null)
{
Rectangle reqUv;
if (uv == null)
reqUv = new Rectangle(0, 0, t.Size);
else
reqUv = (Rectangle) uv;
Vector2 uvOne = new Vector2(
reqUv.X / t.Size.X,
reqUv.Y / t.Size.Y * -1
);
Vector2 uvTwo = new Vector2(
(reqUv.X + reqUv.Size.X) / t.Size.X,
(reqUv.Y + reqUv.Size.Y) / t.Size.Y * -1
);
return new Tuple<Vector2, Vector2>(uvOne, uvTwo);
}
public static void RenderUI(this RenderComposer composer)
{
ImGuiNetPlugin.RenderUI(composer);
}
}
}
|
Add util extention for rendering GUI.
|
feat: Add util extention for rendering GUI.
|
C#
|
mit
|
Cryru/SoulEngine
|
83847904550b7843b4060fc263521e7dbc22030c
|
AngleSharp.Core.Tests/Library/PageImport.cs
|
AngleSharp.Core.Tests/Library/PageImport.cs
|
namespace AngleSharp.Core.Tests.Library
{
using AngleSharp.Core.Tests.Mocks;
using AngleSharp.Dom.Html;
using AngleSharp.Extensions;
using NUnit.Framework;
using System;
using System.Threading.Tasks;
[TestFixture]
public class PageImportTests
{
[Test]
public async Task ImportPageFromVirtualRequest()
{
var requester = new MockRequester();
var receivedRequest = new TaskCompletionSource<String>();
requester.OnRequest = request => receivedRequest.SetResult(request.Address.Href);
var config = Configuration.Default.WithDefaultLoader(setup => setup.IsResourceLoadingEnabled = true, new[] { requester });
var document = await BrowsingContext.New(config).OpenAsync(m => m.Content("<!doctype html><link rel=import href=http://example.com/test.html>"));
var link = document.QuerySelector<IHtmlLinkElement>("link");
var result = await receivedRequest.Task;
Assert.AreEqual("import", link.Relation);
Assert.IsNotNull(link.Import);
Assert.AreEqual("http://example.com/test.html", result);
}
}
}
|
namespace AngleSharp.Core.Tests.Library
{
using AngleSharp.Core.Tests.Mocks;
using AngleSharp.Dom.Html;
using AngleSharp.Extensions;
using NUnit.Framework;
using System;
using System.Threading.Tasks;
[TestFixture]
public class PageImportTests
{
[Test]
public async Task ImportPageFromVirtualRequest()
{
var requester = new MockRequester();
var receivedRequest = new TaskCompletionSource<String>();
requester.OnRequest = request => receivedRequest.SetResult(request.Address.Href);
var config = Configuration.Default.WithDefaultLoader(setup => setup.IsResourceLoadingEnabled = true, new[] { requester });
var document = await BrowsingContext.New(config).OpenAsync(m => m.Content("<!doctype html><link rel=import href=http://example.com/test.html>"));
var link = document.QuerySelector<IHtmlLinkElement>("link");
var result = await receivedRequest.Task;
Assert.AreEqual("import", link.Relation);
Assert.IsNotNull(link.Import);
Assert.AreEqual("http://example.com/test.html", result);
}
[Test]
public async Task ImportPageFromDataRequest()
{
var receivedRequest = new TaskCompletionSource<Boolean>();
var config = Configuration.Default.WithDefaultLoader(setup =>
{
setup.IsResourceLoadingEnabled = true;
setup.Filter = request =>
{
receivedRequest.SetResult(true);
return true;
};
});
var document = await BrowsingContext.New(config).OpenAsync(m => m.Content("<!doctype html><link rel=import href='data:text/html,<div>foo</div>'>"));
var link = document.QuerySelector<IHtmlLinkElement>("link");
var finished = await receivedRequest.Task;
Assert.AreEqual("import", link.Relation);
Assert.IsNotNull(link.Import);
Assert.AreEqual("foo", link.Import.QuerySelector("div").TextContent);
}
}
}
|
Test for loading import from data url
|
Test for loading import from data url
|
C#
|
mit
|
FlorianRappl/AngleSharp,AngleSharp/AngleSharp,FlorianRappl/AngleSharp,FlorianRappl/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp
|
164220c6e9444b40917f06a9d789214249f5351c
|
DynThings.WebPortal/Views/Endpoints/_List.cshtml
|
DynThings.WebPortal/Views/Endpoints/_List.cshtml
|
@model PagedList.IPagedList<DynThings.Data.Models.Endpoint>
<table class="table striped hovered border bordered">
<thead>
<tr>
<th>Title</th>
<th>Type</th>
<th>GUID</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.EndPointType.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.GUID)
</td>
<td>
@Html.ActionLink("Details", "Details", new { id = item.ID })
</td>
</tr>
}
</tbody>
</table>
<div id="EndPointsListPager">
<input id="EndPointCurrentPage" value="@Model.PageNumber.ToString()" hidden />
@Html.PagedListPager(Model, page => Url.Action("ListPV", new { page }))
</div>
|
@model PagedList.IPagedList<DynThings.Data.Models.Endpoint>
<table class="table striped hovered border bordered">
<thead>
<tr>
<th>Title</th>
<th>Type</th>
<th>Device</th>
<th>Thing</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.EndPointType.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.Device.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.Thing.Title)
</td>
<td>
@Html.ActionLink("Details", "Details", new { id = item.ID })
</td>
</tr>
}
</tbody>
</table>
<div id="EndPointsListPager">
<input id="EndPointCurrentPage" value="@Model.PageNumber.ToString()" hidden />
@Html.PagedListPager(Model, page => Url.Action("ListPV", new { page }))
</div>
|
Add Device & Thing Titles to Endpoint GridList
|
Add Device & Thing Titles to Endpoint GridList
|
C#
|
mit
|
MagedAlNaamani/DynThings,MagedAlNaamani/DynThings,cmoussalli/DynThings,MagedAlNaamani/DynThings,cmoussalli/DynThings,MagedAlNaamani/DynThings,cmoussalli/DynThings,cmoussalli/DynThings
|
67599c9196d2c23d017e51071b483da8a4264898
|
TIKSN.Core/Data/LiteDB/LiteDbDatabaseProvider.cs
|
TIKSN.Core/Data/LiteDB/LiteDbDatabaseProvider.cs
|
using LiteDB;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.FileProviders;
namespace TIKSN.Data.LiteDB
{
/// <summary>
/// Create LiteDB database
/// </summary>
public class LiteDbDatabaseProvider : ILiteDbDatabaseProvider
{
private readonly IConfigurationRoot _configuration;
private readonly string _connectionStringKey;
private readonly IFileProvider _fileProvider;
public LiteDbDatabaseProvider(IConfigurationRoot configuration, string connectionStringKey,
IFileProvider fileProvider = null)
{
this._configuration = configuration;
this._connectionStringKey = connectionStringKey;
this._fileProvider = fileProvider;
}
/// <summary>
/// Creates LiteDB database with mapper
/// </summary>
/// <param name="mapper">Mapper</param>
/// <returns></returns>
public LiteDatabase GetDatabase(BsonMapper mapper)
{
var connectionString =
new ConnectionString(this._configuration.GetConnectionString(this._connectionStringKey));
if (this._fileProvider != null)
{
connectionString.Filename = this._fileProvider.GetFileInfo(connectionString.Filename).PhysicalPath;
}
return new LiteDatabase(connectionString);
}
/// <summary>
/// Creates LiteDB database
/// </summary>
/// <returns></returns>
public LiteDatabase GetDatabase() => this.GetDatabase(null);
}
}
|
using LiteDB;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.FileProviders;
namespace TIKSN.Data.LiteDB
{
/// <summary>
/// Create LiteDB database
/// </summary>
public class LiteDbDatabaseProvider : ILiteDbDatabaseProvider
{
private readonly IConfiguration _configuration;
private readonly string _connectionStringKey;
private readonly IFileProvider _fileProvider;
public LiteDbDatabaseProvider(IConfiguration configuration, string connectionStringKey,
IFileProvider fileProvider = null)
{
this._configuration = configuration;
this._connectionStringKey = connectionStringKey;
this._fileProvider = fileProvider;
}
/// <summary>
/// Creates LiteDB database with mapper
/// </summary>
/// <param name="mapper">Mapper</param>
/// <returns></returns>
public LiteDatabase GetDatabase(BsonMapper mapper)
{
var connectionString =
new ConnectionString(this._configuration.GetConnectionString(this._connectionStringKey));
if (this._fileProvider != null)
{
connectionString.Filename = this._fileProvider.GetFileInfo(connectionString.Filename).PhysicalPath;
}
return new LiteDatabase(connectionString);
}
/// <summary>
/// Creates LiteDB database
/// </summary>
/// <returns></returns>
public LiteDatabase GetDatabase() => this.GetDatabase(null);
}
}
|
Use IConfiguration instead of IConfigurationRoot
|
Use IConfiguration instead of IConfigurationRoot
|
C#
|
mit
|
tiksn/TIKSN-Framework
|
c608b63b63a14a5c7949bf4de3359aa3400823d4
|
src/Commands/KillCommand.cs
|
src/Commands/KillCommand.cs
|
/*
* SDB - Mono Soft Debugger Client
* Copyright 2013 Alex Rønne Petersen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Collections.Generic;
namespace Mono.Debugger.Client.Commands
{
sealed class KillCommand : Command
{
public override string[] Names
{
get { return new[] { "kill", "stop" }; }
}
public override string Summary
{
get { return "Kill the inferior process."; }
}
public override string Syntax
{
get { return "kill|stop"; }
}
public override void Process(string args)
{
if (Debugger.State == State.Exited)
Log.Error("No inferior process");
else
Debugger.Kill();
}
}
}
|
/*
* SDB - Mono Soft Debugger Client
* Copyright 2013 Alex Rønne Petersen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Collections.Generic;
namespace Mono.Debugger.Client.Commands
{
sealed class KillCommand : Command
{
public override string[] Names
{
get { return new[] { "kill" }; }
}
public override string Summary
{
get { return "Kill the inferior process."; }
}
public override string Syntax
{
get { return "kill|stop"; }
}
public override void Process(string args)
{
if (Debugger.State == State.Exited)
Log.Error("No inferior process");
else
Debugger.Kill();
}
}
}
|
Remove the silly `stop` alias for `kill`.
|
Remove the silly `stop` alias for `kill`.
|
C#
|
mit
|
mono/sdb,mono/sdb
|
43100b90549d3cf14bc276abd1d4406ae8e68015
|
src/VideoConverter.cs
|
src/VideoConverter.cs
|
using System.Diagnostics;
namespace Cams
{
public static class VideoConverter
{
public static bool CodecCopy(string inputFile, string outputFile)
{
return Run($"-y -i {inputFile} -codec copy {outputFile}");
}
public static bool Concat(string listFilePath, string outputFile)
{
return Run($"-y -safe 0 -f concat -i {listFilePath} -c copy {outputFile}");
}
public static bool FastForward(string inputFile, string outputFile)
{
return Run($"-y -i {inputFile} -filter:v \"setpts = 0.01 * PTS\" {outputFile}");
}
public static bool CheckValidVideoFile(string inputFile)
{
return Run($"-v error -i {inputFile} -f null -");
}
static bool Run(string args)
{
using (var process = new Process
{
StartInfo = new ProcessStartInfo
{
CreateNoWindow = true,
FileName = "ffmpeg",
Arguments = args
}
})
{
process.Start();
process.WaitForExit();
return process.ExitCode == 0;
}
}
}
}
|
using System.Diagnostics;
namespace Cams
{
public static class VideoConverter
{
public static bool CodecCopy(string inputFile, string outputFile)
{
return Run($"-y -i {inputFile} -codec copy {outputFile}");
}
public static bool Concat(string listFilePath, string outputFile)
{
return Run($"-y -safe 0 -f concat -i {listFilePath} -c copy {outputFile}");
}
public static bool FastForward(string inputFile, string outputFile)
{
return Run($"-y -i {inputFile} -filter:v \"setpts = 0.01 * PTS\" -an {outputFile}");
}
public static bool CheckValidVideoFile(string inputFile)
{
return Run($"-v error -i {inputFile} -f null -");
}
static bool Run(string args)
{
using (var process = new Process
{
StartInfo = new ProcessStartInfo
{
CreateNoWindow = true,
FileName = "ffmpeg",
Arguments = args
}
})
{
process.Start();
process.WaitForExit();
return process.ExitCode == 0;
}
}
}
}
|
Drop audio in summary videos
|
Drop audio in summary videos
New Amcrest cameras record audio now
|
C#
|
mit
|
chadly/cams,chadly/vlc-rtsp,chadly/vlc-rtsp,chadly/vlc-rtsp
|
f110c050f79129d81da3a23f19b78da13b64039e
|
source/CSharp.BlankApplication/Program.cs
|
source/CSharp.BlankApplication/Program.cs
|
using System;
namespace $safeprojectname$
{
public class Program
{
public static void Main()
{
}
}
}
|
using System;
namespace $safeprojectname$
{
public class Program
{
public static void Main()
{
// Insert your code below this line
// The main() method has to end with this infinite loop.
// Do not use the NETMF style : Thread.Sleep(Timeout.Infinite)
while (true)
{
Thread.Sleep(200);
}
}
}
}
|
Update application template with working code to prevent the main thread from exiting
|
Update application template with working code to prevent the main thread from exiting
|
C#
|
mit
|
nanoframework/nf-Visual-Studio-extension
|
7f1e9c22894de895e5b12e1e1647d0053edb11d1
|
src/PcscDotNet/PcscConnection.cs
|
src/PcscDotNet/PcscConnection.cs
|
namespace PcscDotNet
{
public class PcscConnection
{
public PcscContext Context { get; private set; }
public IPcscProvider Provider { get; private set; }
public string ReaderName { get; private set; }
public PcscConnection(PcscContext context, string readerName)
{
Provider = (Context = context).Provider;
ReaderName = readerName;
}
}
}
|
using System;
namespace PcscDotNet
{
public class PcscConnection : IDisposable
{
public PcscContext Context { get; private set; }
public SCardHandle Handle { get; private set; }
public bool IsConnect => Handle.HasValue;
public bool IsDisposed { get; private set; } = false;
public SCardProtocols Protocols { get; private set; } = SCardProtocols.Undefined;
public IPcscProvider Provider { get; private set; }
public string ReaderName { get; private set; }
public PcscConnection(PcscContext context, string readerName)
{
Provider = (Context = context).Provider;
ReaderName = readerName;
}
~PcscConnection()
{
Dispose();
}
public unsafe PcscConnection Connect(SCardShare shareMode, SCardProtocols protocols, PcscExceptionHandler onException = null)
{
SCardHandle handle;
Provider.SCardConnect(Context.Handle, ReaderName, shareMode, protocols, &handle, &protocols).ThrowIfNotSuccess(onException);
Handle = handle;
Protocols = protocols;
return this;
}
public PcscConnection Disconnect(SCardDisposition disposition = SCardDisposition.Leave, PcscExceptionHandler onException = null)
{
if (IsDisposed) throw new ObjectDisposedException(nameof(PcscConnection), nameof(Disconnect));
DisconnectInternal(disposition, onException);
return this;
}
public void Dispose()
{
if (IsDisposed) return;
DisconnectInternal();
IsDisposed = true;
GC.SuppressFinalize(this);
}
private void DisconnectInternal(SCardDisposition disposition = SCardDisposition.Leave, PcscExceptionHandler onException = null)
{
if (!IsConnect) return;
Provider.SCardDisconnect(Handle, disposition).ThrowIfNotSuccess(onException);
Handle = SCardHandle.Default;
Protocols = SCardProtocols.Undefined;
}
}
}
|
Add properties and methods about connection. Implement `IDisposable` interface.
|
Add properties and methods about connection.
Implement `IDisposable` interface.
|
C#
|
mit
|
Archie-Yang/PcscDotNet
|
b2be561e3f37364406e2eb6d00f3f9ec9b97285c
|
src/Orchard/Caching/DefaultCacheHolder.cs
|
src/Orchard/Caching/DefaultCacheHolder.cs
|
using System;
using System.Collections.Generic;
using Castle.Core;
namespace Orchard.Caching {
public class DefaultCacheHolder : ICacheHolder {
private readonly IDictionary<CacheKey, object> _caches = new Dictionary<CacheKey, object>();
class CacheKey : Pair<Type, Pair<Type, Type>> {
public CacheKey(Type component, Type key, Type result)
: base(component, new Pair<Type, Type>(key, result)) {
}
}
public ICache<TKey, TResult> GetCache<TKey, TResult>(Type component) {
var cacheKey = new CacheKey(component, typeof(TKey), typeof(TResult));
lock (_caches) {
object value;
if (!_caches.TryGetValue(cacheKey, out value)) {
value = new Cache<TKey, TResult>();
_caches[cacheKey] = value;
}
return (ICache<TKey, TResult>)value;
}
}
}
}
|
using System;
using System.Collections.Concurrent;
namespace Orchard.Caching {
public class DefaultCacheHolder : ICacheHolder {
private readonly ConcurrentDictionary<CacheKey, object> _caches = new ConcurrentDictionary<CacheKey, object>();
class CacheKey : Tuple<Type, Type, Type> {
public CacheKey(Type component, Type key, Type result)
: base(component, key, result) {
}
}
public ICache<TKey, TResult> GetCache<TKey, TResult>(Type component) {
var cacheKey = new CacheKey(component, typeof(TKey), typeof(TResult));
var result = _caches.GetOrAdd(cacheKey, k => new Cache<TKey, TResult>());
return (Cache<TKey, TResult>)result;
}
}
}
|
Use ConcurrentDictionary to simplify code
|
Use ConcurrentDictionary to simplify code
--HG--
branch : dev
|
C#
|
bsd-3-clause
|
MetSystem/Orchard,dcinzona/Orchard-Harvest-Website,dcinzona/Orchard,xiaobudian/Orchard,li0803/Orchard,rtpHarry/Orchard,neTp9c/Orchard,yonglehou/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,MpDzik/Orchard,tobydodds/folklife,neTp9c/Orchard,mvarblow/Orchard,Praggie/Orchard,kgacova/Orchard,patricmutwiri/Orchard,MetSystem/Orchard,openbizgit/Orchard,xkproject/Orchard,dcinzona/Orchard,bedegaming-aleksej/Orchard,stormleoxia/Orchard,vairam-svs/Orchard,Inner89/Orchard,bigfont/orchard-cms-modules-and-themes,dozoft/Orchard,Sylapse/Orchard.HttpAuthSample,OrchardCMS/Orchard,SzymonSel/Orchard,marcoaoteixeira/Orchard,salarvand/orchard,Codinlab/Orchard,dozoft/Orchard,qt1/orchard4ibn,armanforghani/Orchard,salarvand/orchard,mvarblow/Orchard,omidnasri/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,yonglehou/Orchard,escofieldnaxos/Orchard,Dolphinsimon/Orchard,grapto/Orchard.CloudBust,sebastienros/msc,cooclsee/Orchard,TalaveraTechnologySolutions/Orchard,huoxudong125/Orchard,yonglehou/Orchard,Sylapse/Orchard.HttpAuthSample,xiaobudian/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,jerryshi2007/Orchard,vard0/orchard.tan,jtkech/Orchard,AEdmunds/beautiful-springtime,DonnotRain/Orchard,m2cms/Orchard,geertdoornbos/Orchard,kouweizhong/Orchard,alejandroaldana/Orchard,luchaoshuai/Orchard,bedegaming-aleksej/Orchard,stormleoxia/Orchard,hbulzy/Orchard,geertdoornbos/Orchard,fortunearterial/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,KeithRaven/Orchard,vard0/orchard.tan,Fogolan/OrchardForWork,SzymonSel/Orchard,caoxk/orchard,jagraz/Orchard,openbizgit/Orchard,hbulzy/Orchard,jchenga/Orchard,sebastienros/msc,sfmskywalker/Orchard,AEdmunds/beautiful-springtime,geertdoornbos/Orchard,jagraz/Orchard,qt1/Orchard,bedegaming-aleksej/Orchard,enspiral-dev-academy/Orchard,cryogen/orchard,AdvantageCS/Orchard,vairam-svs/Orchard,SeyDutch/Airbrush,Cphusion/Orchard,neTp9c/Orchard,SouleDesigns/SouleDesigns.Orchard,harmony7/Orchard,JRKelso/Orchard,Lombiq/Orchard,angelapper/Orchard,Praggie/Orchard,aaronamm/Orchard,RoyalVeterinaryCollege/Orchard,bigfont/orchard-cms-modules-and-themes,andyshao/Orchard,JRKelso/Orchard,asabbott/chicagodevnet-website,OrchardCMS/Orchard,rtpHarry/Orchard,planetClaire/Orchard-LETS,vairam-svs/Orchard,emretiryaki/Orchard,mgrowan/Orchard,jimasp/Orchard,arminkarimi/Orchard,IDeliverable/Orchard,Serlead/Orchard,jersiovic/Orchard,escofieldnaxos/Orchard,oxwanawxo/Orchard,bigfont/orchard-continuous-integration-demo,cooclsee/Orchard,SeyDutch/Airbrush,oxwanawxo/Orchard,yersans/Orchard,Morgma/valleyviewknolls,RoyalVeterinaryCollege/Orchard,escofieldnaxos/Orchard,abhishekluv/Orchard,jersiovic/Orchard,Morgma/valleyviewknolls,kouweizhong/Orchard,austinsc/Orchard,patricmutwiri/Orchard,dburriss/Orchard,brownjordaninternational/OrchardCMS,TalaveraTechnologySolutions/Orchard,rtpHarry/Orchard,TalaveraTechnologySolutions/Orchard,MpDzik/Orchard,li0803/Orchard,hannan-azam/Orchard,johnnyqian/Orchard,sfmskywalker/Orchard,JRKelso/Orchard,RoyalVeterinaryCollege/Orchard,TaiAivaras/Orchard,jersiovic/Orchard,andyshao/Orchard,IDeliverable/Orchard,aaronamm/Orchard,salarvand/Portal,xkproject/Orchard,jerryshi2007/Orchard,Sylapse/Orchard.HttpAuthSample,sfmskywalker/Orchard,Anton-Am/Orchard,sfmskywalker/Orchard,KeithRaven/Orchard,hhland/Orchard,TaiAivaras/Orchard,jaraco/orchard,mgrowan/Orchard,Morgma/valleyviewknolls,yersans/Orchard,enspiral-dev-academy/Orchard,OrchardCMS/Orchard,harmony7/Orchard,Serlead/Orchard,jagraz/Orchard,spraiin/Orchard,TalaveraTechnologySolutions/Orchard,DonnotRain/Orchard,stormleoxia/Orchard,fassetar/Orchard,ehe888/Orchard,jagraz/Orchard,Serlead/Orchard,Serlead/Orchard,marcoaoteixeira/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,SouleDesigns/SouleDesigns.Orchard,jtkech/Orchard,arminkarimi/Orchard,rtpHarry/Orchard,MpDzik/Orchard,jersiovic/Orchard,Lombiq/Orchard,bigfont/orchard-cms-modules-and-themes,angelapper/Orchard,AdvantageCS/Orchard,NIKASoftwareDevs/Orchard,omidnasri/Orchard,xkproject/Orchard,Lombiq/Orchard,caoxk/orchard,kgacova/Orchard,jerryshi2007/Orchard,enspiral-dev-academy/Orchard,smartnet-developers/Orchard,hannan-azam/Orchard,sfmskywalker/Orchard,planetClaire/Orchard-LETS,SzymonSel/Orchard,omidnasri/Orchard,Dolphinsimon/Orchard,jchenga/Orchard,fortunearterial/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,vard0/orchard.tan,armanforghani/Orchard,ehe888/Orchard,cryogen/orchard,TaiAivaras/Orchard,abhishekluv/Orchard,austinsc/Orchard,dburriss/Orchard,Inner89/Orchard,SouleDesigns/SouleDesigns.Orchard,jimasp/Orchard,Inner89/Orchard,enspiral-dev-academy/Orchard,aaronamm/Orchard,qt1/Orchard,Morgma/valleyviewknolls,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Codinlab/Orchard,johnnyqian/Orchard,Anton-Am/Orchard,SeyDutch/Airbrush,jaraco/orchard,m2cms/Orchard,smartnet-developers/Orchard,fortunearterial/Orchard,openbizgit/Orchard,harmony7/Orchard,jtkech/Orchard,DonnotRain/Orchard,ehe888/Orchard,Ermesx/Orchard,dcinzona/Orchard-Harvest-Website,Ermesx/Orchard,salarvand/orchard,planetClaire/Orchard-LETS,jerryshi2007/Orchard,bedegaming-aleksej/Orchard,MetSystem/Orchard,abhishekluv/Orchard,OrchardCMS/Orchard,Codinlab/Orchard,planetClaire/Orchard-LETS,andyshao/Orchard,SouleDesigns/SouleDesigns.Orchard,gcsuk/Orchard,angelapper/Orchard,NIKASoftwareDevs/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,KeithRaven/Orchard,harmony7/Orchard,TalaveraTechnologySolutions/Orchard,arminkarimi/Orchard,geertdoornbos/Orchard,xiaobudian/Orchard,hbulzy/Orchard,phillipsj/Orchard,grapto/Orchard.CloudBust,OrchardCMS/Orchard-Harvest-Website,sebastienros/msc,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,yersans/Orchard,Lombiq/Orchard,marcoaoteixeira/Orchard,sfmskywalker/Orchard,infofromca/Orchard,fassetar/Orchard,DonnotRain/Orchard,omidnasri/Orchard,IDeliverable/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,cooclsee/Orchard,brownjordaninternational/OrchardCMS,AdvantageCS/Orchard,xkproject/Orchard,qt1/orchard4ibn,dmitry-urenev/extended-orchard-cms-v10.1,johnnyqian/Orchard,JRKelso/Orchard,qt1/Orchard,harmony7/Orchard,vard0/orchard.tan,dmitry-urenev/extended-orchard-cms-v10.1,yersans/Orchard,OrchardCMS/Orchard-Harvest-Website,Dolphinsimon/Orchard,brownjordaninternational/OrchardCMS,Anton-Am/Orchard,luchaoshuai/Orchard,gcsuk/Orchard,Praggie/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,AndreVolksdorf/Orchard,luchaoshuai/Orchard,vairam-svs/Orchard,jtkech/Orchard,aaronamm/Orchard,huoxudong125/Orchard,dcinzona/Orchard-Harvest-Website,LaserSrl/Orchard,phillipsj/Orchard,SeyDutch/Airbrush,dcinzona/Orchard-Harvest-Website,NIKASoftwareDevs/Orchard,armanforghani/Orchard,escofieldnaxos/Orchard,Fogolan/OrchardForWork,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,huoxudong125/Orchard,marcoaoteixeira/Orchard,hhland/Orchard,LaserSrl/Orchard,abhishekluv/Orchard,alejandroaldana/Orchard,OrchardCMS/Orchard-Harvest-Website,xiaobudian/Orchard,li0803/Orchard,ericschultz/outercurve-orchard,johnnyqian/Orchard,qt1/orchard4ibn,OrchardCMS/Orchard-Harvest-Website,kgacova/Orchard,jaraco/orchard,dburriss/Orchard,openbizgit/Orchard,gcsuk/Orchard,xiaobudian/Orchard,dozoft/Orchard,asabbott/chicagodevnet-website,fortunearterial/Orchard,kouweizhong/Orchard,qt1/Orchard,AEdmunds/beautiful-springtime,KeithRaven/Orchard,oxwanawxo/Orchard,salarvand/Portal,kouweizhong/Orchard,Inner89/Orchard,austinsc/Orchard,hannan-azam/Orchard,Dolphinsimon/Orchard,bigfont/orchard-continuous-integration-demo,omidnasri/Orchard,dozoft/Orchard,mgrowan/Orchard,jimasp/Orchard,neTp9c/Orchard,Sylapse/Orchard.HttpAuthSample,spraiin/Orchard,AdvantageCS/Orchard,hannan-azam/Orchard,austinsc/Orchard,oxwanawxo/Orchard,omidnasri/Orchard,rtpHarry/Orchard,smartnet-developers/Orchard,Ermesx/Orchard,LaserSrl/Orchard,TalaveraTechnologySolutions/Orchard,salarvand/Portal,TaiAivaras/Orchard,huoxudong125/Orchard,ericschultz/outercurve-orchard,jimasp/Orchard,gcsuk/Orchard,jersiovic/Orchard,omidnasri/Orchard,tobydodds/folklife,yersans/Orchard,Serlead/Orchard,Praggie/Orchard,qt1/orchard4ibn,Dolphinsimon/Orchard,ericschultz/outercurve-orchard,andyshao/Orchard,mvarblow/Orchard,tobydodds/folklife,fassetar/Orchard,mvarblow/Orchard,spraiin/Orchard,omidnasri/Orchard,abhishekluv/Orchard,bigfont/orchard-continuous-integration-demo,dcinzona/Orchard,sebastienros/msc,dcinzona/Orchard,asabbott/chicagodevnet-website,Cphusion/Orchard,infofromca/Orchard,cooclsee/Orchard,brownjordaninternational/OrchardCMS,phillipsj/Orchard,asabbott/chicagodevnet-website,xkproject/Orchard,oxwanawxo/Orchard,grapto/Orchard.CloudBust,arminkarimi/Orchard,Cphusion/Orchard,OrchardCMS/Orchard-Harvest-Website,spraiin/Orchard,RoyalVeterinaryCollege/Orchard,m2cms/Orchard,infofromca/Orchard,grapto/Orchard.CloudBust,planetClaire/Orchard-LETS,TaiAivaras/Orchard,stormleoxia/Orchard,kgacova/Orchard,jtkech/Orchard,escofieldnaxos/Orchard,vard0/orchard.tan,infofromca/Orchard,jimasp/Orchard,omidnasri/Orchard,TalaveraTechnologySolutions/Orchard,yonglehou/Orchard,OrchardCMS/Orchard,qt1/orchard4ibn,SzymonSel/Orchard,jchenga/Orchard,vairam-svs/Orchard,phillipsj/Orchard,Fogolan/OrchardForWork,MpDzik/Orchard,Morgma/valleyviewknolls,armanforghani/Orchard,spraiin/Orchard,huoxudong125/Orchard,ericschultz/outercurve-orchard,MetSystem/Orchard,dburriss/Orchard,Inner89/Orchard,Cphusion/Orchard,kgacova/Orchard,JRKelso/Orchard,dcinzona/Orchard-Harvest-Website,hbulzy/Orchard,li0803/Orchard,geertdoornbos/Orchard,li0803/Orchard,emretiryaki/Orchard,johnnyqian/Orchard,AndreVolksdorf/Orchard,IDeliverable/Orchard,bigfont/orchard-cms-modules-and-themes,SeyDutch/Airbrush,patricmutwiri/Orchard,yonglehou/Orchard,salarvand/Portal,dburriss/Orchard,Lombiq/Orchard,openbizgit/Orchard,dcinzona/Orchard,MpDzik/Orchard,MetSystem/Orchard,NIKASoftwareDevs/Orchard,hbulzy/Orchard,Sylapse/Orchard.HttpAuthSample,salarvand/orchard,mvarblow/Orchard,armanforghani/Orchard,SouleDesigns/SouleDesigns.Orchard,LaserSrl/Orchard,gcsuk/Orchard,OrchardCMS/Orchard-Harvest-Website,m2cms/Orchard,tobydodds/folklife,salarvand/orchard,bedegaming-aleksej/Orchard,LaserSrl/Orchard,Praggie/Orchard,patricmutwiri/Orchard,SzymonSel/Orchard,Cphusion/Orchard,hhland/Orchard,angelapper/Orchard,AdvantageCS/Orchard,marcoaoteixeira/Orchard,luchaoshuai/Orchard,hannan-azam/Orchard,austinsc/Orchard,Ermesx/Orchard,TalaveraTechnologySolutions/Orchard,hhland/Orchard,Fogolan/OrchardForWork,sfmskywalker/Orchard,tobydodds/folklife,cryogen/orchard,cooclsee/Orchard,infofromca/Orchard,arminkarimi/Orchard,hhland/Orchard,alejandroaldana/Orchard,Ermesx/Orchard,ehe888/Orchard,dcinzona/Orchard-Harvest-Website,caoxk/orchard,andyshao/Orchard,brownjordaninternational/OrchardCMS,jagraz/Orchard,bigfont/orchard-cms-modules-and-themes,patricmutwiri/Orchard,salarvand/Portal,alejandroaldana/Orchard,qt1/Orchard,qt1/orchard4ibn,RoyalVeterinaryCollege/Orchard,Codinlab/Orchard,bigfont/orchard-continuous-integration-demo,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,m2cms/Orchard,KeithRaven/Orchard,Fogolan/OrchardForWork,grapto/Orchard.CloudBust,stormleoxia/Orchard,ehe888/Orchard,sfmskywalker/Orchard,AEdmunds/beautiful-springtime,smartnet-developers/Orchard,neTp9c/Orchard,jaraco/orchard,smartnet-developers/Orchard,aaronamm/Orchard,MpDzik/Orchard,AndreVolksdorf/Orchard,emretiryaki/Orchard,mgrowan/Orchard,fassetar/Orchard,phillipsj/Orchard,NIKASoftwareDevs/Orchard,AndreVolksdorf/Orchard,jerryshi2007/Orchard,caoxk/orchard,Anton-Am/Orchard,emretiryaki/Orchard,abhishekluv/Orchard,sebastienros/msc,vard0/orchard.tan,Anton-Am/Orchard,emretiryaki/Orchard,jchenga/Orchard,kouweizhong/Orchard,IDeliverable/Orchard,AndreVolksdorf/Orchard,Codinlab/Orchard,alejandroaldana/Orchard,cryogen/orchard,luchaoshuai/Orchard,angelapper/Orchard,jchenga/Orchard,fassetar/Orchard,dozoft/Orchard,grapto/Orchard.CloudBust,tobydodds/folklife,enspiral-dev-academy/Orchard,mgrowan/Orchard,DonnotRain/Orchard,fortunearterial/Orchard
|
0b3c16525e0bd2f08592189c770c5ac00d97679b
|
dotnet/Gherkin.AstGenerator/Program.cs
|
dotnet/Gherkin.AstGenerator/Program.cs
|
using System;
using System.Linq;
namespace Gherkin.AstGenerator
{
class Program
{
static int Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("Usage: Gherkin.AstGenerator.exe test-feature-file.feature");
return 100;
}
var startTime = Environment.TickCount;
foreach (var featureFilePath in args)
{
try
{
var astText = AstGenerator.GenerateAst(featureFilePath);
Console.WriteLine(astText);
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
}
var endTime = Environment.TickCount;
if (Environment.GetEnvironmentVariable("GHERKIN_PERF") != null)
{
Console.Error.WriteLine(endTime - startTime);
}
return 0;
}
}
}
|
using System;
using System.Linq;
namespace Gherkin.AstGenerator
{
class Program
{
static int Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("Usage: Gherkin.AstGenerator.exe test-feature-file.feature");
return 100;
}
var startTime = Environment.TickCount;
foreach (var featureFilePath in args)
{
try
{
var astText = AstGenerator.GenerateAst(featureFilePath);
Console.WriteLine(astText);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return 1;
}
}
var endTime = Environment.TickCount;
if (Environment.GetEnvironmentVariable("GHERKIN_PERF") != null)
{
Console.Error.WriteLine(endTime - startTime);
}
return 0;
}
}
}
|
Print to STDOUT - 2> is broken on Mono/OS X
|
Print to STDOUT - 2> is broken on Mono/OS X
|
C#
|
mit
|
dirkrombauts/gherkin3,Zearin/gherkin3,thiblahute/gherkin3,SabotageAndi/gherkin,pjlsergeant/gherkin,dg-ratiodata/gherkin3,hayd/gherkin3,moreirap/gherkin3,amaniak/gherkin3,amaniak/gherkin3,dirkrombauts/gherkin3,araines/gherkin3,moreirap/gherkin3,dirkrombauts/gherkin3,dirkrombauts/gherkin3,thetutlage/gherkin3,dirkrombauts/gherkin3,amaniak/gherkin3,Zearin/gherkin3,concertman/gherkin3,concertman/gherkin3,hayd/gherkin3,thiblahute/gherkin3,hayd/gherkin3,thetutlage/gherkin3,pjlsergeant/gherkin,thetutlage/gherkin3,thetutlage/gherkin3,curzona/gherkin3,curzona/gherkin3,dg-ratiodata/gherkin3,dg-ratiodata/gherkin3,dg-ratiodata/gherkin3,pjlsergeant/gherkin,araines/gherkin3,curzona/gherkin3,hayd/gherkin3,concertman/gherkin3,chebizarro/gherkin3,pjlsergeant/gherkin,moreirap/gherkin3,SabotageAndi/gherkin,dg-ratiodata/gherkin3,cucumber/gherkin3,cucumber/gherkin3,amaniak/gherkin3,dg-ratiodata/gherkin3,araines/gherkin3,chebizarro/gherkin3,chebizarro/gherkin3,moreirap/gherkin3,cucumber/gherkin3,pjlsergeant/gherkin,dirkrombauts/gherkin3,araines/gherkin3,thetutlage/gherkin3,hayd/gherkin3,concertman/gherkin3,cucumber/gherkin3,curzona/gherkin3,SabotageAndi/gherkin,pjlsergeant/gherkin,concertman/gherkin3,hayd/gherkin3,vincent-psarga/gherkin3,cucumber/gherkin3,SabotageAndi/gherkin,dirkrombauts/gherkin3,thiblahute/gherkin3,thiblahute/gherkin3,concertman/gherkin3,pjlsergeant/gherkin,thetutlage/gherkin3,Zearin/gherkin3,vincent-psarga/gherkin3,curzona/gherkin3,araines/gherkin3,cucumber/gherkin3,araines/gherkin3,thiblahute/gherkin3,amaniak/gherkin3,moreirap/gherkin3,chebizarro/gherkin3,thiblahute/gherkin3,dg-ratiodata/gherkin3,vincent-psarga/gherkin3,SabotageAndi/gherkin,chebizarro/gherkin3,hayd/gherkin3,Zearin/gherkin3,amaniak/gherkin3,pjlsergeant/gherkin,vincent-psarga/gherkin3,thetutlage/gherkin3,curzona/gherkin3,SabotageAndi/gherkin,SabotageAndi/gherkin,hayd/gherkin3,chebizarro/gherkin3,vincent-psarga/gherkin3,concertman/gherkin3,cucumber/gherkin3,curzona/gherkin3,cucumber/gherkin3,Zearin/gherkin3,Zearin/gherkin3,cucumber/gherkin3,concertman/gherkin3,SabotageAndi/gherkin,dg-ratiodata/gherkin3,amaniak/gherkin3,vincent-psarga/gherkin3,thiblahute/gherkin3,curzona/gherkin3,araines/gherkin3,chebizarro/gherkin3,pjlsergeant/gherkin,amaniak/gherkin3,thetutlage/gherkin3,vincent-psarga/gherkin3,Zearin/gherkin3,moreirap/gherkin3,thiblahute/gherkin3,araines/gherkin3,moreirap/gherkin3,Zearin/gherkin3,chebizarro/gherkin3,vincent-psarga/gherkin3,dirkrombauts/gherkin3,SabotageAndi/gherkin,moreirap/gherkin3
|
837a9065388adfb1a02926c304e5b61d501eb7e9
|
Content.Client/UserInterface/StatusEffectsUI.cs
|
Content.Client/UserInterface/StatusEffectsUI.cs
|
using Content.Client.Utility;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
namespace Content.Client.UserInterface
{
/// <summary>
/// The status effects display on the right side of the screen.
/// </summary>
public sealed class StatusEffectsUI : Control
{
private readonly VBoxContainer _vBox;
private TextureRect _healthStatusRect;
public StatusEffectsUI()
{
_vBox = new VBoxContainer {GrowHorizontal = GrowDirection.Begin};
AddChild(_vBox);
_vBox.AddChild(_healthStatusRect = new TextureRect
{
Texture = IoCManager.Resolve<IResourceCache>().GetTexture("/Textures/Mob/UI/Human/human0.png")
});
SetAnchorAndMarginPreset(LayoutPreset.TopRight);
MarginTop = 200;
}
public void SetHealthIcon(Texture texture)
{
_healthStatusRect.Texture = texture;
}
}
}
|
using Content.Client.Utility;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
namespace Content.Client.UserInterface
{
/// <summary>
/// The status effects display on the right side of the screen.
/// </summary>
public sealed class StatusEffectsUI : Control
{
private readonly VBoxContainer _vBox;
private TextureRect _healthStatusRect;
public StatusEffectsUI()
{
_vBox = new VBoxContainer {GrowHorizontal = GrowDirection.Begin};
AddChild(_vBox);
_vBox.AddChild(_healthStatusRect = new TextureRect
{
TextureScale = (2, 2),
Texture = IoCManager.Resolve<IResourceCache>().GetTexture("/Textures/Mob/UI/Human/human0.png")
});
SetAnchorAndMarginPreset(LayoutPreset.TopRight);
MarginTop = 200;
MarginRight = 10;
}
public void SetHealthIcon(Texture texture)
{
_healthStatusRect.Texture = texture;
}
}
}
|
Make Status Effects UI better positioned.
|
Make Status Effects UI better positioned.
|
C#
|
mit
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content
|
0c5752bf27942b035006252c3e21338d0d1cf7d1
|
src/Locking/IDistributedAppLock.cs
|
src/Locking/IDistributedAppLock.cs
|
using System;
namespace RapidCore.Locking
{
/// <summary>
/// When implemented in a downstream locker provider, this instance contains a handle to the underlying lock instance
/// </summary>
public interface IDistributedAppLock : IDisposable
{
/// <summary>
/// The name of the lock acquired
/// </summary>
string Name { get; set; }
}
}
|
using System;
namespace RapidCore.Locking
{
/// <summary>
/// When implemented in a downstream locker provider, this instance contains a handle to the underlying lock instance
/// </summary>
public interface IDistributedAppLock : IDisposable
{
/// <summary>
/// The name of the lock acquired
/// </summary>
string Name { get; set; }
/// <summary>
/// Determines whether the lock has been taken in the underlying source and is still active
/// </summary>
bool IsActive { get; set; }
/// <summary>
/// When implemented in a downstream provider it will verify that the current instance of the lock is in an
/// active (locked) state and has the name given to the method
/// </summary>
/// <param name="name"></param>
/// <exception cref="InvalidOperationException">
/// When the lock is either not active, or has a different name than provided in <paramref name="name"/>
/// </exception>
void ThrowIfNotActiveWithGivenName(string name);
}
}
|
Add IsActive and ThrowIfNotActiveWithGivenName to AppLock interface
|
Add IsActive and ThrowIfNotActiveWithGivenName to AppLock interface
|
C#
|
mit
|
rapidcore/rapidcore,rapidcore/rapidcore
|
9d764ff16cdafdd6296fcd7334fdbafc5cc15bd0
|
Cognition/Providers/TranslatorDataTypes.cs
|
Cognition/Providers/TranslatorDataTypes.cs
|
/* Empiria Extensions ****************************************************************************************
* *
* Module : Cognitive Services Component : Service provider *
* Assembly : Empiria.Cognition.dll Pattern : Data Transfer Objects *
* Type : TranslatorDataTypes License : Please read LICENSE.txt file *
* *
* Summary : Define data types for Microsoft Azure Cognition Translator Services. *
* *
************************* Copyright(c) La Vía Óntica SC, Ontica LLC and contributors. All rights reserved. **/
using System;
namespace Empiria.Cognition.Providers {
/// <summary>Summary : Define data types for Microsoft Azure Cognition Translator Services.</summary>
internal class Alignment {
internal string Proj {
get; set;
}
}
internal class SentenceLength {
internal int[] SrcSentLen {
get; set;
}
internal int[] TransSentLen {
get; set;
}
}
internal class Translation {
internal string Text {
get; set;
}
internal TextResult Transliteration {
get; set;
}
internal string To {
get; set;
}
internal Alignment Alignment {
get; set;
}
internal SentenceLength SentLen {
get; set;
}
}
internal class DetectedLanguage {
internal string Language {
get; set;
}
internal float Score {
get; set;
}
}
internal class TextResult {
internal string Text {
get; set;
}
internal string Script {
get; set;
}
}
internal class TranslatorDataTypes {
internal DetectedLanguage DetectedLanguage {
get; set;
}
internal TextResult SourceText {
get; set;
}
internal Translation[] Translations {
get; set;
}
}
}
|
/* Empiria Extensions ****************************************************************************************
* *
* Module : Cognitive Services Component : Service provider *
* Assembly : Empiria.Cognition.dll Pattern : Data Transfer Objects *
* Type : TranslatorDataTypes License : Please read LICENSE.txt file *
* *
* Summary : Define data types for Microsoft Azure Cognition Translator Services. *
* *
************************* Copyright(c) La Vía Óntica SC, Ontica LLC and contributors. All rights reserved. **/
using System;
using Newtonsoft.Json;
namespace Empiria.Cognition.Providers {
internal class Translation {
[JsonProperty]
internal string Text {
get; set;
}
[JsonProperty]
internal string To {
get; set;
}
}
internal class TranslatorResult {
[JsonProperty]
internal Translation[] Translations {
get; set;
}
}
}
|
Use JsonProperty attribute and remove unused types
|
Use JsonProperty attribute and remove unused types
|
C#
|
agpl-3.0
|
Ontica/Empiria.Extended
|
2d8831da460ebb032c4931266b051ea968819001
|
vision/api/QuickStart/QuickStart.cs
|
vision/api/QuickStart/QuickStart.cs
|
// Copyright(c) 2017 Google Inc.
//
// 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.
// [START vision_quickstart]
using Google.Cloud.Vision.V1;
using System;
namespace GoogleCloudSamples
{
public class QuickStart
{
public static void Main(string[] args)
{
var client = ImageAnnotatorClient.Create();
var image = Image.FromFile("wakeupcat.jpg");
var response = client.DetectLabels(image);
foreach (var annotation in response)
{
if (annotation.Description != null)
Console.WriteLine(annotation.Description);
}
}
}
}
// [END vision_quickstart]
|
// Copyright(c) 2017 Google Inc.
//
// 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.
// [START vision_quickstart]
using Google.Cloud.Vision.V1;
using System;
namespace GoogleCloudSamples
{
public class QuickStart
{
public static void Main(string[] args)
{
// Instantiates a client
var client = ImageAnnotatorClient.Create();
// Load the image file into memory
var image = Image.FromFile("wakeupcat.jpg");
// Performs label detection on the image file
var response = client.DetectLabels(image);
foreach (var annotation in response)
{
if (annotation.Description != null)
Console.WriteLine(annotation.Description);
}
}
}
}
// [END vision_quickstart]
|
Add comments to vision quickstart.
|
Add comments to vision quickstart.
|
C#
|
apache-2.0
|
jsimonweb/csharp-docs-samples,jsimonweb/csharp-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,jsimonweb/csharp-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,jsimonweb/csharp-docs-samples
|
6073ccee10f8bdc523947f798e34651c1d89b95d
|
trunk/src/bindings/TAPCfgTest.cs
|
trunk/src/bindings/TAPCfgTest.cs
|
using TAP;
using System;
using System.Net;
public class TAPCfgTest {
private static void Main(string[] args) {
EthernetDevice dev = new EthernetDevice();
dev.Start("Device name");
Console.WriteLine("Got device name: {0}", dev.DeviceName);
dev.MTU = 1280;
dev.SetAddress(IPAddress.Parse("192.168.1.1"), 16);
dev.SetAddress(IPAddress.Parse("fc00::1"), 64);
dev.Enabled = true;
while (true) {
EthernetFrame frame = dev.Read();
if (frame == null)
break;
if (frame.EtherType == EtherType.IPv6) {
IPv6Packet packet = new IPv6Packet(frame.Payload);
if (packet.NextHeader == ProtocolType.ICMPv6) {
ICMPv6Type type = (ICMPv6Type) packet.Payload[0];
Console.WriteLine("Got ICMPv6 packet type {0}", type);
Console.WriteLine("Data: {0}", BitConverter.ToString(packet.Payload));
}
}
Console.WriteLine("Read Ethernet frame of type {0}",
frame.EtherType);
Console.WriteLine("Source address: {0}",
BitConverter.ToString(frame.SourceAddress));
Console.WriteLine("Destination address: {0}",
BitConverter.ToString(frame.DestinationAddress));
}
}
}
|
using TAP;
using System;
using System.Net;
public class TAPCfgTest {
private static void Main(string[] args) {
EthernetDevice dev = new EthernetDevice();
dev.Start("Device name");
Console.WriteLine("Got device name: {0}", dev.DeviceName);
dev.MTU = 1280;
dev.SetAddress(IPAddress.Parse("192.168.1.1"), 16);
dev.SetAddress(IPAddress.Parse("fc00::1"), 64);
dev.Enabled = true;
while (true) {
EthernetFrame frame = dev.Read();
if (frame == null)
break;
if (frame.EtherType == EtherType.IPv6) {
IPv6Packet packet = new IPv6Packet(frame.Payload);
if (packet.NextHeader == ProtocolType.ICMPv6) {
ICMPv6Type type = (ICMPv6Type) packet.Payload[0];
Console.WriteLine("Got ICMPv6 packet type {0}", type);
Console.WriteLine("Src: {0}", packet.Source);
Console.WriteLine("Dst: {0}", packet.Destination);
Console.WriteLine("Data: {0}", BitConverter.ToString(packet.Payload));
}
}
Console.WriteLine("Read Ethernet frame of type {0}",
frame.EtherType);
Console.WriteLine("Source address: {0}",
BitConverter.ToString(frame.SourceAddress));
Console.WriteLine("Destination address: {0}",
BitConverter.ToString(frame.DestinationAddress));
}
}
}
|
Print source and destination addresses on ICMPv6 packets
|
Print source and destination addresses on ICMPv6 packets
git-svn-id: 8d82213adbbc6b1538a984bace977d31fcb31691@115 2f5d681c-ba19-11dd-a503-ed2d4bea8bb5
|
C#
|
lgpl-2.1
|
shutej/tapcfg,shutej/tapcfg,shutej/tapcfg,shutej/tapcfg,shutej/tapcfg,shutej/tapcfg,shutej/tapcfg
|
b5c950e089245da1ec3ee5b822290e9258bf6fcf
|
apod_api/APOD_API.cs
|
apod_api/APOD_API.cs
|
using System;
using System.Threading.Tasks;
using System.IO;
using System.Net;
using Newtonsoft.Json;
namespace apod_api
{
public sealed class APOD_API
{
public APOD_API()
{
date = DateTime.Today;
}
public void sendRequest()
{
generateURL();
WebRequest request = WebRequest.Create(api_url);
api_response = request.GetResponse();
Stream responseStream = api_response.GetResponseStream();
sr = new StreamReader(responseStream);
myAPOD = JsonConvert.DeserializeObject<APOD>(sr.ReadToEnd());
sr.Close();
responseStream.Close();
api_response.Close();
}
public APOD_API setDate(DateTime newDate)
{
date = newDate;
return this;
}
private void generateURL()
{
api_url = api + "?api_key=" + api_key + "&date=" + date.ToString("yyyy-MM-dd");
}
private string api_key = "DEMO_KEY";
private string api = "https://api.nasa.gov/planetary/apod";
private string api_url;
private DateTime date;
private WebResponse api_response;
private StreamReader sr;
private APOD myAPOD;
public APOD apod { get { return myAPOD; } }
}
}
|
using System;
using System.Threading.Tasks;
using System.IO;
using System.Net;
using Newtonsoft.Json;
namespace apod_api
{
public sealed class APOD_API
{
public APOD_API()
{
date = DateTime.Today;
}
public void sendRequest()
{
generateURL();
WebRequest request = WebRequest.Create(api_url);
api_response = request.GetResponse();
Stream responseStream = api_response.GetResponseStream();
sr = new StreamReader(responseStream);
myAPOD = JsonConvert.DeserializeObject<APOD>(sr.ReadToEnd());
sr.Dispose();
responseStream.Dispose();
api_response.Dispose();
}
public APOD_API setDate(DateTime newDate)
{
date = newDate;
return this;
}
private void generateURL()
{
api_url = api + "?api_key=" + api_key + "&date=" + date.ToString("yyyy-MM-dd");
}
private string api_key = "DEMO_KEY";
private string api = "https://api.nasa.gov/planetary/apod";
private string api_url;
private DateTime date;
private WebResponse api_response;
private StreamReader sr;
private APOD myAPOD;
public APOD apod { get { return myAPOD; } }
}
}
|
Switch to .Dispose() from .Close().
|
Switch to .Dispose() from .Close().
|
C#
|
mit
|
jmedrano87/nasa-apod-pcl
|
e8d442c2b8ba4d5ee6b4db012e91931f1a7750ea
|
UnityProject/Assets/Scripts/Sound/SoundSpawn.cs
|
UnityProject/Assets/Scripts/Sound/SoundSpawn.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SoundSpawn : MonoBehaviour
{
public AudioSource audioSource;
//We need to handle this manually to prevent multiple requests grabbing sound pool items in the same frame
public bool isPlaying = false;
private float waitLead = 0;
public void PlayOneShot()
{
audioSource.PlayOneShot(audioSource.clip);
WaitForPlayToFinish();
}
public void PlayNormally()
{
audioSource.Play();
WaitForPlayToFinish();
}
void WaitForPlayToFinish()
{
waitLead = 0f;
UpdateManager.Add(CallbackType.UPDATE, UpdateMe);
}
void UpdateMe()
{
waitLead += Time.deltaTime;
if (waitLead > 0.2f)
{
if (!audioSource.isPlaying)
{
UpdateManager.Remove(CallbackType.UPDATE, UpdateMe);
isPlaying = false;
waitLead = 0f;
}
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SoundSpawn : MonoBehaviour
{
public AudioSource audioSource;
//We need to handle this manually to prevent multiple requests grabbing sound pool items in the same frame
public bool isPlaying = false;
private float waitLead = 0;
public void PlayOneShot()
{
audioSource.PlayOneShot(audioSource.clip);
WaitForPlayToFinish();
}
public void PlayNormally()
{
audioSource.Play();
WaitForPlayToFinish();
}
void WaitForPlayToFinish()
{
waitLead = 0f;
UpdateManager.Add(CallbackType.UPDATE, UpdateMe);
}
private void OnDisable()
{
if(isPlaying)
{
UpdateManager.Remove(CallbackType.UPDATE, UpdateMe);
isPlaying = false;
}
}
void UpdateMe()
{
waitLead += Time.deltaTime;
if (waitLead > 0.2f)
{
if (!audioSource.isPlaying)
{
UpdateManager.Remove(CallbackType.UPDATE, UpdateMe);
isPlaying = false;
waitLead = 0f;
}
}
}
}
|
Fix UpdateManager NRE for soundspawn
|
Fix UpdateManager NRE for soundspawn
|
C#
|
agpl-3.0
|
fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation
|
515ca9408ffb5d8be3d26b281489c9bf80dfe1e3
|
MassTransit.Host.RabbitMQ/Program.cs
|
MassTransit.Host.RabbitMQ/Program.cs
|
// Copyright 2014 Ron Griffin, ...
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
using Topshelf;
namespace MassTransit.Host.RabbitMQ
{
/// <summary>
/// Entry point of the host process used to construct the Topshelf service.
/// </summary>
class Program
{
static void Main(string[] args)
{
HostFactory.Run(x =>
{
x.Service<ServiceHost>(s =>
{
s.ConstructUsing(name => new ServiceHost());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
x.RunAsLocalSystem();
x.SetDescription("MassTransit RabbitMQ Service Bus Host");
x.SetDisplayName("MassTransitServiceBusHost");
x.SetServiceName("MassTransitServiceBusHost");
});
//TODO: extra parameter stuff
}
}
}
|
// Copyright 2014 Ron Griffin, ...
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
using System;
using Magnum.Extensions;
using Topshelf;
namespace MassTransit.Host.RabbitMQ
{
/// <summary>
/// Entry point of the host process used to construct the Topshelf service.
/// </summary>
class Program
{
static void Main(string[] args)
{
var exitCode = HostFactory.Run(x =>
{
x.Service<ServiceHost>(s =>
{
s.ConstructUsing(name => new ServiceHost());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
x.RunAsLocalSystem();
x.SetDescription("MassTransit RabbitMQ Service Bus Host");
x.SetDisplayName("MassTransitServiceBusHost");
x.SetServiceName("MassTransitServiceBusHost");
});
//TODO: extra parameter stuff
Environment.Exit((int)exitCode);
}
}
}
|
Add exit code to console app; return HostFactory.Run result
|
Add exit code to console app; return HostFactory.Run result
|
C#
|
apache-2.0
|
rongriffin/MassTransit.Host.RabbitMQ
|
20f1eb2b33765d477fdabf04a7f3e287fe2b9170
|
osu.Desktop/Windows/GameplayWinKeyBlocker.cs
|
osu.Desktop/Windows/GameplayWinKeyBlocker.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Game.Configuration;
namespace osu.Desktop.Windows
{
public class GameplayWinKeyBlocker : Component
{
private Bindable<bool> allowScreenSuspension;
private Bindable<bool> disableWinKey;
private GameHost host;
[BackgroundDependencyLoader]
private void load(GameHost host, OsuConfigManager config)
{
this.host = host;
allowScreenSuspension = host.AllowScreenSuspension.GetBoundCopy();
allowScreenSuspension.BindValueChanged(_ => updateBlocking());
disableWinKey = config.GetBindable<bool>(OsuSetting.GameplayDisableWinKey);
disableWinKey.BindValueChanged(_ => updateBlocking(), true);
}
private void updateBlocking()
{
bool shouldDisable = disableWinKey.Value && !allowScreenSuspension.Value;
if (shouldDisable)
host.InputThread.Scheduler.Add(WindowsKey.Disable);
else
host.InputThread.Scheduler.Add(WindowsKey.Enable);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Game;
using osu.Game.Configuration;
namespace osu.Desktop.Windows
{
public class GameplayWinKeyBlocker : Component
{
private Bindable<bool> disableWinKey;
private Bindable<bool> localUserPlaying;
[Resolved]
private GameHost host { get; set; }
[BackgroundDependencyLoader(true)]
private void load(OsuGame game, OsuConfigManager config)
{
localUserPlaying = game.LocalUserPlaying.GetBoundCopy();
localUserPlaying.BindValueChanged(_ => updateBlocking());
disableWinKey = config.GetBindable<bool>(OsuSetting.GameplayDisableWinKey);
disableWinKey.BindValueChanged(_ => updateBlocking(), true);
}
private void updateBlocking()
{
bool shouldDisable = disableWinKey.Value && localUserPlaying.Value;
if (shouldDisable)
host.InputThread.Scheduler.Add(WindowsKey.Disable);
else
host.InputThread.Scheduler.Add(WindowsKey.Enable);
}
}
}
|
Fix windows key blocking applying when window is inactive / when watching a replay
|
Fix windows key blocking applying when window is inactive / when watching a replay
Closes #10467.
|
C#
|
mit
|
NeoAdonis/osu,ppy/osu,peppy/osu-new,peppy/osu,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu
|
0fa9ad0676141bd5d8dfffa134e5583d21f8cda1
|
Eco/Variables/PublicIpVariable.cs
|
Eco/Variables/PublicIpVariable.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace Eco.Variables
{
public class PublicIpVariable : IVariableProvider
{
string _lastIp;
DateTime _lastUpdate;
public Dictionary<string, Func<string>> GetVariables()
{
var now = DateTime.Now;
if (now - _lastUpdate > TimeSpan.FromMinutes(1))
{
_lastIp = new WebClient().DownloadString("http://icanhazip.com").Trim();
_lastUpdate = now;
}
return new Dictionary<string, Func<string>>()
{
{ "publicIp", () => _lastIp }
};
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace Eco.Variables
{
public class PublicIpVariable : IVariableProvider
{
string _lastIp;
DateTime _lastUpdate;
public Dictionary<string, Func<string>> GetVariables()
{
Func<string> getIp = () =>
{
var now = DateTime.Now;
if (now - _lastUpdate > TimeSpan.FromMinutes(1))
{
_lastIp = new WebClient().DownloadString("http://icanhazip.com").Trim();
_lastUpdate = now;
}
return _lastIp;
};
return new Dictionary<string, Func<string>>()
{
{ "publicIp", getIp }
};
}
}
}
|
Make PublicIp variable lazy again.
|
Make PublicIp variable lazy again.
|
C#
|
apache-2.0
|
lukyad/Eco
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.