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 |
|---|---|---|---|---|---|---|---|---|
fc41e893302531bee85e2409f581e24e69eb7165 | Set version to RC. | yurko7/math-expression | math-expression/Properties/AssemblyInfo.cs | math-expression/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("math-expression")]
[assembly: AssemblyDescription("Simple compiler of mathematical expressions.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Yuriy Kushnir")]
[assembly: AssemblyProduct("math-expression")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a589158d-4bac-47e2-b5dd-476c5dcb5b67")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly:AssemblyInformationalVersion("1.0.0.0-rc")]
| 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("math-expression")]
[assembly: AssemblyDescription("Simple compiler of mathematical expressions.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Yuriy Kushnir")]
[assembly: AssemblyProduct("math-expression")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a589158d-4bac-47e2-b5dd-476c5dcb5b67")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
580125f1a9b7b185ce8be5a278cdfcb515a926f0 | Update IllegalStreamException.cs | stephanstapel/ZUGFeRD-csharp,stephanstapel/ZUGFeRD-csharp | ZUGFeRD/IllegalStreamException.cs | ZUGFeRD/IllegalStreamException.cs | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace s2industries.ZUGFeRD
{
public class IllegalStreamException : Exception
{
public IllegalStreamException(string message = "")
: base(message)
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace s2industries.ZUGFeRD
{
public class IllegalStreamException : Exception
{
public IllegalStreamException(string message = "")
: base(message)
{
}
}
}
| apache-2.0 | C# |
3d81a5c8d649f8aaa779439c7aafbdc5517a0b5e | Add DotNetNativeWorkaround | killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity | Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealityUtilities.cs | Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealityUtilities.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#if WINDOWS_UWP
#if ENABLE_DOTNET
using System;
#endif // ENABLE_DOTNET
using System.Runtime.InteropServices;
using UnityEngine.XR.WSA;
using Windows.Perception.Spatial;
#endif // WINDOWS_UWP
namespace Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input
{
public static class WindowsMixedRealityUtilities
{
#if WINDOWS_UWP
#if ENABLE_DOTNET
[DllImport("DotNetNativeWorkaround.dll", EntryPoint = "MarshalIInspectable")]
private static extern void GetSpatialCoordinateSystem(IntPtr nativePtr, out SpatialCoordinateSystem coordinateSystem);
public static SpatialCoordinateSystem SpatialCoordinateSystem => spatialCoordinateSystem ?? (spatialCoordinateSystem = GetSpatialCoordinateSystem(WorldManager.GetNativeISpatialCoordinateSystemPtr()));
/// <summary>
/// Helps marshal WinRT IInspectable objects that have been passed to managed code as an IntPtr.
/// On .NET Native, IInspectable pointers cannot be marshaled from native to managed code using Marshal.GetObjectForIUnknown.
/// This class calls into a native method that specifically marshals the type as a specific WinRT interface, which
/// is supported by the marshaller on both .NET Core and .NET Native.
/// </summary>
private static SpatialCoordinateSystem GetSpatialCoordinateSystem(IntPtr nativePtr)
{
try
{
GetSpatialCoordinateSystem(nativePtr, out SpatialCoordinateSystem coordinateSystem);
return coordinateSystem;
}
catch
{
UnityEngine.Debug.LogError("Call to the DotNetNativeWorkaround plug-in failed. The plug-in is required for correct behavior when using .NET Native compilation");
return Marshal.GetObjectForIUnknown(nativePtr) as SpatialCoordinateSystem;
}
}
#else
public static SpatialCoordinateSystem SpatialCoordinateSystem => spatialCoordinateSystem ?? (spatialCoordinateSystem = Marshal.GetObjectForIUnknown(WorldManager.GetNativeISpatialCoordinateSystemPtr()) as SpatialCoordinateSystem);
#endif
private static SpatialCoordinateSystem spatialCoordinateSystem = null;
#endif // WINDOWS_UWP
public static UnityEngine.Vector3 SystemVector3ToUnity(System.Numerics.Vector3 vector)
{
return new UnityEngine.Vector3(vector.X, vector.Y, -vector.Z);
}
public static UnityEngine.Quaternion SystemQuaternionToUnity(System.Numerics.Quaternion quaternion)
{
return new UnityEngine.Quaternion(-quaternion.X, -quaternion.Y, quaternion.Z, quaternion.W);
}
}
} | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#if WINDOWS_UWP
using System.Runtime.InteropServices;
using UnityEngine.XR.WSA;
using Windows.Perception.Spatial;
#endif // WINDOWS_UWP
namespace Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input
{
public static class WindowsMixedRealityUtilities
{
#if WINDOWS_UWP
public static SpatialCoordinateSystem SpatialCoordinateSystem => spatialCoordinateSystem ?? (spatialCoordinateSystem = Marshal.GetObjectForIUnknown(WorldManager.GetNativeISpatialCoordinateSystemPtr()) as SpatialCoordinateSystem);
private static SpatialCoordinateSystem spatialCoordinateSystem = null;
#endif // WINDOWS_UWP
public static UnityEngine.Vector3 SystemVector3ToUnity(System.Numerics.Vector3 vector)
{
return new UnityEngine.Vector3(vector.X, vector.Y, -vector.Z);
}
public static UnityEngine.Quaternion SystemQuaternionToUnity(System.Numerics.Quaternion quaternion)
{
return new UnityEngine.Quaternion(-quaternion.X, -quaternion.Y, quaternion.Z, quaternion.W);
}
}
} | mit | C# |
a2a831a55f54159379f237ee65a773535a92f8c7 | Fix order of mouse effects and remove obsolete Custom effect. | danpierce1/Colore,CoraleStudios/Colore,WolfspiritM/Colore | Corale.Colore/Razer/Mouse/Effects/Effect.cs | Corale.Colore/Razer/Mouse/Effects/Effect.cs | // ---------------------------------------------------------------------------------------
// <copyright file="Effect.cs" company="Corale">
// Copyright © 2015 by Adam Hellberg and Brandon Scott.
//
// 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.
//
// Disclaimer: Corale and/or Colore is in no way affiliated with Razer and/or any
// of its employees and/or licensors. Corale, Adam Hellberg, and/or Brandon Scott
// do not take responsibility for any harm caused, direct or indirect, to any
// Razer peripherals via the use of Colore.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
// ---------------------------------------------------------------------------------------
namespace Corale.Colore.Razer.Mouse.Effects
{
using Corale.Colore.Annotations;
/// <summary>
/// Supported built-in mouse effects.
/// </summary>
public enum Effect
{
/// <summary>
/// No effect.
/// </summary>
[PublicAPI]
None = 0,
/// <summary>
/// Static color effect.
/// </summary>
[PublicAPI]
Static,
/// <summary>
/// Blinking effect.
/// </summary>
[PublicAPI]
Blinking,
/// <summary>
/// The breathing effect.
/// </summary>
[PublicAPI]
Breathing,
/// <summary>
/// The spectrum cycling effect.
/// </summary>
[PublicAPI]
SpectrumCycling,
/// <summary>
/// Invalid effect.
/// </summary>
[PublicAPI]
Invalid
}
}
| // ---------------------------------------------------------------------------------------
// <copyright file="Effect.cs" company="Corale">
// Copyright © 2015 by Adam Hellberg and Brandon Scott.
//
// 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.
//
// Disclaimer: Corale and/or Colore is in no way affiliated with Razer and/or any
// of its employees and/or licensors. Corale, Adam Hellberg, and/or Brandon Scott
// do not take responsibility for any harm caused, direct or indirect, to any
// Razer peripherals via the use of Colore.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
// ---------------------------------------------------------------------------------------
namespace Corale.Colore.Razer.Mouse.Effects
{
using Corale.Colore.Annotations;
/// <summary>
/// Supported built-in mouse effects.
/// </summary>
public enum Effect
{
/// <summary>
/// No effect.
/// </summary>
[PublicAPI]
None = 0,
/// <summary>
/// The spectrum cycling effect.
/// </summary>
[PublicAPI]
SpectrumCycling,
/// <summary>
/// The breathing effect.
/// </summary>
[PublicAPI]
Breathing,
/// <summary>
/// Static color effect.
/// </summary>
[PublicAPI]
Static,
/// <summary>
/// Custom effect.
/// </summary>
[PublicAPI]
Custom,
/// <summary>
/// Invalid effect.
/// </summary>
[PublicAPI]
Invalid
}
}
| mit | C# |
208ee608bc660507879637cc5ab2895648c5e308 | Update HomeController.cs | NanoMania/GitRepoVisualStudio,NanoMania/GitRepoVisualStudio | GitTutorialVS/Controllers/HomeController.cs | GitTutorialVS/Controllers/HomeController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace GitTutorialVS.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
//edited on git hub
//edited on git hub
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace GitTutorialVS.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
//edited on git hub
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
}
| mit | C# |
fd61689a0f0fd28c2fa3cd877ef0661b072ac40b | Make RowsListener sealed. | JohanLarsson/Gu.Wpf.DataGrid2D,mennowo/Gu.Wpf.DataGrid2D | Gu.Wpf.DataGrid2D/Internals/RowsListener.cs | Gu.Wpf.DataGrid2D/Internals/RowsListener.cs | namespace Gu.Wpf.DataGrid2D
{
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
internal sealed class RowsListener : IDisposable
{
private static readonly RoutedEventArgs RowsChangedEventArgs = new RoutedEventArgs(Events.RowsChangedEvent);
private readonly DataGrid dataGrid;
private bool disposed;
public RowsListener(DataGrid dataGrid)
{
this.dataGrid = dataGrid;
////dataGrid.ItemContainerGenerator.ItemsChanged += this.OnItemsChanged;
dataGrid.ItemContainerGenerator.StatusChanged += this.OnStatusChanged;
}
public void Dispose()
{
if (this.disposed)
{
return;
}
this.disposed = true;
////this.dataGrid.ItemContainerGenerator.ItemsChanged -= this.OnItemsChanged;
this.dataGrid.ItemContainerGenerator.StatusChanged -= this.OnStatusChanged;
}
////private void OnItemsChanged(object sender, ItemsChangedEventArgs e)
////{
//// this.dataGrid.RaiseEvent(RowsChangedEventArgs);
////}
private void OnStatusChanged(object o, EventArgs e)
{
var generator = (ItemContainerGenerator)o;
if (generator.Status == GeneratorStatus.ContainersGenerated)
{
this.dataGrid.RaiseEvent(RowsChangedEventArgs);
}
}
}
}
| namespace Gu.Wpf.DataGrid2D
{
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
internal class RowsListener : IDisposable
{
private static readonly RoutedEventArgs RowsChangedEventArgs = new RoutedEventArgs(Events.RowsChangedEvent);
private readonly DataGrid dataGrid;
private bool disposed;
public RowsListener(DataGrid dataGrid)
{
this.dataGrid = dataGrid;
////dataGrid.ItemContainerGenerator.ItemsChanged += this.OnItemsChanged;
dataGrid.ItemContainerGenerator.StatusChanged += this.OnStatusChanged;
}
public void Dispose()
{
if (this.disposed)
{
return;
}
this.disposed = true;
////this.dataGrid.ItemContainerGenerator.ItemsChanged -= this.OnItemsChanged;
this.dataGrid.ItemContainerGenerator.StatusChanged -= this.OnStatusChanged;
}
////private void OnItemsChanged(object sender, ItemsChangedEventArgs e)
////{
//// this.dataGrid.RaiseEvent(RowsChangedEventArgs);
////}
private void OnStatusChanged(object o, EventArgs e)
{
var generator = (ItemContainerGenerator)o;
if (generator.Status == GeneratorStatus.ContainersGenerated)
{
this.dataGrid.RaiseEvent(RowsChangedEventArgs);
}
}
}
} | mit | C# |
a4081acd2d77349530f741d88e4ab4e520d9037a | Fix logging of the notification message (#10321) | stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2 | src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs | src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs | using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.Extensions.Logging;
namespace OrchardCore.DisplayManagement.Notify
{
public class Notifier : INotifier
{
private readonly IList<NotifyEntry> _entries;
private readonly ILogger _logger;
public Notifier(ILogger<Notifier> logger)
{
_entries = new List<NotifyEntry>();
_logger = logger;
}
[Obsolete("This method will be removed in a later version. Use AddAsync()")]
// TODO The implementation for this is provided as an interface default implementation
// when the interface method is removed, replace this with AddAsync.
public void Add(NotifyType type, LocalizedHtmlString message)
{
if (_logger.IsEnabled(LogLevel.Information))
{
_logger.LogInformation("Notification '{NotificationType}' with message '{NotificationMessage}'", type, message.Value);
}
_entries.Add(new NotifyEntry { Type = type, Message = message });
}
public IList<NotifyEntry> List()
{
return _entries;
}
}
}
| using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.Extensions.Logging;
namespace OrchardCore.DisplayManagement.Notify
{
public class Notifier : INotifier
{
private readonly IList<NotifyEntry> _entries;
private readonly ILogger _logger;
public Notifier(ILogger<Notifier> logger)
{
_entries = new List<NotifyEntry>();
_logger = logger;
}
[Obsolete("This method will be removed in a later version. Use AddAsync()")]
// TODO The implementation for this is provided as an interface default implementation
// when the interface method is removed, replace this with AddAsync.
public void Add(NotifyType type, LocalizedHtmlString message)
{
if (_logger.IsEnabled(LogLevel.Information))
{
_logger.LogInformation("Notification '{NotificationType}' with message '{NotificationMessage}'", type, message);
}
_entries.Add(new NotifyEntry { Type = type, Message = message });
}
public IList<NotifyEntry> List()
{
return _entries;
}
}
}
| bsd-3-clause | C# |
a01fddf422fa03e3054837bc52393635a7b9537c | Fix null reference in XmlCommentsModelFilter (fixes #100) | domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Swashbuckle.AspNetCore,oconics/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Ahoy,domaindrivendev/Ahoy,oconics/Ahoy | src/Swashbuckle.SwaggerGen/Annotations/XmlCommentsModelFilter.cs | src/Swashbuckle.SwaggerGen/Annotations/XmlCommentsModelFilter.cs | using System.Xml.XPath;
using System.Reflection;
using Swashbuckle.SwaggerGen.Generator;
using Swashbuckle.Swagger.Model;
namespace Swashbuckle.SwaggerGen.Annotations
{
public class XmlCommentsModelFilter : IModelFilter
{
private const string MemberXPath = "/doc/members/member[@name='{0}']";
private const string SummaryTag = "summary";
private readonly XPathNavigator _xmlNavigator;
public XmlCommentsModelFilter(XPathDocument xmlDoc)
{
_xmlNavigator = xmlDoc.CreateNavigator();
}
public void Apply(Schema model, ModelFilterContext context)
{
var commentId = XmlCommentsIdHelper.GetCommentIdForType(context.SystemType);
var typeNode = _xmlNavigator.SelectSingleNode(string.Format(MemberXPath, commentId));
if (typeNode != null)
{
var summaryNode = typeNode.SelectSingleNode(SummaryTag);
if (summaryNode != null)
model.Description = summaryNode.ExtractContent();
}
foreach (var entry in model.Properties)
{
var jsonProperty = context.JsonObjectContract.Properties[entry.Key];
if (jsonProperty == null) continue;
var propertyInfo = context.JsonObjectContract.UnderlyingType.GetProperty(jsonProperty.UnderlyingName);
if (propertyInfo != null)
{
ApplyPropertyComments(entry.Value, propertyInfo);
}
}
}
private void ApplyPropertyComments(Schema propertySchema, PropertyInfo propertyInfo)
{
var commentId = XmlCommentsIdHelper.GetCommentIdForProperty(propertyInfo);
var propertyNode = _xmlNavigator.SelectSingleNode(string.Format(MemberXPath, commentId));
if (propertyNode == null) return;
var summaryNode = propertyNode.SelectSingleNode(SummaryTag);
if (summaryNode != null)
{
propertySchema.Description = summaryNode.ExtractContent();
}
}
}
}
| using System.Xml.XPath;
using System.Reflection;
using Swashbuckle.SwaggerGen.Generator;
using Swashbuckle.Swagger.Model;
namespace Swashbuckle.SwaggerGen.Annotations
{
public class XmlCommentsModelFilter : IModelFilter
{
private const string MemberXPath = "/doc/members/member[@name='{0}']";
private const string SummaryTag = "summary";
private readonly XPathNavigator _xmlNavigator;
public XmlCommentsModelFilter(XPathDocument xmlDoc)
{
_xmlNavigator = xmlDoc.CreateNavigator();
}
public void Apply(Schema model, ModelFilterContext context)
{
var commentId = XmlCommentsIdHelper.GetCommentIdForType(context.SystemType);
var typeNode = _xmlNavigator.SelectSingleNode(string.Format(MemberXPath, commentId));
if (typeNode != null)
{
var summaryNode = typeNode.SelectSingleNode(SummaryTag);
if (summaryNode != null)
model.Description = summaryNode.ExtractContent();
}
foreach (var entry in model.Properties)
{
var jsonProperty = context.JsonObjectContract.Properties[entry.Key];
if (jsonProperty == null) continue;
ApplyPropertyComments(entry.Value, jsonProperty.PropertyInfo());
}
}
private void ApplyPropertyComments(Schema propertySchema, PropertyInfo propertyInfo)
{
var commentId = XmlCommentsIdHelper.GetCommentIdForProperty(propertyInfo);
var propertyNode = _xmlNavigator.SelectSingleNode(string.Format(MemberXPath, commentId));
if (propertyNode == null) return;
var summaryNode = propertyNode.SelectSingleNode(SummaryTag);
if (summaryNode != null)
{
propertySchema.Description = summaryNode.ExtractContent();
}
}
}
} | mit | C# |
3cfc1c13a0e51bc16f4086a14910155294f86e4a | Increment assembly version | alex-buraykin/E3Series.Wrapper | E3Series.Wrapper/Properties/AssemblyInfo.cs | E3Series.Wrapper/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("E3Series.Wrapper")]
[assembly: AssemblyDescription("Library-wrapper for E3series COM")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("E3Series.Wrapper")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("5b93c4d5-9dd7-40e8-a306-03a314e2f099")]
// 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.0")]
[assembly: AssemblyFileVersion("1.0.1.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("E3Series.Wrapper")]
[assembly: AssemblyDescription("Library-wrapper for E3series COM")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("E3Series.Wrapper")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("5b93c4d5-9dd7-40e8-a306-03a314e2f099")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
7459f05cbbb7a026fa4b3b58f8fe94757e53871a | Bump version. | wasker/nsight.piwik.api | Nsight.Piwik.Api/Properties/AssemblyInfo.cs | Nsight.Piwik.Api/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("Nsight.Piwik.Api")]
[assembly: AssemblyDescription("Piwik API implementation")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ByteGems.com Software")]
[assembly: AssemblyProduct("Nsight.Piwik.Api")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: InternalsVisibleTo("Nsight.Piwik.Api.Tests")]
| 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("Nsight.Piwik.Api")]
[assembly: AssemblyDescription("Piwik API implementation")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ByteGems.com Software")]
[assembly: AssemblyProduct("Nsight.Piwik.Api")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: InternalsVisibleTo("Nsight.Piwik.Api.Tests")]
| mit | C# |
bee9b8246597529fa878b38a9696fbde8673d970 | Update assembly info. | VoiDeD/OctgnArtReplacer | OctgnArtReplacer/Properties/AssemblyInfo.cs | OctgnArtReplacer/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( "OctgnArtReplacer" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "OctgnArtReplacer" )]
[assembly: AssemblyCopyright( "Copyright © Ryan Stecker 2016" )]
[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( "e82a4149-4069-4ded-8704-91c3b8c41c67" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "0.1.0.*" )]
[assembly: AssemblyFileVersion( "0.1.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( "OctgnArtReplacer" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "OctgnArtReplacer" )]
[assembly: AssemblyCopyright( "Copyright © 2016" )]
[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( "e82a4149-4069-4ded-8704-91c3b8c41c67" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
| mit | C# |
43837dce4af504439f1a213efbff0683074901a6 | Allow IsEnabled to be set by scheduling strategies. | p-org/PSharp | Source/SchedulingStrategies/ISchedulable.cs | Source/SchedulingStrategies/ISchedulable.cs | //-----------------------------------------------------------------------
// <copyright file="ISchedulable.cs">
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// 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>
//-----------------------------------------------------------------------
using System;
namespace Microsoft.PSharp.TestingServices.SchedulingStrategies
{
/// <summary>
/// Interface of an entity that can be scheduled.
/// </summary>
public interface ISchedulable
{
/// <summary>
/// Unique id of the entity.
/// </summary>
ulong Id { get; }
/// <summary>
/// Name of the entity.
/// </summary>
string Name { get; }
/// <summary>
/// Is the entity enabled.
/// </summary>
bool IsEnabled { get; set; }
/// <summary>
/// Type of the next operation of the entity.
/// </summary>
OperationType NextOperationType { get; }
/// <summary>
/// The target type of the next operation of the entity.
/// </summary>
OperationTargetType NextTargetType { get; }
/// <summary>
/// Target id of the next operation of the entity.
/// </summary>
ulong NextTargetId { get; }
/// <summary>
/// If the next operation is <see cref="OperationType.Receive"/>
/// then this gives the step index of the corresponding Send.
/// </summary>
ulong NextOperationMatchingSendIndex { get; }
/// <summary>
/// Monotonically increasing operation count.
/// </summary>
ulong OperationCount { get; }
/// <summary>
/// Unique id of the group of operations that is
/// associated with the next operation.
/// </summary>
Guid NextOperationGroupId { get; }
}
}
| //-----------------------------------------------------------------------
// <copyright file="ISchedulable.cs">
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// 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>
//-----------------------------------------------------------------------
using System;
namespace Microsoft.PSharp.TestingServices.SchedulingStrategies
{
/// <summary>
/// Interface of an entity that can be scheduled.
/// </summary>
public interface ISchedulable
{
/// <summary>
/// Unique id of the entity.
/// </summary>
ulong Id { get; }
/// <summary>
/// Name of the entity.
/// </summary>
string Name { get; }
/// <summary>
/// Is the entity enabled.
/// </summary>
bool IsEnabled { get; }
/// <summary>
/// Type of the next operation of the entity.
/// </summary>
OperationType NextOperationType { get; }
/// <summary>
/// The target type of the next operation of the entity.
/// </summary>
OperationTargetType NextTargetType { get; }
/// <summary>
/// Target id of the next operation of the entity.
/// </summary>
ulong NextTargetId { get; }
/// <summary>
/// If the next operation is <see cref="OperationType.Receive"/>
/// then this gives the step index of the corresponding Send.
/// </summary>
ulong NextOperationMatchingSendIndex { get; }
/// <summary>
/// Monotonically increasing operation count.
/// </summary>
ulong OperationCount { get; }
/// <summary>
/// Unique id of the group of operations that is
/// associated with the next operation.
/// </summary>
Guid NextOperationGroupId { get; }
}
}
| mit | C# |
10396eac750a43e57e2e06849558bd150267d639 | Remove unused sandbox setup | appharbor/ConsolR,appharbor/ConsolR | Core/Sandbox.cs | Core/Sandbox.cs | using System;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
using System.Threading.Tasks;
using Compilify.Models;
using Compilify.Services;
using Roslyn.Scripting.CSharp;
namespace Compilify
{
public sealed class Sandbox : IDisposable
{
private readonly byte[] _assemblyBytes;
private bool _disposed;
private readonly AppDomain _domain;
public Sandbox(string name, byte[] compiledAssemblyBytes)
{
_assemblyBytes = compiledAssemblyBytes;
_domain = AppDomain.CurrentDomain;
}
static Sandbox()
{
AppDomain.MonitoringIsEnabled = true;
}
public ExecutionResult Run(string className, string resultProperty, TimeSpan timeout)
{
var task = Task<ExecutionResult>.Factory.StartNew(() => Execute(className, resultProperty));
if (!task.Wait(timeout))
{
return new ExecutionResult { Result = "[Execution timed out]" };
}
return task.Result ?? new ExecutionResult { Result = "null" };
}
private ExecutionResult Execute(string className, string resultProperty)
{
var type = typeof(ByteCodeLoader);
var loader = (ByteCodeLoader)_domain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName);
var unformattedResult = loader.Run(className, resultProperty, _assemblyBytes);
var formatter = new ObjectFormatter(maxLineLength: 5120);
return new ExecutionResult
{
Result = formatter.FormatObject(unformattedResult.ReturnValue),
ConsoleOutput = unformattedResult.ConsoleOutput,
ProcessorTime = _domain.MonitoringTotalProcessorTime,
TotalMemoryAllocated = _domain.MonitoringTotalAllocatedMemorySize,
};
}
private sealed class ByteCodeLoader : MarshalByRefObject
{
public ByteCodeLoader() { }
public SandboxResult Run(string className, string resultProperty, byte[] compiledAssembly)
{
var assembly = Assembly.Load(compiledAssembly);
assembly.EntryPoint.Invoke(null, new object[] { });
var console = (StringWriter)assembly.GetType("Script").GetField("__Console").GetValue(null);
var result = new SandboxResult
{
ConsoleOutput = console.ToString(),
ReturnValue = assembly.GetType(className).GetProperty(resultProperty).GetValue(null, null)
};
return result;
}
}
}
}
| using System;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
using System.Threading.Tasks;
using Compilify.Models;
using Compilify.Services;
using Roslyn.Scripting.CSharp;
namespace Compilify
{
public sealed class Sandbox : IDisposable
{
private readonly byte[] _assemblyBytes;
private bool _disposed;
private readonly AppDomain _domain;
public Sandbox(string name, byte[] compiledAssemblyBytes)
{
_assemblyBytes = compiledAssemblyBytes;
var evidence = new Evidence();
evidence.AddHostEvidence(new Zone(SecurityZone.Internet));
var permissions = SecurityManager.GetStandardSandbox(evidence);
permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
permissions.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess));
var setup = new AppDomainSetup
{
ApplicationBase = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
ApplicationName = name,
DisallowBindingRedirects = true,
DisallowCodeDownload = true,
DisallowPublisherPolicy = true
};
_domain = AppDomain.CurrentDomain;
}
static Sandbox()
{
AppDomain.MonitoringIsEnabled = true;
}
public ExecutionResult Run(string className, string resultProperty, TimeSpan timeout)
{
var task = Task<ExecutionResult>.Factory.StartNew(() => Execute(className, resultProperty));
if (!task.Wait(timeout))
{
return new ExecutionResult { Result = "[Execution timed out]" };
}
return task.Result ?? new ExecutionResult { Result = "null" };
}
private ExecutionResult Execute(string className, string resultProperty)
{
var type = typeof(ByteCodeLoader);
var loader = (ByteCodeLoader)_domain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName);
var unformattedResult = loader.Run(className, resultProperty, _assemblyBytes);
var formatter = new ObjectFormatter(maxLineLength: 5120);
return new ExecutionResult
{
Result = formatter.FormatObject(unformattedResult.ReturnValue),
ConsoleOutput = unformattedResult.ConsoleOutput,
ProcessorTime = _domain.MonitoringTotalProcessorTime,
TotalMemoryAllocated = _domain.MonitoringTotalAllocatedMemorySize,
};
}
public void Dispose()
{
if (!_disposed)
{
_disposed = true;
}
}
private sealed class ByteCodeLoader : MarshalByRefObject
{
public ByteCodeLoader() { }
public SandboxResult Run(string className, string resultProperty, byte[] compiledAssembly)
{
var assembly = Assembly.Load(compiledAssembly);
assembly.EntryPoint.Invoke(null, new object[] { });
var console = (StringWriter)assembly.GetType("Script").GetField("__Console").GetValue(null);
var result = new SandboxResult
{
ConsoleOutput = console.ToString(),
ReturnValue = assembly.GetType(className).GetProperty(resultProperty).GetValue(null, null)
};
return result;
}
}
}
}
| mit | C# |
ae98f3d5e9bc06369ce1a31ded346be3d4de0787 | Add summary | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Extensions/StringExtensions.cs | WalletWasabi/Extensions/StringExtensions.cs | using System.Linq;
namespace System
{
public static class StringExtensions
{
public static bool Equals(this string source, string value, StringComparison comparisonType, bool trimmed)
{
if (comparisonType == StringComparison.Ordinal)
{
if (trimmed)
{
return string.CompareOrdinal(source.Trim(), value.Trim()) == 0;
}
return string.CompareOrdinal(source, value) == 0;
}
if (trimmed)
{
return source.Trim().Equals(value.Trim(), comparisonType);
}
return source.Equals(value, comparisonType);
}
public static bool Contains(this string source, string toCheck, StringComparison comp)
{
return source.IndexOf(toCheck, comp) >= 0;
}
public static string[] Split(this string me, string separator, StringSplitOptions options = StringSplitOptions.None)
{
return me.Split(separator.ToCharArray(), options);
}
/// <summary>
/// Removes one leading and trailing occurrence of the specified string
/// </summary>
public static string Trim(this string me, string trimString, StringComparison comparisonType)
{
return me.TrimStart(trimString, comparisonType).TrimEnd(trimString, comparisonType);
}
/// <summary>
/// Removes one leading occurrence of the specified string
/// </summary>
public static string TrimStart(this string me, string trimString, StringComparison comparisonType)
{
if (me.StartsWith(trimString, comparisonType))
{
return me.Substring(trimString.Length);
}
return me;
}
/// <summary>
/// Removes one trailing occurrence of the specified string
/// </summary>
public static string TrimEnd(this string me, string trimString, StringComparison comparisonType)
{
if (me.EndsWith(trimString, comparisonType))
{
return me.Substring(0, me.Length - trimString.Length);
}
return me;
}
/// <summary>
/// Returns true if the string contains leading or trailing whitespace, otherwise returns false.
/// </summary>
public static bool IsTrimable(this string me)
{
if (me.Length == 0)
{
return false;
}
return char.IsWhiteSpace(me.First()) || char.IsWhiteSpace(me.Last());
}
}
}
| using System.Linq;
namespace System
{
public static class StringExtensions
{
public static bool Equals(this string source, string value, StringComparison comparisonType, bool trimmed)
{
if (comparisonType == StringComparison.Ordinal)
{
if (trimmed)
{
return string.CompareOrdinal(source.Trim(), value.Trim()) == 0;
}
return string.CompareOrdinal(source, value) == 0;
}
if (trimmed)
{
return source.Trim().Equals(value.Trim(), comparisonType);
}
return source.Equals(value, comparisonType);
}
public static bool Contains(this string source, string toCheck, StringComparison comp)
{
return source.IndexOf(toCheck, comp) >= 0;
}
public static string[] Split(this string me, string separator, StringSplitOptions options = StringSplitOptions.None)
{
return me.Split(separator.ToCharArray(), options);
}
/// <summary>
/// Removes one leading and trailing occurrence of the specified string
/// </summary>
public static string Trim(this string me, string trimString, StringComparison comparisonType)
{
return me.TrimStart(trimString, comparisonType).TrimEnd(trimString, comparisonType);
}
/// <summary>
/// Removes one leading occurrence of the specified string
/// </summary>
public static string TrimStart(this string me, string trimString, StringComparison comparisonType)
{
if (me.StartsWith(trimString, comparisonType))
{
return me.Substring(trimString.Length);
}
return me;
}
/// <summary>
/// Removes one trailing occurrence of the specified string
/// </summary>
public static string TrimEnd(this string me, string trimString, StringComparison comparisonType)
{
if (me.EndsWith(trimString, comparisonType))
{
return me.Substring(0, me.Length - trimString.Length);
}
return me;
}
public static bool IsTrimable(this string me)
{
if (me.Length == 0)
{
return false;
}
return char.IsWhiteSpace(me.First()) || char.IsWhiteSpace(me.Last());
}
}
}
| mit | C# |
660c678cdcbe74b8a6b6fe55555a60b2b778f820 | Remove unused using directives | NeoAdonis/osu,UselessToucan/osu,ppy/osu,johnneijzen/osu,ZLima12/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,2yangk23/osu,peppy/osu-new,peppy/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,ZLima12/osu,EVAST9919/osu,ppy/osu,2yangk23/osu,johnneijzen/osu,smoogipooo/osu,EVAST9919/osu | osu.Game/Overlays/Rankings/HeaderFlag.cs | osu.Game/Overlays/Rankings/HeaderFlag.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.Framework.Graphics.Sprites;
using osu.Game.Users.Drawables;
using osuTK.Graphics;
using osuTK;
using osu.Framework.Input.Events;
using System;
namespace osu.Game.Overlays.Rankings
{
public class HeaderFlag : UpdateableFlag
{
private const int duration = 200;
public Action Action;
private readonly SpriteIcon hoverIcon;
public HeaderFlag()
{
AddInternal(hoverIcon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Depth = -1,
Alpha = 0,
Size = new Vector2(10),
Icon = FontAwesome.Solid.Times,
});
}
protected override bool OnHover(HoverEvent e)
{
hoverIcon.FadeIn(duration, Easing.OutQuint);
this.FadeColour(Color4.Gray, duration, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
hoverIcon.FadeOut(duration, Easing.OutQuint);
this.FadeColour(Color4.White, duration, Easing.OutQuint);
}
protected override bool OnClick(ClickEvent e)
{
Action?.Invoke();
return true;
}
}
}
| // 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.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Users.Drawables;
using osuTK.Graphics;
using osuTK;
using osu.Framework.Input.Events;
using osu.Framework.Extensions.Color4Extensions;
using System;
namespace osu.Game.Overlays.Rankings
{
public class HeaderFlag : UpdateableFlag
{
private const int duration = 200;
public Action Action;
private readonly SpriteIcon hoverIcon;
public HeaderFlag()
{
AddInternal(hoverIcon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Depth = -1,
Alpha = 0,
Size = new Vector2(10),
Icon = FontAwesome.Solid.Times,
});
}
protected override bool OnHover(HoverEvent e)
{
hoverIcon.FadeIn(duration, Easing.OutQuint);
this.FadeColour(Color4.Gray, duration, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
hoverIcon.FadeOut(duration, Easing.OutQuint);
this.FadeColour(Color4.White, duration, Easing.OutQuint);
}
protected override bool OnClick(ClickEvent e)
{
Action?.Invoke();
return true;
}
}
}
| mit | C# |
064751d3714a3507c3e37118ab7fd854560ec076 | Add clipping for Gtk2 context | TheBrainTech/xwt,directhex/xwt,akrisiun/xwt,mono/xwt,sevoku/xwt,hamekoz/xwt,mminns/xwt,residuum/xwt,steffenWi/xwt,lytico/xwt,hwthomas/xwt,cra0zy/xwt,antmicro/xwt,mminns/xwt,iainx/xwt | Xwt.Gtk/Xwt.GtkBackend/CanvasBackendGtk2.cs | Xwt.Gtk/Xwt.GtkBackend/CanvasBackendGtk2.cs | //
// CanvasBackendGtk.cs
//
// Author:
// Vsevolod Kukol <v.kukol@rubologic.de>
//
// Copyright (c) 2014 Vsevolod Kukol
//
// 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.Linq;
using Xwt.CairoBackend;
namespace Xwt.GtkBackend
{
partial class CustomCanvas
{
protected override void OnSizeRequested (ref Gtk.Requisition requisition)
{
base.OnSizeRequested (ref requisition);
foreach (var cr in children.ToArray ())
cr.Key.SizeRequest ();
}
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
var a = evnt.Area;
using (var ctx = CreateContext ()) {
// Set context Origin from initial Cairo CTM (to ensure new Xwt CTM is Identity Matrix)
ctx.Origin.X = ctx.Context.Matrix.X0;
ctx.Origin.Y = ctx.Context.Matrix.Y0;
// Gdk Expose event supplies the area to be redrawn - but need to adjust X,Y for context Origin
Rectangle dirtyRect = new Rectangle (a.X-ctx.Origin.X, a.Y-ctx.Origin.Y, a.Width, a.Height);
ctx.Context.Rectangle (dirtyRect.X, dirtyRect.Y, dirtyRect.Width, dirtyRect.Height);
ctx.Context.Clip ();
OnDraw (dirtyRect, ctx);
}
return base.OnExposeEvent (evnt);
}
}
}
| //
// CanvasBackendGtk.cs
//
// Author:
// Vsevolod Kukol <v.kukol@rubologic.de>
//
// Copyright (c) 2014 Vsevolod Kukol
//
// 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.Linq;
using Xwt.CairoBackend;
namespace Xwt.GtkBackend
{
partial class CustomCanvas
{
protected override void OnSizeRequested (ref Gtk.Requisition requisition)
{
base.OnSizeRequested (ref requisition);
foreach (var cr in children.ToArray ())
cr.Key.SizeRequest ();
}
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
var ctx = CreateContext ();
// Set context Origin from initial Cairo CTM (to ensure new Xwt CTM is Identity Matrix)
ctx.Origin.X = ctx.Context.Matrix.X0;
ctx.Origin.Y = ctx.Context.Matrix.Y0;
// Gdk Expose event supplies the area to be redrawn - but need to adjust X,Y for context Origin
var a = evnt.Area;
Rectangle dirtyRect = new Rectangle (a.X-ctx.Origin.X, a.Y-ctx.Origin.Y, a.Width, a.Height);
OnDraw (dirtyRect, ctx);
return base.OnExposeEvent (evnt);
}
}
}
| mit | C# |
4020c81cb428e3334cc1c38a181a1dad1377fe5c | Tidy up. | TimCollins/Reddit.DailyProgrammer | src/14-Hard-ThreadedSort/ThreadedSort.cs | src/14-Hard-ThreadedSort/ThreadedSort.cs | using System;
namespace _14_Hard_ThreadedSort
{
public class ThreadedSort
{
//private const int SizeLimit = 1000000;
private const int SizeLimit = 100;
private const int NumberLimit = 1000;
private int[] _numbers;
public void Generate()
{
_numbers = new int[SizeLimit];
var r = new Random();
for (var i = 0; i < SizeLimit; i++)
{
_numbers[i] = r.Next(1, NumberLimit);
}
}
public void Sort()
{
BubbleSort();
}
private void BubbleSort()
{
var length = _numbers.Length;
bool swapHasTakenPlace;
do
{
swapHasTakenPlace = false;
for (var i = 1; i < length; i++)
{
if (_numbers[i - 1] > _numbers[i])
{
var tmp = _numbers[i - 1];
_numbers[i - 1] = _numbers[i];
_numbers[i] = tmp;
swapHasTakenPlace = true;
}
}
} while (swapHasTakenPlace);
}
public void Display()
{
for (var i = 0; i < SizeLimit; i++)
{
Console.WriteLine("Index {0} - Number {1}", i, _numbers[i]);
}
}
}
}
| using System;
namespace _14_Hard_ThreadedSort
{
public class ThreadedSort
{
//private const int SizeLimit = 1000000;
private const int SizeLimit = 100;
private const int NumberLimit = 1000;
private int[] _numbers;
public void Generate()
{
//_numbers = GetKnownData();
//return;
_numbers = new int[SizeLimit];
var r = new Random();
for (var i = 0; i < SizeLimit; i++)
{
_numbers[i] = r.Next(1, NumberLimit);
}
}
private int[] GetKnownData()
{
return new[] {5, 1, 4, 2, 8, 3};
}
public void Sort()
{
BubbleSort();
}
private void BubbleSort()
{
var length = _numbers.Length;
bool swapHasTakenPlace;
do
{
swapHasTakenPlace = false;
for (var i = 1; i < length; i++)
{
if (_numbers[i - 1] > _numbers[i])
{
var tmp = _numbers[i - 1];
_numbers[i - 1] = _numbers[i];
_numbers[i] = tmp;
swapHasTakenPlace = true;
}
}
} while (swapHasTakenPlace);
}
public void Display()
{
for (var i = 0; i < SizeLimit; i++)
{
Console.WriteLine("Index {0} - Number {1}", i, _numbers[i]);
}
}
}
}
| mit | C# |
b4b7a667d0805e37c0a0d2780e62453c5a9c410b | Add integration from master to feature/ioperation | MattWindsor91/roslyn,ErikSchierboom/roslyn,orthoxerox/roslyn,dpoeschl/roslyn,kelltrick/roslyn,MichalStrehovsky/roslyn,VSadov/roslyn,MichalStrehovsky/roslyn,sharwell/roslyn,TyOverby/roslyn,tannergooding/roslyn,heejaechang/roslyn,tvand7093/roslyn,bartdesmet/roslyn,physhi/roslyn,orthoxerox/roslyn,nguerrera/roslyn,AlekseyTs/roslyn,abock/roslyn,TyOverby/roslyn,Hosch250/roslyn,heejaechang/roslyn,AlekseyTs/roslyn,CaptainHayashi/roslyn,tvand7093/roslyn,VSadov/roslyn,aelij/roslyn,pdelvo/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,mmitche/roslyn,bartdesmet/roslyn,DustinCampbell/roslyn,VSadov/roslyn,jmarolf/roslyn,wvdd007/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn,aelij/roslyn,shyamnamboodiripad/roslyn,khyperia/roslyn,amcasey/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,abock/roslyn,bkoelman/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,pdelvo/roslyn,paulvanbrenk/roslyn,weltkante/roslyn,davkean/roslyn,abock/roslyn,yeaicc/roslyn,lorcanmooney/roslyn,jcouv/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,DustinCampbell/roslyn,diryboy/roslyn,gafter/roslyn,mattwar/roslyn,jasonmalinowski/roslyn,mgoertz-msft/roslyn,genlu/roslyn,OmarTawfik/roslyn,genlu/roslyn,lorcanmooney/roslyn,eriawan/roslyn,OmarTawfik/roslyn,nguerrera/roslyn,swaroop-sridhar/roslyn,Hosch250/roslyn,kelltrick/roslyn,AmadeusW/roslyn,CaptainHayashi/roslyn,agocke/roslyn,CaptainHayashi/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,Giftednewt/roslyn,khyperia/roslyn,tannergooding/roslyn,jcouv/roslyn,tmat/roslyn,jkotas/roslyn,mmitche/roslyn,dotnet/roslyn,tmat/roslyn,mattwar/roslyn,physhi/roslyn,robinsedlaczek/roslyn,dpoeschl/roslyn,mattwar/roslyn,mattscheffer/roslyn,dpoeschl/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,xasx/roslyn,swaroop-sridhar/roslyn,tmeschter/roslyn,orthoxerox/roslyn,robinsedlaczek/roslyn,yeaicc/roslyn,weltkante/roslyn,srivatsn/roslyn,davkean/roslyn,jamesqo/roslyn,genlu/roslyn,akrisiun/roslyn,stephentoub/roslyn,diryboy/roslyn,AmadeusW/roslyn,wvdd007/roslyn,mgoertz-msft/roslyn,bkoelman/roslyn,mgoertz-msft/roslyn,gafter/roslyn,xasx/roslyn,ErikSchierboom/roslyn,nguerrera/roslyn,drognanar/roslyn,drognanar/roslyn,tmat/roslyn,kelltrick/roslyn,physhi/roslyn,lorcanmooney/roslyn,bkoelman/roslyn,MichalStrehovsky/roslyn,cston/roslyn,ErikSchierboom/roslyn,robinsedlaczek/roslyn,cston/roslyn,sharwell/roslyn,weltkante/roslyn,jamesqo/roslyn,jkotas/roslyn,OmarTawfik/roslyn,xasx/roslyn,amcasey/roslyn,eriawan/roslyn,mavasani/roslyn,AnthonyDGreen/roslyn,jmarolf/roslyn,agocke/roslyn,heejaechang/roslyn,srivatsn/roslyn,Giftednewt/roslyn,brettfo/roslyn,akrisiun/roslyn,mavasani/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tannergooding/roslyn,tmeschter/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,yeaicc/roslyn,AlekseyTs/roslyn,brettfo/roslyn,reaction1989/roslyn,reaction1989/roslyn,stephentoub/roslyn,KevinRansom/roslyn,MattWindsor91/roslyn,davkean/roslyn,tmeschter/roslyn,jcouv/roslyn,amcasey/roslyn,tvand7093/roslyn,paulvanbrenk/roslyn,agocke/roslyn,KevinRansom/roslyn,srivatsn/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,mmitche/roslyn,Giftednewt/roslyn,swaroop-sridhar/roslyn,MattWindsor91/roslyn,sharwell/roslyn,AnthonyDGreen/roslyn,mattscheffer/roslyn,aelij/roslyn,AnthonyDGreen/roslyn,jkotas/roslyn,jamesqo/roslyn,MattWindsor91/roslyn,pdelvo/roslyn,mavasani/roslyn,drognanar/roslyn,TyOverby/roslyn,panopticoncentral/roslyn,Hosch250/roslyn,cston/roslyn,DustinCampbell/roslyn,reaction1989/roslyn,KevinRansom/roslyn,paulvanbrenk/roslyn,khyperia/roslyn,eriawan/roslyn,akrisiun/roslyn,mattscheffer/roslyn,panopticoncentral/roslyn,KirillOsenkov/roslyn,gafter/roslyn,wvdd007/roslyn,brettfo/roslyn | src/Tools/Github/GithubMergeTool/run.csx | src/Tools/Github/GithubMergeTool/run.csx | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#r "GithubMergeTool.dll"
#load "auth.csx"
using System;
using System.Net;
using System.Threading.Tasks;
private static string DotnetBotGithubAuthToken = null;
private static TraceWriter Log = null;
private static async Task MakeGithubPr(string repoOwner, string repoName, string srcBranch, string destBranch)
{
var gh = new GithubMergeTool.GithubMergeTool("dotnet-bot@users.noreply.github.com", DotnetBotGithubAuthToken);
Log.Info($"Merging from {srcBranch} to {destBranch}");
var result = await gh.CreateMergePr(repoOwner, repoName, srcBranch, destBranch);
if (result != null)
{
if (result.StatusCode == (HttpStatusCode)422)
{
Log.Info("PR not created -- all commits are present in base branch");
}
else
{
Log.Error($"Error creating PR. GH response code: {result.StatusCode}");
}
}
else
{
Log.Info("PR created successfully");
}
}
private static Task MakeRoslynPr(string srcBranch, string destBranch)
=> MakeGithubPr("dotnet", "roslyn", srcBranch, destBranch);
private static Task MakeRoslynInternalPr(string srcBranch, string destBranch)
=> MakeGithubPr("dotnet", "roslyn-internal", srcBranch, destBranch);
private static Task MakeLutPr(string srcBranch, string destBranch)
=> MakeGithubPr("dotnet", "testimpact", srcBranch, destBranch);
private static Task MakeProjectSystemPr(string srcBranch, string destBranch)
=> MakeGithubPr("dotnet", "roslyn-project-system", srcBranch, destBranch);
private static async Task RunAsync()
{
DotnetBotGithubAuthToken = await GetSecret("dotnet-bot-github-auth-token");
// Roslyn branches
await MakeRoslynPr("dev15.0.x", "dev15.1.x");
await MakeRoslynPr("dev15.1.x", "master");
await MakeRoslynPr("master", "dev16");
await MakeRoslynPr("master", "features/ioperation");
// Roslyn-internal branches
await MakeRoslynInternalPr("dev15.0.x", "dev15.1.x");
await MakeRoslynInternalPr("dev15.1.x", "master");
await MakeRoslynInternalPr("master", "dev16");
// LUT branches
await MakeLutPr("dev15.0.x", "dev15.1.x");
await MakeLutPr("dev15.1.x", "master");
await MakeLutPr("master", "dev16");
// Project system branches
await MakeProjectSystemPr("dev15.0.x", "dev15.1.x");
await MakeProjectSystemPr("dev15.0.x", "dev15.2.x");
await MakeProjectSystemPr("dev15.2.x", "master");
}
public static void Run(TimerInfo nightlyRun, TraceWriter log)
{
Log = log;
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
RunAsync().GetAwaiter().GetResult();
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#r "GithubMergeTool.dll"
#load "auth.csx"
using System;
using System.Net;
using System.Threading.Tasks;
private static string DotnetBotGithubAuthToken = null;
private static TraceWriter Log = null;
private static async Task MakeGithubPr(string repoOwner, string repoName, string srcBranch, string destBranch)
{
var gh = new GithubMergeTool.GithubMergeTool("dotnet-bot@users.noreply.github.com", DotnetBotGithubAuthToken);
Log.Info($"Merging from {srcBranch} to {destBranch}");
var result = await gh.CreateMergePr(repoOwner, repoName, srcBranch, destBranch);
if (result != null)
{
if (result.StatusCode == (HttpStatusCode)422)
{
Log.Info("PR not created -- all commits are present in base branch");
}
else
{
Log.Error($"Error creating PR. GH response code: {result.StatusCode}");
}
}
else
{
Log.Info("PR created successfully");
}
}
private static Task MakeRoslynPr(string srcBranch, string destBranch)
=> MakeGithubPr("dotnet", "roslyn", srcBranch, destBranch);
private static Task MakeRoslynInternalPr(string srcBranch, string destBranch)
=> MakeGithubPr("dotnet", "roslyn-internal", srcBranch, destBranch);
private static Task MakeLutPr(string srcBranch, string destBranch)
=> MakeGithubPr("dotnet", "testimpact", srcBranch, destBranch);
private static Task MakeProjectSystemPr(string srcBranch, string destBranch)
=> MakeGithubPr("dotnet", "roslyn-project-system", srcBranch, destBranch);
private static async Task RunAsync()
{
DotnetBotGithubAuthToken = await GetSecret("dotnet-bot-github-auth-token");
// Roslyn branches
await MakeRoslynPr("dev15.0.x", "dev15.1.x");
await MakeRoslynPr("dev15.1.x", "master");
await MakeRoslynPr("master", "dev16");
// Roslyn-internal branches
await MakeRoslynInternalPr("dev15.0.x", "dev15.1.x");
await MakeRoslynInternalPr("dev15.1.x", "master");
await MakeRoslynInternalPr("master", "dev16");
// LUT branches
await MakeLutPr("dev15.0.x", "dev15.1.x");
await MakeLutPr("dev15.1.x", "master");
await MakeLutPr("master", "dev16");
// Project system branches
await MakeProjectSystemPr("dev15.0.x", "dev15.1.x");
await MakeProjectSystemPr("dev15.0.x", "dev15.2.x");
await MakeProjectSystemPr("dev15.2.x", "master");
}
public static void Run(TimerInfo nightlyRun, TraceWriter log)
{
Log = log;
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
RunAsync().GetAwaiter().GetResult();
}
| apache-2.0 | C# |
61688c069a12f2171bda4860c5554a684a27022e | Change driver version. | kangkot/ArangoDB-NET,yojimbo87/ArangoDB-NET | src/Arango/Arango.Client/ArangoClient.cs | src/Arango/Arango.Client/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.1.1"; }
}
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 "1.0.0"; }
}
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# |
da9539132c93bbdc21f5d59c1dcc3119eb8265fa | add perfomance measuring to repl | corvusalba/my-little-lispy,corvusalba/my-little-lispy | src/CorvusAlba.MyLittleLispy.CLI/Repl.cs | src/CorvusAlba.MyLittleLispy.CLI/Repl.cs | using System;
using System.Diagnostics;
using System.Linq;
using CorvusAlba.MyLittleLispy.Hosting;
using CorvusAlba.MyLittleLispy.Runtime;
namespace CorvusAlba.MyLittleLispy.CLI
{
internal class Repl
{
private readonly ScriptEngine _engine;
public Repl(ScriptEngine engine)
{
_engine = engine;
}
public int Loop()
{
while (true)
{
Console.Write(" > ");
try
{
var line = Console.ReadLine();
while (true)
{
var count = line.Count(c => c == '(') - line.Count(c => c == ')');
if (count == 0)
{
break;
}
Console.Write(" ... ");
line = line + Console.ReadLine();
}
Stopwatch sw = new Stopwatch();
sw.Start();
var value = _engine.Evaluate(line);
sw.Stop();
TimeSpan ts = sw.Elapsed;
string elapsedTime = string.Format("{0:00}:{1:00}:{2:00}:{3:000}",
ts.Hours, ts.Minutes, ts.Seconds,
ts.Milliseconds);
Console.WriteLine(" => {0}", value);
Console.WriteLine("(elapsed {0})", elapsedTime);
}
catch (HaltException e)
{
return e.Code;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
} | using System;
using System.Linq;
using CorvusAlba.MyLittleLispy.Hosting;
using CorvusAlba.MyLittleLispy.Runtime;
namespace CorvusAlba.MyLittleLispy.CLI
{
internal class Repl
{
private readonly ScriptEngine _engine;
public Repl(ScriptEngine engine)
{
_engine = engine;
}
public int Loop()
{
while (true)
{
Console.Write(" > ");
try
{
var line = Console.ReadLine();
while (true)
{
var count = line.Count(c => c == '(') - line.Count(c => c == ')');
if (count == 0)
{
break;
}
Console.Write(" ... ");
line = line + Console.ReadLine();
}
Console.WriteLine(" => {0}", _engine.Evaluate(line));
}
catch (HaltException e)
{
return e.Code;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
} | mit | C# |
90aa55ba58a237da07f1992d0150dd7e1df646d4 | add gravatar hash | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/ThomasRayner.cs | src/Firehose.Web/Authors/ThomasRayner.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class ThomasRayner : IWorkAtMicrosoft
{
public string FirstName => "Thomas";
public string LastName => "Rayner";
public string ShortBioOrTagLine => "Senior Security Systems Engineer @ Microsoft";
public string StateOrRegion => "Redmond";
public string EmailAddress => "thmsrynr@outlook.com";
public string TwitterHandle => "MrThomasRayner";
public string GitHubHandle => "thomasrayner";
public string GravatarHash => "28dbce395fcef492a3874f84afea8144";
public GeoPosition Position => new GeoPosition(47.642384, -122.126984);
public Uri WebSite => new Uri("https://thomasrayner.ca");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://thomasrayner.ca/feed"); } }
public string FeedLanguageCode => "en";
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class ThomasRayner : IWorkAtMicrosoft
{
public string FirstName => "Thomas";
public string LastName => "Rayner";
public string ShortBioOrTagLine => "Senior Security Systems Engineer @ Microsoft";
public string StateOrRegion => "Redmond";
public string EmailAddress => "thmsrynr@outlook.com";
public string TwitterHandle => "MrThomasRayner";
public string GitHubHandle => "thomasrayner";
public string GravatarHash => "";
public GeoPosition Position => new GeoPosition(47.642384, -122.126984);
public Uri WebSite => new Uri("https://thomasrayner.ca");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://thomasrayner.ca/feed"); } }
public string FeedLanguageCode => "en";
}
}
| mit | C# |
a34d5b051256db1cbb14801b84f5871ad6d9cf3f | Update GroupShapesDragAndDropListBox.cs | Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D | Core2D.Wpf/Controls/Custom/Lists/GroupShapesDragAndDropListBox.cs | Core2D.Wpf/Controls/Custom/Lists/GroupShapesDragAndDropListBox.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using System.Windows.Controls;
namespace Core2D.Wpf.Controls.Custom.Lists
{
/// <summary>
/// The <see cref="ListBox"/> control for <see cref="XGroup.Shapes"/> items with drag and drop support.
/// </summary>
public class GroupShapesDragAndDropListBox : DragAndDropListBox<BaseShape>
{
/// <summary>
/// Initializes a new instance of the <see cref="GroupShapesDragAndDropListBox"/> class.
/// </summary>
public GroupShapesDragAndDropListBox()
: base()
{
this.Initialized += (s, e) => base.Initialize();
}
/// <summary>
/// Updates DataContext binding to ImmutableArray collection property.
/// </summary>
/// <param name="array">The updated immutable array.</param>
public override void UpdateDataContext(ImmutableArray<BaseShape> array)
{
var editor = (Core2D.Editor)this.Tag;
var group = this.DataContext as XGroup;
if (group == null)
return;
var previous = group.Shapes;
var next = array;
editor.Project?.History?.Snapshot(previous, next, (p) => group.Shapes = p);
group.Shapes = next;
}
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using System.Windows.Controls;
namespace Core2D.Wpf.Controls.Custom.Lists
{
/// <summary>
/// The <see cref="ListBox"/> control for <see cref="XGroup.Shapes"/> items with drag and drop support.
/// </summary>
public class GroupShapesDragAndDropListBox : DragAndDropListBox<BaseShape>
{
/// <summary>
/// Initializes a new instance of the <see cref="GroupShapesDragAndDropListBox"/> class.
/// </summary>
public GroupShapesDragAndDropListBox()
: base()
{
this.Initialized += (s, e) => base.Initialize();
}
/// <summary>
/// Updates DataContext binding to ImmutableArray collection property.
/// </summary>
/// <param name="array">The updated immutable array.</param>
public override void UpdateDataContext(ImmutableArray<BaseShape> array)
{
var editor = (Core2D.Editor)this.Tag;
var group = this.DataContext as XGroup;
if (group == null)
return;
var previous = group.Shapes;
var next = array;
editor.project?.History?.Snapshot(previous, next, (p) => group.Shapes = p);
group.Shapes = next;
}
}
}
| mit | C# |
49affd7e9e4c5029abbd61a05a3813fa5e1d8659 | Fix UMake | bitcake/bitstrap | Assets/BitStrap/Plugins/Editor/UMake/UMake.cs | Assets/BitStrap/Plugins/Editor/UMake/UMake.cs | using UnityEditor;
using UnityEngine;
namespace BitStrap
{
public sealed class UMake : ScriptableObject
{
public const string buildPathPrefKey = "UMake_BuildPath_";
public string version = "0.0";
[UMakeTargetActions]
public UMakeTarget[] targets;
private static Option<UMake> instance = Functional.None;
public static string BuildPathPref
{
get { return EditorPrefs.GetString( buildPathPrefKey + PlayerSettings.productName, "" ); }
set { EditorPrefs.SetString( buildPathPrefKey + PlayerSettings.productName, value ); }
}
public static Option<UMake> Get()
{
instance = instance.OrElse(() =>
from guid in AssetDatabase.FindAssets("t:" + typeof(UMake).Name).First()
select AssetDatabase.LoadAssetAtPath<UMake>(AssetDatabase.GUIDToAssetPath(guid))
);
return instance;
}
public static Option<UMakeTarget> GetTarget( string targetName )
{
return
from umake in Get()
from target in umake.targets.First( t => t.name == targetName )
select target;
}
public static string GetBuildPath()
{
string path = BuildPathPref;
if( !string.IsNullOrEmpty( path ) )
return path;
return EditorUtility.OpenFolderPanel( "Build Path", path, "Builds" );
}
}
} | using UnityEditor;
using UnityEngine;
namespace BitStrap
{
public sealed class UMake : ScriptableObject
{
public const string buildPathPrefKey = "UMake_BuildPath_";
public string version = "0.0";
[UMakeTargetActions]
public UMakeTarget[] targets;
private static Option<UMake> instance = Functional.None;
public static string BuildPathPref
{
get { return EditorPrefs.GetString( buildPathPrefKey + PlayerSettings.productName, "" ); }
set { EditorPrefs.SetString( buildPathPrefKey + PlayerSettings.productName, value ); }
}
public static Option<UMake> Get()
{
instance = instance.OrElse( () =>
from path in AssetDatabase.FindAssets( "t:" + typeof( UMake ).Name ).First()
select AssetDatabase.LoadAssetAtPath<UMake>( path )
);
return instance;
}
public static Option<UMakeTarget> GetTarget( string targetName )
{
return
from umake in Get()
from target in umake.targets.First( t => t.name == targetName )
select target;
}
public static string GetBuildPath()
{
string path = BuildPathPref;
if( !string.IsNullOrEmpty( path ) )
return path;
return EditorUtility.OpenFolderPanel( "Build Path", path, "Builds" );
}
}
} | mit | C# |
98daaf634ae4851fec97326efe1e9a0eea65137f | Simplify changes | johnneijzen/osu,smoogipoo/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,ZLima12/osu,EVAST9919/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,UselessToucan/osu,EVAST9919/osu,johnneijzen/osu,2yangk23/osu,2yangk23/osu,peppy/osu,NeoAdonis/osu,ZLima12/osu,smoogipoo/osu,UselessToucan/osu | osu.Game/Rulesets/Mods/ModBlockFail.cs | osu.Game/Rulesets/Mods/ModBlockFail.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModBlockFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig
{
private Bindable<bool> hideHealthBar;
private HealthDisplay healthDisplay;
/// <summary>
/// We never fail, 'yo.
/// </summary>
public bool AllowFail => false;
public void ReadFromConfig(OsuConfigManager config)
{
hideHealthBar = config.GetBindable<bool>(OsuSetting.HideHealthBar);
}
public void ApplyToHUD(HUDOverlay overlay)
{
healthDisplay = overlay.HealthDisplay;
hideHealthBar.BindValueChanged(v => healthDisplay.FadeTo(v.NewValue ? 0 : 1, 250, Easing.OutQuint), true);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModBlockFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig
{
private Bindable<bool> hideHealthBar;
private HealthDisplay healthDisplay;
/// <summary>
/// We never fail, 'yo.
/// </summary>
public bool AllowFail => false;
public void ReadFromConfig(OsuConfigManager config)
{
hideHealthBar = config.GetBindable<bool>(OsuSetting.HideHealthBar);
hideHealthBar.ValueChanged += v => healthDisplay?.FadeTo(v.NewValue ? 0 : 1, 250, Easing.OutQuint);
}
public void ApplyToHUD(HUDOverlay overlay)
{
healthDisplay = overlay.HealthDisplay;
hideHealthBar?.TriggerChange();
}
}
}
| mit | C# |
8d22a8e606efe1ae147368fc6ea10e7705596e33 | Revert change to Inspect | ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab | source/Runtime/SharpLabObjectExtensions.cs | source/Runtime/SharpLabObjectExtensions.cs | using System.ComponentModel;
using System.Text;
using SharpLab.Runtime.Internal;
public static class SharpLabObjectExtensions {
// LinqPad/etc compatibility only
[EditorBrowsable(EditorBrowsableState.Never)]
public static T Dump<T>(this T value)
=> value.Inspect(title: "Dump");
public static void Inspect<T>(this T value, string title = "Inspect") {
var builder = new StringBuilder();
ObjectAppender.Append(builder, value);
var data = new SimpleInspectionResult(title, builder);
Output.Write(data);
}
}
| using System.ComponentModel;
using System.Text;
using SharpLab.Runtime.Internal;
public static class SharpLabObjectExtensions {
// LinqPad/etc compatibility only
[EditorBrowsable(EditorBrowsableState.Never)]
public static T Dump<T>(this T value)
=> value.Inspect(title: "Dump");
public static T Inspect<T>(this T value, string title = "Inspect") {
var builder = new StringBuilder();
ObjectAppender.Append(builder, value);
var data = new SimpleInspectionResult(title, builder);
Output.Write(data);
return value;
}
}
| bsd-2-clause | C# |
72230232a4f2c55a5cb788574f31d6ea5c12ce4f | Modify ConnectFour tests to use Move | TalkTakesTime/csharpgamesuite | GameSuite.GamesTests/ConnectFour/GameTests.cs | GameSuite.GamesTests/ConnectFour/GameTests.cs | using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace GameSuite.Games.ConnectFour.Tests
{
[TestClass()]
public class GameTests
{
[TestMethod()]
public void GameTest()
{
var b = new Game();
Assert.IsTrue(b.Height == 6);
Assert.IsTrue(b.Width == 7);
}
[TestMethod()]
public void GameTest1()
{
var b = new Game(2, 5);
Assert.IsTrue(b.Height == 2);
Assert.IsTrue(b.Width == 5);
}
[TestMethod()]
public void PlayTest()
{
var b = new Game();
// test playing in invalid columns
Assert.IsFalse(b.Play(new Move(1, 10)));
// test invalid players
Assert.IsFalse(b.Play(new Move(0, 3)));
Assert.IsFalse(b.Play(new Move(3, 0)));
// and try some correct plays
Assert.IsTrue(b.Play(new Move(1, 0)));
Assert.IsTrue(b.Play(new Move(2, 2)));
// fill a column
for (int i = 0; i < b.Height; i++)
{
Assert.IsTrue(b.Play(new Move(1, 4)));
}
// a move into a full column should be rejected
Assert.IsFalse(b.Play(new Move(1, 4)));
}
[TestMethod()]
public void ToStringTest()
{
var b = new Game();
b.Play(new Move(2, 1));
b.Play(new Move(1, 4));
b.Play(new Move(2, 4));
b.Play(new Move(1, 3));
Console.WriteLine(b.ToString());
// this one is probably more likely to be checked by eye for now
Assert.Inconclusive();
}
[TestMethod()]
public void CanPlayTest()
{
Assert.Fail();
}
}
} | using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace GameSuite.Games.ConnectFour.Tests
{
[TestClass()]
public class GameTests
{
[TestMethod()]
public void GameTest()
{
var b = new Game();
Assert.IsTrue(b.Height == 6);
Assert.IsTrue(b.Width == 7);
}
[TestMethod()]
public void GameTest1()
{
var b = new Game(2, 5);
Assert.IsTrue(b.Height == 2);
Assert.IsTrue(b.Width == 5);
}
[TestMethod()]
public void PlayTest()
{
var b = new Game();
// test playing in invalid columns
Assert.IsFalse(b.Play(-1, 1));
Assert.IsFalse(b.Play(10, 1));
// test invalid players
Assert.IsFalse(b.Play(2, 0));
Assert.IsFalse(b.Play(2, 3));
// and try some correct plays
Assert.IsTrue(b.Play(0, 1));
Assert.IsTrue(b.Play(2, 2));
// fill a column
for (int i = 0; i < b.Height; i++)
{
Assert.IsTrue(b.Play(4, 1));
}
// a move into a full column should be rejected
Assert.IsFalse(b.Play(4, 1));
}
[TestMethod()]
public void ToStringTest()
{
var b = new Game();
b.Play(1, 2);
b.Play(4, 1);
b.Play(4, 2);
b.Play(3, 1);
Console.WriteLine(b.ToString());
// this one is probably more likely to be checked by eye for now
Assert.Inconclusive();
}
[TestMethod()]
public void CanPlayTest()
{
Assert.Fail();
}
}
} | mit | C# |
4a81043b1ec46529884ff96219ff4aa406b1492b | Add BuildDirectory property. | nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke | source/Nuke.Core/EnvironmentInfo.Build.cs | source/Nuke.Core/EnvironmentInfo.Build.cs | // Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using JetBrains.Annotations;
using Nuke.Core.Utilities.Collections;
using static Nuke.Core.IO.PathConstruction;
namespace Nuke.Core
{
public static partial class EnvironmentInfo
{
/// <summary>
/// The build entry assembly.
/// </summary>
public static Assembly BuildAssembly => Assembly.GetEntryAssembly();
[CanBeNull]
public static AbsolutePath BuildDirectory
{
get
{
var buildAssembly = BuildAssembly.Location.NotNull("buildAssembly != null");
var buildProjectDirectory = new FileInfo(buildAssembly).Directory.NotNull()
.DescendantsAndSelf(x => x.Parent)
.Select(x => x.GetFiles("*.csproj", SearchOption.TopDirectoryOnly).SingleOrDefault())
.FirstOrDefault(x => x != null)
?.DirectoryName;
return (AbsolutePath) buildProjectDirectory.NotNull("buildProjectDirectory != null");
}
}
}
}
| // Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using System.Reflection;
namespace Nuke.Core
{
public static partial class EnvironmentInfo
{
/// <summary>
/// The build entry assembly.
/// </summary>
public static Assembly BuildAssembly => Assembly.GetEntryAssembly();
}
}
| mit | C# |
fb6105688976e9c1de3932d78e8d25c924a4a09d | Remove ToString method | mstrother/BmpListener | src/BmpListener/Bgp/PathAttributeOrigin.cs | src/BmpListener/Bgp/PathAttributeOrigin.cs | using System;
using System.Linq;
namespace BmpListener.Bgp
{
public class PathAttributeOrigin : PathAttribute
{
public enum Type
{
IGP,
EGP,
Incomplete
}
public Type Origin { get; private set; }
public override void Decode(byte[] data, int offset)
{
Origin = (Type)data[offset];
}
}
} | using System;
using System.Linq;
namespace BmpListener.Bgp
{
public class PathAttributeOrigin : PathAttribute
{
public enum Type
{
IGP,
EGP,
Incomplete
}
public Type Origin { get; private set; }
public override void Decode(byte[] data, int offset)
{
Origin = (Type)data[offset];
}
public override string ToString()
{
switch (Origin)
{
case (Type.IGP):
return "igp";
case (Type.EGP):
return "egp";
case (Type.Incomplete):
return "incomplete";
default:
return string.Empty;
}
}
}
} | mit | C# |
6a3ecae97053868a73b5009737c73e34759298ad | Add tests for matching when target line has changed | github/VisualStudio,github/VisualStudio,github/VisualStudio | test/UnitTests/GitHub.App/Services/NavigationServiceTests.cs | test/UnitTests/GitHub.App/Services/NavigationServiceTests.cs | using System;
using System.Collections.Generic;
using GitHub.Services;
using NUnit.Framework;
using NSubstitute;
public class NavigationServiceTests
{
public class TheFindNearestMatchingLineMethod
{
[TestCase(new[] { "line" }, new[] { "line" }, 0, 0, 1, Description = "Match same line")]
[TestCase(new[] { "line" }, new[] { "line_no_match" }, 0, -1, 0, Description = "No matching line")]
[TestCase(new[] { "line" }, new[] { "", "line" }, 0, 1, 1, Description = "Match line moved up")]
[TestCase(new[] { "", "line" }, new[] { "line" }, 1, 0, 1, Description = "Match line moved down")]
[TestCase(new[] { "line", "line" }, new[] { "line", "line" }, 0, 0, 2, Description = "Match nearest line")]
[TestCase(new[] { "line", "line" }, new[] { "line", "line" }, 1, 1, 2, Description = "Match nearest line")]
[TestCase(new[] { "line" }, new[] { "line" }, 1, 0, 1, Description = "Treat after last line the same as last line")]
public void FindNearestMatchingLine(IList<string> fromLines, IList<string> toLines, int line,
int expectNearestLine, int expectMatchingLines)
{
var sp = Substitute.For<IServiceProvider>();
var target = new NavigationService(sp);
int matchedLines;
var nearestLine = target.FindNearestMatchingLine(fromLines, toLines, line, out matchedLines);
Assert.That(nearestLine, Is.EqualTo(expectNearestLine));
Assert.That(matchedLines, Is.EqualTo(expectMatchingLines));
}
}
public class TheFindMatchingLineMethod
{
[TestCase(new[] { "void method()", "code" }, new[] { "void method()", "// code" }, 1, 1)]
[TestCase(new[] { "void method()", "code" }, new[] { "void method()" }, 1, 0, Description = "Keep within bounds")]
[TestCase(new[] { "code" }, new[] { "// code" }, 0, -1)]
[TestCase(new[] { "line", "line" }, new[] { "line", "line" }, 0, 0, Description = "Match nearest line")]
[TestCase(new[] { "line", "line" }, new[] { "line", "line" }, 1, 1, Description = "Match nearest line")]
public void FindNearestMatchingLine(IList<string> fromLines, IList<string> toLines, int line,
int matchingLine)
{
var sp = Substitute.For<IServiceProvider>();
var target = new NavigationService(sp);
var nearestLine = target.FindMatchingLine(fromLines, toLines, line);
Assert.That(nearestLine, Is.EqualTo(matchingLine));
}
}
}
| using System;
using System.Collections.Generic;
using GitHub.Services;
using NUnit.Framework;
using NSubstitute;
public class NavigationServiceTests
{
public class TheFindNearestMatchingLineMethod
{
[TestCase(new[] { "line" }, new[] { "line" }, 0, 0, 1, Description = "Match same line")]
[TestCase(new[] { "line" }, new[] { "line_no_match" }, 0, -1, 0, Description = "No matching line")]
[TestCase(new[] { "line" }, new[] { "", "line" }, 0, 1, 1, Description = "Match line moved up")]
[TestCase(new[] { "", "line" }, new[] { "line" }, 1, 0, 1, Description = "Match line moved down")]
[TestCase(new[] { "line", "line" }, new[] { "line", "line" }, 0, 0, 2, Description = "Match nearest line")]
[TestCase(new[] { "line", "line" }, new[] { "line", "line" }, 1, 1, 2, Description = "Match nearest line")]
[TestCase(new[] { "line" }, new[] { "line" }, 1, 0, 1, Description = "Treat after last line the same as last line")]
public void FindNearestMatchingLine(IList<string> fromLines, IList<string> toLines, int line,
int expectNearestLine, int expectMatchingLines)
{
var sp = Substitute.For<IServiceProvider>();
var target = new NavigationService(sp);
int matchedLines;
var nearestLine = target.FindNearestMatchingLine(fromLines, toLines, line, out matchedLines);
Assert.That(nearestLine, Is.EqualTo(expectNearestLine));
Assert.That(matchedLines, Is.EqualTo(expectMatchingLines));
}
}
}
| mit | C# |
4a62542627e1b81dbe2a2d295d80b7a0fac747c7 | Set dlr version | simplicbe/Simplic.Dlr,simplicbe/Simplic.Dlr | src/Simplic.Dlr/Properties/AssemblyInfo.cs | src/Simplic.Dlr/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("Simplic.Dlr")]
[assembly: AssemblyDescription("Provides functions to work very easily with the microsoft dlr / IronPython")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Simplic Systems")]
[assembly: AssemblyProduct("Simplic.Dlr")]
[assembly: AssemblyCopyright("Copyright © Simplic Systems 2016 / Benedikt Eggers")]
[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("265e557a-ebef-410a-976c-cb561716cfa9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.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("Simplic.Dlr")]
[assembly: AssemblyDescription("Provides functions to work very easily with the microsoft dlr / IronPython")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Simplic Systems")]
[assembly: AssemblyProduct("Simplic.Dlr")]
[assembly: AssemblyCopyright("Copyright © Simplic Systems 2016 / Benedikt Eggers")]
[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("265e557a-ebef-410a-976c-cb561716cfa9")]
// 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.4.0")]
[assembly: AssemblyFileVersion("1.2.4.0")]
| mit | C# |
3fa0de6f355a3a7f7face022f738287454733a81 | Update ISerializerRestFactory.cs | tiksn/TIKSN-Framework | TIKSN.Core/Web/Rest/ISerializerRestFactory.cs | TIKSN.Core/Web/Rest/ISerializerRestFactory.cs | using TIKSN.Serialization;
namespace TIKSN.Web.Rest
{
public interface ISerializerRestFactory
{
ISerializer<string> Create(string mediaType);
}
}
| using TIKSN.Serialization;
namespace TIKSN.Web.Rest
{
public interface ISerializerRestFactory
{
ISerializer<string> Create(string mediaType);
}
} | mit | C# |
454b5d703f612d8cafd32431ec69f77d96ff272d | 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; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed HTML attributes such as "href" and "alt".
/// </summary>
public ISet<string> AllowedAttributes { get; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed CSS classes.
/// </summary>
public ISet<string> AllowedCssClasses { get; init; } = new HashSet<string>();
/// <summary>
/// Gets or sets the allowed CSS properties such as "font" and "margin".
/// </summary>
public ISet<string> AllowedCssProperties { get; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed CSS at-rules such as "@media" and "@font-face".
/// </summary>
public ISet<CssRuleType> AllowedAtRules { get; init; } = new HashSet<CssRuleType>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed URI schemes such as "http" and "https".
/// </summary>
public ISet<string> AllowedSchemes { get; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the HTML attributes that can contain a URI such as "href".
/// </summary>
public ISet<string> UriAttributes { get; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
}
}
| 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>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed HTML attributes such as "href" and "alt".
/// </summary>
public ISet<string> AllowedAttributes { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <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>(StringComparer.OrdinalIgnoreCase);
/// <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>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed URI schemes such as "http" and "https".
/// </summary>
public ISet<string> AllowedSchemes { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <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>(StringComparer.OrdinalIgnoreCase);
}
}
| mit | C# |
185186f5cafca419631436579af4a2779011b462 | Increment version to v1.0.0.8 | MatthewSteeples/XeroAPI.Net,TDaphneB/XeroAPI.Net,XeroAPI/XeroAPI.Net,jcvandan/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.0.0.8")]
[assembly: AssemblyFileVersion("1.0.0.8")]
| 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.0.0.7")]
[assembly: AssemblyFileVersion("1.0.0.7")]
| mit | C# |
ac8f865d2383a08fca47d9e701b9979d3606f493 | Remove specialize private set on Coupon | stripe/stripe-dotnet | src/Stripe.net/Entities/Coupons/Coupon.cs | src/Stripe.net/Entities/Coupons/Coupon.cs | namespace Stripe
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class Coupon : StripeEntity<Coupon>, IHasId, IHasMetadata, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("object")]
public string Object { get; set; }
[JsonProperty("amount_off")]
public long? AmountOff { get; set; }
[JsonProperty("created")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime Created { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
/// <summary>
/// Whether this object is deleted or not.
/// </summary>
[JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("duration")]
public string Duration { get; set; }
[JsonProperty("duration_in_months")]
public long? DurationInMonths { get; set; }
[JsonProperty("livemode")]
public bool Livemode { get; set; }
[JsonProperty("max_redemptions")]
public long? MaxRedemptions { get; set; }
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("percent_off")]
public decimal? PercentOff { get; set; }
[JsonProperty("redeem_by")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime? RedeemBy { get; set; }
[JsonProperty("times_redeemed")]
public long TimesRedeemed { get; set; }
[JsonProperty("valid")]
public bool Valid { get; set; }
}
}
| namespace Stripe
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class Coupon : StripeEntity<Coupon>, IHasId, IHasMetadata, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("object")]
public string Object { get; set; }
[JsonProperty("amount_off")]
public long? AmountOff { get; set; }
[JsonProperty("created")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime Created { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
/// <summary>
/// Whether this object is deleted or not.
/// </summary>
[JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("duration")]
public string Duration { get; set; }
[JsonProperty("duration_in_months")]
public long? DurationInMonths { get; set; }
[JsonProperty("livemode")]
public bool Livemode { get; set; }
[JsonProperty("max_redemptions")]
public long? MaxRedemptions { get; set; }
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("percent_off")]
public decimal? PercentOff { get; set; }
[JsonProperty("redeem_by")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime? RedeemBy { get; set; }
[JsonProperty("times_redeemed")]
public long TimesRedeemed { get; private set; }
[JsonProperty("valid")]
public bool Valid { get; set; }
}
}
| apache-2.0 | C# |
1319e8a998eabee85285c44d62858c41512f412c | Fix type mapping for IPubFileProvider | ethanmoffat/EndlessClient | EOLib.IO/Repositories/PubFileRepository.cs | EOLib.IO/Repositories/PubFileRepository.cs | // Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using AutomaticTypeMapper;
using EOLib.IO.Pub;
namespace EOLib.IO.Repositories
{
[MappedType(BaseType = typeof(IPubFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IPubFileProvider), IsSingleton = true)]
[MappedType(BaseType = typeof(IEIFFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IEIFFileProvider), IsSingleton = true)]
[MappedType(BaseType = typeof(IENFFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IENFFileProvider), IsSingleton = true)]
[MappedType(BaseType = typeof(IESFFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IESFFileProvider), IsSingleton = true)]
[MappedType(BaseType = typeof(IECFFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IECFFileProvider), IsSingleton = true)]
public class PubFileRepository : IPubFileRepository, IPubFileProvider
{
public IPubFile<EIFRecord> EIFFile { get; set; }
public IPubFile<ENFRecord> ENFFile { get; set; }
public IPubFile<ESFRecord> ESFFile { get; set; }
public IPubFile<ECFRecord> ECFFile { get; set; }
}
} | // Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using AutomaticTypeMapper;
using EOLib.IO.Pub;
namespace EOLib.IO.Repositories
{
[MappedType(BaseType = typeof(IPubFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IEIFFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IEIFFileProvider), IsSingleton = true)]
[MappedType(BaseType = typeof(IENFFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IENFFileProvider), IsSingleton = true)]
[MappedType(BaseType = typeof(IESFFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IESFFileProvider), IsSingleton = true)]
[MappedType(BaseType = typeof(IECFFileRepository), IsSingleton = true)]
[MappedType(BaseType = typeof(IECFFileProvider), IsSingleton = true)]
public class PubFileRepository : IPubFileRepository, IPubFileProvider
{
public IPubFile<EIFRecord> EIFFile { get; set; }
public IPubFile<ENFRecord> ENFFile { get; set; }
public IPubFile<ESFRecord> ESFFile { get; set; }
public IPubFile<ECFRecord> ECFFile { get; set; }
}
} | mit | C# |
5252ce5376d256d6bd8a703e67a53ed59c3dfd41 | Return unset value instead of throwing in OpaqueColorConverter | laurentkempe/GitDiffMargin | GitDiffMargin/View/OpaqueColorConverter.cs | GitDiffMargin/View/OpaqueColorConverter.cs | using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
namespace GitDiffMargin.View
{
[ValueConversion(typeof(Brush), typeof(Brush))]
class OpaqueColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(Brush))
{
throw new ArgumentException("Target type is not a brush.");
}
var newBrush = ((Brush)value).Clone();
newBrush.Opacity = 1.0; // Remove transparency
return newBrush;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
// It's not possible to convert back: we don't know the original opacity nor can we get it in someway.
return DependencyProperty.UnsetValue;
}
}
}
| using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace GitDiffMargin.View
{
[ValueConversion(typeof(Brush), typeof(Brush))]
class OpaqueColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(Brush))
{
throw new ArgumentException("Target type is not a brush.");
}
var newBrush = ((Brush)value).Clone();
newBrush.Opacity = 1.0; // Remove transparency
return newBrush;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
// We don't need to convert back. What should we do anyways? We don't know the original opacity, nor we can we get it.
throw new NotSupportedException();
}
}
}
| mit | C# |
ca18fd2e1012f0fa9953ae3022918fc7b68e1b97 | Update Index.cshtml | asanchezr/hets,asanchezr/hets,swcurran/hets,swcurran/hets,bcgov/hets,bcgov/hets,swcurran/hets,bcgov/hets,asanchezr/hets,bcgov/hets,asanchezr/hets,swcurran/hets,swcurran/hets | PDF/src/PDF.Server/Views/Home/Index.cshtml | PDF/src/PDF.Server/Views/Home/Index.cshtml | @{
ViewBag.Title = "PDFAPI - Api Home";
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"]</title>
<style>
body {
background-color: #fff;
padding: 10px;
font-family: Verdana, Geneva, sans-serif;
font-size: 12pt;
}
</style>
</head>
<body>
<h2>@ViewData["Title"]</h2>
<hr />
@if (Model.DevelopmentEnvironment){
<div>
<h3>View HETS API</h3>
<a href="~/swagger/ui/index.html">Swagger</a>
</div>
}
</body>
</html>
| @{ViewBag.Title = "PDFAPI - Api Home";}<!DOCTYPE html><html><head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>@ViewData["Title"]</title> <style> body { background-color: #fff; padding: 10px; font-family: Verdana, Geneva, sans-serif; font-size: 12pt; } </style> </head><body><h2>@ViewData["Title"]</h2><hr />
@if (Model.DevelopmentEnvironment){<div> <h3>View HETS API</h3> <a href="~/swagger/ui/index.html">Swagger</a></div> }
</body></html>
| apache-2.0 | C# |
1c015e31f1f919e7b8221fab45a7e39e961a7c6f | Add IReloadable interface and method | Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox,qianlifeng/Wox,Wox-launcher/Wox | Plugins/Wox.Plugin.BrowserBookmark/Main.cs | Plugins/Wox.Plugin.BrowserBookmark/Main.cs | using System.Collections.Generic;
using System.Linq;
using Wox.Plugin.BrowserBookmark.Commands;
using Wox.Plugin.SharedCommands;
namespace Wox.Plugin.BrowserBookmark
{
public class Main : IPlugin, IReloadable
{
private PluginInitContext context;
private List<Bookmark> cachedBookmarks = new List<Bookmark>();
public void Init(PluginInitContext context)
{
this.context = context;
cachedBookmarks = Bookmarks.LoadAllBookmarks();
}
public List<Result> Query(Query query)
{
string param = query.GetAllRemainingParameter().TrimStart();
// Should top results be returned? (true if no search parameters have been passed)
var topResults = string.IsNullOrEmpty(param);
var returnList = cachedBookmarks;
if (!topResults)
{
// Since we mixed chrome and firefox bookmarks, we should order them again
returnList = cachedBookmarks.Where(o => Bookmarks.MatchProgram(o, param)).ToList();
returnList = returnList.OrderByDescending(o => o.Score).ToList();
}
return returnList.Select(c => new Result()
{
Title = c.Name,
SubTitle = "Bookmark: " + c.Url,
IcoPath = @"Images\bookmark.png",
Score = 5,
Action = (e) =>
{
context.API.HideApp();
c.Url.NewBrowserWindow("");
return true;
}
}).ToList();
}
public void ReloadData()
{
cachedBookmarks.Clear();
cachedBookmarks = Bookmarks.LoadAllBookmarks();
}
}
}
| using System.Collections.Generic;
using System.Linq;
using Wox.Plugin.BrowserBookmark.Commands;
using Wox.Plugin.SharedCommands;
namespace Wox.Plugin.BrowserBookmark
{
public class Main : IPlugin
{
private PluginInitContext context;
private List<Bookmark> cachedBookmarks = new List<Bookmark>();
public void Init(PluginInitContext context)
{
this.context = context;
cachedBookmarks = Bookmarks.LoadAllBookmarks();
}
public List<Result> Query(Query query)
{
string param = query.GetAllRemainingParameter().TrimStart();
// Should top results be returned? (true if no search parameters have been passed)
var topResults = string.IsNullOrEmpty(param);
var returnList = cachedBookmarks;
if (!topResults)
{
// Since we mixed chrome and firefox bookmarks, we should order them again
returnList = cachedBookmarks.Where(o => Bookmarks.MatchProgram(o, param)).ToList();
returnList = returnList.OrderByDescending(o => o.Score).ToList();
}
return returnList.Select(c => new Result()
{
Title = c.Name,
SubTitle = "Bookmark: " + c.Url,
IcoPath = @"Images\bookmark.png",
Score = 5,
Action = (e) =>
{
context.API.HideApp();
c.Url.NewBrowserWindow("");
return true;
}
}).ToList();
}
}
}
| mit | C# |
b8c866c6ab1a9ac9ad7fc3eda97848fbbcc3c3be | Add GetDefaultSchema to the conventions | lcharlebois/fluentmigrator,lcharlebois/fluentmigrator | src/FluentMigrator/IMigrationConventions.cs | src/FluentMigrator/IMigrationConventions.cs | #region License
//
// Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
using System;
using System.Collections.Generic;
using FluentMigrator.Infrastructure;
namespace FluentMigrator
{
public interface IMigrationConventions
{
Func<Model.ForeignKeyDefinition, string> GetForeignKeyName { get; set; }
Func<Model.IndexDefinition, string> GetIndexName { get; set; }
Func<string, string> GetPrimaryKeyName { get; set; }
Func<Type, bool> TypeIsMigration { get; set; }
Func<Type, bool> TypeIsProfile { get; set; }
Func<Type, bool> TypeIsVersionTableMetaData { get; set; }
Func<string> GetWorkingDirectory { get; set; }
Func<IMigration,IMigrationInfo> GetMigrationInfo { get; set; }
Func<Model.ConstraintDefinition, string> GetConstraintName { get; set; }
Func<Type, bool> TypeHasTags { get; set; }
Func<Type, IEnumerable<string>, bool> TypeHasMatchingTags { get; set; }
Func<string> GetDefaultSchema { get; set; }
}
}
| #region License
//
// Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
using System;
using System.Collections.Generic;
using FluentMigrator.Infrastructure;
namespace FluentMigrator
{
public interface IMigrationConventions
{
Func<Model.ForeignKeyDefinition, string> GetForeignKeyName { get; set; }
Func<Model.IndexDefinition, string> GetIndexName { get; set; }
Func<string, string> GetPrimaryKeyName { get; set; }
Func<Type, bool> TypeIsMigration { get; set; }
Func<Type, bool> TypeIsProfile { get; set; }
Func<Type, bool> TypeIsVersionTableMetaData { get; set; }
Func<string> GetWorkingDirectory { get; set; }
Func<IMigration,IMigrationInfo> GetMigrationInfo { get; set; }
Func<Model.ConstraintDefinition, string> GetConstraintName { get; set; }
Func<Type, bool> TypeHasTags { get; set; }
Func<Type, IEnumerable<string>, bool> TypeHasMatchingTags { get; set; }
public Func<string> GetDefaultSchema { get; set; }
}
}
| apache-2.0 | C# |
06f93d1cada60b7151d47294f805888e21e3b9d7 | Increment version to 1.0.4.0 for future development | axomic/openasset-rest-cs | OpenAsset.RestClient.Library/Properties/AssemblyInfo.cs | OpenAsset.RestClient.Library/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("OpenAsset.RestClient.Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Axomic Ltd")]
[assembly: AssemblyProduct("OpenAsset RestClient Library")]
[assembly: AssemblyCopyright("Copyright © Axomic Ltd 2013-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("137fd3b7-9fa8-4003-a734-bb82cf0e2586")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenAsset.RestClient.Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Axomic Ltd")]
[assembly: AssemblyProduct("OpenAsset RestClient Library")]
[assembly: AssemblyCopyright("Copyright © Axomic Ltd 2013-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("137fd3b7-9fa8-4003-a734-bb82cf0e2586")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
| mit | C# |
e1fa3e868a769ab6064ab707c3d9fb3af9fadc27 | Change version number to v0.5.1.0 | Seist/Skylight | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Skylight")]
[assembly: AssemblyDescription("An API by TakoMan02 for Everybody Edits")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("TakoMan02")]
[assembly: AssemblyProduct("Skylight")]
[assembly: AssemblyCopyright("Copyright © TakoMan02 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("Skylight")]
[assembly: ComVisible(false)]
[assembly: Guid("a460c245-2753-4861-ae17-751db86fbae2")]
//
//
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("0.5.1.0")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Skylight")]
[assembly: AssemblyDescription("An API by TakoMan02 for Everybody Edits")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("TakoMan02")]
[assembly: AssemblyProduct("Skylight")]
[assembly: AssemblyCopyright("Copyright © TakoMan02 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("Skylight")]
[assembly: ComVisible(false)]
[assembly: Guid("a460c245-2753-4861-ae17-751db86fbae2")]
//
//
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("0.0.5.0")] | mit | C# |
f15d0ae6e68cc48595ce6ff702a142c1890606a0 | fix for new restsharp | sportingsolutions/SS.Integration.UnifiedDataAPIClient.DotNet,sportingsolutions/SS.Integration.UnifiedDataAPIClient.DotNet | SportingSolutions.Udapi.Sdk/Clients/ConnectConverter.cs | SportingSolutions.Udapi.Sdk/Clients/ConnectConverter.cs | //Copyright 2012 Spin Services Limited
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using RestSharp;
using RestSharp.Deserializers;
using RestSharp.Serializers;
namespace SportingSolutions.Udapi.Sdk.Clients
{
public class ConnectConverter : ISerializer, IDeserializer
{
private static readonly JsonSerializerSettings SerializerSettings;
static ConnectConverter()
{
SerializerSettings = new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
Converters = new List<JsonConverter> { new IsoDateTimeConverter() },
NullValueHandling = NullValueHandling.Ignore
};
}
public ConnectConverter(string contentType)
{
ContentType = contentType;
}
public string Serialize(object obj)
{
return JsonConvert.SerializeObject(obj, Formatting.None, SerializerSettings);
}
public T Deserialize<T>(IRestResponse response)
{
var type = typeof(T);
return (T)JsonConvert.DeserializeObject(response.Content, type, SerializerSettings);
}
string IDeserializer.RootElement { get; set; }
string IDeserializer.Namespace { get; set; }
string IDeserializer.DateFormat { get; set; }
public string ContentType { get; set; }
}
}
| //Copyright 2012 Spin Services Limited
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using RestSharp;
using RestSharp.Deserializers;
using RestSharp.Serializers;
namespace SportingSolutions.Udapi.Sdk.Clients
{
public class ConnectConverter : ISerializer, IDeserializer
{
private static readonly JsonSerializerSettings SerializerSettings;
static ConnectConverter()
{
SerializerSettings = new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
Converters = new List<JsonConverter> { new IsoDateTimeConverter() },
NullValueHandling = NullValueHandling.Ignore
};
}
public ConnectConverter(string contentType)
{
ContentType = contentType;
}
public string Serialize(object obj)
{
return JsonConvert.SerializeObject(obj, Formatting.None, SerializerSettings);
}
public T Deserialize<T>(IRestResponse response)
{
var type = typeof(T);
return (T)JsonConvert.DeserializeObject(response.Content, type, SerializerSettings);
}
string IDeserializer.RootElement { get; set; }
string IDeserializer.Namespace { get; set; }
string IDeserializer.DateFormat { get; set; }
string ISerializer.RootElement { get; set; }
string ISerializer.Namespace { get; set; }
string ISerializer.DateFormat { get; set; }
public string ContentType { get; set; }
}
}
| apache-2.0 | C# |
4533449ba6131a36c4263bc9529c5e0c21471ba9 | Rename fields name pattern to match rest of code | TiendaNube/SQLite.Net-PCL,igrali/SQLite.Net-PCL,caseydedore/SQLite.Net-PCL,mattleibow/SQLite.Net-PCL,fernandovm/SQLite.Net-PCL,igrali/SQLite.Net-PCL,kreuzhofer/SQLite.Net-PCL,molinch/SQLite.Net-PCL,oysteinkrog/SQLite.Net-PCL | src/SQLite.Net/BlobSerializerDelegate.cs | src/SQLite.Net/BlobSerializerDelegate.cs | using System;
namespace SQLite.Net
{
public class BlobSerializerDelegate : IBlobSerializer
{
public delegate byte[] SerializeDelegate(object obj);
public delegate bool CanSerializeDelegate(Type type);
public delegate object DeserializeDelegate(byte[] data, Type type);
private readonly SerializeDelegate _serializeDelegate;
private readonly DeserializeDelegate _deserializeDelegate;
private readonly CanSerializeDelegate _canDeserializeDelegate;
public BlobSerializerDelegate(SerializeDelegate serializeDelegate,
DeserializeDelegate deserializeDelegate,
CanSerializeDelegate canDeserializeDelegate)
{
_serializeDelegate = serializeDelegate;
_deserializeDelegate = deserializeDelegate;
_canDeserializeDelegate = canDeserializeDelegate;
}
#region IBlobSerializer implementation
public byte[] Serialize<T>(T obj)
{
return _serializeDelegate(obj);
}
public object Deserialize(byte[] data, Type type)
{
return _deserializeDelegate(data, type);
}
public bool CanDeserialize(Type type)
{
return _canDeserializeDelegate(type);
}
#endregion
}
} | using System;
namespace SQLite.Net
{
public class BlobSerializerDelegate : IBlobSerializer
{
public delegate byte[] SerializeDelegate(object obj);
public delegate bool CanSerializeDelegate(Type type);
public delegate object DeserializeDelegate(byte[] data, Type type);
private readonly SerializeDelegate serializeDelegate;
private readonly DeserializeDelegate deserializeDelegate;
private readonly CanSerializeDelegate canDeserializeDelegate;
public BlobSerializerDelegate (SerializeDelegate serializeDelegate,
DeserializeDelegate deserializeDelegate,
CanSerializeDelegate canDeserializeDelegate)
{
this.serializeDelegate = serializeDelegate;
this.deserializeDelegate = deserializeDelegate;
this.canDeserializeDelegate = canDeserializeDelegate;
}
#region IBlobSerializer implementation
public byte[] Serialize<T>(T obj)
{
return this.serializeDelegate (obj);
}
public object Deserialize(byte[] data, Type type)
{
return this.deserializeDelegate (data, type);
}
public bool CanDeserialize(Type type)
{
return this.canDeserializeDelegate (type);
}
#endregion
}
}
| mit | C# |
b91850262dca5ad4710eaa0ed52d429484ce5c07 | Fix MessageBox behaviour | Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox,lances101/Wox,lances101/Wox,qianlifeng/Wox,Wox-launcher/Wox | Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml.cs | Wox.Plugin.SystemPlugins/Program/ProgramSetting.xaml.cs | using System.Windows;
using System.Windows.Controls;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.SystemPlugins.Program
{
/// <summary>
/// Interaction logic for ProgramSetting.xaml
/// </summary>
public partial class ProgramSetting : UserControl
{
public ProgramSetting()
{
InitializeComponent();
Loaded += Setting_Loaded;
}
private void Setting_Loaded(object sender, RoutedEventArgs e)
{
programSourceView.ItemsSource = UserSettingStorage.Instance.ProgramSources;
}
public void ReloadProgramSourceView()
{
programSourceView.Items.Refresh();
}
private void btnAddProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSourceSetting programSource = new ProgramSourceSetting(this);
programSource.ShowDialog();
}
private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (seletedProgramSource != null)
{
if (MessageBox.Show("Are your sure to delete " + seletedProgramSource.ToString(), "Delete ProgramSource",
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
UserSettingStorage.Instance.ProgramSources.Remove(seletedProgramSource);
programSourceView.Items.Refresh();
}
}
else
{
MessageBox.Show("Please select a program source");
}
}
private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (seletedProgramSource != null)
{
ProgramSourceSetting programSource = new ProgramSourceSetting(this);
programSource.UpdateItem(seletedProgramSource);
programSource.ShowDialog();
}
else
{
MessageBox.Show("Please select a program source");
}
}
}
}
| using System.Windows;
using System.Windows.Controls;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.SystemPlugins.Program
{
/// <summary>
/// Interaction logic for ProgramSetting.xaml
/// </summary>
public partial class ProgramSetting : UserControl
{
public ProgramSetting()
{
InitializeComponent();
Loaded += Setting_Loaded;
}
private void Setting_Loaded(object sender, RoutedEventArgs e)
{
programSourceView.ItemsSource = UserSettingStorage.Instance.ProgramSources;
}
public void ReloadProgramSourceView()
{
programSourceView.Items.Refresh();
}
private void btnAddProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSourceSetting programSource = new ProgramSourceSetting(this);
programSource.ShowDialog();
}
private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (seletedProgramSource != null &&
MessageBox.Show("Are your sure to delete " + seletedProgramSource.ToString(), "Delete ProgramSource",
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
UserSettingStorage.Instance.ProgramSources.Remove(seletedProgramSource);
programSourceView.Items.Refresh();
}
else
{
MessageBox.Show("Please select a program source");
}
}
private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (seletedProgramSource != null)
{
ProgramSourceSetting programSource = new ProgramSourceSetting(this);
programSource.UpdateItem(seletedProgramSource);
programSource.ShowDialog();
}
else
{
MessageBox.Show("Please select a program source");
}
}
}
}
| mit | C# |
b6470891ed9600dfa2744ba43caea85a37e5091d | Add CreateSvgDocument overload, that takes a stream and returns document | sharpdx/SharpDX,sharpdx/SharpDX,sharpdx/SharpDX | Source/SharpDX.Direct2D1/DeviceContext5.cs | Source/SharpDX.Direct2D1/DeviceContext5.cs | // Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// 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 SharpDX.Win32;
using System;
namespace SharpDX.Direct2D1
{
public partial class DeviceContext5
{
/// <summary>
/// Initializes a new instance of the <see cref="DeviceContext5"/> class using an existing <see cref="Device5"/>.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="options">The options to be applied to the created device context.</param>
/// <remarks>
/// The new device context will not have a selected target bitmap. The caller must create and select a bitmap as the target surface of the context.
/// </remarks>
/// <unmanaged>HRESULT ID2D1Device5::CreateDeviceContext([In] D2D1_DEVICE_CONTEXT_OPTIONS options,[Out] ID2D1DeviceContext5** DeviceContext5)</unmanaged>
public DeviceContext5(Device5 device, DeviceContextOptions options)
: base(IntPtr.Zero)
{
device.CreateDeviceContext(options, this);
}
/// <summary>
/// Creates an Svg document from an xml string
/// </summary>
/// <param name="stream"></param>
/// <param name="viewportSize"></param>
/// <returns>Svg document model</returns>
public SvgDocument CreateSvgDocument(IStream stream, SharpDX.Size2F viewportSize)
{
SvgDocument result;
CreateSvgDocument_(ComStream.ToIntPtr(stream), viewportSize, out result);
return result;
}
}
} | // Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// 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;
namespace SharpDX.Direct2D1
{
public partial class DeviceContext5
{
/// <summary>
/// Initializes a new instance of the <see cref="DeviceContext5"/> class using an existing <see cref="Device5"/>.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="options">The options to be applied to the created device context.</param>
/// <remarks>
/// The new device context will not have a selected target bitmap. The caller must create and select a bitmap as the target surface of the context.
/// </remarks>
/// <unmanaged>HRESULT ID2D1Device5::CreateDeviceContext([In] D2D1_DEVICE_CONTEXT_OPTIONS options,[Out] ID2D1DeviceContext5** DeviceContext5)</unmanaged>
public DeviceContext5(Device5 device, DeviceContextOptions options)
: base(IntPtr.Zero)
{
device.CreateDeviceContext(options, this);
}
}
} | mit | C# |
1e402cf936b8ed84e24b5adb9d530db0b5f9fb12 | Update SerializerBase.cs | tiksn/TIKSN-Framework | TIKSN.Core/Serialization/SerializerBase.cs | TIKSN.Core/Serialization/SerializerBase.cs | using System;
namespace TIKSN.Serialization
{
public abstract class SerializerBase<TSerial> : ISerializer<TSerial> where TSerial : class
{
public TSerial Serialize<T>(T obj)
{
try
{
return SerializeInternal(obj);
}
catch (Exception ex)
{
throw new SerializerException("Serialization failed.", ex);
}
}
protected abstract TSerial SerializeInternal<T>(T obj);
}
} | using System;
namespace TIKSN.Serialization
{
public abstract class SerializerBase<TSerial> : ISerializer<TSerial> where TSerial : class
{
public TSerial Serialize(object obj)
{
try
{
return SerializeInternal(obj);
}
catch (Exception ex)
{
throw new SerializerException("Serialization failed.", ex);
}
}
protected abstract TSerial SerializeInternal(object obj);
}
} | mit | C# |
bb056a01ddd0dc8b03491faa467707b4445b4fa4 | Update dll to v1.12.1 | Nicholas-Westby/Archetype,kipusoep/Archetype,imulus/Archetype,imulus/Archetype,imulus/Archetype,kgiszewski/Archetype,Nicholas-Westby/Archetype,kgiszewski/Archetype,kgiszewski/Archetype,kjac/Archetype,kjac/Archetype,kipusoep/Archetype,Nicholas-Westby/Archetype,kipusoep/Archetype,kjac/Archetype | app/Umbraco/Umbraco.Archetype/Properties/VersionInfo.cs | app/Umbraco/Umbraco.Archetype/Properties/VersionInfo.cs | using System.Reflection;
[assembly: AssemblyVersion("1.12.1")]
[assembly: AssemblyFileVersion("1.12.1")]
| using System.Reflection;
[assembly: AssemblyVersion("1.12.0")]
[assembly: AssemblyFileVersion("1.12.0")]
| mit | C# |
545d368da6837469709b63eaa88d2ceae0ae0983 | Resolve test issues. | CamSoper/azure-powershell,TaraMeyer/azure-powershell,krkhan/azure-powershell,shuagarw/azure-powershell,yoavrubin/azure-powershell,hovsepm/azure-powershell,shuagarw/azure-powershell,pankajsn/azure-powershell,yantang-msft/azure-powershell,pankajsn/azure-powershell,TaraMeyer/azure-powershell,hungmai-msft/azure-powershell,naveedaz/azure-powershell,juvchan/azure-powershell,ClogenyTechnologies/azure-powershell,Matt-Westphal/azure-powershell,seanbamsft/azure-powershell,AzureRT/azure-powershell,nemanja88/azure-powershell,krkhan/azure-powershell,hovsepm/azure-powershell,ClogenyTechnologies/azure-powershell,atpham256/azure-powershell,rohmano/azure-powershell,dulems/azure-powershell,TaraMeyer/azure-powershell,jasper-schneider/azure-powershell,seanbamsft/azure-powershell,naveedaz/azure-powershell,ClogenyTechnologies/azure-powershell,AzureRT/azure-powershell,krkhan/azure-powershell,seanbamsft/azure-powershell,juvchan/azure-powershell,rohmano/azure-powershell,ankurchoubeymsft/azure-powershell,akurmi/azure-powershell,AzureAutomationTeam/azure-powershell,haocs/azure-powershell,naveedaz/azure-powershell,hungmai-msft/azure-powershell,alfantp/azure-powershell,AzureAutomationTeam/azure-powershell,pomortaz/azure-powershell,yoavrubin/azure-powershell,arcadiahlyy/azure-powershell,CamSoper/azure-powershell,zhencui/azure-powershell,Matt-Westphal/azure-powershell,dulems/azure-powershell,AzureAutomationTeam/azure-powershell,akurmi/azure-powershell,devigned/azure-powershell,juvchan/azure-powershell,haocs/azure-powershell,jtlibing/azure-powershell,AzureAutomationTeam/azure-powershell,dulems/azure-powershell,pomortaz/azure-powershell,seanbamsft/azure-powershell,nemanja88/azure-powershell,CamSoper/azure-powershell,pomortaz/azure-powershell,arcadiahlyy/azure-powershell,akurmi/azure-powershell,pomortaz/azure-powershell,zhencui/azure-powershell,yantang-msft/azure-powershell,hungmai-msft/azure-powershell,dulems/azure-powershell,alfantp/azure-powershell,nemanja88/azure-powershell,stankovski/azure-powershell,arcadiahlyy/azure-powershell,shuagarw/azure-powershell,shuagarw/azure-powershell,Matt-Westphal/azure-powershell,jasper-schneider/azure-powershell,yantang-msft/azure-powershell,atpham256/azure-powershell,ClogenyTechnologies/azure-powershell,devigned/azure-powershell,nemanja88/azure-powershell,stankovski/azure-powershell,atpham256/azure-powershell,atpham256/azure-powershell,pankajsn/azure-powershell,stankovski/azure-powershell,AzureAutomationTeam/azure-powershell,naveedaz/azure-powershell,ankurchoubeymsft/azure-powershell,hungmai-msft/azure-powershell,hovsepm/azure-powershell,yantang-msft/azure-powershell,hovsepm/azure-powershell,juvchan/azure-powershell,jasper-schneider/azure-powershell,haocs/azure-powershell,hungmai-msft/azure-powershell,yoavrubin/azure-powershell,AzureRT/azure-powershell,pomortaz/azure-powershell,krkhan/azure-powershell,ankurchoubeymsft/azure-powershell,naveedaz/azure-powershell,DeepakRajendranMsft/azure-powershell,jasper-schneider/azure-powershell,DeepakRajendranMsft/azure-powershell,alfantp/azure-powershell,seanbamsft/azure-powershell,yoavrubin/azure-powershell,alfantp/azure-powershell,rohmano/azure-powershell,pankajsn/azure-powershell,yoavrubin/azure-powershell,haocs/azure-powershell,devigned/azure-powershell,CamSoper/azure-powershell,zhencui/azure-powershell,jtlibing/azure-powershell,zhencui/azure-powershell,haocs/azure-powershell,juvchan/azure-powershell,arcadiahlyy/azure-powershell,nemanja88/azure-powershell,atpham256/azure-powershell,rohmano/azure-powershell,rohmano/azure-powershell,TaraMeyer/azure-powershell,arcadiahlyy/azure-powershell,ClogenyTechnologies/azure-powershell,DeepakRajendranMsft/azure-powershell,ankurchoubeymsft/azure-powershell,DeepakRajendranMsft/azure-powershell,krkhan/azure-powershell,zhencui/azure-powershell,jtlibing/azure-powershell,krkhan/azure-powershell,jtlibing/azure-powershell,devigned/azure-powershell,Matt-Westphal/azure-powershell,pankajsn/azure-powershell,yantang-msft/azure-powershell,stankovski/azure-powershell,Matt-Westphal/azure-powershell,stankovski/azure-powershell,ankurchoubeymsft/azure-powershell,naveedaz/azure-powershell,AzureRT/azure-powershell,pankajsn/azure-powershell,shuagarw/azure-powershell,hovsepm/azure-powershell,TaraMeyer/azure-powershell,alfantp/azure-powershell,rohmano/azure-powershell,AzureRT/azure-powershell,atpham256/azure-powershell,akurmi/azure-powershell,DeepakRajendranMsft/azure-powershell,CamSoper/azure-powershell,seanbamsft/azure-powershell,hungmai-msft/azure-powershell,devigned/azure-powershell,AzureRT/azure-powershell,akurmi/azure-powershell,jasper-schneider/azure-powershell,devigned/azure-powershell,dulems/azure-powershell,AzureAutomationTeam/azure-powershell,zhencui/azure-powershell,jtlibing/azure-powershell,yantang-msft/azure-powershell | src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/BackupPolicyTests.cs | src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/BackupPolicyTests.cs | // ----------------------------------------------------------------------------------
//
// Copyright 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.
// ----------------------------------------------------------------------------------
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
namespace Microsoft.WindowsAzure.Commands.StorSimple.Test.ScenarioTests
{
public class BackupPolicyTests:StorSimpleTestBase
{
#region New-AzureStorSimpleDeviceBackupScheduleAddConfig
[Fact(Skip = "TODO: Failed in constructor, owner should look at it")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewBackupPolicyConfig()
{
RunPowerShellTest("Test-NewBackupPolicyAddConfig");
}
[Fact(Skip = "TODO: Failed in constructor, owner should look at it")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewBackupPolicyAddConfigDefaultValues()
{
RunPowerShellTest("Test-NewBackupPolicyAddConfig-DefaultValues");
}
#endregion New-AzureStorSimpleDeviceBackupScheduleAddConfig
}
}
| // ----------------------------------------------------------------------------------
//
// Copyright 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.
// ----------------------------------------------------------------------------------
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
namespace Microsoft.WindowsAzure.Commands.StorSimple.Test.ScenarioTests
{
public class BackupPolicyTests:StorSimpleTestBase
{
#region New-AzureStorSimpleDeviceBackupScheduleAddConfig
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewBackupPolicyConfig()
{
RunPowerShellTest("Test-NewBackupPolicyAddConfig");
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewBackupPolicyAddConfigDefaultValues()
{
RunPowerShellTest("Test-NewBackupPolicyAddConfig-DefaultValues");
}
#endregion New-AzureStorSimpleDeviceBackupScheduleAddConfig
}
}
| apache-2.0 | C# |
60a61fa3ed8679930cdd27b48a6fe23f141297ea | Update test | calebjenkins/Talks.CodeToDiFor,calebjenkins/Talks.CodeToDiFor,calebjenkins/Talks.CodeToDiFor | Talks.CodeToDiFor.Solution/Talks.C2DF.Tests/BetterAppTests/SuperApplicationConsoleAppTests.cs | Talks.CodeToDiFor.Solution/Talks.C2DF.Tests/BetterAppTests/SuperApplicationConsoleAppTests.cs | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Talks.C2DF.BetterApp;
using Talks.C2DF.BetterApp.Lib.Console;
using Talks.C2DF.Interfaces;
using Talks.C2DF.Interfaces.Models;
namespace Talks.C2DF.Tests.BetterAppTests
{
[TestClass]
public class SuperApplicationConsoleAppTests
{
// Mocks
//ISuperApplication senderApp;
//IConsole console;
const string ConsoleText = "Hello World";
SendResponse response;
[TestInitialize]
public void SetUp()
{
response = new SendResponse()
{
Message = ConsoleText,
Price = 10,
ResultMessage = "success"
};
}
[TestMethod]
public void When_Run_Should_ReadInputFrom_Console()
{
// set Up
var consoleColor = ConsoleColor.White;
var consoleMock = new Mock<IConsole>();
consoleMock.SetupGet(x => x.ForegroundColor).Returns(consoleColor).Verifiable();
consoleMock.SetupSet(x => x.ForegroundColor = consoleColor).Verifiable();
consoleMock.Setup(x => x.ReadLine()).Returns(ConsoleText).Verifiable();
consoleMock.Setup(x => x.ReadKey()).Returns(new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false));
consoleMock.Setup(x => x.Clear()).Verifiable();
consoleMock.Setup(x => x.WriteLine()).Verifiable();
consoleMock.Setup(x => x.Write(It.IsAny<string>()));
consoleMock.Setup(x => x.WriteLine(It.IsAny<string>()));
var appMock = new Mock<ISuperApplication>();
appMock.Setup(x => x.Send(It.Is<string>((value) => value == ConsoleText)))
.Returns(response)
.Verifiable();
// Test
var sut = new SuperApplicationConsoleApp(appMock.Object, consoleMock.Object);
sut.Run();
// Validate
consoleMock.VerifyAll();
appMock.Verify();
}
}
}
| using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Talks.C2DF.BetterApp;
using Talks.C2DF.BetterApp.Lib.Console;
using Talks.C2DF.Interfaces;
using Talks.C2DF.Interfaces.Models;
namespace Talks.C2DF.Tests.BetterAppTests
{
[TestClass]
public class SuperApplicationConsoleAppTests
{
// Mocks
//ISuperApplication senderApp;
//IConsole console;
const string ConsoleText = "Hello World";
SendResponse response;
[TestInitialize]
public void SetUp()
{
response = new SendResponse()
{
Message = ConsoleText,
Price = 10,
ResultMessage = "success"
};
}
[TestMethod]
public void When_Run_Should_ReadInputFrom_Console()
{
// set Up
var consoleColor = ConsoleColor.White;
var consoleMock = new Mock<IConsole>();
consoleMock.SetupGet(x => x.ForegroundColor).Returns(consoleColor).Verifiable();
consoleMock.SetupSet(x => x.ForegroundColor = consoleColor).Verifiable();
consoleMock.Setup(x => x.ReadLine()).Returns(ConsoleText).Verifiable();
consoleMock.Setup(x => x.ReadKey()).Returns(new ConsoleKeyInfo(' ', ConsoleKey.Spacebar, false, false, false));
consoleMock.Setup(x => x.Clear()).Verifiable();
consoleMock.Setup(x => x.WriteLine()).Verifiable();
consoleMock.Setup(x => x.Write(It.IsAny<string>()));
consoleMock.Setup(x => x.WriteLine(It.IsAny<string>()));
var appMock = new Mock<ISuperApplication>();
appMock.Setup(x => x.Send(It.Is<string>((value) => value == ConsoleText)))
.Returns(response)
.Verifiable();
// Test
var sut = new SuperApplicationConsoleApp(appMock.Object, consoleMock.Object);
sut.Run();
// Validate
consoleMock.Verify();
appMock.Verify();
}
}
}
| mit | C# |
e0a3df8344a1e51d18afc6a6844491d561d3198b | Handle update based on a path object as well as the directory/file | 15below/Ensconce,BlythMeister/Ensconce,BlythMeister/Ensconce,15below/Ensconce | src/Ensconce.Cake/EnsconceFileUpdateExtensions.cs | src/Ensconce.Cake/EnsconceFileUpdateExtensions.cs | using Cake.Core.IO;
using Ensconce.Update;
using System.IO;
namespace Ensconce.Cake
{
public static class EnsconceFileUpdateExtensions
{
public static void TextSubstitute(this IFile file, FilePath fixedStructureFile)
{
file.Path.TextSubstitute(fixedStructureFile);
}
public static void TextSubstitute(this IDirectory directory, FilePath fixedStructureFile)
{
directory.Path.TextSubstitute(fixedStructureFile);
}
public static void TextSubstitute(this IDirectory directory, string filter, FilePath fixedStructureFile)
{
directory.Path.TextSubstitute(filter, fixedStructureFile);
}
public static void TextSubstitute(this FilePath file, FilePath fixedStructureFile)
{
var tagDictionary = fixedStructureFile == null ? TagDictionaryBuilder.Build(string.Empty) : TagDictionaryBuilder.Build(fixedStructureFile.FullPath);
Update.ProcessFiles.UpdateFile(new FileInfo(file.FullPath), tagDictionary);
}
public static void TextSubstitute(this DirectoryPath directory, FilePath fixedStructureFile)
{
directory.TextSubstitute("*.*", fixedStructureFile);
}
public static void TextSubstitute(this DirectoryPath directory, string filter, FilePath fixedStructureFile)
{
var tagDictionary = fixedStructureFile == null ? TagDictionaryBuilder.Build(string.Empty) : TagDictionaryBuilder.Build(fixedStructureFile.FullPath);
Update.ProcessFiles.UpdateFiles(directory.FullPath, filter, tagDictionary);
}
}
}
| using Cake.Core.IO;
using Ensconce.Update;
using System.IO;
namespace Ensconce.Cake
{
public static class EnsconceFileUpdateExtensions
{
public static void TextSubstitute(this IFile file, FilePath fixedStructureFile)
{
var tagDictionary = fixedStructureFile == null ? TagDictionaryBuilder.Build(string.Empty) : TagDictionaryBuilder.Build(fixedStructureFile.FullPath);
Update.ProcessFiles.UpdateFile(new FileInfo(file.Path.FullPath), tagDictionary);
}
public static void TextSubstitute(this IDirectory directory, FilePath fixedStructureFile)
{
directory.TextSubstitute("*.*", fixedStructureFile);
}
public static void TextSubstitute(this IDirectory directory, string filter, FilePath fixedStructureFile)
{
var tagDictionary = fixedStructureFile == null ? TagDictionaryBuilder.Build(string.Empty) : TagDictionaryBuilder.Build(fixedStructureFile.FullPath);
Update.ProcessFiles.UpdateFiles(directory.Path.FullPath, filter, tagDictionary);
}
}
}
| mit | C# |
58ce5a2acb2e6b6ca467ca57feef93a5ed2abb8f | Refactor array initialization | setchi/n_back_tracer,setchi/n_back_tracer | Assets/Scripts/BackgroundPatternTracer.cs | Assets/Scripts/BackgroundPatternTracer.cs | using UnityEngine;
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UniRx;
public class BackgroundPatternTracer : MonoBehaviour {
public GameObject Tile;
public int col;
public int row;
void Awake () {
transform.localPosition = new Vector3(-col * 1.7f / 2, -row * 1.7f / 2, 10);
var tiles = Enumerable.Range(0, row).SelectMany(y => Enumerable.Range(0, col).Select(x => {
var obj = Instantiate(Tile) as GameObject;
obj.transform.SetParent(transform);
obj.transform.localPosition = new Vector3(x, y) * 1.7f;
return obj.GetComponent<Tile>();
})).ToArray();
var patterns = BackgroundPatternStore.GetPatterns();
var tileEffectEmitters = new List<Action<Tile>> {
tile => tile.EmitMarkEffect(),
tile => tile.EmitHintEffect()
};
Observable.Timer (TimeSpan.Zero, TimeSpan.FromSeconds (0.7f))
.Zip(patterns.ToObservable(), (a, b) => b).Repeat().Subscribe(pattern => {
var tileStream = Observable.Timer (TimeSpan.Zero, TimeSpan.FromSeconds (0.1f))
.Zip(pattern.ToObservable(), (a, b) => tiles[b]);
tileStream
.Do(tile => tileEffectEmitters[pattern.Peek() % 2](tile))
.Zip(tileStream.Skip(1), (prev, current) => new { prev, current })
.Subscribe(tile => tile.current.DrawLine(0.8f * (tile.prev.gameObject.transform.position - tile.current.gameObject.transform.position)))
.AddTo(gameObject);
}).AddTo(gameObject);
}
}
| using UnityEngine;
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UniRx;
public class BackgroundPatternTracer : MonoBehaviour {
public GameObject Tile;
public int col;
public int row;
void Awake () {
transform.localPosition = new Vector3(-col * 1.7f / 2, -row * 1.7f / 2, 10);
Tile[] tiles = new Tile[row * col];
Observable.Range(0, row).Subscribe(y => Observable.Range(0, col).Subscribe(x => {
var obj = Instantiate(Tile) as GameObject;
obj.transform.SetParent(transform);
obj.transform.localPosition = new Vector3(x, y) * 1.7f;
tiles[y * col + x] = obj.GetComponent<Tile>();
}));
var patterns = BackgroundPatternStore.GetPatterns();
var tileEffectEmitters = new List<Action<Tile>> {
tile => tile.EmitMarkEffect(),
tile => tile.EmitHintEffect()
};
Observable.Timer (TimeSpan.Zero, TimeSpan.FromSeconds (0.7f))
.Zip(patterns.ToObservable(), (a, b) => b).Repeat().Subscribe(pattern => {
var tileStream = Observable.Timer (TimeSpan.Zero, TimeSpan.FromSeconds (0.1f))
.Zip(pattern.ToObservable(), (a, b) => tiles[b]);
tileStream
.Do(tile => tileEffectEmitters[pattern.Peek() % 2](tile))
.Zip(tileStream.Skip(1), (prev, current) => new { prev, current })
.Subscribe(tile => tile.current.DrawLine(0.8f * (tile.prev.gameObject.transform.position - tile.current.gameObject.transform.position)))
.AddTo(gameObject);
}).AddTo(gameObject);
}
}
| mit | C# |
8a19ba6fd0aad26717bd5d2138985cd5844b9d64 | Remove dead OneShot mechanic of SampleChannel | paparony03/osu-framework,default0/osu-framework,ppy/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,RedNesto/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,default0/osu-framework,naoey/osu-framework,naoey/osu-framework,ZLima12/osu-framework,RedNesto/osu-framework,paparony03/osu-framework | osu.Framework/Audio/Sample/SampleChannel.cs | osu.Framework/Audio/Sample/SampleChannel.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Diagnostics;
namespace osu.Framework.Audio.Sample
{
public abstract class SampleChannel : AdjustableAudioComponent, IHasCompletedState
{
protected bool WasStarted;
public Sample Sample { get; protected set; }
public SampleChannel(Sample sample)
{
Debug.Assert(sample != null, "Can not use a null sample.");
Sample = sample;
}
public virtual void Play(bool restart = true)
{
WasStarted = true;
}
public virtual void Stop()
{
}
protected override void Dispose(bool disposing)
{
WasStarted = true;
Stop();
base.Dispose(disposing);
}
public abstract bool Playing { get; }
public virtual bool Played => WasStarted && !Playing;
public override bool HasCompleted => base.HasCompleted || Played;
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Diagnostics;
namespace osu.Framework.Audio.Sample
{
public abstract class SampleChannel : AdjustableAudioComponent, IHasCompletedState
{
protected bool WasStarted;
public Sample Sample { get; protected set; }
public SampleChannel(Sample sample)
{
Debug.Assert(sample != null, "Can not use a null sample.");
Sample = sample;
}
/// <summary>
/// Makes this sample fire-and-forget (will be cleaned up automatically).
/// </summary>
public bool OneShot;
public virtual void Play(bool restart = true)
{
WasStarted = true;
}
public virtual void Stop()
{
}
protected override void Dispose(bool disposing)
{
WasStarted = true;
Stop();
base.Dispose(disposing);
}
public abstract bool Playing { get; }
public virtual bool Played => WasStarted && !Playing;
public bool HasCompleted => Played && (OneShot || IsDisposed);
}
}
| mit | C# |
0ca87c03d6b9c621e2044ac3878a8453af904549 | Revert "fixed mandatory field error message" | vtfuture/BForms,vtfuture/BForms,vtfuture/BForms | BForms.Docs/Global.asax.cs | BForms.Docs/Global.asax.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using BForms.Models;
using BForms.Mvc;
namespace BForms.Docs
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
//register BForms validation provider
ModelValidatorProviders.Providers.Add(new BsModelValidatorProvider());
BForms.Utilities.BsResourceManager.Register(Resources.Resource.ResourceManager);
//BForms.Utilities.BsUIManager.Theme(BsTheme.Black);
#if !DEBUG
BForms.Utilities.BsConfigurationManager.Release(true);
#endif
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using BForms.Models;
using BForms.Mvc;
namespace BForms.Docs
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
//register BForms validation provider
ModelValidatorProviders.Providers.Add(new BsModelValidatorProvider());
BForms.Utilities.BsResourceManager.Register(Resources.Resource.ResourceManager);
//BForms.Utilities.BsUIManager.Theme(BsTheme.Black);
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
#if !DEBUG
BForms.Utilities.BsConfigurationManager.Release(true);
#endif
}
}
}
| mit | C# |
40c85d338f4b37dd1d399cc78abf7b497ea25f64 | Add DataReaderChunk.SetData() | 0xd4d/dnlib | src/DotNet/Writer/DataReaderChunk.cs | src/DotNet/Writer/DataReaderChunk.cs | // dnlib: See LICENSE.txt for more info
using System;
using System.IO;
using dnlib.IO;
using dnlib.PE;
namespace dnlib.DotNet.Writer {
/// <summary>
/// A <see cref="DataReader"/> chunk
/// </summary>
public class DataReaderChunk : IChunk {
FileOffset offset;
RVA rva;
DataReader data;
readonly uint virtualSize;
bool setOffsetCalled;
/// <inheritdoc/>
public FileOffset FileOffset => offset;
/// <inheritdoc/>
public RVA RVA => rva;
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">The data</param>
public DataReaderChunk(DataReader data)
: this(ref data) {
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">The data</param>
/// <param name="virtualSize">Virtual size of <paramref name="data"/></param>
public DataReaderChunk(DataReader data, uint virtualSize)
: this(ref data, virtualSize) {
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">The data</param>
internal DataReaderChunk(ref DataReader data)
: this(ref data, (uint)data.Length) {
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">The data</param>
/// <param name="virtualSize">Virtual size of <paramref name="data"/></param>
internal DataReaderChunk(ref DataReader data, uint virtualSize) {
this.data = data;
this.virtualSize = virtualSize;
}
/// <summary>
/// Gets the data reader
/// </summary>
public DataReader GetReader() => data;
/// <summary>
/// Replaces the old data with new data. The new data must be the same size as the old data if
/// <see cref="SetOffset(FileOffset, RVA)"/> has been called. That method gets called after
/// event <see cref="ModuleWriterEvent.BeginCalculateRvasAndFileOffsets"/>
/// </summary>
/// <param name="newData"></param>
public void SetData(DataReader newData) {
if (setOffsetCalled && newData.Length != data.Length)
throw new InvalidOperationException("New data must be the same size as the old data after SetOffset() has been called");
data = newData;
}
/// <inheritdoc/>
public void SetOffset(FileOffset offset, RVA rva) {
this.offset = offset;
this.rva = rva;
setOffsetCalled = true;
}
/// <inheritdoc/>
public uint GetFileLength() => (uint)data.Length;
/// <inheritdoc/>
public uint GetVirtualSize() => virtualSize;
/// <inheritdoc/>
public void WriteTo(BinaryWriter writer) {
data.Position = 0;
data.CopyTo(writer);
}
}
}
| // dnlib: See LICENSE.txt for more info
using System.IO;
using dnlib.IO;
using dnlib.PE;
namespace dnlib.DotNet.Writer {
/// <summary>
/// A <see cref="DataReader"/> chunk
/// </summary>
public class DataReaderChunk : IChunk {
FileOffset offset;
RVA rva;
DataReader data;
readonly uint virtualSize;
/// <inheritdoc/>
public FileOffset FileOffset => offset;
/// <inheritdoc/>
public RVA RVA => rva;
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">The data</param>
public DataReaderChunk(DataReader data)
: this(ref data) {
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">The data</param>
/// <param name="virtualSize">Virtual size of <paramref name="data"/></param>
public DataReaderChunk(DataReader data, uint virtualSize)
: this(ref data, virtualSize) {
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">The data</param>
internal DataReaderChunk(ref DataReader data)
: this(ref data, (uint)data.Length) {
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">The data</param>
/// <param name="virtualSize">Virtual size of <paramref name="data"/></param>
internal DataReaderChunk(ref DataReader data, uint virtualSize) {
this.data = data;
this.virtualSize = virtualSize;
}
/// <summary>
/// Gets the data reader
/// </summary>
public DataReader GetReader() => data;
/// <inheritdoc/>
public void SetOffset(FileOffset offset, RVA rva) {
this.offset = offset;
this.rva = rva;
}
/// <inheritdoc/>
public uint GetFileLength() => (uint)data.Length;
/// <inheritdoc/>
public uint GetVirtualSize() => virtualSize;
/// <inheritdoc/>
public void WriteTo(BinaryWriter writer) {
data.Position = 0;
data.CopyTo(writer);
}
}
}
| mit | C# |
45e59afcbb29fc012d98daf199481573cf5e921c | Change exception dump path | danielchalmers/DesktopWidgets | DesktopWidgets/Helpers/ExceptionHelper.cs | DesktopWidgets/Helpers/ExceptionHelper.cs | using System;
using System.IO;
using DesktopWidgets.Properties;
using Newtonsoft.Json;
namespace DesktopWidgets.Helpers
{
public static class ExceptionHelper
{
private static readonly string ExceptionDumpPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Resources.AppName);
public static void SaveException(Exception ex)
{
try
{
if (!Settings.Default.DumpUnhandledErrors)
{
return;
}
var serialised = JsonConvert.SerializeObject(ex, SettingsHelper.JsonSerializerSettingsAllTypeHandling);
var path = Path.Combine(ExceptionDumpPath, $"error-{Guid.NewGuid()}.json");
if (!Directory.Exists(ExceptionDumpPath))
{
Directory.CreateDirectory(ExceptionDumpPath);
}
File.WriteAllText(path, serialised);
}
catch
{
// ignored
}
}
}
} | using System;
using System.IO;
using DesktopWidgets.Properties;
using Newtonsoft.Json;
namespace DesktopWidgets.Helpers
{
public static class ExceptionHelper
{
private static readonly string ExceptionDumpPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Resources.AppName, "Errors");
public static void SaveException(Exception ex)
{
try
{
if (!Settings.Default.DumpUnhandledErrors)
{
return;
}
var serialised = JsonConvert.SerializeObject(ex, SettingsHelper.JsonSerializerSettingsAllTypeHandling);
var path = Path.Combine(ExceptionDumpPath, $"error-{Guid.NewGuid()}.json");
if (!Directory.Exists(ExceptionDumpPath))
{
Directory.CreateDirectory(ExceptionDumpPath);
}
File.WriteAllText(path, serialised);
}
catch
{
// ignored
}
}
}
} | apache-2.0 | C# |
25f1d580ad39f53169bd9d36108f289d4dae2164 | Change RawUrl to AbsoluteUri | TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets | guides/request-validation-csharp/example-1/example-1.cs | guides/request-validation-csharp/example-1/example-1.cs | using System;
using System.Configuration;
using System.Web;
using System.Net;
using System.Web.Mvc;
using Twilio.Security;
namespace ValidateRequestExample.Filters
{
[AttributeUsage(AttributeTargets.Method)]
public class ValidateTwilioRequestAttribute : ActionFilterAttribute
{
private readonly RequestValidator _requestValidator;
public ValidateTwilioRequestAttributeRequestAttribute()
{
var authToken = ConfigurationManager.AppSettings["TwilioAuthToken"];
_requestValidator = new RequestValidator(authToken);
}
public override void OnActionExecuting(ActionExecutingContext actionContext)
{
var context = actionContext.HttpContext;
if(!IsValidRequest(context.Request))
{
actionContext.Result = new HttpStatusCodeResult(HttpStatusCode.Forbidden);
}
base.OnActionExecuting(actionContext);
}
private bool IsValidRequest(HttpRequestBase request) {
var signature = request.Headers["X-Twilio-Signature"];
var requestUrl = request.Url.AbsoluteUri;
return _requestValidator.Validate(requestUrl, request.Form, signature);
}
}
}
| using System;
using System.Configuration;
using System.Web;
using System.Net;
using System.Web.Mvc;
using Twilio.Security;
namespace ValidateRequestExample.Filters
{
[AttributeUsage(AttributeTargets.Method)]
public class ValidateTwilioRequestAttribute : ActionFilterAttribute
{
private readonly RequestValidator _requestValidator;
public ValidateTwilioRequestAttributeRequestAttribute()
{
var authToken = ConfigurationManager.AppSettings["TwilioAuthToken"];
_requestValidator = new RequestValidator(authToken);
}
public override void OnActionExecuting(ActionExecutingContext actionContext)
{
var context = actionContext.HttpContext;
if(!IsValidRequest(context.Request))
{
actionContext.Result = new HttpStatusCodeResult(HttpStatusCode.Forbidden);
}
base.OnActionExecuting(actionContext);
}
private bool IsValidRequest(HttpRequestBase request) {
var signature = request.Headers["X-Twilio-Signature"];
var requestUrl = request.RawUrl;
return _requestValidator.Validate(requestUrl, request.Form, signature);
}
}
}
| mit | C# |
fa68ac768eb7359c6d572c1f2c047f2b9e7f6df7 | Write process stdout to console | ermshiperete/il-repack,SiliconStudio/il-repack,devitalio/il-repack,timotei/il-repack,RomainHautefeuille/il-repack,mzboray/il-repack,lovewitty/il-repack,xen2/il-repack,MainMa/il-repack,AColmant/il-repack,huoxudong125/il-repack,emanuelvarga/il-repack,gluck/il-repack | ILRepack.IntegrationTests/WPFScenarios.cs | ILRepack.IntegrationTests/WPFScenarios.cs | using NUnit.Framework;
using System;
using System.Diagnostics;
using System.IO;
namespace ILRepack.IntegrationTests
{
[TestFixture]
public class WPFScenarios
{
private const int ScenarioProcessWaitTimeInMs = 10000;
[Test]
public void GivenXAMLThatUsesLibraryClass_MergedWPFApplicationRunsSuccessfully()
{
RunScenario("LibraryClassUsageInXAML");
}
private void RunScenario(string scenarioName)
{
string scenarioExecutable = GetScenarioExecutable(scenarioName);
AssertFileExists(scenarioExecutable);
var processStartInfo = new ProcessStartInfo(scenarioExecutable)
{
RedirectStandardOutput = true,
UseShellExecute = false
};
Process process = Process.Start(processStartInfo);
Assert.NotNull(process);
bool processEnded = process.WaitForExit(ScenarioProcessWaitTimeInMs);
Assert.That(processEnded, Is.True, "Process has not ended.");
Console.WriteLine("\nScenario '{0}' STDOUT: {1}", scenarioName, process.StandardOutput.ReadToEnd());
Assert.That(process.ExitCode, Is.EqualTo(0), "Process exited with error");
}
private string GetScenarioExecutable(string scenarioName)
{
string scenariosDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Scenarios\");
string scenarioDirectory = Path.Combine(scenariosDirectory, scenarioName);
string scenarioExecutableFileName = scenarioName + ".exe";
return Path.GetFullPath(Path.Combine(
scenarioDirectory,
"bin",
GetRunningConfiguration(),
"merged",
scenarioExecutableFileName));
}
private static void AssertFileExists(string filePath)
{
if (!File.Exists(filePath))
{
Assert.Fail("File '{0}' does not exist.", filePath);
}
}
private string GetRunningConfiguration()
{
#if DEBUG
return "Debug";
#else
return "Release";
#endif
}
}
}
| using NUnit.Framework;
using System.Diagnostics;
using System.IO;
namespace ILRepack.IntegrationTests
{
[TestFixture]
public class WPFScenarios
{
private const int ScenarioProcessWaitTimeInMs = 2000;
[Test]
public void GivenXAMLThatUsesLibraryClass_MergedWPFApplicationRunsSuccessfully()
{
RunScenario("LibraryClassUsageInXAML");
}
private void RunScenario(string scenarioName)
{
string scenarioExecutable = GetScenarioExecutable(scenarioName);
AssertFileExists(scenarioExecutable);
Process process = Process.Start(scenarioExecutable);
Assert.NotNull(process);
bool processEnded = process.WaitForExit(ScenarioProcessWaitTimeInMs);
Assert.IsTrue(processEnded);
Assert.AreEqual(0, process.ExitCode);
}
private string GetScenarioExecutable(string scenarioName)
{
string scenariosDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Scenarios\");
string scenarioDirectory = Path.Combine(scenariosDirectory, scenarioName);
string scenarioExecutableFileName = scenarioName + ".exe";
return Path.GetFullPath(Path.Combine(
scenarioDirectory,
"bin",
GetRunningConfiguration(),
"merged",
scenarioExecutableFileName));
}
private static void AssertFileExists(string filePath)
{
if (!File.Exists(filePath))
{
Assert.Fail("File '{0}' does not exist.", filePath);
}
}
private string GetRunningConfiguration()
{
#if DEBUG
return "Debug";
#else
return "Release";
#endif
}
}
}
| apache-2.0 | C# |
935d2ed12f00a91b3427883d47a2929fdca20c6c | Update GeraldVersluis.cs (#598) | planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin | src/Firehose.Web/Authors/GeraldVersluis.cs | src/Firehose.Web/Authors/GeraldVersluis.cs | using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class GeraldVersluis : IWorkAtXamarinOrMicrosoft
{
public string FirstName => "Gerald";
public string LastName => "Versluis";
public string StateOrRegion => "The Netherlands";
public string EmailAddress => "gerald@verslu.is";
public string ShortBioOrTagLine => "Software Engineer at Microsoft on the Xamarin.Forms team";
public Uri WebSite => new Uri("https://blog.verslu.is/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://blog.verslu.is/feed/"); }
}
public string TwitterHandle => "jfversluis";
public string GravatarHash => "f9d4d4211d7956ce3e07e83df0889731";
public string GitHubHandle => "jfversluis";
public GeoPosition Position => new GeoPosition(50.889039, 5.853717);
public string FeedLanguageCode => "en";
}
}
| using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class GeraldVersluis : IAmAMicrosoftMVP
{
public string FirstName => "Gerald";
public string LastName => "Versluis";
public string StateOrRegion => "The Netherlands";
public string EmailAddress => "gerald@verslu.is";
public string ShortBioOrTagLine => "builds awesome Xamarin apps, speaks, blogs, trains, writes and has this weird thing for unicorns";
public Uri WebSite => new Uri("https://blog.verslu.is/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://blog.verslu.is/feed/"); }
}
public string TwitterHandle => "jfversluis";
public string GravatarHash => "f9d4d4211d7956ce3e07e83df0889731";
public string GitHubHandle => "jfversluis";
public GeoPosition Position => new GeoPosition(50.889039, 5.853717);
public string FeedLanguageCode => "en";
}
} | mit | C# |
c78ffc146eb28a16e2537ff42d56576fefb6acc5 | Update Mathieu Buisson info | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/MathieuBuisson.cs | src/Firehose.Web/Authors/MathieuBuisson.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MathieuBuisson : IAmACommunityMember, IFilterMyBlogPosts
{
public string FirstName => "Mathieu";
public string LastName => "Buisson";
public string ShortBioOrTagLine => "Senior DevOps Engineer. Working on Dev, Ops and everything in between";
public string StateOrRegion => "Dublin, Ireland";
public string EmailAddress => "";
public string TwitterHandle => "TheShellNut";
public string GravatarHash => "25061653796d5c748192c68e2eb6bde8";
public Uri WebSite => new Uri("https://mathieubuisson.github.io/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://mathieubuisson.github.io/feed.xml"); }
}
public string GitHubHandle => "MathieuBuisson";
public bool Filter(SyndicationItem item)
{
return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell"));
}
public GeoPosition Position => new GeoPosition(53.294469, -6.141136);
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MathieuBuisson : IAmACommunityMember, IFilterMyBlogPosts
{
public string FirstName => "Mathieu";
public string LastName => "Buisson";
public string ShortBioOrTagLine => "Senior DevOps Engineer. Works on deployment automation, mostly with PowerShell and DSC.";
public string StateOrRegion => "Dublin, Ireland";
public string EmailAddress => "";
public string TwitterHandle => "TheShellNut";
public string GravatarHash => "25061653796d5c748192c68e2eb6bde8";
public Uri WebSite => new Uri("http://theshellnut.com/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://theshellnut.com/feed/"); }
}
public string GitHubHandle => "MathieuBuisson";
public bool Filter(SyndicationItem item)
{
return item.Categories.Where(i => i.Name.Equals("powershell", StringComparison.OrdinalIgnoreCase)).Any();
}
public GeoPosition Position => new GeoPosition(53.294469, -6.141136);
}
} | mit | C# |
66e4559f7891ac243e4bf9e97cc4831b23169d42 | clean up route information | dnauck/License.Manager,dnauck/License.Manager | src/License.Manager.Core/Model/Customer.cs | src/License.Manager.Core/Model/Customer.cs | using ServiceStack.ServiceHost;
namespace License.Manager.Core.Model
{
[Route("/customers", "POST, OPTIONS")]
[Route("/customers/{Id}", "GET, PUT, DELETE, OPTIONS")]
public class Customer : EntityBase, IReturn<Customer>
{
public string Name { get; set; }
public string Company { get; set; }
public string Email { get; set; }
}
} | using ServiceStack.ServiceHost;
namespace License.Manager.Core.Model
{
[Route("/customers", "POST")]
[Route("/customers/{Id}", "PUT, DELETE")]
[Route("/customers/{Id}", "GET, OPTIONS")]
public class Customer : EntityBase, IReturn<Customer>
{
public string Name { get; set; }
public string Company { get; set; }
public string Email { get; set; }
}
} | mit | C# |
b13fd9b50e07f3371e87944085012d76280eb170 | correct waiting for completion in PubSub example | VictorScherbakov/SharpChannels | Examples/PubSub/Program.cs | Examples/PubSub/Program.cs | using System;
using System.Net;
using System.Threading;
using SharpChannels.Core;
using SharpChannels.Core.Channels;
using SharpChannels.Core.Channels.Tcp;
using SharpChannels.Core.Communication;
using SharpChannels.Core.Messages;
using SharpChannels.Core.Serialization;
namespace Examples.PubSub
{
class Program
{
private static int _closedChannels;
private static IChannel<StringMessage> Subscribe(ICommunicationObjectsFactory<StringMessage> factory, string clientName)
{
return Scenarios.PubSub.SetupSubscription(factory, new []{ "topic" })
.UsingMessageReceivedHandler((sender, a) => { Console.WriteLine($"{clientName} received message: {a.Message}"); })
.UsingChannelClosedHandler((sender, args) => { Interlocked.Increment(ref _closedChannels); })
.Go();
}
static void Main(string[] args)
{
var serializer = new StringMessageSerializer();
var serverFactory = new TcpCommunicationObjectsFactory<StringMessage>(new TcpEndpointData(IPAddress.Any, 2000), serializer);
using (var publisher = Scenarios.PubSub.Publisher(serverFactory))
{
var clientFactory = new TcpCommunicationObjectsFactory<StringMessage>(new TcpEndpointData(IPAddress.Loopback, 2000), serializer);
using (Subscribe(clientFactory, "client1"))
using (Subscribe(clientFactory, "client2"))
using (Subscribe(clientFactory, "client3"))
{
publisher.Broadcast("topic", new StringMessage("broadcast message 1"));
publisher.Broadcast("topic", new StringMessage("broadcast message 2"));
publisher.Broadcast("topic", new StringMessage("broadcast message 3"));
while (_closedChannels < 3)
{
Thread.Sleep(0);
}
}
}
Console.ReadKey();
}
}
}
| using System;
using System.Net;
using SharpChannels.Core;
using SharpChannels.Core.Channels;
using SharpChannels.Core.Channels.Tcp;
using SharpChannels.Core.Communication;
using SharpChannels.Core.Messages;
using SharpChannels.Core.Serialization;
namespace Examples.PubSub
{
class Program
{
private static IChannel<StringMessage> Subscribe(ICommunicationObjectsFactory<StringMessage> factory, string clientName)
{
return Scenarios.PubSub.SetupSubscription(factory, new []{ "topic" })
.UsingMessageReceivedHandler((sender, a) => { Console.WriteLine($"{clientName} received message: {a.Message}"); })
.Go();
}
static void Main(string[] args)
{
var serializer = new StringMessageSerializer();
var serverFactory = new TcpCommunicationObjectsFactory<StringMessage>(new TcpEndpointData(IPAddress.Any, 2000), serializer);
using (var publisher = Scenarios.PubSub.Publisher(serverFactory))
{
var clientFactory = new TcpCommunicationObjectsFactory<StringMessage>(new TcpEndpointData(IPAddress.Loopback, 2000), serializer);
using (var subscription1 = Subscribe(clientFactory, "client1"))
using (var subscription2 = Subscribe(clientFactory, "client2"))
using (var subscription3 = Subscribe(clientFactory, "client3"))
{
publisher.Broadcast("topic", new StringMessage("broadcast message 1"));
publisher.Broadcast("topic", new StringMessage("broadcast message 2"));
publisher.Broadcast("topic", new StringMessage("broadcast message 3"));
subscription3.Close();
subscription2.Close();
subscription1.Close();
}
}
Console.ReadKey();
}
}
}
| mit | C# |
9c3e74131f01a804661539b3f00f4010a4946390 | Add a const string field for the If-None-Match HTTP header | ZocDoc/ServiceStack,NServiceKit/NServiceKit,MindTouch/NServiceKit,NServiceKit/NServiceKit,nataren/NServiceKit,ZocDoc/ServiceStack,NServiceKit/NServiceKit,NServiceKit/NServiceKit,ZocDoc/ServiceStack,timba/NServiceKit,timba/NServiceKit,MindTouch/NServiceKit,nataren/NServiceKit,timba/NServiceKit,nataren/NServiceKit,ZocDoc/ServiceStack,MindTouch/NServiceKit,nataren/NServiceKit,timba/NServiceKit,MindTouch/NServiceKit | src/ServiceStack.Common/Web/HttpHeaders.cs | src/ServiceStack.Common/Web/HttpHeaders.cs | namespace ServiceStack.Common.Web
{
public static class HttpHeaders
{
public const string XParamOverridePrefix = "X-Param-Override-";
public const string XHttpMethodOverride = "X-Http-Method-Override";
public const string XUserAuthId = "X-UAId";
public const string XForwardedFor = "X-Forwarded-For";
public const string XRealIp = "X-Real-IP";
public const string Referer = "Referer";
public const string CacheControl = "Cache-Control";
public const string IfModifiedSince = "If-Modified-Since";
public const string IfNoneMatch = "If-None-Match";
public const string LastModified = "Last-Modified";
public const string Accept = "Accept";
public const string AcceptEncoding = "Accept-Encoding";
public const string ContentType = "Content-Type";
public const string ContentEncoding = "Content-Encoding";
public const string ContentLength = "Content-Length";
public const string ContentDisposition = "Content-Disposition";
public const string Location = "Location";
public const string SetCookie = "Set-Cookie";
public const string ETag = "ETag";
public const string Authorization = "Authorization";
public const string WwwAuthenticate = "WWW-Authenticate";
public const string AllowOrigin = "Access-Control-Allow-Origin";
public const string AllowMethods = "Access-Control-Allow-Methods";
public const string AllowHeaders = "Access-Control-Allow-Headers";
public const string AllowCredentials = "Access-Control-Allow-Credentials";
}
} | namespace ServiceStack.Common.Web
{
public static class HttpHeaders
{
public const string XParamOverridePrefix = "X-Param-Override-";
public const string XHttpMethodOverride = "X-Http-Method-Override";
public const string XUserAuthId = "X-UAId";
public const string XForwardedFor = "X-Forwarded-For";
public const string XRealIp = "X-Real-IP";
public const string Referer = "Referer";
public const string CacheControl = "Cache-Control";
public const string IfModifiedSince = "If-Modified-Since";
public const string LastModified = "Last-Modified";
public const string Accept = "Accept";
public const string AcceptEncoding = "Accept-Encoding";
public const string ContentType = "Content-Type";
public const string ContentEncoding = "Content-Encoding";
public const string ContentLength = "Content-Length";
public const string ContentDisposition = "Content-Disposition";
public const string Location = "Location";
public const string SetCookie = "Set-Cookie";
public const string ETag = "ETag";
public const string Authorization = "Authorization";
public const string WwwAuthenticate = "WWW-Authenticate";
public const string AllowOrigin = "Access-Control-Allow-Origin";
public const string AllowMethods = "Access-Control-Allow-Methods";
public const string AllowHeaders = "Access-Control-Allow-Headers";
public const string AllowCredentials = "Access-Control-Allow-Credentials";
}
} | bsd-3-clause | C# |
2878aac6892eed07086ec9ea3f35aa72b2f21969 | check if controller is JsonApiController | json-api-dotnet/JsonApiDotNetCore,Research-Institute/json-api-dotnet-core,Research-Institute/json-api-dotnet-core | src/JsonApiDotNetCore/Internal/DasherizedRoutingConvention.cs | src/JsonApiDotNetCore/Internal/DasherizedRoutingConvention.cs | // REF: https://github.com/aspnet/Entropy/blob/dev/samples/Mvc.CustomRoutingConvention/NameSpaceRoutingConvention.cs
// REF: https://github.com/aspnet/Mvc/issues/5691
using JsonApiDotNetCore.Controllers;
using JsonApiDotNetCore.Extensions;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace JsonApiDotNetCore.Internal
{
public class DasherizedRoutingConvention : IApplicationModelConvention
{
private string _namespace;
public DasherizedRoutingConvention(string nspace)
{
_namespace = nspace;
}
public void Apply(ApplicationModel application)
{
foreach (var controller in application.Controllers)
{
if (IsJsonApiController(controller))
{
var template = $"{_namespace}/{controller.ControllerName.Dasherize()}";
controller.Selectors[0].AttributeRouteModel = new AttributeRouteModel()
{
Template = template
};
}
}
}
private bool IsJsonApiController(ControllerModel controller)
{
var controllerBaseType = controller.ControllerType.BaseType;
if(!controllerBaseType.IsConstructedGenericType) return false;
var genericTypeDefinition = controllerBaseType.GetGenericTypeDefinition();
return (genericTypeDefinition == typeof(JsonApiController<,>) || genericTypeDefinition == typeof(JsonApiController<>));
}
}
}
| // REF: https://github.com/aspnet/Entropy/blob/dev/samples/Mvc.CustomRoutingConvention/NameSpaceRoutingConvention.cs
// REF: https://github.com/aspnet/Mvc/issues/5691
using JsonApiDotNetCore.Extensions;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace JsonApiDotNetCore.Internal
{
public class DasherizedRoutingConvention : IApplicationModelConvention
{
private string _namespace;
public DasherizedRoutingConvention(string nspace)
{
_namespace = nspace;
}
public void Apply(ApplicationModel application)
{
foreach (var controller in application.Controllers)
{
var template = $"{_namespace}/{controller.ControllerName.Dasherize()}";
controller.Selectors[0].AttributeRouteModel = new AttributeRouteModel()
{
Template = template
};
}
}
}
}
| mit | C# |
af7da7963e9b8cb8671bcbfa37a06a22a7578973 | Update List.cshtml | yersans/Orchard,Codinlab/Orchard,jimasp/Orchard,Fogolan/OrchardForWork,vairam-svs/Orchard,Codinlab/Orchard,aaronamm/Orchard,tobydodds/folklife,jersiovic/Orchard,aaronamm/Orchard,bedegaming-aleksej/Orchard,OrchardCMS/Orchard,johnnyqian/Orchard,li0803/Orchard,Serlead/Orchard,jchenga/Orchard,bedegaming-aleksej/Orchard,hannan-azam/Orchard,yersans/Orchard,AdvantageCS/Orchard,Lombiq/Orchard,rtpHarry/Orchard,Dolphinsimon/Orchard,hannan-azam/Orchard,jimasp/Orchard,gcsuk/Orchard,mvarblow/Orchard,tobydodds/folklife,grapto/Orchard.CloudBust,jimasp/Orchard,fassetar/Orchard,aaronamm/Orchard,jtkech/Orchard,jersiovic/Orchard,sfmskywalker/Orchard,omidnasri/Orchard,tobydodds/folklife,gcsuk/Orchard,ehe888/Orchard,sfmskywalker/Orchard,tobydodds/folklife,vairam-svs/Orchard,OrchardCMS/Orchard,vairam-svs/Orchard,sfmskywalker/Orchard,jagraz/Orchard,brownjordaninternational/OrchardCMS,grapto/Orchard.CloudBust,aaronamm/Orchard,brownjordaninternational/OrchardCMS,omidnasri/Orchard,ehe888/Orchard,mvarblow/Orchard,yersans/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,grapto/Orchard.CloudBust,IDeliverable/Orchard,abhishekluv/Orchard,LaserSrl/Orchard,Praggie/Orchard,tobydodds/folklife,jersiovic/Orchard,SouleDesigns/SouleDesigns.Orchard,ehe888/Orchard,rtpHarry/Orchard,ehe888/Orchard,abhishekluv/Orchard,AdvantageCS/Orchard,li0803/Orchard,Codinlab/Orchard,rtpHarry/Orchard,jchenga/Orchard,phillipsj/Orchard,xkproject/Orchard,Dolphinsimon/Orchard,SouleDesigns/SouleDesigns.Orchard,dmitry-urenev/extended-orchard-cms-v10.1,Lombiq/Orchard,phillipsj/Orchard,abhishekluv/Orchard,li0803/Orchard,ehe888/Orchard,phillipsj/Orchard,omidnasri/Orchard,omidnasri/Orchard,omidnasri/Orchard,rtpHarry/Orchard,hannan-azam/Orchard,Praggie/Orchard,sfmskywalker/Orchard,sfmskywalker/Orchard,hbulzy/Orchard,jagraz/Orchard,armanforghani/Orchard,Dolphinsimon/Orchard,phillipsj/Orchard,LaserSrl/Orchard,Lombiq/Orchard,bedegaming-aleksej/Orchard,jchenga/Orchard,IDeliverable/Orchard,Serlead/Orchard,johnnyqian/Orchard,li0803/Orchard,Dolphinsimon/Orchard,LaserSrl/Orchard,rtpHarry/Orchard,Fogolan/OrchardForWork,brownjordaninternational/OrchardCMS,jtkech/Orchard,hbulzy/Orchard,Serlead/Orchard,gcsuk/Orchard,IDeliverable/Orchard,Codinlab/Orchard,Codinlab/Orchard,Fogolan/OrchardForWork,AdvantageCS/Orchard,abhishekluv/Orchard,mvarblow/Orchard,abhishekluv/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,johnnyqian/Orchard,hannan-azam/Orchard,Fogolan/OrchardForWork,fassetar/Orchard,jagraz/Orchard,hbulzy/Orchard,SouleDesigns/SouleDesigns.Orchard,OrchardCMS/Orchard,fassetar/Orchard,SouleDesigns/SouleDesigns.Orchard,aaronamm/Orchard,IDeliverable/Orchard,Dolphinsimon/Orchard,bedegaming-aleksej/Orchard,johnnyqian/Orchard,grapto/Orchard.CloudBust,armanforghani/Orchard,jimasp/Orchard,mvarblow/Orchard,gcsuk/Orchard,sfmskywalker/Orchard,Lombiq/Orchard,grapto/Orchard.CloudBust,hbulzy/Orchard,brownjordaninternational/OrchardCMS,jtkech/Orchard,xkproject/Orchard,Serlead/Orchard,IDeliverable/Orchard,AdvantageCS/Orchard,xkproject/Orchard,SouleDesigns/SouleDesigns.Orchard,tobydodds/folklife,hannan-azam/Orchard,fassetar/Orchard,gcsuk/Orchard,phillipsj/Orchard,brownjordaninternational/OrchardCMS,sfmskywalker/Orchard,Serlead/Orchard,LaserSrl/Orchard,omidnasri/Orchard,Fogolan/OrchardForWork,Praggie/Orchard,li0803/Orchard,bedegaming-aleksej/Orchard,jersiovic/Orchard,xkproject/Orchard,OrchardCMS/Orchard,hbulzy/Orchard,armanforghani/Orchard,AdvantageCS/Orchard,Praggie/Orchard,jchenga/Orchard,mvarblow/Orchard,jagraz/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,yersans/Orchard,omidnasri/Orchard,omidnasri/Orchard,armanforghani/Orchard,omidnasri/Orchard,abhishekluv/Orchard,xkproject/Orchard,Praggie/Orchard,OrchardCMS/Orchard,armanforghani/Orchard,sfmskywalker/Orchard,Lombiq/Orchard,yersans/Orchard,vairam-svs/Orchard,johnnyqian/Orchard,fassetar/Orchard,jagraz/Orchard,jchenga/Orchard,jtkech/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,grapto/Orchard.CloudBust,jersiovic/Orchard,vairam-svs/Orchard,jtkech/Orchard,LaserSrl/Orchard,jimasp/Orchard | src/Orchard.Web/Modules/Orchard.Lists/Views/Admin/List.cshtml | src/Orchard.Web/Modules/Orchard.Lists/Views/Admin/List.cshtml | @using Orchard.ContentManagement.MetaData.Models
@using Orchard.Core.Containers.Models
@using Orchard.ContentManagement;
@{
Style.Require("jQueryColorBox");
Style.Include("nprogress.css");
Style.Include("common-admin.css", "common-admin.min.css");
Style.Include("list-admin.css", "list-admin.min.css");
Script.Require("ContentPicker").AtFoot();
Script.Require("jQueryUI_Sortable").AtFoot();
Script.Require("jQueryColorBox");
Script.Include("nprogress.js", "nprogress.min.js").AtFoot();
Script.Include("orchard-lists-admin.js", "orchard-lists-admin.min.js").AtFoot();
var containerId = ((int?)Model.ContainerId).GetValueOrDefault();
var container = ((ContentItem)Model.Container).As<ContainerPart>();
var itemContentTypes = (IList<ContentTypeDefinition>)Model.ItemContentTypes;
Layout.Title = T("Manage {0}", Model.ContainerDisplayName);
}
<div id="listManagement" @if (container.EnablePositioning) { <text>class="sortable"</text> }
data-baseurl="@WorkContext.CurrentSite.BaseUrl"
data-itemtypes="@String.Join(",", itemContentTypes.Select(x => x.Name))"
data-update-url="@Url.Action("UpdatePositions", "Admin", new { containerId = Model.ContainerId, page = Model.Pager.Page, pageSize = Model.Pager.PageSize })"
data-insert-url="@Url.Action("Insert", "Admin", new { containerId = Model.ContainerId, page = Model.Pager.Page, pageSize = Model.Pager.PageSize })"
data-refresh-url="@Url.Action("List", "Admin", new { containerId = Model.ContainerId, page = Model.Pager.Page, pageSize = Model.Pager.PageSize })"
data-dragdrop="@container.EnablePositioning.ToString().ToLower()">
@Display.Breadcrumbs_ContentItem(ContentItem: Model.Container, ContainerAccessor: Model.ContainerAccessor)
@Display.Parts_Container_Manage(
ContainerDisplayName: Model.ContainerDisplayName,
ContainerContentType: Model.ContainerContentType,
ContainerId: containerId,
ItemContentTypes: itemContentTypes)
@using (Html.BeginFormAntiForgeryPost()) {
@Display.Parts_Container_BulkActions(Options: Model.Options, Container: container)
@Display.ListViewButtons(Providers: Model.ListViewProviders, ActiveProvider: Model.ListViewProvider)
@Display(Model.ListView)
}
</div>
@if (Model.ListNavigation != null) {
@Display(Model.ListNavigation)
}
| @using Orchard.ContentManagement.MetaData.Models
@using Orchard.Core.Containers.Models
@using Orchard.ContentManagement;
@{
Style.Require("jQueryColorBox");
Style.Include("nprogress.css", "nprogress.min.css");
Style.Include("common-admin.css", "common-admin.min.css");
Style.Include("list-admin.css", "list-admin.min.css");
Script.Require("ContentPicker").AtFoot();
Script.Require("jQueryUI_Sortable").AtFoot();
Script.Require("jQueryColorBox");
Script.Include("nprogress.js", "nprogress.min.js").AtFoot();
Script.Include("orchard-lists-admin.js", "orchard-lists-admin.min.js").AtFoot();
var containerId = ((int?)Model.ContainerId).GetValueOrDefault();
var container = ((ContentItem)Model.Container).As<ContainerPart>();
var itemContentTypes = (IList<ContentTypeDefinition>)Model.ItemContentTypes;
Layout.Title = T("Manage {0}", Model.ContainerDisplayName);
}
<div id="listManagement" @if (container.EnablePositioning) { <text>class="sortable"</text> }
data-baseurl="@WorkContext.CurrentSite.BaseUrl"
data-itemtypes="@String.Join(",", itemContentTypes.Select(x => x.Name))"
data-update-url="@Url.Action("UpdatePositions", "Admin", new { containerId = Model.ContainerId, page = Model.Pager.Page, pageSize = Model.Pager.PageSize })"
data-insert-url="@Url.Action("Insert", "Admin", new { containerId = Model.ContainerId, page = Model.Pager.Page, pageSize = Model.Pager.PageSize })"
data-refresh-url="@Url.Action("List", "Admin", new { containerId = Model.ContainerId, page = Model.Pager.Page, pageSize = Model.Pager.PageSize })"
data-dragdrop="@container.EnablePositioning.ToString().ToLower()">
@Display.Breadcrumbs_ContentItem(ContentItem: Model.Container, ContainerAccessor: Model.ContainerAccessor)
@Display.Parts_Container_Manage(
ContainerDisplayName: Model.ContainerDisplayName,
ContainerContentType: Model.ContainerContentType,
ContainerId: containerId,
ItemContentTypes: itemContentTypes)
@using (Html.BeginFormAntiForgeryPost()) {
@Display.Parts_Container_BulkActions(Options: Model.Options, Container: container)
@Display.ListViewButtons(Providers: Model.ListViewProviders, ActiveProvider: Model.ListViewProvider)
@Display(Model.ListView)
}
</div>
@if (Model.ListNavigation != null) {
@Display(Model.ListNavigation)
} | bsd-3-clause | C# |
86e6e4e6dcf19b4bea249e669cf5c4f097bb6a5f | Bump assembly version to 3.0 | serilog/serilog-sinks-periodicbatching | src/Serilog.Sinks.PeriodicBatching/Properties/AssemblyInfo.cs | src/Serilog.Sinks.PeriodicBatching/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: CLSCompliant(true)]
[assembly: InternalsVisibleTo("Serilog.Sinks.PeriodicBatching.Tests, PublicKey=" +
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" +
"6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" +
"d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" +
"94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" +
"b19485ec")]
[assembly: InternalsVisibleTo("Serilog.Sinks.PeriodicBatching.PerformanceTests, PublicKey=" +
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" +
"6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" +
"d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" +
"94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" +
"b19485ec")]
| using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: CLSCompliant(true)]
[assembly: InternalsVisibleTo("Serilog.Sinks.PeriodicBatching.Tests, PublicKey=" +
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" +
"6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" +
"d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" +
"94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" +
"b19485ec")]
[assembly: InternalsVisibleTo("Serilog.Sinks.PeriodicBatching.PerformanceTests, PublicKey=" +
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" +
"6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" +
"d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" +
"94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" +
"b19485ec")]
| apache-2.0 | C# |
80b1f8dc1de08c3d03b78ebf5aaa5082eec79d14 | Update version number. | Damnae/storybrew | editor/Properties/AssemblyInfo.cs | editor/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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[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("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.50.*")]
| 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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[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("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.49.*")]
| mit | C# |
8412452aa6e56b532324b75fc782201d568886fe | Remove two second delay on tray icon | zr40/kyru-dotnet,zr40/kyru-dotnet | Kyru/SystemTray.cs | Kyru/SystemTray.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using Kyru.Core;
using Kyru.Utilities;
namespace Kyru
{
internal class SystemTray : ITimerListener
{
private readonly KyruApplication app;
private readonly NotifyIcon trayIcon;
private readonly ContextMenu trayMenu;
private bool connected;
private readonly Icon iconNotConnected;
private readonly Icon iconConnected;
internal SystemTray(KyruApplication app)
{
this.app = app;
trayMenu = new ContextMenu();
trayMenu.MenuItems.Add("Log in", OnLogin);
trayMenu.MenuItems.Add("Connect", OnRegisterNode);
trayMenu.MenuItems.Add("-");
trayMenu.MenuItems.Add("System status", OnSystemStatus);
trayMenu.MenuItems.Add("-");
trayMenu.MenuItems.Add("Exit", OnExit);
trayIcon = new NotifyIcon();
iconConnected = new Icon("Icons/kyru.ico");
iconNotConnected = SystemIcons.Exclamation;
//TimerElapsed();
trayIcon.MouseDoubleClick += OnLogin;
trayIcon.ContextMenu = trayMenu;
trayIcon.Visible = true;
TimerElapsed();
KyruTimer.Register(this, 2);
}
private void OnExit(object sender, EventArgs e)
{
trayIcon.Dispose();
Application.Exit();
}
private void OnLogin(object sender, EventArgs e)
{
new LoginForm(app.LocalObjectStorage).Show();
}
private void OnRegisterNode(object sender, EventArgs e)
{
new AddNodeForm(app.Node.Kademlia).Show();
}
private void OnSystemStatus(object sender, EventArgs e)
{
new SystemStatusForm(app).Show();
}
public void TimerElapsed()
{
bool newConnected = app.Node.Kademlia.CurrentContactCount > 0;
if (connected != newConnected)
return;
connected = newConnected;
if (connected)
{
trayIcon.Text = "Kyru - Connected";
trayIcon.Icon = iconConnected;
}
else
{
trayIcon.Text = "Kyru - Not Connected";
trayIcon.Icon = iconNotConnected;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using Kyru.Core;
using Kyru.Utilities;
namespace Kyru
{
internal class SystemTray : ITimerListener
{
private KyruApplication app;
private NotifyIcon trayIcon;
private ContextMenu trayMenu;
private bool connected;
private Icon iconNotConnected;
private Icon iconConnected;
internal SystemTray(KyruApplication app)
{
this.app = app;
trayMenu = new ContextMenu();
trayMenu.MenuItems.Add("Log in", OnLogin);
trayMenu.MenuItems.Add("Connect", OnRegisterNode);
trayMenu.MenuItems.Add("-");
trayMenu.MenuItems.Add("System status", OnSystemStatus);
trayMenu.MenuItems.Add("-");
trayMenu.MenuItems.Add("Exit", OnExit);
trayIcon = new NotifyIcon();
iconConnected = new Icon("Icons/kyru.ico");
iconNotConnected = SystemIcons.Exclamation;
//TimerElapsed();
trayIcon.MouseDoubleClick += OnLogin;
trayIcon.ContextMenu = trayMenu;
trayIcon.Visible = true;
KyruTimer.Register(this, 2);
}
private void OnExit(object sender, EventArgs e)
{
trayMenu.Dispose();
Application.Exit();
}
private void OnLogin(object sender, EventArgs e)
{
new LoginForm(app.LocalObjectStorage).Show();
}
private void OnRegisterNode(object sender, EventArgs e)
{
new AddNodeForm(app.Node.Kademlia).Show();
}
private void OnSystemStatus(object sender, EventArgs e)
{
new SystemStatusForm(app).Show();
}
public void TimerElapsed()
{
bool newConnected = app.Node.Kademlia.CurrentContactCount > 0;
if (connected != newConnected)
return;
connected = newConnected;
if (connected)
{
trayIcon.Text = "Kyru - Connected";
trayIcon.Icon = iconConnected;
}
else
{
trayIcon.Text = "Kyru - Not Connected";
trayIcon.Icon = iconNotConnected;
}
}
}
}
| bsd-3-clause | C# |
de7cbf2012754f99717f53192d9dd1a006a71233 | remove init and add loading screen | secondsun/PointingHenry10,secondsun/PointingHenry10 | PointingHenry10/ViewModels/ListViewModel.cs | PointingHenry10/ViewModels/ListViewModel.cs | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Windows.UI.Popups;
using FHSDK;
using FHSDK.Config;
using Newtonsoft.Json;
using PointingHenry10.Models;
using PointingHenry10.Views;
using Quobject.SocketIoClientDotNet.Client;
using Template10.Mvvm;
namespace PointingHenry10.ViewModels
{
public class ListViewModel : ViewModelBase
{
public ListViewModel()
{
RetrieveListOfSessions();
OpenWebsocketsConnection();
}
public ObservableCollection<Session> Sessions { get; } = new ObservableCollection<Session>();
private void OpenWebsocketsConnection()
{
var socket = IO.Socket(FHConfig.GetInstance().GetHost());
socket.On("sessions", data =>
{
Dispatcher.Dispatch(() =>
{
var session = JsonConvert.DeserializeObject<Session>((string) data);
Sessions.Add(session);
});
});
}
private async void RetrieveListOfSessions()
{
Busy.SetBusy(true, "Getting active Sessions...");
var response = await FH.Cloud("poker", "GET", null, null);
if (response.Error == null)
{
var sessions = JsonConvert.DeserializeObject<List<Session>>(response.RawResponse);
sessions.ForEach(item => Sessions.Add(item));
}
else
{
await new MessageDialog(response.Error.Message).ShowAsync();
}
Busy.SetBusy(false);
}
public void GotoJoinDetailSession(Session session) =>
NavigationService.Navigate(typeof(DetailSession), session);
public void GotoAbout() =>
NavigationService.Navigate(typeof(SettingsPage), 2);
}
} | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Windows.UI.Popups;
using FHSDK;
using FHSDK.Config;
using Newtonsoft.Json;
using PointingHenry10.Models;
using PointingHenry10.Views;
using Quobject.SocketIoClientDotNet.Client;
using Template10.Mvvm;
namespace PointingHenry10.ViewModels
{
public class ListViewModel : ViewModelBase
{
public ListViewModel()
{
RetrieveListOfSessions();
OpenWebsocketsConnection();
}
public ObservableCollection<Session> Sessions { get; } = new ObservableCollection<Session>();
private void OpenWebsocketsConnection()
{
var socket = IO.Socket(FHConfig.GetInstance().GetHost());
socket.On("sessions", data =>
{
Dispatcher.Dispatch(() =>
{
var session = JsonConvert.DeserializeObject<Session>((string) data);
Sessions.Add(session);
});
});
}
private async void RetrieveListOfSessions()
{
await FHClient.Init();
var response = await FH.Cloud("poker", "GET", null, null);
if (response.Error == null)
{
var sessions = JsonConvert.DeserializeObject<List<Session>>(response.RawResponse);
sessions.ToList().ForEach(item => Sessions.Add(item));
}
else
{
await new MessageDialog(response.Error.Message).ShowAsync();
}
}
public void GotoJoinDetailSession(Session session) =>
NavigationService.Navigate(typeof(DetailSession), session);
public void GotoAbout() =>
NavigationService.Navigate(typeof(SettingsPage), 2);
}
} | apache-2.0 | C# |
c66c36b53727bbafedfe9fe6472c5a8db88dd6b4 | Make sure to clean my dic. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Extensions/MemoryExtensions.cs | WalletWasabi/Extensions/MemoryExtensions.cs | using Nito.AsyncEx;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Extensions.Caching.Memory
{
public static class MemoryExtensions
{
private static Dictionary<object, AsyncLock> AsyncLocks { get; } = new Dictionary<object, AsyncLock>();
private static object AsyncLocksLock { get; } = new object();
public static async Task<TItem> AtomicGetOrCreateAsync<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory)
{
if (cache.TryGetValue(key, out TItem value))
{
return value;
}
AsyncLock asyncLock;
lock (AsyncLocksLock)
{
// Cleanup the evicted asynclocks first.
foreach (var toRemove in AsyncLocks.Keys.Where(x => !cache.TryGetValue(x, out _)).ToList())
{
AsyncLocks.Remove(toRemove);
}
if (!AsyncLocks.TryGetValue(key, out asyncLock))
{
asyncLock = new AsyncLock();
AsyncLocks.Add(key, asyncLock);
}
}
using (await asyncLock.LockAsync().ConfigureAwait(false))
{
if (!cache.TryGetValue(key, out value))
{
value = await cache.GetOrCreateAsync(key, factory).ConfigureAwait(false);
}
return value;
}
}
}
}
| using Nito.AsyncEx;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Extensions.Caching.Memory
{
public static class MemoryExtensions
{
private static Dictionary<object, AsyncLock> AsyncLocks { get; } = new Dictionary<object, AsyncLock>();
private static object AsyncLocksLock { get; } = new object();
public static async Task<TItem> AtomicGetOrCreateAsync<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory)
{
if (cache.TryGetValue(key, out TItem value))
{
return value;
}
AsyncLock asyncLock;
lock (AsyncLocksLock)
{
if (!AsyncLocks.TryGetValue(key, out asyncLock))
{
asyncLock = new AsyncLock();
AsyncLocks.Add(key, asyncLock);
}
}
using (await asyncLock.LockAsync().ConfigureAwait(false))
{
if (!cache.TryGetValue(key, out value))
{
value = await cache.GetOrCreateAsync(key, factory).ConfigureAwait(false);
}
return value;
}
}
}
}
| mit | C# |
f60ed83c7e0e70051fa4bcae65b557e4a1b6f923 | Bump version. | kyourek/Pagination,kyourek/Pagination,kyourek/Pagination | sln/AssemblyVersion.cs | sln/AssemblyVersion.cs | using System.Reflection;
[assembly: AssemblyVersion("2.1.3")]
| using System.Reflection;
[assembly: AssemblyVersion("2.1.2.1")]
| mit | C# |
523c84b190c2df2d2d9c98b181d14803bc512a9b | Add method MilkcocoaEvent.GetValues() | m2wasabi/milkcocoa-client-unity | Assets/Milkcocoa/Scripts/MilkcocoaEvent.cs | Assets/Milkcocoa/Scripts/MilkcocoaEvent.cs | namespace Milkcocoa
{
public class MilkcocoaEvent
{
public string name { get; set; }
public JSONObject data { get; set; }
public MilkcocoaEvent(string name) : this(name,null) { }
public MilkcocoaEvent(string name, JSONObject data)
{
this.name = name;
this.data = data;
}
public JSONObject GetValues()
{
return data.GetField("params");
}
public override string ToString()
{
return string.Format("[MilkcocoaEvent({0}) data={1}]",name,data);
}
}
} | namespace Milkcocoa
{
public class MilkcocoaEvent
{
public string name { get; set; }
public JSONObject data { get; set; }
public MilkcocoaEvent(string name) : this(name,null) { }
public MilkcocoaEvent(string name, JSONObject data)
{
this.name = name;
this.data = data;
}
public override string ToString()
{
return string.Format("[MilkcocoaEvent({0}) data={1}]",name,data);
}
}
} | mit | C# |
5a53a2c21811f5460fbf16ab4c79f113bb98cb1f | make sure user services are registered | bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core | src/Billing/Startup.cs | src/Billing/Startup.cs | using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Bit.Core;
using Stripe;
using Bit.Core.Utilities;
using Serilog.Events;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Bit.Billing
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.AddSettingsConfiguration(env, "bitwarden-Billing");
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
// Options
services.AddOptions();
// Settings
var globalSettings = services.AddGlobalSettingsServices(Configuration);
services.Configure<BillingSettings>(Configuration.GetSection("BillingSettings"));
// Stripe Billing
StripeConfiguration.SetApiKey(globalSettings.StripeApiKey);
// Repositories
services.AddSqlServerRepositories();
// Context
services.AddScoped<CurrentContext>();
// Identity
services.AddCustomIdentityServices(globalSettings);
// Services
services.AddBaseServices();
services.AddDefaultServices(globalSettings);
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
// Mvc
services.AddMvc();
}
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
IApplicationLifetime appLifetime,
GlobalSettings globalSettings,
ILoggerFactory loggerFactory)
{
loggerFactory
.AddSerilog(env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error)
.AddConsole()
.AddDebug();
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
// Default Middleware
app.UseDefaultMiddleware(env);
app.UseMvc();
}
}
}
| using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Bit.Core;
using Stripe;
using Bit.Core.Utilities;
using Serilog.Events;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Bit.Billing
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.AddSettingsConfiguration(env, "bitwarden-Billing");
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
// Options
services.AddOptions();
// Settings
var globalSettings = services.AddGlobalSettingsServices(Configuration);
services.Configure<BillingSettings>(Configuration.GetSection("BillingSettings"));
// Stripe Billing
StripeConfiguration.SetApiKey(globalSettings.StripeApiKey);
// Repositories
services.AddSqlServerRepositories();
// Context
services.AddScoped<CurrentContext>();
// Services
services.AddBaseServices();
services.AddDefaultServices(globalSettings);
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
// Mvc
services.AddMvc();
}
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
IApplicationLifetime appLifetime,
GlobalSettings globalSettings,
ILoggerFactory loggerFactory)
{
loggerFactory
.AddSerilog(env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error)
.AddConsole()
.AddDebug();
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
// Default Middleware
app.UseDefaultMiddleware(env);
app.UseMvc();
}
}
}
| agpl-3.0 | C# |
b486b0853b3a6d32fa610a0906a1f8c0444706eb | Fix ParseUpdate name | mbdavid/LiteDB | LiteDB/Client/SqlParser/Commands/Update.cs | LiteDB/Client/SqlParser/Commands/Update.cs | using System;
using System.Collections.Generic;
using System.Linq;
using LiteDB.Engine;
using static LiteDB.Constants;
namespace LiteDB
{
internal partial class SqlParser
{
/// <summary>
/// UPDATE - update documents - if used with {key} = {exprValue} will merge current document with this fields
/// if used with { key: value } will replace current document with new document
/// UPDATE {collection}
/// SET [{key} = {exprValue}, {key} = {exprValue} | { newDoc }]
/// [ WHERE {whereExpr} ]
/// </summary>
private BsonDataReader ParseUpdate()
{
_tokenizer.ReadToken().Expect("UPDATE");
var collection = _tokenizer.ReadToken().Expect(TokenType.Word).Value;
_tokenizer.ReadToken().Expect("SET");
var transform = BsonExpression.Create(_tokenizer, _parameters, BsonExpressionParserMode.UpdateDocument);
// optional where
BsonExpression where = null;
var token = _tokenizer.LookAhead();
if (token.Is("WHERE"))
{
// read WHERE
_tokenizer.ReadToken();
where = BsonExpression.Create(_tokenizer, _parameters, BsonExpressionParserMode.Full);
}
// read eof
_tokenizer.ReadToken().Expect(TokenType.EOF, TokenType.SemiColon);
var result = _engine.UpdateMany(collection, transform, where);
return new BsonDataReader(result);
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using LiteDB.Engine;
using static LiteDB.Constants;
namespace LiteDB
{
internal partial class SqlParser
{
/// <summary>
/// UPDATE - update documents - if used with {key} = {exprValue} will merge current document with this fields
/// if used with { key: value } will replace current document with new document
/// UPDATE {collection}
/// SET [{key} = {exprValue}, {key} = {exprValue} | { newDoc }]
/// [ WHERE {whereExpr} ]
/// </summary>
private BsonDataReader ParseUpadate()
{
_tokenizer.ReadToken().Expect("UPDATE");
var collection = _tokenizer.ReadToken().Expect(TokenType.Word).Value;
_tokenizer.ReadToken().Expect("SET");
var transform = BsonExpression.Create(_tokenizer, _parameters, BsonExpressionParserMode.UpdateDocument);
// optional where
BsonExpression where = null;
var token = _tokenizer.LookAhead();
if (token.Is("WHERE"))
{
// read WHERE
_tokenizer.ReadToken();
where = BsonExpression.Create(_tokenizer, _parameters, BsonExpressionParserMode.Full);
}
// read eof
_tokenizer.ReadToken().Expect(TokenType.EOF, TokenType.SemiColon);
var result = _engine.UpdateMany(collection, transform, where);
return new BsonDataReader(result);
}
}
} | mit | C# |
1bed96e8b43516c60ce4fdd6671f67ae3db845b6 | Update Index.cshtml - minor updates. | NinjaVault/NinjaHive,NinjaVault/NinjaHive | NinjaHive.WebApp/Views/Stats/Index.cshtml | NinjaHive.WebApp/Views/Stats/Index.cshtml | @using NinjaHive.Contract.DTOs
@using NinjaHive.WebApp.Controllers
@using NinjaHive.WebApp.Services
@model StatInfo[]
<div class="row">
<div class="col-md-12">
<br />
<p>
@Html.ActionLink("Create Stat Info", "Create", null, new { @class = "btn btn-default" })
</p>
<hr />
<h4>List of items in the database</h4>
</div>
@foreach (var stat in Model)
{
var statId = stat.Id;
var itemDetailsUrl = UrlProvider<StatsController>.GetUrl(c => c.Edit(statId));
<div class="col-md-2">
<div class="thumbnail">
<div class="caption">
Health: @stat.Health<br/>
Magic: @stat.Magic<br/>
Attack: @stat.Attack<br/>
<div>
Defense: @stat.Defense<br/>
Agility: @stat.Agility<br/>
Intelligence: @stat.Intelligence<br/>
Hunger: @stat.Hunger<br/>
Stamina: @stat.Stamina<br/>
Resistance: @stat.Resistance<br/><br />
</div>
@*<a>More...</a><hr style="margin: 0; margin-bottom: 5px;"/>*@
@Html.ActionLink("Delete", "Delete", stat)<br />
<a href="@itemDetailsUrl"> Edit </a>
</div>
</div>
</div>
}
</div>
| @using NinjaHive.Contract.DTOs
@using NinjaHive.WebApp.Controllers
@using NinjaHive.WebApp.Services
@model StatInfo[]
<div class="row">
<div class="col-md-12">
<br />
<p>
@Html.ActionLink("Create Stat Info", "Create", null, new { @class = "btn btn-default" })
</p>
<hr />
<h4>List of items in the database</h4>
</div>
@foreach (var stat in Model)
{
var statId = stat.Id;
var itemDetailsUrl = UrlProvider<StatsController>.GetUrl(c => c.Edit(statId));
<div class="col-md-2">
<div class="thumbnail">
<a href="@itemDetailsUrl" class="thumbnail">
<img src="/Content/Images/default_image.png" alt="..." />
</a>
<div class="caption">
<p></p>
<p>
@Html.ActionLink("Delete", "Delete", stat)<br />
<a href="@itemDetailsUrl"> Edit </a>
</p>
</div>
</div>
</div>
}
</div>
| apache-2.0 | C# |
a81974389f481d6cae94a9494b2db01ef2b663b1 | Add some dumy conf | michael-reichenauer/GitMind | GitMind/GitModel/Branch.cs | GitMind/GitModel/Branch.cs | using System.Collections.Generic;
using System.Linq;
namespace GitMind.GitModel
{
// Some extra Branch and otther dum
internal class Branch
{
private readonly Repository repository;
private readonly string tipCommitId;
private readonly string firstCommitId;
private readonly string parentCommitId;
private readonly IReadOnlyList<string> commitIds;
private readonly string parentBranchId;
public Branch(
Repository repository,
string id,
string name,
string tipCommitId,
string firstCommitId,
string parentCommitId,
IReadOnlyList<string> commitIds,
string parentBranchId,
IReadOnlyList<string> childBranchNames,
bool isActive,
bool isMultiBranch,
int localAheadCount,
int remoteAheadCount)
{
this.repository = repository;
this.tipCommitId = tipCommitId;
this.firstCommitId = firstCommitId;
this.parentCommitId = parentCommitId;
this.commitIds = commitIds;
this.parentBranchId = parentBranchId;
Id = id;
Name = name;
ChildBranchNames = childBranchNames;
IsActive = isActive;
IsMultiBranch = isMultiBranch;
LocalAheadCount = localAheadCount;
RemoteAheadCount = remoteAheadCount;
}
public string Id { get; }
public string Name { get; }
public IReadOnlyList<string> ChildBranchNames { get; }
public bool IsActive { get; }
public bool IsMultiBranch { get; }
public int LocalAheadCount { get; }
public int RemoteAheadCount { get; }
public Commit TipCommit => repository.Commits[tipCommitId];
public Commit FirstCommit => repository.Commits[firstCommitId];
public Commit ParentCommit => repository.Commits[parentCommitId];
public IEnumerable<Commit> Commits => commitIds.Select(id => repository.Commits[id]);
public bool HasParentBranch => parentBranchId != null;
public Branch ParentBranch => repository.Branches[parentBranchId];
public bool IsCurrentBranch => repository.CurrentBranch == this;
public bool IsMergeable =>
IsCurrentBranch
&& repository.Status.ConflictCount == 0
&& repository.Status.StatusCount == 0;
public IEnumerable<Branch> GetChildBranches()
{
foreach (Branch branch in repository.Branches
.Where(b => b.HasParentBranch && b.ParentBranch == this)
.Distinct()
.OrderByDescending(b => b.ParentCommit.CommitDate))
{
yield return branch;
}
}
public IEnumerable<Branch> Parents()
{
Branch current = this;
while (current.HasParentBranch)
{
current = current.ParentBranch;
yield return current;
}
}
public override string ToString() => Name;
}
} | using System.Collections.Generic;
using System.Linq;
namespace GitMind.GitModel
{
// Some extra Branch
internal class Branch
{
private readonly Repository repository;
private readonly string tipCommitId;
private readonly string firstCommitId;
private readonly string parentCommitId;
private readonly IReadOnlyList<string> commitIds;
private readonly string parentBranchId;
public Branch(
Repository repository,
string id,
string name,
string tipCommitId,
string firstCommitId,
string parentCommitId,
IReadOnlyList<string> commitIds,
string parentBranchId,
IReadOnlyList<string> childBranchNames,
bool isActive,
bool isMultiBranch,
int localAheadCount,
int remoteAheadCount)
{
this.repository = repository;
this.tipCommitId = tipCommitId;
this.firstCommitId = firstCommitId;
this.parentCommitId = parentCommitId;
this.commitIds = commitIds;
this.parentBranchId = parentBranchId;
Id = id;
Name = name;
ChildBranchNames = childBranchNames;
IsActive = isActive;
IsMultiBranch = isMultiBranch;
LocalAheadCount = localAheadCount;
RemoteAheadCount = remoteAheadCount;
}
public string Id { get; }
public string Name { get; }
public IReadOnlyList<string> ChildBranchNames { get; }
public bool IsActive { get; }
public bool IsMultiBranch { get; }
public int LocalAheadCount { get; }
public int RemoteAheadCount { get; }
public Commit TipCommit => repository.Commits[tipCommitId];
public Commit FirstCommit => repository.Commits[firstCommitId];
public Commit ParentCommit => repository.Commits[parentCommitId];
public IEnumerable<Commit> Commits => commitIds.Select(id => repository.Commits[id]);
public bool HasParentBranch => parentBranchId != null;
public Branch ParentBranch => repository.Branches[parentBranchId];
public bool IsCurrentBranch => repository.CurrentBranch == this;
public bool IsMergeable =>
IsCurrentBranch
&& repository.Status.ConflictCount == 0
&& repository.Status.StatusCount == 0;
public IEnumerable<Branch> GetChildBranches()
{
foreach (Branch branch in repository.Branches
.Where(b => b.HasParentBranch && b.ParentBranch == this)
.Distinct()
.OrderByDescending(b => b.ParentCommit.CommitDate))
{
yield return branch;
}
}
public IEnumerable<Branch> Parents()
{
Branch current = this;
while (current.HasParentBranch)
{
current = current.ParentBranch;
yield return current;
}
}
public override string ToString() => Name;
}
} | mit | C# |
92da02db8731b2b9eeb699481503c1a3c652903a | Add extension to filename | NeoAdonis/osu,DrabWeb/osu,naoey/osu,DrabWeb/osu,UselessToucan/osu,NeoAdonis/osu,johnneijzen/osu,naoey/osu,Nabile-Rahmani/osu,peppy/osu,Frontear/osuKyzer,2yangk23/osu,NeoAdonis/osu,smoogipoo/osu,2yangk23/osu,smoogipooo/osu,johnneijzen/osu,naoey/osu,EVAST9919/osu,peppy/osu,ppy/osu,EVAST9919/osu,ppy/osu,peppy/osu,ZLima12/osu,smoogipoo/osu,DrabWeb/osu,peppy/osu-new,UselessToucan/osu,ppy/osu,smoogipoo/osu,ZLima12/osu,UselessToucan/osu | osu.Game/Rulesets/Configuration/RulesetConfigManager.cs | osu.Game/Rulesets/Configuration/RulesetConfigManager.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration;
using osu.Framework.Platform;
namespace osu.Game.Rulesets.Configuration
{
public abstract class RulesetConfigManager<T> : ConfigManager<T>, IRulesetConfigManager
where T : struct
{
protected override string Filename => ruleset?.ShortName == null ? null : $"{ruleset.ShortName}.ini";
private readonly Ruleset ruleset;
protected RulesetConfigManager(Ruleset ruleset, Storage storage)
: base(storage)
{
this.ruleset = ruleset;
// Re-load with the ruleset
Load();
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration;
using osu.Framework.Platform;
namespace osu.Game.Rulesets.Configuration
{
public abstract class RulesetConfigManager<T> : ConfigManager<T>, IRulesetConfigManager
where T : struct
{
protected override string Filename => ruleset?.ShortName;
private readonly Ruleset ruleset;
protected RulesetConfigManager(Ruleset ruleset, Storage storage)
: base(storage)
{
this.ruleset = ruleset;
// Re-load with the ruleset
Load();
}
}
}
| mit | C# |
2cd557e0bf0a442877c77ba4c531a2156b92e768 | bump version | RepairShopr/CommitCRM-Exporter | RepairShoprApps/Properties/AssemblyInfo.cs | RepairShoprApps/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("RepairShoprApps")]
[assembly: AssemblyDescription("Export CommitCRM Account and Ticket to RepairShopr Customer and Ticket")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RepairShopr")]
[assembly: AssemblyProduct("RepairShoprApps")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ea37db20-fd81-4073-bd3b-8882adf2ad80")]
// 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.4.9.0")]
[assembly: AssemblyFileVersion("1.4.9.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("RepairShoprApps")]
[assembly: AssemblyDescription("Export CommitCRM Account and Ticket to RepairShopr Customer and Ticket")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RepairShopr")]
[assembly: AssemblyProduct("RepairShoprApps")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ea37db20-fd81-4073-bd3b-8882adf2ad80")]
// 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.4.7.0")]
[assembly: AssemblyFileVersion("1.4.7.0")]
| mit | C# |
ccc0424b0048557301ce949fa0659128cce90c28 | Bump version: 1.0.1.0 | bdb-opensource/closure-externs-dotnet | ClosureExterns/Properties/AssemblyInfo.cs | ClosureExterns/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("ClosureExterns")]
[assembly: AssemblyDescription("Generates Google Closure Compiler type annotations from .NET types")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("BDBPayroll Inc.")]
[assembly: AssemblyProduct("ClosureExterns")]
[assembly: AssemblyCopyright("Copyright © 2014 BDBPayroll Inc.")]
[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("0d32ca9e-c7d3-4521-b271-4a6d3e8d7f86")]
// 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.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1.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("ClosureExterns")]
[assembly: AssemblyDescription("Generates Google Closure Compiler type annotations from .NET types")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("BDBPayroll Inc.")]
[assembly: AssemblyProduct("ClosureExterns")]
[assembly: AssemblyCopyright("Copyright © 2014 BDBPayroll Inc.")]
[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("0d32ca9e-c7d3-4521-b271-4a6d3e8d7f86")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
4e4538dd1de1e5454b8684b69719a06c69628df5 | Revise CleanUpExtractedFiles() | MattCordell/Content-For-Promotion-Extractor | Content-For-Promotion-Extractor/Unpack.cs | Content-For-Promotion-Extractor/Unpack.cs | using System.IO.Compression;
using System.IO;
using System;
using System.Collections.Generic;
namespace Content_For_Promotion_Extractor
{
public enum RF2File { sct2_Concept_Snapshot, sct2_Description_Snapshot, sct2_Relationship_Snapshot, sct2_StatedRelationship_Snapshot };
// Unpacker Extracts the desired file from an RF2 Bundle.
// Paths to extracted files are returned.
// All Extracted files can be cleaned up on deman. Or with finalise.
public class Unpacker
{
private string tempdirectory = Directory.GetCurrentDirectory() + @"\temp\";
private List<string> createdFiles = new List<string>();
public Unpacker()
{
Directory.CreateDirectory(tempdirectory);
}
//Unzip a specific file from an archive and return path
public string Unpack(string donorZip, RF2File targetToken)
{
string extractedFilePath = null;
using (ZipArchive archive = ZipFile.OpenRead(donorZip))
{
foreach (var entry in archive.Entries)
{
if (entry.FullName.Contains(targetToken.ToString()))
{
extractedFilePath = tempdirectory + targetToken.ToString() + ".txt";
entry.ExtractToFile(extractedFilePath, true);
createdFiles.Add(extractedFilePath); //store the path for later cleanup
}
}
}
// an exception handle for file not found would be nice here.
return extractedFilePath; //path to extracted file
}
//clean up all the files + Directories that have been extracted
public void CleanUpExtractedFiles()
{
if (Directory.Exists(tempdirectory))
{
Directory.Delete(tempdirectory);
}
}
~Unpacker()
{
CleanUpExtractedFiles();
}
}
} | using System.IO.Compression;
using System.IO;
using System;
using System.Collections.Generic;
namespace Content_For_Promotion_Extractor
{
public enum RF2File { sct2_Concept_Snapshot, sct2_Description_Snapshot, sct2_Relationship_Snapshot, sct2_StatedRelationship_Snapshot };
// Unpacker Extracts the desired file from an RF2 Bundle.
// Paths to extracted files are returned.
// All Extracted files can be cleaned up on deman. Or with finalise.
public class Unpacker
{
private string tempdirectory = Directory.GetCurrentDirectory() + @"\temp\";
private List<string> createdFiles = new List<string>();
public Unpacker()
{
Directory.CreateDirectory(tempdirectory);
}
//Unzip a specific file from an archive and return path
public string Unpack(string donorZip, RF2File targetToken)
{
string extractedFilePath = null;
using (ZipArchive archive = ZipFile.OpenRead(donorZip))
{
foreach (var entry in archive.Entries)
{
if (entry.FullName.Contains(targetToken.ToString()))
{
extractedFilePath = tempdirectory + targetToken.ToString() + ".txt";
entry.ExtractToFile(extractedFilePath, true);
createdFiles.Add(extractedFilePath); //store the path for later cleanup
}
}
}
// an exception handle for file not found would be nice here.
return extractedFilePath; //path to extracted file
}
//clean up all the files + Directories that have been extracted
public void CleanUpExtractedFiles()
{
foreach (var file in createdFiles)
{
File.Delete(file);
}
Directory.Delete(tempdirectory);
}
~Unpacker()
{
CleanUpExtractedFiles();
}
}
} | mit | C# |
8dc7b59868f59bedd74c44db7f1e3fb01530211a | Update SlimyYoyo.cs | Minesap/TheMinepack | Items/Weapons/SlimyYoyo.cs | Items/Weapons/SlimyYoyo.cs | using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Minepack.Items;
namespace Minepack.Items.Weapons {
public class SlimyYoyo : ModItem
{
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
texture = "TheMinepack/Items/Weapons/SlimyYoyo";
return true;
}
public override void SetDefaults()
{
item.CloneDefaults(ItemID.Code1);
item.name = "Slimy Yoyo";
item.damage = 20;
item.useTime = 22;
item.useAnimation = 22;
item.useStyle = 5;
item.channel = true;
item.melee = true;
item.knockBack = 2;
item.value = Item.sellPrice(0, 0, 50, 0);
item.rare = 1;
item.autoReuse = false;
item.shoot = mod.ProjectileType("SlimyYoyoProjectile");
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "GelatinousBar", 10);
recipe.AddIngredient(null, "YoyoString", 1);
recipe.AddTile(TileID.Solidifier);
recipe.SetResult(this);
recipe.AddRecipe();
}
}}
| using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Minepack.Items;
namespace Minepack.Items.Weapons {
public class SlimyYoyo : ModItem
{
public override void SetDefaults()
{
item.CloneDefaults(ItemID.Valor);
item.name = "Slimy Yoyo";
item.damage = 12;
item.channel = true;
item.melee = true;
item.knockBack = 4;
item.value = 50000;
item.rare = 3;
item.autoReuse = false;
item.shoot = mod.ProjectileType("SlimyYoyoProjectile");
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "GelatinousBar", 10);
recipe.AddIngredient(null, "YoyoString", 1);
recipe.AddTile(TileID.Solidifier);
recipe.SetResult(this);
recipe.AddRecipe();
}
}}
| mit | C# |
c1237695b34a049a2c98ee5af98b11b990978a61 | add successful ComponentManifest test. | pburls/dewey | Dewey/Dewey.Test/ComponentManifestTest.cs | Dewey/Dewey.Test/ComponentManifestTest.cs | using Dewey.Manfiest;
using Dewey.Manifest.Component;
using Dewey.Manifest.Repositories;
using Dewey.Manifest.Repository;
using Ploeh.AutoFixture;
using System.Collections.Generic;
using System.Xml.Linq;
using Xunit;
namespace Dewey.Test
{
public class ComponentManifestTest
{
static IEnumerable<object[]> GetUnsuccessfulMockManifestFileReaders()
{
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with missing directory", FileExists = false, DirectoryExists = false } };
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with missing file", FileExists = false, DirectoryExists = true } };
string xmlText = "<componentManifest/>";
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with xml missing all attributes", XmlText = xmlText } };
xmlText = "<componentManifest type=\"web\"/>";
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with xml missing name attribute", XmlText = xmlText } };
xmlText = "<componentManifest name=\"ExampleWebApiComp\"/>";
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with xml missing type attribute", XmlText = xmlText } };
}
[Theory]
[MemberData(nameof(GetUnsuccessfulMockManifestFileReaders))]
public void LoadComponentItem_returns_UnsuccessfulResult_for(MockManifestFileReader mockManifestFileReader)
{
//Given
var componentItem = new Fixture().Create<ComponentItem>();
//When
var result = ComponentManifest.LoadComponentItem(componentItem, "root", mockManifestFileReader.CreateService());
//Then
Assert.False(result.IsSuccessful);
}
[Fact]
public void LoadComponentItem_returns_SuccessfulResult_for_complete_componentManifest_element()
{
//Given
var mockManifestFileReader = new MockManifestFileReader() { XmlText = "<componentManifest name=\"ExampleWebApiComp\" type=\"web\"/>" };
var componentItem = new Fixture().Create<ComponentItem>();
//When
var result = ComponentManifest.LoadComponentItem(componentItem, "root", mockManifestFileReader.CreateService());
//Then
Assert.True(result.IsSuccessful);
}
}
}
| using Dewey.Manfiest;
using Dewey.Manifest.Component;
using Dewey.Manifest.Repositories;
using Dewey.Manifest.Repository;
using Ploeh.AutoFixture;
using System.Collections.Generic;
using System.Xml.Linq;
using Xunit;
namespace Dewey.Test
{
public class ComponentManifestTest
{
static IEnumerable<object[]> GetUnsuccessfulMockManifestFileReaders()
{
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with missing directory", FileExists = false, DirectoryExists = false } };
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with missing file", FileExists = false, DirectoryExists = true } };
string xmlText = "<componentManifest/>";
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with xml missing all attributes", XmlText = xmlText } };
xmlText = "<componentManifest type=\"web\"/>";
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with xml missing name attribute", XmlText = xmlText } };
xmlText = "<componentManifest name=\"ExampleWebApiComp\"/>";
yield return new object[] { new MockManifestFileReader() { ScenarioName = "with xml missing type attribute", XmlText = xmlText } };
}
[Theory]
[MemberData(nameof(GetUnsuccessfulMockManifestFileReaders))]
public void LoadComponentItem_returns_UnsuccessfulResult_for(MockManifestFileReader mockManifestFileReader)
{
//Given
var componentItem = new Fixture().Create<ComponentItem>();
//When
var result = ComponentManifest.LoadComponentItem(componentItem, "root", mockManifestFileReader.CreateService());
//Then
Assert.False(result.IsSuccessful);
}
}
}
| mit | C# |
a720de7722b14a0101597dc504963e4e18bfc70d | Add explicit height to match resulting button | DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity | Assets/MRTK/Core/Inspectors/Utilities/MixedRealityStylesUtility.cs | Assets/MRTK/Core/Inspectors/Utilities/MixedRealityStylesUtility.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Utilities.Editor
{
public static class MixedRealityStylesUtility
{
/// <summary>
/// Default style for foldouts with bold title
/// </summary>
public static readonly GUIStyle BoldFoldoutStyle =
new GUIStyle(EditorStyles.foldout)
{
fontStyle = FontStyle.Bold
};
/// <summary>
/// Default style for foldouts with bold large font size title
/// </summary>
public static readonly GUIStyle BoldTitleFoldoutStyle =
new GUIStyle(EditorStyles.foldout)
{
fontStyle = FontStyle.Bold,
fontSize = InspectorUIUtility.TitleFontSize,
};
/// <summary>
/// Default style for foldouts with large font size title
/// </summary>
public static readonly GUIStyle TitleFoldoutStyle =
new GUIStyle(EditorStyles.foldout)
{
fontSize = InspectorUIUtility.TitleFontSize,
};
/// <summary>
/// Default style for controller mapping buttons
/// </summary>
public static readonly GUIStyle ControllerButtonStyle = new GUIStyle("LargeButton")
{
imagePosition = ImagePosition.ImageAbove,
fixedHeight = 128,
fontStyle = FontStyle.Bold,
stretchHeight = true,
stretchWidth = true,
wordWrap = true,
fontSize = 10,
};
/// <summary>
/// Default style for bold large font size title
/// </summary>
public static readonly GUIStyle BoldLargeTitleStyle = new GUIStyle(EditorStyles.largeLabel)
{
fontSize = InspectorUIUtility.TitleFontSize,
fontStyle = FontStyle.Bold,
};
}
} | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Utilities.Editor
{
public static class MixedRealityStylesUtility
{
/// <summary>
/// Default style for foldouts with bold title
/// </summary>
public static readonly GUIStyle BoldFoldoutStyle =
new GUIStyle(EditorStyles.foldout)
{
fontStyle = FontStyle.Bold
};
/// <summary>
/// Default style for foldouts with bold large font size title
/// </summary>
public static readonly GUIStyle BoldTitleFoldoutStyle =
new GUIStyle(EditorStyles.foldout)
{
fontStyle = FontStyle.Bold,
fontSize = InspectorUIUtility.TitleFontSize,
};
/// <summary>
/// Default style for foldouts with large font size title
/// </summary>
public static readonly GUIStyle TitleFoldoutStyle =
new GUIStyle(EditorStyles.foldout)
{
fontSize = InspectorUIUtility.TitleFontSize,
};
/// <summary>
/// Default style for large button
/// </summary>
public static readonly GUIStyle ControllerButtonStyle = new GUIStyle("LargeButton")
{
imagePosition = ImagePosition.ImageAbove,
fontStyle = FontStyle.Bold,
stretchHeight = true,
stretchWidth = true,
wordWrap = true,
fontSize = 10,
};
/// <summary>
/// Default style for bold large font size title
/// </summary>
public static readonly GUIStyle BoldLargeTitleStyle = new GUIStyle(EditorStyles.largeLabel)
{
fontSize = InspectorUIUtility.TitleFontSize,
fontStyle = FontStyle.Bold,
};
}
} | mit | C# |
60574b634782c2f95400916630bc96d767640bbb | undo changes to IScheduledCommandT | commonsensesoftware/Its.Cqrs,commonsensesoftware/Its.Cqrs,commonsensesoftware/Its.Cqrs | Domain/Scheduling/IScheduledCommand{T}.cs | Domain/Scheduling/IScheduledCommand{T}.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Its.Domain
{
/// <summary>
/// Represents that a command has been scheduled for future execution against a specific aggregate type.
/// </summary>
public interface IScheduledCommand<in TTarget> :
IScheduledCommand
{
/// <summary>
/// Gets the command to be applied at a later time.
/// </summary>
ICommand<TTarget> Command { get; }
/// <summary>
/// Gets the id of the aggregate to which the command will be applied when delivered.
/// </summary>
Guid AggregateId { get; }
/// <summary>
/// Gets the sequence number of the scheduled command.
/// </summary>
long SequenceNumber { get; }
}
} | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Its.Domain
{
/// <summary>
/// Represents that a command has been scheduled for future execution against a specific aggregate type.
/// </summary>
public interface IScheduledCommand<in TTarget> :
//IEvent,
IScheduledCommand
{
/// <summary>
/// Gets the command to be applied at a later time.
/// </summary>
ICommand<TTarget> Command { get; }
}
}
| mit | C# |
828dd0d3bf71f0fc8e8c91e1029d2773c966d829 | Update new-blog.cshtml | daveaglick/daveaglick,mishrsud/sudhanshutheone.com,daveaglick/daveaglick,mishrsud/sudhanshutheone.com,mishrsud/sudhanshutheone.com | Somedave/Views/Blog/Posts/new-blog.cshtml | Somedave/Views/Blog/Posts/new-blog.cshtml | @{
Title = "New Blog";
Lead = "Look, Ma, no database!"
//Published = new DateTime(2014, 9, 4);
Tags = new[] { "blog", "meta" };
}
<p>It's been a little while coming, but I'm finally launching my new blog. It's built from scratch in ASP.NET MVC. Why go to all the trouble to build a blog engine from scratch when there are a gazillion great engines already out there? That's a very good question, let's break it down.</p>
<h1>Own Your Content</h1>
<p>I'll thank Scott Hanselman for really driving this point home.</p>
<p>So that's <em>why</em> I created this new blog, but what about <em>how</em>? This blog engine uses no database, makes it easy to mix content pages with blog articles, is hosted on GitHub, and uses continuous deployment to automatically publish to an Azure Website.</p>
| @{
Title = "New Blog";
Published = new DateTime(2014, 9, 2);
Tags = new[] { "blog", "meta" };
}
<p>Test</p>
| mit | C# |
ef34e59970b60dae55638056e3847bb069c1c05a | Bump version to release Comparable and String extension methods | Smartrak/Smartrak.Library | System.Contrib/Properties/AssemblyInfo.cs | System.Contrib/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("System.Contrib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Smartrak")]
[assembly: AssemblyProduct("System.Contrib")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ac97934a-bbbc-488b-b337-a11bf4c98e97")]
// 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.10.0")]
[assembly: AssemblyFileVersion("1.10.0")]
[assembly: AssemblyInformationalVersion("1.10.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("System.Contrib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Smartrak")]
[assembly: AssemblyProduct("System.Contrib")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ac97934a-bbbc-488b-b337-a11bf4c98e97")]
// 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.9.1")]
[assembly: AssemblyFileVersion("1.9.1")]
[assembly: AssemblyInformationalVersion("1.9.1")]
| mit | C# |
65843814b368a7d28151e48530a55a6e24b26e93 | remove unused variable | MetaG8/Metrics.NET,Liwoj/Metrics.NET,Recognos/Metrics.NET,cvent/Metrics.NET,Recognos/Metrics.NET,DeonHeyns/Metrics.NET,ntent-ad/Metrics.NET,ntent-ad/Metrics.NET,alhardy/Metrics.NET,cvent/Metrics.NET,etishor/Metrics.NET,DeonHeyns/Metrics.NET,Liwoj/Metrics.NET,MetaG8/Metrics.NET,etishor/Metrics.NET,mnadel/Metrics.NET,huoxudong125/Metrics.NET,huoxudong125/Metrics.NET,MetaG8/Metrics.NET,alhardy/Metrics.NET,mnadel/Metrics.NET | Src/Metrics/Reporters/ScheduledReporter.cs | Src/Metrics/Reporters/ScheduledReporter.cs | using System;
namespace Metrics.Reporters
{
public class ScheduledReporter
{
private readonly Timer reportTime;
private readonly Func<Reporter> reporter;
private readonly TimeSpan interval;
private readonly MetricsRegistry registry;
private System.Threading.Timer timer;
public ScheduledReporter(string name, Func<Reporter> reporter, MetricsRegistry registry, TimeSpan interval)
{
this.reportTime = Metric.Timer("Metrics.Reporter." + name, Unit.Calls);
this.reporter = reporter;
this.interval = interval;
this.registry = registry;
}
public void Start()
{
if (this.timer != null)
{
Stop();
}
this.timer = new System.Threading.Timer((s) => RunReport(), null, interval, interval);
}
private void RunReport()
{
using (this.reportTime.NewContext())
using (var report = reporter())
{
report.RunReport(this.registry);
}
}
public void Stop()
{
this.timer.Dispose();
this.timer = null;
}
}
}
| using System;
namespace Metrics.Reporters
{
public class ScheduledReporter
{
private readonly Timer reportTime;
private readonly Func<Reporter> reporter;
private readonly TimeSpan interval;
private readonly MetricsRegistry registry;
private string name;
private System.Threading.Timer timer;
public ScheduledReporter(string name, Func<Reporter> reporter, MetricsRegistry registry, TimeSpan interval)
{
this.reportTime = Metric.Timer("Metrics.Reporter." + name, Unit.Calls);
this.reporter = reporter;
this.interval = interval;
this.registry = registry;
this.name = name;
}
public void Start()
{
if (this.timer != null)
{
Stop();
}
this.timer = new System.Threading.Timer((s) => RunReport(), null, interval, interval);
}
private void RunReport()
{
using (this.reportTime.NewContext())
using (var report = reporter())
{
report.RunReport(this.registry);
}
}
public void Stop()
{
this.timer.Dispose();
this.timer = null;
}
}
}
| apache-2.0 | C# |
3ee1dd1745080790735e990ef907f048b77fd844 | set version to 0.6 | SimonJonas/SqlServerValidationToolkit | SqlServerValidationToolkit.Configurator/Properties/AssemblyInfo.cs | SqlServerValidationToolkit.Configurator/Properties/AssemblyInfo.cs | using log4net.Config;
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("SqlServerValidationToolkit.Configurator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SqlServerValidationToolkit.Configurator")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: XmlConfigurator]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.0.0")]
[assembly: AssemblyFileVersion("0.6.0.0")]
| using log4net.Config;
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("SqlServerValidationToolkit.Configurator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SqlServerValidationToolkit.Configurator")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: XmlConfigurator]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
| mit | C# |
ac8983ee949501dec4a241e3494a57fa7cc61de3 | Revert "Fixed server not being listed on master server" | Facepunch/Facepunch.Steamworks,Facepunch/Facepunch.Steamworks,Facepunch/Facepunch.Steamworks | Facepunch.Steamworks/Structs/ServerInit.cs | Facepunch.Steamworks/Structs/ServerInit.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
namespace Steamworks
{
/// <summary>
/// Used to set up the server.
/// The variables in here are all required to be set, and can't be changed once the server is created.
/// </summary>
public struct SteamServerInit
{
public IPAddress IpAddress;
public ushort SteamPort;
public ushort GamePort;
public ushort QueryPort;
public bool Secure;
/// <summary>
/// The version string is usually in the form x.x.x.x, and is used by the master server to detect when the server is out of date.
/// If you go into the dedicated server tab on steamworks you'll be able to server the latest version. If this version number is
/// less than that latest version then your server won't show.
/// </summary>
public string VersionString;
/// <summary>
/// This should be the same directory game where gets installed into. Just the folder name, not the whole path. I.e. "Rust", "Garrysmod".
/// </summary>
public string ModDir;
/// <summary>
/// The game description. Setting this to the full name of your game is recommended.
/// </summary>
public string GameDescription;
public SteamServerInit( string modDir, string gameDesc )
{
ModDir = modDir;
GameDescription = gameDesc;
GamePort = 27015;
QueryPort = 27016;
Secure = true;
VersionString = "1.0.0.0";
ModDir = "unset";
GameDescription = "unset";
IpAddress = null;
SteamPort = 0;
}
/// <summary>
/// Set the Steam quert port
/// </summary>
public SteamServerInit WithRandomSteamPort()
{
SteamPort = (ushort)new Random().Next( 10000, 60000 );
return this;
}
/// <summary>
/// If you pass MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE into usQueryPort, then it causes the game server API to use
/// "GameSocketShare" mode, which means that the game is responsible for sending and receiving UDP packets for the master
/// server updater.
///
/// More info about this here: https://partner.steamgames.com/doc/api/ISteamGameServer#HandleIncomingPacket
/// </summary>
public SteamServerInit WithQueryShareGamePort()
{
QueryPort = 0xFFFF;
return this;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
namespace Steamworks
{
/// <summary>
/// Used to set up the server.
/// The variables in here are all required to be set, and can't be changed once the server is created.
/// </summary>
public struct SteamServerInit
{
public IPAddress IpAddress;
public ushort SteamPort;
public ushort GamePort;
public ushort QueryPort;
public bool Secure;
/// <summary>
/// The version string is usually in the form x.x.x.x, and is used by the master server to detect when the server is out of date.
/// If you go into the dedicated server tab on steamworks you'll be able to server the latest version. If this version number is
/// less than that latest version then your server won't show.
/// </summary>
public string VersionString;
/// <summary>
/// This should be the same directory game where gets installed into. Just the folder name, not the whole path. I.e. "Rust", "Garrysmod".
/// </summary>
public string ModDir;
/// <summary>
/// The game description. Setting this to the full name of your game is recommended.
/// </summary>
public string GameDescription;
/// <summary>
/// Is a dedicated server
/// </summary>
public bool DedicatedServer;
public SteamServerInit( string modDir, string gameDesc )
{
DedicatedServer = true;
ModDir = modDir;
GameDescription = gameDesc;
GamePort = 27015;
QueryPort = 27016;
Secure = true;
VersionString = "1.0.0.0";
IpAddress = null;
SteamPort = 0;
}
/// <summary>
/// Set the Steam quert port
/// </summary>
public SteamServerInit WithRandomSteamPort()
{
SteamPort = (ushort)new Random().Next( 10000, 60000 );
return this;
}
/// <summary>
/// If you pass MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE into usQueryPort, then it causes the game server API to use
/// "GameSocketShare" mode, which means that the game is responsible for sending and receiving UDP packets for the master
/// server updater.
///
/// More info about this here: https://partner.steamgames.com/doc/api/ISteamGameServer#HandleIncomingPacket
/// </summary>
public SteamServerInit WithQueryShareGamePort()
{
QueryPort = 0xFFFF;
return this;
}
}
}
| mit | C# |
a92af23b1cc67a0624e0469454e92059f6d908ec | Bump assembly version | NuGet/NuGet.Server | src/CommonAssemblyInfo.cs | src/CommonAssemblyInfo.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany(".NET Foundation")]
[assembly: AssemblyProduct("NuGet")]
[assembly: AssemblyCopyright("\x00a9 .NET Foundation. All rights reserved.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.11.3.0")]
[assembly: AssemblyFileVersion("2.11.3.0")]
[assembly: NeutralResourcesLanguage("en-US")]
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany(".NET Foundation")]
[assembly: AssemblyProduct("NuGet")]
[assembly: AssemblyCopyright("\x00a9 .NET Foundation. All rights reserved.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.11.2.0")]
[assembly: AssemblyFileVersion("2.11.2.0")]
[assembly: NeutralResourcesLanguage("en-US")]
| apache-2.0 | C# |
166805856131b799dfbe6e687cee7b9aadce6eb7 | Add cheers! | jamesmontemagno/Hanselman.Forms,jamesmontemagno/Hanselman.Forms,jamesmontemagno/Hanselman.Forms | src/Hanselman/App.xaml.cs | src/Hanselman/App.xaml.cs | using Xamarin.Forms;
using Hanselman.Views;
using Xamarin.Forms.Xaml;
using Xamarin.Essentials;
using MonkeyCache.FileStore;
using Shiny.Jobs;
using MediaManager;
using MediaManager.Playback;
using Hanselman.Helpers;
// ElectricHavoc cheered 10 March 29, 2019
// KymPhillpotts cheered 50 March 29, 2019
// ElecticHavoc cheered 40 March 29, 2019
// lachlanwgordon cheered 100 August 30, 2019
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace Hanselman
{
public partial class App : Application
{
public static bool IsWindows10 { get; set; }
public App()
{
InitializeComponent();
Barrel.ApplicationId = AppInfo.PackageName;
// The root page of your application
if (DeviceInfo.Platform == DevicePlatform.UWP)
MainPage = new HomePage();
else
MainPage = new AppShell();
}
protected override void OnStart()
{
// Handle when your app starts
CrossMediaManager.Current.PositionChanged += PlaybackPositionChanged;
}
void PlaybackPositionChanged(object sender, PositionChangedEventArgs e)
{
if (string.IsNullOrWhiteSpace(Settings.PlaybackId) || !CrossMediaManager.Current.IsPlaying())
return;
var current = e.Position.Ticks;
Settings.SavePlaybackPosition(Settings.PlaybackId, current);
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
| using Xamarin.Forms;
using Hanselman.Views;
using Xamarin.Forms.Xaml;
using Xamarin.Essentials;
using MonkeyCache.FileStore;
using Shiny.Jobs;
using MediaManager;
using MediaManager.Playback;
using Hanselman.Helpers;
// ElectricHavoc cheered 10 March 29, 2019
// KymPhillpotts cheered 50 March 29, 2019
// ElecticHavoc cheered 40 March 29, 2019
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace Hanselman
{
public partial class App : Application
{
public static bool IsWindows10 { get; set; }
public App()
{
InitializeComponent();
Barrel.ApplicationId = AppInfo.PackageName;
// The root page of your application
if (DeviceInfo.Platform == DevicePlatform.UWP)
MainPage = new HomePage();
else
MainPage = new AppShell();
}
protected override void OnStart()
{
// Handle when your app starts
CrossMediaManager.Current.PositionChanged += PlaybackPositionChanged;
}
void PlaybackPositionChanged(object sender, PositionChangedEventArgs e)
{
if (string.IsNullOrWhiteSpace(Settings.PlaybackId) || !CrossMediaManager.Current.IsPlaying())
return;
var current = e.Position.Ticks;
Settings.SavePlaybackPosition(Settings.PlaybackId, current);
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
| mit | C# |
9b66b63c07ec714eccc391dedd9c7ef5fd4fbd18 | Improve code documentation in the ILedgerIndexes interface | openchain/openchain | src/Openchain.Ledger/ILedgerIndexes.cs | src/Openchain.Ledger/ILedgerIndexes.cs | // Copyright 2015 Coinprism, 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.
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Openchain.Ledger
{
/// <summary>
/// Represents a set of advanced operations that can be performed against a transaction store.
/// </summary>
public interface ILedgerIndexes
{
/// <summary>
/// Returns all records with a particular name and type.
/// </summary>
/// <param name="type">The type of the records to return.</param>
/// <param name="name">The name of the records to return.</param>
/// <returns>The task object representing the asynchronous operation.</returns>
Task<IReadOnlyList<Record>> GetAllRecords(RecordType type, string name);
}
}
| // Copyright 2015 Coinprism, 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.
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Openchain.Ledger
{
public interface ILedgerIndexes
{
Task<IReadOnlyList<Record>> GetAllRecords(RecordType type, string name);
}
}
| apache-2.0 | C# |
a52c39e20d871c19ecef6420b3cb743af95b234e | Add xml comments | OpenStreamDeck/StreamDeckSharp | src/StreamDeckSharp/IStreamDeckRefHandle.cs | src/StreamDeckSharp/IStreamDeckRefHandle.cs | using OpenMacroBoard.SDK;
namespace StreamDeckSharp
{
/// <inheritdoc />
public interface IStreamDeckRefHandle : IDeviceReferenceHandle
{
/// <inheritdoc />
new IStreamDeckBoard Open();
/// <summary>
/// The device path of the HID
/// </summary>
string DevicePath { get; }
/// <summary>
/// A friendly display name
/// </summary>
string DeviceName { get; }
/// <summary>
/// Determines if display write caching should be applied
/// (true is default and recommended)
/// </summary>
bool UseWriteCache { get; set; }
}
}
| using OpenMacroBoard.SDK;
namespace StreamDeckSharp
{
/// <inheritdoc />
public interface IStreamDeckRefHandle : IDeviceReferenceHandle
{
/// <inheritdoc />
new IStreamDeckBoard Open();
string DevicePath { get; }
string DeviceName { get; }
bool UseWriteCache { get; set; }
}
}
| mit | C# |
8b016f05e6cb18e110de0d1bba636ae5dd360304 | Remove unessesary nl | 2yangk23/osu,UselessToucan/osu,naoey/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,johnneijzen/osu,NeoAdonis/osu,DrabWeb/osu,smoogipoo/osu,peppy/osu,johnneijzen/osu,ppy/osu,naoey/osu,ZLima12/osu,naoey/osu,NeoAdonis/osu,2yangk23/osu,DrabWeb/osu,EVAST9919/osu,NeoAdonis/osu,EVAST9919/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,ZLima12/osu,peppy/osu,DrabWeb/osu,smoogipoo/osu,ppy/osu | osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using System.Collections.Generic;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Mods
{
internal class OsuModTransform : Mod, IApplicableToDrawableHitObjects
{
public override string Name => "Transform";
public override string ShortenedName => "TR";
public override FontAwesome Icon => FontAwesome.fa_arrows;
public override ModType Type => ModType.Fun;
public override string Description => "Everything rotates. EVERYTHING.";
public override double ScoreMultiplier => 1;
private float theta;
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{
foreach (var drawable in drawables)
{
var hitObject = (OsuHitObject) drawable.HitObject;
float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2;
Vector2 originalPosition = drawable.Position;
Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance;
//the - 1 and + 1 prevents the hit explosion to appear in the wrong position.
double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1;
double moveDuration = hitObject.TimePreempt + 1;
using (drawable.BeginAbsoluteSequence(appearTime, true))
{
drawable
.MoveToOffset(appearOffset)
.MoveTo(originalPosition, moveDuration, Easing.InOutSine);
}
theta += (float) hitObject.TimeFadeIn / 1000;
}
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using System.Collections.Generic;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Mods
{
internal class OsuModTransform : Mod, IApplicableToDrawableHitObjects
{
public override string Name => "Transform";
public override string ShortenedName => "TR";
public override FontAwesome Icon => FontAwesome.fa_arrows;
public override ModType Type => ModType.Fun;
public override string Description => "Everything rotates. EVERYTHING.";
public override double ScoreMultiplier => 1;
private float theta;
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{
foreach (var drawable in drawables)
{
var hitObject = (OsuHitObject) drawable.HitObject;
float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2;
Vector2 originalPosition = drawable.Position;
Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance;
//the - 1 and + 1 prevents the hit explosion to appear in the wrong position.
double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1;
double moveDuration = hitObject.TimePreempt + 1;
using (drawable.BeginAbsoluteSequence(appearTime, true))
{
drawable
.MoveToOffset(appearOffset)
.MoveTo(originalPosition, moveDuration, Easing.InOutSine);
}
theta += (float) hitObject.TimeFadeIn / 1000;
}
}
}
}
| mit | C# |
e814cab744f86526551679d71362f696e198c796 | update RequestResolverTest for interface | haruair/csharp-command | test/Haruair.Command.Tests/RequestResolverTest.cs | test/Haruair.Command.Tests/RequestResolverTest.cs | using NUnit.Framework;
using System;
using Haruair.Command.Interface;
namespace Haruair.Command.Tests
{
[TestFixture ()]
public class RequestResolverTest
{
IRequestResolver resolver;
[SetUp ()]
public void Init()
{
resolver = new BasicRequestResolver ();
}
[TearDown ()]
public void Dispose()
{
resolver = null;
}
[Test ()]
public void EmptyArgsTestCase ()
{
var args = new string[] { };
var request = resolver.Resolve (args);
Assert.AreEqual (null, request.Command);
Assert.AreEqual (null, request.Method);
}
[Test ()]
public void CommandTestCase ()
{
var args = new string[] { "hello" };
var request = resolver.Resolve (args);
Assert.AreEqual ("hello", request.Command);
Assert.AreEqual (null, request.Method);
}
[Test ()]
public void CommandAndMethodTestCase ()
{
var args = new string[] { "hello", "world" };
var request = resolver.Resolve (args);
Assert.AreEqual ("hello", request.Command);
Assert.AreEqual ("world", request.Method);
}
}
}
| using NUnit.Framework;
using System;
namespace Haruair.Command.Tests
{
[TestFixture ()]
public class RequestResolverTest
{
RequestResolver resolver;
[SetUp ()]
public void Init()
{
resolver = new RequestResolver ();
}
[TearDown ()]
public void Dispose()
{
resolver = null;
}
[Test ()]
public void EmptyArgsTestCase ()
{
var args = new string[] { };
var request = resolver.Resolve (args);
Assert.AreEqual (null, request.Command);
Assert.AreEqual (null, request.Method);
}
[Test ()]
public void CommandTestCase ()
{
var args = new string[] { "hello" };
var request = resolver.Resolve (args);
Assert.AreEqual ("hello", request.Command);
Assert.AreEqual (null, request.Method);
}
[Test ()]
public void CommandAndMethodTestCase ()
{
var args = new string[] { "hello", "world" };
var request = resolver.Resolve (args);
Assert.AreEqual ("hello", request.Command);
Assert.AreEqual ("world", request.Method);
}
}
}
| mit | C# |
b4862ff7f985756e10fed9cd137a3ce7e5b3cde4 | fix build 4 .NET 1.0 | likesea/spring-net,zi1jing/spring-net,yonglehou/spring-net,spring-projects/spring-net,djechelon/spring-net,likesea/spring-net,yonglehou/spring-net,likesea/spring-net,kvr000/spring-net,zi1jing/spring-net,dreamofei/spring-net,kvr000/spring-net,yonglehou/spring-net,kvr000/spring-net,dreamofei/spring-net,spring-projects/spring-net,spring-projects/spring-net,djechelon/spring-net | test/Spring/Spring.Data.Tests/Dao/Attributes/PersistenceExceptionTranslationInterceptorTests.cs | test/Spring/Spring.Data.Tests/Dao/Attributes/PersistenceExceptionTranslationInterceptorTests.cs | #region License
/*
* Copyright 2002-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#if !NET_1_0
#region Imports
using NUnit.Framework;
using Spring.Aop.Framework;
using Spring.Dao.Support;
using Spring.Objects.Factory.Support;
using Spring.Stereotype;
using Spring.Util;
#endregion
namespace Spring.Dao.Attributes
{
/// <summary>
/// Tests for standalone usage of a PersistenceExceptionTranslationInterceptor,
/// as explicit advice bean in a BeanFactory rather than applied as part of
/// as explicit advice bean in a BeanFactory rather than applied as part of
/// </summary>
/// <author>Mark Pollack</author>
/// <author>Mark Pollack (.NET)</author>
public class PersistenceExceptionTranslationInterceptorTests : PersistenceExceptionTranslationAdvisorTests
{
protected override void AddPersistenceExceptionTranslation(ProxyFactory pf, IPersistenceExceptionTranslator pet)
{
if (AttributeUtils.FindAttribute(pf.TargetType, typeof(RepositoryAttribute)) != null)
{
DefaultListableObjectFactory of = new DefaultListableObjectFactory();
of.RegisterObjectDefinition("peti", new RootObjectDefinition(typeof(PersistenceExceptionTranslationInterceptor)));
of.RegisterSingleton("pet", pet);
pf.AddAdvice((PersistenceExceptionTranslationInterceptor) of.GetObject("peti"));
}
}
}
}
#endif | #region License
/*
* Copyright 2002-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#region Imports
using NUnit.Framework;
using Spring.Aop.Framework;
using Spring.Dao.Support;
using Spring.Objects.Factory.Support;
using Spring.Stereotype;
using Spring.Util;
#endregion
namespace Spring.Dao.Attributes
{
/// <summary>
/// Tests for standalone usage of a PersistenceExceptionTranslationInterceptor,
/// as explicit advice bean in a BeanFactory rather than applied as part of
/// as explicit advice bean in a BeanFactory rather than applied as part of
/// </summary>
/// <author>Mark Pollack</author>
/// <author>Mark Pollack (.NET)</author>
public class PersistenceExceptionTranslationInterceptorTests : PersistenceExceptionTranslationAdvisorTests
{
protected override void AddPersistenceExceptionTranslation(ProxyFactory pf, IPersistenceExceptionTranslator pet)
{
if (AttributeUtils.FindAttribute(pf.TargetType, typeof(RepositoryAttribute)) != null)
{
DefaultListableObjectFactory of = new DefaultListableObjectFactory();
of.RegisterObjectDefinition("peti", new RootObjectDefinition(typeof(PersistenceExceptionTranslationInterceptor)));
of.RegisterSingleton("pet", pet);
pf.AddAdvice((PersistenceExceptionTranslationInterceptor) of.GetObject("peti"));
}
}
}
} | apache-2.0 | C# |
e1b608d001f6f6aaab2adc51a8c0fe4ee87e84c9 | Remove forgotten debug output | rfgamaral/SlackUI | SlackUI/Handlers/BrowserResourceHandler.cs | SlackUI/Handlers/BrowserResourceHandler.cs | #region Copyright © 2014 Ricardo Amaral
/*
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
*/
#endregion
using System.Net;
using System.Text.RegularExpressions;
using CefSharp;
namespace SlackUI {
internal class BrowserResourceHandler : IResourceHandler {
#region Public Methods
/*
* Handler for the browser get resource handler event.
*/
public ResourceHandler GetResourceHandler(IWebBrowser browser, IRequest request) {
// Inject custom CSS with overall page style overrides
if(Regex.Match(request.Url, @"rollup-(plastic|\w+_core)_\d+\.css", RegexOptions.IgnoreCase).Success) {
using(WebClient webClient = new WebClient()) {
return ResourceHandler.FromString(webClient.DownloadString(request.Url) +
Properties.Resources.PageStyleOverride, ".css");
}
}
// Let the Chromium web browser handle the event
return null;
}
/*
* Handler for the browser register handler event.
*/
public void RegisterHandler(string url, ResourceHandler handler) {
// No implementation required
}
/*
* Handler for the browser unregister handler event.
*/
public void UnregisterHandler(string url) {
// No implementation required
}
#endregion
}
}
| #region Copyright © 2014 Ricardo Amaral
/*
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
*/
#endregion
using System.Net;
using System.Text.RegularExpressions;
using CefSharp;
namespace SlackUI {
internal class BrowserResourceHandler : IResourceHandler {
#region Public Methods
/*
* Handler for the browser get resource handler event.
*/
public ResourceHandler GetResourceHandler(IWebBrowser browser, IRequest request) {
System.Diagnostics.Debug.WriteLine(request.Url);
// Inject custom CSS with overall page style overrides
if(Regex.Match(request.Url, @"rollup-(plastic|\w+_core)_\d+\.css", RegexOptions.IgnoreCase).Success) {
using(WebClient webClient = new WebClient()) {
return ResourceHandler.FromString(webClient.DownloadString(request.Url) +
Properties.Resources.PageStyleOverride, ".css");
}
}
// Let the Chromium web browser handle the event
return null;
}
/*
* Handler for the browser register handler event.
*/
public void RegisterHandler(string url, ResourceHandler handler) {
// No implementation required
}
/*
* Handler for the browser unregister handler event.
*/
public void UnregisterHandler(string url) {
// No implementation required
}
#endregion
}
}
| mit | C# |
f6da160b16db5d05a0269215d32d875c075316d7 | Update IntersectionofRanges.cs | aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET | Examples/CSharp/Data/AddOn/NamedRanges/IntersectionofRanges.cs | Examples/CSharp/Data/AddOn/NamedRanges/IntersectionofRanges.cs | using System.IO;
using Aspose.Cells;
using System.Drawing;
namespace Aspose.Cells.Examples.Data.AddOn.NamedRanges
{
public class IntersectionofRanges
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate a workbook object.
//Open an existing excel file.
Workbook workbook = new Workbook(dataDir + "book1.xls");
//Get the named ranges.
Range[] ranges = workbook.Worksheets.GetNamedRanges();
//Check whether the first range intersect the second range.
bool isintersect = ranges[0].IsIntersect(ranges[1]);
//Create a style object.
Style style = workbook.Styles[workbook.Styles.Add()];
//Set the shading color with solid pattern type.
style.ForegroundColor = Color.Yellow;
style.Pattern = BackgroundType.Solid;
//Create a styleflag object.
StyleFlag flag = new StyleFlag();
//Apply the cellshading.
flag.CellShading = true;
//If first range intersects second range.
if (isintersect)
{
//Create a range by getting the intersection.
Range intersection = ranges[0].Intersect(ranges[1]);
//Name the range.
intersection.Name = "Intersection";
//Apply the style to the range.
intersection.ApplyStyle(style, flag);
}
//Save the excel file.
workbook.Save(dataDir + "rngIntersection.out.xls");
//ExEnd:1
}
}
}
| using System.IO;
using Aspose.Cells;
using System.Drawing;
namespace Aspose.Cells.Examples.Data.AddOn.NamedRanges
{
public class IntersectionofRanges
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate a workbook object.
//Open an existing excel file.
Workbook workbook = new Workbook(dataDir + "book1.xls");
//Get the named ranges.
Range[] ranges = workbook.Worksheets.GetNamedRanges();
//Check whether the first range intersect the second range.
bool isintersect = ranges[0].IsIntersect(ranges[1]);
//Create a style object.
Style style = workbook.Styles[workbook.Styles.Add()];
//Set the shading color with solid pattern type.
style.ForegroundColor = Color.Yellow;
style.Pattern = BackgroundType.Solid;
//Create a styleflag object.
StyleFlag flag = new StyleFlag();
//Apply the cellshading.
flag.CellShading = true;
//If first range intersects second range.
if (isintersect)
{
//Create a range by getting the intersection.
Range intersection = ranges[0].Intersect(ranges[1]);
//Name the range.
intersection.Name = "Intersection";
//Apply the style to the range.
intersection.ApplyStyle(style, flag);
}
//Save the excel file.
workbook.Save(dataDir + "rngIntersection.out.xls");
}
}
} | mit | C# |
4ddddfcb6eaf000c5790913d888016de5e010598 | 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. | autofac/Autofac.Web | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("Autofac.Tests.Integration.Web")]
| using System.Reflection;
[assembly: AssemblyTitle("Autofac.Tests.Integration.Web")]
[assembly: AssemblyDescription("")]
| mit | C# |
34463ee14fb2d6fd87e0c077246a914b4a1ac7a9 | update assembly info | Jetski5822/NGM.Forum | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
// 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("NGM.Forum")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Forum")]
[assembly: AssemblyCopyright("Copyright © Nicholas Mayne 2010")]
[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("6db4dac4-c637-4786-8e9b-ce26396e4567")]
// 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("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: SecurityTransparent] | 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("NGM.Forum")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicholas Mayne")]
[assembly: AssemblyProduct("NGM.Forum")]
[assembly: AssemblyCopyright("Copyright © Nicholas Mayne 2010")]
[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("6db4dac4-c637-4786-8e9b-ce26396e4567")]
// 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("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]
| bsd-3-clause | C# |
68badb8242b79ea315fab642552047a5cf8fb120 | Add anomaly difficulty flag | Kerbas-ad-astra/Orbital-Science,DMagic1/Orbital-Science | Source/DMAnomalyStorage.cs | Source/DMAnomalyStorage.cs | using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace DMagic
{
public class DMAnomalyStorage
{
private CelestialBody body;
private bool scanned;
private int level;
private Dictionary<string, DMAnomalyObject> anomalies = new Dictionary<string, DMAnomalyObject>();
public DMAnomalyStorage(CelestialBody b, bool s = true)
{
body = b;
scanned = s;
}
public void addAnomaly(DMAnomalyObject anom)
{
if (!anomalies.ContainsKey(anom.Name))
anomalies.Add(anom.Name, anom);
}
public bool scanBody()
{
scanned = true;
if (body.pqsController == null)
return false;
PQSCity[] Cities = body.pqsController.GetComponentsInChildren<PQSCity>();
for (int i = 0; i < Cities.Length; i++)
{
PQSCity city = Cities[i];
if (city == null)
continue;
if (city.transform.parent.name != body.name)
continue;
DMAnomalyObject anom = new DMAnomalyObject(city);
addAnomaly(anom);
}
return AnomalyCount > 0;
}
public DMAnomalyObject getAnomaly(string name)
{
if (anomalies.ContainsKey(name))
return anomalies[name];
return null;
}
public DMAnomalyObject getAnomaly(int index)
{
if (anomalies.Count > index)
return anomalies.ElementAt(index).Value;
return null;
}
public List<DMAnomalyObject> getAllAnomalies
{
get { return anomalies.Values.ToList(); }
}
public CelestialBody Body
{
get { return body; }
}
public bool Scanned
{
get { return scanned; }
}
public int AnomalyCount
{
get { return anomalies.Count; }
}
public int Level
{
get { return level; }
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace DMagic
{
public class DMAnomalyStorage
{
private CelestialBody body;
private bool scanned;
//private bool updated;
private Dictionary<string, DMAnomalyObject> anomalies = new Dictionary<string, DMAnomalyObject>();
public DMAnomalyStorage(CelestialBody b, bool s = true)
{
body = b;
scanned = s;
}
public void addAnomaly(DMAnomalyObject anom)
{
if (!anomalies.ContainsKey(anom.Name))
anomalies.Add(anom.Name, anom);
}
//public void updateAnomalyCity(PQSCity city)
//{
// DMAnomalyObject anom = anomalies.FirstOrDefault(a => a.Name == city.name);
// if (anom == null)
// return;
// anom.addPQSCity(city);
//}
public bool scanBody()
{
scanned = true;
if (body.pqsController == null)
return false;
PQSCity[] Cities = body.pqsController.GetComponentsInChildren<PQSCity>();
for (int i = 0; i < Cities.Length; i++)
{
PQSCity city = Cities[i];
if (city == null)
continue;
if (city.transform.parent.name != body.name)
continue;
DMAnomalyObject anom = new DMAnomalyObject(city);
addAnomaly(anom);
}
return true;
}
public DMAnomalyObject getAnomaly(string name)
{
if (anomalies.ContainsKey(name))
return anomalies[name];
return null;
}
public DMAnomalyObject getAnomaly(int index)
{
if (anomalies.Count > index)
return anomalies.ElementAt(index).Value;
return null;
}
public CelestialBody Body
{
get { return body; }
}
public bool Scanned
{
get { return scanned; }
}
//public bool Updated
//{
// get { return updated; }
// set { updated = value; }
//}
public int AnomalyCount
{
get { return anomalies.Count; }
}
}
}
| bsd-3-clause | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.