commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
5af4f6fc91dd56e7306a19f76ff73cffe132ad1f
Fix merge of error logging for scheduled events
bwatts/Totem,bwatts/Totem
Source/Totem.Runtime/Timeline/TimelineSchedule.cs
Source/Totem.Runtime/Timeline/TimelineSchedule.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Reactive; using System.Reactive.Concurrency; using System.Reactive.Linq; using System.Threading.Tasks; namespace Totem.Runtime.Timeline { /// <summary> /// Sets timers for points which occur in the future /// </summary> internal sealed class TimelineSchedule : Connection { readonly ConcurrentDictionary<IDisposable, bool> _timers = new ConcurrentDictionary<IDisposable, bool>(); readonly TimelineScope _timeline; internal TimelineSchedule(TimelineScope timeline) { _timeline = timeline; } protected override void Close() { foreach(var timer in _timers.Keys) { timer.Dispose(); } } internal void Push(TimelinePoint point) { var timer = null as IDisposable; timer = Observable .Timer(new DateTimeOffset(point.Event.When)) .Take(1) .ObserveOn(ThreadPoolScheduler.Instance) .SelectMany(_ => PushToTimeline(point, timer)) .Subscribe(); _timers[timer] = true; } async Task<Unit> PushToTimeline(TimelinePoint point, IDisposable timer) { try { bool ignored; _timers.TryRemove(timer, out ignored); timer.Dispose(); await _timeline.PushScheduled(point); } catch(Exception error) { Log.Error(error, "[timeline] Failed to push scheduled event of type {EventType}. The timeline will attempt to push it again after a restart.", point.EventType); } return Unit.Default; } } }
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Reactive; using System.Reactive.Concurrency; using System.Reactive.Linq; using System.Threading.Tasks; namespace Totem.Runtime.Timeline { /// <summary> /// Sets timers for points which occur in the future /// </summary> internal sealed class TimelineSchedule : Connection { readonly ConcurrentDictionary<IDisposable, bool> _timers = new ConcurrentDictionary<IDisposable, bool>(); readonly TimelineScope _timeline; internal TimelineSchedule(TimelineScope timeline) { _timeline = timeline; } protected override void Close() { foreach(var timer in _timers.Keys) { timer.Dispose(); } } internal void Push(TimelinePoint point) { var timer = null as IDisposable; timer = Observable .Timer(new DateTimeOffset(point.Event.When)) .Take(1) .ObserveOn(ThreadPoolScheduler.Instance) .SelectMany(_ => PushToTimeline(point, timer)) .Subscribe(); _timers[timer] = true; } async Task<Unit> PushToTimeline(TimelinePoint point, IDisposable timer) { try { bool ignored; _timers.TryRemove(timer, out ignored); timer.Dispose(); await _timeline.PushScheduled(point); return Unit.Default; } catch(Exception error) { Log.Error(error, "[timeline] Failed to push scheduled event of type {EventType}. The timeline will attempt to push it again after a restart.", message.Point.EventType); } } } }
mit
C#
cfd28c51bbbb827c0394282ec144ebdf3a9557f6
change block quote backgroudn width
ppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu
osu.Game/Graphics/Containers/Markdown/OsuMarkdownQuoteBlock.cs
osu.Game/Graphics/Containers/Markdown/OsuMarkdownQuoteBlock.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 Markdig.Syntax; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers.Markdown; using osu.Game.Overlays; namespace osu.Game.Graphics.Containers.Markdown { public class OsuMarkdownQuoteBlock : MarkdownQuoteBlock { private Drawable background; public OsuMarkdownQuoteBlock(QuoteBlock quoteBlock) : base(quoteBlock) { } [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { background.Colour = colourProvider.Content2; } protected override Drawable CreateBackground() { background = base.CreateBackground(); background.Width = 2; return background; } public override MarkdownTextFlowContainer CreateTextFlow() { var textFlow = base.CreateTextFlow(); textFlow.Margin = new MarginPadding { Top = 10, Bottom = 10, Left = 20, Right = 20, }; return textFlow; } } }
// 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 Markdig.Syntax; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers.Markdown; using osu.Game.Overlays; namespace osu.Game.Graphics.Containers.Markdown { public class OsuMarkdownQuoteBlock : MarkdownQuoteBlock { private Drawable background; public OsuMarkdownQuoteBlock(QuoteBlock quoteBlock) : base(quoteBlock) { } [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { background.Colour = colourProvider.Content2; } protected override Drawable CreateBackground() { return background = base.CreateBackground(); } public override MarkdownTextFlowContainer CreateTextFlow() { var textFlow = base.CreateTextFlow(); textFlow.Margin = new MarginPadding { Top = 10, Bottom = 10, Left = 20, Right = 20, }; return textFlow; } } }
mit
C#
e6dccf7eaa3c1b22e606bb9e1541f3bba08d1e52
Fix IDE0079
meziantou/Meziantou.Framework,meziantou/Meziantou.Framework,meziantou/Meziantou.Framework,meziantou/Meziantou.Framework
tests/Meziantou.Framework.TemporaryDirectory.Tests/TemporaryDirectoryTests.cs
tests/Meziantou.Framework.TemporaryDirectory.Tests/TemporaryDirectoryTests.cs
using System.IO; using System.Linq; using System.Threading.Tasks; using Xunit; namespace Meziantou.Framework.Tests { public class TemporaryDirectoryTests { [Fact] public void CreateInParallel() { const int Iterations = 400; var dirs = new TemporaryDirectory[Iterations]; Parallel.For(0, Iterations, new ParallelOptions { MaxDegreeOfParallelism = 50 }, i => { dirs[i] = TemporaryDirectory.Create(); dirs[i].CreateEmptyFile("test.txt"); }); try { Assert.Equal(Iterations, dirs.DistinctBy(dir => dir.FullPath).Count()); foreach (var dir in dirs) { Assert.All(dirs, dir => Assert.True(Directory.Exists(dir.FullPath))); } } finally { foreach (var item in dirs) { item?.Dispose(); } } } [Fact] public void DisposedDeletedDirectory() { FullPath path; using (var dir = TemporaryDirectory.Create()) { path = dir.FullPath; File.WriteAllText(dir.GetFullPath("a.txt"), "content"); } Assert.False(Directory.Exists(path)); } [Fact] public async Task DisposeAsyncDeletedDirectory() { FullPath path; await using (var dir = TemporaryDirectory.Create()) { path = dir.FullPath; #if NET461 File.WriteAllText(dir.GetFullPath("a.txt"), "content"); #elif NETCOREAPP3_1 || NET5_0 await File.WriteAllTextAsync(dir.GetFullPath("a.txt"), "content"); #else #error Platform not supported #endif } Assert.False(Directory.Exists(path)); } } }
using System.IO; using System.Linq; using System.Threading.Tasks; using Xunit; namespace Meziantou.Framework.Tests { public class TemporaryDirectoryTests { [Fact] public void CreateInParallel() { const int Iterations = 400; var dirs = new TemporaryDirectory[Iterations]; Parallel.For(0, Iterations, new ParallelOptions { MaxDegreeOfParallelism = 50 }, i => { dirs[i] = TemporaryDirectory.Create(); dirs[i].CreateEmptyFile("test.txt"); }); try { Assert.Equal(Iterations, dirs.DistinctBy(dir => dir.FullPath).Count()); foreach (var dir in dirs) { Assert.All(dirs, dir => Assert.True(Directory.Exists(dir.FullPath))); } } finally { foreach (var item in dirs) { item?.Dispose(); } } } [Fact] public void DisposedDeletedDirectory() { FullPath path; using (var dir = TemporaryDirectory.Create()) { path = dir.FullPath; File.WriteAllText(dir.GetFullPath("a.txt"), "content"); } Assert.False(Directory.Exists(path)); } [Fact] public async Task DisposeAsyncDeletedDirectory() { FullPath path; await using (var dir = TemporaryDirectory.Create()) { path = dir.FullPath; #pragma warning disable MA0042 // Do not use blocking calls in an async method File.WriteAllText(dir.GetFullPath("a.txt"), "content"); #pragma warning restore MA0042 } Assert.False(Directory.Exists(path)); } } }
mit
C#
7d8cfaa6c4d0af0df305e94d10758f0624fe8286
fix version
NeverCL/EntityFramework.Extension
EntityFramework.Extension/EntityFramework.Extension/Properties/AssemblyInfo.cs
EntityFramework.Extension/EntityFramework.Extension/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("EntityFramework.Extension")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EntityFramework.Extension")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //将 ComVisible 设置为 false 将使此程序集中的类型 //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("f2d92c1c-25d2-465d-8696-944afd03050d")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.2.2.0")] [assembly: AssemblyFileVersion("0.2.2.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("EntityFramework.Extension")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EntityFramework.Extension")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //将 ComVisible 设置为 false 将使此程序集中的类型 //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("f2d92c1c-25d2-465d-8696-944afd03050d")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
3c7999a00b5e73d227fe4cf96aae09dc9cdeaca1
更新2.2.1.31
Laforeta/KanColleCacher,Gizeta/KanColleCacher,hakuame/KanColleCacher
KanColleCacher/Properties/AssemblyInfo.cs
KanColleCacher/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using d_f_32.KanColleCacher; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle(AssemblyInfo.Title)] [assembly: AssemblyDescription(AssemblyInfo.Description)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct(AssemblyInfo.Name)] [assembly: AssemblyCopyright(AssemblyInfo.Copyright)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID //[assembly: Guid("7909a3f7-15a8-4ee5-afc5-11a7cfa40576")] [assembly: Guid("DA0FF655-A2CA-40DC-A78B-6DC85C2D448B")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion(AssemblyInfo.Version)] [assembly: AssemblyFileVersion(AssemblyInfo.Version)] namespace d_f_32.KanColleCacher { public static class AssemblyInfo { public const string Name = "KanColleCacher"; public const string Version = "2.2.1.31"; public const string Author = "d.f.32"; public const string Copyright = "©2014 - d.f.32"; #if DEBUG public const string Title = "提督很忙!缓存工具 (DEBUG)"; #else public const string Title = "提督很忙!缓存工具"; #endif public const string Description = "通过创建本地缓存以加快游戏加载速度(并支持魔改)"; } }
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using d_f_32.KanColleCacher; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle(AssemblyInfo.Title)] [assembly: AssemblyDescription(AssemblyInfo.Description)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct(AssemblyInfo.Name)] [assembly: AssemblyCopyright(AssemblyInfo.Copyright)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID //[assembly: Guid("7909a3f7-15a8-4ee5-afc5-11a7cfa40576")] [assembly: Guid("DA0FF655-A2CA-40DC-A78B-6DC85C2D448B")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion(AssemblyInfo.Version)] [assembly: AssemblyFileVersion(AssemblyInfo.Version)] namespace d_f_32.KanColleCacher { public static class AssemblyInfo { public const string Name = "KanColleCacher"; public const string Version = "2.2.0.28"; public const string Author = "d.f.32"; public const string Copyright = "©2014 - d.f.32"; #if DEBUG public const string Title = "提督很忙!缓存工具 (DEBUG)"; #else public const string Title = "提督很忙!缓存工具"; #endif public const string Description = "通过创建本地缓存以加快游戏加载速度(并支持魔改)"; } }
mit
C#
3c45017f27c4865553e261f74dc21a20cfea5cde
Change Sidebar "Shortcut Style" "Height" option name
danielchalmers/DesktopWidgets
DesktopWidgets/Widgets/Sidebar/Settings.cs
DesktopWidgets/Widgets/Sidebar/Settings.cs
using System.Collections.ObjectModel; using System.ComponentModel; using System.Windows; using System.Windows.Input; using DesktopWidgets.WidgetBase.Settings; namespace DesktopWidgets.Widgets.Sidebar { public class Settings : WidgetSettingsBase { [Browsable(false)] [DisplayName("Shortcuts")] public ObservableCollection<Shortcut> Shortcuts { get; set; } [Category("Shortcut Style")] [DisplayName("Icon Position")] public IconPosition IconPosition { get; set; } = IconPosition.Left; [Category("Shortcut Style")] [DisplayName("Tooltip Type")] public ToolTipType ToolTipType { get; set; } = ToolTipType.Path; [Category("Shortcut Style")] [DisplayName("Horizontal Alignment")] public HorizontalAlignment ButtonHorizontalAlignment { get; set; } = HorizontalAlignment.Center; [Category("Shortcut Style")] [DisplayName("Vertical Alignment")] public VerticalAlignment ButtonVerticalAlignment { get; set; } = VerticalAlignment.Center; [Category("Shortcut Style")] [DisplayName("Icon Scaling Mode")] public ImageScalingMode IconScalingMode { get; set; } = ImageScalingMode.LowQuality; [Category("Shortcut Style")] [DisplayName("Content Mode")] public ShortcutContentMode ShortcutContentMode { get; set; } = ShortcutContentMode.Both; [Category("Style")] [DisplayName("Orientation")] public ShortcutOrientation ShortcutOrientation { get; set; } = ShortcutOrientation.Vertical; [Category("Shortcut Style")] [DisplayName("Image Size")] public int ButtonHeight { get; set; } = 32; [Category("Behavior (Hideable)")] [DisplayName("Hide on Shortcut Launch")] public bool HideOnExecute { get; set; } = true; [Browsable(false)] [DisplayName("Default Shortcuts Mode")] public DefaultShortcutsMode DefaultShortcutsMode { get; set; } = DefaultShortcutsMode.Preset; [Category("General")] [DisplayName("Parse Shortcut Files")] public bool ParseShortcutFiles { get; set; } = false; [Category("General")] [DisplayName("Enable Icon Cache")] public bool UseIconCache { get; set; } = true; [Category("Behavior")] [DisplayName("Keep Open With Modifier Key")] public ModifierKeys KeepOpenWithModifierKey { get; set; } = ModifierKeys.Control; } }
using System.Collections.ObjectModel; using System.ComponentModel; using System.Windows; using System.Windows.Input; using DesktopWidgets.WidgetBase.Settings; namespace DesktopWidgets.Widgets.Sidebar { public class Settings : WidgetSettingsBase { [Browsable(false)] [DisplayName("Shortcuts")] public ObservableCollection<Shortcut> Shortcuts { get; set; } [Category("Shortcut Style")] [DisplayName("Icon Position")] public IconPosition IconPosition { get; set; } = IconPosition.Left; [Category("Shortcut Style")] [DisplayName("Tooltip Type")] public ToolTipType ToolTipType { get; set; } = ToolTipType.Path; [Category("Shortcut Style")] [DisplayName("Horizontal Alignment")] public HorizontalAlignment ButtonHorizontalAlignment { get; set; } = HorizontalAlignment.Center; [Category("Shortcut Style")] [DisplayName("Vertical Alignment")] public VerticalAlignment ButtonVerticalAlignment { get; set; } = VerticalAlignment.Center; [Category("Shortcut Style")] [DisplayName("Icon Scaling Mode")] public ImageScalingMode IconScalingMode { get; set; } = ImageScalingMode.LowQuality; [Category("Shortcut Style")] [DisplayName("Content Mode")] public ShortcutContentMode ShortcutContentMode { get; set; } = ShortcutContentMode.Both; [Category("Style")] [DisplayName("Orientation")] public ShortcutOrientation ShortcutOrientation { get; set; } = ShortcutOrientation.Vertical; [Category("Shortcut Style")] [DisplayName("Height")] public int ButtonHeight { get; set; } = 32; [Category("Behavior (Hideable)")] [DisplayName("Hide on Shortcut Launch")] public bool HideOnExecute { get; set; } = true; [Browsable(false)] [DisplayName("Default Shortcuts Mode")] public DefaultShortcutsMode DefaultShortcutsMode { get; set; } = DefaultShortcutsMode.Preset; [Category("General")] [DisplayName("Parse Shortcut Files")] public bool ParseShortcutFiles { get; set; } = false; [Category("General")] [DisplayName("Enable Icon Cache")] public bool UseIconCache { get; set; } = true; [Category("Behavior")] [DisplayName("Keep Open With Modifier Key")] public ModifierKeys KeepOpenWithModifierKey { get; set; } = ModifierKeys.Control; } }
apache-2.0
C#
d8282508a4a3047986724865e30bc626ae6e01e6
fix typo.
cube-soft/Cube.Core,cube-soft/Cube.Core
Libraries/Core/Sources/LoggerSource.cs
Libraries/Core/Sources/LoggerSource.cs
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, 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. // /* ------------------------------------------------------------------------- */ namespace Cube; using System; #region ILoggerSource /* ------------------------------------------------------------------------- */ /// /// ILoggerSource /// /// <summary> /// Represents a type used to perform logging. /// </summary> /// /* ------------------------------------------------------------------------- */ public interface ILoggerSource { /* --------------------------------------------------------------------- */ /// /// Log /// /// <summary> /// Writes a log entry. /// </summary> /// /// <param name="level">Log level.</param> /// <param name="type">Type of requested object.</param> /// <param name="message">Logging message.</param> /// /* --------------------------------------------------------------------- */ void Log(LogLevel level, Type type, string message); } #endregion #region NullLoggerSource /* ------------------------------------------------------------------------- */ /// /// NullLoggerSource /// /// <summary> /// Minimalistic ILoggerSource implementation that does nothing. /// </summary> /// /* ------------------------------------------------------------------------- */ public sealed class NullLoggerSource : ILoggerSource { /* --------------------------------------------------------------------- */ /// /// Log /// /// <summary> /// Writes a log entry. /// </summary> /// /// <param name="level">Log level.</param> /// <param name="type">Type of requested object.</param> /// <param name="message">Logging message.</param> /// /* --------------------------------------------------------------------- */ public void Log(LogLevel level, Type type, string message) { } } #endregion
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, 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. // /* ------------------------------------------------------------------------- */ namespace Cube; using System; #region ILoggerSource /* ------------------------------------------------------------------------- */ /// /// ILoggerSource /// /// <summary> /// Represents a type used to perform logging. /// </summary> /// /* ------------------------------------------------------------------------- */ public interface ILoggerSource { /* --------------------------------------------------------------------- */ /// /// Log /// /// <summary> /// Writes a log entry. /// </summary> /// /// <param name="lavel">Log level.</param> /// <param name="type">Type of requested object.</param> /// <param name="message">Logging message.</param> /// /* --------------------------------------------------------------------- */ void Log(LogLevel lavel, Type type, string message); } #endregion #region NullLoggerSource /* ------------------------------------------------------------------------- */ /// /// NullLoggerSource /// /// <summary> /// Minimalistic ILoggerSource implementation that does nothing. /// </summary> /// /* ------------------------------------------------------------------------- */ public sealed class NullLoggerSource : ILoggerSource { /* --------------------------------------------------------------------- */ /// /// Log /// /// <summary> /// Writes a log entry. /// </summary> /// /// <param name="lavel">Log level.</param> /// <param name="type">Type of requested object.</param> /// <param name="message">Logging message.</param> /// /* --------------------------------------------------------------------- */ public void Log(LogLevel lavel, Type type, string message) { } } #endregion
apache-2.0
C#
bf612ed40990222ee8b92e417aa0e55a5d42711c
Use UnionStep.
ExRam/ExRam.Gremlinq
ExRam.Gremlinq/Gremlin/Steps/ValuesStep.cs
ExRam.Gremlinq/Gremlin/Steps/ValuesStep.cs
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace ExRam.Gremlinq { public sealed class ValuesStep<TSource, TTarget> : NonTerminalStep { private readonly Expression<Func<TSource, TTarget>>[] _projections; public ValuesStep(Expression<Func<TSource, TTarget>>[] projections) { _projections = projections; } public override IEnumerable<Step> Resolve(IGraphModel model) { var keys = _projections .Select(projection => { if (projection.Body.StripConvert() is MemberExpression memberExpression) return model.GetIdentifier(memberExpression.Member.Name); throw new NotSupportedException(); }) .ToArray(); var numberOfIdSteps = keys .OfType<T>() .Count(x => x == T.Id); var propertyKeys = keys .OfType<string>() .Cast<object>() .ToArray(); if (numberOfIdSteps > 1 || numberOfIdSteps > 0 && propertyKeys.Length > 0) { yield return new UnionStep( new IGremlinQuery[] { GremlinQuery.Anonymous.AddStep(MethodStep.Create("values", propertyKeys)).Resolve(model), GremlinQuery.Anonymous.Id().Resolve(model) }); } else if (numberOfIdSteps > 0) yield return MethodStep.Id; else { yield return MethodStep.Create( "values", propertyKeys); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace ExRam.Gremlinq { public sealed class ValuesStep<TSource, TTarget> : NonTerminalStep { private readonly Expression<Func<TSource, TTarget>>[] _projections; public ValuesStep(Expression<Func<TSource, TTarget>>[] projections) { _projections = projections; } public override IEnumerable<Step> Resolve(IGraphModel model) { var keys = _projections .Select(projection => { if (projection.Body.StripConvert() is MemberExpression memberExpression) return model.GetIdentifier(memberExpression.Member.Name); throw new NotSupportedException(); }) .ToArray(); var numberOfIdSteps = keys .OfType<T>() .Count(x => x == T.Id); var propertyKeys = keys .OfType<string>() .Cast<object>() .ToArray(); if (numberOfIdSteps > 1 || numberOfIdSteps > 0 && propertyKeys.Length > 0) { yield return MethodStep.Create("union", GremlinQuery.Anonymous.AddStep(MethodStep.Create("values", propertyKeys)).Resolve(model), GremlinQuery.Anonymous.Id().Resolve(model)); } else if (numberOfIdSteps > 0) yield return MethodStep.Id; else { yield return MethodStep.Create( "values", propertyKeys); } } } }
mit
C#
772f10f743c20bf459e4ef237d94f38064b15b41
Bump version
muojp/SoraCommonNet,muojp/SoraCommonNet
SoraCommonNet/Properties/AssemblyInfo.cs
SoraCommonNet/Properties/AssemblyInfo.cs
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SoraCommonNet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("muo_jp")] [assembly: AssemblyProduct("SoraCommonNet")] [assembly: AssemblyCopyright("Copyright © Kei Nakazawa (@muo_jp) 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.2.0")] [assembly: AssemblyFileVersion("0.1.2.0")]
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SoraCommonNet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyProduct("SoraCommonNet")] [assembly: AssemblyCopyright("Copyright © Microsoft Corporation 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
2821a97a96879c60293715fcddaba09f0ad9075e
change title on home page and kick off build / release / deploy
nikkh/xekina,nikkh/xekina
Xekina/XekinaWebApp/Views/Home/Index.cshtml
Xekina/XekinaWebApp/Views/Home/Index.cshtml
@{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <h1>Xekina Sample Web Application</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Getting started</h2> <p> ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. </p> <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Get more libraries</h2> <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p> <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Web Hosting</h2> <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p> <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p> </div> </div>
@{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Getting started</h2> <p> ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. </p> <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Get more libraries</h2> <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p> <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Web Hosting</h2> <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p> <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p> </div> </div>
unlicense
C#
93a1aeb3f8f155921dc8aa3514b7e8065fdfd797
Support invalid certificates (e.g. if Fiddler is in use) and more security protocols (adds Tls1.1 and Tls1.2)
laingsimon/draw-ship,laingsimon/draw-ship
DrawShip.Viewer/Program.cs
DrawShip.Viewer/Program.cs
using System; using System.Net; using System.Windows.Forms; namespace DrawShip.Viewer { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; var applicationContext = new ApplicationContext(); var runMode = applicationContext.GetRunMode(); runMode.Run(applicationContext); } } }
using System; using System.Windows.Forms; namespace DrawShip.Viewer { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { var applicationContext = new ApplicationContext(); var runMode = applicationContext.GetRunMode(); runMode.Run(applicationContext); } } }
apache-2.0
C#
4a837067e95025760a1f07fc7da5215d94ff49b1
Add regression test for NumberTypes
AkosLukacs/t4ts,AkosLukacs/t4ts,cskeppstedt/t4ts,bazubii/t4ts,dolly22/t4ts,cskeppstedt/t4ts,dolly22/t4ts,bazubii/t4ts
T4TS.Tests/TypeContext/TypeContextTests.cs
T4TS.Tests/TypeContext/TypeContextTests.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace T4TS.Tests { [TestClass] public class TypeContextTests { [TestMethod] public void ShouldSupportDatetimesAsNativeDates() { var context = new TypeContext(new Settings { UseNativeDates = true }); var resolvedType = context.GetTypeScriptType(typeof(DateTime).FullName); Assert.IsInstanceOfType(resolvedType, typeof(DateTimeType)); } [TestMethod] public void ShouldSupportDatetimesAsStrings() { var context = new TypeContext(new Settings { UseNativeDates = false }); var resolvedType = context.GetTypeScriptType(typeof(DateTime).FullName); Assert.IsInstanceOfType(resolvedType, typeof(StringType)); } [TestMethod] public void ShouldSupportDatetimeOffsetAsNativeDates() { var context = new TypeContext(new Settings { UseNativeDates = true }); var resolvedType = context.GetTypeScriptType(typeof(DateTimeOffset).FullName); Assert.IsInstanceOfType(resolvedType, typeof(DateTimeType)); } [TestMethod] public void ShouldSupportDatetimeOffsetAsStrings() { var context = new TypeContext(new Settings { UseNativeDates = false }); var resolvedType = context.GetTypeScriptType(typeof(DateTimeOffset).FullName); Assert.IsInstanceOfType(resolvedType, typeof(StringType)); } [TestMethod] public void ShouldSupportNumberTypes() { var inputTypes = new [] { typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(decimal), typeof(double) }; var context = new TypeContext(new Settings()); var expectedType = typeof(NumberType); foreach (var type in inputTypes) { var resolvedType = context.GetTypeScriptType(type.FullName); Assert.IsInstanceOfType(resolvedType, expectedType); } } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace T4TS.Tests { [TestClass] public class TypeContextTests { [TestMethod] public void ShouldSupportDatetimesAsNativeDates() { var context = new TypeContext(new Settings { UseNativeDates = true }); var resolvedType = context.GetTypeScriptType(typeof(DateTime).FullName); Assert.IsInstanceOfType(resolvedType, typeof(DateTimeType)); } [TestMethod] public void ShouldSupportDatetimesAsStrings() { var context = new TypeContext(new Settings { UseNativeDates = false }); var resolvedType = context.GetTypeScriptType(typeof(DateTime).FullName); Assert.IsInstanceOfType(resolvedType, typeof(StringType)); } [TestMethod] public void ShouldSupportDatetimeOffsetAsNativeDates() { var context = new TypeContext(new Settings { UseNativeDates = true }); var resolvedType = context.GetTypeScriptType(typeof(DateTimeOffset).FullName); Assert.IsInstanceOfType(resolvedType, typeof(DateTimeType)); } [TestMethod] public void ShouldSupportDatetimeOffsetAsStrings() { var context = new TypeContext(new Settings { UseNativeDates = false }); var resolvedType = context.GetTypeScriptType(typeof(DateTimeOffset).FullName); Assert.IsInstanceOfType(resolvedType, typeof(StringType)); } } }
apache-2.0
C#
d7ab964824edd4681dc5fddfdaf78fae592e8053
Split out package equality comparer
lukedgr/nodejstools,AustinHull/nodejstools,paulvanbrenk/nodejstools,lukedgr/nodejstools,paladique/nodejstools,Microsoft/nodejstools,lukedgr/nodejstools,Microsoft/nodejstools,kant2002/nodejstools,paulvanbrenk/nodejstools,munyirik/nodejstools,avitalb/nodejstools,mousetraps/nodejstools,Microsoft/nodejstools,AustinHull/nodejstools,kant2002/nodejstools,avitalb/nodejstools,paulvanbrenk/nodejstools,paladique/nodejstools,munyirik/nodejstools,paladique/nodejstools,kant2002/nodejstools,kant2002/nodejstools,paladique/nodejstools,Microsoft/nodejstools,avitalb/nodejstools,munyirik/nodejstools,lukedgr/nodejstools,kant2002/nodejstools,avitalb/nodejstools,mjbvz/nodejstools,AustinHull/nodejstools,munyirik/nodejstools,mousetraps/nodejstools,paulvanbrenk/nodejstools,mjbvz/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,mjbvz/nodejstools,mousetraps/nodejstools,paulvanbrenk/nodejstools,mousetraps/nodejstools,mousetraps/nodejstools,munyirik/nodejstools,AustinHull/nodejstools,AustinHull/nodejstools,avitalb/nodejstools,Microsoft/nodejstools,mjbvz/nodejstools,paladique/nodejstools
Nodejs/Product/Npm/PackageComparer.cs
Nodejs/Product/Npm/PackageComparer.cs
//*********************************************************// // Copyright (c) Microsoft. All rights reserved. // // Apache 2.0 License // // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or // implied. See the License for the specific language governing // permissions and limitations under the License. // //*********************************************************// using System.Collections.Generic; namespace Microsoft.NodejsTools.Npm { public class PackageComparer : IComparer<IPackage> { public int Compare(IPackage x, IPackage y) { if (x == y) { return 0; } else if (null == x) { return -1; } else if (null == y) { return 1; } // TODO: should take into account versions! return x.Name.CompareTo(y.Name); } } public class PackageEqualityComparer : EqualityComparer<IPackage> { public override bool Equals(IPackage p1, IPackage p2) { return p1.Name == p2.Name && p1.Version == p2.Version && p1.IsBundledDependency == p2.IsBundledDependency && p1.IsDevDependency == p2.IsDevDependency && p1.IsListedInParentPackageJson == p2.IsListedInParentPackageJson && p1.IsMissing == p2.IsMissing && p1.IsOptionalDependency == p2.IsOptionalDependency; } public override int GetHashCode(IPackage obj) { if (obj.Name == null || obj.Version == null) return obj.GetHashCode(); return obj.Name.GetHashCode() ^ obj.Version.GetHashCode(); } } }
//*********************************************************// // Copyright (c) Microsoft. All rights reserved. // // Apache 2.0 License // // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or // implied. See the License for the specific language governing // permissions and limitations under the License. // //*********************************************************// using System.Collections.Generic; namespace Microsoft.NodejsTools.Npm { public class PackageComparer : IComparer<IPackage> { public int Compare(IPackage x, IPackage y) { if (x == y) { return 0; } else if (null == x) { return -1; } else if (null == y) { return 1; } // TODO: should take into account versions! return x.Name.CompareTo(y.Name); } } }
apache-2.0
C#
f05ec79bccf8c5c34d3441c462af83f3cdb67da9
Make ilpack-tolerable
SaladLab/UniGet
src/MdbTool.cs
src/MdbTool.cs
namespace UniGet { internal class MdbTool { public static void ConvertPdbToMdb(string dll) { Pdb2Mdb.Converter.Convert(dll); } } }
namespace UniGet { internal class MdbTool { public static void ConvertPdbToMdb(string dll) { RunPdb2Mdb(dll); } private static void RunPdb2Mdb(params string[] args) { var entryPoint = typeof(Pdb2Mdb.Converter).Assembly.EntryPoint; entryPoint.Invoke(null, new object[] { args }); } } }
mit
C#
ec5e571533fd466c3ea865c7d50fc182e19bd46b
Fix soundmanager (forgot to record time)
EusthEnoptEron/Sketchball
Sketchball/GameComponents/SoundManager.cs
Sketchball/GameComponents/SoundManager.cs
using System; using System.Collections.Generic; using System.Linq; using System.Media; using System.Text; using System.Threading.Tasks; namespace Sketchball.GameComponents { public class SoundManager { private SoundPlayer currentPlayer; private DateTime lastPlay = new DateTime(); /// <summary> /// The minimum interval between to equivalent sounds. /// </summary> private const int MIN_INTERVAL = 200; public void Play(SoundPlayer player) { DateTime now = DateTime.Now; if (currentPlayer != player || (now - lastPlay).TotalMilliseconds > MIN_INTERVAL) { if (currentPlayer != null) currentPlayer.Stop(); currentPlayer = player; currentPlayer.Play(); lastPlay = now; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Media; using System.Text; using System.Threading.Tasks; namespace Sketchball.GameComponents { public class SoundManager { private SoundPlayer currentPlayer; private DateTime lastPlay = new DateTime(); /// <summary> /// The minimum interval between to equivalent sounds. /// </summary> private const int MIN_INTERVAL = 400; public void Play(SoundPlayer player) { DateTime now = DateTime.Now; if (currentPlayer != player || (now - lastPlay).TotalMilliseconds > MIN_INTERVAL) { if (currentPlayer != null) currentPlayer.Stop(); currentPlayer = player; currentPlayer.Play(); } } } }
mit
C#
2c1a47552b7a69bd366d32f586a5a68393692623
Remove trailing .exe in process name.
michaltakac/IronAHK,yatsek/IronAHK,polyethene/IronAHK,michaltakac/IronAHK,michaltakac/IronAHK,michaltakac/IronAHK,polyethene/IronAHK,yatsek/IronAHK,polyethene/IronAHK,polyethene/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,yatsek/IronAHK,yatsek/IronAHK
Rusty/Core/Common/Misc.cs
Rusty/Core/Common/Misc.cs
using System; using System.Diagnostics; namespace IronAHK.Rusty { partial class Core { #region Disk static string[] Glob(string pattern) { return new string[] { }; } #endregion #region Process static Process FindProcess(string name) { int id; if (int.TryParse(name, out id)) return System.Diagnostics.Process.GetProcessById(id); const string exe = ".exe"; if (name.EndsWith(exe, StringComparison.OrdinalIgnoreCase)) name = name.Substring(0, name.Length - exe.Length); var prc = System.Diagnostics.Process.GetProcessesByName(name); return prc.Length > 0 ? prc[0] : null; } #endregion #region Text static string NormaliseEol(string text, string eol = null) { const string CR = "\r", LF = "\n", CRLF = "\r\n"; eol = eol ?? Environment.NewLine; switch (eol) { case CR: return text.Replace(CRLF, CR).Replace(LF, CR); case LF: return text.Replace(CRLF, LF).Replace(CR, LF); case CRLF: return text.Replace(CR, string.Empty).Replace(LF, CRLF); } return text; } #endregion } }
using System; using System.Diagnostics; namespace IronAHK.Rusty { partial class Core { #region Disk static string[] Glob(string pattern) { return new string[] { }; } #endregion #region Process static Process FindProcess(string name) { int id; if (int.TryParse(name, out id)) return System.Diagnostics.Process.GetProcessById(id); var prc = System.Diagnostics.Process.GetProcessesByName(name); return prc.Length > 0 ? prc[0] : null; } #endregion #region Text static string NormaliseEol(string text, string eol = null) { const string CR = "\r", LF = "\n", CRLF = "\r\n"; eol = eol ?? Environment.NewLine; switch (eol) { case CR: return text.Replace(CRLF, CR).Replace(LF, CR); case LF: return text.Replace(CRLF, LF).Replace(CR, LF); case CRLF: return text.Replace(CR, string.Empty).Replace(LF, CRLF); } return text; } #endregion } }
bsd-2-clause
C#
dc2f7e503d4a7a2aea8f0e2c140e72882e15635e
debug tumble
GRGSIBERIA/maya-camera
MayaCamera.cs
MayaCamera.cs
using UnityEngine; using System.Collections; public class MayaCamera : MonoBehaviour { Vector3 lookAtPosition; public float dollySpeed = 0.1f; public float tumbleSpeed = 1f; public float trackSpeed = 1f; Vector3 prevMousePosition; Vector3 prevMouseSpeed; public Vector3 mouseSpeed; public Vector3 mouseAccel; // Use this for initialization void Start () { lookAtPosition = Vector3.zero; prevMousePosition = Input.mousePosition; mouseSpeed = Vector3.zero; mouseAccel = Vector3.zero; Camera.main.transform.LookAt(lookAtPosition); } // Update is called once per frame void Update () { CalculateMousePhisics(); Tumble(); Dolly(); Track(); Camera.main.transform.LookAt(lookAtPosition); } void Tumble() { if (Input.GetKey(KeyCode.LeftAlt) && Input.GetMouseButton(0)) { // NbN, tumble Vector3 inverse_vector = lookAtPosition - Camera.main.transform.position; Quaternion rotation = Quaternion.LookRotation(inverse_vector); Camera.main.transform.rotation = rotation; Camera.main.transform.RotateAround(lookAtPosition, Vector3.up, mouseSpeed.x); Camera.main.transform.RotateAround(lookAtPosition, Camera.main.transform.right, -mouseSpeed.y); } } void Dolly() { if (Input.GetKey(KeyCode.LeftAlt) && Input.GetMouseButton(1)) { // ENbN, dolly var dollied_local = Camera.main.transform.localPosition; dollied_local.z -= (mouseSpeed.x + mouseSpeed.y) * dollySpeed; Camera.main.transform.localPosition = dollied_local; } } void Track() { if (Input.GetKey(KeyCode.LeftAlt) && Input.GetMouseButton(2)) { // NbN, track var speed_vec = mouseSpeed * trackSpeed; Camera.main.transform.localPosition -= speed_vec; lookAtPosition -= speed_vec; } } void CalculateMousePhisics() { // }EX̑xxvZ mouseSpeed = Input.mousePosition - prevMousePosition; mouseAccel = mouseSpeed - prevMouseSpeed; prevMouseSpeed = mouseSpeed; prevMousePosition = Input.mousePosition; } }
using UnityEngine; using System.Collections; public class MayaCamera : MonoBehaviour { Vector3 lookAtPosition; public float dollySpeed = 1f; public float tumbleSpeed = 1f; public float trackSpeed = 1f; Vector3 prevMousePosition; Vector3 prevMouseSpeed; public Vector3 mouseSpeed; public Vector3 mouseAccel; // Use this for initialization void Start () { lookAtPosition = Vector3.zero; prevMousePosition = Input.mousePosition; mouseSpeed = Vector3.zero; mouseAccel = Vector3.zero; Camera.main.transform.LookAt(lookAtPosition); } // Update is called once per frame void Update () { CalculateMousePhisics(); Tumble(); Dolly(); Track(); } void Tumble() { if (Input.GetKey(KeyCode.LeftAlt) && Input.GetMouseButton(0)) { // NbN, tumble Vector3 inverse_vector = Camera.main.transform.position - lookAtPosition; float length = inverse_vector.magnitude; inverse_vector.Normalize(); Vector3 rotated_vector = Quaternion.Euler( mouseSpeed.x * tumbleSpeed, mouseSpeed.y * tumbleSpeed, 0) * inverse_vector; Camera.main.transform.position = rotated_vector + lookAtPosition; Camera.main.transform.LookAt(lookAtPosition); } } void Dolly() { if (Input.GetKey(KeyCode.LeftAlt) && Input.GetMouseButton(1)) { // ENbN, dolly var dollied_local = Camera.main.transform.localPosition; dollied_local.z -= mouseSpeed.y * dollySpeed; Camera.main.transform.localPosition = dollied_local; } } void Track() { if (Input.GetKey(KeyCode.LeftAlt) && Input.GetMouseButton(2)) { // NbN, track Camera.main.transform.localPosition -= mouseSpeed; lookAtPosition -= mouseSpeed; } } void CalculateMousePhisics() { // }EX̑xxvZ mouseSpeed = Input.mousePosition - prevMousePosition; mouseAccel = mouseSpeed - prevMouseSpeed; prevMouseSpeed = mouseSpeed; prevMousePosition = Input.mousePosition; } }
bsd-3-clause
C#
15e8317021fdbbe6278847c1c35b87622c47e979
Use the term response instead of request.
bigfont/webapi-cors
CORS/Controllers/ValuesController.cs
CORS/Controllers/ValuesController.cs
using System.Collections.Generic; using System.Web.Http; using System.Web.Http.Cors; namespace CORS.Controllers { public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() { return new string[] { "This is a CORS response.", "It works from any origin." }; } // GET api/values/another [HttpGet] [EnableCors(origins:"http://www.bigfont.ca", headers:"*", methods: "*")] public IEnumerable<string> Another() { return new string[] { "This is a CORS response.", "It works only from www.bigfont.ca AND from the same origin." }; } } }
using System.Collections.Generic; using System.Web.Http; using System.Web.Http.Cors; namespace CORS.Controllers { public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() { return new string[] { "This is a CORS request.", "That works from any origin." }; } // GET api/values/another [HttpGet] [EnableCors(origins:"http://www.bigfont.ca", headers:"*", methods: "*")] public IEnumerable<string> Another() { return new string[] { "This is a CORS request.", "It works only from www.bigfont.ca." }; } } }
mit
C#
00291c07fcfa1199d5346b44fcdbcbdf68cddadc
update token
ethanli83/LinqRunner,ethanli83/LinqRunner,ethanli83/LinqRunner,ethanli83/LinqRunner,ethanli83/LinqRunner
LinqRunner.Server/Api/IssueApi.cs
LinqRunner.Server/Api/IssueApi.cs
using System; using System.IO; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Syntax; using Nancy; namespace LinqRunner.Server.Api { public class IssueApi : NancyModule { // c1e5b9fd11081e5deba883f71465ff330b4a4ec0 private static readonly HttpClient HttpClient = new HttpClient(); // private readonly string _id = "ad14b9fc01935d8fa1be"; // private readonly string _secret = "cc74c1fa4ea9321e3f9313b3a86b3b13752be9db"; public IssueApi() : base("api/issue") { Post("create", async args => { using (var sr = new StreamReader(Request.Body)) { return await CreateIssue(sr.ReadToEnd()); } }); } private async Task<HttpResponseMessage> CreateIssue(string issue) { var req = new HttpRequestMessage(HttpMethod.Post, "https://api.github.com/repos/ethanli83/EFSqlTranslator/issues"); req.Headers.Authorization = new AuthenticationHeaderValue("token", "445f3184b9259cdfcf52e20029882ccc79be9fe0"); req.Content = new StringContent(issue, Encoding.UTF8, "application/json"); req.Headers.Add("User-Agent", "TestingToken"); var res = await HttpClient.SendAsync(req); var data = await res.Content.ReadAsStringAsync(); Negotiate.WithStatusCode((int) res.StatusCode); return res; } } }
using System; using System.IO; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Syntax; using Nancy; namespace LinqRunner.Server.Api { public class IssueApi : NancyModule { // c1e5b9fd11081e5deba883f71465ff330b4a4ec0 private static readonly HttpClient HttpClient = new HttpClient(); // private readonly string _id = "ad14b9fc01935d8fa1be"; // private readonly string _secret = "cc74c1fa4ea9321e3f9313b3a86b3b13752be9db"; public IssueApi() : base("api/issue") { Post("create", async args => { using (var sr = new StreamReader(Request.Body)) { return await CreateIssue(sr.ReadToEnd()); } }); } private async Task<HttpResponseMessage> CreateIssue(string issue) { var req = new HttpRequestMessage(HttpMethod.Post, "https://api.github.com/repos/ethanli83/EFSqlTranslator/issues"); req.Headers.Authorization = new AuthenticationHeaderValue("token", "abf856788973128b19a9064a31dd904034660436"); req.Content = new StringContent(issue, Encoding.UTF8, "application/json"); req.Headers.Add("User-Agent", "TestingToken"); var res = await HttpClient.SendAsync(req); var data = await res.Content.ReadAsStringAsync(); Negotiate.WithStatusCode((int) res.StatusCode); return res; } } }
mit
C#
356e4f3904210149111f49055a802ed6aa73ba6e
Update AssemblyInfo.cs
falahati/LiteDB,RytisLT/LiteDB,89sos98/LiteDB,falahati/LiteDB,RytisLT/LiteDB,89sos98/LiteDB,mbdavid/LiteDB
LiteDB/Properties/AssemblyInfo.cs
LiteDB/Properties/AssemblyInfo.cs
using System.Resources; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("LiteDB")] [assembly: AssemblyDescription("LiteDB - A lightweight embedded .NET NoSQL document store in a single datafile")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Maurício David")] [assembly: AssemblyProduct("LiteDB")] [assembly: AssemblyCopyright("MIT © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("54989b5c-4bcf-4d58-b8ba-9b014a324f76")] [assembly: AssemblyVersion("3.1.2.0")] [assembly: AssemblyFileVersion("3.1.2.0")] [assembly: NeutralResourcesLanguage("en")]
using System.Resources; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("LiteDB")] [assembly: AssemblyDescription("LiteDB - A lightweight embedded .NET NoSQL document store in a single datafile")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Maurício David")] [assembly: AssemblyProduct("LiteDB")] [assembly: AssemblyCopyright("MIT © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("54989b5c-4bcf-4d58-b8ba-9b014a324f76")] [assembly: AssemblyVersion("3.1.1.0")] [assembly: AssemblyFileVersion("3.1.1.0")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
c0d9e1891ab392cc80da5e794fdd8fe36d20f12d
Fix spurious 404 response when deep linking to a client route
BrainCrumbz/AWATTS,BrainCrumbz/AWATTS,BrainCrumbz/AWATTS,BrainCrumbz/AWATTS
src/WebPackAngular2TypeScript/Routing/DeepLinkingMiddleware.cs
src/WebPackAngular2TypeScript/Routing/DeepLinkingMiddleware.cs
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.StaticFiles; using Microsoft.Extensions.Logging; using System.Threading.Tasks; namespace WebPackAngular2TypeScript.Routing { public class DeepLinkingMiddleware { public DeepLinkingMiddleware(RequestDelegate next, IHostingEnvironment hostingEnv, ILoggerFactory loggerFactory, DeepLinkingOptions options) { this.next = next; this.options = options; staticFileMiddleware = new StaticFileMiddleware(next, hostingEnv, options.FileServerOptions.StaticFileOptions, loggerFactory); } public async Task Invoke(HttpContext context) { // try to resolve the request with default static file middleware await staticFileMiddleware.Invoke(context); if (context.Response.StatusCode == StatusCodes.Status404NotFound) { var redirectUrlPath = FindRedirection(context); if (redirectUrlPath != unresolvedPath) { // if resolved, reset response as successful context.Response.StatusCode = StatusCodes.Status200OK; context.Request.Path = redirectUrlPath; await staticFileMiddleware.Invoke(context); } } } protected virtual PathString FindRedirection(HttpContext context) { // route to root path when request was not resolved return options.RedirectUrlPath; } protected readonly DeepLinkingOptions options; protected readonly RequestDelegate next; protected readonly StaticFileMiddleware staticFileMiddleware; protected readonly PathString unresolvedPath = null; } }
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.StaticFiles; using Microsoft.Extensions.Logging; using System.Threading.Tasks; namespace WebPackAngular2TypeScript.Routing { public class DeepLinkingMiddleware { public DeepLinkingMiddleware(RequestDelegate next, IHostingEnvironment hostingEnv, ILoggerFactory loggerFactory, DeepLinkingOptions options) { this.next = next; this.options = options; staticFileMiddleware = new StaticFileMiddleware(next, hostingEnv, options.FileServerOptions.StaticFileOptions, loggerFactory); } public async Task Invoke(HttpContext context) { // try to resolve the request with default static file middleware await staticFileMiddleware.Invoke(context); if (context.Response.StatusCode == 404) { var redirectUrlPath = FindRedirection(context); if (redirectUrlPath != unresolvedPath) { context.Request.Path = redirectUrlPath; await staticFileMiddleware.Invoke(context); } } } protected virtual PathString FindRedirection(HttpContext context) { // route to root path when request was not resolved return options.RedirectUrlPath; } protected readonly DeepLinkingOptions options; protected readonly RequestDelegate next; protected readonly StaticFileMiddleware staticFileMiddleware; protected readonly PathString unresolvedPath = null; } }
mit
C#
3838c12ad19b2289456acfc39ed8b9d2272a121b
Fix adding control observers
l8s/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1
Source/Eto.Platform.Mac/Forms/MacObject.cs
Source/Eto.Platform.Mac/Forms/MacObject.cs
using System; using MonoMac.Foundation; using System.Collections.Generic; using MonoMac.ObjCRuntime; namespace Eto.Platform.Mac.Forms { public class MacObject<T, W> : MacBase<T, W> where T: NSObject where W: InstanceWidget { public virtual object EventObject { get { return Control; } } public new void AddMethod (Selector selector, Delegate action, string arguments, object control = null) { base.AddMethod (selector, action, arguments, control ?? EventObject); } public new NSObject AddObserver (NSString key, Action<ObserverActionArgs> action, NSObject control = null) { return base.AddObserver (key, action, control ?? Control); } public new void AddControlObserver (NSString key, Action<ObserverActionArgs> action, NSObject control = null) { base.AddControlObserver (key, action, control ?? Control); } } }
using System; using MonoMac.Foundation; using System.Collections.Generic; using MonoMac.ObjCRuntime; namespace Eto.Platform.Mac.Forms { public class MacObject<T, W> : MacBase<T, W> where T: NSObject where W: InstanceWidget { public virtual object EventObject { get { return Control; } } public new void AddMethod (Selector selector, Delegate action, string arguments, object control = null) { base.AddMethod (selector, action, arguments, control ?? EventObject); } public new NSObject AddObserver (NSString key, Action<ObserverActionArgs> action, NSObject control = null) { return base.AddObserver (key, action, control ?? Control); } public new void AddControlObserver (NSString key, Action<ObserverActionArgs> action, NSObject control = null) { base.AddControlObserver (key, action, control ?? control); } } }
bsd-3-clause
C#
678ea8a21e6cef5dce988e219ac95261ab9a64bd
fix build
bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,l8s/Eto,l8s/Eto,PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,PowerOfCode/Eto
Source/Eto.Platform.Mac/Forms/MacObject.cs
Source/Eto.Platform.Mac/Forms/MacObject.cs
using System; using MonoMac.Foundation; using System.Collections.Generic; using MonoMac.ObjCRuntime; namespace Eto.Platform.Mac { public interface IMacControl { object Handler { get; } } public class MacObject<T, W> : WidgetHandler<T, W> where T: NSObject where W: Widget { List<NSObject> notifications; public class ObserverActionArgs : EventArgs { public W Widget { get; set; } public NSNotification Notification { get; set; } } class ObserverWrapper { public WeakReference Widget { get; set; } public WeakReference Action { get; set; } public void Run (NSNotification notification) { var action = Action.Target as Action<ObserverActionArgs>; var widget = (W)Widget.Target; if (action != null && widget != null) { action (new ObserverActionArgs{ Widget = widget, Notification = notification}); } } } public virtual object EventObject { get { return Control; } } protected void RemoveObserver (NSObject observer) { NSNotificationCenter.DefaultCenter.RemoveObserver (observer); notifications.Remove (observer); } public void AddMethod (Selector selector, Delegate action, string arguments, object control = null) { control = control ?? EventObject; var type = control.GetType (); if (!typeof(IMacControl).IsAssignableFrom (type)) throw new EtoException("Control does not inherit from IMacControl"); var cls = new Class(type); cls.AddMethod (selector.Handle, action, arguments); } public NSObject AddObserver (NSString key, Action<ObserverActionArgs> action, NSObject control = null) { if (notifications == null) notifications = new List<NSObject> (); if (control == null) control = Control; var wrap = new ObserverWrapper{ Action = new WeakReference (action), Widget = new WeakReference (this.Widget) }; var observer = NSNotificationCenter.DefaultCenter.AddObserver (key, wrap.Run, control); notifications.Add (observer); return observer; } protected override void Dispose (bool disposing) { base.Dispose (disposing); // dispose in finalizer as well if (notifications != null) { NSNotificationCenter.DefaultCenter.RemoveObservers (notifications); notifications = null; } } } }
using System; using MonoMac.Foundation; using System.Collections.Generic; using MonoMac.ObjCRuntime; namespace Eto.Platform.Mac { public interface IMacControl { object Handler { get; } } public class MacObject<T, W> : WidgetHandler<T, W> where T: NSObject where W: Widget { List<NSObject> notifications; public class ObserverActionArgs : EventArgs { public W Widget { get; set; } public NSNotification Notification { get; set; } } class ObserverWrapper { public WeakReference Widget { get; set; } public WeakReference Action { get; set; } public void Run (NSNotification notification) { var action = Action.Target as Action<ObserverActionArgs>; var widget = (W)Widget.Target; if (action != null && widget != null) { action (new ObserverActionArgs{ Widget = widget, Notification = notification}); } } } public virtual object EventObject { get { return Control; } } protected void RemoveObserver (NSObject observer) { NSNotificationCenter.DefaultCenter.RemoveObserver (observer); notifications.Remove (observer); } public void AddMethod (Selector selector, Delegate action, string arguments, object control = null) { control = control ?? EventObject; var type = control.GetType (); if (!typeof(IMacControl).IsAssignableFrom (type)) throw new EtoException("Control does not inherit from IMacControl"); var cls = new Class(type); cls.AddMethod (selector, action, arguments); } public NSObject AddObserver (NSString key, Action<ObserverActionArgs> action, NSObject control = null) { if (notifications == null) notifications = new List<NSObject> (); if (control == null) control = Control; var wrap = new ObserverWrapper{ Action = new WeakReference (action), Widget = new WeakReference (this.Widget) }; var observer = NSNotificationCenter.DefaultCenter.AddObserver (key, wrap.Run, control); notifications.Add (observer); return observer; } protected override void Dispose (bool disposing) { base.Dispose (disposing); // dispose in finalizer as well if (notifications != null) { NSNotificationCenter.DefaultCenter.RemoveObservers (notifications); notifications = null; } } } }
bsd-3-clause
C#
e447389da0c244dc9834ab96ec14b9c341138d0b
Update Computer.cs
Vinogradov-Mikhail/semestr3
workTwo/workTwo/Computer.cs
workTwo/workTwo/Computer.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Network { /// <summary> /// class for Сomuter in Local Network /// </summary> public class Computer { /// <summary> /// OperatingSystem of this PC /// </summary> private OperatingSystems os; /// <summary> /// is computer infected /// </summary> public bool Infected { get; set; } /// <summary> /// get os probability /// </summary> /// <returns></returns> public int GetProbability() => os.InfectionProbability; /// <summary> /// get os name /// </summary> /// <returns></returns> public string GetOsName() => os.NameOfOs; public Computer(OperatingSystems thisOs, bool poison) { os = thisOs; Infected = poison; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Network { /// <summary> /// class for comuter /// </summary> public class Computer { /// <summary> /// OperatingSystem of this PC /// </summary> private OperatingSystems os; /// <summary> /// is computer infected /// </summary> public bool Infected { get; set; } /// <summary> /// get os probability /// </summary> /// <returns></returns> public int GetProbability() => os.InfectionProbability; /// <summary> /// get os name /// </summary> /// <returns></returns> public string GetOsName() { return os.NameOfOs; } public Computer(OperatingSystems thisOs, bool poison) { os = thisOs; Infected = poison; } } }
apache-2.0
C#
0e2cb8f1559eb48ed26b4a8222669004e084cb9d
Move check for recipients to first
mattgwagner/alert-roster
alert-roster.web/Models/EmailSender.cs
alert-roster.web/Models/EmailSender.cs
using NLog; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Net; using System.Net.Mail; using System.Web; namespace alert_roster.web.Models { public class EmailSender { private static readonly Logger log = LogManager.GetCurrentClassLogger(); public static String EmailSubject = ConfigurationManager.AppSettings["Email.Subject"]; public static String FromAddress = ConfigurationManager.AppSettings["Email.FromAddress"]; public static String SmtpServer = ConfigurationManager.AppSettings["MAILGUN_SMTP_SERVER"]; public static int SmtpPort = int.Parse(ConfigurationManager.AppSettings["MAILGUN_SMTP_PORT"]); public static String SmtpUser = ConfigurationManager.AppSettings["MAILGUN_SMTP_LOGIN"]; public static String SmtpPassword = ConfigurationManager.AppSettings["MAILGUN_SMTP_PASSWORD"]; public static Boolean EnableSsl = true; public static Boolean IsBodyHtml = false; public static void Send(IEnumerable<String> Recipients, String content) { if (Recipients.Any()) { using (var smtp = new SmtpClient { Host = SmtpServer, Port = SmtpPort, EnableSsl = EnableSsl, Credentials = new NetworkCredential { UserName = SmtpUser, Password = SmtpPassword } }) using (var message = new MailMessage { IsBodyHtml = IsBodyHtml }) { message.From = new MailAddress(FromAddress); message.Subject = EmailSubject; foreach (var recipient in Recipients) { message.Bcc.Add(new MailAddress(recipient)); } message.Body = content; smtp.Send(message); } } } } }
using NLog; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Net; using System.Net.Mail; using System.Web; namespace alert_roster.web.Models { public class EmailSender { private static readonly Logger log = LogManager.GetCurrentClassLogger(); public static String EmailSubject = ConfigurationManager.AppSettings["Email.Subject"]; public static String FromAddress = ConfigurationManager.AppSettings["Email.FromAddress"]; public static String SmtpServer = ConfigurationManager.AppSettings["MAILGUN_SMTP_SERVER"]; public static int SmtpPort = int.Parse(ConfigurationManager.AppSettings["MAILGUN_SMTP_PORT"]); public static String SmtpUser = ConfigurationManager.AppSettings["MAILGUN_SMTP_LOGIN"]; public static String SmtpPassword = ConfigurationManager.AppSettings["MAILGUN_SMTP_PASSWORD"]; public static Boolean EnableSsl = true; public static Boolean IsBodyHtml = false; public static void Send(IEnumerable<String> Recipients, String content) { using (var smtp = new SmtpClient { Host = SmtpServer, Port = SmtpPort, EnableSsl = EnableSsl, Credentials = new NetworkCredential { UserName = SmtpUser, Password = SmtpPassword } }) using (var message = new MailMessage { IsBodyHtml = IsBodyHtml }) { if (Recipients.Any()) { message.From = new MailAddress(FromAddress); message.Subject = EmailSubject; foreach (var recipient in Recipients) { message.Bcc.Add(new MailAddress(recipient)); } message.Body = content; smtp.Send(message); } } } } }
mit
C#
3364492a4db766838692819ee9a1db43cfc8ac7e
change CrudService<T> to use Repository<T>
SorenZ/Alamut.DotNet
src/Alamut.Service/CrudService[TEntity].cs
src/Alamut.Service/CrudService[TEntity].cs
using Alamut.Data.Entity; using Alamut.Data.Repository; using Alamut.Data.Service; namespace Alamut.Service { public class CrudService<TEntity> : CrudService<TEntity, int>, ICrudService<TEntity> where TEntity : IEntity { public CrudService(IRepository<TEntity> repository) : base(repository) { } } }
using Alamut.Data.Entity; using Alamut.Data.Repository; using Alamut.Data.Service; namespace Alamut.Service { public class CrudService<TEntity> : CrudService<TEntity, int>, ICrudService<TEntity> where TEntity : IEntity { public CrudService(IRepository<TEntity, int> repository) : base(repository) { } } }
mit
C#
8a954d011101e2bf340bfea4a75e370c9f052ed1
Remove excessive constructor of PSScriptExecutor
Sitecore/Sitecore-Instance-Manager
src/ContainerInstaller/PSScriptExecutor.cs
src/ContainerInstaller/PSScriptExecutor.cs
using Sitecore.Diagnostics.Base; namespace ContainerInstaller { public class PSScriptExecutor : PSExecutor { private readonly string _script; public PSScriptExecutor(string executionDir, string script) : base(executionDir) { Assert.ArgumentNotNullOrEmpty(script, "script"); this._script = script; } public override string GetScript() { return this._script; } } }
using Sitecore.Diagnostics.Base; namespace ContainerInstaller { public class PSScriptExecutor : PSExecutor { private readonly string _script; public PSScriptExecutor(string executionDir) : base(executionDir) { } public PSScriptExecutor(string executionDir, string script) : this(executionDir) { Assert.ArgumentNotNullOrEmpty(script, "script"); this._script = script; } public override string GetScript() { return this._script; } } }
mit
C#
f1495864dd489f3dc8cdc118a1f297e3d3c1776a
Update LinkedListDictionary.cs
efruchter/UnityUtilities
MiscDataStructures/LinkedListDictionary.cs
MiscDataStructures/LinkedListDictionary.cs
using System.Collections; using System.Collections.Generic; namespace System.Collections.Generic { /// <summary> /// LinkedList/Dictionary combo for constant time add/remove/contains. Memory usage is higher as expected. /// -kazoo /// </summary> /// <typeparam name="TK">key value type. It is recomended that this be "int", for speed purposes.</typeparam> /// <typeparam name="TV">The value type. Can be anything you like.</typeparam> public class LinkedListDictionary<TK, TV> : IEnumerable<TV> { private readonly Dictionary<TK, LLEntry> dictionary = new Dictionary<TK, LLEntry>(); private readonly LinkedList<TV> list = new LinkedList<TV>(); /// <summary> /// Get The count. /// </summary> /// <returns></returns> public int Count { get { return list.Count; } } /// <summary> /// Is the key in the dictionary? /// </summary> /// <param name="k">key</param> /// <returns>true if key is present, false otherwise.</returns> public bool ContainsKey(TK k) { return dictionary.ContainsKey(k); } /// <summary> /// Remove a key/value from the dictionary if present. /// </summary> /// <param name="k">key</param> /// <returns>True if removal worked. False if removal is not possible.</returns> public bool Remove(TK k) { if (!ContainsKey(k)) { return false; } LLEntry entry = dictionary[k]; list.Remove(entry.vNode); return dictionary.Remove(k); } /// <summary> /// Add an item. Replacement is allowed. /// </summary> /// <param name="k">key</param> /// <param name="v">value</param> public void Add(TK k, TV v) { Remove(k); dictionary[k] = new LLEntry(v, list.AddLast(v)); } /// <summary> /// Retrieve an element by key. /// </summary> /// <param name="k">key</param> /// <returns>Value. If element is not present, default(V) will be returned.</returns> public TV GetValue(TK k) { if (ContainsKey(k)) { return dictionary[k].v; } return default(TV); } public TV this[TK k] { get { return GetValue(k); } set { Add(k, value); } } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public IEnumerator<TV> GetEnumerator() { return list.GetEnumerator(); } public void Clear() { dictionary.Clear(); list.Clear(); } private struct LLEntry { public readonly TV v; public readonly LinkedListNode<TV> vNode; public LLEntry(TV v, LinkedListNode<TV> vNode) { this.v = v; this.vNode = vNode; } } } }
using System.Collections; using System.Collections.Generic; /// <summary> /// LinkedList/Dictionary combo for constant time add/remove/contains. Memory usage is higher as expected. /// -kazoo /// </summary> /// <typeparam name="TK">key value type. It is recomended that this be "int", for speed purposes.</typeparam> /// <typeparam name="TV">The value type. Can be anything you like.</typeparam> public class LinkedListDictionary<TK, TV> : IEnumerable<TV> { private readonly Dictionary<TK, LLEntry> dictionary = new Dictionary<TK, LLEntry>(); private readonly LinkedList<TV> list = new LinkedList<TV>(); /// <summary> /// Get The count. /// </summary> /// <returns></returns> public int Count { get { return list.Count; } } /// <summary> /// Is the key in the dictionary? /// </summary> /// <param name="k">key</param> /// <returns>true if key is present, false otherwise.</returns> public bool ContainsKey(TK k) { return dictionary.ContainsKey(k); } /// <summary> /// Remove a key/value from the dictionary if present. /// </summary> /// <param name="k">key</param> /// <returns>True if removal worked. False if removal is not possible.</returns> public bool Remove(TK k) { if (!ContainsKey(k)) { return false; } LLEntry entry = dictionary[k]; list.Remove(entry.vNode); return dictionary.Remove(k); } /// <summary> /// Add an item. Replacement is allowed. /// </summary> /// <param name="k">key</param> /// <param name="v">value</param> public void Add(TK k, TV v) { Remove(k); dictionary[k] = new LLEntry(v, list.AddLast(v)); } /// <summary> /// Retrieve an element by key. /// </summary> /// <param name="k">key</param> /// <returns>Value. If element is not present, default(V) will be returned.</returns> public TV GetValue(TK k) { if (ContainsKey(k)) { return dictionary[k].v; } return default(TV); } public TV this[TK k] { get { return GetValue(k); } set { Add(k, value); } } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public IEnumerator<TV> GetEnumerator() { return list.GetEnumerator(); } private struct LLEntry { public readonly TV v; public readonly LinkedListNode<TV> vNode; public LLEntry(TV v, LinkedListNode<TV> vNode) { this.v = v; this.vNode = vNode; } } }
mit
C#
69bf905ab7fd223a356a9f80a3280dcb7657bf25
Fix connectionStrings section attribute in BadConfig doc page
vasanthangel4/azure-webjobs-sdk,Azure/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,Azure/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,oaastest/azure-webjobs-sdk
src/Dashboard/Views/BadConfig/Index.cshtml
src/Dashboard/Views/BadConfig/Index.cshtml
@using Dashboard @using Microsoft.WindowsAzure.Jobs @{ ViewBag.Title = "Configuration Error"; } <h2>Bad Config</h2> <p> The configuration is not properly set for the Windows Azure Web Jobs SDK Dashboard. In your configuration (such as web.config), you must set a connection string named <i>@JobHost.LoggingConnectionStringName</i> that points to the account connection string where the sb logs are being stored. EG, under "connectionStrings" in Web.config, add a value like: </p> <pre> &lt;add name="@JobHost.LoggingConnectionStringName" connectionString="DefaultEndpointsProtocol=https;AccountName=<b>NAME</b>;AccountKey=<b>KEY</b>" /&gt; </pre> <p> This is the storage account that your user functions will bind against. This is also where logging will be stored. </p> <p class="alert alert-danger">@SimpleBatchStuff.BadInitErrorMessage</p>
@using Dashboard @using Microsoft.WindowsAzure.Jobs @{ ViewBag.Title = "Configuration Error"; } <h2>Bad Config</h2> <p> The configuration is not properly set for the Windows Azure Web Jobs SDK Dashboard. In your configuration (such as web.config), you must set a connection string named <i>@JobHost.LoggingConnectionStringName</i> that points to the account connection string where the sb logs are being stored. EG, under "connectionStrings" in Web.config, add a value like: </p> <pre> &lt;add name="@JobHost.LoggingConnectionStringName" value="DefaultEndpointsProtocol=https;AccountName=<b>NAME</b>;AccountKey=<b>KEY</b>" /&gt; </pre> <p> This is the storage account that your user functions will bind against. This is also where logging will be stored. </p> <p class="alert alert-danger">@SimpleBatchStuff.BadInitErrorMessage</p>
mit
C#
d3d56f47780b1b9316ffe84e356bde9a32615666
Increment version to v1.1.0.22
jcvandan/XeroAPI.Net,TDaphneB/XeroAPI.Net,XeroAPI/XeroAPI.Net,MatthewSteeples/XeroAPI.Net
source/XeroApi/Properties/AssemblyInfo.cs
source/XeroApi/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.22")] [assembly: AssemblyFileVersion("1.1.0.22")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.21")] [assembly: AssemblyFileVersion("1.1.0.21")]
mit
C#
e5207a1d2791312bb7a12bf24a0bf7336d835f75
Simplify null checks
NuKeeperDotNet/NuKeeper,skolima/NuKeeper,AnthonySteele/NuKeeper,skolima/NuKeeper,NuKeeperDotNet/NuKeeper,NuKeeperDotNet/NuKeeper,AnthonySteele/NuKeeper,AnthonySteele/NuKeeper,skolima/NuKeeper,AnthonySteele/NuKeeper,NuKeeperDotNet/NuKeeper,skolima/NuKeeper
NuKeeper/NuGet/Api/PackageUpdatesLookup.cs
NuKeeper/NuGet/Api/PackageUpdatesLookup.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using NuGet.Protocol.Core.Types; using NuKeeper.RepositoryInspection; namespace NuKeeper.NuGet.Api { public class PackageUpdatesLookup : IPackageUpdatesLookup { private readonly IApiPackageLookup _packageLookup; public PackageUpdatesLookup(IApiPackageLookup packageLookup) { _packageLookup = packageLookup; } public async Task<List<PackageUpdateSet>> FindUpdatesForPackages(List<PackageInProject> packages) { var latestVersions = await BuildLatestVersionsDictionary(packages); var results = new List<PackageUpdateSet>(); foreach (var packageId in latestVersions.Keys) { var latestVersion = latestVersions[packageId].Identity; var updatesForThisPackage = packages .Where(p => p.Id == packageId && p.Version < latestVersion.Version) .ToList(); if (updatesForThisPackage.Count > 0) { var updateSet = new PackageUpdateSet(latestVersion, updatesForThisPackage); results.Add(updateSet); } } return results; } private async Task<Dictionary<string, IPackageSearchMetadata>> BuildLatestVersionsDictionary(IEnumerable<PackageInProject> packages) { var result = new Dictionary<string, IPackageSearchMetadata>(); var packageIds = packages .Select(p => p.Id) .Distinct(); foreach (var packageId in packageIds) { var serverVersion = await _packageLookup.LookupLatest(packageId); if (serverVersion?.Identity != null) { result.Add(packageId, serverVersion); Console.WriteLine($"Found latest version of {packageId}: {serverVersion.Identity.Id} {serverVersion.Identity.Version}"); } } return result; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using NuGet.Protocol.Core.Types; using NuKeeper.RepositoryInspection; namespace NuKeeper.NuGet.Api { public class PackageUpdatesLookup : IPackageUpdatesLookup { private readonly IApiPackageLookup _packageLookup; public PackageUpdatesLookup(IApiPackageLookup packageLookup) { _packageLookup = packageLookup; } public async Task<List<PackageUpdateSet>> FindUpdatesForPackages(List<PackageInProject> packages) { var latestVersions = await BuildLatestVersionsDictionary(packages); var results = new List<PackageUpdateSet>(); foreach (var packageId in latestVersions.Keys) { var latestVersion = latestVersions[packageId].Identity; var updatesForThisPackage = packages .Where(p => p.Id == packageId && p.Version < latestVersion.Version) .ToList(); if (updatesForThisPackage.Count > 0) { var updateSet = new PackageUpdateSet(latestVersion, updatesForThisPackage); results.Add(updateSet); } } return results; } private async Task<Dictionary<string, IPackageSearchMetadata>> BuildLatestVersionsDictionary(IEnumerable<PackageInProject> packages) { var result = new Dictionary<string, IPackageSearchMetadata>(); var packageIds = packages .Select(p => p.Id) .Distinct(); foreach (var packageId in packageIds) { var serverVersion = await _packageLookup.LookupLatest(packageId); if (serverVersion != null) { result.Add(packageId, serverVersion); Console.WriteLine($"Found latest version of {packageId}: {serverVersion.Identity?.Id} {serverVersion.Identity?.Version}"); } } return result; } } }
apache-2.0
C#
c2aaf77ddba5d49f9253a4f2733df3ed95e55659
Fix memory leak in timers (#3452)
galvesribeiro/orleans,SoftWar1923/orleans,ashkan-saeedi-mazdeh/orleans,ibondy/orleans,dotnet/orleans,brhinescot/orleans,veikkoeeva/orleans,brhinescot/orleans,ElanHasson/orleans,hoopsomuah/orleans,Liversage/orleans,benjaminpetit/orleans,amccool/orleans,ElanHasson/orleans,dVakulen/orleans,jthelin/orleans,galvesribeiro/orleans,ashkan-saeedi-mazdeh/orleans,Liversage/orleans,pherbel/orleans,MikeHardman/orleans,dVakulen/orleans,jason-bragg/orleans,ashkan-saeedi-mazdeh/orleans,jokin/orleans,waynemunro/orleans,sergeybykov/orleans,ReubenBond/orleans,yevhen/orleans,jokin/orleans,hoopsomuah/orleans,amccool/orleans,ibondy/orleans,waynemunro/orleans,brhinescot/orleans,SoftWar1923/orleans,yevhen/orleans,sergeybykov/orleans,dotnet/orleans,pherbel/orleans,jokin/orleans,amccool/orleans,dVakulen/orleans,Liversage/orleans,MikeHardman/orleans
src/OrleansRuntime/Timers/TimerRegistry.cs
src/OrleansRuntime/Timers/TimerRegistry.cs
using System; using System.Threading.Tasks; using Orleans.Runtime; using Orleans.Runtime.Scheduler; namespace Orleans.Timers { internal class TimerRegistry : ITimerRegistry { private readonly OrleansTaskScheduler scheduler; public TimerRegistry(OrleansTaskScheduler scheduler) { this.scheduler = scheduler; } public IDisposable RegisterTimer(Grain grain, Func<object, Task> asyncCallback, object state, TimeSpan dueTime, TimeSpan period) { var timer = GrainTimer.FromTaskCallback(this.scheduler, asyncCallback, state, dueTime, period, activationData: grain.Data); grain.Data.OnTimerCreated(timer); timer.Start(); return timer; } } }
using System; using System.Threading.Tasks; using Orleans.Runtime; using Orleans.Runtime.Scheduler; namespace Orleans.Timers { internal class TimerRegistry : ITimerRegistry { private readonly OrleansTaskScheduler scheduler; public TimerRegistry(OrleansTaskScheduler scheduler) { this.scheduler = scheduler; } public IDisposable RegisterTimer(Grain grain, Func<object, Task> asyncCallback, object state, TimeSpan dueTime, TimeSpan period) { var timer = GrainTimer.FromTaskCallback(this.scheduler, asyncCallback, state, dueTime, period); grain.Data.OnTimerCreated(timer); timer.Start(); return timer; } } }
mit
C#
a9dfe2065a6fd456e3ffe306b046a3a08890231f
Enhance the Mac command reference text a bit
awaescher/RepoZ,awaescher/RepoZ
RepoZ.UI.Mac.Story/StringCommandHandler.cs
RepoZ.UI.Mac.Story/StringCommandHandler.cs
using System; using System.Text; using System.Collections.Generic; using System.Linq; namespace RepoZ.UI.Mac.Story { public class StringCommandHandler { private Dictionary<string, Action> _commands = new Dictionary<string, Action>(); private StringBuilder _helpBuilder = new StringBuilder(); internal bool IsCommand(string value) { return value?.StartsWith(":") == true; } internal bool Handle(string command) { if (_commands.TryGetValue(CleanCommand(command), out Action commandAction)) { commandAction.Invoke(); return true; } return false; } internal void Define(string[] commands, Action commandAction, string helpText) { foreach (var command in commands) _commands[CleanCommand(command)] = commandAction; if (_helpBuilder.Length == 0) { _helpBuilder.AppendLine("To execute a command instead of filtering the list of repositories, simply begin with a colon (:)."); _helpBuilder.AppendLine(""); _helpBuilder.AppendLine("Command reference:"); } _helpBuilder.AppendLine(""); _helpBuilder.AppendLine("\t:" + string.Join(" or :", commands.OrderBy(c => c))); _helpBuilder.AppendLine("\t\t"+ helpText); } private string CleanCommand(string command) { command = command?.Trim().ToLower() ?? ""; return command.StartsWith(":", StringComparison.OrdinalIgnoreCase) ? command.Substring(1) : command; } internal string GetHelpText() => _helpBuilder.ToString(); } }
using System; using System.Text; using System.Collections.Generic; using System.Linq; namespace RepoZ.UI.Mac.Story { public class StringCommandHandler { private Dictionary<string, Action> _commands = new Dictionary<string, Action>(); private StringBuilder _helpBuilder = new StringBuilder(); internal bool IsCommand(string value) { return value?.StartsWith(":") == true; } internal bool Handle(string command) { if (_commands.TryGetValue(CleanCommand(command), out Action commandAction)) { commandAction.Invoke(); return true; } return false; } internal void Define(string[] commands, Action commandAction, string helpText) { foreach (var command in commands) _commands[CleanCommand(command)] = commandAction; if (_helpBuilder.Length > 0) _helpBuilder.AppendLine(""); _helpBuilder.AppendLine(string.Join(", ", commands.OrderBy(c => c))); _helpBuilder.AppendLine("\t"+ helpText); } private string CleanCommand(string command) { command = command?.Trim().ToLower() ?? ""; return command.StartsWith(":", StringComparison.OrdinalIgnoreCase) ? command.Substring(1) : command; } internal string GetHelpText() => _helpBuilder.ToString(); } }
mit
C#
356e0f42d34cd5ff11767f8f584ead235aa8bc0e
Use site title in email subject for exception handler.
IanNorris/RationalVote,IanNorris/RationalVote
Source/Controllers/MailController.cs
Source/Controllers/MailController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using ActionMailer.Net.Mvc; using RationalVote.Models; using System.Configuration; namespace RationalVote.Controllers { public class MailController : MailerBase { public static string GetFromEmail( string purpose ) { return String.Format( "\"{0} {1}\" <{2}>", ConfigurationManager.AppSettings.Get("siteTitle"), purpose, ConfigurationManager.AppSettings.Get("emailFrom") ); } public EmailResult VerificationEmail( User model, EmailVerificationToken token ) { To.Add( model.Email ); From = GetFromEmail( "Verification" ); Subject = "Please verify your account"; ViewBag.Token = token.Token; return Email( "VerificationEmail" ); } public EmailResult ExceptionEmail( HttpException e, string message ) { To.Add( ConfigurationManager.AppSettings.Get( "ServerAdmin" ) ); From = GetFromEmail( "Exception" ); Subject = ConfigurationManager.AppSettings.Get("siteTitle") + " exception - " + message; ViewBag.Exception = e.ToString(); return Email( "ExceptionEmail" ); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using ActionMailer.Net.Mvc; using RationalVote.Models; using System.Configuration; namespace RationalVote.Controllers { public class MailController : MailerBase { public static string GetFromEmail( string purpose ) { return String.Format( "\"{0} {1}\" <{2}>", ConfigurationManager.AppSettings.Get("siteTitle"), purpose, ConfigurationManager.AppSettings.Get("emailFrom") ); } public EmailResult VerificationEmail( User model, EmailVerificationToken token ) { To.Add( model.Email ); From = GetFromEmail( "Verification" ); Subject = "Please verify your account"; ViewBag.Token = token.Token; return Email( "VerificationEmail" ); } public EmailResult ExceptionEmail( HttpException e, string message ) { To.Add( ConfigurationManager.AppSettings.Get( "ServerAdmin" ) ); From = GetFromEmail( "Exception" ); Subject = "Site exception - " + message; ViewBag.Exception = e.ToString(); return Email( "ExceptionEmail" ); } } }
mit
C#
85fcff68b5ee6432e4efb2b7507952071b85dd8b
Write error message in try catch
appharbor/appharbor-cli
src/AppHarbor/ApplicationConfiguration.cs
src/AppHarbor/ApplicationConfiguration.cs
using System; using System.IO; using System.Linq; using AppHarbor.Model; namespace AppHarbor { public class ApplicationConfiguration : IApplicationConfiguration { private readonly IFileSystem _fileSystem; private readonly IGitExecutor _gitExecutor; public ApplicationConfiguration(IFileSystem fileSystem, IGitExecutor gitExecutor) { _fileSystem = fileSystem; _gitExecutor = gitExecutor; } public string GetApplicationId() { try { using (var stream = _fileSystem.OpenRead(ConfigurationFile.FullName)) { using (var reader = new StreamReader(stream)) { return reader.ReadToEnd(); } } } catch (FileNotFoundException) { } var url = _gitExecutor.Execute("config remote.appharbor.url", CurrentDirectory).FirstOrDefault(); if (url != null) { return url.Split(new string[] { "/", ".git" }, StringSplitOptions.RemoveEmptyEntries).Last(); } throw new ApplicationConfigurationException("Application is not configured"); } public virtual void SetupApplication(string id, User user) { var repositoryUrl = string.Format("https://{0}@appharbor.com/{1}.git", user.Username, id); try { _gitExecutor.Execute(string.Format("remote add appharbor {0}", repositoryUrl), CurrentDirectory); Console.WriteLine("Added \"appharbor\" as a remote repository. Push to AppHarbor with git push appharbor master"); return; } catch (InvalidOperationException) { Console.WriteLine("Couldn't add appharbor repository as a git remote. Repository URL is: {0}", repositoryUrl); } using (var stream = _fileSystem.OpenWrite(ConfigurationFile.FullName)) { using (var writer = new StreamWriter(stream)) { writer.Write(id); } } Console.WriteLine("Wrote application configuration to {0}", ConfigurationFile); } private static DirectoryInfo CurrentDirectory { get { return new DirectoryInfo(Directory.GetCurrentDirectory()); } } private static FileInfo ConfigurationFile { get { var directory = Directory.GetCurrentDirectory(); var appharborConfigurationFile = new FileInfo(Path.Combine(directory, ".appharbor")); return appharborConfigurationFile; } } } }
using System; using System.IO; using System.Linq; using AppHarbor.Model; namespace AppHarbor { public class ApplicationConfiguration : IApplicationConfiguration { private readonly IFileSystem _fileSystem; private readonly IGitExecutor _gitExecutor; public ApplicationConfiguration(IFileSystem fileSystem, IGitExecutor gitExecutor) { _fileSystem = fileSystem; _gitExecutor = gitExecutor; } public string GetApplicationId() { try { using (var stream = _fileSystem.OpenRead(ConfigurationFile.FullName)) { using (var reader = new StreamReader(stream)) { return reader.ReadToEnd(); } } } catch (FileNotFoundException) { } var url = _gitExecutor.Execute("config remote.appharbor.url", CurrentDirectory).FirstOrDefault(); if (url != null) { return url.Split(new string[] { "/", ".git" }, StringSplitOptions.RemoveEmptyEntries).Last(); } throw new ApplicationConfigurationException("Application is not configured"); } public virtual void SetupApplication(string id, User user) { var repositoryUrl = string.Format("https://{0}@appharbor.com/{1}.git", user.Username, id); try { _gitExecutor.Execute(string.Format("remote add appharbor {0}", repositoryUrl), CurrentDirectory); Console.WriteLine("Added \"appharbor\" as a remote repository. Push to AppHarbor with git push appharbor master"); return; } catch (InvalidOperationException) { } Console.WriteLine("Couldn't add appharbor repository as a git remote. Repository URL is: {0}", repositoryUrl); using (var stream = _fileSystem.OpenWrite(ConfigurationFile.FullName)) { using (var writer = new StreamWriter(stream)) { writer.Write(id); } } Console.WriteLine("Wrote application configuration to {0}", ConfigurationFile); } private static DirectoryInfo CurrentDirectory { get { return new DirectoryInfo(Directory.GetCurrentDirectory()); } } private static FileInfo ConfigurationFile { get { var directory = Directory.GetCurrentDirectory(); var appharborConfigurationFile = new FileInfo(Path.Combine(directory, ".appharbor")); return appharborConfigurationFile; } } } }
mit
C#
4485c025452cc6879ba2089b99d381460971232c
Handle hyperlinks in Bloom Reader Preview inside Bloom (BL-7569)
gmartin7/myBloomFork,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork
src/BloomExe/Publish/HtmlPublishPanel.cs
src/BloomExe/Publish/HtmlPublishPanel.cs
using System; using System.Windows.Forms; using SIL.PlatformUtilities; using Gecko; using Gecko.DOM; namespace Bloom.Publish { /// <summary> /// This configurable class provides a C# wrapper for several of the publish option /// panels that appear in the Publish tab, for which the UI is an html component /// </summary> public partial class HtmlPublishPanel : UserControl { private Browser _browser; public HtmlPublishPanel(string pathToHtmlFile) { InitializeComponent(); _browser = new Browser(); _browser.Dock = DockStyle.Fill; Controls.Add(_browser); // Has to be in front of the panel docked top for Fill to work. _browser.BringToFront(); _browser.Navigate(pathToHtmlFile.ToLocalhost() + GetUrlParams(), false); _browser.OnBrowserClick += HandleExternalLinkClick; VisibleChanged += OnVisibleChanged; } public Browser Browser => _browser; private string GetUrlParams() { return $"?isLinux={Platform.IsLinux}"; } private void OnVisibleChanged(object sender, EventArgs eventArgs) { if (!Visible) { Deactivate(); } } /// <summary> /// Detect clicks on anchor elements and handle them by passing the href to the default system browser. /// </summary> /// <remarks> /// See https://issues.bloomlibrary.org/youtrack/issue/BL-7569. /// Note that Readium handles these clicks internally and we never get to see them. The relevant Readium /// code is apparently in readium-js-viewer/readium-js/readium-shared-js/js/views/internal_links_support.js /// in the function this.processLinkElements. /// </remarks> private void HandleExternalLinkClick(object sender, EventArgs e) { var ge = e as DomEventArgs; if (ge == null || ge.Target == null) return; GeckoHtmlElement target; try { target = (GeckoHtmlElement)ge.Target.CastToGeckoElement(); } catch (InvalidCastException) { return; } var anchor = target as GeckoAnchorElement; if (anchor == null) anchor = target.Parent as GeckoAnchorElement; // Might be a span inside an anchor if (anchor != null && !String.IsNullOrEmpty(anchor.Href) && // Handle only http(s) and mailto protocols. (anchor.Href.ToLowerInvariant().StartsWith("http") || anchor.Href.ToLowerInvariant().StartsWith("mailto")) && // Don't try to handle localhost Bloom requests. !anchor.Href.ToLowerInvariant().StartsWith(Bloom.Api.BloomServer.ServerUrlWithBloomPrefixEndingInSlash)) { SIL.Program.Process.SafeStart(anchor.Href); ge.Handled = true; } // All other clicks get normal processing... } private void Deactivate() { // This is important so the react stuff can do its cleanup _browser.WebBrowser.Navigate("about:blank"); } } }
using System; using System.Windows.Forms; using SIL.PlatformUtilities; namespace Bloom.Publish { /// <summary> /// This configurable class provides a C# wrapper for several of the publish option /// panels that appear in the Publish tab, for which the UI is an html component /// </summary> public partial class HtmlPublishPanel : UserControl { private Browser _browser; public HtmlPublishPanel(string pathToHtmlFile) { InitializeComponent(); _browser = new Browser(); _browser.Dock = DockStyle.Fill; Controls.Add(_browser); // Has to be in front of the panel docked top for Fill to work. _browser.BringToFront(); _browser.Navigate(pathToHtmlFile.ToLocalhost() + GetUrlParams(), false); VisibleChanged += OnVisibleChanged; } public Browser Browser => _browser; private string GetUrlParams() { return $"?isLinux={Platform.IsLinux}"; } private void OnVisibleChanged(object sender, EventArgs eventArgs) { if (!Visible) { Deactivate(); } } private void Deactivate() { // This is important so the react stuff can do its cleanup _browser.WebBrowser.Navigate("about:blank"); } } }
mit
C#
0f76185e9874abe3caff7d9be0f95dde99e0c6a2
Create obfuscator(fix)
remobjects/Obfuscar
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
#region Copyright (c) 2007 Ryan Williams <drcforbin@gmail.com> /// <copyright> /// Copyright (c) 2007 Ryan Williams <drcforbin@gmail.com> /// /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to deal /// in the Software without restriction, including without limitation the rights /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell /// copies of the Software, and to permit persons to whom the Software is /// furnished to do so, subject to the following conditions: /// /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN /// THE SOFTWARE. /// </copyright> #endregion using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: InternalsVisibleTo( "ObfuscarTests" )] // 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( "Obfuscar" )] [assembly: AssemblyDescription( "" )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "" )] [assembly: AssemblyProduct( "Obfuscar" )] [assembly: AssemblyCopyright( "Copyright © Ryan Williams 2007" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible( false )] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid( "7965f23d-515c-4f93-a7a0-76a416ab54af" )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion( "1.4.0" )] [assembly: AssemblyFileVersion( "1.4.0" )] [assembly: AssemblyKeyName("RemObjectsSoftware")]
#region Copyright (c) 2007 Ryan Williams <drcforbin@gmail.com> /// <copyright> /// Copyright (c) 2007 Ryan Williams <drcforbin@gmail.com> /// /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to deal /// in the Software without restriction, including without limitation the rights /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell /// copies of the Software, and to permit persons to whom the Software is /// furnished to do so, subject to the following conditions: /// /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN /// THE SOFTWARE. /// </copyright> #endregion using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: InternalsVisibleTo( "ObfuscarTests" )] // 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( "Obfuscar" )] [assembly: AssemblyDescription( "" )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "" )] [assembly: AssemblyProduct( "Obfuscar" )] [assembly: AssemblyCopyright( "Copyright © Ryan Williams 2007" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible( false )] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid( "7965f23d-515c-4f93-a7a0-76a416ab54af" )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion( "1.4.0" )] [assembly: AssemblyFileVersion( "1.4.0" )] [assembly: AssemblyKeyName('RemObjectsSoftware')]
mit
C#
201fc0fefb8f13eae404f14420f03ed13c65e040
bump to version 1.2.1.0
dnauck/AspSQLProvider,dnauck/AspSQLProvider
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
// // $Id$ // // Copyright 2006 - 2008 Nauck IT KG http://www.nauck-it.de // // Author: // Daniel Nauck <d.nauck(at)nauck-it.de> // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PostgreSQL Provider")] [assembly: AssemblyDescription("PostgreSQL Membership, Role, Profile and Session-State Store Provider for ASP.NET 2.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nauck IT KG")] [assembly: AssemblyProduct("PostgreSQL Provider")] [assembly: AssemblyCopyright("Copyright 2006 - 2008 Nauck IT KG")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguageAttribute("en")] [assembly: CLSCompliant(true)] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("0c7b829a-f6f7-4b4b-9b24-f10eacbbcb93")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.2.1.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]
// // $Id$ // // Copyright 2006 - 2008 Nauck IT KG http://www.nauck-it.de // // Author: // Daniel Nauck <d.nauck(at)nauck-it.de> // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PostgreSQL Provider")] [assembly: AssemblyDescription("PostgreSQL Membership, Role, Profile and Session-State Store Provider for ASP.NET 2.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nauck IT KG")] [assembly: AssemblyProduct("PostgreSQL Provider")] [assembly: AssemblyCopyright("Copyright 2006 - 2008 Nauck IT KG")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguageAttribute("en")] [assembly: CLSCompliant(true)] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("0c7b829a-f6f7-4b4b-9b24-f10eacbbcb93")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.2.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
1ab9e35c6ee1de4854a77c34671b16b932d31f11
Update version to 1.0
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using TweetDick; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(Program.BrandName)] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct(Program.BrandName)] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7f09373d-8beb-416f-a48d-45d8aaeb8caf")] // 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: NeutralResourcesLanguageAttribute("en")]
using System.Reflection; using System.Runtime.InteropServices; using TweetDick; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(Program.BrandName)] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct(Program.BrandName)] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7f09373d-8beb-416f-a48d-45d8aaeb8caf")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.9.1.0")] [assembly: AssemblyFileVersion("0.9.1.0")] [assembly: NeutralResourcesLanguageAttribute("en")]
mit
C#
1b4db3ac0b3767711141a410b07442f5b0eacd09
Implement Load() methods to create a License instance from XML
dnauck/Portable.Licensing,dreamrain21/Portable.Licensing,dreamrain21/Portable.Licensing,dnauck/Portable.Licensing
src/Portable.Licensing/LicenseFactory.cs
src/Portable.Licensing/LicenseFactory.cs
// // Copyright © 2012 - 2013 Nauck IT KG http://www.nauck-it.de // // Author: // Daniel Nauck <d.nauck(at)nauck-it.de> // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System.IO; using System.Xml; using System.Xml.Linq; using Portable.Licensing.Model; namespace Portable.Licensing { /// <summary> /// Static factory class to create new <see cref="ILicense"/>. /// </summary> public static class LicenseFactory { /// <summary> /// Create a new <see cref="ILicense"/> using the <see cref="ILicenseBuilder"/> /// fluent api. /// </summary> /// <returns>An instance of the <see cref="ILicenseBuilder"/> class.</returns> public static ILicenseBuilder New() { return new LicenseBuilder(); } /// <summary> /// Loads a <see cref="ILicense"/> from a string that contains XML. /// </summary> /// <param name="xmlString">A <see cref="string"/> that contains XML.</param> /// <returns>A <see cref="ILicense"/> populated from the <see cref="string"/> that contains XML.</returns> public static ILicense Load(string xmlString) { return License.Load(XElement.Parse(xmlString, LoadOptions.None)); } /// <summary> /// Loads a <see cref="ILicense"/> by using the specified <see cref="Stream"/> /// that contains the XML. /// </summary> /// <param name="stream">A <see cref="Stream"/> that contains the XML.</param> /// <returns>A <see cref="ILicense"/> populated from the <see cref="Stream"/> that contains XML.</returns> public static ILicense Load(Stream stream) { return License.Load(XElement.Load(stream, LoadOptions.None)); } /// <summary> /// Loads a <see cref="ILicense"/> by using the specified <see cref="TextReader"/> /// that contains the XML. /// </summary> /// <param name="reader">A <see cref="TextReader"/> that contains the XML.</param> /// <returns>A <see cref="ILicense"/> populated from the <see cref="TextReader"/> that contains XML.</returns> public static ILicense Load(TextReader reader) { return License.Load(XElement.Load(reader, LoadOptions.None)); } /// <summary> /// Loads a <see cref="ILicense"/> by using the specified <see cref="XmlReader"/> /// that contains the XML. /// </summary> /// <param name="reader">A <see cref="XmlReader"/> that contains the XML.</param> /// <returns>A <see cref="ILicense"/> populated from the <see cref="TextReader"/> that contains XML.</returns> public static ILicense Load(XmlReader reader) { return License.Load(XElement.Load(reader, LoadOptions.None)); } } }
// // Copyright © 2012 - 2013 Nauck IT KG http://www.nauck-it.de // // Author: // Daniel Nauck <d.nauck(at)nauck-it.de> // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using Portable.Licensing.Model; namespace Portable.Licensing { /// <summary> /// Static factory class to create new <see cref="ILicense"/>. /// </summary> public static class LicenseFactory { /// <summary> /// Create a new <see cref="ILicense"/> using the <see cref="ILicenseBuilder"/> /// fluent api. /// </summary> /// <returns>An instance of the <see cref="ILicenseBuilder"/> class.</returns> public static ILicenseBuilder New() { return new LicenseBuilder(); } } }
mit
C#
50e741ea0b59cc94d6e43d4939676906576718a2
Use SequenceEqual instead of operator== for comparison of arrays in 'Can_perform_query_with_max_length' test
azabluda/InfoCarrier.Core
test/InfoCarrier.Core.EFCore.FunctionalTests/BuiltInDataTypesInfoCarrierTest.cs
test/InfoCarrier.Core.EFCore.FunctionalTests/BuiltInDataTypesInfoCarrierTest.cs
namespace InfoCarrier.Core.EFCore.FunctionalTests { using System.Linq; using Microsoft.EntityFrameworkCore.Specification.Tests; using Xunit; public class BuiltInDataTypesInfoCarrierTest : BuiltInDataTypesTestBase<BuiltInDataTypesInfoCarrierFixture> { public BuiltInDataTypesInfoCarrierTest(BuiltInDataTypesInfoCarrierFixture fixture) : base(fixture) { } [Fact] public virtual void Can_perform_query_with_ansi_strings() { this.Can_perform_query_with_ansi_strings(supportsAnsi: false); } [Fact] public override void Can_perform_query_with_max_length() { // UGLY: this is a complete copy-n-paste of // https://github.com/aspnet/EntityFramework/blob/rel/1.1.0/src/Microsoft.EntityFrameworkCore.Specification.Tests/BuiltInDataTypesTestBase.cs#L25 // We only use SequenceEqual instead of operator== for comparison of arrays. var shortString = "Sky"; var shortBinary = new byte[] { 8, 8, 7, 8, 7 }; var longString = new string('X', 9000); var longBinary = new byte[9000]; for (var i = 0; i < longBinary.Length; i++) { longBinary[i] = (byte)i; } using (var context = this.CreateContext()) { context.Set<MaxLengthDataTypes>().Add( new MaxLengthDataTypes { Id = 799, String3 = shortString, ByteArray5 = shortBinary, String9000 = longString, ByteArray9000 = longBinary }); Assert.Equal(1, context.SaveChanges()); } using (var context = this.CreateContext()) { Assert.NotNull(context.Set<MaxLengthDataTypes>().SingleOrDefault(e => e.Id == 799 && e.String3 == shortString)); Assert.NotNull(context.Set<MaxLengthDataTypes>().SingleOrDefault(e => e.Id == 799 && e.ByteArray5.SequenceEqual(shortBinary))); Assert.NotNull(context.Set<MaxLengthDataTypes>().SingleOrDefault(e => e.Id == 799 && e.String9000 == longString)); Assert.NotNull(context.Set<MaxLengthDataTypes>().SingleOrDefault(e => e.Id == 799 && e.ByteArray9000.SequenceEqual(longBinary))); } } } }
namespace InfoCarrier.Core.EFCore.FunctionalTests { using Microsoft.EntityFrameworkCore.Specification.Tests; using Xunit; public class BuiltInDataTypesInfoCarrierTest : BuiltInDataTypesTestBase<BuiltInDataTypesInfoCarrierFixture> { public BuiltInDataTypesInfoCarrierTest(BuiltInDataTypesInfoCarrierFixture fixture) : base(fixture) { } [Fact] public virtual void Can_perform_query_with_ansi_strings() { this.Can_perform_query_with_ansi_strings(supportsAnsi: false); } } }
mit
C#
5fd565585d85261888dc8e975fb3230bcecf2485
Fix !gid command helptext
VoiDeD/steam-irc-bot
SteamIrcBot/IRC/Commands/GID.cs
SteamIrcBot/IRC/Commands/GID.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using SteamKit2; namespace SteamIrcBot { class GIDCommand : Command { public GIDCommand() { Triggers.Add( "!gid" ); Triggers.Add( "!globalid" ); HelpText = "!gid - decompose a Steam GID_t"; } protected override void OnRun( CommandDetails details ) { if ( details.Args.Length == 0 ) { IRC.Instance.Send( details.Channel, "{0}: GID argument required", details.Sender.Nickname ); return; } var inputGid = details.Args[ 0 ]; ulong ulGid; if ( !ulong.TryParse( inputGid, out ulGid ) ) { IRC.Instance.Send( details.Channel, "{0}: Invalid GID", details.Sender.Nickname ); return; } GlobalID gid = ulGid; IRC.Instance.Send( details.Channel, "{0}: {1}", details.Sender.Nickname, SteamUtils.ExpandGID( gid ) ); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using SteamKit2; namespace SteamIrcBot { class GIDCommand : Command { public GIDCommand() { Triggers.Add( "!gid" ); Triggers.Add( "!globalid" ); HelpText = "!gid - decompose a Steam GID_t"; } protected override void OnRun( CommandDetails details ) { if ( details.Args.Length == 0 ) { IRC.Instance.Send( details.Channel, "{0}: SteamID argument required", details.Sender.Nickname ); return; } var inputGid = details.Args[ 0 ]; ulong ulGid; if ( !ulong.TryParse( inputGid, out ulGid ) ) { IRC.Instance.Send( details.Channel, "{0}: Invalid GID", details.Sender.Nickname ); return; } GlobalID gid = ulGid; IRC.Instance.Send( details.Channel, "{0}: {1}", details.Sender.Nickname, SteamUtils.ExpandGID( gid ) ); } } }
mit
C#
508bf59898fad1c8d930a2d65d1c9c04bf2b5b7d
Revert last commit
jdno/AIChallengeFramework
IO/Logger.cs
IO/Logger.cs
// // Copyright 2014 jdno // // 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; namespace AIChallengeFramework { /// <summary> /// This is a small logging facility that can be used for troubleshooting. /// </summary> public static class Logger { /// <summary> /// These are the log level supported by this project. /// </summary> public enum Severity { OFF = 0, ERROR = 1, INFO = 2, DEBUG = 3 } /// <summary> /// Choose the severity you would like to have logged. /// </summary> public static Severity LogLevel { get; private set; } /// <summary> /// Initialize this instance. /// </summary> public static void Initialize () { LogLevel = Severity.ERROR; } /// <summary> /// Efficiently check if the log level is DEBUG. /// </summary> /// <returns><c>true</c> if is DEBUG; otherwise, <c>false</c>.</returns> public static bool IsDebug () { if (LogLevel == Severity.DEBUG) { return true; } else { return false; } } /// <summary> /// Log the message only if the log level is error. /// </summary> /// <param name="message">Message.</param> public static void Error (string message) { if (LogLevel >= Severity.ERROR) print (message); } /// <summary> /// Log the message only if the log level is info or error. /// </summary> /// <param name="message">Message.</param> public static void Info (string message) { if (LogLevel >= Severity.INFO) print (message); } /// <summary> /// Log the message only if the log level is debug, info or error. /// </summary> /// <param name="message">Message.</param> public static void Debug (string message) { if (LogLevel >= Severity.DEBUG) print (message); } /// <summary> /// Print the specified message. /// </summary> /// <param name="message">Message.</param> private static void print (string message) { Console.Error.WriteLine (message); } } }
// // Copyright 2014 jdno // // 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; namespace AIChallengeFramework { /// <summary> /// This is a small logging facility that can be used for troubleshooting. /// </summary> public static class Logger { /// <summary> /// These are the log level supported by this project. /// </summary> public enum Severity { OFF = 0, ERROR = 1, INFO = 2, DEBUG = 3 } /// <summary> /// Choose the severity you would like to have logged. /// </summary> public static Severity LogLevel { get; private set; } /// <summary> /// Initialize this instance. /// </summary> public static void Initialize () { LogLevel = Severity.ERROR; } /// <summary> /// Efficiently check if the log level is DEBUG. /// </summary> /// <returns><c>true</c> if is DEBUG; otherwise, <c>false</c>.</returns> public static bool IsDebug () { if (LogLevel == Severity.DEBUG) { return true; } else { return false; } } /// <summary> /// Log the message only if the log level is error. /// </summary> /// <param name="message">Message.</param> public static void Error (string message) { if (LogLevel <= Severity.ERROR) print (message); } /// <summary> /// Log the message only if the log level is info or error. /// </summary> /// <param name="message">Message.</param> public static void Info (string message) { if (LogLevel <= Severity.INFO) print (message); } /// <summary> /// Log the message only if the log level is debug, info or error. /// </summary> /// <param name="message">Message.</param> public static void Debug (string message) { if (LogLevel <= Severity.DEBUG) print (message); } /// <summary> /// Print the specified message. /// </summary> /// <param name="message">Message.</param> private static void print (string message) { Console.Error.WriteLine (message); } } }
apache-2.0
C#
764f86b1e04ed59b1bf948ec55cfc42a8922e301
fix cf
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Tor/Socks5/Models/Messages/TorSocks5Request.cs
WalletWasabi/Tor/Socks5/Models/Messages/TorSocks5Request.cs
using System; using WalletWasabi.Helpers; using WalletWasabi.Tor.Socks5.Models.Bases; using WalletWasabi.Tor.Socks5.Models.Fields.ByteArrayFields; using WalletWasabi.Tor.Socks5.Models.Fields.OctetFields; namespace WalletWasabi.Tor.Socks5.Models.Messages { public class TorSocks5Request : ByteArraySerializableBase { public TorSocks5Request(CmdField cmd, AddrField dstAddr, PortField dstPort) { Cmd = Guard.NotNull(nameof(cmd), cmd); DstAddr = Guard.NotNull(nameof(dstAddr), dstAddr); DstPort = Guard.NotNull(nameof(dstPort), dstPort); Ver = VerField.Socks5; Rsv = RsvField.X00; Atyp = dstAddr.Atyp; } public VerField Ver { get; } public CmdField Cmd { get; } public RsvField Rsv { get; } public AtypField Atyp { get; } public AddrField DstAddr { get; } public PortField DstPort { get; } public override byte[] ToBytes() => ByteHelpers.Combine( new byte[] { Ver.ToByte(), Cmd.ToByte(), Rsv.ToByte(), Atyp.ToByte() }, DstAddr.ToBytes(), DstPort.ToBytes()); } }
using System; using WalletWasabi.Helpers; using WalletWasabi.Tor.Socks5.Models.Bases; using WalletWasabi.Tor.Socks5.Models.Fields.ByteArrayFields; using WalletWasabi.Tor.Socks5.Models.Fields.OctetFields; namespace WalletWasabi.Tor.Socks5.Models.Messages { public class TorSocks5Request : ByteArraySerializableBase { public TorSocks5Request(CmdField cmd, AddrField dstAddr, PortField dstPort) { Cmd = Guard.NotNull(nameof(cmd), cmd); DstAddr = Guard.NotNull(nameof(dstAddr), dstAddr); DstPort = Guard.NotNull(nameof(dstPort), dstPort); Ver = VerField.Socks5; Rsv = RsvField.X00; Atyp = dstAddr.Atyp; } public VerField Ver { get; } public CmdField Cmd { get; } public RsvField Rsv { get; } public AtypField Atyp { get; } public AddrField DstAddr { get; } public PortField DstPort { get; } public override byte[] ToBytes() => ByteHelpers.Combine( new byte[] { Ver.ToByte(), Cmd.ToByte(), Rsv.ToByte(), Atyp.ToByte() } , DstAddr.ToBytes() , DstPort.ToBytes()); } }
mit
C#
f4092b816b299c6f8109bb6bd9704a79904655c9
Remove stub information from Error page
diolive/cache,diolive/cache
DioLive.Cache/src/DioLive.Cache.WebUI/Views/Shared/Error.cshtml
DioLive.Cache/src/DioLive.Cache.WebUI/Views/Shared/Error.cshtml
@{ ViewData["PageTitle"] = "Error"; } <h1 class="text-danger">Error.</h1> <h2 class="text-danger">An error occurred while processing your request.</h2>
@{ ViewData["PageTitle"] = "Error"; } <h1 class="text-danger">Error.</h1> <h2 class="text-danger">An error occurred while processing your request.</h2> <h3>Development Mode</h3> <p> Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred. </p> <p> <strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application. </p>
mit
C#
73d4290426016f6ef58fc59c9746e6953fcc25e6
fix bootstrap theme
g-stoyanov/InfinysBreakfastOrders,g-stoyanov/InfinysBreakfastOrders
Source/Web/InfinysBreakfastOrders.Web/App_Start/BundleConfig.cs
Source/Web/InfinysBreakfastOrders.Web/App_Start/BundleConfig.cs
using System.Web; using System.Web.Optimization; namespace InfinysBreakfastOrders.Web { public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.validate*")); bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( "~/Scripts/bootstrap.js", "~/Scripts/respond.js")); bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap*", "~/Content/site.css")); } } }
using System.Web; using System.Web.Optimization; namespace InfinysBreakfastOrders.Web { public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.validate*")); bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( "~/Scripts/bootstrap.js", "~/Scripts/respond.js")); bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap.cerulean.css", "~/Content/site.css")); } } }
mit
C#
c23231b0787fe850aa68c74a25a431005796da6f
Update AttachmentType.cs
smartsheet-platform/smartsheet-csharp-sdk,smartsheet-platform/smartsheet-csharp-sdk
main/Smartsheet/Api/Models/AttachmentType.cs
main/Smartsheet/Api/Models/AttachmentType.cs
// #[license] // SmartsheetClient SDK for C# // %% // Copyright (C) 2014 SmartsheetClient // %% // 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. // %[license] namespace Smartsheet.Api.Models { /// <summary> /// Represents the Type of attachment. /// </summary> public enum AttachmentType { /// <summary> /// The file /// </summary> FILE, /// <summary> /// Google drive /// </summary> GOOGLE_DRIVE, /// <summary> /// The link /// </summary> LINK, /// <summary> /// BOX /// </summary> BOX_COM, /// <summary> /// Dropbox /// </summary> DROPBOX, /// <summary> /// Evernote /// </summary> EVERNOTE, /// <summary> /// Egnyte /// </summary> EGNYTE, /// <summary> /// OneDrive /// </summary> ONEDRIVE, /// <summary> /// Smartsheet /// </summary> SMARTSHEET } }
// #[license] // SmartsheetClient SDK for C# // %% // Copyright (C) 2014 SmartsheetClient // %% // 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. // %[license] namespace Smartsheet.Api.Models { /// <summary> /// Represents the Type of attachment. /// </summary> public enum AttachmentType { /// <summary> /// The file /// </summary> FILE, /// <summary> /// Google drive /// </summary> GOOGLE_DRIVE, /// <summary> /// The link /// </summary> LINK, /// <summary> /// BOX /// </summary> BOX_COM, /// <summary> /// Dropbox /// </summary> DROPBOX, /// <summary> /// Evernote /// </summary> EVERNOTE, /// <summary> /// Egnyte /// </summary> EGNYTE, /// <summary> /// OneDrive /// </summary> ONEDRIVE, /// <summary> /// Smartsheet /// </summary> SMARTSHEET } }
apache-2.0
C#
a10d5c2916c0133be2cda91943ce7b514799e382
Use lambda for osversion procedure
LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC
RestRPC.Service/Program.cs
RestRPC.Service/Program.cs
using CommandLine; using System; using System.IO; using System.Threading; using RestRPC.Framework; using RestRPC.Framework.Plugins; using RestRPC.Service.Plugins; namespace RestRPC.Service { class Program { static RestRPCComponent wshComponent; static void Main(string[] args) { string componentName = Guid.NewGuid().ToString(); Uri remoteUri; var options = new CommandLineOptions(); if (Parser.Default.ParseArguments(args, options)) { if (!string.IsNullOrWhiteSpace(options.Name)) componentName = options.Name; remoteUri = new Uri(options.ServerUriString); } else { return; } wshComponent = new RestRPCComponent(componentName, remoteUri, TimeSpan.FromMilliseconds(30), options.Username, options.Password, Console.Out, LogType.All); // Register custom plugins and procedures wshComponent.PluginManager.RegisterPlugin("print", new PrintToScreen()); wshComponent.PluginManager.RegisterProcedure("osversion", (inputArgs) => { return Environment.OSVersion.VersionString; }); // Load plugins in plugins directory if dir exists if (Directory.Exists("plugins")) { var plugins = PluginLoader.LoadAllPluginsFromDir("plugins", "*.dll"); foreach (var plug in plugins) { wshComponent.PluginManager.RegisterPlugin(plug.GetType().FullName, plug); } } // Start WSH component wshComponent.Start(); // TODO: Use a timer instead of Sleep while (true) { wshComponent.Update(); Thread.Sleep(100); } } } }
using CommandLine; using System; using System.IO; using System.Threading; using RestRPC.Framework; using RestRPC.Framework.Plugins; using RestRPC.Service.Plugins; namespace RestRPC.Service { class Program { static RestRPCComponent wshComponent; static void Main(string[] args) { string componentName = Guid.NewGuid().ToString(); Uri remoteUri; var options = new CommandLineOptions(); if (Parser.Default.ParseArguments(args, options)) { if (!string.IsNullOrWhiteSpace(options.Name)) componentName = options.Name; remoteUri = new Uri(options.ServerUriString); } else { return; } wshComponent = new RestRPCComponent(componentName, remoteUri, TimeSpan.FromMilliseconds(30), options.Username, options.Password, Console.Out, LogType.All); // Register custom plugins and procedures wshComponent.PluginManager.RegisterPlugin("print", new PrintToScreen()); wshComponent.PluginManager.RegisterProcedure("osversion", OSVersionProcedure); // Load plugins in plugins directory if dir exists if (Directory.Exists("plugins")) { var plugins = PluginLoader.LoadAllPluginsFromDir("plugins", "*.dll"); foreach (var plug in plugins) { wshComponent.PluginManager.RegisterPlugin(plug.GetType().FullName, plug); } } // Start WSH component wshComponent.Start(); // TODO: Use a timer instead of Sleep while (true) { wshComponent.Update(); Thread.Sleep(100); } } static object OSVersionProcedure(object[] args) { return Environment.OSVersion.VersionString; } } }
mit
C#
11ebe62c03b11832e596dc44a66388f3beddf675
Fix tests.
AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia
tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_Method.cs
tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_Method.cs
using Avalonia.Data; using Avalonia.Data.Core; using Avalonia.Markup.Parsers; using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace Avalonia.Markup.UnitTests.Parsers { public class ExpressionObserverBuilderTests_Method { private class TestObject { public void MethodWithoutReturn() { } public int MethodWithReturn() => 0; public int MethodWithReturnAndParameter(object i) => (int)i; public static void StaticMethod() { } } [Fact] public async Task Should_Get_Method() { var data = new TestObject(); var observer = ExpressionObserverBuilder.Build(data, nameof(TestObject.MethodWithoutReturn)); var result = await observer.Take(1); Assert.NotNull(result); GC.KeepAlive(data); } [Theory] [InlineData(nameof(TestObject.MethodWithoutReturn), typeof(Action))] [InlineData(nameof(TestObject.MethodWithReturn), typeof(Func<int>))] [InlineData(nameof(TestObject.MethodWithReturnAndParameter), typeof(Func<object, int>))] [InlineData(nameof(TestObject.StaticMethod), typeof(Action))] public async Task Should_Get_Method_WithCorrectDelegateType(string methodName, Type expectedType) { var data = new TestObject(); var observer = ExpressionObserverBuilder.Build(data, methodName); var result = await observer.Take(1); Assert.IsType(expectedType, result); GC.KeepAlive(data); } [Fact] public async Task Can_Call_Method_Returned_From_Observer() { var data = new TestObject(); var observer = ExpressionObserverBuilder.Build(data, nameof(TestObject.MethodWithReturnAndParameter)); var result = await observer.Take(1); var callback = (Func<object, int>)result; Assert.Equal(1, callback(1)); GC.KeepAlive(data); } } }
using Avalonia.Data; using Avalonia.Data.Core; using Avalonia.Markup.Parsers; using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace Avalonia.Markup.UnitTests.Parsers { public class ExpressionObserverBuilderTests_Method { private class TestObject { public void MethodWithoutReturn() { } public int MethodWithReturn() => 0; public int MethodWithReturnAndParameters(int i) => i; public static void StaticMethod() { } public static void ManyParameters(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) { } public static int ManyParametersWithReturnType(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) => 1; } [Fact] public async Task Should_Get_Method() { var data = new TestObject(); var observer = ExpressionObserverBuilder.Build(data, nameof(TestObject.MethodWithoutReturn)); var result = await observer.Take(1); Assert.NotNull(result); GC.KeepAlive(data); } [Theory] [InlineData(nameof(TestObject.MethodWithoutReturn), typeof(Action))] [InlineData(nameof(TestObject.MethodWithReturn), typeof(Func<int>))] [InlineData(nameof(TestObject.MethodWithReturnAndParameters), typeof(Func<int, int>))] [InlineData(nameof(TestObject.StaticMethod), typeof(Action))] [InlineData(nameof(TestObject.ManyParameters), typeof(Action<int, int, int, int, int, int, int, int, int>))] [InlineData(nameof(TestObject.ManyParametersWithReturnType), typeof(Func<int, int, int, int, int, int, int, int, int>))] public async Task Should_Get_Method_WithCorrectDelegateType(string methodName, Type expectedType) { var data = new TestObject(); var observer = ExpressionObserverBuilder.Build(data, methodName); var result = await observer.Take(1); Assert.IsType(expectedType, result); GC.KeepAlive(data); } [Fact] public async Task Can_Call_Method_Returned_From_Observer() { var data = new TestObject(); var observer = ExpressionObserverBuilder.Build(data, nameof(TestObject.MethodWithReturnAndParameters)); var result = await observer.Take(1); var callback = (Func<int, int>)result; Assert.Equal(1, callback(1)); GC.KeepAlive(data); } } }
mit
C#
bf5b1d4d3485059f38c91710d9f7cc949a1adbb4
Update version for next release.
Thraka/SadConsole
SadConsole.Platforms/SadConsole.Platforms.Windows.Core/Properties/AssemblyInfo.cs
SadConsole.Platforms/SadConsole.Platforms.Windows.Core/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SadConsole.Core")] [assembly: AssemblyDescription("A MonoGame library that emulates old-school console and command prompt style graphics.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("SadLogic")] [assembly: AssemblyProduct("SadConsole.Core")] [assembly: AssemblyCopyright("Copyright © 2015 Steve De George JR (Thraka)")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9e8424e8-efd3-4158-b49e-feccd7509a7f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.7.0.0")] [assembly: AssemblyFileVersion("2.7.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SadConsole.Core")] [assembly: AssemblyDescription("A MonoGame library that emulates old-school console and command prompt style graphics.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("SadLogic")] [assembly: AssemblyProduct("SadConsole.Core")] [assembly: AssemblyCopyright("Copyright © 2015 Steve De George JR (Thraka)")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9e8424e8-efd3-4158-b49e-feccd7509a7f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.6.0.0")] [assembly: AssemblyFileVersion("2.6.0.0")]
mit
C#
d5b8ccf222f8bfeb7c9d54a85c4e4f82f949421e
Return JSON object from Values controller
peterblazejewicz/ng-templates,peterblazejewicz/ng-templates,peterblazejewicz/ng-templates,peterblazejewicz/ng-templates
auth0/04-Calling-API/server/src/WebAPIApplication/Controllers/ValuesController.cs
auth0/04-Calling-API/server/src/WebAPIApplication/Controllers/ValuesController.cs
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace WebAPIApplication.Controllers { [Route("api/[controller]")] public class ValuesController : Controller { [HttpGet] [Route("ping")] public dynamic Ping() { return new { message = "All good. You don't need to be authenticated to call this." }; } [Authorize] [HttpGet] [Route("secured/ping")] public object PingSecured() { return new { message = "All good. You only get this message if you are authenticated." }; } } }
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace WebAPIApplication.Controllers { [Route("api/[controller]")] public class ValuesController : Controller { [HttpGet] [Route("ping")] public string Ping() { return "All good. You don't need to be authenticated to call this."; } [Authorize] [HttpGet] [Route("secured/ping")] public string PingSecured() { return "All good. You only get this message if you are authenticated."; } } }
unlicense
C#
4b5e4c1534709ecca542dbd72535a7f20c96ad6d
test 16;00
renyh1013/chord,DigitalPlatform/chord,renyh1013/chord,renyh1013/chord,DigitalPlatform/chord,DigitalPlatform/chord
dp2Tools/Program.cs
dp2Tools/Program.cs
// 20180514 test2 //test juan //test juan 20180414 //test juan 20180414 16 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace dp2Tools { static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() //test { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form_main()); } } }
// 20180514 test2 //test juan //test juan 20180414 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace dp2Tools { static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() //test { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form_main()); } } }
apache-2.0
C#
bee34cc0ffca46d1d9432a38823502f2c1ac5a07
remove redundant word 'create'
svick/cli,dasMulli/cli,dasMulli/cli,blackdwarf/cli,blackdwarf/cli,EdwardBlair/cli,blackdwarf/cli,svick/cli,ravimeda/cli,EdwardBlair/cli,livarcocc/cli-1,Faizan2304/cli,johnbeisner/cli,johnbeisner/cli,dasMulli/cli,EdwardBlair/cli,harshjain2/cli,livarcocc/cli-1,Faizan2304/cli,johnbeisner/cli,livarcocc/cli-1,svick/cli,Faizan2304/cli,ravimeda/cli,harshjain2/cli,ravimeda/cli,blackdwarf/cli,harshjain2/cli
src/Microsoft.DotNet.Configurer/LocalizableStrings.cs
src/Microsoft.DotNet.Configurer/LocalizableStrings.cs
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DotNet.Configurer { internal class LocalizableStrings { public const string FirstTimeWelcomeMessage = @"Welcome to .NET Core! --------------------- Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. Telemetry -------------- The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry. Configuring... ------------------- A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once."; public const string FailedToPrimeCacheError = "Failed to prime the NuGet cache. {0} failed with: {1}"; } }
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DotNet.Configurer { internal class LocalizableStrings { public const string FirstTimeWelcomeMessage = @"Welcome to .NET Core! --------------------- Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. Telemetry -------------- The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry. Configuring... ------------------- A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once."; public const string FailedToPrimeCacheError = "Failed to create prime the NuGet cache. {0} failed with: {1}"; } }
mit
C#
3634f61f195cb48e6b68665471bf07bfea986c90
Bump version.
yojimbo87/ArangoDB-NET,kangkot/ArangoDB-NET
src/Arango/Arango.Client/API/ArangoClient.cs
src/Arango/Arango.Client/API/ArangoClient.cs
using System.Collections.Generic; using System.Linq; using Arango.Client.Protocol; namespace Arango.Client { public static class ArangoClient { private static List<Connection> _connections = new List<Connection>(); public static string DriverName { get { return "ArangoDB-NET"; } } public static string DriverVersion { get { return "0.6.1"; } } public static ArangoSettings Settings { get; set; } static ArangoClient() { Settings = new ArangoSettings(); } public static void AddDatabase(string hostname, int port, bool isSecured, string userName, string password, string alias) { var connection = new Connection(hostname, port, isSecured, userName, password, alias); _connections.Add(connection); } internal static Connection GetConnection(string alias) { return _connections.Where(connection => connection.Alias == alias).FirstOrDefault(); } } }
using System.Collections.Generic; using System.Linq; using Arango.Client.Protocol; namespace Arango.Client { public static class ArangoClient { private static List<Connection> _connections = new List<Connection>(); public static string DriverName { get { return "ArangoDB-NET"; } } public static string DriverVersion { get { return "0.6.0"; } } public static ArangoSettings Settings { get; set; } static ArangoClient() { Settings = new ArangoSettings(); } public static void AddDatabase(string hostname, int port, bool isSecured, string userName, string password, string alias) { var connection = new Connection(hostname, port, isSecured, userName, password, alias); _connections.Add(connection); } internal static Connection GetConnection(string alias) { return _connections.Where(connection => connection.Alias == alias).FirstOrDefault(); } } }
mit
C#
e3bb2763b110eb7119b419574136ac3fc90f6454
Add ArgumentNullException to WindowsSymlinkFactory
tgstation/tgstation-server-tools,Cyberboss/tgstation-server,tgstation/tgstation-server,tgstation/tgstation-server,Cyberboss/tgstation-server
src/Tgstation.Server.Host/IO/WindowsSymlinkFactory.cs
src/Tgstation.Server.Host/IO/WindowsSymlinkFactory.cs
using System; using System.ComponentModel; using System.IO; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; namespace Tgstation.Server.Host.IO { /// <summary> /// <see cref="ISymlinkFactory"/> for windows systems /// </summary> sealed class WindowsSymlinkFactory : ISymlinkFactory { /// <inheritdoc /> public Task CreateSymbolicLink(string targetPath, string linkPath, CancellationToken cancellationToken) => Task.Factory.StartNew(() => { if (targetPath == null) throw new ArgumentNullException(nameof(targetPath)); if (linkPath == null) throw new ArgumentNullException(nameof(linkPath)); //check if its not a file var flags = File.Exists(targetPath) ? 0 : 3; //SYMBOLIC_LINK_FLAG_DIRECTORY | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE on win10 1607+ developer mode cancellationToken.ThrowIfCancellationRequested(); if (!NativeMethods.CreateSymbolicLink(linkPath, targetPath, flags)) throw new Win32Exception(Marshal.GetLastWin32Error()); }, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current); } }
using System.ComponentModel; using System.IO; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; namespace Tgstation.Server.Host.IO { /// <summary> /// <see cref="ISymlinkFactory"/> for windows systems /// </summary> sealed class WindowsSymlinkFactory : ISymlinkFactory { /// <inheritdoc /> public Task CreateSymbolicLink(string targetPath, string linkPath, CancellationToken cancellationToken) => Task.Factory.StartNew(() => { //check if its not a file var flags = File.Exists(targetPath) ? 0 : 3; //SYMBOLIC_LINK_FLAG_DIRECTORY | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE on win10 1607+ developer mode cancellationToken.ThrowIfCancellationRequested(); if (!NativeMethods.CreateSymbolicLink(linkPath, targetPath, flags)) throw new Win32Exception(Marshal.GetLastWin32Error()); }, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current); } }
agpl-3.0
C#
475fa3e2c59212cad32136e2b945bd95c95ffe59
Put back Live JanRain URL
NancyFx/DinnerParty,prabirshrestha/DinnerParty,denkhaus/DinnerParty,jchannon/DinnerParty,NancyFx/DinnerParty,davidebbo/DinnerParty,denkhaus/DinnerParty,davidebbo/DinnerParty,prabirshrestha/DinnerParty,jchannon/DinnerParty
Views/Account/LogOn.cshtml
Views/Account/LogOn.cshtml
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic> @{ Layout = "_Layout.cshtml"; } <h2>@Model.Page.Title</h2> @section HeadArea { <script type="text/javascript"> (function () { if (typeof window.janrain !== 'object') window.janrain = {}; if (typeof window.janrain.settings !== 'object') window.janrain.settings = {}; janrain.settings.tokenUrl = 'http://dinnerparty.azurewebsites.net/account/token'; function isReady() { janrain.ready = true; }; if (document.addEventListener) { document.addEventListener("DOMContentLoaded", isReady, false); } else { window.attachEvent('onload', isReady); } var e = document.createElement('script'); e.type = 'text/javascript'; e.id = 'janrainAuthWidget'; if (document.location.protocol === 'https:') { e.src = 'https://rpxnow.com/js/lib/dinnerparty/engage.js'; } else { e.src = 'http://widget-cdn.rpxnow.com/js/lib/dinnerparty/engage.js'; } var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s); })(); </script> } <div id="login"> <div id="janrainEngageEmbed" class="login-oauth"></div> <div id="or"> <p>OR</p> </div> @Html.Partial("_LogonNative", Model) </div>
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic> @{ Layout = "_Layout.cshtml"; } <h2>@Model.Page.Title</h2> @section HeadArea { <script type="text/javascript"> (function () { if (typeof window.janrain !== 'object') window.janrain = {}; if (typeof window.janrain.settings !== 'object') window.janrain.settings = {}; janrain.settings.tokenUrl = 'http://localhost:63155/account/token'; function isReady() { janrain.ready = true; }; if (document.addEventListener) { document.addEventListener("DOMContentLoaded", isReady, false); } else { window.attachEvent('onload', isReady); } var e = document.createElement('script'); e.type = 'text/javascript'; e.id = 'janrainAuthWidget'; if (document.location.protocol === 'https:') { e.src = 'https://rpxnow.com/js/lib/dinnerparty/engage.js'; } else { e.src = 'http://widget-cdn.rpxnow.com/js/lib/dinnerparty/engage.js'; } var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s); })(); </script> } <div id="login"> <div id="janrainEngageEmbed" class="login-oauth"></div> <div id="or"> <p>OR</p> </div> @Html.Partial("_LogonNative", Model) </div>
mit
C#
234224e8d93a6c9ebc7e4532206d79677db2de6c
Make sure a capture will not leave the TemplateContext in an unbalanced state if an exception occurs
lunet-io/scriban,textamina/scriban
src/Scriban/Syntax/ScriptCaptureStatement.cs
src/Scriban/Syntax/ScriptCaptureStatement.cs
// Copyright (c) Alexandre Mutel. All rights reserved. // Licensed under the BSD-Clause 2 license. // See license.txt file in the project root for full license information. using Scriban.Runtime; namespace Scriban.Syntax { [ScriptSyntax("capture statement", "capture <variable> ... end")] public class ScriptCaptureStatement : ScriptStatement { public ScriptExpression Target { get; set; } public ScriptBlockStatement Body { get; set; } public override object Evaluate(TemplateContext context) { // unit test: 230-capture-statement.txt context.PushOutput(); try { context.Evaluate(Body); } finally { var result = context.PopOutput(); context.SetValue(Target, result); } return null; } } }
// Copyright (c) Alexandre Mutel. All rights reserved. // Licensed under the BSD-Clause 2 license. // See license.txt file in the project root for full license information. using Scriban.Runtime; namespace Scriban.Syntax { [ScriptSyntax("capture statement", "capture <variable> ... end")] public class ScriptCaptureStatement : ScriptStatement { public ScriptExpression Target { get; set; } public ScriptBlockStatement Body { get; set; } public override object Evaluate(TemplateContext context) { // unit test: 230-capture-statement.txt context.PushOutput(); { context.Evaluate(Body); } var result = context.PopOutput(); context.SetValue(Target, result); return null; } } }
bsd-2-clause
C#
fa1f7d8f257ae2c5baf2f99933f188926f9c5565
fix bug in cosine func
dzibma/FuzzyMath
FuzzyMath/Functions/cos.cs
FuzzyMath/Functions/cos.cs
using System; namespace FuzzyMath { public static partial class Functions { /// <summary> /// Calculates cosine of the fuzzy number /// </summary> /// <param name="X">Fuzzy angle in radians</param> public static FuzzyNumber Cos(FuzzyNumber X) { return FuzzyNumber.Map(X, x => Cos(x)); } public static Interval Cos(Interval x) { double a, b, extreme; extreme = Math.Floor(x.A / Math.PI) * Math.PI; if (x.Contains(extreme)) { a = Math.Cos(extreme); } else { extreme += Math.PI; if (x.Contains(extreme)) { a = Math.Cos(extreme); } else { a = Math.Cos(x.A); b = Math.Cos(x.B); return b > a ? new Interval(a, b) : new Interval(b, a); } } extreme += Math.PI; if (x.Contains(extreme)) { b = Math.Cos(extreme); } else { b = a > 0 ? Math.Min(Math.Cos(x.A), Math.Cos(x.B)) : Math.Max(Math.Cos(x.A), Math.Cos(x.B)); } return b > a ? new Interval(a, b) : new Interval(b, a); } } }
using System; namespace FuzzyMath { public static partial class Functions { /// <summary> /// Calculates cosine of the fuzzy number /// </summary> /// <param name="X">Fuzzy angle in radians</param> public static FuzzyNumber Cos(FuzzyNumber X) { return FuzzyNumber.Map(X, x => Cos(x)); } public static Interval Cos(Interval x) { double a, b, extreme; extreme = Math.Floor(x.A / Math.PI) * Math.PI; if (x.Contains(extreme)) { a = Math.Cos(extreme); } else { extreme += Math.PI; if (x.Contains(extreme)) { a = Math.Cos(extreme); } else { a = Math.Cos(x.A); b = Math.Cos(x.B); return b > a ? new Interval(a, b) : new Interval(b, a); } } extreme += Math.PI; if (x.Contains(extreme)) { b = Math.Sin(extreme); } else { b = a > 0 ? Math.Min(Math.Cos(x.A), Math.Cos(x.B)) : Math.Max(Math.Cos(x.A), Math.Cos(x.B)); } return b > a ? new Interval(a, b) : new Interval(b, a); } } }
mit
C#
83397d962d8e4d3f6c55a90590df564dc6952171
Increment version
muntashir/Pingo
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Pingo")] [assembly: AssemblyDescription("A tool that shows the status of computers connected to the network through pings.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("github.com/muntashir")] [assembly: AssemblyProduct("Pingo")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.2")] [assembly: AssemblyFileVersion("1.0.2")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Pingo")] [assembly: AssemblyDescription("A tool that shows the status of computers connected to the network through pings.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("github.com/muntashir")] [assembly: AssemblyProduct("Pingo")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.1")] [assembly: AssemblyFileVersion("1.0.1")]
mit
C#
7a9fe3554d13c42c5e48b320c7c04cc7228c3d92
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
jango2015/Autofac.Configuration,autofac/Autofac.Configuration
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("Autofac.Tests.Configuration")]
using System.Reflection; [assembly: AssemblyTitle("Autofac.Tests.Configuration")] [assembly: AssemblyDescription("")]
mit
C#
b6294b1912f6a5aa14be691e6d0b3c82966f5beb
Bump version
nixxquality/WebMConverter,Yuisbean/WebMConverter,o11c/WebMConverter
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("WebM for Retards")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WebM for Retards")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.7.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("WebM for Retards")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WebM for Retards")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.6.2")]
mit
C#
f5900c30be7db6a6b80b0eb1ffad603992e01703
Update version to 1.2.1
dylanmei/linqpad-soap-driver,dylanmei/linqpad-soap-driver
Driver/Properties/AssemblyInfo.cs
Driver/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SoapDriver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SoapDriver")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("01f8aabf-86e2-4f7d-b48f-8e030230e240")] // 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.2.1")] [assembly: AssemblyFileVersion("1.2.1")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SoapDriver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SoapDriver")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("01f8aabf-86e2-4f7d-b48f-8e030230e240")] // 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.2")] [assembly: AssemblyFileVersion("1.2")]
mit
C#
e41f4232dfe089d41c768cf68394a561b0c94594
fix guild members tracking
Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns
TCC.Core/Data/GuildInfo.cs
TCC.Core/Data/GuildInfo.cs
using System.Collections.Generic; using System.Linq; using FoglioUtils; using TeraDataLite; namespace TCC.Data { public class GuildInfo { public bool InGuild { get; private set; } public GuildMemberData Master { get; private set; } public TSObservableCollection<GuildMemberData> Members { get; private set; } = new TSObservableCollection<GuildMemberData>(); public bool AmIMaster { get; private set; } public string NameOf(uint id) { var found = Members.ToSyncList().FirstOrDefault(m => m.PlayerId == id); return found.Name != "" ? found.Name : "Unknown player"; } public void Set(List<GuildMemberData> mMembers, uint masterId, string masterName) { mMembers.ForEach(m => { if (Has(m.Name)) return; Members.Add(m); }); //var toRemove = new List<GuildMemberData>(); //Members.ToSyncList().ForEach(m => //{ // if (mMembers.All(f => f.PlayerId != m.PlayerId)) toRemove.Add(m); //}); //toRemove.ForEach(m => Members.Remove(m)); InGuild = true; SetMaster(masterId, masterName); } public bool Has(string name) { return Members.ToSyncList().Any(m => m.Name == name); } public void Clear() { Members.Clear(); InGuild = false; Master = default; AmIMaster = false; } public void SetMaster(uint playerId, string playerName) { Master = new GuildMemberData { Name = playerName, PlayerId = playerId }; AmIMaster = Master.Name == Game.Me.Name; } } }
using System.Collections.Generic; using System.Linq; using FoglioUtils; using TeraDataLite; namespace TCC.Data { public class GuildInfo { public bool InGuild { get; private set; } public GuildMemberData Master { get; private set; } public TSObservableCollection<GuildMemberData> Members { get; private set; } = new TSObservableCollection<GuildMemberData>(); public bool AmIMaster { get; private set; } public string NameOf(uint id) { var found = Members.ToSyncList().FirstOrDefault(m => m.PlayerId == id); return found.Name != "" ? found.Name : "Unknown player"; } public void Set(List<GuildMemberData> mMembers, uint masterId, string masterName) { mMembers.ForEach(m => { if (Has(m.Name)) return; Members.Add(m); }); var toRemove = new List<GuildMemberData>(); Members.ToSyncList().ForEach(m => { if (mMembers.All(f => f.PlayerId != m.PlayerId)) toRemove.Add(m); }); toRemove.ForEach(m => Members.Remove(m)); InGuild = true; SetMaster(masterId, masterName); } public bool Has(string name) { return Members.ToSyncList().Any(m => m.Name == name); } public void Clear() { Members.Clear(); InGuild = false; Master = default; AmIMaster = false; } public void SetMaster(uint playerId, string playerName) { Master = new GuildMemberData { Name = playerName, PlayerId = playerId }; AmIMaster = Master.Name == Game.Me.Name; } } }
mit
C#
47ccf1a8df911bd2fbac458b4354a85654cac98d
update sections add 2 organism
lonelu/MetaMorpheus
Test/XLSearchOutputTest.cs
Test/XLSearchOutputTest.cs
using NUnit.Framework; using System.Collections.Generic; using System.IO; using TaskLayer; using EngineLayer; namespace Test { [TestFixture] public static class XLSearchOutputTest { [Test] public static void WriteTsvTest() { string outputFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, @"XlOutputTestFile"); string myFile = Path.Combine(TestContext.CurrentContext.TestDirectory, @"XlTestData\2017-11-21_XL_DSSO_Ribosome_RT60min_28800-28898.mzML"); string myDatabase = Path.Combine(TestContext.CurrentContext.TestDirectory, @"XlTestData\RibosomeGO.fasta"); Directory.CreateDirectory(outputFolder); XLSearchTask xLSearch = new XLSearchTask(); xLSearch.XlSearchParameters.CrosslinkAtCleavageSite = true; xLSearch.RunTask(outputFolder, new List<DbForTask> { new DbForTask(myDatabase, false) }, new List<string> { myFile }, "test"); var resultsPath = File.ReadAllLines(Path.Combine(outputFolder, @"XL_Intralinks.tsv")); var sections = resultsPath[1].Split('\t'); Assert.That(resultsPath.Length > 1); Assert.That(sections.Length == 49); var resultsPath_Inter = File.ReadAllLines(Path.Combine(outputFolder, @"XL_Interlinks.tsv")); Assert.That(resultsPath_Inter.Length > 1); var resultsPath_Deadend = File.ReadAllLines(Path.Combine(outputFolder, @"Deadends.tsv")); Assert.That(resultsPath_Deadend.Length >1); var resultsPath_loop = File.ReadAllLines(Path.Combine(outputFolder, @"Looplinks.tsv")); Assert.That(resultsPath_loop.Length >1); var resultsPath_single = File.ReadAllLines(Path.Combine(outputFolder, @"SinglePeptides.tsv")); Assert.That(resultsPath_single.Length >1); Directory.Delete(outputFolder, true); } } }
using NUnit.Framework; using System.Collections.Generic; using System.IO; using TaskLayer; using EngineLayer; namespace Test { [TestFixture] public static class XLSearchOutputTest { [Test] public static void WriteTsvTest() { string outputFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, @"XlOutputTestFile"); string myFile = Path.Combine(TestContext.CurrentContext.TestDirectory, @"XlTestData\2017-11-21_XL_DSSO_Ribosome_RT60min_28800-28898.mzML"); string myDatabase = Path.Combine(TestContext.CurrentContext.TestDirectory, @"XlTestData\RibosomeGO.fasta"); Directory.CreateDirectory(outputFolder); XLSearchTask xLSearch = new XLSearchTask(); xLSearch.XlSearchParameters.CrosslinkAtCleavageSite = true; xLSearch.RunTask(outputFolder, new List<DbForTask> { new DbForTask(myDatabase, false) }, new List<string> { myFile }, "test"); var resultsPath = File.ReadAllLines(Path.Combine(outputFolder, @"XL_Intralinks.tsv")); var sections = resultsPath[1].Split('\t'); Assert.That(resultsPath.Length > 1); Assert.That(sections.Length == 47); var resultsPath_Inter = File.ReadAllLines(Path.Combine(outputFolder, @"XL_Interlinks.tsv")); Assert.That(resultsPath_Inter.Length > 1); var resultsPath_Deadend = File.ReadAllLines(Path.Combine(outputFolder, @"Deadends.tsv")); Assert.That(resultsPath_Deadend.Length >1); var resultsPath_loop = File.ReadAllLines(Path.Combine(outputFolder, @"Looplinks.tsv")); Assert.That(resultsPath_loop.Length >1); var resultsPath_single = File.ReadAllLines(Path.Combine(outputFolder, @"SinglePeptides.tsv")); Assert.That(resultsPath_single.Length >1); Directory.Delete(outputFolder, true); } } }
mit
C#
b0e613f7409b4b5e55c4c49032fa80f837400f1b
Remove unused import
MHeasell/Mappy,MHeasell/Mappy
Mappy/Models/IMainModel.cs
Mappy/Models/IMainModel.cs
namespace Mappy.Models { using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Drawing; using Mappy.Collections; using Mappy.Data; public interface IMainModel : INotifyPropertyChanged { event EventHandler<ListChangedEventArgs> TilesChanged; event EventHandler<GridEventArgs> BaseTileGraphicsChanged; event EventHandler<GridEventArgs> BaseTileHeightChanged; event EventHandler<FeatureInstanceEventArgs> FeatureInstanceChanged; event EventHandler<StartPositionChangedEventArgs> StartPositionChanged; int? SelectedTile { get; } int? SelectedStartPosition { get; } ObservableCollection<Guid> SelectedFeatures { get; } Rectangle BandboxRectangle { get; } IList<Positioned<IMapTile>> FloatingTiles { get; } IMapTile BaseTile { get; } int MapWidth { get; } int MapHeight { get; } int FeatureGridWidth { get; } int FeatureGridHeight { get; } int SeaLevel { get; } Point ViewportLocation { get; set; } FeatureInstance GetFeatureInstance(Guid id); IEnumerable<FeatureInstance> EnumerateFeatureInstances(); void DragDropStartPosition(int index, int x, int y); void DragDropTile(IMapTile tile, int x, int y); void DragDropFeature(string name, int x, int y); void StartBandbox(int x, int y); void GrowBandbox(int x, int y); void CommitBandbox(); void TranslateSelection(int x, int y); void FlushTranslation(); void ClearSelection(); void DeleteSelection(); Point? GetStartPosition(int index); void SelectTile(int index); void SelectFeature(Guid id); void SelectStartPosition(int index); } }
namespace Mappy.Models { using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Drawing; using Geometry; using Mappy.Collections; using Mappy.Data; public interface IMainModel : INotifyPropertyChanged { event EventHandler<ListChangedEventArgs> TilesChanged; event EventHandler<GridEventArgs> BaseTileGraphicsChanged; event EventHandler<GridEventArgs> BaseTileHeightChanged; event EventHandler<FeatureInstanceEventArgs> FeatureInstanceChanged; event EventHandler<StartPositionChangedEventArgs> StartPositionChanged; int? SelectedTile { get; } int? SelectedStartPosition { get; } ObservableCollection<Guid> SelectedFeatures { get; } Rectangle BandboxRectangle { get; } IList<Positioned<IMapTile>> FloatingTiles { get; } IMapTile BaseTile { get; } int MapWidth { get; } int MapHeight { get; } int FeatureGridWidth { get; } int FeatureGridHeight { get; } int SeaLevel { get; } Point ViewportLocation { get; set; } FeatureInstance GetFeatureInstance(Guid id); IEnumerable<FeatureInstance> EnumerateFeatureInstances(); void DragDropStartPosition(int index, int x, int y); void DragDropTile(IMapTile tile, int x, int y); void DragDropFeature(string name, int x, int y); void StartBandbox(int x, int y); void GrowBandbox(int x, int y); void CommitBandbox(); void TranslateSelection(int x, int y); void FlushTranslation(); void ClearSelection(); void DeleteSelection(); Point? GetStartPosition(int index); void SelectTile(int index); void SelectFeature(Guid id); void SelectStartPosition(int index); } }
mit
C#
3c19009759bc19fb90dc0af5b8a981d845537c33
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
dparra0007/Autofac.Mvc,autofac/Autofac.Mvc,jango2015/Autofac.Mvc
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("Autofac.Tests.Integration.Mvc")]
using System.Reflection; [assembly: AssemblyTitle("Autofac.Tests.Integration.Mvc")] [assembly: AssemblyDescription("")]
mit
C#
6565e8c2295535c0b5b359e19d3b6feb85c567a4
use dictionary first then check web
yasokada/unity-150825-TELChecker
Assets/CheckButtonControl.cs
Assets/CheckButtonControl.cs
using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Linq; // for Where using System.Collections.Generic; public class CheckButtonControl : MonoBehaviour { public Text resText; public const string kTitle = "<title>"; public InputField IFtelno; public InputField IFinfo; private Dictionary<string,string> telbook = new Dictionary<string, string>(); void Start() { IFtelno.text = "0729883121"; // TODO: remove } string getHospitalName(string txt, string telno) { string removed = txt.Substring (kTitle.Length, 30); // check with first 2 characters string lhs = removed.Substring (0, 2); string rhs = telno.Substring (0, 2); if (lhs.Equals (rhs)) { return "not registered"; } return removed; } string removeHyphen(string src) { var dst = new string (src.Where (c => !"-".Contains (c)).ToArray ()); return dst; } bool hasObtainedTelNo(string src) { if (src.ToLower ().Contains ("not")) { return false; } return true; } IEnumerator checkHospitalTelephoneNumber() { // string telno = "0729883121"; // registered // string telno = "0729883120"; // not registered string telno = IFtelno.text; // remove "-" from telno telno = removeHyphen (telno); if (telbook.ContainsKey (telno)) { IFinfo.text = "dic:" + telbook[telno]; yield break; } string url = "http://www.jpcaller.com/phone/"; WWW web = new WWW(url + telno); yield return web; string res = web.text; int pos = res.IndexOf (kTitle); resText.text = "not found"; IFinfo.text = ""; if (pos > 0) { res = getHospitalName(web.text.Substring(pos, 40), telno); resText.text = res; if (hasObtainedTelNo(res)) { IFinfo.text = "web:" + resText.text; addDictionary(telno, resText.text); } } } void addDictionary(string telno, string name) { if (telbook.ContainsKey (telno) == false) { telbook.Add (telno, name); Debug.Log("added"); } // var res = telbook ["012345678"]; // Debug.Log (res); } public void CheckButtonOnClick() { // testDic (); StartCoroutine("checkHospitalTelephoneNumber"); } }
using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Linq; // for Where using System.Collections.Generic; public class CheckButtonControl : MonoBehaviour { public Text resText; public const string kTitle = "<title>"; public InputField IFtelno; public InputField IFinfo; private Dictionary<string,string> telbook = new Dictionary<string, string>(); void Start() { IFtelno.text = "0729883121"; // TODO: remove } string getHospitalName(string txt, string telno) { string removed = txt.Substring (kTitle.Length, 30); // check with first 2 characters string lhs = removed.Substring (0, 2); string rhs = telno.Substring (0, 2); if (lhs.Equals (rhs)) { return "not registered"; } return removed; } string removeHyphen(string src) { var dst = new string (src.Where (c => !"-".Contains (c)).ToArray ()); return dst; } bool hasObtainedTelNo(string src) { if (src.ToLower ().Contains ("not")) { return false; } return true; } IEnumerator checkHospitalTelephoneNumber() { // string telno = "0729883121"; // registered // string telno = "0729883120"; // not registered string telno = IFtelno.text; string url = "http://www.jpcaller.com/phone/"; // remove "-" from telno telno = removeHyphen (telno); WWW web = new WWW(url + telno); yield return web; string res = web.text; int pos = res.IndexOf (kTitle); resText.text = "not found"; IFinfo.text = ""; if (pos > 0) { res = getHospitalName(web.text.Substring(pos, 40), telno); resText.text = res; if (hasObtainedTelNo(res)) { IFinfo.text = resText.text; addDictionary(telno, resText.text); } } } void addDictionary(string telno, string name) { if (telbook.ContainsKey (telno) == false) { telbook.Add (telno, name); Debug.Log("added"); } // var res = telbook ["012345678"]; // Debug.Log (res); } public void CheckButtonOnClick() { // testDic (); StartCoroutine("checkHospitalTelephoneNumber"); } }
mit
C#
06430746c7d9ea3d8990020b8bec76e52eb7ca83
fix copyright
dlmelendez/identityazuretable,dlmelendez/identityazuretable,dlmelendez/identityazuretable
tests/ElCamino.AspNetCore.Identity.AzureTable.Tests/Fakes/HashTestKeyHelperFake.cs
tests/ElCamino.AspNetCore.Identity.AzureTable.Tests/Fakes/HashTestKeyHelperFake.cs
// MIT License Copyright 2022 (c) David Melendez. All rights reserved. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using ElCamino.AspNetCore.Identity.AzureTable.Helpers; namespace ElCamino.AspNetCore.Identity.AzureTable.Tests.Fakes { internal class HashTestKeyHelperFake : BaseKeyHelper { public override string ConvertKeyToHash(string input) { throw new NotImplementedException(); } public string ConvertKeyToHashBackwardCompatSHA1(string input) { if (input != null) { using SHA1 sha = SHA1.Create(); return GetHash(sha, input, Encoding.Unicode, 40); } return null; } public string ConvertKeyToHashBackwardCompatSHA256(string input) { if (input != null) { using SHA256 sha = SHA256.Create(); return GetHash(sha, input, Encoding.UTF8, 64); } return null; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using ElCamino.AspNetCore.Identity.AzureTable.Helpers; // MIT License Copyright 2022 (c) David Melendez. All rights reserved. See License.txt in the project root for license information. namespace ElCamino.AspNetCore.Identity.AzureTable.Tests.Fakes { internal class HashTestKeyHelperFake : BaseKeyHelper { public override string ConvertKeyToHash(string input) { throw new NotImplementedException(); } public string ConvertKeyToHashBackwardCompatSHA1(string input) { if (input != null) { using SHA1 sha = SHA1.Create(); return GetHash(sha, input, Encoding.Unicode, 40); } return null; } public string ConvertKeyToHashBackwardCompatSHA256(string input) { if (input != null) { using SHA256 sha = SHA256.Create(); return GetHash(sha, input, Encoding.UTF8, 64); } return null; } } }
mit
C#
177935d644be16be513d48b9baa724aaf4b64a10
Remove unused using
smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,2yangk23/osu,ppy/osu,EVAST9919/osu,UselessToucan/osu,peppy/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,EVAST9919/osu,smoogipoo/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,johnneijzen/osu,smoogipooo/osu,ppy/osu,2yangk23/osu
osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedPlaylist.cs
osu.Game.Tests/Visual/Multiplayer/TestSceneOverlinedPlaylist.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.Graphics; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Multi.Components; using osu.Game.Tests.Beatmaps; using osuTK; namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneOverlinedPlaylist : MultiplayerTestScene { protected override bool UseOnlineAPI => true; public TestSceneOverlinedPlaylist() { for (int i = 0; i < 10; i++) { Room.Playlist.Add(new PlaylistItem { ID = i, Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo }, Ruleset = { Value = new OsuRuleset().RulesetInfo } }); } Add(new OverlinedPlaylist(false) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(500), }); } } }
// 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.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Multi.Components; using osu.Game.Tests.Beatmaps; using osuTK; namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneOverlinedPlaylist : MultiplayerTestScene { protected override bool UseOnlineAPI => true; public TestSceneOverlinedPlaylist() { for (int i = 0; i < 10; i++) { Room.Playlist.Add(new PlaylistItem { ID = i, Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo }, Ruleset = { Value = new OsuRuleset().RulesetInfo } }); } Add(new OverlinedPlaylist(false) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(500), }); } } }
mit
C#
bae88f5ac111dab2ea4f1d330a51ed987171b3d9
fix sms sender phones string
vkeepe/cordova-sms-plugin,cordova-sms/cordova-sms-plugin,vkeepe/cordova-sms-plugin,Telerik-Verified-Plugins/SMS,cordova-sms/cordova-sms-plugin,cordova-sms/cordova-sms-plugin,Telerik-Verified-Plugins/SMS,Telerik-Verified-Plugins/SMS,vkeepe/cordova-sms-plugin
src/wp8/Sms.cs
src/wp8/Sms.cs
using System; using Microsoft.Phone.Tasks; using WPCordovaClassLib.Cordova; using WPCordovaClassLib.Cordova.Commands; using WPCordovaClassLib.Cordova.JSON; namespace WPCordovaClassLib.Cordova.Commands { public class Sms : BaseCommand { public void send(string options) { string[] optValues = JsonHelper.Deserialize<string[]>(options); string[] numValues = JsonHelper.Deserialize<string[]>(optValues[0]); String number = String.Join(",", numValues); String message = optValues[1]; SmsComposeTask task = new SmsComposeTask(); task.Body = message; task.To = number; task.Show(); } } }
using System; using Microsoft.Phone.Tasks; using WPCordovaClassLib.Cordova; using WPCordovaClassLib.Cordova.Commands; using WPCordovaClassLib.Cordova.JSON; namespace WPCordovaClassLib.Cordova.Commands { public class Sms : BaseCommand { public void send(string options) { string[] optValues = JsonHelper.Deserialize<string[]>(options); String number = optValues[0]; String message = optValues[1]; SmsComposeTask task = new SmsComposeTask(); task.Body = message; task.To = number; task.Show(); } } }
mit
C#
891d3eb463b655ca0a1250dc783ffeab60af95b5
add missing model: DockerBlob
lvermeulen/ProGet.Net
src/ProGet.Net/Native/Models/DockerBlob.cs
src/ProGet.Net/Native/Models/DockerBlob.cs
using System; // ReSharper disable InconsistentNaming namespace ProGet.Net.Native.Models { public class DockerBlob { public int Feed_Id { get; set; } public string Blob_Digest { get; set; } public int Download_Count { get; set; } public DateTime? LastRequested_Date { get; set; } public long Blob_Size { get; set; } } }
namespace ProGet.Net.Native.Models { public class DockerBlob { } }
mit
C#
7b18a4e9e2e7beeee6d08b0420b9afc0867d4d84
Add xml doc comment for the ClassArgumentExtensions.IsNotNull overload with the custom message
pmacn/Krav,pmacn/Krav
src/RequireThat/ClassArgumentExtensions.cs
src/RequireThat/ClassArgumentExtensions.cs
using RequireThat.Resources; using System; using System.Diagnostics; namespace RequireThat { public static class ClassArgumentExtensions { /// <summary> /// Requires that the <paramref name="argument"/> is not null. /// Throws an exception if the requirement is not met. /// </summary> /// <typeparam name="TStatement">The type of the <paramref name="argument"/>.</typeparam> /// <param name="argument">The <seealso cref="RequireThat.Argument"/> to add the requirement to.</param> /// <returns>The <seealso cref="RequireThat.Argument"/> that the extension was called on.</returns> /// <exception cref="ArgumentNullException">Thrown if the requirement is not met.</exception> [DebuggerStepThrough] public static Argument<T> IsNotNull<T>(this Argument<T> argument) where T : class { return argument.IsNotNull(ExceptionMessages.WasNull); } /// <summary> /// Requires that the <paramref name="argument"/> is not null. /// Throws an exception with the specified <paramref name="message"/> if the requirement is not met. /// </summary> /// <typeparam name="TStatement">The type of the <paramref name="argument"/>.</typeparam> /// <param name="argument">The <seealso cref="RequireThat.Argument"/> to add the requirement to.</param> /// <returns>The <seealso cref="RequireThat.Argument"/> that the extension was called on.</returns> /// <exception cref="ArgumentNullException">Thrown if the requirement is not met.</exception> public static Argument<T> IsNotNull<T>(this Argument<T> argument, string message) where T : class { if (argument.Value == null) throw ExceptionFactory.CreateNullException(argument, message); return argument; } } }
using RequireThat.Resources; using System; using System.Diagnostics; namespace RequireThat { public static class ClassArgumentExtensions { /// <summary> /// Requires that the <paramref name="argument"/> is not null. /// Throws an exception if the requirement is not met. /// </summary> /// <typeparam name="TStatement">The type of the <paramref name="argument"/>.</typeparam> /// <param name="argument">The <seealso cref="RequireThat.Argument"/> to add the requirement to.</param> /// <returns>The <seealso cref="RequireThat.Argument"/> that the extension was called on.</returns> /// <exception cref="ArgumentNullException">Thrown if the requirement is not met.</exception> [DebuggerStepThrough] public static Argument<T> IsNotNull<T>(this Argument<T> argument) where T : class { return argument.IsNotNull(ExceptionMessages.WasNull); } public static Argument<T> IsNotNull<T>(this Argument<T> argument, string message) where T : class { if (argument.Value == null) throw ExceptionFactory.CreateNullException(argument, message); return argument; } } }
mit
C#
932d6658a47d4d0926a9219353b090dcbb2a1ff0
Rename app setting for finance api audiences
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerFinance.Api/Startup.cs
src/SFA.DAS.EmployerFinance.Api/Startup.cs
using System.Configuration; using Microsoft.Owin; using Microsoft.Owin.Security.ActiveDirectory; using Owin; using SFA.DAS.EmployerFinance.Api; [assembly: OwinStartup(typeof(Startup))] namespace SFA.DAS.EmployerFinance.Api { public class Startup { public void Configuration(IAppBuilder app) { _ = app.UseWindowsAzureActiveDirectoryBearerAuthentication(new WindowsAzureActiveDirectoryBearerAuthenticationOptions { Tenant = ConfigurationManager.AppSettings["idaTenant"], TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters { RoleClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role", ValidAudiences = ConfigurationManager.AppSettings["FinanceApiIdaAudience"].ToString().Split(',') } }); } } }
using System.Configuration; using Microsoft.Owin; using Microsoft.Owin.Security.ActiveDirectory; using Owin; using SFA.DAS.EmployerFinance.Api; [assembly: OwinStartup(typeof(Startup))] namespace SFA.DAS.EmployerFinance.Api { public class Startup { public void Configuration(IAppBuilder app) { _ = app.UseWindowsAzureActiveDirectoryBearerAuthentication(new WindowsAzureActiveDirectoryBearerAuthenticationOptions { Tenant = ConfigurationManager.AppSettings["idaTenant"], TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters { RoleClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role", ValidAudiences = ConfigurationManager.AppSettings["FinanceApiIdentifierUri"].ToString().Split(',') } }); } } }
mit
C#
3de042ba4214cbb78d79205a1ce10b8c7b7e3560
Update HtmlSanitizerOptions.cs
mganss/HtmlSanitizer
src/HtmlSanitizer/HtmlSanitizerOptions.cs
src/HtmlSanitizer/HtmlSanitizerOptions.cs
using AngleSharp.Css.Dom; using System; using System.Collections.Generic; namespace Ganss.XSS { /// <summary> /// Provides options to be used with <see cref="HtmlSanitizer"/>. /// </summary> public class HtmlSanitizerOptions { /// <summary> /// Gets or sets the allowed tag names such as "a" and "div". /// </summary> public ISet<string> AllowedTags { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed HTML attributes such as "href" and "alt". /// </summary> public ISet<string> AllowedAttributes { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed CSS classes. /// </summary> public ISet<string> AllowedCssClasses { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed CSS properties such as "font" and "margin". /// </summary> public ISet<string> AllowedCssProperties { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed CSS at-rules such as "@media" and "@font-face". /// </summary> public ISet<CssRuleType> AllowedAtRules { get; set; } = new HashSet<CssRuleType>(); /// <summary> /// Gets or sets the allowed URI schemes such as "http" and "https". /// </summary> public ISet<string> AllowedSchemes { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the HTML attributes that can contain a URI such as "href". /// </summary> public ISet<string> UriAttributes { get; set; } = new HashSet<string>(); } }
using AngleSharp.Css.Dom; using System; using System.Collections.Generic; namespace Ganss.XSS { /// <summary> /// Provides options to be used with <see cref="HtmlSanitizer"/>. /// </summary> public class HtmlSanitizerOptions { /// <summary> /// Gets or sets the allowed tag names such as "a" and "div". /// </summary> public ISet<string> AllowedTags { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed HTML attributes such as "href" and "alt". /// </summary> public ISet<string> AllowedAttributes { get; set; } = new HashSet<string>(); // <summary> /// Gets or sets the allowed CSS classes. /// </summary> public ISet<string> AllowedCssClasses { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed CSS properties such as "font" and "margin". /// </summary> public ISet<string> AllowedCssProperties { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed CSS at-rules such as "@media" and "@font-face". /// </summary> public ISet<CssRuleType> AllowedAtRules { get; set; } = new HashSet<CssRuleType>(); /// <summary> /// Gets or sets the allowed URI schemes such as "http" and "https". /// </summary> public ISet<string> AllowedSchemes { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the HTML attributes that can contain a URI such as "href". /// </summary> public ISet<string> UriAttributes { get; set; } = new HashSet<string>(); } }
mit
C#
71c703ad6c1058edf6146a1af5f9f5c655eb7b57
Add 'Board Meeting Minutes' to navigation bar
croquet-australia/croquet-australia.com.au,croquet-australia/croquet-australia.com.au,croquet-australia/croquet-australia-website,croquet-australia/croquet-australia.com.au,croquet-australia/website-application,croquet-australia/website-application,croquet-australia/croquet-australia-website,croquet-australia/website-application,croquet-australia/croquet-australia-website,croquet-australia/croquet-australia-website,croquet-australia/croquet-australia.com.au,croquet-australia/website-application
source/CroquetAustraliaWebsite.Application/app/Infrastructure/PublicNavigationBar.cs
source/CroquetAustraliaWebsite.Application/app/Infrastructure/PublicNavigationBar.cs
using System.Collections.Generic; namespace CroquetAustraliaWebsite.Application.App.Infrastructure { public static class PublicNavigationBar { public static IEnumerable<NavigationItem> GetNavigationItems() { return new[] { new NavigationItem("Contact Us", new NavigationItem("Office & Board", "~/governance/contact-us"), new NavigationItem("Committees", "~/governance/contact-us#committees"), new NavigationItem("Appointed Officers", "~/governance/contact-us#appointed-officers"), new NavigationItem("State Associations", "~/governance/state-associations")), new NavigationItem("Governance", new NavigationItem("Background", "~/governance/background"), new NavigationItem("Constitution, Regulations & Policies", "~/governance/constitution-regulations-and-policies"), new NavigationItem("Members", "~/governance/members"), new NavigationItem("Board Meeting Minutes", "~/governance/minutes/board-meeting-minutes")), new NavigationItem("Tournaments", "~/tournaments"), new NavigationItem("Disciplines", new NavigationItem("Association Croquet", new NavigationItem("Coaching", "~/disciplines/association-croquet/coaching"), new NavigationItem("Refereeing", "~/disciplines/association-croquet/refereeing")), new NavigationItem("Golf Croquet", new NavigationItem("Coaching", "~/disciplines/golf-croquet/coaching"), new NavigationItem("Refereeing", "~/disciplines/golf-croquet/refereeing"), new NavigationItem("Resources", "~/disciplines/golf-croquet/resources"))) }; } } }
using System.Collections.Generic; namespace CroquetAustraliaWebsite.Application.App.Infrastructure { public static class PublicNavigationBar { public static IEnumerable<NavigationItem> GetNavigationItems() { return new[] { new NavigationItem("Contact Us", new NavigationItem("Office & Board", "~/governance/contact-us"), new NavigationItem("Committees", "~/governance/contact-us#committees"), new NavigationItem("Appointed Officers", "~/governance/contact-us#appointed-officers"), new NavigationItem("State Associations", "~/governance/state-associations")), new NavigationItem("Governance", new NavigationItem("Background", "~/governance/background"), new NavigationItem("Constitution, Regulations & Policies", "~/governance/constitution-regulations-and-policies"), new NavigationItem("Members", "~/governance/members")), new NavigationItem("Tournaments", "~/tournaments"), new NavigationItem("Disciplines", new NavigationItem("Association Croquet", new NavigationItem("Coaching", "~/disciplines/association-croquet/coaching"), new NavigationItem("Refereeing", "~/disciplines/association-croquet/refereeing")), new NavigationItem("Golf Croquet", new NavigationItem("Coaching", "~/disciplines/golf-croquet/coaching"), new NavigationItem("Refereeing", "~/disciplines/golf-croquet/refereeing"), new NavigationItem("Resources", "~/disciplines/golf-croquet/resources"))) }; } } }
mit
C#
5d964a0fb8abd58aa30759fc69c391febaf502b2
Fix answer 28 to include square roots in prime test
Abc-Arbitrage/Abc.NCrafts.AllocationQuiz
Abc.NCrafts.Quizz/Performance/Questions/028/Answer1.cs
Abc.NCrafts.Quizz/Performance/Questions/028/Answer1.cs
using System; using System.Linq; namespace Abc.NCrafts.Quizz.Performance.Questions._028 { [CorrectAnswer(Difficulty = Difficulty.Medium)] public class Answer1 { public static void Run() { // begin var primes = Enumerable.Range(0, 10 * 1000) .Where(IsPrime) .ToList(); // end Logger.Log("Primes: {0}", primes.Count); } private static bool IsPrime(int number) { if (number == 0 || number == 1) return false; if (number == 2) return true; for (var divisor = 2; divisor <= (int)Math.Sqrt(number); divisor++) { if (number % divisor == 0) return false; } return true; } } }
using System; using System.Linq; namespace Abc.NCrafts.Quizz.Performance.Questions._028 { [CorrectAnswer(Difficulty = Difficulty.Medium)] public class Answer1 { public static void Run() { // begin var primes = Enumerable.Range(0, 10 * 1000) .Where(IsPrime) .ToList(); // end Logger.Log("Primes: {0}", primes.Count); } private static bool IsPrime(int number) { if (number == 0 || number == 1) return false; if (number == 2) return true; for (var divisor = 2; divisor < (int)Math.Sqrt(number); divisor++) { if (number % divisor == 0) return false; } return true; } } }
mit
C#
182c06a7c2abcedfe76d836f5924c49d1a2a05a3
Revert accidental change
jherby2k/AudioWorks
AudioWorks/src/Extensions/AudioWorks.Extensions.Mp4/ItunesAudioMetadataDecoder.cs
AudioWorks/src/Extensions/AudioWorks.Extensions.Mp4/ItunesAudioMetadataDecoder.cs
/* Copyright © 2018 Jeremy Herbison This file is part of AudioWorks. AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. AudioWorks 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see <https://www.gnu.org/licenses/>. */ using System.IO; using AudioWorks.Common; using AudioWorks.Extensibility; namespace AudioWorks.Extensions.Mp4 { [AudioMetadataDecoderExport(".m4a")] public sealed class ItunesAudioMetadataDecoder : IAudioMetadataDecoder { const string _format = "iTunes"; public string Format => _format; public AudioMetadata ReadMetadata(Stream stream) { var mp4 = new Mp4Model(stream); if (mp4.DescendToAtom("moov", "udta", "meta", "ilst")) return new IlstAtomToMetadataAdapter(mp4, mp4.GetChildAtomInfo()); throw new AudioUnsupportedException("No ilst atom found."); } } }
/* Copyright © 2018 Jeremy Herbison This file is part of AudioWorks. AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. AudioWorks 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see <https://www.gnu.org/licenses/>. */ using System.IO; using AudioWorks.Common; using AudioWorks.Extensibility; namespace AudioWorks.Extensions.Mp4 { [AudioMetadataDecoderExport(".m4a")] public sealed class ItunesAudioMetadataDecoder : IAudioMetadataDecoder { const string _format = "iTunes"; public string Format => _format; public AudioMetadata ReadMetadata(Stream stream) { using var reader = new BinaryReader(stream); var mp4 = new Mp4Model(stream); if (mp4.DescendToAtom("moov", "udta", "meta", "ilst")) return new IlstAtomToMetadataAdapter(mp4, mp4.GetChildAtomInfo()); throw new AudioUnsupportedException("No ilst atom found."); } } }
agpl-3.0
C#
65666435cd24af1d84dcca88fc050a2cdaeccef8
rename vEyeSpaceNormal
bitzhuwei/CSharpGL,bitzhuwei/CSharpGL,bitzhuwei/CSharpGL
Demos/DirectionalLight/DirectionalLightNode.shaders.cs
Demos/DirectionalLight/DirectionalLightNode.shaders.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using CSharpGL; namespace DirectionalLight { public partial class DirectionalLightNode { private const string directionalLightVert = @"#version 330 core in vec3 " + inPosition + @"; // per-vertex position in vec3 " + inNormal + @"; // per-vertex normal uniform mat4 " + mvpMat + @"; // combined model view projection matrix uniform mat3 " + normalMatrix + @"; // normal matrix smooth out vec3 eyeSpaceNormal; // normal in eye space void main() { eyeSpaceNormal = normalMatrix * inNormal; gl_Position = mvpMat * vec4(inPosition, 1); } "; private const string directionalLightFrag = @"#version 330 core uniform vec3 " + halfVector + @"; uniform float " + shiness + @" = 6; uniform float " + strength + @" = 1; uniform vec3 " + lightDirection + @"; // direction towards light source in view space uniform vec3 " + lightColor + @"; uniform vec3 " + diffuseColor + @" = vec3(1, 0.8431, 0); // diffuse color of surface uniform vec3 " + ambientColor + @" = vec3(0.2, 0.2, 0.2); // inputs from vertex shader smooth in vec3 eyeSpaceNormal; // interpolated normal in eye space layout (location = 0) out vec4 vFragColor; // fargment shader output void main() { vec3 L = normalize(lightDirection); // light vector float diffuse = max(0, dot(normalize(eyeSpaceNormal), L)); float specular = 0; if (diffuse > 0) { specular = max(0, dot(normalize(halfVector), eyeSpaceNormal)); specular = pow(specular, shiness) * strength; } vFragColor = vec4(((ambientColor + diffuse) * diffuseColor + specular) * lightColor, 1.0); } "; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using CSharpGL; namespace DirectionalLight { public partial class DirectionalLightNode { private const string directionalLightVert = @"#version 330 core in vec3 " + inPosition + @"; // per-vertex position in vec3 " + inNormal + @"; // per-vertex normal uniform mat4 " + mvpMat + @"; // combined model view projection matrix uniform mat3 " + normalMatrix + @"; // normal matrix smooth out vec3 vEyeSpaceNormal; // normal in eye space void main() { vEyeSpaceNormal = normalMatrix * inNormal; gl_Position = mvpMat * vec4(inPosition, 1); } "; private const string directionalLightFrag = @"#version 330 core uniform vec3 " + halfVector + @"; uniform float " + shiness + @" = 6; uniform float " + strength + @" = 1; uniform vec3 " + lightDirection + @"; // direction towards light source in view space uniform vec3 " + lightColor + @"; uniform vec3 " + diffuseColor + @" = vec3(1, 0.8431, 0); // diffuse color of surface uniform vec3 " + ambientColor + @" = vec3(0.2, 0.2, 0.2); // inputs from vertex shader smooth in vec3 vEyeSpaceNormal; // interpolated normal in eye space layout (location = 0) out vec4 vFragColor; // fargment shader output void main() { vec3 L = normalize(lightDirection); // light vector float diffuse = max(0, dot(normalize(vEyeSpaceNormal), L)); float specular = 0; if (diffuse > 0) { specular = max(0, dot(normalize(halfVector), vEyeSpaceNormal)); specular = pow(specular, shiness) * strength; } vFragColor = vec4(((ambientColor + diffuse) * diffuseColor + specular) * lightColor, 1.0); } "; } }
mit
C#
2159defda7aa0d3574b3b9b46585e5c6115f0b65
add address_importer field
goshippo/shippo-csharp-client
Shippo/CustomsDeclaration.cs
Shippo/CustomsDeclaration.cs
using System; using Newtonsoft.Json; namespace Shippo { [JsonObject(MemberSerialization.OptIn)] public class CustomsDeclaration : ShippoId { [JsonProperty(PropertyName = "object_created")] public object ObjectCreated { get; set; } [JsonProperty(PropertyName = "object_updated")] public object ObjectUpdated { get; set; } [JsonProperty(PropertyName = "object_owner")] public object ObjectOwner { get; set; } [JsonProperty(PropertyName = "object_state")] public object ObjectState { get; set; } [JsonProperty(PropertyName = "exporter_reference")] public object ExporterReference { get; set; } [JsonProperty(PropertyName = "importer_reference")] public object ImporterReference { get; set; } [JsonProperty(PropertyName = "contents_type")] public object ContentsType { get; set; } [JsonProperty(PropertyName = "contents_explanation")] public object ContentsExplanation { get; set; } [JsonProperty(PropertyName = "invoice")] public object Invoice { get; set; } [JsonProperty(PropertyName = "license")] public object License { get; set; } [JsonProperty(PropertyName = "certificate")] public object Certificate { get; set; } [JsonProperty(PropertyName = "notes")] public object Notes { get; set; } [JsonProperty(PropertyName = "eel_pfc")] public object EelPfc { get; set; } [JsonProperty(PropertyName = "aes_itn")] public object AesItn { get; set; } [JsonProperty(PropertyName = "non_delivery_option")] public object NonDeliveryOption { get; set; } [JsonProperty(PropertyName = "certify")] public object Certify { get; set; } [JsonProperty(PropertyName = "certify_signer")] public object CertifySigner { get; set; } [JsonProperty (PropertyName = "address_importer")] public object AddressImporter { get; set; } [JsonProperty(PropertyName = "disclaimer")] public object Discliamer { get; set; } [JsonProperty(PropertyName = "incoterm")] public object Incoterm { get; set; } [JsonProperty(PropertyName = "items")] public object Items { get; set; } [JsonProperty(PropertyName = "metadata")] public object Metadata { get; set; } } }
using System; using Newtonsoft.Json; namespace Shippo { [JsonObject(MemberSerialization.OptIn)] public class CustomsDeclaration : ShippoId { [JsonProperty(PropertyName = "object_created")] public object ObjectCreated { get; set; } [JsonProperty(PropertyName = "object_updated")] public object ObjectUpdated { get; set; } [JsonProperty(PropertyName = "object_owner")] public object ObjectOwner { get; set; } [JsonProperty(PropertyName = "object_state")] public object ObjectState { get; set; } [JsonProperty(PropertyName = "exporter_reference")] public object ExporterReference { get; set; } [JsonProperty(PropertyName = "importer_reference")] public object ImporterReference { get; set; } [JsonProperty(PropertyName = "contents_type")] public object ContentsType { get; set; } [JsonProperty(PropertyName = "contents_explanation")] public object ContentsExplanation { get; set; } [JsonProperty(PropertyName = "invoice")] public object Invoice { get; set; } [JsonProperty(PropertyName = "license")] public object License { get; set; } [JsonProperty(PropertyName = "certificate")] public object Certificate { get; set; } [JsonProperty(PropertyName = "notes")] public object Notes { get; set; } [JsonProperty(PropertyName = "eel_pfc")] public object EelPfc { get; set; } [JsonProperty(PropertyName = "aes_itn")] public object AesItn { get; set; } [JsonProperty(PropertyName = "non_delivery_option")] public object NonDeliveryOption { get; set; } [JsonProperty(PropertyName = "certify")] public object Certify { get; set; } [JsonProperty(PropertyName = "certify_signer")] public object CertifySigner { get; set; } [JsonProperty(PropertyName = "disclaimer")] public object Discliamer { get; set; } [JsonProperty(PropertyName = "incoterm")] public object Incoterm { get; set; } [JsonProperty(PropertyName = "items")] public object Items { get; set; } [JsonProperty(PropertyName = "metadata")] public object Metadata { get; set; } } }
apache-2.0
C#
e6a37028755f1b2a1e26455ad8367b9d498cfad2
clean up adobe
EricZimmerman/RegistryPlugins
RegistryPlugin.Adobe/ValuesOut.cs
RegistryPlugin.Adobe/ValuesOut.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RegistryPluginBase.Interfaces; namespace RegistryPlugin.Adobe { public class ValuesOut:IValueOut { public ValuesOut(string productName, string productVersion, string fullPath, DateTimeOffset lastOpened, string fileName, int fileSize, string fileSource, int pageCount) { ProductName = productName; ProductVersion = productVersion; FullPath = fullPath; LastOpened = lastOpened; FileName = fileName; FileSize = fileSize; FileSource = fileSource; PageCount = pageCount; } public string ProductName { get; } public string ProductVersion { get; } public string FullPath { get; } public DateTimeOffset LastOpened { get; } public string FileName { get; } public int FileSize { get; } public string FileSource { get; } public int PageCount { get; } public string BatchKeyPath { get; set; } public string BatchValueName { get; set; } public string BatchValueData1 => $"Product: {ProductName} {ProductVersion}"; public string BatchValueData2 => $"FullPath: {FullPath}"; public string BatchValueData3 => $"LastOpened: {LastOpened.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff})"; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RegistryPluginBase.Interfaces; namespace RegistryPlugin.Adobe { public class ValuesOut:IValueOut { public ValuesOut(string productName, string productVersion, string fullPath, DateTimeOffset lastOpened, string fileName, int fileSize, string fileSource, int pageCount) { ProductName = productName; ProductVersion = productVersion; FullPath = fullPath; LastOpened = lastOpened; FileName = fileName; FileSize = fileSize; FileSource = fileSource; PageCount = pageCount; } public string ProductName { get; } public string ProductVersion { get; } public string FullPath { get; } public DateTimeOffset LastOpened { get; } public string FileName { get; } public int FileSize { get; } public string FileSource { get; } public int PageCount { get; } public string BatchKeyPath { get; set; } public string BatchValueName { get; set; } public string BatchValueData1 => $"Product: {ProductName} {ProductVersion}"; public string BatchValueData2 => $"FullPath: {FullPath}"; public string BatchValueData3 => $"LastOpened: {LastOpened?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff})";} } }
mit
C#
0973c224d643aec9a62213432b83627563d4b12a
Bump to version 2.0
hispafox/LibLog,BlackFrog1/LibLog,modulexcite/LibLog,damianh/LibLog,leastprivilege/LibLog,darkl/LibLog,khellang/LibLog,adamralph/LibLog,erikvanbrakel/LibLog
src/SharedAssemblyInfo.cs
src/SharedAssemblyInfo.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="SharedAssemblyInfo.cs" company="Damian Hickey"> // Copyright © 2011-2014 Damian Hickey // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Damian Hickey")] [assembly: AssemblyProduct("LibLog")] [assembly: AssemblyCopyright("Damian Hickey 2011-2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")]
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="SharedAssemblyInfo.cs" company="Damian Hickey"> // Copyright © 2011-2014 Damian Hickey // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Damian Hickey")] [assembly: AssemblyProduct("LibLog")] [assembly: AssemblyCopyright("Damian Hickey 2011-2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.5.0.0")] [assembly: AssemblyFileVersion("1.5.0.0")]
mit
C#
313c59c08f5c54cd0b33ed443fd79a72e9c80b74
Update startup implementation
peterblazejewicz/missing-aspnet5-static-page-template,peterblazejewicz/missing-aspnet5-static-page-template,peterblazejewicz/missing-aspnet5-static-page-template
src/StaticPage/Startup.cs
src/StaticPage/Startup.cs
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Hosting; using Microsoft.AspNet.StaticFiles; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace StaticPage { public class Startup { public Startup(IHostingEnvironment env) { // Set up configuration sources. var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; set; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDirectoryBrowser(); } // 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(); } else { app.UseExceptionHandler("/error.html"); } app.UseIISPlatformHandler(); app.UseStaticFiles(); app.UseWelcomePage("/welcome"); app.UseRuntimeInfoPage(); // default path is /runtimeinfo app.UseFileServer(new FileServerOptions() { EnableDirectoryBrowsing = true, }); } // Entry point for the application. public static void Main(string[] args) => Microsoft.AspNet.Hosting.WebApplication.Run<Startup>(args); } }
using Microsoft.AspNet.Builder; using Microsoft.AspNet.StaticFiles; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Console; namespace StaticPage { public class Startup { // public Startup(IHostingEnvironment env) // { // // Set up configuration sources. // var builder = new ConfigurationBuilder() // .AddJsonFile("appsettings.json") // .AddEnvironmentVariables(); // Configuration = builder.Build(); // } // public IConfigurationRoot Configuration { get; set; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDirectoryBrowser(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { // loggerFactory.AddConsole(Configuration.GetSection("Logging")); // loggerFactory.AddDebug(); // if (env.IsDevelopment()) // { // app.UseDeveloperExceptionPage(); // } // else // { // app.UseExceptionHandler("error.html"); // } // app.UseIISPlatformHandler(); // app.UseStaticFiles(); // app.UseWelcomePage("/welcome"); // app.UseRuntimeInfoPage(); // default path is /runtimeinfo // app.UseFileServer(new FileServerOptions() // { // EnableDirectoryBrowsing = true, // }); // Displays all log levels //factory.AddConsole(LogLevel.Verbose); app.UseFileServer(new FileServerOptions() { EnableDirectoryBrowsing = true, }); } // Entry point for the application. public static void Main(string[] args) => Microsoft.AspNet.Hosting.WebApplication.Run<Startup>(args); } }
unlicense
C#
c775cdbfddc84a25c8198a61348caa44b4c99d71
Add an async variant of Enqueue
PimDeWitte/UnityMainThreadDispatcher
UnityMainThreadDispatcher.cs
UnityMainThreadDispatcher.cs
/* Copyright 2015 Pim de Witte All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using UnityEngine; using System.Collections; using System.Collections.Generic; using System; /// Author: Pim de Witte (pimdewitte.com) and contributors /// <summary> /// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for /// things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling /// </summary> public class UnityMainThreadDispatcher : MonoBehaviour { private static readonly Queue<Action> _executionQueue = new Queue<Action>(); public void Update() { lock(_executionQueue) { while (_executionQueue.Count > 0) { _executionQueue.Dequeue().Invoke(); } } } /// <summary> /// Locks the queue and adds the IEnumerator to the queue /// </summary> /// <param name="action">IEnumerator function that will be executed from the main thread.</param> public void Enqueue(IEnumerator action) { lock (_executionQueue) { _executionQueue.Enqueue (() => { StartCoroutine (action); }); } } /// <summary> /// Locks the queue and adds the Action to the queue /// </summary> /// <param name="action">function that will be executed from the main thread.</param> public void Enqueue(Action action) { Enqueue(ActionWrapper(action)); } /// <summary> /// Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes /// </summary> /// <param name="action">function that will be executed from the main thread.</param> /// <returns>A Task that can be awaited until the action completes</returns> public Task EnqueueAsync(Action action) { var tcs = new TaskCompletionSource<bool>(); void WrappedAction() { try { action(); tcs.TrySetResult(true); } catch (Exception ex) { tcs.TrySetException(ex); } } Enqueue(ActionWrapper(WrappedAction)); return tcs.Task; } IEnumerator ActionWrapper(Action a) { a(); yield return null; } private static UnityMainThreadDispatcher _instance = null; public static bool Exists() { return _instance != null; } public static UnityMainThreadDispatcher Instance() { if (!Exists ()) { throw new Exception ("UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene."); } return _instance; } void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(this.gameObject); } } void OnDestroy() { _instance = null; } }
/* Copyright 2015 Pim de Witte All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using UnityEngine; using System.Collections; using System.Collections.Generic; using System; /// Author: Pim de Witte (pimdewitte.com) and contributors /// <summary> /// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for /// things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling /// </summary> public class UnityMainThreadDispatcher : MonoBehaviour { private static readonly Queue<Action> _executionQueue = new Queue<Action>(); public void Update() { lock(_executionQueue) { while (_executionQueue.Count > 0) { _executionQueue.Dequeue().Invoke(); } } } /// <summary> /// Locks the queue and adds the IEnumerator to the queue /// </summary> /// <param name="action">IEnumerator function that will be executed from the main thread.</param> public void Enqueue(IEnumerator action) { lock (_executionQueue) { _executionQueue.Enqueue (() => { StartCoroutine (action); }); } } /// <summary> /// Locks the queue and adds the Action to the queue /// </summary> /// <param name="action">function that will be executed from the main thread.</param> public void Enqueue(Action action) { Enqueue(ActionWrapper(action)); } IEnumerator ActionWrapper(Action a) { a(); yield return null; } private static UnityMainThreadDispatcher _instance = null; public static bool Exists() { return _instance != null; } public static UnityMainThreadDispatcher Instance() { if (!Exists ()) { throw new Exception ("UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene."); } return _instance; } void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(this.gameObject); } } void OnDestroy() { _instance = null; } }
apache-2.0
C#
85b6ee2ca8cf5889297c0b3ae0a910bf75df4738
Fix null reference exception
vostok/core
Vostok.Core/Tracing/Trace.cs
Vostok.Core/Tracing/Trace.cs
using System.Collections.Generic; using Vostok.Airlock; using Vostok.Commons.Collections; namespace Vostok.Tracing { public static class Trace { private static readonly IPool<Span> spanPool; private static readonly TraceConfiguration configuration; static Trace() { configuration = new TraceConfiguration(); spanPool = new UnlimitedLazyPool<Span>( () => new Span { Annotations = new Dictionary<string, string>() }); AirlockSerializerRegistry.Register(new SpanAirlockSerializer()); } public static ISpanBuilder BeginSpan() { var isEnabled = Configuration.IsEnabled(); var airlock = Configuration.AirlockClient; var airlockRoutingKey = configuration.AirlockRoutingKey?.Invoke(); if (!isEnabled || airlock == null || airlockRoutingKey == null) return new FakeSpanBuilder(); var pooledSpan = spanPool.AcquireHandle(); var contextScope = TraceContextScope.Begin(); return new SpanBuilder(airlockRoutingKey, airlock, pooledSpan, contextScope, configuration); } public static ITraceConfiguration Configuration => configuration; } }
using System.Collections.Generic; using Vostok.Airlock; using Vostok.Commons.Collections; namespace Vostok.Tracing { public static class Trace { private static readonly IPool<Span> spanPool; private static readonly TraceConfiguration configuration; static Trace() { configuration = new TraceConfiguration(); spanPool = new UnlimitedLazyPool<Span>( () => new Span { Annotations = new Dictionary<string, string>() }); AirlockSerializerRegistry.Register(new SpanAirlockSerializer()); } public static ISpanBuilder BeginSpan() { var isEnabled = Configuration.IsEnabled(); var airlock = Configuration.AirlockClient; var airlockRoutingKey = configuration.AirlockRoutingKey(); if (!isEnabled || airlock == null || airlockRoutingKey == null) return new FakeSpanBuilder(); var pooledSpan = spanPool.AcquireHandle(); var contextScope = TraceContextScope.Begin(); return new SpanBuilder(airlockRoutingKey, airlock, pooledSpan, contextScope, configuration); } public static ITraceConfiguration Configuration => configuration; } }
mit
C#
46f7d718b0ae2c94169cf67785625b8775a5c81c
fix bug
xuanbg/Utility
WCF/CustomWebHttpBehavior.cs
WCF/CustomWebHttpBehavior.cs
using System.ServiceModel.Description; using System.ServiceModel.Dispatcher; namespace Insight.WCF { public class CustomWebHttpBehavior : WebHttpBehavior { public string AllowOrigin { get; set; } /// <summary> /// 设置请求消息反序列化器 /// </summary> /// <param name="operationDescription"></param> /// <param name="endpoint"></param> /// <returns></returns> protected override IDispatchMessageFormatter GetRequestDispatchFormatter(OperationDescription operationDescription, ServiceEndpoint endpoint) { var innerFormatter = base.GetRequestDispatchFormatter(operationDescription, endpoint); return new CustomDispatchFormatter(innerFormatter, AllowOrigin); } /// <summary> /// 设置响应消息序列化器 /// </summary> /// <param name="operationDescription"></param> /// <param name="endpoint"></param> /// <returns></returns> protected override IDispatchMessageFormatter GetReplyDispatchFormatter(OperationDescription operationDescription, ServiceEndpoint endpoint) { var innerFormatter = base.GetReplyDispatchFormatter(operationDescription, endpoint); return new CustomDispatchFormatter(innerFormatter, AllowOrigin); } /// <summary> /// ServiceEndpoint 检查器 /// </summary> /// <param name="endpoint"></param> public override void Validate(ServiceEndpoint endpoint) { } } }
using System.ServiceModel.Description; using System.ServiceModel.Dispatcher; namespace Insight.WCF { public class CustomWebHttpBehavior : WebHttpBehavior { public string AllowOrigin { get; set; } /// <summary> /// 设置请求消息反序列化器 /// </summary> /// <param name="operationDescription"></param> /// <param name="endpoint"></param> /// <returns></returns> protected override IDispatchMessageFormatter GetRequestDispatchFormatter(OperationDescription operationDescription, ServiceEndpoint endpoint) { var innerFormatter = base.GetRequestDispatchFormatter(operationDescription, endpoint); return new CustomDispatchFormatter(innerFormatter, AllowOrigin); } /// <summary> /// 设置响应消息序列化器 /// </summary> /// <param name="operationDescription"></param> /// <param name="endpoint"></param> /// <returns></returns> protected override IDispatchMessageFormatter GetReplyDispatchFormatter(OperationDescription operationDescription, ServiceEndpoint endpoint) { var innerFormatter = base.GetRequestDispatchFormatter(operationDescription, endpoint); return new CustomDispatchFormatter(innerFormatter, AllowOrigin); } /// <summary> /// ServiceEndpoint 检查器 /// </summary> /// <param name="endpoint"></param> public override void Validate(ServiceEndpoint endpoint) { } } }
mit
C#
8ab76cdf9d5c8ca9c997bba9bb30515e74566fa0
Use FirstOrDefault rather than First
appharbor/appharbor-cli
src/AppHarbor/Commands/RemoveDrainCommand.cs
src/AppHarbor/Commands/RemoveDrainCommand.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using RestSharp; namespace AppHarbor.Commands { [CommandHelp("Remove a log drain", "[DRAIN URL]")] public class RemoveDrainCommand : ApplicationCommand { private readonly string _accessToken; private readonly IRestClient _restClient; public RemoveDrainCommand(IApplicationConfiguration applicationConfiguration, IAccessTokenConfiguration accessTokenConfiguration) : base(applicationConfiguration) { _accessToken = accessTokenConfiguration.GetAccessToken(); _restClient = new RestClient("https://appharbor.com/"); } protected override void InnerExecute(string[] arguments) { var request = new RestRequest("applications/{slug}/drains", Method.GET) .AddUrlSegment("slug", ApplicationId) .AddHeader("Authorization", string.Format("BEARER {0}", _accessToken)); request.RequestFormat = DataFormat.Json; var drains = _restClient.Execute<List<Drain>>(request); var drain = drains.Data.FirstOrDefault(x => x.Value == arguments[0]); if (drain == null) { throw new CommandException("No drains with that URL is associated with this application"); } var url = new Uri(drain.Url); var destroyRequest = new RestRequest(url, Method.DELETE) { RequestFormat = DataFormat.Json, } .AddHeader("Authorization", string.Format("BEARER {0}", _accessToken)); var destroyResponse = _restClient.Execute(destroyRequest); if (destroyResponse.StatusCode != HttpStatusCode.NoContent) { throw new CommandException("Couldn't remove drain"); } } private class Drain { public string Url { get; set; } public string Token { get; set; } public string Value { get; set; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using RestSharp; namespace AppHarbor.Commands { [CommandHelp("Remove a log drain", "[DRAIN URL]")] public class RemoveDrainCommand : ApplicationCommand { private readonly string _accessToken; private readonly IRestClient _restClient; public RemoveDrainCommand(IApplicationConfiguration applicationConfiguration, IAccessTokenConfiguration accessTokenConfiguration) : base(applicationConfiguration) { _accessToken = accessTokenConfiguration.GetAccessToken(); _restClient = new RestClient("https://appharbor.com/"); } protected override void InnerExecute(string[] arguments) { var request = new RestRequest("applications/{slug}/drains", Method.GET) .AddUrlSegment("slug", ApplicationId) .AddHeader("Authorization", string.Format("BEARER {0}", _accessToken)); request.RequestFormat = DataFormat.Json; var drains = _restClient.Execute<List<Drain>>(request); var drain = drains.Data.First(x => x.Value == arguments[0]); if (drain == null) { throw new CommandException("No drains with that URL is associated with this application"); } var url = new Uri(drain.Url); var destroyRequest = new RestRequest(url, Method.DELETE) { RequestFormat = DataFormat.Json, } .AddHeader("Authorization", string.Format("BEARER {0}", _accessToken)); var destroyResponse = _restClient.Execute(destroyRequest); if (destroyResponse.StatusCode != HttpStatusCode.NoContent) { throw new CommandException("Couldn't remove drain"); } } private class Drain { public string Url { get; set; } public string Token { get; set; } public string Value { get; set; } } } }
mit
C#
7613712a42d982de38c344665d8ec191bac3f946
rename test1
jintiao/SerializationTest
Assets/Editor/Test1-SerializationRule/SerializationRuleWindow.cs
Assets/Editor/Test1-SerializationRule/SerializationRuleWindow.cs
using System; using UnityEngine; using UnityEditor; namespace SerializationTest.Test1 { public class MyClass { public string s; public void OnGUI() { s = EditorGUILayout.TextField("public string s", s); } } [Serializable] public class MyClassSerializable { public float f1; [NonSerialized]public float f2; private int i1; [SerializeField]private int i2; public void OnGUI() { f1 = EditorGUILayout.Slider("public float f1", f1, 0, 100); f2 = EditorGUILayout.Slider("[NonSerialized]public float f2", f2, 0, 100); i1 = EditorGUILayout.IntSlider("private int i1", i1, 0, 100); i2 = EditorGUILayout.IntSlider("[SerializeField]private int i2", i2, 0, 100); } } public class SerializationRuleWindow : EditorWindow { private const string WINDOW_TITLE = "Serialization Rule"; public MyClass m1; public MyClassSerializable s1; private MyClassSerializable s2; void OnEnable() { if(m1 == null) m1 = new MyClass(); if(s1 == null) s1 = new MyClassSerializable(); if(s2 == null) s2 = new MyClassSerializable(); titleContent.text = WINDOW_TITLE; } void OnGUI() { EditorGUILayout.Space(); EditorGUILayout.LabelField("public MyClass m1"); m1.OnGUI(); EditorGUILayout.Space(); EditorGUILayout.LabelField("public MyClassSerializable s1"); s1.OnGUI(); EditorGUILayout.Space(); EditorGUILayout.LabelField("private MyClassSerializable s2"); s2.OnGUI(); } [MenuItem ("Window/Serialization Test/Test 1 - " + WINDOW_TITLE)] public static void ShowWindow() { EditorWindow.GetWindow<SerializationRuleWindow>(); } } // class SerializationRuleWindow } // namespace SerializationTest.Test1
using System; using UnityEngine; using UnityEditor; namespace SerializationTest.Test1 { public class MyClass { public string s; public void OnGUI() { s = EditorGUILayout.TextField("public string s", s); } } [Serializable] public class MyClassSerializable { public float f1; [NonSerialized]public float f2; private int i1; [SerializeField]private int i2; public void OnGUI() { f1 = EditorGUILayout.Slider("public float f1", f1, 0, 100); f2 = EditorGUILayout.Slider("[NonSerialized]public float f2", f2, 0, 100); i1 = EditorGUILayout.IntSlider("private int i1", i1, 0, 100); i2 = EditorGUILayout.IntSlider("[SerializeField]private int i2", i2, 0, 100); } } public class TestWindow1 : EditorWindow { public MyClass m1; public MyClassSerializable s1; private MyClassSerializable s2; void OnEnable() { if(m1 == null) m1 = new MyClass(); if(s1 == null) s1 = new MyClassSerializable(); if(s2 == null) s2 = new MyClassSerializable(); titleContent.text = "Serialization Rule"; } void OnGUI() { EditorGUILayout.Space(); EditorGUILayout.LabelField("public MyClass m1"); m1.OnGUI(); EditorGUILayout.Space(); EditorGUILayout.LabelField("public MyClassSerializable s1"); s1.OnGUI(); EditorGUILayout.Space(); EditorGUILayout.LabelField("private MyClassSerializable s2"); s2.OnGUI(); } [MenuItem ("Window/Serialization Test/Test 1 - Serialization Rule")] public static void ShowWindow() { EditorWindow.GetWindow<TestWindow1>(); } } // class TestWindow1 } // namespace SerializationTest.Test1
mit
C#
76c2d699c4f71e2a3eafa11f8c30749a3bfabefa
Prepare 0.6.0 release
LouisTakePILLz/ArgumentParser
ArgumentParser/Properties/AssemblyInfo.cs
ArgumentParser/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ArgumentParser")] [assembly: AssemblyDescription("A rich and elegant library for parameter-parsing that supports various syntaxes and flavors.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("LouisTakePILLz")] [assembly: AssemblyProduct("ArgumentParser")] [assembly: AssemblyCopyright("Copyright © LouisTakePILLz 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a67b27e2-8841-4951-a6f0-a00d93f59560")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.6.0.0")] [assembly: AssemblyFileVersion("0.6.0.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ArgumentParser")] [assembly: AssemblyDescription("A rich and elegant library for parameter-parsing that supports various syntaxes and flavors.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("LouisTakePILLz")] [assembly: AssemblyProduct("ArgumentParser")] [assembly: AssemblyCopyright("Copyright © LouisTakePILLz 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a67b27e2-8841-4951-a6f0-a00d93f59560")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("0.5.0.0")]
apache-2.0
C#
c11ec0e54df7a4d45b710f32b8b372f2f31f5200
Fix FiddlerProxyUtil.StartAutoRespond to use parameter
sjdirect/commoner
Commoner.Core/Testing/FiddlerProxyUtil.cs
Commoner.Core/Testing/FiddlerProxyUtil.cs
using System.Linq; using Fiddler; namespace Commoner.Core.Testing { public class FiddlerProxyUtil { public static void StartAutoRespond(string p) { var importedSessions = SazImporter.ReadSessionArchive(p).ToList(); FiddlerApplication.BeforeRequest += delegate(Session oS) { //TODO add dictionary for lookup var matchedSession = importedSessions.FirstOrDefault(s => s.fullUrl == oS.fullUrl); if (matchedSession != null) { oS.utilCreateResponseAndBypassServer(); oS.responseBodyBytes = matchedSession.responseBodyBytes; oS.oResponse.headers = (HTTPResponseHeaders)matchedSession.oResponse.headers.Clone(); } }; FiddlerApplication.Startup(8889, false, false); } public static void StopAutoResponding() { if (FiddlerApplication.IsStarted()) FiddlerApplication.Shutdown(); } } }
using System.Linq; using Fiddler; namespace Commoner.Core.Testing { public class FiddlerProxyUtil { public static void StartAutoRespond(string p) { var importedSessions = SazImporter.ReadSessionArchive(@"..\..\..\TestResponses.saz").ToList(); FiddlerApplication.BeforeRequest += delegate(Session oS) { //TODO add dictionary for lookup var matchedSession = importedSessions.FirstOrDefault(s => s.fullUrl == oS.fullUrl); if (matchedSession != null) { oS.utilCreateResponseAndBypassServer(); oS.responseBodyBytes = matchedSession.responseBodyBytes; oS.oResponse.headers = (HTTPResponseHeaders)matchedSession.oResponse.headers.Clone(); } }; FiddlerApplication.Startup(8889, false, false); } public static void StopAutoResponding() { if (FiddlerApplication.IsStarted()) FiddlerApplication.Shutdown(); } } }
apache-2.0
C#
f1557c04a1004a72c31133f40c4ce1376ebbcd98
Add all common postfixes.
matkoch/TestLinker,matkoch/TestLinker
src/TestLinker/Options/TestLinkerSettings.cs
src/TestLinker/Options/TestLinkerSettings.cs
// Copyright 2016, 2015, 2014 Matthias Koch // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Linq; using JetBrains.Application.Settings; using JetBrains.ReSharper.UnitTestFramework; namespace TestLinker.Options { [SettingsKey (typeof(UnitTestingSettings), "Settings for TestLinker")] public class TestLinkerSettings { [SettingsEntry (DefaultValue: true, Description: "Use Suffix Search")] public bool EnableSuffixSearch; [SettingsEntry (NamingStyle.Postfix, "Naming style for tests")] public NamingStyle NamingStyle; [SettingsEntry ("Test,Spec,Tests,Specs", "Naming Suffixes")] public string NamingSuffixes; [SettingsEntry (DefaultValue: true, Description: "Use Typeof Search")] public bool EnableTypeofSearch; [SettingsEntry ("SubjectAttribute", "Typeof Attribute")] public string TypeofAttributeName; } }
// Copyright 2016, 2015, 2014 Matthias Koch // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Linq; using JetBrains.Application.Settings; using JetBrains.ReSharper.UnitTestFramework; namespace TestLinker.Options { [SettingsKey (typeof(UnitTestingSettings), "Settings for TestLinker")] public class TestLinkerSettings { [SettingsEntry (DefaultValue: true, Description: "Use Suffix Search")] public bool EnableSuffixSearch; [SettingsEntry (NamingStyle.Postfix, "Naming style for tests")] public NamingStyle NamingStyle; [SettingsEntry ("Test,Spec", "Naming Suffixes")] public string NamingSuffixes; [SettingsEntry (DefaultValue: true, Description: "Use Typeof Search")] public bool EnableTypeofSearch; [SettingsEntry ("SubjectAttribute", "Typeof Attribute")] public string TypeofAttributeName; } }
mit
C#
558f8172e487d62acceca5b87da241bfceb11ea2
Add base uri to tests
extremecodetv/SocksSharp
tests/SocksSharp.Tests/ProxyClientTests.cs
tests/SocksSharp.Tests/ProxyClientTests.cs
using System; using System.Diagnostics; using Microsoft.Extensions.Configuration; using Xunit; using SocksSharp; using SocksSharp.Proxy; namespace SocksSharp.Tests { public class ProxyClientTests { private Uri baseUri = new Uri("http://httpbin.org/"); private ProxySettings proxySettings; private void GatherTestConfiguration() { var appConfigMsgWarning = "{0} not configured in proxysettings.json! Some tests may fail."; var builder = new ConfigurationBuilder() .AddJsonFile("proxysettings.json") .Build(); proxySettings = new ProxySettings(); var host = builder["host"]; if (String.IsNullOrEmpty(host)) { Debug.WriteLine(String.Format(appConfigMsgWarning, nameof(host))); } else { proxySettings.Host = host; } var port = builder["port"]; if (String.IsNullOrEmpty(port)) { Debug.WriteLine(String.Format(appConfigMsgWarning, nameof(port))); } else { proxySettings.Port = Int32.Parse(port); } //TODO: Setup manualy var username = builder["username"]; var password = builder["password"]; } private ProxyClientHandler<Socks5> CreateNewSocks5Client() { if(proxySettings.Host == null || proxySettings.Port == 0) { throw new Exception("Please add your proxy settings to proxysettings.json!"); } return new ProxyClientHandler<Socks5>(proxySettings); } [Fact] public void Test1() { } } }
using System; using System.Diagnostics; using Microsoft.Extensions.Configuration; using Xunit; using SocksSharp; using SocksSharp.Proxy; namespace SocksSharp.Tests { public class ProxyClientTests { private ProxySettings proxySettings; private void GatherTestConfiguration() { var appConfigMsgWarning = "{0} not configured in proxysettings.json! Some tests may fail."; var builder = new ConfigurationBuilder() .AddJsonFile("proxysettings.json") .Build(); proxySettings = new ProxySettings(); var host = builder["host"]; if (String.IsNullOrEmpty(host)) { Debug.WriteLine(String.Format(appConfigMsgWarning, nameof(host))); } else { proxySettings.Host = host; } var port = builder["port"]; if (String.IsNullOrEmpty(port)) { Debug.WriteLine(String.Format(appConfigMsgWarning, nameof(port))); } else { proxySettings.Port = Int32.Parse(port); } //TODO: Setup manualy var username = builder["username"]; var password = builder["password"]; } private ProxyClientHandler<Socks5> CreateNewSocks5Client() { if(proxySettings.Host == null || proxySettings.Port == 0) { throw new Exception("Please add your proxy settings to proxysettings.json!"); } return new ProxyClientHandler<Socks5>(proxySettings); } [Fact] public void Test1() { } } }
mit
C#
5b176aef41d0e403d5a0afdfb50b78cfa8efa785
Apply code review
antonba/azure-sdk-tools,johnkors/azure-sdk-tools,johnkors/azure-sdk-tools,markcowl/azure-sdk-tools,DinoV/azure-sdk-tools,DinoV/azure-sdk-tools,DinoV/azure-sdk-tools,antonba/azure-sdk-tools,markcowl/azure-sdk-tools,antonba/azure-sdk-tools,akromm/azure-sdk-tools,akromm/azure-sdk-tools,akromm/azure-sdk-tools,Madhukarc/azure-sdk-tools,akromm/azure-sdk-tools,markcowl/azure-sdk-tools,markcowl/azure-sdk-tools,johnkors/azure-sdk-tools,antonba/azure-sdk-tools,Madhukarc/azure-sdk-tools,DinoV/azure-sdk-tools,johnkors/azure-sdk-tools,johnkors/azure-sdk-tools,Madhukarc/azure-sdk-tools,Madhukarc/azure-sdk-tools,DinoV/azure-sdk-tools,markcowl/azure-sdk-tools,antonba/azure-sdk-tools,akromm/azure-sdk-tools,Madhukarc/azure-sdk-tools
WindowsAzurePowershell/src/Management.CloudService/PHP/Cmdlet/AddAzurePHPWorkerRole.cs
WindowsAzurePowershell/src/Management.CloudService/PHP/Cmdlet/AddAzurePHPWorkerRole.cs
// ---------------------------------------------------------------------------------- // // Copyright 2011 Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- namespace Microsoft.WindowsAzure.Management.CloudService.PHP.Cmdlet { using System; using System.Management.Automation; using Model; using Properties; /// <summary> /// Create scaffolding for a new PHP worker role, change cscfg file and csdef to include the added worker role /// </summary> [Cmdlet(VerbsCommon.Add, "AzurePHPWorkerRole")] public class AddAzurePHPWorkerRoleCommand : AddRole { internal string AddAzurePHPWorkerRoleProcess(string workerRoleName, int instances, string rootPath) { string result; AzureService service = new AzureService(rootPath, null); RoleInfo workerRole = service.AddWorkerRole(Resources.PHPScaffolding, workerRoleName, instances); try { service.ChangeRolePermissions(workerRole); } catch (UnauthorizedAccessException) { SafeWriteObject(Resources.AddRoleMessageInsufficientPermissions); SafeWriteObject(Environment.NewLine); } result = string.Format(Resources.AddRoleMessageCreate, rootPath, workerRole.Name); return result; } protected override void ProcessRecord() { try { SkipChannelInit = true; base.ProcessRecord(); string result = AddAzurePHPWorkerRoleProcess(Name, Instances, base.GetServiceRootPath()); SafeWriteObject(result); } catch (Exception ex) { SafeWriteError(new ErrorRecord(ex, string.Empty, ErrorCategory.CloseError, null)); } } } }
// ---------------------------------------------------------------------------------- // // Copyright 2011 Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- namespace Microsoft.WindowsAzure.Management.CloudService.PHP.Cmdlet { using System; using System.Management.Automation; using Model; using Properties; /// <summary> /// Create scaffolding for a new PHP worker role, change cscfg file and csdef to include the added worker role /// </summary> [Cmdlet(VerbsCommon.Add, "AzurePHPWorkerRole")] public class AddAzurePHPWorkerRoleCommand : AddRole { internal string AddAzureNodeWorkerRoleProcess(string workerRoleName, int instances, string rootPath) { string result; AzureService service = new AzureService(rootPath, null); RoleInfo workerRole = service.AddWorkerRole(Resources.PHPScaffolding, workerRoleName, instances); try { service.ChangeRolePermissions(workerRole); } catch (UnauthorizedAccessException) { SafeWriteObject(Resources.AddRoleMessageInsufficientPermissions); SafeWriteObject(Environment.NewLine); } result = string.Format(Resources.AddRoleMessageCreate, rootPath, workerRole.Name); return result; } protected override void ProcessRecord() { try { SkipChannelInit = true; base.ProcessRecord(); string result = AddAzureNodeWorkerRoleProcess(Name, Instances, base.GetServiceRootPath()); SafeWriteObject(result); } catch (Exception ex) { SafeWriteError(new ErrorRecord(ex, string.Empty, ErrorCategory.CloseError, null)); } } } }
apache-2.0
C#
4fcbdfa192c9fbde487d276b9368180695d1fc22
Update build.cake
xamarin/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents
iOS/JSQMessagesViewController/build.cake
iOS/JSQMessagesViewController/build.cake
#load "../../common.cake" var TARGET = Argument ("t", Argument ("target", "Default")); var IOS_PODS = new List<string> { "platform :ios, '7.0'", "install! 'cocoapods', :integrate_targets => false", "target 'Xamarin' do", "pod 'JSQMessagesViewController', '7.3.5'", "end", }; var buildSpec = new BuildSpec () { Libs = new ISolutionBuilder [] { new DefaultSolutionBuilder { SolutionPath = "./source/JSQMessagesViewController/JSQMessagesViewController.sln", Configuration = "Release", BuildsOn = BuildPlatforms.Mac, OutputFiles = new [] { new OutputFileCopy { FromFile = "./source/JSQMessagesViewController/bin/Release/JSQMessagesViewController.dll", ToDirectory = "./output/unified/" }, } }, }, Samples = new ISolutionBuilder [] { new IOSSolutionBuilder { SolutionPath = "./samples/XamarinChat.sln", Configuration = "Release", Platform="iPhone", BuildsOn = BuildPlatforms.Mac }, new IOSSolutionBuilder { SolutionPath = "./samples/PatriotConversation.sln", Configuration = "Release", Platform="iPhone", BuildsOn = BuildPlatforms.Mac }, }, NuGets = new [] { new NuGetInfo { NuSpec = "./nuget/Xamarin.JSQMessagesViewController.nuspec" }, }, Components = new [] { new Component {ManifestDirectory = "./component", BuildsOn = BuildPlatforms.Mac}, }, }; Task ("externals").IsDependentOn ("externals-base").Does (() => { RunMake ("./externals/", "all"); }); Task ("clean").IsDependentOn ("clean-base").Does (() => { RunMake ("./externals/", "clean"); }); SetupXamarinBuildTasks (buildSpec, Tasks, Task); RunTarget (TARGET);
#load "../../common.cake" var TARGET = Argument ("t", Argument ("target", "Default")); var IOS_PODS = new List<string> { "platform :ios, '7.0'", "install! 'cocoapods', :integrate_targets => false", "target 'Xamarin' do", "pod 'JSQMessagesViewController', '~> 7.3'", "end", }; var buildSpec = new BuildSpec () { Libs = new ISolutionBuilder [] { new DefaultSolutionBuilder { SolutionPath = "./source/JSQMessagesViewController/JSQMessagesViewController.sln", Configuration = "Release", BuildsOn = BuildPlatforms.Mac, OutputFiles = new [] { new OutputFileCopy { FromFile = "./source/JSQMessagesViewController/bin/Release/JSQMessagesViewController.dll", ToDirectory = "./output/unified/" }, } }, }, Samples = new ISolutionBuilder [] { new IOSSolutionBuilder { SolutionPath = "./samples/XamarinChat.sln", Configuration = "Release", Platform="iPhone", BuildsOn = BuildPlatforms.Mac }, new IOSSolutionBuilder { SolutionPath = "./samples/PatriotConversation.sln", Configuration = "Release", Platform="iPhone", BuildsOn = BuildPlatforms.Mac }, }, NuGets = new [] { new NuGetInfo { NuSpec = "./nuget/Xamarin.JSQMessagesViewController.nuspec" }, }, Components = new [] { new Component {ManifestDirectory = "./component", BuildsOn = BuildPlatforms.Mac}, }, }; Task ("externals").IsDependentOn ("externals-base").Does (() => { RunMake ("./externals/", "all"); }); Task ("clean").IsDependentOn ("clean-base").Does (() => { RunMake ("./externals/", "clean"); }); SetupXamarinBuildTasks (buildSpec, Tasks, Task); RunTarget (TARGET);
mit
C#
cab75b4de0a28a59043ee989b6e0f6ebbde50d44
Check Azure configuration more carefully. Add contracts for some base classes. Fix ExportOrder.
wasabii/Cogito,wasabii/Cogito
Cogito.Composition/ExportOrderAttribute.cs
Cogito.Composition/ExportOrderAttribute.cs
using System; using System.ComponentModel.Composition; namespace Cogito.Composition { /// <summary> /// Attaches an Order metadata property to the export. /// </summary> [MetadataAttribute] public class ExportOrderAttribute : Attribute, IOrderedExportMetadata { /// <summary> /// Initializes a new instance. /// </summary> /// <param name="order"></param> /// <returns></returns> public ExportOrderAttribute(int order) { Order = order; } public int Order { get; set; } } }
using System; using System.ComponentModel.Composition; namespace Cogito.Composition { /// <summary> /// Attaches an Order metadata property to the export. /// </summary> [MetadataAttribute] public class ExportOrderAttribute : Attribute { readonly int order; /// <summary> /// Initializes a new instance. /// </summary> /// <param name="order"></param> /// <returns></returns> public ExportOrderAttribute(int order) { Priority = order; } public int Priority { get; set; } } }
mit
C#
4b440f427cc238b49f794a71b4e3d586f410d83b
increase wait times
bitrise-io/sample-apps-xamarin-android,bitrise-io/sample-apps-xamarin-android
CreditCardValidator.Droid.UITests/Tests.cs
CreditCardValidator.Droid.UITests/Tests.cs
using System; using System.IO; using System.Linq; using System.Reflection; using NUnit.Framework; using Xamarin.UITest; using Xamarin.UITest.Android; using Xamarin.UITest.Queries; using Xamarin.UITest.Utils; namespace CreditCardValidator.Droid.UITests { // Android emulators are slow, give some time for test. public class WaitTimes : IWaitTimes { public TimeSpan GestureWaitTimeout { get { return TimeSpan.FromMinutes(5); } } public TimeSpan WaitForTimeout { get { return TimeSpan.FromMinutes(5); } } } [TestFixture] public class Tests { [SetUp] public void BeforeEachTest() { string apkPath = Environment.GetEnvironmentVariable ("ANDROID_APK_PATH"); if (apkPath != null && apkPath != "") { // In case of Bitrise step: steps-xamarin-uitest ConfigureApp .Android .ApkFile (apkPath) .WaitTimes(new WaitTimes()) .StartApp (); } else { // In case of Bitrise step: steps-xamarin-testcloud ConfigureApp .Android .WaitTimes(new WaitTimes()) .StartApp (); } } [Test] public void AssertTrue() { Assert.True (true); } } }
using System; using System.IO; using System.Linq; using System.Reflection; using NUnit.Framework; using Xamarin.UITest; using Xamarin.UITest.Android; using Xamarin.UITest.Queries; using Xamarin.UITest.Utils; namespace CreditCardValidator.Droid.UITests { [TestFixture] public class Tests { [SetUp] public void BeforeEachTest() { string apkPath = Environment.GetEnvironmentVariable ("ANDROID_APK_PATH"); if (apkPath != null && apkPath != "") { // In case of Bitrise step: steps-xamarin-uitest ConfigureApp .Android .ApkFile (apkPath) .StartApp (); } else { // In case of Bitrise step: steps-xamarin-testcloud ConfigureApp .Android .StartApp (); } } [Test] public void AssertTrue() { Assert.True (true); } } }
mit
C#
988a11fa8cbe4998f678f957af6516ee93faef6d
Add unit test for empty timezone
amweiss/dark-sky-core
test/UnitTests/LongExtensionsUnitTests.cs
test/UnitTests/LongExtensionsUnitTests.cs
namespace DarkSky.UnitTests.Extensions { using System; using NodaTime; using Xunit; using static DarkSky.Extensions.LongExtensions; public class LongExtensionsUnitTests { public static System.Collections.Generic.IEnumerable<object[]> GetDateTimeOffsets() { yield return new object[] { DateTimeOffset.MinValue, "UTC" }; yield return new object[] { DateTimeOffset.MaxValue, "UTC" }; yield return new object[] { new DateTimeOffset(2017, 1, 1, 1, 0, 0, new TimeSpan(0)), "UTC" }; yield return new object[] { new ZonedDateTime(Instant.FromUnixTimeSeconds(1499435235), DateTimeZoneProviders.Tzdb["America/New_York"]).ToDateTimeOffset(), "America/New_York" }; yield return new object[] { new ZonedDateTime(Instant.FromUnixTimeSeconds(1499435235), DateTimeZoneProviders.Tzdb["America/New_York"]).ToDateTimeOffset(), string.Empty }; yield return new object[] { new ZonedDateTime(Instant.FromUnixTimeSeconds(1499435235), DateTimeZoneProviders.Tzdb["America/New_York"]).ToDateTimeOffset(), null }; } [Theory] [MemberData(nameof(GetDateTimeOffsets))] public void CorrectConversionTest(DateTimeOffset date, string timezone) { // Truncate milliseconds since we don't use them for the UNIX timestamps. var dateTimeOffset = date.AddTicks(-(date.Ticks % TimeSpan.TicksPerSecond)); var convertedDate = dateTimeOffset.ToUnixTimeSeconds().ToDateTimeOffsetFromUnixTimestamp(timezone); Assert.Equal(dateTimeOffset, convertedDate); } } }
namespace DarkSky.UnitTests.Extensions { using System; using NodaTime; using Xunit; using static DarkSky.Extensions.LongExtensions; public class LongExtensionsUnitTests { public static System.Collections.Generic.IEnumerable<object[]> GetDateTimeOffsets() { yield return new object[] { DateTimeOffset.MinValue, "UTC" }; yield return new object[] { DateTimeOffset.MaxValue, "UTC" }; yield return new object[] { new DateTimeOffset(2017, 1, 1, 1, 0, 0, new TimeSpan(0)), "UTC" }; yield return new object[] { new ZonedDateTime(Instant.FromUnixTimeSeconds(1499435235), DateTimeZoneProviders.Tzdb["America/New_York"]).ToDateTimeOffset(), "America/New_York" }; } [Theory] [MemberData(nameof(GetDateTimeOffsets))] public void CorrectConversionTest(DateTimeOffset date, string timezone) { // Truncate milliseconds since we don't use them for the UNIX timestamps. var dateTimeOffset = date.AddTicks(-(date.Ticks % TimeSpan.TicksPerSecond)); var convertedDate = dateTimeOffset.ToUnixTimeSeconds().ToDateTimeOffsetFromUnixTimestamp(timezone); Assert.Equal(dateTimeOffset, convertedDate); } } }
mit
C#
7dfc65dacf5e9c8c1902a7a11587f14ab6779ee7
revert bad commit
mixpanel/mixpanel-unity
Mixpanel/Editor/MixpanelSettingsEditor.cs
Mixpanel/Editor/MixpanelSettingsEditor.cs
using UnityEditor; namespace mixpanel.editor { internal class MixpanelSettingsEditor { [SettingsProvider] internal static SettingsProvider CreateCustomSettingsProvider() { // First parameter is the path in the Settings window. // Second parameter is the scope of this setting: it only appears in the Project Settings window. var provider = new SettingsProvider("Project/Mixpanel", SettingsScope.Project) { // Create the SettingsProvider and initialize its drawing (IMGUI) function in place: guiHandler = (searchContext) => { Editor.CreateEditor(MixpanelSettings.Instance).OnInspectorGUI(); }, // Populate the search keywords to enable smart search filtering and label highlighting: keywords = SettingsProvider.GetSearchKeywordsFromSerializedObject(new SerializedObject(MixpanelSettings.Instance)) }; return provider; } } }
using UnityEditor; namespace mixpanel.editor { internal class MixpanelSettingsEditor { [SettingsProvider] internal static SettingsProvider CreateCustomSettingsProvider() { // First parameter is the path in the Settings window. // Second parameter is the scope of this setting: it only appears in the Project Settings window. var provider = new SettingsProvider("Project/Mixpanel", SettingsScope.Project); { // Create the SettingsProvider and initialize its drawing (IMGUI) function in place: guiHandler = (searchContext) => { Editor.CreateEditor(MixpanelSettings.Instance).OnInspectorGUI(); }, // Populate the search keywords to enable smart search filtering and label highlighting: keywords = SettingsProvider.GetSearchKeywordsFromSerializedObject(new SerializedObject(MixpanelSettings.Instance)) }; return provider; } } }
apache-2.0
C#
82ad0c71469f174df1d4fb99f7535206b26e0478
Remove unused method
sethreno/schemazen,sethreno/schemazen
Test/Helpers/TestHelper.cs
Test/Helpers/TestHelper.cs
using System.Data.SqlClient; using SchemaZen.Library; namespace SchemaZen.Tests; public class TestHelper { public static bool EchoSql => true; public static void ExecSql(string sql, string dbName) { if (EchoSql) Console.WriteLine(sql); using (var cn = new SqlConnection(ConfigHelper.TestDB)) { if (!string.IsNullOrEmpty(dbName)) cn.ConnectionString = GetConnString(dbName); cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = sql; cm.ExecuteNonQuery(); } } } public static void ExecBatchSql(string sql, string dbName) { DBHelper.ExecBatchSql(GetConnString(dbName), sql); } public static string GetConnString(string dbName) { var connString = ""; using (var cn = new SqlConnection(ConfigHelper.TestDB)) { connString = cn.ConnectionString; if (!string.IsNullOrEmpty(dbName)) connString = cn.ConnectionString.Replace("database=" + cn.Database, "database=" + dbName); } return connString; } public static void DropDb(string dbName) { if (DbExists(dbName)) { ExecSql("ALTER DATABASE " + dbName + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE", ""); ExecSql("drop database " + dbName, ""); ClearPool(dbName); } } public static bool DbExists(string dbName) { var exists = false; using (var cn = new SqlConnection(ConfigHelper.TestDB)) { cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = "select db_id('" + dbName + "')"; exists = !ReferenceEquals(cm.ExecuteScalar(), DBNull.Value); } } return exists; } public static void ClearPool(string dbName) { using (var cn = new SqlConnection(GetConnString(dbName))) { SqlConnection.ClearPool(cn); } } }
using System.Data.SqlClient; using SchemaZen.Library; namespace SchemaZen.Tests; public class TestHelper { public static bool EchoSql => true; public void SetUp() { var conn = GetConnString("TESTDB"); DBHelper.DropDb(conn); DBHelper.CreateDb(conn); SqlConnection.ClearAllPools(); // TODO: verify that database called "model" is empty, otherwise tests will fail because new databases are created with this as a template } public static void ExecSql(string sql, string dbName) { if (EchoSql) Console.WriteLine(sql); using (var cn = new SqlConnection(ConfigHelper.TestDB)) { if (!string.IsNullOrEmpty(dbName)) cn.ConnectionString = GetConnString(dbName); cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = sql; cm.ExecuteNonQuery(); } } } public static void ExecBatchSql(string sql, string dbName) { DBHelper.ExecBatchSql(GetConnString(dbName), sql); } public static string GetConnString(string dbName) { var connString = ""; using (var cn = new SqlConnection(ConfigHelper.TestDB)) { connString = cn.ConnectionString; if (!string.IsNullOrEmpty(dbName)) connString = cn.ConnectionString.Replace("database=" + cn.Database, "database=" + dbName); } return connString; } public static void DropDb(string dbName) { if (DbExists(dbName)) { ExecSql("ALTER DATABASE " + dbName + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE", ""); ExecSql("drop database " + dbName, ""); ClearPool(dbName); } } public static bool DbExists(string dbName) { var exists = false; using (var cn = new SqlConnection(ConfigHelper.TestDB)) { cn.Open(); using (var cm = cn.CreateCommand()) { cm.CommandText = "select db_id('" + dbName + "')"; exists = !ReferenceEquals(cm.ExecuteScalar(), DBNull.Value); } } return exists; } public static void ClearPool(string dbName) { using (var cn = new SqlConnection(GetConnString(dbName))) { SqlConnection.ClearPool(cn); } } }
mit
C#
994979f4adadc8269281dc576382199659fe83ea
Fix SonarCloud issue
awaescher/RepoZ,awaescher/RepoZ
grr/Messages/Filters/IndexMessageFilter.cs
grr/Messages/Filters/IndexMessageFilter.cs
using grr.History; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace grr.Messages.Filters { public class IndexMessageFilter : IMessageFilter { private readonly IHistoryRepository _historyRepository; public IndexMessageFilter(IHistoryRepository historyRepository) { _historyRepository = historyRepository ?? throw new ArgumentNullException(nameof(historyRepository)); } public void Filter(RepositoryFilterOptions filter) { if (filter?.RepositoryFilter == null) return; if (filter.RepositoryFilter.StartsWith(":")) { string rest = filter.RepositoryFilter.Substring(1); if (int.TryParse(rest, out int index)) { index--; // the index visible to the user are 1-based, not 0-based var state = _historyRepository.Load(); if (index >= 0 && state.LastRepositories.Length > index) filter.RepositoryFilter = state.LastRepositories[index]?.Name ?? filter.RepositoryFilter; } } } } }
using grr.History; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace grr.Messages.Filters { public class IndexMessageFilter : IMessageFilter { private readonly IHistoryRepository _historyRepository; public IndexMessageFilter(IHistoryRepository historyRepository) { _historyRepository = historyRepository ?? throw new ArgumentNullException(nameof(historyRepository)); } public void Filter(RepositoryFilterOptions filter) { string filterValue = filter?.RepositoryFilter ?? ""; if (filterValue.StartsWith(":")) { string rest = filterValue.Substring(1); if (int.TryParse(rest, out int index)) { index--; // the index visible to the user are 1-based, not 0-based var state = _historyRepository.Load(); if (index >= 0 && state.LastRepositories.Length > index) filter.RepositoryFilter = state.LastRepositories[index]?.Name ?? filterValue; } } } } }
mit
C#
6ee1ca21f88931c68389630045e8777d82d267d0
Make sure conection is encrypted (throw if not)
nE0sIghT/SyslogNet,emertechie/SyslogNet,YallaDotNet/syslog
SyslogNet.Client/Transport/SyslogEncryptedTcpSender.cs
SyslogNet.Client/Transport/SyslogEncryptedTcpSender.cs
using System; using System.Net.Security; using System.Net.Sockets; using System.Security; using System.Security.Cryptography.X509Certificates; using SyslogNet.Client.Serialization; namespace SyslogNet.Client.Transport { public class SyslogEncryptedTcpSender : ISyslogMessageSender, IDisposable { private readonly TcpClient tcpClient; private readonly SslStream sslStream; public SyslogEncryptedTcpSender(string hostname, int port) { try { tcpClient = new TcpClient(hostname, port); sslStream = new SslStream(tcpClient.GetStream(), false, ValidateServerCertificate); sslStream.AuthenticateAsClient(hostname); if (!sslStream.IsEncrypted) throw new SecurityException("Could not establish an encrypted connection"); } catch { if (tcpClient != null) ((IDisposable)tcpClient).Dispose(); if (sslStream != null) sslStream.Dispose(); throw; } } public void Send(SyslogMessage message, ISyslogMessageSerializer serializer) { byte[] datagramBytes = serializer.Serialize(message); sslStream.Write(datagramBytes, 0, datagramBytes.Length); sslStream.Flush(); } // Quick and nasty way to avoid logging framework dependency public static Action<string> CertificateErrorHandler = err => { }; public void Dispose() { tcpClient.Close(); sslStream.Close(); ((IDisposable)tcpClient).Dispose(); sslStream.Dispose(); } private static bool ValidateServerCertificate( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { if (sslPolicyErrors == SslPolicyErrors.None) return true; CertificateErrorHandler(String.Format("Certificate error: {0}", sslPolicyErrors)); return false; } } }
using System; using System.Net.Security; using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; using SyslogNet.Client.Serialization; namespace SyslogNet.Client.Transport { public class SyslogEncryptedTcpSender : ISyslogMessageSender, IDisposable { private readonly TcpClient tcpClient; private readonly SslStream sslStream; public SyslogEncryptedTcpSender(string hostname, int port) { try { tcpClient = new TcpClient(hostname, port); sslStream = new SslStream(tcpClient.GetStream(), false, ValidateServerCertificate); sslStream.AuthenticateAsClient(hostname); } catch { if (tcpClient != null) ((IDisposable)tcpClient).Dispose(); if (sslStream != null) sslStream.Dispose(); throw; } } public void Send(SyslogMessage message, ISyslogMessageSerializer serializer) { byte[] datagramBytes = serializer.Serialize(message); sslStream.Write(datagramBytes, 0, datagramBytes.Length); sslStream.Flush(); } // Quick and nasty way to avoid logging framework dependency public static Action<string> CertificateErrorHandler = err => { }; public void Dispose() { tcpClient.Close(); sslStream.Close(); ((IDisposable)tcpClient).Dispose(); sslStream.Dispose(); } private static bool ValidateServerCertificate( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { if (sslPolicyErrors == SslPolicyErrors.None) return true; CertificateErrorHandler(String.Format("Certificate error: {0}", sslPolicyErrors)); return false; } } }
mit
C#