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 |
|---|---|---|---|---|---|---|---|---|
d07a8b86520634af23da8a5e0ba2e044c569bd23
|
Set window controls to right color
|
Esri/arcgis-runtime-demos-dotnet
|
src/OfflineWorkflowsSample/OfflineWorkflowsSample/Controls/CustomAppTitleBar.xaml.cs
|
src/OfflineWorkflowsSample/OfflineWorkflowsSample/Controls/CustomAppTitleBar.xaml.cs
|
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace OfflineWorkflowSample
{
public sealed partial class CustomAppTitleBar : UserControl, INotifyPropertyChanged
{
private string _title = "ArcGIS Maps Offline";
public string Title
{
get => _title;
set
{
_title = value;
OnPropertyChanged();
}
}
private Page _containingPage;
public CustomAppTitleBar()
{
this.InitializeComponent();
Window.Current.SetTitleBar(DraggablePart);
ApplicationView.GetForCurrentView().TitleBar.ButtonForegroundColor = Colors.Black;
DataContext = this;
}
public void EnableBackButton(Page containingPage)
{
_containingPage = containingPage;
BackButton.Visibility = Visibility.Visible;
}
private void BackButton_OnClick(object sender, RoutedEventArgs e)
{
if (_containingPage?.Frame != null && _containingPage.Frame.CanGoBack)
{
_containingPage.Frame.GoBack();
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace OfflineWorkflowSample
{
public sealed partial class CustomAppTitleBar : UserControl, INotifyPropertyChanged
{
private string _title = "ArcGIS Maps Offline";
public string Title
{
get => _title;
set
{
_title = value;
OnPropertyChanged();
}
}
private Page _containingPage;
public CustomAppTitleBar()
{
this.InitializeComponent();
Window.Current.SetTitleBar(DraggablePart);
DataContext = this;
}
public void EnableBackButton(Page containingPage)
{
_containingPage = containingPage;
BackButton.Visibility = Visibility.Visible;
}
private void BackButton_OnClick(object sender, RoutedEventArgs e)
{
if (_containingPage?.Frame != null && _containingPage.Frame.CanGoBack)
{
_containingPage.Frame.GoBack();
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|
apache-2.0
|
C#
|
c2cf6cb51b66e98e3f41cb856e02780730f70e55
|
Fix exception when no search service has been created
|
rajashekarusa/PnP-Sites-Core,Oaden/PnP-Sites-Core,m-carter1/PnP-Sites-Core,phillipharding/PnP-Sites-Core,rajashekarusa/PnP-Sites-Core,Puzzlepart/PnP-Sites-Core,itacs/PnP-Sites-Core,phillipharding/PnP-Sites-Core,PieterVeenstra/PnP-Sites-Core,m-carter1/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,comblox/PnP-Sites-Core,Puzzlepart/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,comblox/PnP-Sites-Core,itacs/PnP-Sites-Core,BobGerman/PnP-Sites-Core,BobGerman/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,PieterVeenstra/PnP-Sites-Core,rajashekarusa/PnP-Sites-Core,Oaden/PnP-Sites-Core
|
Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectSearchSettings.cs
|
Core/OfficeDevPnP.Core/Framework/Provisioning/ObjectHandlers/ObjectSearchSettings.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using OfficeDevPnP.Core.Framework.Provisioning.Model;
using OfficeDevPnP.Core.Diagnostics;
namespace OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers
{
internal class ObjectSearchSettings : ObjectHandlerBase
{
public override string Name
{
get { return "Search Settings"; }
}
public override ProvisioningTemplate ExtractObjects(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
{
using (var scope = new PnPMonitoredScope(this.Name))
{
var site = (web.Context as ClientContext).Site;
try
{
var searchSettings = site.GetSearchConfiguration();
if (!String.IsNullOrEmpty(searchSettings))
{
template.SearchSettings = searchSettings;
}
}
catch (ServerException)
{
// The search service is not necessarily configured
// Swallow the exception
}
}
return template;
}
public override TokenParser ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation)
{
using (var scope = new PnPMonitoredScope(this.Name))
{
var site = (web.Context as ClientContext).Site;
if (!String.IsNullOrEmpty(template.SearchSettings))
{
site.SetSearchConfiguration(template.SearchSettings);
}
}
return parser;
}
public override bool WillExtract(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
{
return creationInfo.IncludeSearchConfiguration;
}
public override bool WillProvision(Web web, ProvisioningTemplate template)
{
return !String.IsNullOrEmpty(template.SearchSettings);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using OfficeDevPnP.Core.Framework.Provisioning.Model;
using OfficeDevPnP.Core.Diagnostics;
namespace OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers
{
internal class ObjectSearchSettings : ObjectHandlerBase
{
public override string Name
{
get { return "Search Settings"; }
}
public override ProvisioningTemplate ExtractObjects(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
{
using (var scope = new PnPMonitoredScope(this.Name))
{
var site = (web.Context as ClientContext).Site;
var searchSettings = site.GetSearchConfiguration();
if (!String.IsNullOrEmpty(searchSettings))
{
template.SearchSettings = searchSettings;
}
}
return template;
}
public override TokenParser ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation)
{
using (var scope = new PnPMonitoredScope(this.Name))
{
var site = (web.Context as ClientContext).Site;
if (!String.IsNullOrEmpty(template.SearchSettings))
{
site.SetSearchConfiguration(template.SearchSettings);
}
}
return parser;
}
public override bool WillExtract(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
{
return true;
}
public override bool WillProvision(Web web, ProvisioningTemplate template)
{
return !String.IsNullOrEmpty(template.SearchSettings);
}
}
}
|
mit
|
C#
|
f467225c4941098d389070580b65f10d22b1d1c9
|
Set bursting state in GamePlayerJoinedEventPayloadHandler
|
HelloKitty/Booma.Proxy
|
src/Booma.Proxy.Client.Unity.Ship/Handlers/Command/Bursting/GamePlayerJoinedEventPayloadHandler.cs
|
src/Booma.Proxy.Client.Unity.Ship/Handlers/Command/Bursting/GamePlayerJoinedEventPayloadHandler.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using GladNet;
namespace Booma.Proxy
{
[SceneTypeCreate(GameSceneType.Pioneer2)]
public sealed class GamePlayerJoinedEventPayloadHandler : GameMessageHandler<BlockGamePlayerJoinedEventPayload>
{
private ICharacterSlotSelectedModel SlotModel { get; }
private IBurstingService BurstingService { get; }
/// <inheritdoc />
public GamePlayerJoinedEventPayloadHandler(ILog logger, [NotNull] ICharacterSlotSelectedModel slotModel, [NotNull] IBurstingService burstingService)
: base(logger)
{
SlotModel = slotModel ?? throw new ArgumentNullException(nameof(slotModel));
BurstingService = burstingService ?? throw new ArgumentNullException(nameof(burstingService));
}
/// <inheritdoc />
public override async Task HandleMessage(IPeerMessageContext<PSOBBGamePacketPayloadClient> context, BlockGamePlayerJoinedEventPayload payload)
{
//When this join is recieved, then we have to set the bursting state so it can be remembered, referenced or cleaned up.
if(BurstingService.SetBurstingEntity(EntityGuid.ComputeEntityGuid(EntityType.Player, payload.Identifier)))
{
//TODO: We are creating a fake 0x6D 0x70 here. Do we ever need a real one??
await context.PayloadSendService.SendMessage(new BlockNetworkCommand6DEventClientPayload(payload.Identifier, new Sub6DFakePlayerJoinDataNeededCommand(SlotModel.SlotSelected)));
}
//TODO: What do we do if this fails?
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using GladNet;
namespace Booma.Proxy
{
[SceneTypeCreate(GameSceneType.Pioneer2)]
public sealed class GamePlayerJoinedEventPayloadHandler : GameMessageHandler<BlockGamePlayerJoinedEventPayload>
{
private ICharacterSlotSelectedModel SlotModel { get; }
/// <inheritdoc />
public GamePlayerJoinedEventPayloadHandler(ILog logger, [NotNull] ICharacterSlotSelectedModel slotModel)
: base(logger)
{
SlotModel = slotModel ?? throw new ArgumentNullException(nameof(slotModel));
}
/// <inheritdoc />
public override async Task HandleMessage(IPeerMessageContext<PSOBBGamePacketPayloadClient> context, BlockGamePlayerJoinedEventPayload payload)
{
//TODO: We are creating a fake 0x6D 0x70 here. Do we ever need a real one??
//TODO: We are currently testing sending this in 15EA.
//TODO: We are creating a fake 0x6D 0x70 here. Do we ever need a real one??
await context.PayloadSendService.SendMessage(new BlockNetworkCommand6DEventClientPayload(payload.Identifier, new Sub6DFakePlayerJoinDataNeededCommand(SlotModel.SlotSelected)));
}
}
}
|
agpl-3.0
|
C#
|
c74bbd398ba9279571601a31d7ca4728798a38e9
|
Remove ResponseInfo from ConnectionInfo
|
flagbug/Espera.Network
|
Espera.Network/ConnectionInfo.cs
|
Espera.Network/ConnectionInfo.cs
|
using System;
namespace Espera.Network
{
public class ConnectionInfo
{
public ConnectionInfo(NetworkAccessPermission permission, Version serverVersion)
{
this.AccessPermission = permission;
this.ServerVersion = serverVersion;
}
public NetworkAccessPermission AccessPermission { get; private set; }
public Version ServerVersion { get; private set; }
}
}
|
using System;
namespace Espera.Network
{
public class ConnectionInfo
{
public ConnectionInfo(NetworkAccessPermission permission, Version serverVersion, ResponseInfo responseInfo)
{
if (responseInfo == null)
throw new ArgumentNullException("responseInfo");
this.AccessPermission = permission;
this.ServerVersion = serverVersion;
this.ResponseInfo = responseInfo;
}
public NetworkAccessPermission AccessPermission { get; private set; }
public ResponseInfo ResponseInfo { get; private set; }
public Version ServerVersion { get; private set; }
}
}
|
mit
|
C#
|
fadf6ae5e2bc4d19eff47d1a4e92412f116301eb
|
Add missing sample namespace.
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
samples/CookieSample/Startup.cs
|
samples/CookieSample/Startup.cs
|
using System.Security.Claims;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Security.Cookies;
namespace CookieSample
{
public class Startup
{
public void Configure(IBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
});
app.Run(async context =>
{
if (context.User == null || !context.User.Identity.IsAuthenticated)
{
context.Response.SignIn(new ClaimsIdentity(new[] { new Claim("name", "bob") }, CookieAuthenticationDefaults.AuthenticationType));
context.Response.ContentType = "text/plain";
await context.Response.WriteAsync("Hello First timer");
return;
}
context.Response.ContentType = "text/plain";
await context.Response.WriteAsync("Hello old timer");
});
}
}
}
|
using System.Security.Claims;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Security.Cookies;
namespace CookieSample
{
public class Startup
{
public void Configure(IBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
});
app.Run(async context =>
{
if (context.User == null || !context.User.Identity.IsAuthenticated)
{
context.Response.SignIn(new ClaimsIdentity(new[] { new Claim("name", "bob") }, CookieAuthenticationDefaults.AuthenticationType));
context.Response.ContentType = "text/plain";
await context.Response.WriteAsync("Hello First timer");
return;
}
context.Response.ContentType = "text/plain";
await context.Response.WriteAsync("Hello old timer");
});
}
}
}
|
apache-2.0
|
C#
|
c3017645866d37b25af93c5a22b150ed7edff9c4
|
Replace ElementAt with AsEnumerable
|
yishn/GTPWrapper
|
GTPWrapper/DataTypes/ListTree.cs
|
GTPWrapper/DataTypes/ListTree.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GTPWrapper.DataTypes {
public class ListTree<T> {
/// <summary>
/// Gets or sets the list of elements of this tree.
/// </summary>
public List<T> Elements { get; set; }
/// <summary>
/// Gets or sets the list of subtrees of this tree.
/// </summary>
public List<ListTree<T>> SubTrees { get; set; }
/// <summary>
/// Initializes a new instance of the ListTreeNode class with an empty list.
/// </summary>
public ListTree() : this(new List<T>()) { }
/// <summary>
/// Initializes a new instance of the ListTreeNode class.
/// </summary>
public ListTree(List<T> list) {
this.Elements = list;
this.SubTrees = new List<ListTree<T>>();
}
/// <summary>
/// Returns a linear list of the elements in the tree as IEnumerable.
/// </summary>
public IEnumerable<T> AsEnumerable() {
foreach (T element in this.Elements) yield return element;
if (this.SubTrees.Count == 0) yield break;
foreach (T element in this.SubTrees[0].AsEnumerable()) yield return element;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GTPWrapper.DataTypes {
public class ListTree<T> {
/// <summary>
/// Gets or sets the list of elements of this tree.
/// </summary>
public List<T> Elements { get; set; }
/// <summary>
/// Gets or sets the list of subtrees of this tree.
/// </summary>
public List<ListTree<T>> SubTrees { get; set; }
/// <summary>
/// Initializes a new instance of the ListTreeNode class with an empty list.
/// </summary>
public ListTree() : this(new List<T>()) { }
/// <summary>
/// Initializes a new instance of the ListTreeNode class.
/// </summary>
public ListTree(List<T> list) {
this.Elements = list;
this.SubTrees = new List<ListTree<T>>();
}
/// <summary>
/// Returns the element at the given global index, traveling down a subtree if necessary.
/// </summary>
/// <param name="index">The global index of the element.</param>
public T ElementAt(int index) {
if (Elements.Count > index) return this.Elements[index];
return this.SubTrees[0].ElementAt(index - Elements.Count);
}
}
}
|
mit
|
C#
|
297f2394031b492bc9483663072e6335205ae648
|
Fix typo and remove usings
|
punker76/Espera,flagbug/Espera
|
Espera/Espera.Core/BlobCacheKeys.cs
|
Espera/Espera.Core/BlobCacheKeys.cs
|
namespace Espera.Core
{
/// <summary>
/// This class contains the used keys for Akavache
/// </summary>
public static class BlobCacheKeys
{
/// <summary>
/// This is the key prefix for song artworks. After the hyphen, the MD5 hash of the artwork
/// is attached.
/// </summary>
public const string Artwork = "artwork-";
/// <summary>
/// This is the key for the changelog that is shown after the application is updated.
/// </summary>
public const string Changelog = "changelog";
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Espera.Core
{
/// <summary>
/// This class contains the used keys for Akavache
/// </summary>
public static class BlobCacheKeys
{
/// <summary>
/// This is the key prefix for song artworks. After the hyphe, the MD5 hash of the artwork
/// is attached.
/// </summary>
public const string Artwork = "artwork-";
/// <summary>
/// This is the key for the changelog that is shown after the application is updated.
/// </summary>
public const string Changelog = "changelog";
}
}
|
mit
|
C#
|
92fb369eb97b0684686a591f9954db638960b031
|
validate email on org create
|
bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core
|
src/Core/Models/Api/Request/Organizations/OrganizationCreateRequestModel.cs
|
src/Core/Models/Api/Request/Organizations/OrganizationCreateRequestModel.cs
|
using Bit.Core.Models.Table;
using Bit.Core.Enums;
using Bit.Core.Models.Business;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
namespace Bit.Core.Models.Api
{
public class OrganizationCreateRequestModel : IValidatableObject
{
[Required]
[StringLength(50)]
public string Name { get; set; }
[StringLength(50)]
public string BusinessName { get; set; }
[Required]
[StringLength(50)]
[EmailAddress]
public string BillingEmail { get; set; }
public PlanType PlanType { get; set; }
[Required]
public string Key { get; set; }
public string PaymentToken { get; set; }
[Range(0, double.MaxValue)]
public short AdditionalSeats { get; set; }
public virtual OrganizationSignup ToOrganizationSignup(User user)
{
return new OrganizationSignup
{
Owner = user,
OwnerKey = Key,
Name = Name,
Plan = PlanType,
PaymentToken = PaymentToken,
AdditionalSeats = AdditionalSeats,
BillingEmail = BillingEmail,
BusinessName = BusinessName
};
}
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if(PlanType != PlanType.Free && string.IsNullOrWhiteSpace(PaymentToken))
{
yield return new ValidationResult("Payment required.", new string[] { nameof(PaymentToken) });
}
}
}
}
|
using Bit.Core.Models.Table;
using Bit.Core.Enums;
using Bit.Core.Models.Business;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
namespace Bit.Core.Models.Api
{
public class OrganizationCreateRequestModel : IValidatableObject
{
[Required]
[StringLength(50)]
public string Name { get; set; }
[StringLength(50)]
public string BusinessName { get; set; }
[Required]
[StringLength(50)]
public string BillingEmail { get; set; }
public PlanType PlanType { get; set; }
[Required]
public string Key { get; set; }
public string PaymentToken { get; set; }
[Range(0, double.MaxValue)]
public short AdditionalSeats { get; set; }
public virtual OrganizationSignup ToOrganizationSignup(User user)
{
return new OrganizationSignup
{
Owner = user,
OwnerKey = Key,
Name = Name,
Plan = PlanType,
PaymentToken = PaymentToken,
AdditionalSeats = AdditionalSeats,
BillingEmail = BillingEmail,
BusinessName = BusinessName
};
}
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if(PlanType != PlanType.Free && string.IsNullOrWhiteSpace(PaymentToken))
{
yield return new ValidationResult("Payment required.", new string[] { nameof(PaymentToken) });
}
}
}
}
|
agpl-3.0
|
C#
|
2d3ad1cb0f9872da40c6d143ce4554563971ae04
|
Add application/wasm to the default compression list (#377)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Microsoft.AspNetCore.ResponseCompression/ResponseCompressionDefaults.cs
|
src/Microsoft.AspNetCore.ResponseCompression/ResponseCompressionDefaults.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.Collections.Generic;
namespace Microsoft.AspNetCore.ResponseCompression
{
/// <summary>
/// Defaults for the ResponseCompressionMiddleware
/// </summary>
public class ResponseCompressionDefaults
{
/// <summary>
/// Default MIME types to compress responses for.
/// </summary>
// This list is not intended to be exhaustive, it's a baseline for the 90% case.
public static readonly IEnumerable<string> MimeTypes = new[]
{
// General
"text/plain",
// Static files
"text/css",
"application/javascript",
// MVC
"text/html",
"application/xml",
"text/xml",
"application/json",
"text/json",
// WebAssembly
"application/wasm",
};
}
}
|
// 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.Collections.Generic;
namespace Microsoft.AspNetCore.ResponseCompression
{
/// <summary>
/// Defaults for the ResponseCompressionMiddleware
/// </summary>
public class ResponseCompressionDefaults
{
/// <summary>
/// Default MIME types to compress responses for.
/// </summary>
// This list is not intended to be exhaustive, it's a baseline for the 90% case.
public static readonly IEnumerable<string> MimeTypes = new[]
{
// General
"text/plain",
// Static files
"text/css",
"application/javascript",
// MVC
"text/html",
"application/xml",
"text/xml",
"application/json",
"text/json",
};
}
}
|
apache-2.0
|
C#
|
c17dc58467479a64b07391dcde4fde8c9b3e9142
|
Add summaries to PgnErrorInfo members.
|
PenguinF/sandra-three
|
Sandra.Chess/Pgn/PgnErrorInfo.cs
|
Sandra.Chess/Pgn/PgnErrorInfo.cs
|
#region License
/*********************************************************************************
* PgnErrorInfo.cs
*
* Copyright (c) 2004-2019 Henk Nicolai
*
* 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 Eutherion.Text;
namespace Sandra.Chess.Pgn
{
/// <summary>
/// Reports an error at a certain location in a source PGN.
/// </summary>
public class PgnErrorInfo : ISpan
{
/// <summary>
/// Gets the error code.
/// </summary>
public PgnErrorCode ErrorCode { get; }
/// <summary>
/// Gets the start position of the text span where the error occurred.
/// </summary>
public int Start { get; }
/// <summary>
/// Gets the length of the text span where the error occurred.
/// </summary>
public int Length { get; }
/// <summary>
/// Initializes a new instance of <see cref="PgnErrorInfo"/>.
/// </summary>
/// <param name="errorCode">
/// The error code.
/// </param>
/// <param name="start">
/// The start position of the text span where the error occurred.
/// </param>
/// <param name="length">
/// The length of the text span where the error occurred.
/// </param>
public PgnErrorInfo(PgnErrorCode errorCode, int start, int length)
{
ErrorCode = errorCode;
Start = start;
Length = length;
}
}
}
|
#region License
/*********************************************************************************
* PgnErrorInfo.cs
*
* Copyright (c) 2004-2019 Henk Nicolai
*
* 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 Eutherion.Text;
namespace Sandra.Chess.Pgn
{
/// <summary>
/// Reports an error at a certain location in a source PGN.
/// </summary>
public class PgnErrorInfo : ISpan
{
public PgnErrorCode ErrorCode { get; }
public int Start { get; }
public int Length { get; }
public PgnErrorInfo(PgnErrorCode errorCode, int start, int length)
{
ErrorCode = errorCode;
Start = start;
Length = length;
}
}
}
|
apache-2.0
|
C#
|
0bdf83c8858ba6adeba3f907db727925d6caab52
|
Add closed event to connection
|
k-t/SharpHaven
|
MonoHaven.Lib/Network/Connection.cs
|
MonoHaven.Lib/Network/Connection.cs
|
using System;
using System.Net.Sockets;
namespace MonoHaven.Network
{
public class Connection : IDisposable
{
private const int ProtocolVersion = 2;
private const int MSG_SESS = 0;
private const int MSG_CLOSE = 8;
private readonly ConnectionSettings settings;
private readonly GameSocket socket;
private readonly MessageReceiver receiver;
private readonly MessageSender sender;
private ConnectionState state;
private readonly object stateLock = new object();
public Connection(ConnectionSettings settings)
{
this.settings = settings;
state = ConnectionState.Created;
socket = new GameSocket(settings.Host, settings.Port);
sender = new MessageSender(socket);
sender.Finished += OnTaskFinished;
receiver = new MessageReceiver(socket);
receiver.Finished += OnTaskFinished;
}
public event EventHandler Closed;
public void Dispose()
{
Close();
}
public void Open()
{
try
{
lock (stateLock)
{
if (state != ConnectionState.Created)
throw new InvalidOperationException("Can't open already opened/closed connection");
Connect();
receiver.Run();
sender.Run();
state = ConnectionState.Opened;
}
}
catch (SocketException ex)
{
throw new ConnectionException(ex.Message, ex);
}
}
public void Close()
{
lock (stateLock)
{
if (state != ConnectionState.Opened)
return;
receiver.Finished -= OnTaskFinished;
receiver.Stop();
sender.Finished -= OnTaskFinished;
sender.Stop();
socket.SendMessage(new Message(MSG_CLOSE));
socket.Close();
state = ConnectionState.Closed;
}
if (Closed != null)
Closed(this, EventArgs.Empty);
}
private void Connect()
{
socket.Connect();
var hello = new Message(MSG_SESS)
.Uint16(1)
.String("Haven")
.Uint16(ProtocolVersion)
.String(settings.UserName)
.Bytes(settings.Cookie);
socket.SendMessage(hello);
ConnectionError error;
while (true)
{
var reply = socket.ReceiveMessage();
if (reply.MessageType == MSG_SESS)
{
error = (ConnectionError)reply.ReadByte();
break;
}
if (reply.MessageType == MSG_CLOSE)
{
error = ConnectionError.ConnectionError;
break;
}
}
if (error != ConnectionError.None)
throw new ConnectionException(error);
}
private void OnTaskFinished(object sender, EventArgs args)
{
// TODO: call this method in another thread so it won't block task completion?
Close();
}
}
}
|
using System;
using System.Net.Sockets;
using System.Threading;
namespace MonoHaven.Network
{
public class Connection : IDisposable
{
private const int ProtocolVersion = 2;
private const int MSG_SESS = 0;
private const int MSG_CLOSE = 8;
private readonly ConnectionSettings settings;
private readonly GameSocket socket;
private readonly MessageReceiver receiver;
private readonly MessageSender sender;
private ConnectionState state;
private readonly object stateLock = new object();
public Connection(ConnectionSettings settings)
{
this.settings = settings;
state = ConnectionState.Created;
socket = new GameSocket(settings.Host, settings.Port);
sender = new MessageSender(socket);
sender.Finished += TaskFinished;
receiver = new MessageReceiver(socket);
receiver.Finished += TaskFinished;
}
public void Dispose()
{
Close();
}
public void Open()
{
try
{
lock (stateLock)
{
if (state != ConnectionState.Created)
throw new InvalidOperationException("Can't open already opened/closed connection");
Connect();
receiver.Run();
sender.Run();
state = ConnectionState.Opened;
}
}
catch (SocketException ex)
{
throw new ConnectionException(ex.Message, ex);
}
}
public void Close()
{
lock (stateLock)
{
if (state != ConnectionState.Opened)
return;
receiver.Stop();
sender.Stop();
socket.SendMessage(new Message(MSG_CLOSE));
socket.Close();
state = ConnectionState.Closed;
}
}
private void Connect()
{
socket.Connect();
var hello = new Message(MSG_SESS)
.Uint16(1)
.String("Haven")
.Uint16(ProtocolVersion)
.String(settings.UserName)
.Bytes(settings.Cookie);
socket.SendMessage(hello);
ConnectionError error;
while (true)
{
var reply = socket.ReceiveMessage();
if (reply.MessageType == MSG_SESS)
{
error = (ConnectionError)reply.ReadByte();
break;
}
if (reply.MessageType == MSG_CLOSE)
{
error = ConnectionError.ConnectionError;
break;
}
}
if (error != ConnectionError.None)
throw new ConnectionException(error);
}
private void TaskFinished(object sender, EventArgs args)
{
// TODO: call this method in another thread so it won't block task completion?
Close();
}
}
}
|
mit
|
C#
|
1d74be5109fe45f671a1c5617f2b9ae0df28cd39
|
bump version
|
MetacoSA/NBitcoin,stratisproject/NStratis,NicolasDorier/NBitcoin,thepunctuatedhorizon/BrickCoinAlpha.0.0.1,dangershony/NStratis,MetacoSA/NBitcoin,lontivero/NBitcoin
|
NBitcoin/Properties/AssemblyInfo.cs
|
NBitcoin/Properties/AssemblyInfo.cs
|
using System;
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("NBitcoin")]
[assembly: AssemblyDescription("Implementation of bitcoin protocol")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AO-IS")]
[assembly: AssemblyProduct("NBitcoin")]
[assembly: AssemblyCopyright("Copyright © AO-IS 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("NBitcoin.Tests")]
// 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)]
// 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("3.0.0.63")]
[assembly: AssemblyFileVersion("3.0.0.63")]
[assembly: AssemblyInformationalVersion("3.0.0.63")]
|
using System;
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("NBitcoin")]
[assembly: AssemblyDescription("Implementation of bitcoin protocol")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AO-IS")]
[assembly: AssemblyProduct("NBitcoin")]
[assembly: AssemblyCopyright("Copyright © AO-IS 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("NBitcoin.Tests")]
// 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)]
// 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("3.0.0.62")]
[assembly: AssemblyFileVersion("3.0.0.62")]
[assembly: AssemblyInformationalVersion("3.0.0.62")]
|
mit
|
C#
|
ff48809c9ea304659f4c13abe1692c1ab09e2c1b
|
Update AdjacencyMatrix.cs
|
nabaird/Unity-Pathfinding-
|
Horizontal%20Movement/PathingNodes/AdjacencyMatrix.cs
|
Horizontal%20Movement/PathingNodes/AdjacencyMatrix.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class AdjacencyMatrix : MonoBehaviour {
public class vertex
{
public GameObject node;
public float weight;
public vertex(GameObject n, float w)
{
node = n;
weight = w;
}
}
public List<vertex> aMatrix;
public GameObject[] allNodes;
public int index;
public void GenerateMatrix()
{
allNodes = GameObject.Find("Nodes").GetComponent<AllNodes>().NodeList;
aMatrix = new List<vertex>();
foreach (GameObject node in allNodes)
{
float distance = Vector3.Distance(node.transform.position, transform.position);//the weight is the distance in unity between nodes
if (node != this)
{
RaycastHit hit;//We use raycasting to see which nodes within view of other nodes
if (Physics.Raycast(transform.position, Vector3.Normalize(node.transform.position - transform.position), out hit))
{
if (hit.collider == node.GetComponent<Collider>())
{
aMatrix.Add(new vertex(node, distance));
}
}
}
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class AdjacencyMatrix : MonoBehaviour {
public class vertex
{
public GameObject node;
public float weight;
public vertex(GameObject n, float w)
{
node = n;
weight = w;
}
}
public List<vertex> aMatrix;
public GameObject[] allNodes;
public List<GameObject> test;
public int index;
public void GenerateMatrix()
{
allNodes = GameObject.Find("Nodes").GetComponent<AllNodes>().NodeList;
aMatrix = new List<vertex>();
foreach (GameObject node in allNodes)
{
float distance = Vector3.Distance(node.transform.position, transform.position);//the weight is the distance in unity between nodes
if (node != this)
{
RaycastHit hit;//We use raycasting to see which nodes within view of other nodes
if (Physics.Raycast(transform.position, Vector3.Normalize(node.transform.position - transform.position), out hit))
{
if (hit.collider == node.GetComponent<Collider>())
{
aMatrix.Add(new vertex(node, distance));
}
}
}
}
test = new List<GameObject>();
foreach (vertex v in aMatrix)
{
test.Add(v.node);
}
}
|
mit
|
C#
|
f141fc40ab5160828455bec36c4936b3c4e3e0b5
|
Add xmldoc
|
ZLima12/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework
|
osu.Framework/Audio/Track/ChannelAmplitudes.cs
|
osu.Framework/Audio/Track/ChannelAmplitudes.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
namespace osu.Framework.Audio.Track
{
/// <summary>
/// A collection of information providing per-channel and per-frequency amplitudes of an audio channel.
/// </summary>
public readonly struct ChannelAmplitudes
{
/// <summary>
/// The length of the <see cref="FrequencyAmplitudes"/> data.
/// </summary>
public const int AMPLITUDES_SIZE = 256;
/// <summary>
/// The amplitude of the left channel (0..1).
/// </summary>
public readonly float LeftChannel;
/// <summary>
/// The amplitude of the right channel (0..1).
/// </summary>
public readonly float RightChannel;
/// <summary>
/// The maximum amplitude of the left and right channels (0..1).
/// </summary>
public float Maximum => Math.Max(LeftChannel, RightChannel);
/// <summary>
/// The average amplitude of the left and right channels (0..1).
/// </summary>
public float Average => (LeftChannel + RightChannel) / 2;
/// <summary>
/// 256 length array of bins containing the average frequency of both channels at every ~78Hz step of the audible spectrum (0Hz - 20,000Hz).
/// </summary>
public readonly ReadOnlyMemory<float> FrequencyAmplitudes;
private static readonly float[] empty_array = new float[AMPLITUDES_SIZE];
public ChannelAmplitudes(float leftChannel = 0, float rightChannel = 0, float[] amplitudes = null)
{
LeftChannel = leftChannel;
RightChannel = rightChannel;
FrequencyAmplitudes = amplitudes ?? empty_array;
}
public static ChannelAmplitudes Empty { get; } = new ChannelAmplitudes(0);
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
namespace osu.Framework.Audio.Track
{
public readonly struct ChannelAmplitudes
{
/// <summary>
/// The length of the <see cref="FrequencyAmplitudes"/> data.
/// </summary>
public const int AMPLITUDES_SIZE = 256;
public readonly float LeftChannel;
public readonly float RightChannel;
public float Maximum => Math.Max(LeftChannel, RightChannel);
public float Average => (LeftChannel + RightChannel) / 2;
/// <summary>
/// 256 length array of bins containing the average frequency of both channels at every ~78Hz step of the audible spectrum (0Hz - 20,000Hz).
/// </summary>
public readonly ReadOnlyMemory<float> FrequencyAmplitudes;
private static readonly float[] empty_array = new float[AMPLITUDES_SIZE];
public ChannelAmplitudes(float leftChannel = 0, float rightChannel = 0, float[] amplitudes = null)
{
LeftChannel = leftChannel;
RightChannel = rightChannel;
FrequencyAmplitudes = amplitudes ?? empty_array;
}
public static ChannelAmplitudes Empty { get; } = new ChannelAmplitudes(0);
}
}
|
mit
|
C#
|
6a8410e4016ac20643cadd6a2fc1d8fb3574c009
|
test commit
|
trppt12/ConnectedCar
|
src/RunFromConsole/Cars.Simulator.ConsoleHost/Program.cs
|
src/RunFromConsole/Cars.Simulator.ConsoleHost/Program.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//THIS IS JUST A TEST COMMENT FOR COMMITTING
namespace Microsoft.Practices.DataPipeline.Cars.Simulator.ConsoleHost
{
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Practices.DataPipeline.Cars.Dispatcher.Simulator;
using Microsoft.Practices.DataPipeline.Cars.Dispatcher.Simulator.Instrumentation;
using Microsoft.Practices.DataPipeline.Tests;
internal class Program
{
private static void Main(string[] args)
{
var configuration = SimulatorConfiguration.GetCurrentConfiguration();
var instrumentationPublisher =
new SenderInstrumentationManager(instrumentationEnabled: true, installInstrumentation: true)
.CreatePublisher("Console");
var carEmulator = new SimulationProfile("Console", 1, instrumentationPublisher, configuration);
var options = SimulationScenarios
.AllScenarios
.ToDictionary(
scenario => "Run " + scenario,
scenario => (Func<CancellationToken, Task>)(token => carEmulator.RunEmulationAsync(scenario, token)));
// Add Single shot
foreach (var scenario in SimulationScenarios.AllScenarios)
{
var name = scenario;
options.Add(
"Send 1 message from " + name,
token => carEmulator.RunOneMessageEmulationAsync(name, token)
);
}
ConsoleHost.WithOptions(options, configuration.ScenarioDuration);
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Practices.DataPipeline.Cars.Simulator.ConsoleHost
{
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Practices.DataPipeline.Cars.Dispatcher.Simulator;
using Microsoft.Practices.DataPipeline.Cars.Dispatcher.Simulator.Instrumentation;
using Microsoft.Practices.DataPipeline.Tests;
internal class Program
{
private static void Main(string[] args)
{
var configuration = SimulatorConfiguration.GetCurrentConfiguration();
var instrumentationPublisher =
new SenderInstrumentationManager(instrumentationEnabled: true, installInstrumentation: true)
.CreatePublisher("Console");
var carEmulator = new SimulationProfile("Console", 1, instrumentationPublisher, configuration);
var options = SimulationScenarios
.AllScenarios
.ToDictionary(
scenario => "Run " + scenario,
scenario => (Func<CancellationToken, Task>)(token => carEmulator.RunEmulationAsync(scenario, token)));
// Add Single shot
foreach (var scenario in SimulationScenarios.AllScenarios)
{
var name = scenario;
options.Add(
"Send 1 message from " + name,
token => carEmulator.RunOneMessageEmulationAsync(name, token)
);
}
ConsoleHost.WithOptions(options, configuration.ScenarioDuration);
}
}
}
|
mit
|
C#
|
19b417b08c78a61665eca98815cc2dde297b6869
|
Remove incorrect test code...
|
hannan-azam/Orchard,hbulzy/Orchard,DonnotRain/Orchard,salarvand/orchard,yonglehou/Orchard,jchenga/Orchard,NIKASoftwareDevs/Orchard,armanforghani/Orchard,xiaobudian/Orchard,brownjordaninternational/OrchardCMS,sfmskywalker/Orchard,Cphusion/Orchard,NIKASoftwareDevs/Orchard,sebastienros/msc,grapto/Orchard.CloudBust,jaraco/orchard,IDeliverable/Orchard,harmony7/Orchard,caoxk/orchard,dmitry-urenev/extended-orchard-cms-v10.1,abhishekluv/Orchard,xiaobudian/Orchard,TaiAivaras/Orchard,alejandroaldana/Orchard,phillipsj/Orchard,andyshao/Orchard,sfmskywalker/Orchard,geertdoornbos/Orchard,kgacova/Orchard,arminkarimi/Orchard,infofromca/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,infofromca/Orchard,patricmutwiri/Orchard,arminkarimi/Orchard,Morgma/valleyviewknolls,RoyalVeterinaryCollege/Orchard,xiaobudian/Orchard,smartnet-developers/Orchard,spraiin/Orchard,Praggie/Orchard,abhishekluv/Orchard,dburriss/Orchard,AdvantageCS/Orchard,fassetar/Orchard,jersiovic/Orchard,vairam-svs/Orchard,openbizgit/Orchard,OrchardCMS/Orchard,AEdmunds/beautiful-springtime,DonnotRain/Orchard,rtpHarry/Orchard,omidnasri/Orchard,rtpHarry/Orchard,Dolphinsimon/Orchard,kgacova/Orchard,sebastienros/msc,MpDzik/Orchard,IDeliverable/Orchard,abhishekluv/Orchard,OrchardCMS/Orchard-Harvest-Website,sfmskywalker/Orchard,fortunearterial/Orchard,Dolphinsimon/Orchard,TaiAivaras/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,dcinzona/Orchard,MetSystem/Orchard,LaserSrl/Orchard,smartnet-developers/Orchard,cooclsee/Orchard,Dolphinsimon/Orchard,MetSystem/Orchard,MetSystem/Orchard,caoxk/orchard,jchenga/Orchard,MetSystem/Orchard,SouleDesigns/SouleDesigns.Orchard,alejandroaldana/Orchard,vairam-svs/Orchard,armanforghani/Orchard,dcinzona/Orchard-Harvest-Website,luchaoshuai/Orchard,cooclsee/Orchard,geertdoornbos/Orchard,vard0/orchard.tan,hannan-azam/Orchard,TalaveraTechnologySolutions/Orchard,enspiral-dev-academy/Orchard,mvarblow/Orchard,mvarblow/Orchard,hhland/Orchard,dozoft/Orchard,m2cms/Orchard,emretiryaki/Orchard,Inner89/Orchard,m2cms/Orchard,salarvand/Portal,bedegaming-aleksej/Orchard,harmony7/Orchard,jtkech/Orchard,LaserSrl/Orchard,xkproject/Orchard,Cphusion/Orchard,hannan-azam/Orchard,kgacova/Orchard,li0803/Orchard,OrchardCMS/Orchard-Harvest-Website,RoyalVeterinaryCollege/Orchard,fassetar/Orchard,cooclsee/Orchard,geertdoornbos/Orchard,qt1/Orchard,marcoaoteixeira/Orchard,angelapper/Orchard,hhland/Orchard,dozoft/Orchard,emretiryaki/Orchard,mvarblow/Orchard,AndreVolksdorf/Orchard,enspiral-dev-academy/Orchard,cooclsee/Orchard,Codinlab/Orchard,bedegaming-aleksej/Orchard,johnnyqian/Orchard,li0803/Orchard,tobydodds/folklife,LaserSrl/Orchard,xkproject/Orchard,dcinzona/Orchard,omidnasri/Orchard,jimasp/Orchard,jimasp/Orchard,OrchardCMS/Orchard-Harvest-Website,marcoaoteixeira/Orchard,grapto/Orchard.CloudBust,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,hhland/Orchard,aaronamm/Orchard,marcoaoteixeira/Orchard,andyshao/Orchard,oxwanawxo/Orchard,infofromca/Orchard,jtkech/Orchard,fortunearterial/Orchard,angelapper/Orchard,Ermesx/Orchard,angelapper/Orchard,spraiin/Orchard,phillipsj/Orchard,kgacova/Orchard,harmony7/Orchard,kouweizhong/Orchard,IDeliverable/Orchard,AndreVolksdorf/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,johnnyqian/Orchard,hhland/Orchard,MpDzik/Orchard,SouleDesigns/SouleDesigns.Orchard,bigfont/orchard-continuous-integration-demo,salarvand/orchard,geertdoornbos/Orchard,jagraz/Orchard,ehe888/Orchard,cryogen/orchard,tobydodds/folklife,planetClaire/Orchard-LETS,KeithRaven/Orchard,jerryshi2007/Orchard,Sylapse/Orchard.HttpAuthSample,TalaveraTechnologySolutions/Orchard,mgrowan/Orchard,li0803/Orchard,harmony7/Orchard,austinsc/Orchard,LaserSrl/Orchard,Anton-Am/Orchard,hbulzy/Orchard,abhishekluv/Orchard,gcsuk/Orchard,OrchardCMS/Orchard-Harvest-Website,Lombiq/Orchard,Inner89/Orchard,yonglehou/Orchard,TaiAivaras/Orchard,vard0/orchard.tan,spraiin/Orchard,kouweizhong/Orchard,stormleoxia/Orchard,patricmutwiri/Orchard,qt1/Orchard,xkproject/Orchard,planetClaire/Orchard-LETS,stormleoxia/Orchard,sfmskywalker/Orchard,asabbott/chicagodevnet-website,escofieldnaxos/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,smartnet-developers/Orchard,johnnyqian/Orchard,kgacova/Orchard,omidnasri/Orchard,SouleDesigns/SouleDesigns.Orchard,openbizgit/Orchard,salarvand/orchard,johnnyqian/Orchard,salarvand/Portal,Sylapse/Orchard.HttpAuthSample,jerryshi2007/Orchard,Ermesx/Orchard,bigfont/orchard-cms-modules-and-themes,dburriss/Orchard,AndreVolksdorf/Orchard,vairam-svs/Orchard,salarvand/Portal,sfmskywalker/Orchard,emretiryaki/Orchard,omidnasri/Orchard,andyshao/Orchard,Praggie/Orchard,ehe888/Orchard,SouleDesigns/SouleDesigns.Orchard,kouweizhong/Orchard,SeyDutch/Airbrush,stormleoxia/Orchard,jtkech/Orchard,AdvantageCS/Orchard,cryogen/orchard,TalaveraTechnologySolutions/Orchard,openbizgit/Orchard,qt1/orchard4ibn,Lombiq/Orchard,yersans/Orchard,salarvand/Portal,asabbott/chicagodevnet-website,sfmskywalker/Orchard,armanforghani/Orchard,geertdoornbos/Orchard,huoxudong125/Orchard,Serlead/Orchard,m2cms/Orchard,dcinzona/Orchard-Harvest-Website,aaronamm/Orchard,li0803/Orchard,OrchardCMS/Orchard-Harvest-Website,qt1/orchard4ibn,openbizgit/Orchard,tobydodds/folklife,jimasp/Orchard,stormleoxia/Orchard,Morgma/valleyviewknolls,enspiral-dev-academy/Orchard,JRKelso/Orchard,jerryshi2007/Orchard,sebastienros/msc,vairam-svs/Orchard,marcoaoteixeira/Orchard,KeithRaven/Orchard,jersiovic/Orchard,TaiAivaras/Orchard,OrchardCMS/Orchard,Inner89/Orchard,grapto/Orchard.CloudBust,jimasp/Orchard,AdvantageCS/Orchard,tobydodds/folklife,dcinzona/Orchard-Harvest-Website,IDeliverable/Orchard,stormleoxia/Orchard,huoxudong125/Orchard,phillipsj/Orchard,jaraco/orchard,jchenga/Orchard,neTp9c/Orchard,Anton-Am/Orchard,JRKelso/Orchard,Codinlab/Orchard,mgrowan/Orchard,SzymonSel/Orchard,vard0/orchard.tan,xiaobudian/Orchard,Ermesx/Orchard,RoyalVeterinaryCollege/Orchard,LaserSrl/Orchard,oxwanawxo/Orchard,patricmutwiri/Orchard,ehe888/Orchard,vard0/orchard.tan,kouweizhong/Orchard,austinsc/Orchard,luchaoshuai/Orchard,escofieldnaxos/Orchard,jtkech/Orchard,Inner89/Orchard,SzymonSel/Orchard,aaronamm/Orchard,yonglehou/Orchard,jersiovic/Orchard,jchenga/Orchard,bigfont/orchard-continuous-integration-demo,neTp9c/Orchard,hbulzy/Orchard,tobydodds/folklife,Sylapse/Orchard.HttpAuthSample,jagraz/Orchard,MpDzik/Orchard,mgrowan/Orchard,jtkech/Orchard,austinsc/Orchard,qt1/orchard4ibn,cryogen/orchard,Sylapse/Orchard.HttpAuthSample,grapto/Orchard.CloudBust,jerryshi2007/Orchard,bedegaming-aleksej/Orchard,cryogen/orchard,Cphusion/Orchard,luchaoshuai/Orchard,grapto/Orchard.CloudBust,asabbott/chicagodevnet-website,jaraco/orchard,gcsuk/Orchard,Serlead/Orchard,RoyalVeterinaryCollege/Orchard,mvarblow/Orchard,AEdmunds/beautiful-springtime,enspiral-dev-academy/Orchard,sebastienros/msc,DonnotRain/Orchard,bigfont/orchard-continuous-integration-demo,brownjordaninternational/OrchardCMS,dcinzona/Orchard,m2cms/Orchard,caoxk/orchard,Morgma/valleyviewknolls,patricmutwiri/Orchard,harmony7/Orchard,gcsuk/Orchard,andyshao/Orchard,emretiryaki/Orchard,dozoft/Orchard,bigfont/orchard-cms-modules-and-themes,salarvand/orchard,brownjordaninternational/OrchardCMS,Fogolan/OrchardForWork,jagraz/Orchard,OrchardCMS/Orchard,IDeliverable/Orchard,NIKASoftwareDevs/Orchard,bigfont/orchard-cms-modules-and-themes,ehe888/Orchard,AndreVolksdorf/Orchard,TalaveraTechnologySolutions/Orchard,Cphusion/Orchard,JRKelso/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,abhishekluv/Orchard,alejandroaldana/Orchard,OrchardCMS/Orchard-Harvest-Website,Praggie/Orchard,spraiin/Orchard,austinsc/Orchard,Serlead/Orchard,openbizgit/Orchard,alejandroaldana/Orchard,arminkarimi/Orchard,tobydodds/folklife,mgrowan/Orchard,mgrowan/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,dmitry-urenev/extended-orchard-cms-v10.1,vard0/orchard.tan,qt1/orchard4ibn,gcsuk/Orchard,Anton-Am/Orchard,planetClaire/Orchard-LETS,jersiovic/Orchard,arminkarimi/Orchard,jersiovic/Orchard,Anton-Am/Orchard,Cphusion/Orchard,yersans/Orchard,rtpHarry/Orchard,jchenga/Orchard,dcinzona/Orchard-Harvest-Website,neTp9c/Orchard,sebastienros/msc,asabbott/chicagodevnet-website,ehe888/Orchard,gcsuk/Orchard,armanforghani/Orchard,xkproject/Orchard,Morgma/valleyviewknolls,Praggie/Orchard,aaronamm/Orchard,yonglehou/Orchard,dcinzona/Orchard,SeyDutch/Airbrush,Inner89/Orchard,luchaoshuai/Orchard,SzymonSel/Orchard,AdvantageCS/Orchard,dcinzona/Orchard-Harvest-Website,brownjordaninternational/OrchardCMS,SzymonSel/Orchard,dburriss/Orchard,MpDzik/Orchard,Dolphinsimon/Orchard,KeithRaven/Orchard,bedegaming-aleksej/Orchard,ericschultz/outercurve-orchard,omidnasri/Orchard,neTp9c/Orchard,Codinlab/Orchard,bigfont/orchard-cms-modules-and-themes,xiaobudian/Orchard,jagraz/Orchard,AEdmunds/beautiful-springtime,MpDzik/Orchard,yonglehou/Orchard,Sylapse/Orchard.HttpAuthSample,TalaveraTechnologySolutions/Orchard,omidnasri/Orchard,dozoft/Orchard,TaiAivaras/Orchard,dcinzona/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Serlead/Orchard,fortunearterial/Orchard,mvarblow/Orchard,omidnasri/Orchard,fassetar/Orchard,dcinzona/Orchard-Harvest-Website,Serlead/Orchard,brownjordaninternational/OrchardCMS,SouleDesigns/SouleDesigns.Orchard,Praggie/Orchard,grapto/Orchard.CloudBust,hannan-azam/Orchard,patricmutwiri/Orchard,NIKASoftwareDevs/Orchard,Codinlab/Orchard,angelapper/Orchard,ericschultz/outercurve-orchard,omidnasri/Orchard,SeyDutch/Airbrush,planetClaire/Orchard-LETS,qt1/Orchard,jagraz/Orchard,austinsc/Orchard,KeithRaven/Orchard,JRKelso/Orchard,fortunearterial/Orchard,dburriss/Orchard,MetSystem/Orchard,SzymonSel/Orchard,RoyalVeterinaryCollege/Orchard,Fogolan/OrchardForWork,luchaoshuai/Orchard,xkproject/Orchard,AndreVolksdorf/Orchard,Fogolan/OrchardForWork,johnnyqian/Orchard,salarvand/orchard,m2cms/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,sfmskywalker/Orchard,yersans/Orchard,ericschultz/outercurve-orchard,Lombiq/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,dmitry-urenev/extended-orchard-cms-v10.1,Codinlab/Orchard,rtpHarry/Orchard,DonnotRain/Orchard,kouweizhong/Orchard,fassetar/Orchard,TalaveraTechnologySolutions/Orchard,Ermesx/Orchard,emretiryaki/Orchard,Anton-Am/Orchard,AEdmunds/beautiful-springtime,smartnet-developers/Orchard,li0803/Orchard,Dolphinsimon/Orchard,fortunearterial/Orchard,qt1/orchard4ibn,SeyDutch/Airbrush,NIKASoftwareDevs/Orchard,huoxudong125/Orchard,abhishekluv/Orchard,marcoaoteixeira/Orchard,oxwanawxo/Orchard,oxwanawxo/Orchard,Morgma/valleyviewknolls,salarvand/Portal,sfmskywalker/Orchard,hhland/Orchard,hannan-azam/Orchard,yersans/Orchard,TalaveraTechnologySolutions/Orchard,aaronamm/Orchard,arminkarimi/Orchard,OrchardCMS/Orchard,spraiin/Orchard,dozoft/Orchard,smartnet-developers/Orchard,infofromca/Orchard,hbulzy/Orchard,Ermesx/Orchard,AdvantageCS/Orchard,ericschultz/outercurve-orchard,phillipsj/Orchard,omidnasri/Orchard,DonnotRain/Orchard,infofromca/Orchard,escofieldnaxos/Orchard,huoxudong125/Orchard,qt1/Orchard,Lombiq/Orchard,bedegaming-aleksej/Orchard,planetClaire/Orchard-LETS,oxwanawxo/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,escofieldnaxos/Orchard,Fogolan/OrchardForWork,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,phillipsj/Orchard,bigfont/orchard-cms-modules-and-themes,jerryshi2007/Orchard,JRKelso/Orchard,alejandroaldana/Orchard,Lombiq/Orchard,hbulzy/Orchard,qt1/orchard4ibn,bigfont/orchard-continuous-integration-demo,enspiral-dev-academy/Orchard,neTp9c/Orchard,SeyDutch/Airbrush,vard0/orchard.tan,OrchardCMS/Orchard,caoxk/orchard,KeithRaven/Orchard,cooclsee/Orchard,angelapper/Orchard,MpDzik/Orchard,escofieldnaxos/Orchard,yersans/Orchard,dburriss/Orchard,huoxudong125/Orchard,vairam-svs/Orchard,jaraco/orchard,rtpHarry/Orchard,armanforghani/Orchard,fassetar/Orchard,qt1/Orchard,jimasp/Orchard,Fogolan/OrchardForWork,TalaveraTechnologySolutions/Orchard,andyshao/Orchard
|
src/Orchard.Web/Modules/Orchard.Setup/Views/Setup/Index.cshtml
|
src/Orchard.Web/Modules/Orchard.Setup/Views/Setup/Index.cshtml
|
@model Orchard.Setup.ViewModels.SetupViewModel
<h1>@Html.TitleForPage(T("Get Started").ToString())</h1>
@using (Html.BeginFormAntiForgeryPost()) {
Html.ValidationSummary();
<h2>@T("Please answer a few questions to configure your site.")</h2>
<fieldset class="site">
<div>
<label for="SiteName">@T("What is the name of your site?")</label>
@Html.TextBoxFor(svm => svm.SiteName, new { autofocus = "autofocus" })
</div>
<div>
<label for="AdminUsername">@T("Choose a user name:")</label>
@Html.EditorFor(svm => svm.AdminUsername)
</div>
<div>
<label for="AdminPassword">@T("Choose a password:")</label>
@Html.PasswordFor(svm => svm.AdminPassword)
</div>
<div>
<label for="ConfirmAdminPassword">@T("Confirm the password:")</label>
@Html.PasswordFor(svm => svm.ConfirmPassword)
</div>
</fieldset>
if (!Model.DatabaseIsPreconfigured) {
<fieldset class="data">
<legend>@T("How would you like to store your data?")</legend>
@Html.ValidationMessage("DatabaseOptions", "Unable to setup data storage")
<div>
@Html.RadioButtonFor(svm => svm.DatabaseOptions, true, new { id = "builtin" })
<label for="builtin" class="forcheckbox">@T("Use built-in data storage (SQL Server Compact)")</label>
</div>
<div>
@Html.RadioButtonFor(svm => svm.DatabaseOptions, false, new { id = "sql" })
<label for="sql" class="forcheckbox">@T("Use an existing SQL Server (or SQL Express) database")</label>
<div data-controllerid="sql">
<label for="DatabaseConnectionString">@T("Connection string")</label>
@Html.EditorFor(svm => svm.DatabaseConnectionString)
<span class="hint">
@T("Example:")<br />@T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password")
</span>
</div>
<div data-controllerid="sql">
<label for="DatabaseTablePrefix">@T("Database Table Prefix")</label>
@Html.EditorFor(svm => svm.DatabaseTablePrefix)
</div>
</div>
</fieldset>
}
<fieldset>
<input class="button primaryAction" type="submit" value="@T("Finish Setup")" />
</fieldset>
}
|
@model Orchard.Setup.ViewModels.SetupViewModel
@Html.Partial("~/Themes/Classic/Theme.txt2")
<h1>@Html.TitleForPage(T("Get Started").ToString())</h1>
@using (Html.BeginFormAntiForgeryPost()) {
Html.ValidationSummary();
<h2>@T("Please answer a few questions to configure your site.")</h2>
<fieldset class="site">
<div>
<label for="SiteName">@T("What is the name of your site?")</label>
@Html.TextBoxFor(svm => svm.SiteName, new { autofocus = "autofocus" })
</div>
<div>
<label for="AdminUsername">@T("Choose a user name:")</label>
@Html.EditorFor(svm => svm.AdminUsername)
</div>
<div>
<label for="AdminPassword">@T("Choose a password:")</label>
@Html.PasswordFor(svm => svm.AdminPassword)
</div>
<div>
<label for="ConfirmAdminPassword">@T("Confirm the password:")</label>
@Html.PasswordFor(svm => svm.ConfirmPassword)
</div>
</fieldset>
if (!Model.DatabaseIsPreconfigured) {
<fieldset class="data">
<legend>@T("How would you like to store your data?")</legend>
@Html.ValidationMessage("DatabaseOptions", "Unable to setup data storage")
<div>
@Html.RadioButtonFor(svm => svm.DatabaseOptions, true, new { id = "builtin" })
<label for="builtin" class="forcheckbox">@T("Use built-in data storage (SQL Server Compact)")</label>
</div>
<div>
@Html.RadioButtonFor(svm => svm.DatabaseOptions, false, new { id = "sql" })
<label for="sql" class="forcheckbox">@T("Use an existing SQL Server (or SQL Express) database")</label>
<div data-controllerid="sql">
<label for="DatabaseConnectionString">@T("Connection string")</label>
@Html.EditorFor(svm => svm.DatabaseConnectionString)
<span class="hint">
@T("Example:")<br />@T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password")
</span>
</div>
<div data-controllerid="sql">
<label for="DatabaseTablePrefix">@T("Database Table Prefix")</label>
@Html.EditorFor(svm => svm.DatabaseTablePrefix)
</div>
</div>
</fieldset>
}
<fieldset>
<input class="button primaryAction" type="submit" value="@T("Finish Setup")" />
</fieldset>
}
|
bsd-3-clause
|
C#
|
9eca32659c89468f2795a4e43f09cb414ab014eb
|
Adjust the name of the property that the data for a response goes into
|
paynecrl97/Glimpse,gabrielweyer/Glimpse,elkingtonmcb/Glimpse,SusanaL/Glimpse,dudzon/Glimpse,gabrielweyer/Glimpse,rho24/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,flcdrg/Glimpse,paynecrl97/Glimpse,codevlabs/Glimpse,rho24/Glimpse,dudzon/Glimpse,sorenhl/Glimpse,dudzon/Glimpse,codevlabs/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,elkingtonmcb/Glimpse,rho24/Glimpse,flcdrg/Glimpse,Glimpse/Glimpse,elkingtonmcb/Glimpse,sorenhl/Glimpse,SusanaL/Glimpse,sorenhl/Glimpse,Glimpse/Glimpse,SusanaL/Glimpse,Glimpse/Glimpse,codevlabs/Glimpse,gabrielweyer/Glimpse
|
source/Glimpse.Core2/SerializationConverter/GlimpseMetadataConverter.cs
|
source/Glimpse.Core2/SerializationConverter/GlimpseMetadataConverter.cs
|
using System.Collections.Generic;
using Glimpse.Core2.Extensibility;
using Glimpse.Core2.Framework;
namespace Glimpse.Core2.SerializationConverter
{
public class GlimpseMetadataConverter:SerializationConverter<GlimpseRequest>
{
public override IDictionary<string, object> Convert(GlimpseRequest request)
{
return new Dictionary<string, object>
{
{"clientId", request.ClientId},
{"dateTime", request.DateTime},
{"duration", request.Duration},
{"parentRequestId", request.ParentRequestId},
{"requestId", request.RequestId},
{"isAjax", request.RequestIsAjax},
{"method", request.RequestHttpMethod},
{"uri", request.RequestUri},
{"contentType", request.ResponseContentType},
{"statusCode", request.ResponseStatusCode},
{"data", request.PluginData},
{"userAgent", request.UserAgent}
};
}
}
}
|
using System.Collections.Generic;
using Glimpse.Core2.Extensibility;
using Glimpse.Core2.Framework;
namespace Glimpse.Core2.SerializationConverter
{
public class GlimpseMetadataConverter:SerializationConverter<GlimpseRequest>
{
public override IDictionary<string, object> Convert(GlimpseRequest request)
{
return new Dictionary<string, object>
{
{"clientId", request.ClientId},
{"dateTime", request.DateTime},
{"duration", request.Duration},
{"parentRequestId", request.ParentRequestId},
{"requestId", request.RequestId},
{"isAjax", request.RequestIsAjax},
{"method", request.RequestHttpMethod},
{"uri", request.RequestUri},
{"contentType", request.ResponseContentType},
{"statusCode", request.ResponseStatusCode},
{"plugins", request.PluginData},
{"userAgent", request.UserAgent}
};
}
}
}
|
apache-2.0
|
C#
|
ba1e5f34f3fd86d5d63ccae6202dfed1d78faef3
|
Mark IsCustomer and IsSupplier fields as readonly
|
XeroAPI/XeroAPI.Net,jcvandan/XeroAPI.Net,TDaphneB/XeroAPI.Net,MatthewSteeples/XeroAPI.Net
|
source/XeroApi/Model/Contact.cs
|
source/XeroApi/Model/Contact.cs
|
using System;
namespace XeroApi.Model
{
public class Contact : ModelBase
{
[ItemId]
public Guid ContactID { get; set; }
[ItemNumber]
public string ContactNumber { get; set; }
[ItemUpdatedDate]
public DateTime? UpdatedDateUTC { get; set; }
public string ContactStatus { get; set; }
public string Name { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string EmailAddress { get; set; }
public string SkypeUserName { get; set; }
public string BankAccountDetails { get; set; }
public string TaxNumber { get; set; }
public string AccountsReceivableTaxType { get; set; }
public string AccountsPayableTaxType { get; set; }
public Addresses Addresses { get; set; }
public Phones Phones { get; set; }
public ContactGroups ContactGroups { get; set; }
[ReadOnly]
public bool IsSupplier { get; set; }
[ReadOnly]
public bool IsCustomer { get; set; }
public string DefaultCurrency { get; set; }
}
public class Contacts : ModelList<Contact>
{
}
}
|
using System;
namespace XeroApi.Model
{
public class Contact : ModelBase
{
[ItemId]
public Guid ContactID { get; set; }
[ItemNumber]
public string ContactNumber { get; set; }
[ItemUpdatedDate]
public DateTime? UpdatedDateUTC { get; set; }
public string ContactStatus { get; set; }
public string Name { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string EmailAddress { get; set; }
public string SkypeUserName { get; set; }
public string BankAccountDetails { get; set; }
public string TaxNumber { get; set; }
public string AccountsReceivableTaxType { get; set; }
public string AccountsPayableTaxType { get; set; }
public Addresses Addresses { get; set; }
public Phones Phones { get; set; }
public ContactGroups ContactGroups { get; set; }
public bool IsSupplier { get; set; }
public bool IsCustomer { get; set; }
public string DefaultCurrency { get; set; }
}
public class Contacts : ModelList<Contact>
{
}
}
|
mit
|
C#
|
621e6d3808cfc551403975fa4b1b566fb343afc4
|
Handle possible Nullref in SentryStacktrace
|
xpicio/raven-csharp,getsentry/raven-csharp,webaction/raven-csharp,xpicio/raven-csharp,asbjornu/raven-csharp,getsentry/raven-csharp,getsentry/raven-csharp
|
SharpRaven/Data/SentryStacktrace.cs
|
SharpRaven/Data/SentryStacktrace.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using Newtonsoft.Json;
namespace SharpRaven.Data {
public class SentryStacktrace {
public SentryStacktrace(Exception e) {
StackTrace trace = new StackTrace(e, true);
Frames = trace.GetFrames().Reverse().Select(frame =>
{
int lineNo = frame.GetFileLineNumber();
if (lineNo == 0)
{
//The pdb files aren't currently available
lineNo = frame.GetILOffset();
}
var method = frame.GetMethod();
return new ExceptionFrame()
{
Filename = frame.GetFileName(),
Module = (method.DeclaringType != null) ? method.DeclaringType.FullName : null,
Function = method.Name,
Source = method.ToString(),
LineNumber = lineNo,
ColumnNumber = frame.GetFileColumnNumber()
};
}).ToList();
}
[JsonProperty(PropertyName = "frames")]
public List<ExceptionFrame> Frames;
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using Newtonsoft.Json;
namespace SharpRaven.Data {
public class SentryStacktrace {
public SentryStacktrace(Exception e) {
StackTrace trace = new StackTrace(e, true);
Frames = trace.GetFrames().Reverse().Select(frame =>
{
int lineNo = frame.GetFileLineNumber();
if (lineNo == 0)
{
//The pdb files aren't currently available
lineNo = frame.GetILOffset();
}
MethodBase method = frame.GetMethod();
return new ExceptionFrame()
{
Filename = frame.GetFileName(),
Module = method.DeclaringType == null ? "" : method.DeclaringType.FullName,
Function = method.Name,
Source = method.ToString(),
LineNumber = lineNo,
ColumnNumber = frame.GetFileColumnNumber()
};
}).ToList();
}
[JsonProperty(PropertyName = "frames")]
public List<ExceptionFrame> Frames;
}
}
|
bsd-3-clause
|
C#
|
fcb247b5cee31091df444eaa93161fdaa694d19e
|
Fix libvlc_event_detach delegate return type
|
ZeBobo5/Vlc.DotNet,jeremyVignelles/Vlc.DotNet
|
src/Vlc.DotNet.Core.Interops/Signatures/libvlc.h/libvlc_event_detach.cs
|
src/Vlc.DotNet.Core.Interops/Signatures/libvlc.h/libvlc_event_detach.cs
|
using System;
using System.Runtime.InteropServices;
namespace Vlc.DotNet.Core.Interops.Signatures
{
/// <summary>
/// Unregister an event notification.
/// </summary>
/// <param name="eventManagerInstance">Event manager to which you want to attach to.</param>
/// <param name="eventType">The desired event to which we want to listen.</param>
/// <param name="callback">The function to call when i_event_type occurs.</param>
/// <param name="userData">User provided data to carry with the event.</param>
[LibVlcFunction("libvlc_event_detach")]
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void DetachEvent(IntPtr eventManagerInstance, EventTypes eventType, EventCallback callback, IntPtr userData);
}
|
using System;
using System.Runtime.InteropServices;
namespace Vlc.DotNet.Core.Interops.Signatures
{
/// <summary>
/// Unregister an event notification.
/// </summary>
/// <param name="eventManagerInstance">Event manager to which you want to attach to.</param>
/// <param name="eventType">The desired event to which we want to listen.</param>
/// <param name="callback">The function to call when i_event_type occurs.</param>
/// <param name="userData">User provided data to carry with the event.</param>
/// <returns>Return 0 on success, ENOMEM on error.</returns>
[LibVlcFunction("libvlc_event_detach")]
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int DetachEvent(IntPtr eventManagerInstance, EventTypes eventType, EventCallback callback, IntPtr userData);
}
|
mit
|
C#
|
c17ab9b632be61e87c0394001524c763c2e2231d
|
Make Drawable inherit from Container: Fix for Winforms PixelLayoutHandler.
|
bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,l8s/Eto,l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto
|
Source/Eto.Platform.Windows/Forms/PixelLayoutHandler.cs
|
Source/Eto.Platform.Windows/Forms/PixelLayoutHandler.cs
|
using System;
using SD = System.Drawing;
using SWF = System.Windows.Forms;
using Eto.Forms;
using Eto.Drawing;
namespace Eto.Platform.Windows
{
public class PixelLayoutHandler : WindowsLayout<SWF.Control, PixelLayout>, IPixelLayout
{
public override SWF.Control Control {
get {
return Widget.Container != null ? (SWF.Control)Widget.Container.ControlObject : null;
}
protected set {
base.Control = value;
}
}
public override Size DesiredSize
{
get { return Control.PreferredSize.ToEto (); }
}
public void Add(Control child, int x, int y)
{
var control = Widget.Container.ControlObject as SWF.Control;
var scrollableControl = control as SWF.ScrollableControl;
SWF.Control ctl = child.GetContainerControl ();
SD.Point pt = new SD.Point(x, y);
if (scrollableControl != null) pt.Offset(scrollableControl.AutoScrollPosition);
ctl.Location = pt;
control.Controls.Add(ctl);
ctl.BringToFront();
}
public void Move(Control child, int x, int y)
{
SWF.ScrollableControl parent = Widget.Container.ControlObject as SWF.ScrollableControl;
SWF.Control ctl = child.GetContainerControl ();
SD.Point pt = new SD.Point(x, y);
if (parent != null) pt.Offset(parent.AutoScrollPosition);
ctl.Location = pt;
}
public void Remove (Control child)
{
var parent = Widget.Container.ControlObject as SWF.ScrollableControl;
var ctl = child.GetContainerControl ();
if (parent != null) parent.Controls.Remove(ctl);
}
}
}
|
using System;
using SD = System.Drawing;
using SWF = System.Windows.Forms;
using Eto.Forms;
using Eto.Drawing;
namespace Eto.Platform.Windows
{
public class PixelLayoutHandler : WindowsLayout<SWF.Control, PixelLayout>, IPixelLayout
{
public override SWF.Control Control {
get {
return Widget.Container != null ? (SWF.Control)Widget.Container.ControlObject : null;
}
protected set {
base.Control = value;
}
}
public override Size DesiredSize
{
get { return Control.PreferredSize.ToEto (); }
}
public void Add(Control child, int x, int y)
{
SWF.ScrollableControl parent = Widget.Container.ControlObject as SWF.ScrollableControl;
SWF.Control ctl = child.GetContainerControl ();
SD.Point pt = new SD.Point(x, y);
if (parent != null) pt.Offset(parent.AutoScrollPosition);
ctl.Location = pt;
parent.Controls.Add(ctl);
ctl.BringToFront();
}
public void Move(Control child, int x, int y)
{
SWF.ScrollableControl parent = Widget.Container.ControlObject as SWF.ScrollableControl;
SWF.Control ctl = child.GetContainerControl ();
SD.Point pt = new SD.Point(x, y);
if (parent != null) pt.Offset(parent.AutoScrollPosition);
ctl.Location = pt;
}
public void Remove (Control child)
{
var parent = Widget.Container.ControlObject as SWF.ScrollableControl;
var ctl = child.GetContainerControl ();
if (parent != null) parent.Controls.Remove(ctl);
}
}
}
|
bsd-3-clause
|
C#
|
5c890029e38bb49747dedfeaae56a3c5126f5c8f
|
Add comments
|
chrkon/helix-toolkit,helix-toolkit/helix-toolkit,JeremyAnsel/helix-toolkit,holance/helix-toolkit
|
Source/HelixToolkit.SharpDX.Assimp.Shared/Interfaces.cs
|
Source/HelixToolkit.SharpDX.Assimp.Shared/Interfaces.cs
|
using HelixToolkit.Logger;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX
#else
#if CORE
namespace HelixToolkit.SharpDX.Core
#else
namespace HelixToolkit.UWP
#endif
#endif
{
/// <summary>
/// Custom Texture loading IO interface.
/// </summary>
public interface ITextureIO
{
TextureModel Load(string modelPath, string texturePath, ILogger logger);
}
}
|
using HelixToolkit.Logger;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX
#else
#if CORE
namespace HelixToolkit.SharpDX.Core
#else
namespace HelixToolkit.UWP
#endif
#endif
{
public interface ITextureIO
{
TextureModel Load(string modelPath, string texturePath, ILogger logger);
}
}
|
mit
|
C#
|
2b64cba0ad10a68b2f21d21705fcd5d2937246c0
|
Rename class
|
mono-soc-2011/banshee,eeejay/banshee,ixfalia/banshee,directhex/banshee-hacks,stsundermann/banshee,lamalex/Banshee,petejohanson/banshee,dufoli/banshee,dufoli/banshee,eeejay/banshee,allquixotic/banshee-gst-sharp-work,stsundermann/banshee,stsundermann/banshee,petejohanson/banshee,lamalex/Banshee,directhex/banshee-hacks,babycaseny/banshee,arfbtwn/banshee,GNOME/banshee,directhex/banshee-hacks,mono-soc-2011/banshee,arfbtwn/banshee,dufoli/banshee,directhex/banshee-hacks,arfbtwn/banshee,ixfalia/banshee,Carbenium/banshee,eeejay/banshee,mono-soc-2011/banshee,arfbtwn/banshee,Dynalon/banshee-osx,Carbenium/banshee,GNOME/banshee,mono-soc-2011/banshee,petejohanson/banshee,babycaseny/banshee,babycaseny/banshee,ixfalia/banshee,Dynalon/banshee-osx,GNOME/banshee,Dynalon/banshee-osx,Carbenium/banshee,petejohanson/banshee,ixfalia/banshee,mono-soc-2011/banshee,babycaseny/banshee,Carbenium/banshee,allquixotic/banshee-gst-sharp-work,lamalex/Banshee,directhex/banshee-hacks,mono-soc-2011/banshee,Dynalon/banshee-osx,eeejay/banshee,ixfalia/banshee,lamalex/Banshee,stsundermann/banshee,Carbenium/banshee,babycaseny/banshee,stsundermann/banshee,Dynalon/banshee-osx,allquixotic/banshee-gst-sharp-work,arfbtwn/banshee,ixfalia/banshee,petejohanson/banshee,Carbenium/banshee,stsundermann/banshee,dufoli/banshee,dufoli/banshee,allquixotic/banshee-gst-sharp-work,ixfalia/banshee,dufoli/banshee,Dynalon/banshee-osx,mono-soc-2011/banshee,ixfalia/banshee,dufoli/banshee,lamalex/Banshee,eeejay/banshee,arfbtwn/banshee,GNOME/banshee,Dynalon/banshee-osx,babycaseny/banshee,Dynalon/banshee-osx,arfbtwn/banshee,dufoli/banshee,directhex/banshee-hacks,lamalex/Banshee,babycaseny/banshee,arfbtwn/banshee,stsundermann/banshee,allquixotic/banshee-gst-sharp-work,petejohanson/banshee,GNOME/banshee,allquixotic/banshee-gst-sharp-work,babycaseny/banshee,GNOME/banshee,GNOME/banshee,GNOME/banshee,stsundermann/banshee
|
src/Core/Nereid/Nereid/Entry.cs
|
src/Core/Nereid/Nereid/Entry.cs
|
//
// Entry.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2007 Novell, Inc.
//
// 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.
//
namespace Nereid
{
public class Client : Banshee.Gui.GtkBaseClient
{
public static void Main ()
{
Banshee.Gui.GtkBaseClient.Entry<Client> ();
}
private Gnome.Program program;
protected override void OnRegisterServices ()
{
program = new Gnome.Program ("Banshee", Banshee.ServiceStack.Application.Version,
Gnome.Modules.UI, System.Environment.GetCommandLineArgs ());
Banshee.ServiceStack.ServiceManager.RegisterService <PlayerInterface> ();
}
public override void Run ()
{
int test_jobs_count = 0;
RunTimeout (10000, delegate { new Banshee.ServiceStack.TestUserJob (); return test_jobs_count++ < 4; });
program.Run ();
}
}
}
|
//
// Entry.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2007 Novell, Inc.
//
// 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.
//
namespace Nereid
{
public class NereidClient : Banshee.Gui.GtkBaseClient
{
public static void Main ()
{
Banshee.Gui.GtkBaseClient.Entry<NereidClient> ();
}
private Gnome.Program program;
protected override void OnRegisterServices ()
{
program = new Gnome.Program ("Banshee", Banshee.ServiceStack.Application.Version,
Gnome.Modules.UI, System.Environment.GetCommandLineArgs ());
Banshee.ServiceStack.ServiceManager.RegisterService <PlayerInterface> ();
}
public override void Run ()
{
int test_jobs_count = 0;
RunTimeout (10000, delegate { new Banshee.ServiceStack.TestUserJob (); return test_jobs_count++ < 4; });
program.Run ();
}
}
}
|
mit
|
C#
|
6c5115943706fc898acca66d51b2c066ffa68fa4
|
Initialize MassTransit logger with TopShelf during host startup
|
D3-LucaPiombino/MassTransit,jsmale/MassTransit
|
src/MassTransit.Host/Program.cs
|
src/MassTransit.Host/Program.cs
|
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Host
{
using System;
using System.IO;
using log4net.Config;
using Log4NetIntegration.Logging;
using Topshelf;
using Topshelf.Logging;
class Program
{
static int Main()
{
SetupLogger();
return (int)HostFactory.Run(x =>
{
var configurator = new MassTransitHostConfigurator<MassTransitHostServiceBootstrapper>
{
Description = "MassTransit Host - A service host for MassTransit endpoints",
DisplayName = "MassTransit Host",
ServiceName = "MassTransitHost"
};
configurator.Configure(x);
});
}
static void SetupLogger()
{
var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MassTransit.Host.log4net.config"));
if (configFile.Exists)
XmlConfigurator.ConfigureAndWatch(configFile);
Log4NetLogWriterFactory.Use();
Log4NetLogger.Use();
}
}
}
|
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Host
{
using System;
using System.IO;
using log4net.Config;
using Topshelf;
using Topshelf.Logging;
class Program
{
static int Main()
{
SetupLogger();
return (int)HostFactory.Run(x =>
{
var configurator = new MassTransitHostConfigurator<MassTransitHostServiceBootstrapper>
{
Description = "MassTransit Host - A service host for MassTransit endpoints",
DisplayName = "MassTransit Host",
ServiceName = "MassTransitHost"
};
configurator.Configure(x);
});
}
static void SetupLogger()
{
var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MassTransit.Host.log4net.config"));
if (configFile.Exists)
XmlConfigurator.ConfigureAndWatch(configFile);
Log4NetLogWriterFactory.Use();
}
}
}
|
apache-2.0
|
C#
|
42f2e179f60f5248f37a65f2a3c3ffd928cb5839
|
Use hash set to assert should fire
|
Codestellation/Pulsar
|
src/Pulsar/Cron/CronCalendar.cs
|
src/Pulsar/Cron/CronCalendar.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Codestellation.Pulsar.Cron
{
public class CronCalendar
{
private readonly List<DateTime> _days;
private readonly HashSet<DateTime> _dayIndex;
public CronCalendar(IEnumerable<DateTime> scheduledDays)
{
_days = scheduledDays.ToList();
_days.Sort();
_dayIndex = new HashSet<DateTime>(_days);
}
public IEnumerable<DateTime> ScheduledDays
{
get { return _days; }
}
public IEnumerable<DateTime> DaysAfter(DateTime point)
{
var date = point.Date;
for (int dayIndex = 0; dayIndex < _days.Count; dayIndex++)
{
var candidate = _days[dayIndex];
if (date <= candidate)
{
yield return candidate;
}
}
}
public bool ShouldFire(DateTime date)
{
return _dayIndex.Contains(date);
}
public bool TryFindNextDay(DateTime date, out DateTime closest)
{
for (int dayIndex = 0; dayIndex < _days.Count; dayIndex++)
{
var candidate = _days[dayIndex];
if (date < candidate)
{
closest = candidate;
return true;
}
}
closest = DateTime.MinValue;
return false;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Codestellation.Pulsar.Cron
{
public class CronCalendar
{
private readonly List<DateTime> _days;
public CronCalendar(IEnumerable<DateTime> scheduledDays)
{
_days = scheduledDays.ToList();
_days.Sort();
}
public IEnumerable<DateTime> ScheduledDays
{
get { return _days; }
}
public IEnumerable<DateTime> DaysAfter(DateTime point)
{
var date = point.Date;
for (int dayIndex = 0; dayIndex < _days.Count; dayIndex++)
{
var candidate = _days[dayIndex];
if (date <= candidate)
{
yield return candidate;
}
}
}
public bool ShouldFire(DateTime date)
{
return _days.Contains(date);
}
public bool TryFindNextDay(DateTime date, out DateTime closest)
{
for (int dayIndex = 0; dayIndex < _days.Count; dayIndex++)
{
var candidate = _days[dayIndex];
if (date < candidate)
{
closest = candidate;
return true;
}
}
closest = DateTime.MinValue;
return false;
}
}
}
|
mit
|
C#
|
ac32b220cfd2ebe2cd73d440f09e4033d90bfd00
|
Add XML cmments
|
Green-Bug/nunit,agray/nunit,michal-franc/nunit,Therzok/nunit,mjedrzejek/nunit,ggeurts/nunit,ChrisMaddock/nunit,jnm2/nunit,danielmarbach/nunit,appel1/nunit,zmaruo/nunit,zmaruo/nunit,dicko2/nunit,Suremaker/nunit,OmicronPersei/nunit,ArsenShnurkov/nunit,JohanO/nunit,michal-franc/nunit,jnm2/nunit,ArsenShnurkov/nunit,JustinRChou/nunit,Therzok/nunit,passaro/nunit,acco32/nunit,jhamm/nunit,agray/nunit,nivanov1984/nunit,nunit/nunit,elbaloo/nunit,agray/nunit,elbaloo/nunit,pcalin/nunit,mikkelbu/nunit,JustinRChou/nunit,Suremaker/nunit,modulexcite/nunit,Green-Bug/nunit,NarohLoyahl/nunit,pcalin/nunit,pcalin/nunit,jeremymeng/nunit,nunit/nunit,jeremymeng/nunit,acco32/nunit,passaro/nunit,mikkelbu/nunit,dicko2/nunit,appel1/nunit,elbaloo/nunit,JohanO/nunit,NikolayPianikov/nunit,jhamm/nunit,modulexcite/nunit,jadarnel27/nunit,modulexcite/nunit,akoeplinger/nunit,jeremymeng/nunit,cPetru/nunit-params,passaro/nunit,ggeurts/nunit,ChrisMaddock/nunit,Green-Bug/nunit,NarohLoyahl/nunit,dicko2/nunit,pflugs30/nunit,pflugs30/nunit,cPetru/nunit-params,danielmarbach/nunit,danielmarbach/nunit,michal-franc/nunit,NarohLoyahl/nunit,JohanO/nunit,NikolayPianikov/nunit,zmaruo/nunit,jhamm/nunit,acco32/nunit,OmicronPersei/nunit,ArsenShnurkov/nunit,akoeplinger/nunit,mjedrzejek/nunit,akoeplinger/nunit,Therzok/nunit,jadarnel27/nunit,nivanov1984/nunit
|
src/framework/Constraints/ReusableConstraint.cs
|
src/framework/Constraints/ReusableConstraint.cs
|
using System;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// ReusableConstraint wraps a constraint expression after
/// resolving it so that it can be reused consistently.
/// </summary>
public class ReusableConstraint : IResolveConstraint
{
private Constraint constraint;
/// <summary>
/// Construct a ReusableConstraint from a constraint expression
/// </summary>
/// <param name="c">The expression to be resolved and reused</param>
public ReusableConstraint(IResolveConstraint c)
{
this.constraint = c.Resolve();
}
/// <summary>
/// Converts a constraint to a ReusableConstraint
/// </summary>
/// <param name="c">The constraint to be converted</param>
/// <returns>A ReusableConstraint</returns>
public static implicit operator ReusableConstraint(Constraint c)
{
return new ReusableConstraint(c);
}
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return constraint.ToString();
}
#region IResolveConstraint Members
/// <summary>
/// Return the top-level constraint for this expression
/// </summary>
/// <returns></returns>
public Constraint Resolve()
{
return constraint;
}
#endregion
}
}
|
using System;
namespace NUnit.Framework.Constraints
{
public class ReusableConstraint : IResolveConstraint
{
private Constraint constraint;
public ReusableConstraint(IResolveConstraint c)
{
this.constraint = c.Resolve();
}
public static implicit operator ReusableConstraint(Constraint c)
{
return new ReusableConstraint(c);
}
public override string ToString()
{
return constraint.ToString();
}
#region IResolveConstraint Members
public Constraint Resolve()
{
return constraint;
}
#endregion
}
}
|
mit
|
C#
|
b827ef74d5470776edadb89e25d6633d13ce3eeb
|
Fix test issue with ContactOwners test.
|
mtian/SiteExtensionGallery,mtian/SiteExtensionGallery,projectkudu/SiteExtensionGallery,ScottShingler/NuGetGallery,mtian/SiteExtensionGallery,skbkontur/NuGetGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,skbkontur/NuGetGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,skbkontur/NuGetGallery,projectkudu/SiteExtensionGallery,projectkudu/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch
|
tests/NuGetGallery.FunctionalTests/TestBase/Constants.cs
|
tests/NuGetGallery.FunctionalTests/TestBase/Constants.cs
|
using NuGetGallery.FunctionTests.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NuGetGallery.FunctionalTests
{
internal static class Constants
{
#region FormFields
internal const string ConfirmPasswordFormField = "ConfirmPassword";
internal const string EmailAddressFormField = "Register.EmailAddress";
internal const string RegisterPasswordFormField = "Register.Password";
internal const string PasswordFormField = "SignIn.Password";
internal const string ConfirmPasswordField = "ConfirmPassword";
internal const string UserNameFormField = "Register.Username";
internal const string UserNameOrEmailFormField = "SignIn.UserNameOrEmail";
internal const string AcceptTermsField = "AcceptTerms";
#endregion FormFields
#region PredefinedText
internal const string HomePageText = "What is NuGet?";
internal const string RegisterNewUserPendingConfirmationText = "Your account is now registered!";
internal const string UserAlreadyExistsText = "User already exists";
internal const string ReadOnlyModeRegisterNewUserText = "503 : Please try again later! (Read-only)";
internal const string SearchTerm = "elmah";
internal const string CreateNewAccountText = "Create A New Account";
internal const string StatsPageDefaultText = "Download statistics displayed on this page reflect the actual package downloads from the NuGet.org site";
internal const string ContactOwnersText = "Your message has been sent to the owners of";
internal const string UnListedPackageText = "This package is unlisted and hidden from package listings";
internal const string TestPackageId = "BaseTestPackage";
#endregion PredefinedText
}
}
|
using NuGetGallery.FunctionTests.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NuGetGallery.FunctionalTests
{
internal static class Constants
{
#region FormFields
internal const string ConfirmPasswordFormField = "ConfirmPassword";
internal const string EmailAddressFormField = "Register.EmailAddress";
internal const string RegisterPasswordFormField = "Register.Password";
internal const string PasswordFormField = "SignIn.Password";
internal const string ConfirmPasswordField = "ConfirmPassword";
internal const string UserNameFormField = "Register.Username";
internal const string UserNameOrEmailFormField = "SignIn.UserNameOrEmail";
internal const string AcceptTermsField = "AcceptTerms";
#endregion FormFields
#region PredefinedText
internal const string HomePageText = "What is NuGet?";
internal const string RegisterNewUserPendingConfirmationText = "Your account is now registered!";
internal const string UserAlreadyExistsText = "User already exists";
internal const string ReadOnlyModeRegisterNewUserText = "503 : Please try again later! (Read-only)";
internal const string SearchTerm = "elmah";
internal const string CreateNewAccountText = "Create A New Account";
internal const string StatsPageDefaultText = "Download statistics displayed on this page reflect the actual package downloads from the NuGet.org site";
internal const string ContactOwnersText = "Your message has been sent to the owners of ";
internal const string UnListedPackageText = "This package is unlisted and hidden from package listings";
internal const string TestPackageId = "BaseTestPackage";
#endregion PredefinedText
}
}
|
apache-2.0
|
C#
|
75f06783f9d49ff5bc33ce25fd15a8e72c397d49
|
Exclude boolean fields from IsRequired asterisk #2233
|
stevejgordon/allReady,mgmccarthy/allReady,mgmccarthy/allReady,c0g1t8/allReady,gitChuckD/allReady,dpaquette/allReady,dpaquette/allReady,binaryjanitor/allReady,BillWagner/allReady,c0g1t8/allReady,HTBox/allReady,binaryjanitor/allReady,HamidMosalla/allReady,gitChuckD/allReady,dpaquette/allReady,stevejgordon/allReady,HamidMosalla/allReady,gitChuckD/allReady,BillWagner/allReady,c0g1t8/allReady,HamidMosalla/allReady,HamidMosalla/allReady,stevejgordon/allReady,HTBox/allReady,BillWagner/allReady,BillWagner/allReady,HTBox/allReady,stevejgordon/allReady,dpaquette/allReady,MisterJames/allReady,gitChuckD/allReady,c0g1t8/allReady,MisterJames/allReady,HTBox/allReady,MisterJames/allReady,mgmccarthy/allReady,mgmccarthy/allReady,binaryjanitor/allReady,MisterJames/allReady,binaryjanitor/allReady
|
AllReadyApp/Web-App/AllReady/TagHelpers/LabelTagHelper.cs
|
AllReadyApp/Web-App/AllReady/TagHelpers/LabelTagHelper.cs
|
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.TagHelpers;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace AllReady.TagHelpers
{
[HtmlTargetElement("label", Attributes=ForAttributeName)]
public class LabelRequiredTagHelper: LabelTagHelper
{
private const string ForAttributeName = "asp-for";
public LabelRequiredTagHelper(IHtmlGenerator generator) : base(generator)
{
}
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
await base.ProcessAsync(context, output);
// Automatically mark required fields with an asterisk, except booleans
// because MVC always sets IsRequired to true for booleans.
if (For.Metadata.IsRequired && For.Metadata.ModelType.FullName != "System.Boolean")
{
var span = new TagBuilder("span");
span.AddCssClass("required");
span.InnerHtml.Append("*");
output.Content.AppendHtml(span);
}
}
}
}
|
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.TagHelpers;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace AllReady.TagHelpers
{
[HtmlTargetElement("label", Attributes=ForAttributeName)]
public class LabelRequiredTagHelper: LabelTagHelper
{
private const string ForAttributeName = "asp-for";
public LabelRequiredTagHelper(IHtmlGenerator generator) : base(generator)
{
}
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
await base.ProcessAsync(context, output);
if (For.Metadata.IsRequired)
{
var span = new TagBuilder("span");
span.AddCssClass("required");
span.InnerHtml.Append("*");
output.Content.AppendHtml(span);
}
}
}
}
|
mit
|
C#
|
e11c060adf1c4baa87021d0ff93cde7b3037a7e0
|
Tweak version behavior a bit
|
hexafluoride/Bifrost
|
Bifrost/Utilities.cs
|
Bifrost/Utilities.cs
|
using System;
using System.Threading;
using System.Reflection;
using System.Diagnostics;
using NLog;
namespace Bifrost
{
public class Utilities
{
private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Starts a new thread with the given delegate. Useful for not getting bottlenecked by ThreadPool.
/// </summary>
/// <param name="action">The delegate to execute.</param>
/// <returns>The created thread.</returns>
public static Thread StartThread(Action action)
{
Thread thr = new Thread(() => action());
thr.Start();
return thr;
}
/// <summary>
/// Logs the Bifrost version as patched by AppVeyor.
/// </summary>
public static void LogVersion()
{
string version = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;
// truncate git hash to 8 chars for readability
var parts = version.Split('-');
if (parts.Length > 1)
{
parts[parts.Length - 1] = parts[parts.Length - 1].Substring(0, 8);
version = string.Join("-", parts);
}
version = "\"" + version + "\"";
if (parts.Length <= 1)
version += " (unrecognized version, not an AppVeyor build)";
Log.Info("Bifrost version {0}", version);
}
}
}
|
using System;
using System.Threading;
using System.Reflection;
using System.Diagnostics;
using NLog;
namespace Bifrost
{
public class Utilities
{
private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Starts a new thread with the given delegate. Useful for not getting bottlenecked by ThreadPool.
/// </summary>
/// <param name="action">The delegate to execute.</param>
/// <returns>The created thread.</returns>
public static Thread StartThread(Action action)
{
Thread thr = new Thread(() => action());
thr.Start();
return thr;
}
/// <summary>
/// Logs the Bifrost version as patched by AppVeyor.
/// </summary>
public static void LogVersion()
{
string version = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;
Log.Info("Bifrost version {0}", version);
}
}
}
|
mit
|
C#
|
cbe36d24b0fe7b7e64e6a55b6291e09d6f22f990
|
Truncate extension id string if too long
|
SarahRogers/azure-powershell,yoavrubin/azure-powershell,ClogenyTechnologies/azure-powershell,krkhan/azure-powershell,yantang-msft/azure-powershell,akurmi/azure-powershell,hungmai-msft/azure-powershell,mayurid/azure-powershell,stankovski/azure-powershell,zhencui/azure-powershell,akurmi/azure-powershell,juvchan/azure-powershell,ankurchoubeymsft/azure-powershell,dominiqa/azure-powershell,zhencui/azure-powershell,chef-partners/azure-powershell,haocs/azure-powershell,juvchan/azure-powershell,devigned/azure-powershell,jtlibing/azure-powershell,krkhan/azure-powershell,jasper-schneider/azure-powershell,SarahRogers/azure-powershell,pomortaz/azure-powershell,AzureRT/azure-powershell,hovsepm/azure-powershell,hungmai-msft/azure-powershell,TaraMeyer/azure-powershell,jasper-schneider/azure-powershell,nemanja88/azure-powershell,alfantp/azure-powershell,ankurchoubeymsft/azure-powershell,nemanja88/azure-powershell,SarahRogers/azure-powershell,CamSoper/azure-powershell,seanbamsft/azure-powershell,chef-partners/azure-powershell,dulems/azure-powershell,atpham256/azure-powershell,hovsepm/azure-powershell,haocs/azure-powershell,zhencui/azure-powershell,DeepakRajendranMsft/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,naveedaz/azure-powershell,juvchan/azure-powershell,arcadiahlyy/azure-powershell,jtlibing/azure-powershell,zhencui/azure-powershell,hovsepm/azure-powershell,seanbamsft/azure-powershell,arcadiahlyy/azure-powershell,AzureAutomationTeam/azure-powershell,pomortaz/azure-powershell,arcadiahlyy/azure-powershell,nemanja88/azure-powershell,yantang-msft/azure-powershell,zhencui/azure-powershell,hovsepm/azure-powershell,hovsepm/azure-powershell,devigned/azure-powershell,chef-partners/azure-powershell,mayurid/azure-powershell,devigned/azure-powershell,krkhan/azure-powershell,dominiqa/azure-powershell,krkhan/azure-powershell,nemanja88/azure-powershell,alfantp/azure-powershell,arcadiahlyy/azure-powershell,devigned/azure-powershell,ankurchoubeymsft/azure-powershell,rohmano/azure-powershell,alfantp/azure-powershell,hungmai-msft/azure-powershell,DeepakRajendranMsft/azure-powershell,hungmai-msft/azure-powershell,dulems/azure-powershell,yantang-msft/azure-powershell,ankurchoubeymsft/azure-powershell,chef-partners/azure-powershell,atpham256/azure-powershell,pankajsn/azure-powershell,atpham256/azure-powershell,stankovski/azure-powershell,alfantp/azure-powershell,AzureAutomationTeam/azure-powershell,arcadiahlyy/azure-powershell,dominiqa/azure-powershell,AzureRT/azure-powershell,jasper-schneider/azure-powershell,jtlibing/azure-powershell,zhencui/azure-powershell,hungmai-msft/azure-powershell,dominiqa/azure-powershell,akurmi/azure-powershell,yoavrubin/azure-powershell,dulems/azure-powershell,pomortaz/azure-powershell,haocs/azure-powershell,Matt-Westphal/azure-powershell,yantang-msft/azure-powershell,naveedaz/azure-powershell,AzureRT/azure-powershell,yantang-msft/azure-powershell,atpham256/azure-powershell,shuagarw/azure-powershell,jasper-schneider/azure-powershell,mayurid/azure-powershell,nemanja88/azure-powershell,haocs/azure-powershell,AzureRT/azure-powershell,shuagarw/azure-powershell,akurmi/azure-powershell,AzureRT/azure-powershell,krkhan/azure-powershell,AzureRT/azure-powershell,DeepakRajendranMsft/azure-powershell,hungmai-msft/azure-powershell,mayurid/azure-powershell,dulems/azure-powershell,pomortaz/azure-powershell,yoavrubin/azure-powershell,atpham256/azure-powershell,pankajsn/azure-powershell,naveedaz/azure-powershell,seanbamsft/azure-powershell,juvchan/azure-powershell,rohmano/azure-powershell,dominiqa/azure-powershell,CamSoper/azure-powershell,Matt-Westphal/azure-powershell,Matt-Westphal/azure-powershell,pankajsn/azure-powershell,dulems/azure-powershell,SarahRogers/azure-powershell,devigned/azure-powershell,seanbamsft/azure-powershell,AzureAutomationTeam/azure-powershell,yoavrubin/azure-powershell,naveedaz/azure-powershell,akurmi/azure-powershell,shuagarw/azure-powershell,naveedaz/azure-powershell,rohmano/azure-powershell,seanbamsft/azure-powershell,DeepakRajendranMsft/azure-powershell,mayurid/azure-powershell,ClogenyTechnologies/azure-powershell,TaraMeyer/azure-powershell,pankajsn/azure-powershell,alfantp/azure-powershell,shuagarw/azure-powershell,stankovski/azure-powershell,TaraMeyer/azure-powershell,atpham256/azure-powershell,pankajsn/azure-powershell,DeepakRajendranMsft/azure-powershell,stankovski/azure-powershell,SarahRogers/azure-powershell,AzureAutomationTeam/azure-powershell,Matt-Westphal/azure-powershell,ClogenyTechnologies/azure-powershell,krkhan/azure-powershell,CamSoper/azure-powershell,AzureAutomationTeam/azure-powershell,pomortaz/azure-powershell,ankurchoubeymsft/azure-powershell,CamSoper/azure-powershell,TaraMeyer/azure-powershell,pankajsn/azure-powershell,shuagarw/azure-powershell,ClogenyTechnologies/azure-powershell,chef-partners/azure-powershell,rohmano/azure-powershell,rohmano/azure-powershell,yantang-msft/azure-powershell,rohmano/azure-powershell,TaraMeyer/azure-powershell,jtlibing/azure-powershell,haocs/azure-powershell,CamSoper/azure-powershell,yoavrubin/azure-powershell,jasper-schneider/azure-powershell,stankovski/azure-powershell,jtlibing/azure-powershell,seanbamsft/azure-powershell,naveedaz/azure-powershell,Matt-Westphal/azure-powershell,devigned/azure-powershell,juvchan/azure-powershell
|
src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionRole.cs
|
src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionRole.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 System;
using System.Text;
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions
{
public class ExtensionRole
{
protected const string DefaultExtensionIdPrefixStr = "Default";
protected const string ExtensionIdSuffixTemplate = "-{0}-{1}-Ext-{2}";
protected const int MaxExtensionIdLength = 64;
public string RoleName { get; private set; }
public string PrefixName { get; private set; }
public ExtensionRoleType RoleType { get; private set; }
public bool Default { get; private set; }
public ExtensionRole()
{
RoleName = string.Empty;
RoleType = ExtensionRoleType.AllRoles;
PrefixName = DefaultExtensionIdPrefixStr;
Default = true;
}
public ExtensionRole(string roleName)
{
if (string.IsNullOrWhiteSpace(roleName))
{
RoleName = string.Empty;
RoleType = ExtensionRoleType.AllRoles;
PrefixName = DefaultExtensionIdPrefixStr;
Default = true;
}
else
{
PrefixName = RoleName = roleName.Trim();
PrefixName = PrefixName.Replace(".", string.Empty);
RoleType = ExtensionRoleType.NamedRoles;
Default = false;
}
}
public override string ToString()
{
return PrefixName;
}
public string GetExtensionId(string extensionName, string slot, int index)
{
var normalizedExtName = extensionName.Replace(".", string.Empty);
var suffix = new StringBuilder();
suffix.AppendFormat(ExtensionIdSuffixTemplate, normalizedExtName, slot, index);
int prefixLength = Math.Min(Math.Max(MaxExtensionIdLength - suffix.Length, 0), RoleName.Length);
var result = new StringBuilder();
result.Append(RoleName, 0, prefixLength);
result.Append(suffix);
return result.ToString();
}
}
}
|
// ----------------------------------------------------------------------------------
//
// 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.
// ----------------------------------------------------------------------------------
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions
{
public class ExtensionRole
{
protected const string DefaultExtensionIdPrefixStr = "Default";
protected const string ExtensionIdTemplate = "{0}-{1}-{2}-Ext-{3}";
public string RoleName { get; private set; }
public string PrefixName { get; private set; }
public ExtensionRoleType RoleType { get; private set; }
public bool Default { get; private set; }
public ExtensionRole()
{
RoleName = string.Empty;
RoleType = ExtensionRoleType.AllRoles;
PrefixName = DefaultExtensionIdPrefixStr;
Default = true;
}
public ExtensionRole(string roleName)
{
if (string.IsNullOrWhiteSpace(roleName))
{
RoleName = string.Empty;
RoleType = ExtensionRoleType.AllRoles;
PrefixName = DefaultExtensionIdPrefixStr;
Default = true;
}
else
{
PrefixName = RoleName = roleName.Trim();
PrefixName = PrefixName.Replace(".", string.Empty);
RoleType = ExtensionRoleType.NamedRoles;
Default = false;
}
}
public override string ToString()
{
return PrefixName;
}
public string GetExtensionId(string extensionName, string slot, int index)
{
return string.Format(ExtensionIdTemplate, PrefixName, extensionName, slot, index);
}
}
}
|
apache-2.0
|
C#
|
dad426cb4584257c7dc202bfca0f8ad7116703ed
|
remove data annotation validation for the checkbox on the signup page of the TodoTemplate project #1962 (#1965)
|
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
|
src/Tooling/Bit.Tooling.Templates/TodoTemplate/Shared/Dtos/Account/SignUpRequestDto.cs
|
src/Tooling/Bit.Tooling.Templates/TodoTemplate/Shared/Dtos/Account/SignUpRequestDto.cs
|
namespace TodoTemplate.Shared.Dtos.Account;
public class SignUpRequestDto
{
[EmailAddress(ErrorMessage = "The email address format is incorrect.")]
public string? Email { get; set; }
[EmailAddress(ErrorMessage = "The email address format is incorrect.")]
[Required(ErrorMessage = "Please enter your username.")]
public string? UserName { get; set; }
public string? PhoneNumber { get; set; }
[Required(ErrorMessage = "Please enter your password.")]
[MinLength(6, ErrorMessage = "The password must have at least 6 characters.")]
public string? Password { get; set; }
[NotMapped]
public bool IsAcceptPrivacy { get; set; }
}
|
namespace TodoTemplate.Shared.Dtos.Account;
public class SignUpRequestDto
{
[EmailAddress(ErrorMessage = "The email address format is incorrect.")]
public string? Email { get; set; }
[EmailAddress(ErrorMessage = "The email address format is incorrect.")]
[Required(ErrorMessage = "Please enter your username.")]
public string? UserName { get; set; }
public string? PhoneNumber { get; set; }
[Required(ErrorMessage = "Please enter your password.")]
[MinLength(6, ErrorMessage = "The password must have at least 6 characters.")]
public string? Password { get; set; }
[NotMapped]
[Range(typeof(bool), "true", "true", ErrorMessage = "You must accept the privacy.")]
public bool IsAcceptPrivacy { get; set; }
}
|
mit
|
C#
|
6ea1489bf52f44c03a6a462cf9a4d8dafba47877
|
add debug here
|
YAFNET/YAFNET,Pathfinder-Fr/YAFNET,YAFNET/YAFNET,YAFNET/YAFNET,Pathfinder-Fr/YAFNET,YAFNET/YAFNET,Pathfinder-Fr/YAFNET
|
yafsrc/YetAnotherForum.NET/Classes/LatestInformationService.cs
|
yafsrc/YetAnotherForum.NET/Classes/LatestInformationService.cs
|
/* Yet Another Forum.NET
* Copyright (C) 2003-2005 Bjørnar Henden
* Copyright (C) 2006-2013 Jaben Cargman
* Copyright (C) 2014-2020 Ingo Herbote
* https://www.yetanotherforum.net/
*
* 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
* https://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace YAF.Classes
{
using System;
using System.Web;
using YAF.Core;
using YAF.RegisterV2;
#if DEBUG
using YAF.Types.Extensions;
#endif
using YAF.Types.Interfaces;
/// <summary>
/// LatestInformation service class
/// </summary>
public class LatestInformationService : IHaveServiceLocator
{
/// <summary>
/// Gets ServiceLocator.
/// </summary>
public IServiceLocator ServiceLocator => BoardContext.Current.ServiceLocator;
/// <summary>
/// Gets the latest version information.
/// </summary>
/// <returns>Returns the LatestVersionInformation</returns>
public byte[] GetLatestVersion()
{
if (this.Get<HttpApplicationStateBase>()["YafRegistrationLatestInformation"] is byte[]
latestInfo)
{
return latestInfo;
}
try
{
var reg = new RegisterV2 { Timeout = 30000 };
// load the latest version
latestInfo = reg.LatestVersion();
if (latestInfo != null)
{
this.Get<HttpApplicationStateBase>().Set("YafRegistrationLatestInformation", latestInfo);
}
}
#if DEBUG
catch (Exception x)
{
this.Get<ILogger>().Error(x, "Exception In LatestInformationService");
#else
catch (Exception)
{
#endif
return null;
}
return latestInfo;
}
}
}
|
/* Yet Another Forum.NET
* Copyright (C) 2003-2005 Bjørnar Henden
* Copyright (C) 2006-2013 Jaben Cargman
* Copyright (C) 2014-2020 Ingo Herbote
* https://www.yetanotherforum.net/
*
* 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
* https://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace YAF.Classes
{
using System;
using System.Web;
using YAF.Core;
using YAF.RegisterV2;
using YAF.Types.Extensions;
using YAF.Types.Interfaces;
/// <summary>
/// LatestInformation service class
/// </summary>
public class LatestInformationService : IHaveServiceLocator
{
/// <summary>
/// Gets ServiceLocator.
/// </summary>
public IServiceLocator ServiceLocator => BoardContext.Current.ServiceLocator;
/// <summary>
/// Gets the latest version information.
/// </summary>
/// <returns>Returns the LatestVersionInformation</returns>
public byte[] GetLatestVersion()
{
if (this.Get<HttpApplicationStateBase>()["YafRegistrationLatestInformation"] is byte[]
latestInfo)
{
return latestInfo;
}
try
{
var reg = new RegisterV2 { Timeout = 30000 };
// load the latest version
latestInfo = reg.LatestVersion();
if (latestInfo != null)
{
this.Get<HttpApplicationStateBase>().Set("YafRegistrationLatestInformation", latestInfo);
}
}
#if DEBUG
catch (Exception x)
{
this.Get<ILogger>().Error(x, "Exception In LatestInformationService");
#else
catch (Exception)
{
#endif
return null;
}
return latestInfo;
}
}
}
|
apache-2.0
|
C#
|
272221a0f789c02c823918102aefb3acf6ef084f
|
Correct FastMurmurHash
|
Draxent/CompressingWebPages
|
CompressingWebPages/FastMurmurHash.cs
|
CompressingWebPages/FastMurmurHash.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CompressingWebPages
{
class FastMurmurHash
{
const ulong m = 0xc6a4a7935bd1e995;
const int r = 47;
private uint seed;
public FastMurmurHash(uint seed)
{
this.seed = seed;
}
#region Hash
public ulong Hash(ulong key)
{
ulong h = this.seed ^ m;
key *= m;
key ^= key >> r;
key *= m;
h ^= key;
h *= m;
h ^= h >> r;
h *= m;
h ^= h >> r;
return h;
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CompressingWebPages
{
class FastMurmurHash
{
const ulong m = 0xc6a4a7935bd1e995;
const int r = 47;
private uint seed;
public FastMurmurHash(uint seed)
{
this.seed = seed;
}
public ulong Hash(ulong key)
{
byte[] data = new byte[8];
data[0] = (byte)key;
data[1] = (byte)(key >> 8);
data[2] = (byte)(key >> 16);
data[3] = (byte)(key >> 24);
data[4] = (byte)(key >> 32);
data[5] = (byte)(key >> 40);
data[6] = (byte)(key >> 48);
data[7] = (byte)(key >> 56);
ulong h = this.seed ^ 8;
ulong k = (ulong)(data[0] | data[1] << 8 | data[2] << 16 | data[3] << 32);
k *= m;
k ^= k >> r;
k *= m;
h ^= k;
h *= m;
h ^= h >> r;
h *= m;
h ^= h >> r;
return h;
}
}
}
|
mit
|
C#
|
3446c22262f98660e0dc15a109f94c98dae5d93f
|
Update IDeveloperPageExceptionFilter doc comment (#38659)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Middleware/Diagnostics.Abstractions/src/IDeveloperPageExceptionFilter.cs
|
src/Middleware/Diagnostics.Abstractions/src/IDeveloperPageExceptionFilter.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Diagnostics;
// FIXME: A link is needed for the reference but adding it breaks Intellisense (see pull/38659)
/// <summary>
/// Provides an extensibility point for changing the behavior of the DeveloperExceptionPageMiddleware.
/// </summary>
public interface IDeveloperPageExceptionFilter
{
/// <summary>
/// An exception handling method that is used to either format the exception or delegate to the next handler in the chain.
/// </summary>
/// <param name="errorContext">The error context.</param>
/// <param name="next">The next filter in the pipeline.</param>
/// <returns>A task the completes when the handler is done executing.</returns>
Task HandleExceptionAsync(ErrorContext errorContext, Func<ErrorContext, Task> next);
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Diagnostics;
/// <summary>
/// Provides an extensiblity point for changing the behavior of the DeveloperExceptionPageMiddleware.
/// </summary>
public interface IDeveloperPageExceptionFilter
{
/// <summary>
/// An exception handling method that is used to either format the exception or delegate to the next handler in the chain.
/// </summary>
/// <param name="errorContext">The error context.</param>
/// <param name="next">The next filter in the pipeline.</param>
/// <returns>A task the completes when the handler is done executing.</returns>
Task HandleExceptionAsync(ErrorContext errorContext, Func<ErrorContext, Task> next);
}
|
apache-2.0
|
C#
|
be8323f8e314362671fd4107f2c180d4207b8546
|
update version
|
agileharbor/shipStationAccess
|
src/Global/GlobalAssemblyInfo.cs
|
src/Global/GlobalAssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[ assembly : ComVisible( false ) ]
[ assembly : AssemblyProduct( "ShipStationAccess" ) ]
[ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ]
[ assembly : AssemblyCopyright( "Copyright (C) Agile Harbor, LLC" ) ]
[ assembly : AssemblyDescription( "ShipStation webservices API wrapper." ) ]
[ assembly : AssemblyTrademark( "" ) ]
[ assembly : AssemblyCulture( "" ) ]
[ assembly : CLSCompliant( false ) ]
// 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.*")]
// Keep in track with CA API version
[ assembly : AssemblyVersion( "1.3.70.0" ) ]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[ assembly : ComVisible( false ) ]
[ assembly : AssemblyProduct( "ShipStationAccess" ) ]
[ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ]
[ assembly : AssemblyCopyright( "Copyright (C) Agile Harbor, LLC" ) ]
[ assembly : AssemblyDescription( "ShipStation webservices API wrapper." ) ]
[ assembly : AssemblyTrademark( "" ) ]
[ assembly : AssemblyCulture( "" ) ]
[ assembly : CLSCompliant( false ) ]
// 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.*")]
// Keep in track with CA API version
[ assembly : AssemblyVersion( "1.3.69.0" ) ]
|
bsd-3-clause
|
C#
|
c8d0af004327ea9b1f65f5795b62c7428c4a09d9
|
build 7.1.36.0
|
agileharbor/channelAdvisorAccess
|
src/Global/GlobalAssemblyInfo.cs
|
src/Global/GlobalAssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[ assembly : ComVisible( false ) ]
[ assembly : AssemblyProduct( "ChannelAdvisorAccess" ) ]
[ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ]
[ assembly : AssemblyCopyright( "Copyright (C) Agile Harbor, LLC" ) ]
[ assembly : AssemblyDescription( "ChannelAdvisor webservices API wrapper." ) ]
[ assembly : AssemblyTrademark( "" ) ]
[ assembly : AssemblyCulture( "" ) ]
[ assembly : CLSCompliant( false ) ]
// 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.*")]
// Keep in track with CA API version
[ assembly : AssemblyVersion( "7.1.36.0" ) ]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[ assembly : ComVisible( false ) ]
[ assembly : AssemblyProduct( "ChannelAdvisorAccess" ) ]
[ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ]
[ assembly : AssemblyCopyright( "Copyright (C) Agile Harbor, LLC" ) ]
[ assembly : AssemblyDescription( "ChannelAdvisor webservices API wrapper." ) ]
[ assembly : AssemblyTrademark( "" ) ]
[ assembly : AssemblyCulture( "" ) ]
[ assembly : CLSCompliant( false ) ]
// 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.*")]
// Keep in track with CA API version
[ assembly : AssemblyVersion( "7.1.35.0" ) ]
|
bsd-3-clause
|
C#
|
6bce6ce44d252e15149c387ca3a8b008606d685a
|
Move helper to workspace layer
|
physhi/roslyn,diryboy/roslyn,wvdd007/roslyn,brettfo/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,ErikSchierboom/roslyn,AmadeusW/roslyn,physhi/roslyn,stephentoub/roslyn,dotnet/roslyn,tmat/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,jasonmalinowski/roslyn,aelij/roslyn,eriawan/roslyn,panopticoncentral/roslyn,tmat/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,gafter/roslyn,panopticoncentral/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,davkean/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,dotnet/roslyn,weltkante/roslyn,brettfo/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,gafter/roslyn,AlekseyTs/roslyn,genlu/roslyn,KirillOsenkov/roslyn,tannergooding/roslyn,AmadeusW/roslyn,dotnet/roslyn,tannergooding/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,KevinRansom/roslyn,diryboy/roslyn,heejaechang/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,sharwell/roslyn,brettfo/roslyn,reaction1989/roslyn,aelij/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,sharwell/roslyn,sharwell/roslyn,mavasani/roslyn,tannergooding/roslyn,AmadeusW/roslyn,eriawan/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,genlu/roslyn,weltkante/roslyn,jmarolf/roslyn,weltkante/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,gafter/roslyn,reaction1989/roslyn,eriawan/roslyn,davkean/roslyn,physhi/roslyn,genlu/roslyn,ErikSchierboom/roslyn,davkean/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,mavasani/roslyn,reaction1989/roslyn,tmat/roslyn
|
src/Features/Core/Portable/FindUsages/ExternalReferenceItem.cs
|
src/Features/Core/Portable/FindUsages/ExternalReferenceItem.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CodeAnalysis.FindUsages
{
/// <summary>
/// Information about a symbol's reference that can be used for display and navigation in an
/// editor. These generally reference items outside of the Roslyn <see cref="Solution"/> model
/// provided by external sources (for example: RichNav).
/// </summary>
internal abstract class ExternalReferenceItem
{
/// <summary>
/// The definition this reference corresponds to.
/// </summary>
public DefinitionItem Definition { get; }
public ExternalReferenceItem(
DefinitionItem definition,
string projectName,
object text,
string displayPath)
{
Definition = definition;
ProjectName = projectName;
Text = text;
DisplayPath = displayPath;
}
public string ProjectName { get; }
/// <remarks>
/// Must be of type Microsoft.VisualStudio.Text.Adornments.ImageElement or
/// Microsoft.VisualStudio.Text.Adornments.ContainerElement or
/// Microsoft.VisualStudio.Text.Adornments.ClassifiedTextElement or System.String
/// </remarks>
public object Text { get; }
public string DisplayPath { get; }
public abstract bool TryNavigateTo(Workspace workspace, bool isPreview);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CodeAnalysis.FindUsages
{
/// <summary>
/// Information about a symbol's reference that can be used for display and navigation in an
/// editor. These generally reference items outside of the Roslyn <see cref="Solution"/> model
/// provided by external sources (for example: RichNav).
/// </summary>
internal abstract class ExternalReferenceItem
{
/// <summary>
/// The definition this reference corresponds to.
/// </summary>
public DefinitionItem Definition { get; }
public ExternalReferenceItem(
DefinitionItem definition,
string documentName,
object text,
string displayPath)
{
Definition = definition;
DocumentName = documentName;
Text = text;
DisplayPath = displayPath;
}
public string ProjectName { get; }
/// <remarks>
/// Must be of type Microsoft.VisualStudio.Text.Adornments.ImageElement or
/// Microsoft.VisualStudio.Text.Adornments.ContainerElement or
/// Microsoft.VisualStudio.Text.Adornments.ClassifiedTextElement or System.String
/// </remarks>
public object Text { get; }
public string DisplayPath { get; }
public abstract bool TryNavigateTo(Workspace workspace, bool isPreview);
}
}
|
mit
|
C#
|
7f1d2bbf3c1f3665cc9debda2f4024db124da230
|
implement donation generation
|
GiveCampUK/GiveCRM,GiveCampUK/GiveCRM
|
src/GiveCRM.DummyDataGenerator/Generation/DonationGenerator.cs
|
src/GiveCRM.DummyDataGenerator/Generation/DonationGenerator.cs
|
using System;
using System.Collections.Generic;
using GiveCRM.DataAccess;
using GiveCRM.Models;
using System.Linq;
namespace GiveCRM.DummyDataGenerator.Generation
{
internal class DonationGenerator
{
private readonly RandomSource random = new RandomSource();
private readonly Action<string> logAction;
private readonly IEnumerable<Campaign> campaigns;
private readonly int donationRate;
public DonationGenerator(Action<string> logAction, IEnumerable<Campaign> campaigns)
{
this.logAction = logAction;
this.campaigns = campaigns;
// donation rate is set somewhere between 1/3 and 2/3
donationRate = 33 + random.NextInt(33);
}
internal void Generate()
{
logAction("Generating donations...");
// only want to generate donations for committed campaigns
var committedCampaigns = campaigns.Where(c => c.IsCommitted).ToList();
var members = new Members();
var donations = new Donations();
foreach (var campaign in committedCampaigns)
{
var membersForCampaign = members.GetByCampaignId(campaign.Id);
foreach (var member in membersForCampaign)
{
GenerateCampaignDonationsForMember(donations, campaign, member);
}
}
logAction("Donations generated successfully");
}
private void GenerateCampaignDonationsForMember(Donations donationsRepo, Campaign campaign, Member member)
{
int numberOfDonations = random.NextInt(0, 3);
for (int i = 0; i < numberOfDonations; i++)
{
// don't generate donations each time to simulate a miss
if (this.random.Percent(donationRate))
{
var amount = GenerateAmount();
var donation = new Donation
{
CampaignId = campaign.Id,
MemberId = member.Id,
Amount = amount,
Date = random.NextDateTime(),
};
donationsRepo.Insert(donation);
}
}
}
private decimal GenerateAmount()
{
int poundsAmount = random.NextInt(100);
int penceAmount = 0;
// high chance that there is no fractional amount
if (!random.Percent(75))
{
// chance that it's a quarter, half or three quarters
if (random.Percent(50))
{
penceAmount = random.NextInt(4) / 4;
}
else
{
// random from .01 to 0.99
penceAmount = random.NextInt(100) / 100;
}
}
int totalAmount = (poundsAmount * 100) + penceAmount;
return new Decimal(totalAmount, 0, 0, false, 2);
}
}
}
|
using System;
namespace GiveCRM.DummyDataGenerator.Generation
{
internal class DonationGenerator : BaseGenerator
{
private readonly RandomSource random = new RandomSource();
public DonationGenerator(Action<string> logAction) : base(logAction)
{}
internal override string GeneratedItemType{get {return "donations";}}
internal override void Generate(int numberToGenerate)
{
}
}
}
|
mit
|
C#
|
45c2e9c7c912e1ab345720b5873b4ef4643c3d92
|
Make MySqlError.Code obsolete. Fixes #1011
|
mysql-net/MySqlConnector,mysql-net/MySqlConnector
|
src/MySqlConnector/MySqlError.cs
|
src/MySqlConnector/MySqlError.cs
|
using System;
namespace MySqlConnector
{
/// <summary>
/// <see cref="MySqlError"/> represents an error or warning that occurred during the execution of a SQL statement.
/// </summary>
public sealed class MySqlError
{
internal MySqlError(string level, int code, string message)
{
Level = level;
#pragma warning disable 618
Code = code;
#pragma warning restore
ErrorCode = (MySqlErrorCode) code;
Message = message;
}
/// <summary>
/// The error level. This comes from the MySQL Server. Possible values include <c>Note</c>, <c>Warning</c>, and <c>Error</c>.
/// </summary>
public string Level { get; }
/// <summary>
/// The numeric error code. Prefer to use <see cref="ErrorCode"/>.
/// </summary>
[Obsolete("Use ErrorCode")]
public int Code { get; }
/// <summary>
/// The <see cref="MySqlErrorCode"/> for the error or warning.
/// </summary>
public MySqlErrorCode ErrorCode { get; }
/// <summary>
/// A human-readable description of the error or warning.
/// </summary>
public string Message { get; }
};
}
|
namespace MySqlConnector
{
/// <summary>
/// <see cref="MySqlError"/> represents an error or warning that occurred during the execution of a SQL statement.
/// </summary>
public sealed class MySqlError
{
internal MySqlError(string level, int code, string message)
{
Level = level;
Code = code;
ErrorCode = (MySqlErrorCode) code;
Message = message;
}
/// <summary>
/// The error level. This comes from the MySQL Server. Possible values include <c>Note</c>, <c>Warning</c>, and <c>Error</c>.
/// </summary>
public string Level { get; }
/// <summary>
/// The numeric error code. Prefer to use <see cref="ErrorCode"/>.
/// </summary>
public int Code { get; }
/// <summary>
/// The <see cref="MySqlErrorCode"/> for the error or warning.
/// </summary>
public MySqlErrorCode ErrorCode { get; }
/// <summary>
/// A human-readable description of the error or warning.
/// </summary>
public string Message { get; }
};
}
|
mit
|
C#
|
ec1bff419ec8edc92eec4b4e74bf527eee159be8
|
Set HttpSys read error log levels to debug #35490 (#35537)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Servers/HttpSys/src/RequestProcessing/RequestStream.Log.cs
|
src/Servers/HttpSys/src/RequestProcessing/RequestStream.Log.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.HttpSys
{
internal partial class RequestStream
{
private static class Log
{
private static readonly Action<ILogger, Exception?> _errorWhenReadAsync =
LoggerMessage.Define(LogLevel.Debug, LoggerEventIds.ErrorWhenReadAsync, "ReadAsync");
private static readonly Action<ILogger, Exception?> _errorWhenReadBegun =
LoggerMessage.Define(LogLevel.Debug, LoggerEventIds.ErrorWhenReadBegun, "BeginRead");
private static readonly Action<ILogger, Exception?> _errorWhileRead =
LoggerMessage.Define(LogLevel.Debug, LoggerEventIds.ErrorWhileRead, "Read");
public static void ErrorWhenReadAsync(ILogger logger, Exception exception)
{
_errorWhenReadAsync(logger, exception);
}
public static void ErrorWhenReadBegun(ILogger logger, Exception exception)
{
_errorWhenReadBegun(logger, exception);
}
public static void ErrorWhileRead(ILogger logger, Exception exception)
{
_errorWhileRead(logger, exception);
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.HttpSys
{
internal partial class RequestStream
{
private static class Log
{
private static readonly Action<ILogger, Exception?> _errorWhenReadAsync =
LoggerMessage.Define(LogLevel.Error, LoggerEventIds.ErrorWhenReadAsync, "ReadAsync");
private static readonly Action<ILogger, Exception?> _errorWhenReadBegun =
LoggerMessage.Define(LogLevel.Error, LoggerEventIds.ErrorWhenReadBegun, "BeginRead");
private static readonly Action<ILogger, Exception?> _errorWhileRead =
LoggerMessage.Define(LogLevel.Error, LoggerEventIds.ErrorWhileRead, "Read");
public static void ErrorWhenReadAsync(ILogger logger, Exception exception)
{
_errorWhenReadAsync(logger, exception);
}
public static void ErrorWhenReadBegun(ILogger logger, Exception exception)
{
_errorWhenReadBegun(logger, exception);
}
public static void ErrorWhileRead(ILogger logger, Exception exception)
{
_errorWhileRead(logger, exception);
}
}
}
}
|
apache-2.0
|
C#
|
ec902d60b9f499923965e0696940b13d462241f0
|
Remove IRazorDocumentOptionsService inheritance interface (#54047)
|
shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,eriawan/roslyn,wvdd007/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,eriawan/roslyn,physhi/roslyn,diryboy/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,physhi/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,diryboy/roslyn,physhi/roslyn,wvdd007/roslyn,mavasani/roslyn,sharwell/roslyn,weltkante/roslyn,eriawan/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,bartdesmet/roslyn,mavasani/roslyn,bartdesmet/roslyn
|
src/Tools/ExternalAccess/Razor/IRazorDocumentOptionsService.cs
|
src/Tools/ExternalAccess/Razor/IRazorDocumentOptionsService.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.CodeAnalysis.ExternalAccess.Razor
{
internal interface IRazorDocumentOptionsService
{
Task<IRazorDocumentOptions> GetOptionsForDocumentAsync(Document document, CancellationToken cancellationToken);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.CodeAnalysis.ExternalAccess.Razor
{
internal interface IRazorDocumentOptionsService : IDocumentService
{
Task<IRazorDocumentOptions> GetOptionsForDocumentAsync(Document document, CancellationToken cancellationToken);
}
}
|
mit
|
C#
|
7c5379d4218b6f708ecf6e7673695a3c6a886545
|
Update Buffer{T}.cs
|
SixLabors/Fonts
|
src/SixLabors.Fonts/Buffer{T}.cs
|
src/SixLabors.Fonts/Buffer{T}.cs
|
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace SixLabors.Fonts
{
/// <summary>
/// An disposable buffer that is backed by an array pool.
/// </summary>
/// <typeparam name="T">The type of buffer element.</typeparam>
internal struct Buffer<T> : IDisposable
where T : struct
{
private int length;
private readonly byte[] buffer;
private bool isDisposed;
public Buffer(int length)
{
Guard.MustBeGreaterThanOrEqualTo(length, 0, nameof(length));
int itemSizeBytes = Unsafe.SizeOf<T>();
int bufferSizeInBytes = length * itemSizeBytes;
this.buffer = ArrayPool<byte>.Shared.Rent(bufferSizeInBytes);
this.length = length;
this.isDisposed = false;
}
public Span<T> GetSpan()
{
if (this.buffer is null)
{
ThrowObjectDisposedException();
}
#if SUPPORTS_CREATESPAN
ref byte r0 = ref MemoryMarshal.GetReference<byte>(this.buffer);
return MemoryMarshal.CreateSpan(ref Unsafe.As<byte, T>(ref r0), this.length);
#else
return MemoryMarshal.Cast<byte, T>(this.buffer.AsSpan()).Slice(0, this.length);
#endif
}
public void Dispose()
{
if (this.isDisposed)
{
return;
}
ArrayPool<byte>.Shared.Return(this.buffer);
this.length = 0;
this.isDisposed = true;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void ThrowObjectDisposedException() => throw new ObjectDisposedException("Buffer<T>");
}
}
|
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace SixLabors.Fonts
{
/// <summary>
/// An disposable buffer that is backed by an array pool.
/// </summary>
/// <typeparam name="T">The type of buffer element.</typeparam>
internal sealed class Buffer<T> : IDisposable
where T : struct
{
private int length;
private readonly byte[] buffer;
private bool isDisposed;
public Buffer(int length)
{
Guard.MustBeGreaterThanOrEqualTo(length, 0, nameof(length));
int itemSizeBytes = Unsafe.SizeOf<T>();
int bufferSizeInBytes = length * itemSizeBytes;
this.buffer = ArrayPool<byte>.Shared.Rent(bufferSizeInBytes);
this.length = length;
}
public Span<T> GetSpan()
{
if (this.buffer is null)
{
ThrowObjectDisposedException();
}
#if SUPPORTS_CREATESPAN
ref byte r0 = ref MemoryMarshal.GetReference<byte>(this.buffer);
return MemoryMarshal.CreateSpan(ref Unsafe.As<byte, T>(ref r0), this.length);
#else
return MemoryMarshal.Cast<byte, T>(this.buffer.AsSpan()).Slice(0, this.length);
#endif
}
public void Dispose()
{
if (this.isDisposed)
{
return;
}
ArrayPool<byte>.Shared.Return(this.buffer);
this.length = 0;
this.isDisposed = true;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void ThrowObjectDisposedException() => throw new ObjectDisposedException("Buffer<T>");
}
}
|
apache-2.0
|
C#
|
a59d9b33247611c9f3d7f7f053f26f5661f5187d
|
Introduce helper methods to make test clearer
|
ceddlyburge/canoe-polo-league-organiser-backend
|
CanoePoloLeagueOrganiserTests/RubyInspiredListFunctionsTests.cs
|
CanoePoloLeagueOrganiserTests/RubyInspiredListFunctionsTests.cs
|
using System;
using CanoePoloLeagueOrganiser;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace CanoePoloLeagueOrganiserTests
{
public class RubyInspiredListFunctionsTests
{
[Fact]
public void EachCons2()
{
var list = new List<int> { 1, 2, 3, 4 };
var actual = list.EachCons2();
Assert.Collection(actual,
AssertPair(1, 2),
AssertPair(2, 3),
AssertPair(3, 4));
}
[Fact]
public void EachCons3()
{
var list = new List<int> { 1, 2, 3, 4, 5 };
var actual = list.EachCons(3);
Assert.Collection(actual,
AssertTriple("1,2,3"),
AssertTriple("2,3,4"),
AssertTriple("3,4,5"));
}
static Action<IEnumerable<int>> AssertTriple(string csvTriple) =>
(triple) => Assert.Equal(csvTriple, string.Join(",", triple));
static Action<Tuple<int, int>> AssertPair(int firstValue, int secondValue)
{
return (pair) =>
{
Assert.Equal(firstValue, pair.Item1);
Assert.Equal(secondValue, pair.Item2);
};
}
}
}
|
using System;
using CanoePoloLeagueOrganiser;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace CanoePoloLeagueOrganiserTests
{
public class RubyInspiredListFunctionsTests
{
[Fact]
public void EachCons2()
{
var list = new List<int> { 1, 2, 3, 4 };
var actual = list.EachCons2();
Assert.Collection(actual,
(pair) => { Assert.Equal(1, pair.Item1); Assert.Equal(2, pair.Item2); },
(pair) => { Assert.Equal(2, pair.Item1); Assert.Equal(3, pair.Item2); },
(pair) => { Assert.Equal(3, pair.Item1); Assert.Equal(4, pair.Item2); }
);
}
[Fact]
public void EachCons3()
{
var list = new List<int> { 1, 2, 3, 4, 5 };
var actual = list.EachCons(3);
Assert.Collection(actual,
(triple) => Assert.Equal("1,2,3", string.Join(",", triple)),
(triple) => Assert.Equal("2,3,4", string.Join(",", triple)),
(triple) => Assert.Equal("3,4,5", string.Join(",", triple))
);
}
}
}
|
mit
|
C#
|
114b950b3fbb2caa01f3dc59b5c6d43fff88ccd6
|
Bump version to 3.0.
|
jcheng31/DarkSkyApi,jcheng31/ForecastPCL
|
DarkSkyApi/Properties/AssemblyInfo.cs
|
DarkSkyApi/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("DarkSkyApi")]
[assembly: AssemblyDescription("An unofficial PCL for the Dark Sky weather API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jerome Cheng")]
[assembly: AssemblyProduct("DarkSkyApi")]
[assembly: AssemblyCopyright("")]
[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("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
|
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DarkSkyApi")]
[assembly: AssemblyDescription("An unofficial PCL for the Dark Sky weather API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jerome Cheng")]
[assembly: AssemblyProduct("DarkSkyApi")]
[assembly: AssemblyCopyright("")]
[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("2.9.9.0")]
[assembly: AssemblyFileVersion("2.9.9.0")]
|
mit
|
C#
|
3b7b592ac859e18021ff864852385b8e6b1eda14
|
fix name on resource path
|
ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET
|
ElectronNET.CLI/EmbeddedFileHelper.cs
|
ElectronNET.CLI/EmbeddedFileHelper.cs
|
using System;
using System.IO;
using System.Reflection;
namespace ElectronNET.CLI
{
public static class EmbeddedFileHelper
{
private const string ResourcePath = "h5.ElectronNET.CLI.{0}";
private static Stream GetTestResourceFileStream(string folderAndFileInProjectPath)
{
var asm = Assembly.GetExecutingAssembly();
var resource = string.Format(ResourcePath, folderAndFileInProjectPath);
return asm.GetManifestResourceStream(resource);
}
public static void DeployEmbeddedFile(string targetPath, string file, string namespacePath = "")
{
using (var fileStream = File.Create(Path.Combine(targetPath, file)))
{
var streamFromEmbeddedFile = GetTestResourceFileStream("ElectronHost." + namespacePath + file);
if (streamFromEmbeddedFile == null)
{
Console.WriteLine("Error: Couldn't find embedded file: " + file);
}
streamFromEmbeddedFile.CopyTo(fileStream);
}
}
public static void DeployEmbeddedFileToTargetFile(string targetPath, string embeddedFile, string targetFile, string namespacePath = "")
{
using (var fileStream = File.Create(Path.Combine(targetPath, targetFile)))
{
var streamFromEmbeddedFile = GetTestResourceFileStream("ElectronHost." + namespacePath + embeddedFile);
if (streamFromEmbeddedFile == null)
{
Console.WriteLine("Error: Couldn't find embedded file: " + embeddedFile);
}
streamFromEmbeddedFile.CopyTo(fileStream);
}
}
}
}
|
using System;
using System.IO;
using System.Reflection;
namespace ElectronNET.CLI
{
public static class EmbeddedFileHelper
{
private const string ResourcePath = "ElectronNET.CLI.{0}";
private static Stream GetTestResourceFileStream(string folderAndFileInProjectPath)
{
var asm = Assembly.GetExecutingAssembly();
var resource = string.Format(ResourcePath, folderAndFileInProjectPath);
return asm.GetManifestResourceStream(resource);
}
public static void DeployEmbeddedFile(string targetPath, string file, string namespacePath = "")
{
using (var fileStream = File.Create(Path.Combine(targetPath, file)))
{
var streamFromEmbeddedFile = GetTestResourceFileStream("ElectronHost." + namespacePath + file);
if (streamFromEmbeddedFile == null)
{
Console.WriteLine("Error: Couldn't find embedded file: " + file);
}
streamFromEmbeddedFile.CopyTo(fileStream);
}
}
public static void DeployEmbeddedFileToTargetFile(string targetPath, string embeddedFile, string targetFile, string namespacePath = "")
{
using (var fileStream = File.Create(Path.Combine(targetPath, targetFile)))
{
var streamFromEmbeddedFile = GetTestResourceFileStream("ElectronHost." + namespacePath + embeddedFile);
if (streamFromEmbeddedFile == null)
{
Console.WriteLine("Error: Couldn't find embedded file: " + embeddedFile);
}
streamFromEmbeddedFile.CopyTo(fileStream);
}
}
}
}
|
mit
|
C#
|
e030de797846ea157913c8ebe09bbc5ec136d57b
|
fix type compile issue
|
CrowCreek/Sql-Server-Query-Manager
|
CrowCreek.SqlServerQueryManager/Utilities/SqlServer/DbDataReaderExtensions.cs
|
CrowCreek.SqlServerQueryManager/Utilities/SqlServer/DbDataReaderExtensions.cs
|
/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.txt', which is part of this source code package.
*/
using System;
using System.Data.Common;
using System.Reflection;
namespace CrowCreek.Utilities.SqlServer
{
public static class DbDataReaderExtensions
{
public static TFieldType ReadField<TFieldType>(this DbDataReader dataRecord, string fieldName)
{
var fieldType = typeof(TFieldType);
var fieldTypeInfo = fieldType.GetTypeInfo();
var nullableUnderlying = Nullable.GetUnderlyingType(fieldType);
object raw;
try
{
raw = dataRecord[fieldName];
}
catch (Exception ex)
{
throw new FieldReadException(fieldName, ex);
}
// If the value is an enumeration check that the value from the db is defined in the enum
if (fieldTypeInfo.IsEnum && !Enum.IsDefined(fieldType, raw)) throw new FieldEnumNotDefinedException(fieldName, fieldType, raw.ToString());
// If we got a null from the database, check to see that we are reading a reference type or a nullable value type, if so return a default of the type
if (raw == DBNull.Value && (!fieldTypeInfo.IsValueType || nullableUnderlying != null))
{
return default(TFieldType);
}
try
{
if (nullableUnderlying != null && nullableUnderlying.GetTypeInfo().IsEnum) return (TFieldType)Enum.ToObject(nullableUnderlying, raw);
return (TFieldType)raw;
}
catch (InvalidCastException ex)
{
throw new FieldReadCastException(fieldName, ex);
}
catch (Exception ex)
{
throw new FieldReadException(fieldName, ex);
}
}
}
}
|
/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.txt', which is part of this source code package.
*/
using System;
using System.Data.Common;
using System.Reflection;
namespace CrowCreek.Utilities.SqlServer
{
public static class DbDataReaderExtensions
{
public static TFieldType ReadField<TFieldType>(this DbDataReader dataRecord, string fieldName)
{
var fieldType = typeof(TFieldType);
var fieldTypeInfo = fieldType.GetTypeInfo();
var nullableUnderlying = Nullable.GetUnderlyingType(fieldType);
object raw;
try
{
raw = dataRecord[fieldName];
}
catch (Exception ex)
{
throw new FieldReadException(fieldName, ex);
}
// If the value is an enumeration check that the value from the db is defined in the enum
if (fieldTypeInfo.IsEnum && !Enum.IsDefined(fieldType, raw)) throw new FieldEnumNotDefinedException(fieldName, fieldType, raw.ToString());
// If we got a null from the database, check to see that we are reading a reference type or a nullable value type, if so return a default of the type
if (raw == DBNull.Value && (!fieldTypeInfo.IsValueType || nullableUnderlying != null))
{
return default(TFieldType);
}
try
{
if (nullableUnderlying != null && nullableUnderlying.IsEnum) return (TFieldType)Enum.ToObject(nullableUnderlying, raw);
return (TFieldType)raw;
}
catch (InvalidCastException ex)
{
throw new FieldReadCastException(fieldName, ex);
}
catch (Exception ex)
{
throw new FieldReadException(fieldName, ex);
}
}
}
}
|
mit
|
C#
|
c217735b9c33384996bcfdba3995c06236e187b2
|
Update index.cshtml
|
Aleksandrovskaya/apmathclouddif
|
site/index.cshtml
|
site/index.cshtml
|
@{
double t_0 = 0;
double t_end = 150;
double step = 0.1;
int N = Convert.ToInt32((t_end-t_0)/step) + 1;
String data = "";
bool show_chart = false;
if (IsPost){
show_chart = true;
var number = Request["text1"];
double xd = number.AsInt();
double t = 0;
double x1 = 0;
double x2 = 0;
double x3 = 0;
double currentx1 = 0;
double currentx2 = 0;
double currentx3 = 0;
for (int i=0; i < N; ++i){
t = t_0 + step * i;
currentx1 = x1 + step* (-0.1252*x1 + -0.004637*(x2-xd)+-0.002198*x3);
currentx2 = x2 + step*x1 ;
currentx3= x3 + step*(10*x1 + -0.2*x3 +1*(x2-xd));
x1 = currentx1;
x2 = currentx2;
x3 = currentx3;
data += "[" +t+"," + x2+"]";
if( i < N - 1){
data += ",";
}
}
}
}
<html>
<head>
<meta charset="utf-8">
<title>MathBox</title>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={
'modules':[{
'name':'visualization',
'version':'1',
'packages':['corechart']
}]
}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Time', 'pitch'],
@data
]);
var options = {
title: 'pitch',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<form action="" method="post">
<p><label for="text1">Input Angle</label><br>
<input type="text" name="text1" /></p>
<p><input type="submit" value=" Show " /></p>
</form>
@if (show_chart)
{
<div id="curve_chart" style="width: 900px; height: 500px"></div>
}
else
{
<p></p>
}
</body>
</html>
|
@{
double t_0 = 0;
double t_end = 150;
double step = 0.1;
int N = Convert.ToInt32((t_end-t_0)/step) + 1;
String data = "";
bool show_chart = false;
if (IsPost){
show_chart = true;
var number = Request["text1"];
double xd = number.AsInt();
double t = 0;
double x1 = 0;
double x2 = 0;
double x3 = 0;
double currentx1 = 0;
double currentx2 = 0;
double currentx3 = 0;
for (int i=0; i < N; ++i){
t = t_0 + step * i;
currentx1 = x1 + step* (-0.1252*x1 + -0.004637*(x2-xd)+-0.002198*x3);
currentx2 = x2 + step*x1 ;
currentx3= x3 + step*(10*x1 + -0.2*x3 +1*(x2-xd));
x1 = currentx1;
x2 = currentx2;
x3 = currentx3;
data += "[" +t+"," + x2+"]";
if( i < N - 1){
data += ",";
}
}
}
}
<html>
<head>
<meta charset="utf-8">
<title>MathBox</title>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={
'modules':[{
'name':'visualization',
'version':'1',
'packages':['corechart']
}]
}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Time', 'pitch'],
@data
]);
var options = {
title: 'pitch',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<form action="" method="post" align="center">
<p><label for="text1">Input Angle</label><br>
<input type="text" name="text1" /></p>
<p><input type="submit" value=" Show " /></p>
</form>
@if (show_chart)
{
<div id="curve_chart" style="width: 900px; height: 500px"></div>
}
else
{
<p></p>
}
</body>
</html>
|
mit
|
C#
|
d93d4735419676c23de566f23e6a16a44c0e003e
|
Drop Fixie.Tests.TestClasses.ConstructionTests tests which are made redundant by the new Fixie.Tests.Lifecycle.ConstructionTests.
|
Duohong/fixie,fixie/fixie,bardoloi/fixie,JakeGinnivan/fixie,EliotJones/fixie,KevM/fixie,bardoloi/fixie
|
src/Fixie.Tests/TestClasses/ConstructionTests.cs
|
src/Fixie.Tests/TestClasses/ConstructionTests.cs
|
using Fixie.Conventions;
namespace Fixie.Tests.TestClasses
{
public class ConstructionTests
{
public void ShouldFailAllCasesWhenTestClassConstructorCannotBeInvoked()
{
//This ensures we handle a case that LifecycleTests CANNOT test.
var listener = new StubListener();
new SelfTestConvention().Execute(listener, typeof(CannotInvokeConstructorTestClass));
listener.ShouldHaveEntries(
"Fixie.Tests.TestClasses.ConstructionTests+CannotInvokeConstructorTestClass.UnreachableCaseA failed: No parameterless constructor defined for this object.",
"Fixie.Tests.TestClasses.ConstructionTests+CannotInvokeConstructorTestClass.UnreachableCaseB failed: No parameterless constructor defined for this object.");
}
class CannotInvokeConstructorTestClass
{
public CannotInvokeConstructorTestClass(int argument)
{
}
public void UnreachableCaseA() { }
public void UnreachableCaseB() { }
}
}
}
|
using Fixie.Conventions;
using Should;
namespace Fixie.Tests.TestClasses
{
public class ConstructionTests
{
public void ShouldConstructInstancePerCase()
{
var listener = new StubListener();
ConstructibleTestClass.ConstructionCount = 0;
new SelfTestConvention().Execute(listener, typeof(ConstructibleTestClass));
listener.ShouldHaveEntries(
"Fixie.Tests.TestClasses.ConstructionTests+ConstructibleTestClass.Fail failed: 'Fail' failed!",
"Fixie.Tests.TestClasses.ConstructionTests+ConstructibleTestClass.Pass passed.");
ConstructibleTestClass.ConstructionCount.ShouldEqual(2);
}
public void ShouldFailAllCasesWhenTestClassConstructorCannotBeInvoked()
{
var listener = new StubListener();
new SelfTestConvention().Execute(listener, typeof(CannotInvokeConstructorTestClass));
listener.ShouldHaveEntries(
"Fixie.Tests.TestClasses.ConstructionTests+CannotInvokeConstructorTestClass.UnreachableCaseA failed: No parameterless constructor defined for this object.",
"Fixie.Tests.TestClasses.ConstructionTests+CannotInvokeConstructorTestClass.UnreachableCaseB failed: No parameterless constructor defined for this object.");
}
public void ShouldFailAllCasesWithOriginalExceptionWhenTestClassConstructorThrowsException()
{
var listener = new StubListener();
new SelfTestConvention().Execute(listener, typeof(ConstructorThrowsTestClass));
listener.ShouldHaveEntries(
"Fixie.Tests.TestClasses.ConstructionTests+ConstructorThrowsTestClass.UnreachableCaseA failed: '.ctor' failed!",
"Fixie.Tests.TestClasses.ConstructionTests+ConstructorThrowsTestClass.UnreachableCaseB failed: '.ctor' failed!");
}
class ConstructibleTestClass
{
public static int ConstructionCount { get; set; }
public ConstructibleTestClass()
{
ConstructionCount++;
}
public void Fail()
{
throw new FailureException();
}
public void Pass()
{
}
}
class CannotInvokeConstructorTestClass
{
public CannotInvokeConstructorTestClass(int argument)
{
}
public void UnreachableCaseA() { }
public void UnreachableCaseB() { }
}
class ConstructorThrowsTestClass
{
public ConstructorThrowsTestClass()
{
throw new FailureException();
}
public void UnreachableCaseA() { }
public void UnreachableCaseB() { }
}
}
}
|
mit
|
C#
|
7cba6546eaba8a1ed07b83e55a9aa0f1b1747096
|
Make threadsafe
|
mavasani/roslyn,AmadeusW/roslyn,tmat/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,stephentoub/roslyn,gafter/roslyn,heejaechang/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,tmat/roslyn,gafter/roslyn,heejaechang/roslyn,KevinRansom/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,tannergooding/roslyn,sharwell/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,tmat/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,eriawan/roslyn,physhi/roslyn,mgoertz-msft/roslyn,dotnet/roslyn,gafter/roslyn,eriawan/roslyn,physhi/roslyn,dotnet/roslyn,wvdd007/roslyn,tannergooding/roslyn,diryboy/roslyn,dotnet/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,ErikSchierboom/roslyn,weltkante/roslyn,physhi/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,eriawan/roslyn,weltkante/roslyn,sharwell/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,diryboy/roslyn,weltkante/roslyn,sharwell/roslyn
|
src/Features/LanguageServer/Protocol/Handler/BufferedProgress.cs
|
src/Features/LanguageServer/Protocol/Handler/BufferedProgress.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using Microsoft.CodeAnalysis.PooledObjects;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler
{
/// <summary>
/// Helper type to allow command handlers to report data either in a streaming fashion (if a client supports that),
/// or as an array of results. This type is thread-safe in the same manner that <see cref="IProgress{T}"/> is
/// expected to be. Namely, multiple client can be calling <see cref="IProgress{T}.Report(T)"/> on it at the same
/// time. This is safe, though the order that the items are reported in when called concurrently is not specified.
/// </summary>
/// <typeparam name="T"></typeparam>
internal struct BufferedProgress<T> : IProgress<T>, IDisposable
{
/// <summary>
/// The progress stream to report results to. May be <see langword="null"/> for clients that do not support streaming.
/// If <see langword="null"/> then <see cref="_buffer"/> will be non null and will contain all the produced values.
/// </summary>
private readonly IProgress<T[]>? _underlyingProgress;
/// <summary>
/// A buffer that results are held in if the client does not support streaming. Values of this can be retrieved
/// using <see cref="GetValues"/>.
/// </summary>
private readonly ArrayBuilder<T>? _buffer;
public BufferedProgress(IProgress<T[]>? underlyingProgress)
{
_underlyingProgress = underlyingProgress;
_buffer = underlyingProgress == null ? ArrayBuilder<T>.GetInstance() : null;
}
public void Dispose()
=> _buffer?.Free();
/// <summary>
/// Report a value either in a streaming or buffered fashion depending on what the client supports.
/// </summary>
public void Report(T value)
{
// Don't need to lock _underlyingProgress. It is inherently thread-safe itself being an IProgress implementation.
_underlyingProgress?.Report(new[] { value });
if (_buffer != null)
{
lock (_buffer)
{
_buffer.Add(value);
}
}
}
/// <summary>
/// Gets the set of buffered values. Will return null if the client supports streaming. Must be called after
/// all calls to <see cref="Report(T)"/> have been made. Not safe to call concurrently with any call to <see
/// cref="Report(T)"/>.
/// </summary>
public T[]? GetValues()
=> _buffer?.ToArray();
}
internal static class BufferedProgress
{
public static BufferedProgress<T> Create<T>(IProgress<T[]>? progress)
=> new BufferedProgress<T>(progress);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using Microsoft.CodeAnalysis.PooledObjects;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler
{
/// <summary>
/// Helper type to allow command handlers to report data either in a streaming fashion (if a client supports that),
/// or as an array of results.
/// </summary>
/// <typeparam name="T"></typeparam>
internal struct BufferedProgress<T> : IProgress<T>, IDisposable
{
/// <summary>
/// The progress stream to report results to. May be <see langword="null"/> for clients that do not support streaming.
/// If <see langword="null"/> then <see cref="_buffer"/> will be non null and will contain all the produced values.
/// </summary>
private readonly IProgress<T[]>? _underlyingProgress;
/// <summary>
/// A buffer that results are held in if the client does not support streaming. Values of this can be retrieved
/// using <see cref="GetValues"/>.
/// </summary>
private readonly ArrayBuilder<T>? _buffer;
public BufferedProgress(IProgress<T[]>? underlyingProgress)
{
_underlyingProgress = underlyingProgress;
_buffer = underlyingProgress == null ? ArrayBuilder<T>.GetInstance() : null;
}
public void Dispose()
=> _buffer?.Free();
/// <summary>
/// Report a value either in a streaming or buffered fashion depending on what the client supports.
/// </summary>
public void Report(T value)
{
_underlyingProgress?.Report(new[] { value });
_buffer?.Add(value);
}
/// <summary>
/// Gets the set of buffered values. Will return null if the client supports streaming.
/// </summary>
public T[]? GetValues()
=> _buffer?.ToArray();
}
internal static class BufferedProgress
{
public static BufferedProgress<T> Create<T>(IProgress<T[]>? progress)
=> new BufferedProgress<T>(progress);
}
}
|
mit
|
C#
|
5dfbbaab489c10bb1cf1953b29f0aa127f82279f
|
Fix counter serialization.
|
bretcope/BosunReporter.NET,qed-/BosunReporter.NET,lockwobr/BosunReporter.NET
|
BosunReporter/BosunCounter.cs
|
BosunReporter/BosunCounter.cs
|
using System;
using System.Collections.Generic;
using System.Threading;
namespace BosunReporter
{
public class BosunCounter : BosunMetric, ILongCounter
{
public long Value = 0;
public override string MetricType => "counter";
protected override IEnumerable<string> GetSerializedMetrics(string unixTimestamp)
{
yield return ToJson("", Value, unixTimestamp);
}
public BosunCounter()
{
}
public void Increment(long amount = 1)
{
if (!IsAttached)
{
var ex = new InvalidOperationException("Attempting to record on a gauge which is not attached to a BosunReporter object.");
try
{
ex.Data["Metric"] = Name;
ex.Data["Tags"] = SerializedTags;
}
finally
{
throw ex;
}
}
Interlocked.Add(ref Value, amount);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Threading;
namespace BosunReporter
{
public class BosunCounter : BosunMetric, ILongCounter
{
public long Value = 0;
public override string MetricType => "counter";
protected override IEnumerable<string> GetSerializedMetrics(string unixTimestamp)
{
yield return ToJson("", Value.ToString("D"), unixTimestamp);
}
public BosunCounter()
{
}
public void Increment(long amount = 1)
{
if (!IsAttached)
{
var ex = new InvalidOperationException("Attempting to record on a gauge which is not attached to a BosunReporter object.");
try
{
ex.Data["Metric"] = Name;
ex.Data["Tags"] = SerializedTags;
}
finally
{
throw ex;
}
}
Interlocked.Add(ref Value, amount);
}
}
}
|
mit
|
C#
|
b2ee067722c227860ca42e84c4044fd1322a44a8
|
Fix 0x60 0x0B box hit command size
|
HelloKitty/Booma.Proxy
|
src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60ClientBoxHitEventCommand.cs
|
src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60ClientBoxHitEventCommand.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
namespace Booma.Proxy
{
//https://sylverant.net/wiki/index.php/Packet_0x60#Subcommand_0x0B
[WireDataContract]
[SubCommand60(SubCommand60OperationCode.GameBoxHit)]
public sealed class Sub60ClientBoxHitEventCommand : BaseSubCommand60, IMessageContextIdentifiable
{
/// <inheritdoc />
public byte Identifier => ObjectIdentifier.Identifier;
[WireMember(1)]
public MapObjectIdentifier ObjectIdentifier { get; }
//TODO: What is this?
//Sylverant says this is always 1? Also considers the first and subsequent 3 bytes sepertae but we'll leave this
//together for now
/// <summary>
/// TODO: ?
/// </summary>
[WireMember(2)]
private int unk1 { get; } = 1;
//Slyverant says the last 3 bytes of this are always 0. So, we'll guess it's a 4 byte value instead. Little enditan
//TODO: What is this?
/// <summary>
/// TODO: ?
/// </summary>
[WireMember(3)]
private short Identifier2_unk2 { get; }
[WireMember(4)]
private short unk3 { get; } = 0;
/// <inheritdoc />
public Sub60ClientBoxHitEventCommand(MapObjectIdentifier objectIdentifier)
: this()
{
ObjectIdentifier = objectIdentifier;
Identifier2_unk2 = objectIdentifier.ObjectIndex; //don't include object type for some reason
}
//Serializer ctor
private Sub60ClientBoxHitEventCommand()
{
CommandSize = 12 / 4;
}
/// <inheritdoc />
public override string ToString()
{
return $"Id: {Identifier} Unk1: {unk1} Id2unk: {Identifier2_unk2}";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
namespace Booma.Proxy
{
//https://sylverant.net/wiki/index.php/Packet_0x60#Subcommand_0x0B
[WireDataContract]
[SubCommand60(SubCommand60OperationCode.GameBoxHit)]
public sealed class Sub60ClientBoxHitEventCommand : BaseSubCommand60, IMessageContextIdentifiable
{
/// <inheritdoc />
public byte Identifier => ObjectIdentifier.Identifier;
[WireMember(1)]
public MapObjectIdentifier ObjectIdentifier { get; }
//TODO: What is this?
//Sylverant says this is always 1? Also considers the first and subsequent 3 bytes sepertae but we'll leave this
//together for now
/// <summary>
/// TODO: ?
/// </summary>
[WireMember(2)]
private int unk1 { get; } = 1;
//Slyverant says the last 3 bytes of this are always 0. So, we'll guess it's a 4 byte value instead. Little enditan
//TODO: What is this?
/// <summary>
/// TODO: ?
/// </summary>
[WireMember(3)]
private short Identifier2_unk2 { get; }
[WireMember(4)]
private short unk3 { get; } = 0;
/// <inheritdoc />
public Sub60ClientBoxHitEventCommand(MapObjectIdentifier objectIdentifier)
{
ObjectIdentifier = objectIdentifier;
Identifier2_unk2 = objectIdentifier.ObjectIndex; //don't include object type for some reason
}
//Serializer ctor
private Sub60ClientBoxHitEventCommand()
{
CommandSize = 12 / 4;
}
/// <inheritdoc />
public override string ToString()
{
return $"Id: {Identifier} Unk1: {unk1} Id2unk: {Identifier2_unk2}";
}
}
}
|
agpl-3.0
|
C#
|
665e6f0894178c72c7c7f77f3d92f2a36876b4a8
|
Fix plist (for AdMob).
|
Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x
|
unity/Editor/IosProcessor.cs
|
unity/Editor/IosProcessor.cs
|
#if UNITY_IOS
using System.IO;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEditor.iOS.Xcode;
using UnityEngine;
namespace EE.Editor {
public class IosProcessor : IPostprocessBuildWithReport {
public int callbackOrder { get; }
public void OnPostprocessBuild(BuildReport report) {
var plistPath = Path.Combine(report.summary.outputPath, "Info.plist");
var plist = new PlistDocument();
plist.ReadFromFile(plistPath);
var settings = LibrarySettings.Instance;
if (settings.IsAdMobEnabled) {
var appId = settings.AdMobIosAppId;
if (appId.Length == 0) {
Debug.LogError("AdMob iOS App Id is missing");
} else {
plist.root.SetString("GADApplicationIdentifier", appId);
}
// Add SKAdNetworkItems
var items = plist.root.CreateArray("SKAdNetworkItems");
var dict = items.AddDict();
dict.SetString("SKAdNetworkIdentifier", "cstr6suwn9.skadnetwork");
}
plist.WriteToFile(plistPath);
}
}
}
#endif // UNITY_IOS
|
#if UNITY_IOS
using System.IO;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEditor.iOS.Xcode;
using UnityEngine;
namespace EE.Editor {
public class IosProcessor : IPostprocessBuildWithReport {
public int callbackOrder { get; }
public void OnPostprocessBuild(BuildReport report) {
var plistPath = Path.Combine(report.summary.outputPath, "Info.plist");
var plist = new PlistDocument();
plist.ReadFromFile(plistPath);
var settings = LibrarySettings.Instance;
if (settings.IsAdMobEnabled) {
var appId = settings.AdMobIosAppId;
if (appId.Length == 0) {
Debug.LogError("AdMob iOS App Id is missing");
} else {
plist.root.SetString("GADApplicationIdentifier", appId);
}
}
plist.WriteToFile(plistPath);
}
}
}
#endif // UNITY_IOS
|
mit
|
C#
|
fe337905345a86a7a0246c8d0a5d027855955b9f
|
Implement DirectInput.SystemGuid
|
alesliehughes/monoDX,alesliehughes/monoDX
|
Microsoft.DirectX.DirectInput/Microsoft.DirectX.DirectInput/SystemGuid.cs
|
Microsoft.DirectX.DirectInput/Microsoft.DirectX.DirectInput/SystemGuid.cs
|
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 Alistair Leslie-Hughes
*
* 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 Microsoft.DirectX.DirectInput
{
public sealed class SystemGuid
{
public static readonly Guid Mouse;
public static readonly Guid Keyboard;
static SystemGuid()
{
Mouse = new Guid (0x6f1d2b60, 0xd5a0, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
Keyboard = new Guid (0x6f1d2b61, 0xd5a0, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
}
}
}
|
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 Alistair Leslie-Hughes
*
* 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 Microsoft.DirectX.DirectInput
{
public sealed class SystemGuid
{
public static readonly Guid Mouse;
public static readonly Guid Keyboard;
static SystemGuid()
{
throw new NotImplementedException ();
}
}
}
|
mit
|
C#
|
2c1c80fc6795fef094499bffdbe3416fbd96c420
|
Update SharedAssemblyInfo.cs
|
wieslawsoltes/AvaloniaBehaviors,XamlBehaviors/XamlBehaviors,wieslawsoltes/AvaloniaBehaviors,XamlBehaviors/XamlBehaviors
|
src/Shared/SharedAssemblyInfo.cs
|
src/Shared/SharedAssemblyInfo.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
using System.Resources;
[assembly: AssemblyCompany("Wiesław Šoltés")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2017")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Avalonia")]
[assembly: AssemblyTrademark("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.5.1")]
[assembly: AssemblyFileVersion("0.5.1")]
[assembly: AssemblyInformationalVersion("0.5.1")]
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
using System.Resources;
[assembly: AssemblyCompany("Wiesław Šoltés")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2017")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Avalonia")]
[assembly: AssemblyTrademark("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.5.0.2")]
[assembly: AssemblyFileVersion("0.5.0.2")]
[assembly: AssemblyInformationalVersion("0.5.0.2")]
|
mit
|
C#
|
ec3d826bc679aa625ed5b3387900946d4bc462c2
|
remove unused variable
|
icarus-consulting/Yaapii.Atoms
|
src/Yaapii.Atoms/IO/GZipInput.cs
|
src/Yaapii.Atoms/IO/GZipInput.cs
|
// MIT License
//
// Copyright(c) 2017 ICARUS Consulting GmbH
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System.IO;
using System.IO.Compression;
namespace Yaapii.Atoms.IO
{
/// <summary>
/// A input that decompresses.
/// </summary>
public sealed class GZipInput : IInput
{
// The input.
private readonly IInput origin;
/// <summary>
/// The input as a gzip stream.
/// </summary>
/// <param name="input">the input</param>
public GZipInput(IInput input)
{
this.origin = input;
}
/// <summary>
/// A stream which is decompressing.
/// </summary>
/// <returns></returns>
public Stream Stream()
{
return new GZipStream(this.origin.Stream(), CompressionMode.Decompress);
}
}
}
|
// MIT License
//
// Copyright(c) 2017 ICARUS Consulting GmbH
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System.IO;
using System.IO.Compression;
namespace Yaapii.Atoms.IO
{
/// <summary>
/// A input that decompresses.
/// </summary>
public sealed class GZipInput : IInput
{
// The input.
private readonly IInput _origin;
// The buffer size.
private readonly int _size;
/// <summary>
/// The input as a gzip stream.
/// </summary>
/// <param name="input">the input</param>
public GZipInput(IInput input)
{
this._origin = input;
}
/// <summary>
/// A stream which is decompressing.
/// </summary>
/// <returns></returns>
public Stream Stream()
{
return new GZipStream(this._origin.Stream(), CompressionMode.Decompress);
}
}
}
|
mit
|
C#
|
828c67afb5698fe1854c816880c92b3118df73ef
|
Update index.cshtml
|
Aleksandrovskaya/apmathclouddif
|
site/index.cshtml
|
site/index.cshtml
|
@{
double t_0 = 0;
double t_end = 150;
double step = 0.1;
int N = Convert.ToInt32((t_end-t_0)/step) + 1;
String data = "";
bool show_chart = false;
if (IsPost){
show_chart = true;
var number = Request["text1"];
double xd = number.AsInt();
double t = 0;
double x1 = 0;
double x2 = 0;
double x3 = 0;
double currentx1 = 0;
double currentx2 = 0;
double currentx3 = 0;
for (int i=0; i < N; ++i){
t = t_0 + step * i;
currentx1 = x1 + step* (-0.1252*x1 + -0.004637*x2+-0.002198*x3);
currentx2 = x2 + step*x1 ;
currentx3= x3 + step*(10*x1 + -0.2*x3 +1*(x2-xd));
x1 = currentx1;
x2 = currentx2;
x3 = currentx3;
data += "[" +t+"," + x2+"]";
if( i < N - 1){
data += ",";
}
}
}
}
<html>
<head>
<meta charset="utf-8">
<title>MathBox</title>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={
'modules':[{
'name':'visualization',
'version':'1',
'packages':['corechart']
}]
}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Time', 'pitch'],
@data
]);
var options = {
title: 'pitch',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<form action="" method="post">
<p><label for="text1">Input Angle</label><br>
<input type="text" name="text1" /></p>
<p><input type="submit" value=" Show " /></p>
</form>
@if (show_chart)
{
<div id="curve_chart" style="width: 900px; height: 500px"></div>
}
else
{
<p></p>
}
</body>
</html>
|
@{
double t_0 = 0;
double t_end = 150;
double step = 0.1;
int N = Convert.ToInt32((t_end-t_0)/step) + 1;
String data = "";
bool show_chart = false;
if (IsPost){
show_chart = true;
var number = Request["text1"];
double xd = number.AsInt();
double t = 0;
double x1 = 0;
double x2 = 0;
double x3 = 0;
double currentx1 = 0;
double currentx2 = 0;
double currentx3 = 0;
for (int i=0; i < N; ++i){
t = t_0 + step * i;
currentx1 = x1 + step* (-0.1252*x1 + -0.004637*x2+-0.002198*x3);
currentx2 = x2 + step*x1 ;
currentx3= x3 + step*(10*x1 + -0.2*x3 +1*(x2-xd));
x1 = currentx1;
x2 = currentx2;
x3 = currentx3;
data += "[" +t+"," + x2+"]";
if( i < N - 1){
data += ",";
}
}
}
}
<html>
<head>
<meta charset="utf-8">
<title>MathBox</title>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={
'modules':[{
'name':'visualization',
'version':'1',
'packages':['corechart']
}]
}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Time', 'Height'],
@data
]);
var options = {
title: 'pitch',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<form action="" method="post">
<p><label for="text1">Input Height</label><br>
<input type="text" name="text1" /></p>
<p><input type="submit" value=" Show " /></p>
</form>
@if (show_chart)
{
<div id="curve_chart" style="width: 900px; height: 500px"></div>
}
else
{
<p></p>
}
</body>
</html>
|
mit
|
C#
|
32bd3107e1929cd8b9f1bb5f636ced0b8175da1f
|
Remove high performance GC setting
|
NeoAdonis/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,peppy/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu
|
osu.Game/Performance/HighPerformanceSession.cs
|
osu.Game/Performance/HighPerformanceSession.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
namespace osu.Game.Performance
{
public class HighPerformanceSession : Component
{
private readonly IBindable<bool> localUserPlaying = new Bindable<bool>();
[BackgroundDependencyLoader]
private void load(OsuGame game)
{
localUserPlaying.BindTo(game.LocalUserPlaying);
}
protected override void LoadComplete()
{
base.LoadComplete();
localUserPlaying.BindValueChanged(playing =>
{
if (playing.NewValue)
EnableHighPerformanceSession();
else
DisableHighPerformanceSession();
}, true);
}
protected virtual void EnableHighPerformanceSession()
{
}
protected virtual void DisableHighPerformanceSession()
{
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Runtime;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
namespace osu.Game.Performance
{
public class HighPerformanceSession : Component
{
private readonly IBindable<bool> localUserPlaying = new Bindable<bool>();
private GCLatencyMode originalGCMode;
[BackgroundDependencyLoader]
private void load(OsuGame game)
{
localUserPlaying.BindTo(game.LocalUserPlaying);
}
protected override void LoadComplete()
{
base.LoadComplete();
localUserPlaying.BindValueChanged(playing =>
{
if (playing.NewValue)
EnableHighPerformanceSession();
else
DisableHighPerformanceSession();
}, true);
}
protected virtual void EnableHighPerformanceSession()
{
originalGCMode = GCSettings.LatencyMode;
GCSettings.LatencyMode = GCLatencyMode.LowLatency;
}
protected virtual void DisableHighPerformanceSession()
{
if (GCSettings.LatencyMode == GCLatencyMode.LowLatency)
GCSettings.LatencyMode = originalGCMode;
}
}
}
|
mit
|
C#
|
e126ebcb37db64277e83004197c5d26557b94f00
|
Update FizzBuzz.cs
|
michaeljwebb/Algorithm-Practice
|
LeetCode/FizzBuzz.cs
|
LeetCode/FizzBuzz.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Services;
using System.Text;
using System.Threading.Tasks;
class FizzBuzz
{
private static void Main(string[] args)
{
for (int i = 1; i < 16; i++)
{
if (i % 3 == 0 && i % 5 == 0)
{
Console.WriteLine("FizzBuzz");
}
else if (i % 3 == 0)
{
Console.WriteLine("Fizz");
}
else if (i % 5 == 0)
{
Console.WriteLine("Buzz");
}
else
{
Console.WriteLine(i);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Services;
using System.Text;
using System.Threading.Tasks;
namespace LeetCode
{
class FizzBuzz
{
private static void Main(string[] args)
{
for (int i = 1; i < 16; i++)
{
if (i % 3 == 0 && i % 5 == 0)
{
Console.WriteLine("FizzBuzz");
}
else if (i % 3 == 0)
{
Console.WriteLine("Fizz");
}
else if (i % 5 == 0)
{
Console.WriteLine("Buzz");
}
else
{
Console.WriteLine(i);
}
}
}
}
}
|
mit
|
C#
|
8913db7f1330fd22689df479bedbf8baf850ca06
|
Update ver
|
ConfigJson/dev
|
ConfigJson/ConfigJson/Properties/AssemblyInfo.cs
|
ConfigJson/ConfigJson/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("ConfigJsonNET")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("iocoded")]
[assembly: AssemblyProduct("ConfigJson.NET")]
[assembly: AssemblyCopyright("Copyright © Sam Bamgboye 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("9414c314-2c97-432d-9848-9a3f02fe6b5a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ConfigJsonNET")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("iocoded")]
[assembly: AssemblyProduct("ConfigJson.NET")]
[assembly: AssemblyCopyright("Copyright © Sam Bamgboye 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("9414c314-2c97-432d-9848-9a3f02fe6b5a")]
// 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.0.0")]
|
mit
|
C#
|
73ee0c4fae3c688fb1e26d423dce7ab254161fdb
|
Fix a failing test in Test_SubjectListModel
|
wongjiahau/TTAP-UTAR,wongjiahau/TTAP-UTAR
|
NUnit.Tests2/Test_SubjectListModel.cs
|
NUnit.Tests2/Test_SubjectListModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Time_Table_Arranging_Program.Class;
using Time_Table_Arranging_Program.Interfaces;
using Time_Table_Arranging_Program.Model;
using Time_Table_Arranging_Program.User_Control.SubjectListFolder;
namespace NUnit.Tests2 {
[TestFixture]
public class Test_SubjectListModel {
private SubjectListModel input() {
return new SubjectListModel(SubjectModel.Parse(TestData.TestSlots), Permutator.Run_v2_withoutConsideringWeekNumber, new TaskRunnerForUnitTesting());
}
[Test]
public void Test_SelectSubjectUsingRandomCodeShallThrowException() {
var input = this.input();
Assert.That(() => {
input.SelectSubject("Random code");
} ,
Throws.TypeOf<ArgumentException>());
}
[Test]
public void Test_SubjectListModel_SelectSubjectUsingCorrectCode() {
var input = this.input();
input.SelectSubject("MPU3113");
Assert.IsTrue(input.SelectedSubjectCount == 1);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Time_Table_Arranging_Program.Model;
using Time_Table_Arranging_Program.User_Control.SubjectListFolder;
namespace NUnit.Tests2 {
[TestFixture]
public class Test_SubjectListModel {
private SubjectListModel input() {
return new SubjectListModel(SubjectModel.Parse(TestData.TestSlots));
}
[Test]
public void Test_SelectSubjectUsingRandomCodeShallThrowException() {
var input = this.input();
Assert.That(() => {
input.SelectSubject("Random code");
} ,
Throws.TypeOf<ArgumentException>());
}
[Test]
public void Test_SubjectListModel_SelectSubjectUsingCorrectCode() {
var input = this.input();
input.SelectSubject("MPU3113");
Assert.IsTrue(input.SelectedSubjectCount == 1);
}
}
}
|
agpl-3.0
|
C#
|
16bc81e150a593420f89aac94dadc1713bb56269
|
Add field Id to ArchiveMetadata
|
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
|
src/Arkivverket.Arkade/Core/ArchiveMetadata.cs
|
src/Arkivverket.Arkade/Core/ArchiveMetadata.cs
|
using System;
using System.Collections.Generic;
namespace Arkivverket.Arkade.Core
{
public class ArchiveMetadata
{
public string Id { get; set; }
public string ArchiveDescription { get; set; }
public string AgreementNumber { get; set; }
public List<MetadataEntityInformationUnit> ArchiveCreators { get; set; }
public MetadataEntityInformationUnit Transferer { get; set; }
public MetadataEntityInformationUnit Producer { get; set; }
public List<MetadataEntityInformationUnit> Owners { get; set; }
public string Recipient { get; set; }
public MetadataSystemInformationUnit System { get; set; }
public MetadataSystemInformationUnit ArchiveSystem { get; set; }
public List<string> Comments { get; set; }
public string History { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public DateTime ExtractionDate { get; set; }
public string IncommingSeparator { get; set; }
public string OutgoingSeparator { get; set; }
public List<FileDescription> FileDescriptions { get; set; }
}
public class MetadataEntityInformationUnit
{
public string Entity { get; set; }
public string ContactPerson { get; set; }
public string Telephone { get; set; }
public string Email { get; set; }
}
public class MetadataSystemInformationUnit
{
public string Name { get; set; }
public string Version { get; set; }
public string Type { get; set; }
public string TypeVersion { get; set; }
}
public class FileDescription
{
public int Id { get; set; }
public string Name { get; set; }
public string Extension { get; set; }
public string Sha256Checksum { get; set; }
public long Size { get; set; }
public DateTime CreationTime { get; set; }
}
}
|
using System;
using System.Collections.Generic;
namespace Arkivverket.Arkade.Core
{
public class ArchiveMetadata
{
public string ArchiveDescription { get; set; }
public string AgreementNumber { get; set; }
public List<MetadataEntityInformationUnit> ArchiveCreators { get; set; }
public MetadataEntityInformationUnit Transferer { get; set; }
public MetadataEntityInformationUnit Producer { get; set; }
public List<MetadataEntityInformationUnit> Owners { get; set; }
public string Recipient { get; set; }
public MetadataSystemInformationUnit System { get; set; }
public MetadataSystemInformationUnit ArchiveSystem { get; set; }
public List<string> Comments { get; set; }
public string History { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public DateTime ExtractionDate { get; set; }
public string IncommingSeparator { get; set; }
public string OutgoingSeparator { get; set; }
public List<FileDescription> FileDescriptions { get; set; }
}
public class MetadataEntityInformationUnit
{
public string Entity { get; set; }
public string ContactPerson { get; set; }
public string Telephone { get; set; }
public string Email { get; set; }
}
public class MetadataSystemInformationUnit
{
public string Name { get; set; }
public string Version { get; set; }
public string Type { get; set; }
public string TypeVersion { get; set; }
}
public class FileDescription
{
public int Id { get; set; }
public string Name { get; set; }
public string Extension { get; set; }
public string Sha256Checksum { get; set; }
public long Size { get; set; }
public DateTime CreationTime { get; set; }
}
}
|
agpl-3.0
|
C#
|
2a4ab60950e93baa50ddf5db40ea7ff990ed8bf2
|
Add Flags attribute to KeyFilters
|
0x1mason/GribApi.NET
|
src/GribApi.NET/Grib.Api/Interop/KeyFilters.cs
|
src/GribApi.NET/Grib.Api/Interop/KeyFilters.cs
|
// Copyright 2015 Eric Millin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Grib.Api.Interop
{
/// <summary>
/// Bitwise OR-able bitflags used to filter message keys when iterating.
/// </summary>
[Flags]
public enum KeyFilters : uint
{
All = 0,
SkipReadOnly = 1<<0,
SkipOptional = 1<<1,
SkipEditionSpecific = 1<<2,
SkipCoded = 1<<3,
SkipComputed = 1<<4,
SkipDuplicates = 1<<5,
SkipFunction = 1<<6
}
}
|
// Copyright 2015 Eric Millin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Grib.Api.Interop
{
/// <summary>
/// Bitwise OR-able bitflags used to filter message keys when iterating.
/// </summary>
public enum KeyFilters : uint
{
All = 0,
SkipReadOnly = 1<<0,
SkipOptional = 1<<1,
SkipEditionSpecific = 1<<2,
SkipCoded = 1<<3,
SkipComputed = 1<<4,
SkipDuplicates = 1<<5,
SkipFunction = 1<<6
}
}
|
apache-2.0
|
C#
|
b443c9f77a02438e93a98c21f4037cfdf1c9fa65
|
fix errorviewmodel
|
joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
|
src/JoinRpg.WebPortal.Models/ErrorViewModel.cs
|
src/JoinRpg.WebPortal.Models/ErrorViewModel.cs
|
namespace JoinRpg.Web.Models
{
public class ErrorViewModel
{
public string Title { get; set; }
public string Message { get; set; }
public string Description { get; set; }
public string ReturnLink { get; set; }
public string ReturnText { get; set; }
public bool Debug { get; set; }
public object Data { get; set; }
public ErrorViewModel()
{
#if DEBUG
Debug = true;
#endif
}
}
}
|
namespace JoinRpg.Web.Models
{
public class ErrorViewModel
{
public string Title { get; set; }
public string Message { get; set; }
public string Description { get; set; }
public string ReturnLink { get; set; }
public string ReturnText { get; set; }
public bool Debug { get; set; }
public object Data { get; set; }
public ErrorViewModel() =>
#if DEBUG
Debug = true;
#endif
}
}
|
mit
|
C#
|
b02cf0ec7e0e9b78097198086dd681baf8015350
|
Update ZoomHelperTests.cs
|
PanAndZoom/PanAndZoom,PanAndZoom/PanAndZoom,wieslawsoltes/MatrixPanAndZoomDemo,wieslawsoltes/PanAndZoom,wieslawsoltes/PanAndZoom
|
tests/Avalonia.Controls.PanAndZoom.UnitTests/ZoomHelperTests.cs
|
tests/Avalonia.Controls.PanAndZoom.UnitTests/ZoomHelperTests.cs
|
using Xunit;
namespace Avalonia.Controls.PanAndZoom.UnitTests
{
public class ZoomHelperTests
{
private Matrix CreateMatrix(double scaleX = 1.0, double scaleY = 1.0, double offsetX = 0.0, double offsetY = 0.0)
{
return new Matrix(scaleX, 0, 0, scaleY, offsetX, offsetY);
}
[Fact]
public void CalculateScrollable_Default()
{
var bounds = new Rect(0, 0, 100, 100);
var matrix = CreateMatrix();
ZoomHelper.CalculateScrollable(bounds, matrix, out var extent, out var viewport, out var offset);
Assert.Equal(new Size(100, 100), extent);
Assert.Equal(new Size(100, 100), viewport);
Assert.Equal(new Vector(0, 0), offset);
}
}
}
|
using Xunit;
namespace Avalonia.Controls.PanAndZoom.UnitTests
{
public class ZoomHelperTests
{
private Matrix CreateMatrix(double scaleX = 1.0, double scaleY = 1.0, double offsetX = 0.0, double offsetY = 0.0)
{
return new Matrix(scaleX, 0, 0, scaleY, offsetX, offsetY);
}
[Fact]
public void CalculateScrollable_Defaults()
{
var bounds = new Rect(0, 0, 100, 100);
var matrix = CreateMatrix();
ZoomHelper.CalculateScrollable(bounds, matrix, out var extent, out var viewport, out var offset);
Assert.Equal(new Size(100, 100), extent);
Assert.Equal(new Size(100, 100), viewport);
Assert.Equal(new Vector(0, 0), offset);
}
}
}
|
mit
|
C#
|
ddff811c0bcbd8b7b2501db0e5b0c76b4900e86a
|
Revert "added BsPager HtmlHelper with settings"
|
vtfuture/BForms,vtfuture/BForms,vtfuture/BForms
|
BForms/Html/BsPagerExtensions.cs
|
BForms/Html/BsPagerExtensions.cs
|
using System;
using System.Linq.Expressions;
using System.Web.Mvc;
using BForms.Grid;
using BForms.Models;
namespace BForms.Html
{
public static class BsPagerExtensions
{
public static BsGridPagerBuilder BsPager(this HtmlHelper html, BsPagerModel model)
{
var builder = new BsGridPagerBuilder(model, new BsPagerSettings(), null) { viewContext = html.ViewContext };
return builder;
}
public static BsGridPagerBuilder BsPagerFor<TModel>(this HtmlHelper<TModel> html, Expression<Func<TModel, BsPagerModel>> expression)
{
var model = expression.Compile().Invoke(html.ViewData.Model);
return BsPager(html, model);
}
}
}
|
using System;
using System.Linq.Expressions;
using System.Web.Mvc;
using BForms.Grid;
using BForms.Models;
namespace BForms.Html
{
public static class BsPagerExtensions
{
public static BsGridPagerBuilder BsPager(this HtmlHelper html, BsPagerModel model, BsPagerSettings pagerSettings)
{
var builder = new BsGridPagerBuilder(model, pagerSettings, null) { viewContext = html.ViewContext };
return builder;
}
public static BsGridPagerBuilder BsPager(this HtmlHelper html, BsPagerModel model)
{
var builder = BsPager(html, model, null);
return builder;
}
public static BsGridPagerBuilder BsPagerFor<TModel>(this HtmlHelper<TModel> html, Expression<Func<TModel, BsPagerModel>> expression)
{
var model = expression.Compile().Invoke(html.ViewData.Model);
return BsPager(html, model);
}
}
}
|
mit
|
C#
|
6a5a6dee4596f8640d09633c0fb405d2a45c92d5
|
Fix ContourSeries example generator
|
oxyplot/documentation-examples
|
ExampleGenerator/Series/ContourSeriesExamples.cs
|
ExampleGenerator/Series/ContourSeriesExamples.cs
|
namespace ExampleGenerator
{
using System;
using OxyPlot;
using OxyPlot.Series;
public class ContourSeriesExamples
{
[Export("Series/ContourSeries")]
public static PlotModel ContourSeries()
{
var model = new PlotModel { Title = "ContourSeries" };
double x0 = -3.1;
double x1 = 3.1;
double y0 = -3;
double y1 = 3;
Func<double, double, double> peaks = (x, y) => 3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1)) - 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y) - 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
var xx = ArrayBuilder.CreateVector(x0, x1, 100);
var yy = ArrayBuilder.CreateVector(y0, y1, 100);
var peaksData = ArrayBuilder.Evaluate(peaks, xx, yy);
var cs = new ContourSeries
{
Color = OxyColors.Black,
LabelBackground = OxyColors.White,
ColumnCoordinates = yy,
RowCoordinates = xx,
Data = peaksData
};
model.Series.Add(cs);
return model;
}
}
}
|
namespace ExampleGenerator
{
using System;
using OxyPlot;
using OxyPlot.Series;
[Export("Series/ContourSeries")]
public class ContourSeriesExamples
{
public static PlotModel ContourSeries()
{
var model = new PlotModel { Title = "ContourSeries" };
double x0 = -3.1;
double x1 = 3.1;
double y0 = -3;
double y1 = 3;
Func<double, double, double> peaks = (x, y) => 3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1)) - 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y) - 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
var xx = ArrayBuilder.CreateVector(x0, x1, 100);
var yy = ArrayBuilder.CreateVector(y0, y1, 100);
var peaksData = ArrayBuilder.Evaluate(peaks, xx, yy);
var cs = new ContourSeries
{
Color = OxyColors.Black,
LabelBackground = OxyColors.White,
ColumnCoordinates = yy,
RowCoordinates = xx,
Data = peaksData
};
model.Series.Add(cs);
return model;
}
}
}
|
mit
|
C#
|
ea0ff2a3a61b74bfe0d4b4073f14c77fe2b42f0e
|
Update to avoid now internal API
|
Tragetaschen/dbus-sharp,arfbtwn/dbus-sharp,arfbtwn/dbus-sharp,mono/dbus-sharp,Tragetaschen/dbus-sharp,openmedicus/dbus-sharp,openmedicus/dbus-sharp,mono/dbus-sharp
|
examples/Test.cs
|
examples/Test.cs
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using NDesk.DBus;
using org.freedesktop.DBus;
public class ManagedDBusTest
{
public static void Main (string[] args)
{
Connection conn;
if (args.Length == 0)
conn = Bus.Session;
else {
if (args[0] == "--session")
conn = Bus.Session;
else if (args[0] == "--system")
conn = Bus.System;
else
conn = Connection.Open (args[0]);
}
ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
string name = "org.freedesktop.DBus";
IBus bus = conn.GetObject<IBus> (name, opath);
bus.NameAcquired += delegate (string acquired_name) {
Console.WriteLine ("NameAcquired: " + acquired_name);
};
Console.WriteLine ();
string xmlData = bus.Introspect ();
Console.WriteLine ("xmlData: " + xmlData);
Console.WriteLine ();
foreach (string n in bus.ListNames ())
Console.WriteLine (n);
Console.WriteLine ();
foreach (string n in bus.ListNames ())
Console.WriteLine ("Name " + n + " has owner: " + bus.NameHasOwner (n));
Console.WriteLine ();
}
}
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using NDesk.DBus;
using org.freedesktop.DBus;
public class ManagedDBusTest
{
public static void Main (string[] args)
{
string addr;
if (args.Length == 0)
addr = Address.Session;
else {
if (args[0] == "--session")
addr = Address.Session;
else if (args[0] == "--system")
addr = Address.System;
else
addr = args[0];
}
Connection conn = Connection.Open (addr);
ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
string name = "org.freedesktop.DBus";
IBus bus = conn.GetObject<IBus> (name, opath);
bus.NameAcquired += delegate (string acquired_name) {
Console.WriteLine ("NameAcquired: " + acquired_name);
};
string myName = bus.Hello ();
Console.WriteLine ("myName: " + myName);
Console.WriteLine ();
string xmlData = bus.Introspect ();
Console.WriteLine ("xmlData: " + xmlData);
Console.WriteLine ();
foreach (string n in bus.ListNames ())
Console.WriteLine (n);
Console.WriteLine ();
foreach (string n in bus.ListNames ())
Console.WriteLine ("Name " + n + " has owner: " + bus.NameHasOwner (n));
Console.WriteLine ();
}
}
|
mit
|
C#
|
9fef63d114b8219ebd91c1323db31f70acd7987d
|
Update dependencies.
|
JohanLarsson/Gu.Localization
|
Gu.Wpf.Localization.UiTests/Helpers/StartInfo.cs
|
Gu.Wpf.Localization.UiTests/Helpers/StartInfo.cs
|
namespace Gu.Wpf.Localization.UiTests
{
using System.Diagnostics;
using System.Globalization;
using Gu.Wpf.UiAutomation;
public static class StartInfo
{
public static ProcessStartInfo DemoProject { get; } = CreateStartUpInfo(
Application.FindExe("Gu.Wpf.Localization.Demo.exe"),
CultureInfo.GetCultureInfo("en"));
public static ProcessStartInfo WithNeutralLanguageProject { get; } = CreateStartUpInfo(
Application.FindExe("Gu.Wpf.Localization.WithNeutralLanguage.exe"),
CultureInfo.GetCultureInfo("en"));
private static ProcessStartInfo CreateStartUpInfo(string exeFileName, CultureInfo culture)
{
var processStartInfo = new ProcessStartInfo
{
Arguments = culture.Name,
FileName = exeFileName,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true
};
return processStartInfo;
}
}
}
|
namespace Gu.Wpf.Localization.UiTests
{
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
public static class StartInfo
{
public static ProcessStartInfo DemoProject { get; } = CreateStartUpInfo("Gu.Wpf.Localization.Demo", CultureInfo.GetCultureInfo("en"));
public static ProcessStartInfo WithNeutralLanguageProject { get; } = CreateStartUpInfo("Gu.Wpf.Localization.WithNeutralLanguage", CultureInfo.GetCultureInfo("en"));
private static ProcessStartInfo CreateStartUpInfo(string assemblyName, CultureInfo culture)
{
var processStartInfo = new ProcessStartInfo
{
Arguments = culture.Name,
FileName = GetExeFileName(assemblyName),
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true
};
return processStartInfo;
}
private static string GetExeFileName(string assemblyName)
{
var testAssembnly = Assembly.GetExecutingAssembly();
var testDirestory = Path.GetDirectoryName(new Uri(testAssembnly.CodeBase).AbsolutePath);
var exeDirectory = testDirestory.Replace(testAssembnly.GetName().Name, assemblyName);
var fileName = Path.Combine(exeDirectory, $"{assemblyName}.exe");
return fileName;
}
}
}
|
mit
|
C#
|
20c6f84efab1fa9f851b5b31466844e9492d5c0b
|
Fix banana test regression
|
peppy/osu-new,NeoAdonis/osu,naoey/osu,EVAST9919/osu,Frontear/osuKyzer,ppy/osu,DrabWeb/osu,johnneijzen/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,2yangk23/osu,UselessToucan/osu,smoogipooo/osu,DrabWeb/osu,UselessToucan/osu,johnneijzen/osu,naoey/osu,NeoAdonis/osu,peppy/osu,ppy/osu,naoey/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,ZLima12/osu,2yangk23/osu,EVAST9919/osu,DrabWeb/osu,UselessToucan/osu,Nabile-Rahmani/osu,peppy/osu,ZLima12/osu
|
osu.Game.Rulesets.Catch/Tests/TestCaseBananaShower.cs
|
osu.Game.Rulesets.Catch/Tests/TestCaseBananaShower.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.Collections.Generic;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable;
using osu.Game.Rulesets.Catch.UI;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
[Ignore("getting CI working")]
public class TestCaseBananaShower : Game.Tests.Visual.TestCasePlayer
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(BananaShower),
typeof(DrawableBananaShower),
typeof(CatchRuleset),
typeof(CatchRulesetContainer),
};
public TestCaseBananaShower()
: base(new CatchRuleset())
{
}
protected override Beatmap CreateBeatmap()
{
var beatmap = new Beatmap
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 6,
}
}
};
beatmap.HitObjects.Add(new BananaShower { StartTime = 200, Duration = 5000, NewCombo = true });
return beatmap;
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable;
using osu.Game.Rulesets.Catch.UI;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
[Ignore("getting CI working")]
public class TestCaseBananaShower : Game.Tests.Visual.TestCasePlayer
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(BananaShower),
typeof(DrawableBananaShower),
typeof(CatchRuleset),
typeof(CatchRulesetContainer),
};
public TestCaseBananaShower()
: base(new CatchRuleset())
{
}
protected override Beatmap CreateBeatmap()
{
var beatmap = new Beatmap
{
BeatmapInfo = new BeatmapInfo
{
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 6,
}
}
};
beatmap.HitObjects.Add(new BananaShower { StartTime = 200, Duration = 500, NewCombo = true });
return beatmap;
}
}
}
|
mit
|
C#
|
aa26bbcc51a1f7bd773f8ea7a433be8272f5d8ca
|
Return null if home route has no values (#5406)
|
stevetayloruk/Orchard2,xkproject/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,petedavis/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2
|
src/OrchardCore.Modules/OrchardCore.HomeRoute/Routing/HomeRouteTransformer.cs
|
src/OrchardCore.Modules/OrchardCore.HomeRoute/Routing/HomeRouteTransformer.cs
|
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using OrchardCore.Settings;
namespace OrchardCore.HomeRoute.Routing
{
public class HomeRouteTransformer : DynamicRouteValueTransformer
{
private readonly ISiteService _siteService;
public HomeRouteTransformer(ISiteService siteService)
{
_siteService = siteService;
}
public override async ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values)
{
var homeRoute = (await _siteService.GetSiteSettingsAsync()).HomeRoute;
if (homeRoute.Count > 0)
{
return new RouteValueDictionary(homeRoute);
}
else
{
return null;
}
}
}
}
|
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using OrchardCore.Settings;
namespace OrchardCore.HomeRoute.Routing
{
public class HomeRouteTransformer : DynamicRouteValueTransformer
{
private readonly ISiteService _siteService;
public HomeRouteTransformer(ISiteService siteService)
{
_siteService = siteService;
}
public override async ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values)
{
return new RouteValueDictionary((await _siteService.GetSiteSettingsAsync()).HomeRoute);
}
}
}
|
bsd-3-clause
|
C#
|
85530921b81e0540344e3eb518ac374e5eb2d46f
|
Use ObjectManager.GetPlayerById rather than re-writing the same code twice
|
aevitas/orion
|
src/Orion.GlobalOffensive/Orion.GlobalOffensive/Objects/LocalPlayer.cs
|
src/Orion.GlobalOffensive/Orion.GlobalOffensive/Objects/LocalPlayer.cs
|
// Copyright (C) 2015 aevitas
// See the file LICENSE for copying permission.
using System;
using System.Linq;
using System.Numerics;
using Orion.GlobalOffensive.Patchables;
namespace Orion.GlobalOffensive.Objects
{
/// <summary>
/// Represents the local player - i.e. the guy who's eyes we're borrowing.
/// </summary>
public class LocalPlayer : BaseEntity
{
/// <summary>
/// Initializes a new instance of the <see cref="LocalPlayer" /> class.
/// </summary>
/// <param name="baseAddress">The base address.</param>
internal LocalPlayer(IntPtr baseAddress) : base(baseAddress)
{
}
/// <summary>
/// Gets the view matrix of the local player.
/// </summary>
/// <value>
/// The view matrix.
/// </value>
public Matrix4x4 ViewMatrix => ReadField<Matrix4x4>(BaseOffsets.ViewMatrix);
/// <summary>
/// Gets the player ID for the player currently under the player's crosshair, and 0 if none.
/// </summary>
public int CrosshairId => ReadField<int>(StaticOffsets.CrosshairId);
/// <summary>
/// Gets the target the local player is currently aiming at, or null if none.
/// </summary>
public BaseEntity Target
{
get
{
// Store this in a local variable - the crosshair ID will get updated *very* frequently,
// to the point where we can't be sure that by the time we make a call to FirstOrDefault, it'll
// still be "valid" according to the check before it. (Value can change on a per-frame basis)
// This way, at least we'll be sure that for the execution of this function, we maintain the same value.
int id = CrosshairId;
if (CrosshairId <= 0)
return null;
return Orion.Objects.GetPlayerById(id);
}
}
}
}
|
// Copyright (C) 2015 aevitas
// See the file LICENSE for copying permission.
using System;
using System.Linq;
using System.Numerics;
using Orion.GlobalOffensive.Patchables;
namespace Orion.GlobalOffensive.Objects
{
/// <summary>
/// Represents the local player - i.e. the guy who's eyes we're borrowing.
/// </summary>
public class LocalPlayer : BaseEntity
{
/// <summary>
/// Initializes a new instance of the <see cref="LocalPlayer" /> class.
/// </summary>
/// <param name="baseAddress">The base address.</param>
internal LocalPlayer(IntPtr baseAddress) : base(baseAddress)
{
}
/// <summary>
/// Gets the view matrix of the local player.
/// </summary>
/// <value>
/// The view matrix.
/// </value>
public Matrix4x4 ViewMatrix => ReadField<Matrix4x4>(BaseOffsets.ViewMatrix);
/// <summary>
/// Gets the player ID for the player currently under the player's crosshair, and 0 if none.
/// </summary>
public int CrosshairId => ReadField<int>(StaticOffsets.CrosshairId);
/// <summary>
/// Gets the target the local player is currently aiming at, or null if none.
/// </summary>
public BaseEntity Target
{
get
{
// Store this in a local variable - the crosshair ID will get updated *very* frequently,
// to the point where we can't be sure that by the time we make a call to FirstOrDefault, it'll
// still be "valid" according to the check before it. (Value can change on a per-frame basis)
// This way, at least we'll be sure that for the execution of this function, we maintain the same value.
int id = CrosshairId;
if (CrosshairId <= 0)
return null;
return Orion.Objects.Players.FirstOrDefault(p => p.Id == id);
}
}
}
}
|
apache-2.0
|
C#
|
f40f8f50840ec9dce2b7139ba8454024a56cd07f
|
Add comments
|
eriawan/roslyn,sharwell/roslyn,dotnet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,physhi/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,physhi/roslyn,dotnet/roslyn,bartdesmet/roslyn,weltkante/roslyn,diryboy/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,eriawan/roslyn,diryboy/roslyn,sharwell/roslyn,KevinRansom/roslyn,wvdd007/roslyn,wvdd007/roslyn,wvdd007/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,physhi/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn
|
src/EditorFeatures/Core/Extensibility/NavigationBar/NavigationBarItem.cs
|
src/EditorFeatures/Core/Extensibility/NavigationBar/NavigationBarItem.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.Text;
namespace Microsoft.CodeAnalysis.Editor
{
internal abstract class NavigationBarItem
{
public string Text { get; }
public Glyph Glyph { get; }
public bool Bolded { get; }
public bool Grayed { get; }
public int Indent { get; }
public ImmutableArray<NavigationBarItem> ChildItems { get; }
/// <summary>
/// The tracking spans in the owning document corresponding to this nav bar item. If the user's
/// caret enters one of these spans, we'll select that item in the nav bar (except if they're in
/// an item's span that is nested within this). Tracking spans allow us to know where things are
/// as the users edits while the computation for the latest items might be going on.
/// </summary>
/// <remarks>This can be empty for items whose location is in another document.</remarks>
public ImmutableArray<ITrackingSpan> TrackingSpans { get; }
/// <summary>
/// The tracking span in the owning document corresponding to where to navigate to if the user
/// selects this item in the drop down.
/// </summary>
/// <remarks>This can be <see langword="null"/> for items whose location is in another document.</remarks>
public ITrackingSpan? NavigationTrackingSpan { get; }
public NavigationBarItem(
string text,
Glyph glyph,
ImmutableArray<ITrackingSpan> trackingSpans,
ITrackingSpan? navigationTrackingSpan,
ImmutableArray<NavigationBarItem> childItems = default,
int indent = 0,
bool bolded = false,
bool grayed = false)
{
this.Text = text;
this.Glyph = glyph;
this.TrackingSpans = trackingSpans;
this.NavigationTrackingSpan = navigationTrackingSpan;
this.ChildItems = childItems.NullToEmpty();
this.Indent = indent;
this.Bolded = bolded;
this.Grayed = grayed;
}
internal static ImmutableArray<ITrackingSpan> GetTrackingSpans(ITextSnapshot textSnapshot, ImmutableArray<TextSpan> spans)
=> spans.NullToEmpty().SelectAsArray(static (s, ts) => GetTrackingSpan(ts, s), textSnapshot);
internal static ITrackingSpan GetTrackingSpan(ITextSnapshot textSnapshot, TextSpan textSpan)
=> textSnapshot.CreateTrackingSpan(textSpan.ToSpan(), SpanTrackingMode.EdgeExclusive);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.Text;
namespace Microsoft.CodeAnalysis.Editor
{
internal abstract class NavigationBarItem
{
public string Text { get; }
public Glyph Glyph { get; }
public bool Bolded { get; }
public bool Grayed { get; }
public int Indent { get; }
public ImmutableArray<NavigationBarItem> ChildItems { get; }
public ImmutableArray<ITrackingSpan> TrackingSpans { get; }
public ITrackingSpan? NavigationTrackingSpan { get; }
public NavigationBarItem(
string text,
Glyph glyph,
ImmutableArray<ITrackingSpan> trackingSpans,
ITrackingSpan? navigationTrackingSpan,
ImmutableArray<NavigationBarItem> childItems = default,
int indent = 0,
bool bolded = false,
bool grayed = false)
{
this.Text = text;
this.Glyph = glyph;
this.TrackingSpans = trackingSpans;
this.NavigationTrackingSpan = navigationTrackingSpan;
this.ChildItems = childItems.NullToEmpty();
this.Indent = indent;
this.Bolded = bolded;
this.Grayed = grayed;
}
internal static ImmutableArray<ITrackingSpan> GetTrackingSpans(ITextSnapshot textSnapshot, ImmutableArray<TextSpan> spans)
=> spans.NullToEmpty().SelectAsArray(static (s, ts) => GetTrackingSpan(ts, s), textSnapshot);
internal static ITrackingSpan GetTrackingSpan(ITextSnapshot textSnapshot, TextSpan textSpan)
=> textSnapshot.CreateTrackingSpan(textSpan.ToSpan(), SpanTrackingMode.EdgeExclusive);
}
}
|
mit
|
C#
|
9b1dffa13ddaecd7bc942fe5081deb6e570f3884
|
Fix build warning (#851)
|
cshung/clrmd,Microsoft/clrmd,cshung/clrmd,Microsoft/clrmd
|
src/Microsoft.Diagnostics.Runtime/src/Linux/MemoryVirtualAddressSpace.cs
|
src/Microsoft.Diagnostics.Runtime/src/Linux/MemoryVirtualAddressSpace.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Microsoft.Diagnostics.Runtime.Linux
{
internal class MemoryVirtualAddressSpace : IAddressSpace
{
private readonly LinuxLiveDataReader _dataReader;
public MemoryVirtualAddressSpace(LinuxLiveDataReader dataReader)
{
_dataReader = dataReader;
}
public long Length => throw new NotImplementedException();
public string Name => nameof(MemoryVirtualAddressSpace);
public int Read(long position, Span<byte> buffer)
{
return _dataReader.Read((ulong)position, buffer);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Microsoft.Diagnostics.Runtime.Linux
{
internal class MemoryVirtualAddressSpace : IAddressSpace
{
private readonly LinuxLiveDataReader _dataReader;
public MemoryVirtualAddressSpace(LinuxLiveDataReader dataReader)
{
_dataReader = dataReader;
}
public long Length => throw new NotImplementedException();
public string Name => null;
public int Read(long position, Span<byte> buffer)
{
return _dataReader.Read((ulong)position, buffer);
}
}
}
|
mit
|
C#
|
c566906395b3b29d292889521a3db600afb83031
|
Add utility to determine if the active tab is provisional
|
agocke/roslyn,jcouv/roslyn,eriawan/roslyn,physhi/roslyn,MichalStrehovsky/roslyn,CaptainHayashi/roslyn,tmeschter/roslyn,KirillOsenkov/roslyn,lorcanmooney/roslyn,khyperia/roslyn,DustinCampbell/roslyn,bkoelman/roslyn,DustinCampbell/roslyn,tmat/roslyn,wvdd007/roslyn,bartdesmet/roslyn,drognanar/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,xasx/roslyn,swaroop-sridhar/roslyn,paulvanbrenk/roslyn,mgoertz-msft/roslyn,tvand7093/roslyn,pdelvo/roslyn,reaction1989/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,Hosch250/roslyn,akrisiun/roslyn,amcasey/roslyn,CyrusNajmabadi/roslyn,pdelvo/roslyn,Giftednewt/roslyn,mattwar/roslyn,jcouv/roslyn,yeaicc/roslyn,orthoxerox/roslyn,panopticoncentral/roslyn,tmat/roslyn,mgoertz-msft/roslyn,TyOverby/roslyn,mavasani/roslyn,aelij/roslyn,MattWindsor91/roslyn,agocke/roslyn,swaroop-sridhar/roslyn,MichalStrehovsky/roslyn,jasonmalinowski/roslyn,brettfo/roslyn,nguerrera/roslyn,jasonmalinowski/roslyn,VSadov/roslyn,mattwar/roslyn,sharwell/roslyn,amcasey/roslyn,brettfo/roslyn,mmitche/roslyn,davkean/roslyn,tmeschter/roslyn,jmarolf/roslyn,amcasey/roslyn,jamesqo/roslyn,jmarolf/roslyn,OmarTawfik/roslyn,weltkante/roslyn,srivatsn/roslyn,physhi/roslyn,bkoelman/roslyn,orthoxerox/roslyn,jmarolf/roslyn,tvand7093/roslyn,dotnet/roslyn,orthoxerox/roslyn,mattscheffer/roslyn,Giftednewt/roslyn,stephentoub/roslyn,genlu/roslyn,kelltrick/roslyn,KevinRansom/roslyn,MichalStrehovsky/roslyn,DustinCampbell/roslyn,tmat/roslyn,wvdd007/roslyn,MattWindsor91/roslyn,kelltrick/roslyn,OmarTawfik/roslyn,KevinRansom/roslyn,aelij/roslyn,nguerrera/roslyn,jkotas/roslyn,jamesqo/roslyn,MattWindsor91/roslyn,dotnet/roslyn,heejaechang/roslyn,akrisiun/roslyn,mgoertz-msft/roslyn,yeaicc/roslyn,davkean/roslyn,mavasani/roslyn,VSadov/roslyn,paulvanbrenk/roslyn,TyOverby/roslyn,heejaechang/roslyn,VSadov/roslyn,genlu/roslyn,dpoeschl/roslyn,tannergooding/roslyn,jcouv/roslyn,AmadeusW/roslyn,lorcanmooney/roslyn,weltkante/roslyn,diryboy/roslyn,sharwell/roslyn,drognanar/roslyn,TyOverby/roslyn,shyamnamboodiripad/roslyn,khyperia/roslyn,gafter/roslyn,dpoeschl/roslyn,mattscheffer/roslyn,AlekseyTs/roslyn,jeffanders/roslyn,mattscheffer/roslyn,kelltrick/roslyn,brettfo/roslyn,gafter/roslyn,eriawan/roslyn,jkotas/roslyn,swaroop-sridhar/roslyn,genlu/roslyn,CaptainHayashi/roslyn,mmitche/roslyn,AmadeusW/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,gafter/roslyn,heejaechang/roslyn,jeffanders/roslyn,khyperia/roslyn,bkoelman/roslyn,AnthonyDGreen/roslyn,CyrusNajmabadi/roslyn,reaction1989/roslyn,pdelvo/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,stephentoub/roslyn,srivatsn/roslyn,jamesqo/roslyn,jeffanders/roslyn,drognanar/roslyn,eriawan/roslyn,abock/roslyn,CaptainHayashi/roslyn,aelij/roslyn,wvdd007/roslyn,srivatsn/roslyn,lorcanmooney/roslyn,AmadeusW/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,KevinRansom/roslyn,robinsedlaczek/roslyn,abock/roslyn,physhi/roslyn,tmeschter/roslyn,Hosch250/roslyn,agocke/roslyn,jkotas/roslyn,robinsedlaczek/roslyn,reaction1989/roslyn,zooba/roslyn,tvand7093/roslyn,ErikSchierboom/roslyn,tannergooding/roslyn,Giftednewt/roslyn,mmitche/roslyn,xasx/roslyn,robinsedlaczek/roslyn,stephentoub/roslyn,mavasani/roslyn,paulvanbrenk/roslyn,panopticoncentral/roslyn,akrisiun/roslyn,KirillOsenkov/roslyn,mattwar/roslyn,dotnet/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,dpoeschl/roslyn,davkean/roslyn,AnthonyDGreen/roslyn,nguerrera/roslyn,MattWindsor91/roslyn,cston/roslyn,zooba/roslyn,bartdesmet/roslyn,abock/roslyn,zooba/roslyn,xasx/roslyn,ErikSchierboom/roslyn,AlekseyTs/roslyn,KirillOsenkov/roslyn,sharwell/roslyn,Hosch250/roslyn,diryboy/roslyn,bartdesmet/roslyn,yeaicc/roslyn,panopticoncentral/roslyn,cston/roslyn,AlekseyTs/roslyn,OmarTawfik/roslyn,tannergooding/roslyn,cston/roslyn,AnthonyDGreen/roslyn
|
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Shell_InProc.cs
|
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Shell_InProc.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess
{
internal class Shell_InProc : InProcComponent
{
public static Shell_InProc Create() => new Shell_InProc();
public string GetActiveWindowCaption()
=> InvokeOnUIThread(() => GetDTE().ActiveWindow.Caption);
public int GetHWnd()
=> GetDTE().MainWindow.HWnd;
public bool IsActiveTabProvisional()
=> InvokeOnUIThread(() =>
{
var shellMonitorSelection = GetGlobalService<SVsShellMonitorSelection, IVsMonitorSelection>();
if (!ErrorHandler.Succeeded(shellMonitorSelection.GetCurrentElementValue((uint)VSConstants.VSSELELEMID.SEID_DocumentFrame, out var windowFrameObject)))
{
throw new InvalidOperationException("Tried to get the active document frame but no documents were open.");
}
var windowFrame = (IVsWindowFrame)windowFrameObject;
if (!ErrorHandler.Succeeded(windowFrame.GetProperty((int)VsFramePropID.IsProvisional, out var isProvisionalObject)))
{
throw new InvalidOperationException("The active window frame did not have an 'IsProvisional' property.");
}
return (bool)isProvisionalObject;
});
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess
{
internal class Shell_InProc : InProcComponent
{
public static Shell_InProc Create() => new Shell_InProc();
public string GetActiveWindowCaption()
=> InvokeOnUIThread(() => GetDTE().ActiveWindow.Caption);
public int GetHWnd()
=> GetDTE().MainWindow.HWnd;
public bool IsActiveTabProvisional()
=> InvokeOnUIThread(() =>
{
var shellMonitorSelection = GetGlobalService<SVsShellMonitorSelection, IVsMonitorSelection>();
if (!ErrorHandler.Succeeded(shellMonitorSelection.GetCurrentElementValue((uint) VSConstants.VSSELELEMID.SEID_DocumentFrame, out var windowFrameObject)))
{
throw new InvalidOperationException("Tried to get the active document frame but no documents were open.");
}
var windowFrame = (IVsWindowFrame)windowFrameObject;
if (!ErrorHandler.Succeeded(windowFrame.GetProperty((int) VsFramePropID.IsProvisional, out var isProvisionalObject)))
{
throw new InvalidOperationException("The active window frame did not have an 'IsProvisional' property.");
}
return (bool) isProvisionalObject;
});
}
}
|
apache-2.0
|
C#
|
20173edd3f9d52eb816f54cc7a0d6a034ad08ce8
|
Rename error method
|
hey-red/Mime
|
src/Mime/Magic.cs
|
src/Mime/Magic.cs
|
using System;
using System.Runtime.InteropServices;
namespace HeyRed.Mime
{
public class Magic : IDisposable
{
private IntPtr _magic;
public Magic(MagicOpenFlags flags, string dbPath = null)
{
_magic = MagicNative.magic_open(flags);
if (_magic == IntPtr.Zero)
{
throw new MagicException("Cannot create magic cookie.");
}
if (MagicNative.magic_load(_magic, dbPath) == -1 &&
dbPath != null)
{
throw new MagicException(GetLastError());
}
}
public string Read(string filePath)
{
var str = Marshal.PtrToStringAnsi(MagicNative.magic_file(_magic, filePath));
if (str == null)
{
throw new MagicException(GetLastError());
}
return str;
}
public string Read(byte[] buffer)
{
var str = Marshal.PtrToStringAnsi(MagicNative.magic_buffer(_magic, buffer, buffer.Length));
if (str == null)
{
throw new MagicException(GetLastError());
}
return str;
}
private string GetLastError()
{
var err = Marshal.PtrToStringAnsi(MagicNative.magic_error(_magic));
return char.ToUpper(err[0]) + err.Substring(1);
}
#region IDisposable support
~Magic()
{
Dispose();
}
public void Dispose()
{
if (_magic != IntPtr.Zero)
{
MagicNative.magic_close(_magic);
_magic = IntPtr.Zero;
}
GC.SuppressFinalize(this);
}
#endregion
}
}
|
using System;
using System.Runtime.InteropServices;
namespace HeyRed.Mime
{
public class Magic : IDisposable
{
private IntPtr _magic;
public Magic(MagicOpenFlags flags, string dbPath = null)
{
_magic = MagicNative.magic_open(flags);
if (_magic == IntPtr.Zero)
{
throw new MagicException("Cannot create magic cookie.");
}
if (MagicNative.magic_load(_magic, dbPath) == -1 &&
dbPath != null)
{
throw new MagicException(GetLastMagicError());
}
}
public string Read(string filePath)
{
var str = Marshal.PtrToStringAnsi(MagicNative.magic_file(_magic, filePath));
if (str == null)
{
throw new MagicException(GetLastMagicError());
}
return str;
}
public string Read(byte[] buffer)
{
var str = Marshal.PtrToStringAnsi(MagicNative.magic_buffer(_magic, buffer, buffer.Length));
if (str == null)
{
throw new MagicException(GetLastMagicError());
}
return str;
}
private string GetLastMagicError()
{
var err = Marshal.PtrToStringAnsi(MagicNative.magic_error(_magic));
return char.ToUpper(err[0]) + err.Substring(1);
}
#region IDisposable support
~Magic()
{
Dispose();
}
public void Dispose()
{
if (_magic != IntPtr.Zero)
{
MagicNative.magic_close(_magic);
_magic = IntPtr.Zero;
}
GC.SuppressFinalize(this);
}
#endregion
}
}
|
mit
|
C#
|
8aeecbe30e0248f218ada84e0cabe3b773b37c44
|
add status: none
|
marihachi/CrystalResonanceForDesktop
|
src/Data/Enum/NotePushRating.cs
|
src/Data/Enum/NotePushRating.cs
|
namespace CrystalResonanceDesktop.Data.Enum
{
public enum NotePushRating
{
None,
Perfect,
Good,
Bad,
Miss
}
}
|
namespace CrystalResonanceDesktop.Data.Enum
{
public enum NotePushRating
{
Perfect,
Good,
Bad,
Miss
}
}
|
mit
|
C#
|
11433e542af993ca7bd81efeff0972ee0ccd101f
|
Use Debugger.IsAttached instead of IsDevelopment to control developer mode
|
Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnet5,gzepeda/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnetcore,gzepeda/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnetcore,gzepeda/ApplicationInsights-aspnetcore
|
src/Microsoft.ApplicationInsights.AspNetCore/Extensions/DefaultApplicationInsightsServiceConfigureOptions.cs
|
src/Microsoft.ApplicationInsights.AspNetCore/Extensions/DefaultApplicationInsightsServiceConfigureOptions.cs
|
namespace Microsoft.AspNetCore.Hosting
{
using System.Diagnostics;
using Microsoft.ApplicationInsights.AspNetCore.Extensions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
internal class DefaultApplicationInsightsServiceConfigureOptions : IConfigureOptions<ApplicationInsightsServiceOptions>
{
private readonly IHostingEnvironment hostingEnvironment;
public DefaultApplicationInsightsServiceConfigureOptions(IHostingEnvironment hostingEnvironment)
{
this.hostingEnvironment = hostingEnvironment;
}
public void Configure(ApplicationInsightsServiceOptions options)
{
var configBuilder = new ConfigurationBuilder()
.SetBasePath(this.hostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", true)
.AddEnvironmentVariables();
ApplicationInsightsExtensions.AddTelemetryConfiguration(configBuilder.Build(), options);
if (Debugger.IsAttached)
{
options.DeveloperMode = true;
}
}
}
}
|
namespace Microsoft.AspNetCore.Hosting
{
using Microsoft.ApplicationInsights.AspNetCore.Extensions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
internal class DefaultApplicationInsightsServiceConfigureOptions : IConfigureOptions<ApplicationInsightsServiceOptions>
{
private readonly IHostingEnvironment hostingEnvironment;
public DefaultApplicationInsightsServiceConfigureOptions(IHostingEnvironment hostingEnvironment)
{
this.hostingEnvironment = hostingEnvironment;
}
public void Configure(ApplicationInsightsServiceOptions options)
{
var configBuilder = new ConfigurationBuilder()
.SetBasePath(this.hostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", true)
.AddEnvironmentVariables();
ApplicationInsightsExtensions.AddTelemetryConfiguration(configBuilder.Build(), options);
if (this.hostingEnvironment.IsDevelopment())
{
options.DeveloperMode = true;
}
}
}
}
|
mit
|
C#
|
05c0aeb8705a725a906d47f2e0c8e37c906ead61
|
make Modified protected internal
|
AlejandroCano/framework,avifatal/framework,signumsoftware/framework,avifatal/framework,signumsoftware/framework,AlejandroCano/framework
|
Signum.Entities/Modifiable.cs
|
Signum.Entities/Modifiable.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Signum.Utilities;
using System.Collections.ObjectModel;
using Signum.Utilities.DataStructures;
using Signum.Entities.Reflection;
namespace Signum.Entities
{
[Serializable]
public abstract class Modifiable
{
[Ignore]
ModifiedState modified;
[HiddenProperty]
public ModifiedState Modified
{
get { return modified; }
protected internal set
{
if(modified == ModifiedState.Sealed)
throw new InvalidOperationException("The instance {0} is sealed and can not be modified".Formato(this));
modified = value;
}
}
/// <summary>
/// True if SelfModified or (saving) and Modified
/// </summary>
public bool IsGraphModified
{
get { return Modified == ModifiedState.Modified || Modified == ModifiedState.SelfModified; }
}
protected internal virtual void SetSelfModified()
{
Modified = ModifiedState.SelfModified;
}
protected internal virtual void PreSaving(ref bool graphModified)
{
}
protected internal virtual void PostRetrieving()
{
}
}
public enum ModifiedState
{
SelfModified,
/// <summary>
/// Recursively Clean (only valid during saving)
/// </summary>
Clean,
/// <summary>
/// Recursively Modified (only valid during saving)
/// </summary>
Modified,
Sealed,
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Signum.Utilities;
using System.Collections.ObjectModel;
using Signum.Utilities.DataStructures;
using Signum.Entities.Reflection;
namespace Signum.Entities
{
[Serializable]
public abstract class Modifiable
{
[Ignore]
ModifiedState modified;
[HiddenProperty]
public ModifiedState Modified
{
get { return modified; }
internal set
{
if(modified == ModifiedState.Sealed)
throw new InvalidOperationException("The instance {0} is sealed and can not be modified".Formato(this));
modified = value;
}
}
/// <summary>
/// True if SelfModified or (saving) and Modified
/// </summary>
public bool IsGraphModified
{
get { return Modified == ModifiedState.Modified || Modified == ModifiedState.SelfModified; }
}
protected internal virtual void SetSelfModified()
{
Modified = ModifiedState.SelfModified;
}
protected internal virtual void PreSaving(ref bool graphModified)
{
}
protected internal virtual void PostRetrieving()
{
}
}
public enum ModifiedState
{
SelfModified,
/// <summary>
/// Recursively Clean (only valid during saving)
/// </summary>
Clean,
/// <summary>
/// Recursively Modified (only valid during saving)
/// </summary>
Modified,
Sealed,
}
}
|
mit
|
C#
|
435701b6549419895a2bbe46625fff82c340a026
|
Fix WebAPI
|
rschiefer/templating,seancpeters/templating,seancpeters/templating,rschiefer/templating,lambdakris/templating,danroth27/templating,mlorbetske/templating,mlorbetske/templating,seancpeters/templating,rschiefer/templating,danroth27/templating,danroth27/templating,lambdakris/templating,seancpeters/templating,lambdakris/templating
|
template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/WebApi-CSharp/Startup.cs
|
template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/WebApi-CSharp/Startup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
#if (OrganizationalAuth || IndividualB2CAuth)
using Microsoft.Extensions.Options;
#endif
namespace Company.WebApplication1
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
#if (OrganizationalAuth || IndividualB2CAuth)
services.AddJwtBearerAuthentication();
#endif
#if (OrganizationalAuth)
services.Configure<AzureAdOptions>(Configuration.GetSection("Authentication:AzureAd"));
#endif
#if (IndividualB2CAuth)
services.Configure<AzureAdB2COptions>(Configuration.GetSection("Authentication:AzureAdB2C"));
#endif
#if (OrganizationalAuth || IndividualB2CAuth)
services.AddSingleton<IConfigureOptions<JwtBearerOptions>, JwtBearerOptionsSetup>();
#endif
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseMvc();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
#if (OrganizationalAuth || IndividualB2CAuth)
using Microsoft.Extensions.Options;
#endif
namespace Company.WebApplication1
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
#if (OrganizationalAuth)
services.Configure<AzureAdOptions>(Configuration.GetSection("Authentication:AzureAd"));
#endif
#if (IndividualB2CAuth)
services.Configure<AzureAdB2COptions>(Configuration.GetSection("Authentication:AzureAdB2C"));
#endif
#if (OrganizationalAuth || IndividualB2CAuth)
services.AddSingleton<IConfigureOptions<JwtBearerOptions>, JwtBearerOptionsSetup>();
#endif
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
#if (OrganizationalAuth || IndividualB2CAuth)
app.UseJwtBearerAuthentication();
#endif
app.UseMvc();
}
}
}
|
mit
|
C#
|
c11ea5963e1844c9c2cef781f771d1a7fd6c3e92
|
add code to check unity version and WindowsWebPlayer
|
NDark/ndinfrastructure,NDark/ndinfrastructure
|
Unity/UnityTools/OnClickOpenBrower.cs
|
Unity/UnityTools/OnClickOpenBrower.cs
|
/**
MIT License
Copyright (c) 2017 NDark
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.
*/
/**
@file OnClickOpenBrower.cs
@author NDark
@date 20170501 . file started.
@date 20170620 by NDark
. add class method OpenBrowerWithSpecifiedTabName(), OpenBrowerNewTab(), OpenBrowerAtSelf(), RefreshBrower()
*/
using UnityEngine;
public class OnClickOpenBrower : MonoBehaviour
{
public string m_Url = string.Empty ;
public void OpenBrower()
{
OpenBrowerWithSpecifiedTabName() ;// aNewWindow
}
public void RefreshBrower()
{
_OpenBrower( GetRefreshBrowserJSString() ) ;
}
public void OpenBrowerNewTab()
{
_OpenBrower( GenerateOpenBrowserJSString( "_blank" ) ) ;
}
public void OpenBrowerAtSelf()
{
_OpenBrower( GenerateOpenBrowserJSString( "_self" ) ) ;
}
public void OpenBrowerWithSpecifiedTabName( string _WindowName = "aNewWindow" )
{
_OpenBrower( GenerateOpenBrowserJSString( _WindowName ) ) ;
}
// _CustomKey _blank , _self , or other specified window name(will use the same name to open the same tab).
void _OpenBrower( string _JSCall )
{
// Debug.Log( Application.platform ) ;
if( Application.platform == RuntimePlatform.WebGLPlayer )
{
// Debug.Log( jsCall ) ;
Application.ExternalEval( _JSCall );
}
#if !UNITY_5_4_OR_NEWER
else if( Application.platform == RuntimePlatform.WindowsWebPlayer )
{
// Debug.Log( jsCall ) ;
Application.ExternalEval( _JSCall );
}
#endif
else /*if( Application.platform == RuntimePlatform.WindowsPlayer ||
Application.platform == RuntimePlatform.WindowsEditor )*/
{
Application.OpenURL( m_Url ) ;
}
}
void OnClick()
{
OpenBrower() ;
}
string GenerateOpenBrowserJSString( string _CustomKey )
{
return "window.open('" + m_Url + "','"+_CustomKey+"')" ;
}
string GetRefreshBrowserJSString()
{
return "document.location.reload(true)" ;
}
}
|
/**
MIT License
Copyright (c) 2017 NDark
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.
*/
/**
@file OnClickOpenBrower.cs
@author NDark
@date 20170501 . file started.
@date 20170620 by NDark
. add class method OpenBrowerWithSpecifiedTabName(), OpenBrowerNewTab(), OpenBrowerAtSelf(), RefreshBrower()
*/
using UnityEngine;
public class OnClickOpenBrower : MonoBehaviour
{
public string m_Url = string.Empty ;
public void OpenBrower()
{
OpenBrowerWithSpecifiedTabName() ;// aNewWindow
}
public void RefreshBrower()
{
_OpenBrower( GetRefreshBrowserJSString() ) ;
}
public void OpenBrowerNewTab()
{
_OpenBrower( GenerateOpenBrowserJSString( "_blank" ) ) ;
}
public void OpenBrowerAtSelf()
{
_OpenBrower( GenerateOpenBrowserJSString( "_self" ) ) ;
}
public void OpenBrowerWithSpecifiedTabName( string _WindowName = "aNewWindow" )
{
_OpenBrower( GenerateOpenBrowserJSString( _WindowName ) ) ;
}
// _CustomKey _blank , _self , or other specified window name(will use the same name to open the same tab).
void _OpenBrower( string _JSCall )
{
// Debug.Log( Application.platform ) ;
if( Application.platform == RuntimePlatform.WebGLPlayer )
{
// Debug.Log( jsCall ) ;
Application.ExternalEval( _JSCall );
}
else /*if( Application.platform == RuntimePlatform.WindowsPlayer ||
Application.platform == RuntimePlatform.WindowsEditor )*/
{
Application.OpenURL( m_Url ) ;
}
}
void OnClick()
{
OpenBrower() ;
}
string GenerateOpenBrowserJSString( string _CustomKey )
{
return "window.open('" + m_Url + "','"+_CustomKey+"')" ;
}
string GetRefreshBrowserJSString()
{
return "document.location.reload(true)" ;
}
}
|
mit
|
C#
|
748e990c6d156d7819c1cd1b9038ff28630e6194
|
clean tests
|
nhibernate/NHibernate.AspNet.Identity,lnu/NHibernate.AspNet.Identity,lnu/NHibernate.AspNet.Identity,andyshao/NHibernate.AspNet.Identity,smallkid/NHibernate.AspNet.Identity,smallkid/NHibernate.AspNet.Identity,andyshao/NHibernate.AspNet.Identity,nhibernate/NHibernate.AspNet.Identity,andyshao/NHibernate.AspNet.Identity,smallkid/NHibernate.AspNet.Identity,lnu/NHibernate.AspNet.Identity,nhibernate/NHibernate.AspNet.Identity
|
source/MilesiBastos.AspNet.Identity.NHibernate.Tests/MapTest.cs
|
source/MilesiBastos.AspNet.Identity.NHibernate.Tests/MapTest.cs
|
using FluentNHibernate.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NHibernate.Cfg;
using NHibernate.Mapping.ByCode;
using NHibernate.Tool.hbm2ddl;
using System;
using System.IO;
namespace MilesiBastos.AspNet.Identity.NHibernate.Tests
{
[TestClass]
public class MapTest
{
[TestMethod]
public void CanCorrectlyMapIdentityUser()
{
var mapper = new ModelMapper();
mapper.AddMapping<IdentityUserMap>();
mapper.AddMapping<IdentityRoleMap>();
mapper.AddMapping<IdentityUserClaimMap>();
mapper.AddMapping<IdentityUserLoginMap>();
var mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();
var configuration = new Configuration();
configuration.Configure("sqlite-nhibernate-config.xml");
configuration.AddDeserializedMapping(mapping, null);
var factory = configuration.BuildSessionFactory();
var session = factory.OpenSession();
BuildSchema(configuration);
new PersistenceSpecification<IdentityUser>(session)
.CheckProperty(c => c.UserName, "John")
.VerifyTheMappings();
}
private static void BuildSchema(Configuration config)
{
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"App_Data\sql\schema.sql");
if (!Directory.Exists(Path.GetDirectoryName(path)))
Directory.CreateDirectory(Path.GetDirectoryName(path));
// this NHibernate tool takes a configuration (with mapping info in)
// and exports a database schema from it
new SchemaExport(config)
.SetOutputFile(path)
.Create(true, true /* DROP AND CREATE SCHEMA */);
}
}
}
|
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FluentNHibernate.Testing;
using FluentNHibernate.Cfg.Db;
using SharpArch.NHibernate;
using NHibernate.Mapping.ByCode;
using SharpArch.Domain.DomainModel;
using NHibernate.Cfg;
using NHibernate;
using System.IO;
using NHibernate.Tool.hbm2ddl;
namespace MilesiBastos.AspNet.Identity.NHibernate.Tests
{
[TestClass]
public class MapTest
{
[TestMethod]
public void CanCorrectlyMapIdentityUser()
{
var mapper = new ModelMapper();
mapper.AddMapping<IdentityUserMap>();
mapper.AddMapping<IdentityRoleMap>();
mapper.AddMapping<IdentityUserClaimMap>();
mapper.AddMapping<IdentityUserLoginMap>();
var mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();
var configuration = new Configuration();
configuration.Configure("sqlite-nhibernate-config.xml");
configuration.AddDeserializedMapping(mapping, null);
var factory = configuration.BuildSessionFactory();
var session = factory.OpenSession();
BuildSchema(configuration);
new PersistenceSpecification<IdentityUser>(session)
.CheckProperty(c => c.UserName, "John")
.VerifyTheMappings();
}
private static void BuildSchema(Configuration config)
{
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"App_Data\sql\schema.sql");
if (!Directory.Exists(Path.GetDirectoryName(path)))
Directory.CreateDirectory(Path.GetDirectoryName(path));
// this NHibernate tool takes a configuration (with mapping info in)
// and exports a database schema from it
new SchemaExport(config)
.SetOutputFile(path)
.Create(true, true /* DROP AND CREATE SCHEMA */);
}
}
}
|
mit
|
C#
|
275305d1d16195b1bb969d4bd42bc3bdcb487a24
|
Update Xmas Gift second behaviour.
|
Noxalus/Xmas-Hell
|
Xmas-Hell/Xmas-Hell-Core/Entities/Bosses/XmasGift/XmasGiftBehaviour2.cs
|
Xmas-Hell/Xmas-Hell-Core/Entities/Bosses/XmasGift/XmasGiftBehaviour2.cs
|
using System;
using FarseerPhysics;
using Microsoft.Xna.Framework;
using System.Diagnostics;
namespace XmasHell.Entities.Bosses.XmasGift
{
class XmasGiftBehaviour2 : AbstractBossBehaviour
{
private TimeSpan _impulseTimer;
public XmasGiftBehaviour2(Boss boss) : base(boss)
{
}
public override void Start()
{
base.Start();
Boss.PhysicsBody.Position = ConvertUnits.ToSimUnits(Boss.Position());
Boss.PhysicsWorld.Gravity = GameConfig.DefaultGravity;
Boss.PhysicsEnabled = true;
Boss.PhysicsBody.ApplyAngularImpulse(10f);
Boss.PhysicsBody.OnCollision += OnCollision;
Boss.CurrentAnimator.Play("NoAnimation");
_impulseTimer = TimeSpan.Zero;
}
private bool OnCollision(FarseerPhysics.Dynamics.Fixture fixtureA, FarseerPhysics.Dynamics.Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
{
Debug.WriteLine("Linear velocity: " + Boss.PhysicsBody.LinearVelocity);
if (Boss.Position().Y > Boss.GetPlayerPosition().Y)
ImpulseToPlayer();
return true;
}
public override void Stop()
{
base.Stop();
Boss.PhysicsWorld.Gravity = Vector2.Zero;
Boss.PhysicsEnabled = false;
Boss.PhysicsBody.OnCollision -= OnCollision;
}
private void ImpulseToPlayer()
{
if (_impulseTimer.TotalMilliseconds > 0)
return;
var forceVector = Boss.GetPlayerDirection();
var strength = 500f;
forceVector.Normalize();
//Boss.PhysicsBody.ApplyForce(forceVector * strength);
Boss.PhysicsBody.ApplyLinearImpulse(forceVector * strength);
Boss.PhysicsBody.ApplyAngularImpulse(100);//Boss.Game.GameManager.Random.Next(10, 100));
_impulseTimer = TimeSpan.FromSeconds(0.1);
}
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
if (Boss.Position().Y > Boss.GetPlayerPosition().Y &&
Math.Abs(Boss.PhysicsBody.LinearVelocity.Y) < 0.0005f && Math.Abs(Boss.PhysicsBody.LinearVelocity.X) < 0.0005f)
{
ImpulseToPlayer();
}
if (_impulseTimer.TotalMilliseconds > 0)
_impulseTimer -= gameTime.ElapsedGameTime;
}
}
}
|
using System;
using FarseerPhysics;
using Microsoft.Xna.Framework;
namespace XmasHell.Entities.Bosses.XmasGift
{
class XmasGiftBehaviour2 : AbstractBossBehaviour
{
public XmasGiftBehaviour2(Boss boss) : base(boss)
{
}
public override void Start()
{
base.Start();
Boss.PhysicsBody.Position = ConvertUnits.ToSimUnits(Boss.Position());
Boss.PhysicsWorld.Gravity = GameConfig.DefaultGravity;
Boss.PhysicsEnabled = true;
Boss.PhysicsBody.ApplyAngularImpulse(10f);
Boss.CurrentAnimator.Play("NoAnimation");
}
public override void Stop()
{
base.Stop();
Boss.PhysicsWorld.Gravity = Vector2.Zero;
Boss.PhysicsEnabled = false;
}
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
if (Boss.Position().Y > Boss.GetPlayerPosition().Y &&
Math.Abs(Boss.PhysicsBody.LinearVelocity.Y) < 0.0005f && Math.Abs(Boss.PhysicsBody.LinearVelocity.X) < 0.0005f)
{
var forceVector = Boss.GetPlayerDirection();
var strength = 500f;
forceVector.Normalize();
//Boss.PhysicsBody.ApplyForce(forceVector * strength);
Boss.PhysicsBody.ApplyLinearImpulse(forceVector * strength);
Boss.PhysicsBody.ApplyAngularImpulse(100);//Boss.Game.GameManager.Random.Next(10, 100));
}
}
}
}
|
mit
|
C#
|
41c9191773f6a626b01714c9d3d9ccbc44776760
|
remove size properties from roomDetails
|
whoa-algebraic/game-off-2016,virtuoushub/game-off-2016,virtuoushub/game-off-2016,virtuoushub/game-off-2016,whoa-algebraic/game-off-2016,whoa-algebraic/game-off-2016
|
Assets/Scripts/RoomDetails.cs
|
Assets/Scripts/RoomDetails.cs
|
using System.Collections.Generic;
using UnityEngine;
public class RoomDetails : MonoBehaviour {
private List<GameObject> Doors;
void Start() {
int doorIndex = 0;
for(int i = 0; i < transform.childCount; i++) {
GameObject child = transform.GetChild(i).gameObject;
if (child.tag == "door") {
Doors.Add(child);
child.GetComponent<DoorDetails>().ID = doorIndex;
doorIndex++;
}
}
}
public List<GameObject> GetDoors() {
return Doors;
}
}
|
using System.Collections.Generic;
using UnityEngine;
public class RoomDetails : MonoBehaviour {
public int HorizontalSize;
public int VerticalSize;
private List<GameObject> Doors;
void Start() {
int doorIndex = 0;
for(int i = 0; i < transform.childCount; i++) {
GameObject child = transform.GetChild(i).gameObject;
if (child.tag == "door") {
Doors.Add(child);
child.GetComponent<DoorDetails>().ID = doorIndex;
doorIndex++;
}
}
}
public List<GameObject> GetDoors() {
return Doors;
}
}
|
mit
|
C#
|
de286fa91b29f0b1e7310da0843f9d81381a5cf7
|
add license
|
NDark/ndinfrastructure,NDark/ndinfrastructure
|
Unity/Timer/CountDownTimer.cs
|
Unity/Timer/CountDownTimer.cs
|
/**
MIT License
Copyright (c) 2017 NDark
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 UnityEngine;
public class CountDownTimer
{
public float IntervalSec { get{return m_IntervalSec;} set{ m_IntervalSec = value ;} }
public void Rewind()
{
m_NextTime = Time.time + m_IntervalSec;
}
public bool IsReady()
{
return ( Time.time > m_NextTime ) ;
}
float m_NextTime = 0.0f ;
float m_IntervalSec = float.MaxValue ;
}
|
using UnityEngine;
public class CountDownTimer
{
public float IntervalSec { get{return m_IntervalSec;} set{ m_IntervalSec = value ;} }
public void Rewind()
{
m_NextTime = Time.time + m_IntervalSec;
}
public bool IsReady()
{
return ( Time.time > m_NextTime ) ;
}
float m_NextTime = 0.0f ;
float m_IntervalSec = float.MaxValue ;
}
|
mit
|
C#
|
d6d91f90e71d8df65705f4a29153b317c402de04
|
Fix unity plugin installation for uber repo
|
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
|
resharper/resharper-unity/src/Unity.Rider/Integration/UnityEditorIntegration/EditorPlugin/PluginPathsProvider.cs
|
resharper/resharper-unity/src/Unity.Rider/Integration/UnityEditorIntegration/EditorPlugin/PluginPathsProvider.cs
|
using System.IO;
using System.Reflection;
using JetBrains.Application.Environment;
using JetBrains.ProjectModel;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.Rider.Integration.UnityEditorIntegration.EditorPlugin
{
[SolutionComponent]
public class PluginPathsProvider
{
private readonly ApplicationPackages myApplicationPackages;
private readonly IDeployedPackagesExpandLocationResolver myResolver;
private readonly FileSystemPath myRootDir;
public static readonly string BasicPluginDllFile = "JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll";
public static readonly string Unity56PluginDllFile = "JetBrains.Rider.Unity.Editor.Plugin.Unity56.Repacked.dll";
public static readonly string FullPluginDllFile = "JetBrains.Rider.Unity.Editor.Plugin.Full.Repacked.dll";
public PluginPathsProvider(ApplicationPackages applicationPackages, IDeployedPackagesExpandLocationResolver resolver)
{
// System.Diagnostics.Debugger.Launch();
myApplicationPackages = applicationPackages;
myResolver = resolver;
myRootDir = GetRootDir();
}
public VirtualFileSystemPath GetEditorPluginPathDir()
{
var editorPluginPathDir = myRootDir.Combine(@"EditorPlugin");
return editorPluginPathDir.ToVirtualFileSystemPath();
}
public bool ShouldRunInstallation()
{
// Avoid EditorPlugin installation when we run from the dotnet-products repository.
// For the dotnet-products repository EditorPlugin may not be compiled, it is optional
return !myRootDir.Combine("Product.Root").ExistsFile;
}
private FileSystemPath GetRootDir()
{
var assembly = Assembly.GetExecutingAssembly();
var package = myApplicationPackages.FindPackageWithAssembly(assembly, OnError.LogException);
var installDirectory = myResolver.GetDeployedPackageDirectory(package);
var root = installDirectory.Parent;
return root;
}
}
}
|
using System.IO;
using System.Reflection;
using JetBrains.Application.Environment;
using JetBrains.ProjectModel;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.Rider.Integration.UnityEditorIntegration.EditorPlugin
{
[SolutionComponent]
public class PluginPathsProvider
{
private readonly ApplicationPackages myApplicationPackages;
private readonly IDeployedPackagesExpandLocationResolver myResolver;
private readonly FileSystemPath myRootDir;
public static readonly string BasicPluginDllFile = "JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll";
public static readonly string Unity56PluginDllFile = "JetBrains.Rider.Unity.Editor.Plugin.Unity56.Repacked.dll";
public static readonly string FullPluginDllFile = "JetBrains.Rider.Unity.Editor.Plugin.Full.Repacked.dll";
public PluginPathsProvider(ApplicationPackages applicationPackages, IDeployedPackagesExpandLocationResolver resolver)
{
myApplicationPackages = applicationPackages;
myResolver = resolver;
myRootDir = GetRootDir();
}
public VirtualFileSystemPath GetEditorPluginPathDir()
{
var editorPluginPathDir = myRootDir.Combine(@"EditorPlugin");
return editorPluginPathDir.ToVirtualFileSystemPath();
}
public bool ShouldRunInstallation()
{
// Avoid EditorPlugin installation when we run from the dotnet-products repository.
// For the dotnet-products repository EditorPlugin may not be compiled, it is optional
return myRootDir.Combine("Product.Root").ExistsFile;
}
private FileSystemPath GetRootDir()
{
var assembly = Assembly.GetExecutingAssembly();
var package = myApplicationPackages.FindPackageWithAssembly(assembly, OnError.LogException);
var installDirectory = myResolver.GetDeployedPackageDirectory(package);
var root = installDirectory.Parent;
return root;
}
}
}
|
apache-2.0
|
C#
|
15ef156340c0e5c6d3221f7a415539eaba9cdab8
|
Update HomeController.cs
|
ealsur/globalazurecampar,ealsur/globalazurecampar
|
Controllers/HomeController.cs
|
Controllers/HomeController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
namespace globalazurecampar.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
namespace globalazurecampar.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
public IActionResult Error()
{
return View();
}
}
}
|
mit
|
C#
|
53a3fa640b65cc1b6c07c3ddd67a9d49c04fd6fd
|
remove unused code
|
minhdu/UIMan
|
Assets/UnuGames/UIManExample/Scripts/StartGame.cs
|
Assets/UnuGames/UIManExample/Scripts/StartGame.cs
|
using UnityEngine;
using System.Collections;
using UnuGames;
public class StartGame : MonoBehaviour {
// Use this for initialization
void Start () {
UIMan.Instance.ShowScreen<UIMainMenu> ();
}
// Update is called once per frame
void Update () {
}
}
|
using UnityEngine;
using System.Collections;
using UnuGames;
public class StartGame : MonoBehaviour {
// Use this for initialization
void Start () {
UIMan.Instance.Preload<UIMainMenu> ();
UIMan.Instance.ShowScreen<UIMainMenu> ();
}
// Update is called once per frame
void Update () {
}
}
|
mit
|
C#
|
e1ba2f80002585a0968db5560345c3b03e8f8bd5
|
fix error => works as expected
|
jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets
|
BuildViews/FrameworkWeb/Views/Home/Contact.cshtml
|
BuildViews/FrameworkWeb/Views/Home/Contact.cshtml
|
@model FrameworkWeb.Models.CompanyInfo
@{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
@Model.PhoneNumber
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>
|
@model FrameworkWeb.Models.CompanyInfo
@{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
@Model.PhoneNubmer
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>
|
apache-2.0
|
C#
|
2ed76c02b17a6e61fdc462877a7e8901b89136de
|
Enhance version number to `v1.1.1' after inclusion of Fabio's patch.
|
massimo-nocentini/network-reasoner,massimo-nocentini/network-reasoner,massimo-nocentini/network-reasoner
|
it.unifi.dsi.stlab.networkreasoner.gas.system.terranova/VersioningInfo.cs
|
it.unifi.dsi.stlab.networkreasoner.gas.system.terranova/VersioningInfo.cs
|
using System;
namespace it.unifi.dsi.stlab.networkreasoner.gas.system.terranova
{
public class VersioningInfo
{
/// <summary>
/// Gets the version number.
///
/// Here are the stack of versions with a brief description:
///
/// v1.1.1: tuning computational parameter to handle middle and low pressure networks.
///
/// v1.1.0: introduce pressure regulator gadget for edges.
///
/// v1.0.1: enhancement to tackle turbolent behavior due to
/// Reynolds number.
///
/// v1.0.0: basic version with checker about negative pressures
/// associated to nodes with load gadget.
///
/// </summary>
/// <value>The version number.</value>
public String VersionNumber {
get {
return "v1.1.1";
}
}
public String EngineIdentifier {
get {
return "Network Reasoner, stlab.dsi.unifi.it";
}
}
}
}
|
using System;
namespace it.unifi.dsi.stlab.networkreasoner.gas.system.terranova
{
public class VersioningInfo
{
/// <summary>
/// Gets the version number.
///
/// Here are the stack of versions with a brief description:
///
/// v1.1.0: introduce pressure regulator gadget for edges.
///
/// v1.0.1: enhancement to tackle turbolent behavior due to
/// Reynolds number.
///
/// v1.0.0: basic version with checker about negative pressures
/// associated to nodes with load gadget.
///
/// </summary>
/// <value>The version number.</value>
public String VersionNumber {
get {
return "v1.1.0";
}
}
public String EngineIdentifier {
get {
return "Network Reasoner, stlab.dsi.unifi.it";
}
}
}
}
|
mit
|
C#
|
b04a764d7b49fd79ffb89bb1c8c7d90247d93fad
|
Update repo link
|
martincostello/api,martincostello/api,martincostello/api
|
src/API/Views/Home/Index.cshtml
|
src/API/Views/Home/Index.cshtml
|
@using System.Reflection
@{
ViewBag.Title = "Home Page";
string? mvcVersion = typeof(Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions)
.GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
SiteOptions options = Options.Value;
}
<div class="jumbotron">
<h1>Martin Costello's API</h1>
<p class="lead">
This website is an excercise in the use of ASP.NET Core @Environment.Version.ToString(2) for a website and REST API.
</p>
</div>
<div>
<p>
This website is hosted in <a href="https://azure.microsoft.com" rel="noopener" target="_blank" title="Microsoft Azure">Microsoft Azure</a>
and the source code can be found on <a href="@options.Metadata?.Repository" rel="noopener" target="_blank" title="This application's GitHub repository">GitHub</a>.
</p>
<p>
It is currently running <a href="https://github.com/dotnet/aspnetcore" rel="noopener" target="_blank" title="ASP.NET Core on GitHub">ASP.NET Core @mvcVersion</a>.
</p>
</div>
<div class="row">
<div class="col-lg-6">
<h2 class="h3">Website</h2>
<p>My main website.</p>
<p><a id="link-website" href="@options.Metadata?.Author?.Website" class="btn btn-lg btn-primary" rel="noopener" role="button" target="_blank" title="Visit my website">Visit website »</a></p>
</div>
<div class="col-lg-6">
<h2 class="h3">Blog</h2>
<p>I occasionally blog about topics related to .NET development.</p>
<p><a id="link-blog" href="@options.ExternalLinks?.Blog?.AbsoluteUri" class="btn btn-lg btn-primary" rel="noopener" role="button" target="_blank" title="Visit my blog">Visit blog »</a></p>
</div>
</div>
|
@using System.Reflection
@{
ViewBag.Title = "Home Page";
string? mvcVersion = typeof(Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions)
.GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
SiteOptions options = Options.Value;
}
<div class="jumbotron">
<h1>Martin Costello's API</h1>
<p class="lead">
This website is an excercise in the use of ASP.NET Core @Environment.Version.ToString(2) for a website and REST API.
</p>
</div>
<div>
<p>
This website is hosted in <a href="https://azure.microsoft.com" rel="noopener" target="_blank" title="Microsoft Azure">Microsoft Azure</a>
and the source code can be found on <a href="@options.Metadata?.Repository" rel="noopener" target="_blank" title="This application's GitHub repository">GitHub</a>.
</p>
<p>
It is currently running <a href="https://github.com/aspnet/AspNetCore" rel="noopener" target="_blank" title="ASP.NET Core on GitHub">ASP.NET Core @mvcVersion</a>.
</p>
</div>
<div class="row">
<div class="col-lg-6">
<h2 class="h3">Website</h2>
<p>My main website.</p>
<p><a id="link-website" href="@options.Metadata?.Author?.Website" class="btn btn-lg btn-primary" rel="noopener" role="button" target="_blank" title="Visit my website">Visit website »</a></p>
</div>
<div class="col-lg-6">
<h2 class="h3">Blog</h2>
<p>I occasionally blog about topics related to .NET development.</p>
<p><a id="link-blog" href="@options.ExternalLinks?.Blog?.AbsoluteUri" class="btn btn-lg btn-primary" rel="noopener" role="button" target="_blank" title="Visit my blog">Visit blog »</a></p>
</div>
</div>
|
mit
|
C#
|
c7a14a25f52dfeee123123cb98b36675831435ac
|
Update build number
|
deluxetiky/FluentValidation,robv8r/FluentValidation,mgmoody42/FluentValidation,pacificIT/FluentValidation,olcayseker/FluentValidation,roend83/FluentValidation,ruisebastiao/FluentValidation,roend83/FluentValidation,regisbsb/FluentValidation,cecilphillip/FluentValidation,glorylee/FluentValidation,IRlyDontKnow/FluentValidation,GDoronin/FluentValidation
|
src/CommonAssemblyInfo.cs
|
src/CommonAssemblyInfo.cs
|
#region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
[assembly : AssemblyTitle("FluentValidation")]
[assembly : AssemblyDescription("FluentValidation")]
[assembly : AssemblyProduct("FluentValidation")]
[assembly : AssemblyCopyright("Copyright (c) Jeremy Skinner 2008-2012")]
[assembly : ComVisible(false)]
[assembly : AssemblyVersion("3.4.2.0")]
[assembly : AssemblyFileVersion("3.4.2.0")]
[assembly: CLSCompliant(true)]
#if !SILVERLIGHT
[assembly: AllowPartiallyTrustedCallers]
#endif
|
#region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
[assembly : AssemblyTitle("FluentValidation")]
[assembly : AssemblyDescription("FluentValidation")]
[assembly : AssemblyProduct("FluentValidation")]
[assembly : AssemblyCopyright("Copyright (c) Jeremy Skinner 2008-2012")]
[assembly : ComVisible(false)]
[assembly : AssemblyVersion("3.4.0.0")]
[assembly : AssemblyFileVersion("3.4.0.0")]
[assembly: CLSCompliant(true)]
#if !SILVERLIGHT
[assembly: AllowPartiallyTrustedCallers]
#endif
|
apache-2.0
|
C#
|
e13200299e7c6cf504a19ef8ed3521cc26e0931e
|
add authentication to validation controller
|
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
|
services/api/Tweek.ApiService.NetCore/Controllers/ValidationController.cs
|
services/api/Tweek.ApiService.NetCore/Controllers/ValidationController.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Engine.Drivers.Rules;
using Engine.Rules.Validation;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Tweek.ApiService.NetCore.Security;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace Tweek.ApiService.NetCore.Controllers
{
[Route("validation")]
public class ValidationController : Controller
{
private readonly Validator.ValidationDelegate mValidateRules;
public ValidationController(Validator.ValidationDelegate validateRules)
{
mValidateRules = validateRules;
}
[HttpPost]
public async Task<ActionResult> Validate()
{
if (!User.IsTweekIdentity()) return Forbid();
Dictionary<string, RuleDefinition> ruleset = null;
try
{
var raw = await (new StreamReader(HttpContext.Request.Body).ReadToEndAsync());
ruleset = JsonConvert.DeserializeObject<Dictionary<string, RuleDefinition>>(raw);
}
catch (Exception)
{
return BadRequest("invalid ruleset");
}
return await mValidateRules(ruleset) ? (ActionResult)Content("true") : BadRequest("invalid ruleset");
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Engine.Core.Rules;
using Engine.Drivers.Rules;
using Engine.Rules.Creation;
using Engine.Rules.Validation;
using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Newtonsoft.Json;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace Tweek.ApiService.NetCore.Controllers
{
[Route("validation")]
public class ValidationController : Controller
{
private readonly Validator.ValidationDelegate mValidateRules;
public ValidationController(Validator.ValidationDelegate validateRules)
{
mValidateRules = validateRules;
}
[HttpPost]
public async Task<ActionResult> Validate()
{
Dictionary<string, RuleDefinition> ruleset = null;
try
{
var raw = await (new StreamReader(HttpContext.Request.Body).ReadToEndAsync());
ruleset = JsonConvert.DeserializeObject<Dictionary<string, RuleDefinition>>(raw);
}
catch (Exception)
{
return BadRequest("invalid ruleset");
}
return await mValidateRules(ruleset) ? (ActionResult)Content("true") : BadRequest("invalid ruleset");
}
}
}
|
mit
|
C#
|
6b110599e7a1c59d21ee96fdef9e427cdf8e5adf
|
add GetFirstEdgeCustom to INode
|
matiii/Dijkstra.NET
|
src/Dijkstra.NET/Graph/INode.cs
|
src/Dijkstra.NET/Graph/INode.cs
|
using System;
namespace Dijkstra.NET.Graph
{
public interface INode
{
uint Key { get; }
}
public interface INode<T, TEdgeCustom> : INode where TEdgeCustom : IEquatable<TEdgeCustom>
{
T Item { get; }
TEdgeCustom GetFirstEdgeCustom(int nodeEdgeKey);
}
}
|
using System;
namespace Dijkstra.NET.Graph
{
public interface INode
{
uint Key { get; }
}
public interface INode<T, TEdgeCustom> : INode where TEdgeCustom : IEquatable<TEdgeCustom>
{
T Item { get; }
}
}
|
mit
|
C#
|
c678cd61e8a39c26781fcc18938eb31b3f7aea93
|
rename the list action
|
SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery
|
AstroPhotoGallery/AstroPhotoGallery/Controllers/TagController.cs
|
AstroPhotoGallery/AstroPhotoGallery/Controllers/TagController.cs
|
using AstroPhotoGallery.Extensions;
using AstroPhotoGallery.Models;
using PagedList;
using System.Data.Entity;
using System.Linq;
using System.Web.Mvc;
namespace AstroPhotoGallery.Controllers
{
public class TagController : Controller
{
//
// GET: Tag/ListPicsWithTag/id
public ActionResult ListPicsWithTag(int? id, int? page)
{
if (id == null)
{
this.AddNotification("No tag ID provided.", NotificationType.ERROR);
return RedirectToAction("Index", "Home");
}
using (var db = new GalleryDbContext())
{
//Get pictures from db
var pictures = db.Tags
.Include(t => t.Pictures.Select(p => p.Tags))
.Include(t => t.Pictures.Select(p => p.PicUploader))
.FirstOrDefault(t => t.Id == id)
.Pictures
.OrderByDescending(p => p.Id)
.ToList();
//Return the view
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(pictures.ToPagedList(pageNumber, pageSize));
}
}
}
}
|
using AstroPhotoGallery.Extensions;
using AstroPhotoGallery.Models;
using PagedList;
using System.Data.Entity;
using System.Linq;
using System.Web.Mvc;
namespace AstroPhotoGallery.Controllers
{
public class TagController : Controller
{
//
// GET: Tag/List/id
public ActionResult List(int? id, int? page)
{
if (id == null)
{
this.AddNotification("No tag ID provided.", NotificationType.ERROR);
return RedirectToAction("Index", "Home");
}
using (var db = new GalleryDbContext())
{
//Get pictures from db
var pictures = db.Tags
.Include(t => t.Pictures.Select(p => p.Tags))
.Include(t => t.Pictures.Select(p => p.PicUploader))
.FirstOrDefault(t => t.Id == id)
.Pictures
.OrderByDescending(p => p.Id)
.ToList();
//Return the view
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(pictures.ToPagedList(pageNumber, pageSize));
}
}
}
}
|
mit
|
C#
|
011030648ab129c72b72adb079a9edf4028a4b75
|
Comment added and cleaning
|
alexandredubois/openapi-csharp-client
|
Cdiscount.OpenApi.ProxyClient/Contract/Request/GetCartRequest.cs
|
Cdiscount.OpenApi.ProxyClient/Contract/Request/GetCartRequest.cs
|
using System;
namespace Cdiscount.OpenApi.ProxyClient.Contract.Request
{
/// <summary>
/// GetCart request object
/// </summary>
public class GetCartRequest
{
/// <summary>
/// Cart identifier
/// </summary>
public Guid CartGuid { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cdiscount.OpenApi.ProxyClient.Contract.Request
{
/// <summary>
/// GetCart request object
/// </summary>
public class GetCartRequest
{
public Guid CartGuid { get; set; }
}
}
|
mit
|
C#
|
00fbc8c5a94bde60e5f84e80ac8dd6b6da3ca310
|
Fix missed RelocatedType annotation
|
cshung/coreclr,poizan42/coreclr,wtgodbe/coreclr,cshung/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,poizan42/coreclr,krk/coreclr,krk/coreclr,cshung/coreclr,krk/coreclr,wtgodbe/coreclr,poizan42/coreclr,wtgodbe/coreclr,poizan42/coreclr,cshung/coreclr,poizan42/coreclr,krk/coreclr,cshung/coreclr,cshung/coreclr,poizan42/coreclr,wtgodbe/coreclr,krk/coreclr,krk/coreclr
|
src/System.Private.CoreLib/shared/System/Security/Principal/IPrincipal.cs
|
src/System.Private.CoreLib/shared/System/Security/Principal/IPrincipal.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
// All roles will implement this interface
//
using System;
namespace System.Security.Principal
{
#if PROJECTN
[Internal.Runtime.CompilerServices.RelocatedType("System.Security.Principal")]
#endif
public interface IPrincipal
{
// Retrieve the identity object
IIdentity Identity { get; }
// Perform a check for a specific role
bool IsInRole(string role);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
// All roles will implement this interface
//
using System;
namespace System.Security.Principal
{
public interface IPrincipal
{
// Retrieve the identity object
IIdentity Identity { get; }
// Perform a check for a specific role
bool IsInRole(string role);
}
}
|
mit
|
C#
|
7546373f9456bdc710166481bb30dfc30677c55b
|
Fix test asserting between int and uint
|
tgstation/tgstation-server,tgstation/tgstation-server,tgstation/tgstation-server-tools
|
tests/Tgstation.Server.Tests/Instance/DeploymentTest.cs
|
tests/Tgstation.Server.Tests/Instance/DeploymentTest.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Client.Components;
namespace Tgstation.Server.Tests.Instance
{
sealed class DeploymentTest : JobsRequiredTest
{
readonly IDreamMakerClient dreamMakerClient;
readonly IDreamDaemonClient dreamDaemonClient;
public DeploymentTest(IDreamMakerClient dreamMakerClient, IDreamDaemonClient dreamDaemonClient, IJobsClient jobsClient) : base(jobsClient)
{
this.dreamMakerClient = dreamMakerClient ?? throw new ArgumentNullException(nameof(dreamMakerClient));
this.dreamDaemonClient = dreamDaemonClient ?? throw new ArgumentNullException(nameof(dreamDaemonClient));
}
public async Task Run(Task repositoryTask, CancellationToken cancellationToken)
{
Assert.IsFalse(repositoryTask.IsCompleted);
var deployJob = await dreamMakerClient.Compile(cancellationToken);
deployJob = await WaitForJob(deployJob, 30, true, null, cancellationToken);
Assert.IsTrue(deployJob.ErrorCode == ErrorCode.RepoCloning || deployJob.ErrorCode == ErrorCode.RepoMissing);
var dmSettings = await dreamMakerClient.Read(cancellationToken);
Assert.AreEqual(true, dmSettings.RequireDMApiValidation);
Assert.AreEqual(null, dmSettings.ProjectName);
await repositoryTask;
// by alphabetization rules, it should discover api_free here
var updatedDD = await dreamDaemonClient.Update(new DreamDaemon
{
StartupTimeout = 5
}, cancellationToken);
Assert.AreEqual(5U, updatedDD.StartupTimeout);
deployJob = await dreamMakerClient.Compile(cancellationToken);
await WaitForJob(deployJob, 30, true, ErrorCode.DreamMakerNeverValidated, cancellationToken);
const string FailProject = "tests/DMAPI/BuildFail/build_fail";
var updated = await dreamMakerClient.Update(new DreamMaker
{
ProjectName = FailProject
}, cancellationToken);
Assert.AreEqual(FailProject, updated.ProjectName);
deployJob = await dreamMakerClient.Compile(cancellationToken);
await WaitForJob(deployJob, 30, true, ErrorCode.DreamMakerExitCode, cancellationToken);
await dreamMakerClient.Update(new DreamMaker
{
ProjectName = "tests/DMAPI/ThisDoesntExist/this_doesnt_exist"
}, cancellationToken);
deployJob = await dreamMakerClient.Compile(cancellationToken);
await WaitForJob(deployJob, 30, true, ErrorCode.DreamMakerMissingDme, cancellationToken);
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Client.Components;
namespace Tgstation.Server.Tests.Instance
{
sealed class DeploymentTest : JobsRequiredTest
{
readonly IDreamMakerClient dreamMakerClient;
readonly IDreamDaemonClient dreamDaemonClient;
public DeploymentTest(IDreamMakerClient dreamMakerClient, IDreamDaemonClient dreamDaemonClient, IJobsClient jobsClient) : base(jobsClient)
{
this.dreamMakerClient = dreamMakerClient ?? throw new ArgumentNullException(nameof(dreamMakerClient));
this.dreamDaemonClient = dreamDaemonClient ?? throw new ArgumentNullException(nameof(dreamDaemonClient));
}
public async Task Run(Task repositoryTask, CancellationToken cancellationToken)
{
Assert.IsFalse(repositoryTask.IsCompleted);
var deployJob = await dreamMakerClient.Compile(cancellationToken);
deployJob = await WaitForJob(deployJob, 30, true, null, cancellationToken);
Assert.IsTrue(deployJob.ErrorCode == ErrorCode.RepoCloning || deployJob.ErrorCode == ErrorCode.RepoMissing);
var dmSettings = await dreamMakerClient.Read(cancellationToken);
Assert.AreEqual(true, dmSettings.RequireDMApiValidation);
Assert.AreEqual(null, dmSettings.ProjectName);
await repositoryTask;
// by alphabetization rules, it should discover api_free here
var updatedDD = await dreamDaemonClient.Update(new DreamDaemon
{
StartupTimeout = 5
}, cancellationToken);
Assert.AreEqual(5, updatedDD.StartupTimeout);
deployJob = await dreamMakerClient.Compile(cancellationToken);
await WaitForJob(deployJob, 30, true, ErrorCode.DreamMakerNeverValidated, cancellationToken);
const string FailProject = "tests/DMAPI/BuildFail/build_fail";
var updated = await dreamMakerClient.Update(new DreamMaker
{
ProjectName = FailProject
}, cancellationToken);
Assert.AreEqual(FailProject, updated.ProjectName);
deployJob = await dreamMakerClient.Compile(cancellationToken);
await WaitForJob(deployJob, 30, true, ErrorCode.DreamMakerExitCode, cancellationToken);
await dreamMakerClient.Update(new DreamMaker
{
ProjectName = "tests/DMAPI/ThisDoesntExist/this_doesnt_exist"
}, cancellationToken);
deployJob = await dreamMakerClient.Compile(cancellationToken);
await WaitForJob(deployJob, 30, true, ErrorCode.DreamMakerMissingDme, cancellationToken);
}
}
}
|
agpl-3.0
|
C#
|
5c5fa26a0d6fc58212aa434f227ed7ccc57ddd12
|
Add build targets for npm.
|
FacilityApi/FacilityJavaScript,FacilityApi/FacilityJavaScript,FacilityApi/FacilityJavaScript
|
tools/Build/Build.cs
|
tools/Build/Build.cs
|
using System;
using System.Linq;
using Faithlife.Build;
using static Faithlife.Build.AppRunner;
using static Faithlife.Build.BuildUtility;
using static Faithlife.Build.DotNetRunner;
return BuildRunner.Execute(args, build =>
{
var codegen = "fsdgenjs";
var gitLogin = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? "");
var dotNetBuildSettings = new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = gitLogin,
GitAuthor = new GitAuthorInfo("FacilityApiBot", "facilityapi@gmail.com"),
SourceCodeUrl = "https://github.com/FacilityApi/FacilityJavaScript/tree/master/src",
ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
},
PackageSettings = new DotNetPackageSettings
{
GitLogin = gitLogin,
PushTagOnPublish = x => $"nuget.{x.Version}",
},
};
build.AddDotNetTargets(dotNetBuildSettings);
build.Target("codegen")
.DependsOn("build")
.Describe("Generates code from the FSD")
.Does(() => CodeGen(verify: false));
build.Target("verify-codegen")
.DependsOn("build")
.Describe("Ensures the generated code is up-to-date")
.Does(() => CodeGen(verify: true));
build.Target("test")
.DependsOn("verify-codegen");
void CodeGen(bool verify)
{
var configuration = dotNetBuildSettings.GetConfiguration();
var toolPath = FindFiles($"src/{codegen}/bin/{configuration}/net5.0/{codegen}.dll").FirstOrDefault() ?? throw new BuildException($"Missing {codegen}.dll.");
var verifyOption = verify ? "--verify" : null;
RunDotNet(toolPath, "example/ExampleApi.fsd", "example/js/", "--indent", "2", "--express", "--disable-eslint", "--newline", "lf", verifyOption);
RunDotNet(toolPath, "example/ExampleApi.fsd", "example/ts/src/", "--typescript", "--express", "--disable-eslint", "--newline", "lf", verifyOption);
}
build.Target("build-npm")
.Describe("Builds the npm package.")
.Does(() =>
{
RunNpmFrom("./ts", "install");
RunNpmFrom("./ts", "run", "build");
});
build.Target("test-npm")
.DependsOn("build-npm")
.Describe("Tests the npm package.")
.Does(() =>
{
RunNpmFrom("./ts", "run", "test");
RunNpmFrom("./example/js", "run", "test");
RunNpmFrom("./example/ts", "run", "test");
});
build.Target("publish-npm")
.DependsOn("test-npm")
.Describe("Publishes the npm package.")
.Does(() =>
{
RunNpmFrom("./ts", "publish");
});
void RunNpmFrom(string directory, params string[] args) =>
RunApp("npm",
new AppRunnerSettings
{
Arguments = args,
WorkingDirectory = directory,
UseCmdOnWindows = true,
});
});
|
using System;
using System.Linq;
using Faithlife.Build;
using static Faithlife.Build.BuildUtility;
using static Faithlife.Build.DotNetRunner;
return BuildRunner.Execute(args, build =>
{
var codegen = "fsdgenjs";
var gitLogin = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? "");
var dotNetBuildSettings = new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = gitLogin,
GitAuthor = new GitAuthorInfo("FacilityApiBot", "facilityapi@gmail.com"),
SourceCodeUrl = "https://github.com/FacilityApi/FacilityJavaScript/tree/master/src",
ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
},
PackageSettings = new DotNetPackageSettings
{
GitLogin = gitLogin,
PushTagOnPublish = x => $"nuget.{x.Version}",
},
};
build.AddDotNetTargets(dotNetBuildSettings);
build.Target("codegen")
.DependsOn("build")
.Describe("Generates code from the FSD")
.Does(() => CodeGen(verify: false));
build.Target("verify-codegen")
.DependsOn("build")
.Describe("Ensures the generated code is up-to-date")
.Does(() => CodeGen(verify: true));
build.Target("test")
.DependsOn("verify-codegen");
void CodeGen(bool verify)
{
var configuration = dotNetBuildSettings.GetConfiguration();
var toolPath = FindFiles($"src/{codegen}/bin/{configuration}/net5.0/{codegen}.dll").FirstOrDefault() ?? throw new BuildException($"Missing {codegen}.dll.");
var verifyOption = verify ? "--verify" : null;
RunDotNet(toolPath, "example/ExampleApi.fsd", "example/js/", "--indent", "2", "--express", "--disable-eslint", "--newline", "lf", verifyOption);
RunDotNet(toolPath, "example/ExampleApi.fsd", "example/ts/src/", "--typescript", "--express", "--disable-eslint", "--newline", "lf", verifyOption);
}
});
|
mit
|
C#
|
b24fce0ab2eeb79419c32d16fa128809e23ced90
|
Add more fields to search
|
joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,kirillkos/joinrpg-net
|
JoinRpg.Services.Impl/Search/SearchServiceImpl.cs
|
JoinRpg.Services.Impl/Search/SearchServiceImpl.cs
|
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using JoinRpg.Dal.Impl;
using JoinRpg.DataModel;
using JoinRpg.Services.Interfaces;
using JoinRpg.Services.Interfaces.Search;
namespace JoinRpg.Services.Impl.Search
{
[UsedImplicitly]
public class SearchServiceImpl : DbServiceImplBase, ISearchService
{
public SearchServiceImpl(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
public async Task<IReadOnlyCollection<ISearchResult>> SearchAsync(string searchString)
{
var searchTasks = GetProviders().Select(p => p.SearchAsync(searchString)).ToList(); //Starting searches
//TODO: Ths is not correct way to do it. We must consume it one-by-one until we have X values. When we have X, we should cancel other requests
var result = await Task.WhenAll(searchTasks);
return result.SelectMany(resultGroup => resultGroup).ToList().AsReadOnly(); //Waiting for results
}
private IEnumerable<ISearchProvider> GetProviders()
{
yield return new UserSearchProvider {UnitOfWork = UnitOfWork};
}
}
internal class UserSearchProvider : ISearchProvider
{
public IUnitOfWork UnitOfWork { private get; set; }
public async Task<IReadOnlyCollection<ISearchResult>> SearchAsync(string searchString)
{
var results =
await
UnitOfWork.GetDbSet<User>()
.Where(user =>
//TODO There should be magic way to do this. Experiment with Expression.Voodoo
user.Email.Contains(searchString)
|| user.FatherName.Contains(searchString)
|| user.BornName.Contains(searchString)
|| user.SurName.Contains(searchString)
)
.ToListAsync();
return results.Select(user => new SearchResultImpl
{
Type = SearchResultType.ResultUser,
Name = user.DisplayName,
Description = user.FullName,
FoundValue = user.Email,
Identification = user.UserId.ToString()
}).ToList();
}
}
internal class SearchResultImpl : ISearchResult
{
public SearchResultType Type { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string FoundValue { get; set; }
public string Identification { get; set; }
}
internal interface ISearchProvider
{
Task<IReadOnlyCollection<ISearchResult>> SearchAsync(string searchString);
}
}
|
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JetBrains.Annotations;
using JoinRpg.Dal.Impl;
using JoinRpg.DataModel;
using JoinRpg.Services.Interfaces;
using JoinRpg.Services.Interfaces.Search;
namespace JoinRpg.Services.Impl.Search
{
[UsedImplicitly]
public class SearchServiceImpl : DbServiceImplBase, ISearchService
{
public SearchServiceImpl(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
public async Task<IReadOnlyCollection<ISearchResult>> SearchAsync(string searchString)
{
var searchTasks = GetProviders().Select(p => p.SearchAsync(searchString)).ToList(); //Starting searches
var result = await Task.WhenAll(searchTasks);
return result.SelectMany(resultGroup => resultGroup).ToList().AsReadOnly(); //Waiting for results
}
private IEnumerable<ISearchProvider> GetProviders()
{
yield return new UserSearchProvider {UnitOfWork = UnitOfWork};
}
}
internal class UserSearchProvider : ISearchProvider
{
public IUnitOfWork UnitOfWork { private get; set; }
public async Task<IReadOnlyCollection<ISearchResult>> SearchAsync(string searchString)
{
return
await
UnitOfWork.GetDbSet<User>()
.Where(user => user.Email.Contains(searchString))
.Select(user => new SearchResultImpl
{
Type = SearchResultType.ResultUser,
Name = user.UserName,
Description = "",
FoundValue = user.Email,
Identification = user.UserId.ToString()
}).ToListAsync();
}
}
internal class SearchResultImpl : ISearchResult
{
public SearchResultType Type { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string FoundValue { get; set; }
public string Identification { get; set; }
}
internal interface ISearchProvider
{
Task<IReadOnlyCollection<ISearchResult>> SearchAsync(string searchString);
IUnitOfWork UnitOfWork { set; }
}
}
|
mit
|
C#
|
e019fdbb75777f84e8b004a0a7d67247587460bb
|
Fix SGD
|
kawatan/Milk
|
Megalopolis/Optimizers/SGD.cs
|
Megalopolis/Optimizers/SGD.cs
|
using System;
namespace Megalopolis
{
namespace Optimizers
{
public class SGD : IOptimizer
{
public double lr = 0.001; // Learning rate
public SGD() { }
public SGD(double lr)
{
this.lr = lr;
}
public double Optimize(int index, double weight, double gradient)
{
return weight - this.lr * gradient;
}
}
}
}
|
using System;
namespace Megalopolis.Optimizers
{
public class SGD
{
public double lr = 0.001; // Learning rate
public SGD() { }
public SGD(double lr)
{
this.lr = lr;
}
public double Optimize(int index, double weight, double gradient)
{
return weight - this.lr * gradient;
}
}
}
|
apache-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.