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 |
---|---|---|---|---|---|---|---|---|
3606a2c3120bf26148beb0ca46b728950056874a | Change StartJobsAsync to work on the generic host | mrahhal/MR.AspNetCore.Jobs,mrahhal/MR.AspNetCore.Jobs | src/MR.AspNetCore.Jobs/JobsServiceProviderExtensions.cs | src/MR.AspNetCore.Jobs/JobsServiceProviderExtensions.cs | using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace MR.AspNetCore.Jobs
{
public static class JobsWebHostExtensions
{
public static Task StartJobsAsync(this IHost host)
{
var bootstrapper = host.Services.GetRequiredService<IBootstrapper>();
return bootstrapper.BootstrapAsync();
}
}
}
| using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace MR.AspNetCore.Jobs
{
public static class JobsWebHostExtensions
{
public static Task StartJobsAsync(this IWebHost host)
{
var bootstrapper = host.Services.GetRequiredService<IBootstrapper>();
return bootstrapper.BootstrapAsync();
}
}
}
| mit | C# |
a07a889c259af34615661aa5e3580f93c69f3958 | Fix culture | BioWareRu/BioEngine,BioWareRu/BioEngine,BioWareRu/BioEngine | src/BioEngine.Admin/Startup.cs | src/BioEngine.Admin/Startup.cs | using AntDesign.ProLayout;
using BioEngine.Core;
using FluentValidation;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Sitko.Core.App.Web;
namespace BioEngine.Admin
{
public class Startup : BioEngineStartup
{
public Startup(IConfiguration configuration, IHostEnvironment environment) : base(configuration, environment)
{
}
protected override void ConfigureAppServices(IServiceCollection services)
{
base.ConfigureAppServices(services);
services.AddRazorPages(options =>
{
options.Conventions.AuthorizeFolder("/");
});
services.Configure<ProSettings>(settings =>
{
settings.NavTheme = "dark";
settings.Title = "BRCGames";
settings.FixedHeader = true;
});
services.AddValidatorsFromAssemblyContaining<Program>();
services.AddValidatorsFromAssemblyContaining<BioEngineApp<Startup>>();
}
protected override void ConfigureAfterRoutingMiddleware(IApplicationBuilder app)
{
base.ConfigureAfterRoutingMiddleware(app);
app.ConfigureLocalization("ru");
app.UseAuthentication();
app.UseAuthorization();
}
}
}
| using AntDesign.ProLayout;
using BioEngine.Core;
using FluentValidation;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Sitko.Core.App.Web;
namespace BioEngine.Admin
{
public class Startup : BioEngineStartup
{
public Startup(IConfiguration configuration, IHostEnvironment environment) : base(configuration, environment)
{
}
protected override void ConfigureAppServices(IServiceCollection services)
{
base.ConfigureAppServices(services);
services.AddRazorPages(options =>
{
options.Conventions.AuthorizeFolder("/");
});
services.Configure<ProSettings>(settings =>
{
settings.NavTheme = "dark";
settings.Title = "BRCGames";
settings.FixedHeader = true;
});
services.AddValidatorsFromAssemblyContaining<Program>();
services.AddValidatorsFromAssemblyContaining<BioEngineApp<Startup>>();
}
protected override void ConfigureAfterRoutingMiddleware(IApplicationBuilder app)
{
base.ConfigureAfterRoutingMiddleware(app);
app.ConfigureLocalization("ru-RU");
app.UseAuthentication();
app.UseAuthorization();
}
}
}
| mit | C# |
5bc0c5ed7553917fe756176b454fdeb7368926b4 | Add Escape const to Keyboard class. | 2gis/Winium.Cruciatus | src/Cruciatus/Core/Keyboard.cs | src/Cruciatus/Core/Keyboard.cs | namespace Cruciatus.Core
{
#region using
using NLog;
#endregion
public static class Keyboard
{
public const string Enter = "{ENTER}";
public const string Backspace = "{BACKSPACE}";
public const string Escape = "{ESCAPE}";
public const string CtrlA = "^a";
public const string CtrlC = "^c";
public const string CtrlV = "^v";
private static readonly Logger Logger = CruciatusFactory.Logger;
public static void SendKeys(string text)
{
Logger.Info("Send keys '{0}'", text);
System.Windows.Forms.SendKeys.SendWait(text);
}
public static void SendEnter()
{
SendKeys(Enter);
}
public static void SendBackspace()
{
SendKeys(Backspace);
}
public static void SendCtrlA()
{
SendKeys(CtrlA);
}
public static void SendCtrlC()
{
SendKeys(CtrlC);
}
public static void SendCtrlV()
{
SendKeys(CtrlV);
}
}
}
| namespace Cruciatus.Core
{
#region using
using NLog;
#endregion
public static class Keyboard
{
public const string Enter = "{ENTER}";
public const string Backspace = "{BACKSPACE}";
public const string CtrlA = "^a";
public const string CtrlC = "^c";
public const string CtrlV = "^v";
private static readonly Logger Logger = CruciatusFactory.Logger;
public static void SendKeys(string text)
{
Logger.Info("Send keys '{0}'", text);
System.Windows.Forms.SendKeys.SendWait(text);
}
public static void SendEnter()
{
SendKeys(Enter);
}
public static void SendBackspace()
{
SendKeys(Backspace);
}
public static void SendCtrlA()
{
SendKeys(CtrlA);
}
public static void SendCtrlC()
{
SendKeys(CtrlC);
}
public static void SendCtrlV()
{
SendKeys(CtrlV);
}
}
}
| mpl-2.0 | C# |
fb086b6017e3cc41bc093a1041951c569a2bac39 | add jsonrpc 2.0 property to json request | vmlf01/JsonRpc.CoreCLR.Client | src/JsonRpc.CoreCLR.Client/Models/JsonRpcRequest.cs | src/JsonRpc.CoreCLR.Client/Models/JsonRpcRequest.cs | using Newtonsoft.Json;
namespace JsonRpc.CoreCLR.Client.Models
{
[JsonObject(MemberSerialization.OptIn)]
public class JsonRpcRequest
{
public bool IsNotification { get; set; }
[JsonProperty(PropertyName = "jsonrpc")]
public string JsonRpc { get { return "2.0"; } }
[JsonProperty("method")]
public string Method { get; set; }
[JsonProperty("params")]
public object Params { get; set; }
[JsonProperty("id")]
public object Id { get; set; }
}
}
| using Newtonsoft.Json;
namespace JsonRpc.CoreCLR.Client.Models
{
[JsonObject(MemberSerialization.OptIn)]
public class JsonRpcRequest
{
public bool IsNotification { get; set; }
[JsonProperty("method")]
public string Method { get; set; }
[JsonProperty("params")]
public object Params { get; set; }
[JsonProperty("id")]
public object Id { get; set; }
}
}
| mit | C# |
703b4654da1aee62aad2944a10375a81b5f7b13a | fix spelling | mzboray/PSAutomation | src/PSAutomation/Commands/GetChildElementCommand.cs | src/PSAutomation/Commands/GetChildElementCommand.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Automation;
namespace PSAutomation.Commands
{
[Cmdlet(VerbsCommon.Get, "ChildElement")]
[OutputType(typeof(AutomationElement))]
public sealed class GetChildElementCommand : PSCmdlet
{
private readonly static Condition[] TrueCondition = new[] {
System.Windows.Automation.Condition.TrueCondition
};
[Parameter]
public AutomationElement Root { get; set; }
[Parameter]
public SwitchParameter Recurse { get; set; }
[Parameter]
public Condition[] Condition { get; set; }
protected override void ProcessRecord()
{
AutomationElement root = this.Root ?? AutomationElement.RootElement;
TreeScope scope = this.Recurse.IsPresent ? TreeScope.Descendants : TreeScope.Children;
Condition[] conditions = this.Condition ?? TrueCondition;
foreach(var condition in conditions)
{
var results = root.FindAll(scope, condition);
var wrappedResults = PSObjectFactory.WrapElements(results.OfType<AutomationElement>());
this.WriteObject(wrappedResults, true);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Automation;
namespace PSAutomation.Commands
{
[Cmdlet(VerbsCommon.Get, "ChildElement")]
[OutputType(typeof(AutomationElement))]
public sealed class GetChildElementCommand : PSCmdlet
{
private readonly static Condition[] TrueCondition = new[] {
System.Windows.Automation.Condition.TrueCondition
};
[Parameter]
public AutomationElement Root { get; set; }
[Parameter]
public SwitchParameter Recurse { get; set; }
[Parameter]
public Condition[] Condition { get; set; }
protected override void ProcessRecord()
{
AutomationElement root = this.Root ?? AutomationElement.RootElement;
TreeScope scope = this.Recurse.IsPresent ? TreeScope.Descendants : TreeScope.Children;
Condition[] conditions = this.Condition ?? TrueCondition;
foreach(var condition in conditions)
{
var results = root.FindAll(scope, condition);
var wrappedResuults = PSObjectFactory.WrapElements(results.OfType<AutomationElement>());
this.WriteObject(wrappedResuults, true);
}
}
}
}
| mit | C# |
8d608daa9e08aca7563aad7b1bba2dbf2903295d | Set the access token properly in the OAuth form | Glurmo/LiveSplit,Glurmo/LiveSplit,chloe747/LiveSplit,stoye/LiveSplit,zoton2/LiveSplit,kugelrund/LiveSplit,stoye/LiveSplit,chloe747/LiveSplit,Fluzzarn/LiveSplit,kugelrund/LiveSplit,Glurmo/LiveSplit,ROMaster2/LiveSplit,Dalet/LiveSplit,Fluzzarn/LiveSplit,Dalet/LiveSplit,zoton2/LiveSplit,Fluzzarn/LiveSplit,kugelrund/LiveSplit,ROMaster2/LiveSplit,chloe747/LiveSplit,zoton2/LiveSplit,ROMaster2/LiveSplit,LiveSplit/LiveSplit,stoye/LiveSplit,Dalet/LiveSplit | LiveSplit/LiveSplit.View/View/SpeedrunComOAuthForm.cs | LiveSplit/LiveSplit.View/View/SpeedrunComOAuthForm.cs | using LiveSplit.Options;
using System;
using System.Windows.Forms;
namespace LiveSplit.Web.Share
{
public partial class SpeedrunComOAuthForm : Form, ISpeedrunComAuthenticator
{
private string accessToken;
public SpeedrunComOAuthForm()
{
InitializeComponent();
}
void OAuthForm_Load(object sender, EventArgs e)
{
OAuthWebBrowser.Navigate(new Uri("http://www.speedrun.com/api/auth"));
}
private void OAuthWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
try
{
var html = OAuthWebBrowser.DocumentText;
var index = html.IndexOf("id=\"api-key\">");
var secondIndex = html.IndexOf("</code");
if (index >= 0 && secondIndex >= 0)
{
index = index + "id=\"api-key\">".Length;
accessToken = html.Substring(index, secondIndex - index);
try
{
ShareSettings.Default.SpeedrunComAccessToken = accessToken;
ShareSettings.Default.Save();
}
catch (Exception ex)
{
Log.Error(ex);
}
Action closeAction = () => Close();
if (InvokeRequired)
Invoke(closeAction);
else
closeAction();
}
}
catch (Exception ex)
{
Log.Error(ex);
}
}
public string GetAccessToken()
{
accessToken = null;
ShowDialog();
return accessToken;
}
}
}
| using LiveSplit.Options;
using System;
using System.Windows.Forms;
namespace LiveSplit.Web.Share
{
public partial class SpeedrunComOAuthForm : Form, ISpeedrunComAuthenticator
{
private string accessToken;
public SpeedrunComOAuthForm()
{
InitializeComponent();
}
void OAuthForm_Load(object sender, EventArgs e)
{
OAuthWebBrowser.Navigate(new Uri("http://www.speedrun.com/api/auth"));
}
private void OAuthWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
try
{
var html = OAuthWebBrowser.DocumentText;
var index = html.IndexOf("id=\"api-key\">");
var secondIndex = html.IndexOf("</code");
if (index >= 0 && secondIndex >= 0)
{
index = index + "id=\"api-key\">".Length;
var accessToken = html.Substring(index, secondIndex - index);
try
{
ShareSettings.Default.SpeedrunComAccessToken = accessToken;
ShareSettings.Default.Save();
}
catch (Exception ex)
{
Log.Error(ex);
}
Action closeAction = () => Close();
if (InvokeRequired)
Invoke(closeAction);
else
closeAction();
}
}
catch (Exception ex)
{
Log.Error(ex);
}
}
public string GetAccessToken()
{
accessToken = null;
ShowDialog();
return accessToken;
}
}
}
| mit | C# |
a8d8c8f4607e75a5ae8e9b0e0143b9c506095567 | Add one client control for each TabPage. | PenguinF/sandra-three | Eutherion/Win/Controls/GlyphTabControl.TabPage.cs | Eutherion/Win/Controls/GlyphTabControl.TabPage.cs | #region License
/*********************************************************************************
* GlyphTabControl.TabPage.cs
*
* Copyright (c) 2004-2020 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 System;
using System.Windows.Forms;
namespace Eutherion.Win.Controls
{
public partial class GlyphTabControl
{
/// <summary>
/// Represents a single tab page in a <see cref="GlyphTabControl"/>.
/// </summary>
public class TabPage
{
/// <summary>
/// Gets the client control for this tab page.
/// </summary>
public Control ClientControl { get; }
/// <summary>
/// Initializes a new instance of <see cref="TabPage"/>.
/// </summary>
/// <param name="clientControl">
/// The client control for this tab page.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="clientControl"/> is null.
/// </exception>
public TabPage(Control clientControl)
=> ClientControl = clientControl ?? throw new ArgumentNullException(nameof(clientControl));
}
}
}
| #region License
/*********************************************************************************
* GlyphTabControl.TabPage.cs
*
* Copyright (c) 2004-2020 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
namespace Eutherion.Win.Controls
{
public partial class GlyphTabControl
{
/// <summary>
/// Represents a single tab page in a <see cref="GlyphTabControl"/>.
/// </summary>
public class TabPage
{
}
}
}
| apache-2.0 | C# |
2eafd77e13d94618b40e8773eb23bd20bff830bd | Add new properties to message schema | MindscapeHQ/raygun4net,MindscapeHQ/raygun4net,MindscapeHQ/raygun4net | Mindscape.Raygun4Net/Messages/RaygunMessageDetails.cs | Mindscape.Raygun4Net/Messages/RaygunMessageDetails.cs | using System.Collections;
using System.Collections.Generic;
namespace Mindscape.Raygun4Net.Messages
{
public class RaygunMessageDetails
{
public string MachineName { get; set; }
public string GroupingKey { get; set; }
public string Version { get; set; }
public string CorrelationId { get; set; }
public string ContextId { get; set; }
public RaygunErrorMessage Error { get; set; }
public RaygunEnvironmentMessage Environment { get; set; }
public RaygunClientMessage Client { get; set; }
public IList<string> Tags { get; set; }
public IDictionary UserCustomData { get; set; }
public RaygunIdentifierMessage User { get; set; }
public RaygunRequestMessage Request { get; set; }
public RaygunResponseMessage Response { get; set; }
public IList<RaygunBreadcrumb> Breadcrumbs { get; set; }
}
} | using System.Collections;
using System.Collections.Generic;
namespace Mindscape.Raygun4Net.Messages
{
public class RaygunMessageDetails
{
public string MachineName { get; set; }
public string GroupingKey { get; set; }
public string Version { get; set; }
public RaygunErrorMessage Error { get; set; }
public RaygunEnvironmentMessage Environment { get; set; }
public RaygunClientMessage Client { get; set; }
public IList<string> Tags { get; set; }
public IDictionary UserCustomData { get; set; }
public RaygunIdentifierMessage User { get; set; }
public RaygunRequestMessage Request { get; set; }
public RaygunResponseMessage Response { get; set; }
public IList<RaygunBreadcrumb> Breadcrumbs { get; set; }
}
} | mit | C# |
b9d9a70b99f6c085bdf9da15a4184e0bbe8736c2 | Update "UCBookInformation" | DRFP/Personal-Library | _Build/PersonalLibrary/Base/UCBookInformation.xaml.cs | _Build/PersonalLibrary/Base/UCBookInformation.xaml.cs | using Library.Model;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using static Library.API;
namespace Base {
public partial class UCBookInformation : UserControl {
private Book book;
public UCBookInformation(Book book) {
InitializeComponent();
Margin = new Thickness(3, 0, 0, 0);
this.book = book;
if (book.booThumbnail != null) imgThumbnail.Source = new BitmapImage(new Uri(book.booThumbnail));
txbTitle.Text = book.booTitle;
txbDescription.Text = book.booDescription;
txbAuthor.Text = $"Author: {book.booAuthor}";
txbPublisher.Text = $"Publisher: {book.booPublisher}";
txbPublishedDate.Text = $"Published Date: {book.booPublishedDate}";
txbPageCount.Text = $"Page Count: {book.booPageCount}";
txbRating.Text = $"Rating: {book.booRating} ({book.booRatingsCount})";
SetShelves();
}
private async void SetShelves() {
var shelves = await GetShelves();
foreach (var shelf in shelves) cmbShelves.Items.Add(new ComboBoxItem() { Tag = shelf.slfID, Content = shelf.slfName });
}
private async void btnAdd_Click(object sender, RoutedEventArgs e) {
var shelf = cmbShelves.SelectedItem as ComboBoxItem;
if (shelf != null) await AddBook(book, int.Parse(shelf.Tag.ToString()));
}
}
} | using Library.Model;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using static Library.API;
namespace Base {
public partial class UCBookInformation : UserControl {
private Book book;
public UCBookInformation(Book book) {
InitializeComponent();
Margin = new Thickness(3, 0, 0, 0);
this.book = book;
imgThumbnail.Source = new BitmapImage(new Uri(book.booThumbnail));
txbTitle.Text = book.booTitle;
txbDescription.Text = book.booDescription;
txbAuthor.Text = $"Author: {book.booAuthor}";
txbPublisher.Text = $"Publisher: {book.booPublisher}";
txbPublishedDate.Text = $"Published Date: {book.booPublishedDate}";
txbPageCount.Text = $"Page Count: {book.booPageCount}";
txbRating.Text = $"Rating: {book.booRating} ({book.booRatingsCount})";
SetShelves();
}
private async void SetShelves() {
var shelves = await GetShelves();
foreach (var shelf in shelves) cmbShelves.Items.Add(new ComboBoxItem() { Tag = shelf.slfID, Content = shelf.slfName });
}
private async void btnAdd_Click(object sender, RoutedEventArgs e) {
var shelf = cmbShelves.SelectedItem as ComboBoxItem;
if (shelf != null) await AddBook(book, int.Parse(shelf.Tag.ToString()));
}
}
} | mit | C# |
4d6b9d123ec011b629e181c0f584c5674643806a | Use AutoFixture to populate test objects | appharbor/appharbor-cli | src/AppHarbor.Tests/Commands/LogoutAuthCommandTest.cs | src/AppHarbor.Tests/Commands/LogoutAuthCommandTest.cs | using System.IO;
using AppHarbor.Commands;
using Moq;
using Ploeh.AutoFixture.Xunit;
using Xunit.Extensions;
namespace AppHarbor.Tests.Commands
{
public class LogoutAuthCommandTest
{
[Theory, AutoCommandData]
public void ShouldLogoutUser([Frozen]Mock<IAccessTokenConfiguration> accessTokenConfigurationMock, [Frozen]Mock<TextWriter> writer, LogoutAuthCommand logoutCommand)
{
logoutCommand.Execute(new string[0]);
writer.Verify(x => x.WriteLine("Successfully logged out."));
accessTokenConfigurationMock.Verify(x => x.DeleteAccessToken(), Times.Once());
}
}
}
| using System.IO;
using AppHarbor.Commands;
using Moq;
using Xunit;
namespace AppHarbor.Tests.Commands
{
public class LogoutAuthCommandTest
{
[Fact]
public void ShouldLogoutUser()
{
var accessTokenConfigurationMock = new Mock<AccessTokenConfiguration>();
var writer = new Mock<TextWriter>();
var logoutCommand = new LogoutAuthCommand(accessTokenConfigurationMock.Object, writer.Object);
logoutCommand.Execute(new string[0]);
writer.Verify(x => x.WriteLine("Successfully logged out."));
accessTokenConfigurationMock.Verify(x => x.DeleteAccessToken(), Times.Once());
}
}
}
| mit | C# |
9fec2103a305e6a6cdb7d080c7af8a81100472ef | Add default format (json) in web api config | aliziani/ELearning,aliziani/ELearning,aliziani/ELearning | TokenAuthentification/App_Start/WebApiConfig.cs | TokenAuthentification/App_Start/WebApiConfig.cs | using Newtonsoft.Json.Serialization;
using System.Linq;
using System.Net.Http.Formatting;
using System.Web.Http;
namespace TokenAuthentification
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
// Default format
var jsonFormatter = config.Formatters.OfType<JsonMediaTypeFormatter>().First();
jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace TokenAuthentification
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
| mit | C# |
7cf28608ae7fb76b37ed6b3068cca102fec6c70f | Remove plants from tundra biome | creatorfromhell/TrueCraft,Mitch528/TrueCraft,christopherbauer/TrueCraft,blha303/TrueCraft,flibitijibibo/TrueCraft,manio143/TrueCraft,SirCmpwn/TrueCraft,manio143/TrueCraft,flibitijibibo/TrueCraft,thdtjsdn/TrueCraft,thdtjsdn/TrueCraft,thdtjsdn/TrueCraft,christopherbauer/TrueCraft,flibitijibibo/TrueCraft,Mitch528/TrueCraft,christopherbauer/TrueCraft,robinkanters/TrueCraft,Mitch528/TrueCraft,illblew/TrueCraft,robinkanters/TrueCraft,manio143/TrueCraft,blha303/TrueCraft,robinkanters/TrueCraft,blha303/TrueCraft,illblew/TrueCraft,creatorfromhell/TrueCraft,illblew/TrueCraft,SirCmpwn/TrueCraft,SirCmpwn/TrueCraft | TrueCraft.Core/TerrainGen/Biomes/TundraBiome.cs | TrueCraft.Core/TerrainGen/Biomes/TundraBiome.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrueCraft.Core.TerrainGen.Noise;
using TrueCraft.Core.Logic.Blocks;
using TrueCraft.API.World;
using TrueCraft.API;
namespace TrueCraft.Core.TerrainGen.Biomes
{
public class TundraBiome : BiomeProvider
{
public override byte ID
{
get { return (byte)Biome.Tundra; }
}
public override double Temperature
{
get { return 0.1f; }
}
public override double Rainfall
{
get { return 0.7f; }
}
public override TreeSpecies[] Trees
{
get
{
return new[] { TreeSpecies.Spruce };
}
}
public override PlantSpecies[] Plants
{
get
{
return new PlantSpecies[0];
}
}
public override double TreeDensity
{
get
{
return 50;
}
}
public override byte SurfaceBlock
{
get
{
return GrassBlock.BlockID;
}
}
public override byte FillerBlock
{
get
{
return DirtBlock.BlockID;
}
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrueCraft.Core.TerrainGen.Noise;
using TrueCraft.Core.Logic.Blocks;
using TrueCraft.API.World;
using TrueCraft.API;
namespace TrueCraft.Core.TerrainGen.Biomes
{
public class TundraBiome : BiomeProvider
{
public override byte ID
{
get { return (byte)Biome.Tundra; }
}
public override double Temperature
{
get { return 0.1f; }
}
public override double Rainfall
{
get { return 0.7f; }
}
public override TreeSpecies[] Trees
{
get
{
return new[] { TreeSpecies.Spruce };
}
}
public override double TreeDensity
{
get
{
return 50;
}
}
public override byte SurfaceBlock
{
get
{
return GrassBlock.BlockID;
}
}
public override byte FillerBlock
{
get
{
return DirtBlock.BlockID;
}
}
}
} | mit | C# |
3269f690ebcba324a1d74cb9b860d40bf1101d1b | Fix cause of InterruptMusic exception in log. | CaitSith2/KtaneTwitchPlays,samfun123/KtaneTwitchPlays | TwitchPlaysAssembly/Src/Audio/InterruptMusic.cs | TwitchPlaysAssembly/Src/Audio/InterruptMusic.cs | using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
public class InterruptMusic : MonoBehaviour
{
public static InterruptMusic Instance
{
get
{
return _instance;
}
}
private static InterruptMusic _instance = null;
private static Type _gameplayMusicControllerType = null;
private static FieldInfo _volumeLevelField = null;
private static MethodInfo _setVolumeMethod = null;
private Dictionary<int, float> _oldVolumes = new Dictionary<int, float>();
static InterruptMusic()
{
_gameplayMusicControllerType = ReflectionHelper.FindType("GameplayMusicController");
if (_gameplayMusicControllerType != null)
{
_volumeLevelField = _gameplayMusicControllerType.GetField("volumeLevel", BindingFlags.NonPublic | BindingFlags.Instance);
_setVolumeMethod = _gameplayMusicControllerType.GetMethod("SetVolume", BindingFlags.Public | BindingFlags.Instance);
}
}
private void Awake()
{
_instance = this;
}
public void SetMusicInterrupt(bool enableInterrupt)
{
object[] gameplayMusicControllers = FindObjectsOfType(_gameplayMusicControllerType);
foreach (object musicController in gameplayMusicControllers)
{
int musicControllerInstanceID = ((MonoBehaviour) musicController).GetInstanceID();
if (enableInterrupt)
{
_oldVolumes[musicControllerInstanceID] = (float)_volumeLevelField.GetValue(musicController);
_setVolumeMethod.Invoke(musicController, new object[] { 0.0f, true });
}
else
{
if(_oldVolumes.ContainsKey(musicControllerInstanceID))
_setVolumeMethod.Invoke(musicController, new object[] { _oldVolumes[musicControllerInstanceID], true });
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
public class InterruptMusic : MonoBehaviour
{
public static InterruptMusic Instance
{
get
{
return _instance;
}
}
private static InterruptMusic _instance = null;
private static Type _gameplayMusicControllerType = null;
private static FieldInfo _volumeLevelField = null;
private static MethodInfo _setVolumeMethod = null;
private Dictionary<int, float> _oldVolumes = new Dictionary<int, float>();
static InterruptMusic()
{
_gameplayMusicControllerType = ReflectionHelper.FindType("GameplayMusicController");
if (_gameplayMusicControllerType != null)
{
_volumeLevelField = _gameplayMusicControllerType.GetField("volumeLevel", BindingFlags.NonPublic | BindingFlags.Instance);
_setVolumeMethod = _gameplayMusicControllerType.GetMethod("SetVolume", BindingFlags.Public | BindingFlags.Instance);
}
}
private void Awake()
{
_instance = this;
}
public void SetMusicInterrupt(bool enableInterrupt)
{
object[] gameplayMusicControllers = FindObjectsOfType(_gameplayMusicControllerType);
foreach (object musicController in gameplayMusicControllers)
{
if (enableInterrupt)
{
_oldVolumes[((MonoBehaviour)musicController).GetInstanceID()] = (float)_volumeLevelField.GetValue(musicController);
_setVolumeMethod.Invoke(musicController, new object[] { 0.0f, true });
}
else
{
_setVolumeMethod.Invoke(musicController, new object[] { _oldVolumes[((MonoBehaviour)musicController).GetInstanceID()], true });
}
}
}
}
| mit | C# |
9bb501c595bf33d5d6af451801015914a30561b2 | Fix failing tests | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | csharp/ql/test/library-tests/csharp9/ForeachExtension.cs | csharp/ql/test/library-tests/csharp9/ForeachExtension.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
static class Extensions
{
public static IEnumerator<T> GetEnumerator<T>(this IEnumerator<T> enumerator) => enumerator;
public static IAsyncEnumerator<T> GetAsyncEnumerator<T>(this IAsyncEnumerator<T> enumerator) => enumerator;
public static IEnumerator<int> GetEnumerator(this int count)
{
for (int i = 0; i < count; i++)
{
yield return i;
}
}
}
class Program
{
async Task Main()
{
IEnumerator<int> enumerator1 = Enumerable.Range(0, 10).GetEnumerator();
foreach (var item in enumerator1)
{
}
IAsyncEnumerator<int> enumerator2 = GetAsyncEnumerator();
await foreach (var item in enumerator2)
{
}
foreach (var item in 42)
{
}
foreach (var i in new int[] { 1, 2, 3 }) // not extension
{
}
}
static async IAsyncEnumerator<int> GetAsyncEnumerator()
{
yield return 0;
await Task.Delay(1);
yield return 1;
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
static class Extensions
{
public static IEnumerator<T> GetEnumerator<T>(this IEnumerator<T> enumerator) => enumerator;
public static IAsyncEnumerator<T> GetAsyncEnumerator<T>(this IAsyncEnumerator<T> enumerator) => enumerator;
public static IEnumerator<int> GetEnumerator(this int count)
{
for (int i = 0; i < count; i++)
{
yield return i;
}
}
}
class Program
{
async Task Main()
{
IEnumerator<int> enumerator1 = Enumerable.Range(0, 10).GetEnumerator();
foreach (var item in enumerator1)
{
}
IAsyncEnumerator<int> enumerator2 = GetAsyncEnumerator();
await foreach (var item in enumerator2)
{
}
foreach (var item in 42)
{
}
foreach (var i in new int[] { 1, 2, 3 }) // not extension
{
}
}
static async IAsyncEnumerator<int> GetAsyncEnumerator()
{
yield return 0;
await Task.Delay(1);
yield return 1;
}
}
// semmle-extractor-options: /r:System.Linq.dll | mit | C# |
cc2089b1015070bc778fc3b8c2f896e9c8839237 | Add XML comments to NameAttribute | atata-framework/atata,YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata | src/Atata/Attributes/NameAttribute.cs | src/Atata/Attributes/NameAttribute.cs | using System;
namespace Atata
{
/// <summary>
/// Specifies the name of the component.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Field)]
public class NameAttribute : Attribute
{
public NameAttribute(string value)
{
Value = value;
}
/// <summary>
/// Gets the name value.
/// </summary>
public string Value { get; private set; }
}
}
| using System;
namespace Atata
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Field)]
public class NameAttribute : Attribute
{
public NameAttribute(string value)
{
Value = value;
}
public string Value { get; private set; }
}
}
| apache-2.0 | C# |
653aca6a943f07071a80703953ce75a395dc383d | Update PageDocument.cs | wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D | src/Core2D/UI/Avalonia/Dock/Documents/PageDocument.cs | src/Core2D/UI/Avalonia/Dock/Documents/PageDocument.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using DMC = Dock.Model.Controls;
namespace Core2D.UI.Avalonia.Dock.Documents
{
/// <summary>
/// Page document.
/// </summary>
public class PageDocument : DMC.Document
{
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using DMC=Dock.Model.Controls;
namespace Core2D.UI.Avalonia.Dock.Documents
{
/// <summary>
/// Page document.
/// </summary>
public class PageDocument : DMC.Document
{
}
}
| mit | C# |
ac163a6ec61c9b5e76527d08253d5d73e7f4b0ff | Disable provider filtering for Alexa | martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site | src/LondonTravel.Site/Views/Shared/_SignInForm.cshtml | src/LondonTravel.Site/Views/Shared/_SignInForm.cshtml | @inject Microsoft.AspNetCore.Identity.SignInManager<LondonTravelUser> SignInManager
@{
var providers = SignInManager.GetExternalAuthenticationSchemes()
.OrderBy((p) => p.DisplayName)
.ThenBy((p) => p.AuthenticationScheme)
.ToList();
/*
var schemesToShow = ViewData["AuthenticationSchemesToShow"] as IEnumerable<string>;
if (schemesToShow != null)
{
providers = providers
.Where((p) => schemesToShow.Contains(p.AuthenticationScheme, StringComparer.OrdinalIgnoreCase))
.ToList();
}
*/
}
<form asp-route="@SiteRoutes.ExternalSignIn" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
<div>
<p>
@foreach (var provider in providers)
{
@await Html.PartialAsync("_SocialButton", provider)
}
</p>
</div>
</form>
| @inject Microsoft.AspNetCore.Identity.SignInManager<LondonTravelUser> SignInManager
@{
var providers = SignInManager.GetExternalAuthenticationSchemes()
.OrderBy((p) => p.DisplayName)
.ThenBy((p) => p.AuthenticationScheme)
.ToList();
var schemesToShow = ViewData["AuthenticationSchemesToShow"] as IEnumerable<string>;
if (schemesToShow != null)
{
providers = providers
.Where((p) => schemesToShow.Contains(p.AuthenticationScheme, StringComparer.OrdinalIgnoreCase))
.ToList();
}
}
<form asp-route="@SiteRoutes.ExternalSignIn" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
<div>
<p>
@foreach (var provider in providers)
{
@await Html.PartialAsync("_SocialButton", provider)
}
</p>
</div>
</form>
| apache-2.0 | C# |
8a8d9193a7a93bfa34780cbe5b110ab2e0ba5f1c | Refactor - rename test methods | stoneass/IntUITive,stoneass/IntUITive | IntUITive.Selenium.Tests/IntuitivelyFindByIdTests.cs | IntUITive.Selenium.Tests/IntuitivelyFindByIdTests.cs | using NUnit.Framework;
namespace IntUITive.Selenium.Tests
{
[TestFixture]
public class IntuitivelyFindByIdTests : BaseIntuitivelyTests
{
[Test]
public void Find_WithIdAsTerm_ReturnsElement()
{
var element = Intuitively.Find("uniqueId");
Assert.That(element.GetAttribute("id"), Is.EqualTo("uniqueId"));
}
[Test]
public void Find_WithCaseInsensitiveId_ReturnsElement()
{
var element = Intuitively.Find("UNIQUEID");
Assert.That(element.GetAttribute("id"), Is.EqualTo("uniqueId"));
}
}
} | using NUnit.Framework;
namespace IntUITive.Selenium.Tests
{
[TestFixture]
public class IntuitivelyFindByIdTests : BaseIntuitivelyTests
{
[Test]
public void Find_WithIdAsTerm_ReturnsSingleElement()
{
var element = Intuitively.Find("uniqueId");
Assert.That(element.GetAttribute("id"), Is.EqualTo("uniqueId"));
}
[Test]
public void Find_WithCaseInsensitiveId_ReturnsSingleElement()
{
var element = Intuitively.Find("UNIQUEID");
Assert.That(element.GetAttribute("id"), Is.EqualTo("uniqueId"));
}
}
} | apache-2.0 | C# |
c4201bbe58f18b4517a40ac2e05c0cc76bad1252 | Throw when GetInstance cannot find an instance from the IoC container | belgaard/Leantest,belgaard/Leantest,belgaard/Leantest | Source/Core/Core/ExecutionHandling/ContextBuilder.cs | Source/Core/Core/ExecutionHandling/ContextBuilder.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace LeanTest.Core.ExecutionHandling
{
/// <summary>
/// Encapsulates the IoC container and builds the data and execution context for a test, including 'state' and 'mocks'.
/// </summary>
public class ContextBuilder
{
private readonly IIocContainer _container;
private readonly IBuilder[] _builders;
internal IDataStore DataStore { get; }
/// <summary>Initialize internal fields, including data store and builders (for e.g. 'mocks' and 'state').</summary>
internal ContextBuilder(IIocContainer container, params Func<IIocContainer, IDataStore, IBuilder>[] builderFactories)
{
_container = container ?? throw new ArgumentNullException(nameof(container));
DataStore = new DataStore();
_builders = builderFactories?.Select(builderFactory => builderFactory(_container, DataStore)).ToArray() ?? throw new ArgumentNullException(nameof(builderFactories));
}
/// <summary>Get an instance of type <c>T</c> from the IoC container.</summary>
public T GetInstance<T>() where T : class => _container.Resolve<T>();
/// <summary>Declare data of type <c>T</c> to be stored, then used to fill in builders (e.g. 'mocks' and 'state') during <c>Build</c>.</summary>
public ContextBuilder WithData<T>(T data)
{
DataStore.WithData(data);
foreach (IBuilder builder in _builders)
builder.WithBuilderForData<T>();
// TODO: Throw if no builder was found for this piece of data!
return this;
}
/// <summary>Pre-declare the intent to handle data of type <c>T</c>. The effect will be to have <c>PreBuild</c>, <c>Build</c> and <c>PostBuild</c> run for builders that
/// support data of type <c>T</c>, even for tests which do not declare data of type <c>T</c>.</summary>
public ContextBuilder WithData<T>()
{
foreach (IBuilder builder in _builders)
builder.WithBuilderForData<T>();
// TODO: Throw if no builder was found for this piece of data!
return this;
}
/// <summary>Declare an enumeration of data of type <c>T</c> to be stored, then used to fill builders (e.g. 'mocks' and 'state') during <c>Build</c>.</summary>
public ContextBuilder WithEnumerableData<T>(IEnumerable<T> ts)
{
DataStore.WithEnumerable(ts);
foreach (IBuilder builder in _builders)
builder.WithBuilderForData<T>();
// TODO: Throw if no builder was found for this piece of data!
return this;
}
/// <summary>Clear all declared data from the data store.</summary>
public ContextBuilder WithClearDataStore()
{
DataStore.TypedData.Clear();
return this;
}
/// <summary>Use the declared data to build builders (e.g. 'mocks' and 'state').</summary>
public ContextBuilder Build()
{
foreach (IBuilder builder in _builders)
builder.Build();
return this;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace LeanTest.Core.ExecutionHandling
{
/// <summary>
/// Encapsulates the IoC container and builds the data and execution context for a test, including 'state' and 'mocks'.
/// </summary>
public class ContextBuilder
{
private readonly IIocContainer _container;
private readonly IBuilder[] _builders;
internal IDataStore DataStore { get; }
/// <summary>
/// Initialize internal fields, including data store and builders (for e.g. 'mocks' and 'state') .
/// </summary>
/// <param name="container"></param>
/// <param name="builderFactories"></param>
internal ContextBuilder(IIocContainer container, params Func<IIocContainer, IDataStore, IBuilder>[] builderFactories)
{
_container = container ?? throw new ArgumentNullException(nameof(container));
DataStore = new DataStore();
_builders = builderFactories?.Select(builderFactory => builderFactory(_container, DataStore)).ToArray() ?? throw new ArgumentNullException(nameof(builderFactories));
}
/// <summary>
/// Get an instance of type <c>T</c> from the IoC container.
/// </summary>
public T GetInstance<T>() where T : class
{
return _container.TryResolve<T>();
}
/// <summary>
/// Declare data of type <c>T</c> to be stored, then used to fill in builders (e.g. 'mocks' and 'state') during <c>Build</c>.
/// </summary>
public ContextBuilder WithData<T>(T data)
{
DataStore.WithData(data);
foreach (IBuilder builder in _builders)
builder.WithBuilderForData<T>();
// TODO: Throw if no builder was found for this piece of data!
return this;
}
/// <summary>
/// Pre-declare the intent to handle data of type <c>T</c>. The effect will be to have <c>PreBuild</c>, <c>Build</c> and <c>PostBuild</c> run for builders that
/// support data of type <c>T</c>, even for tests which do not declare data of type <c>T</c>.
/// </summary>
public ContextBuilder WithData<T>()
{
foreach (IBuilder builder in _builders)
builder.WithBuilderForData<T>();
// TODO: Throw if no builder was found for this piece of data!
return this;
}
/// <summary>
/// Declare an enumeration of data of type <c>T</c> to be stored, then used to fill builders (e.g. 'mocks' and 'state') during <c>Build</c>.
/// </summary>
public ContextBuilder WithEnumerableData<T>(IEnumerable<T> ts)
{
DataStore.WithEnumerable(ts);
foreach (IBuilder builder in _builders)
builder.WithBuilderForData<T>();
// TODO: Throw if no builder was found for this piece of data!
return this;
}
/// <summary>
/// Clear all declared data from the data store.
/// </summary>
/// <returns></returns>
public ContextBuilder WithClearDataStore()
{
DataStore.TypedData.Clear();
return this;
}
/// <summary>
/// Use the declared data to build builders (e.g. 'mocks' and 'state').
/// </summary>
/// <returns></returns>
public ContextBuilder Build()
{
foreach (IBuilder builder in _builders)
builder.Build();
return this;
}
}
}
| mit | C# |
488bed5e53f88b683477ccc36f55fc86314fe7a2 | Make ChannelReferences Procedures thread-safe (#39) | MathewSachin/ManagedBass,Revica/ManagedBass | src/Bass/Shared/ChannelReferences.cs | src/Bass/Shared/ChannelReferences.cs | using System;
using System.Collections.Concurrent;
using System.Linq;
namespace ManagedBass
{
/// <summary>
/// Holds References to Channel Items like <see cref="SyncProcedure"/> and <see cref="FileProcedures"/>.
/// </summary>
public static class ChannelReferences
{
static readonly ConcurrentDictionary<Tuple<int, int>, object> Procedures = new ConcurrentDictionary<Tuple<int, int>, object>();
static readonly SyncProcedure Freeproc = Callback;
/// <summary>
/// Adds a Reference.
/// </summary>
public static void Add(int Handle, int SpecificHandle, object proc)
{
if (proc == null)
return;
if (proc.Equals(Freeproc))
return;
var key = Tuple.Create(Handle, SpecificHandle);
var contains = Procedures.ContainsKey(key);
if (Freeproc != null && Procedures.All(pair => pair.Key.Item1 != Handle))
Bass.ChannelSetSync(Handle, SyncFlags.Free, 0, Freeproc);
if (contains)
Procedures[key] = proc;
else Procedures.TryAdd(key, proc);
}
/// <summary>
/// Removes a Reference.
/// </summary>
public static void Remove(int Handle, int SpecialHandle)
{
var key = Tuple.Create(Handle, SpecialHandle);
Procedures.TryRemove(key, out object unused);
}
static void Callback(int Handle, int Channel, int Data, IntPtr User)
{
// ToArray is necessary because the object iterated on should not be modified.
var toRemove = Procedures.Where(Pair => Pair.Key.Item1 == Channel).Select(Pair => Pair.Key).ToArray();
foreach (var key in toRemove)
Procedures.TryRemove(key, out object unused);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace ManagedBass
{
/// <summary>
/// Holds References to Channel Items like <see cref="SyncProcedure"/> and <see cref="FileProcedures"/>.
/// </summary>
public static class ChannelReferences
{
static readonly Dictionary<Tuple<int, int>, object> Procedures = new Dictionary<Tuple<int, int>, object>();
static readonly SyncProcedure Freeproc = Callback;
/// <summary>
/// Adds a Reference.
/// </summary>
public static void Add(int Handle, int SpecificHandle, object proc)
{
if (proc == null)
return;
if (proc.Equals(Freeproc))
return;
var key = Tuple.Create(Handle, SpecificHandle);
var contains = Procedures.ContainsKey(key);
if (Freeproc != null && Procedures.All(pair => pair.Key.Item1 != Handle))
Bass.ChannelSetSync(Handle, SyncFlags.Free, 0, Freeproc);
if (contains)
Procedures[key] = proc;
else Procedures.Add(key, proc);
}
/// <summary>
/// Removes a Reference.
/// </summary>
public static void Remove(int Handle, int SpecialHandle)
{
var key = Tuple.Create(Handle, SpecialHandle);
if (Procedures.ContainsKey(key))
Procedures.Remove(key);
}
static void Callback(int Handle, int Channel, int Data, IntPtr User)
{
// ToArray is necessary because the object iterated on should not be modified.
var toRemove = Procedures.Where(Pair => Pair.Key.Item1 == Channel).Select(Pair => Pair.Key).ToArray();
foreach (var key in toRemove)
Procedures.Remove(key);
}
}
}
| mit | C# |
4b086b7e1cf38d386ad6c2bcffed2fee89e4679f | Fix default JSON response charset | rudygt/Nancy,thecodejunkie/Nancy,dbabox/Nancy,wtilton/Nancy,thecodejunkie/Nancy,AcklenAvenue/Nancy,phillip-haydon/Nancy,kekekeks/Nancy,EIrwin/Nancy,hitesh97/Nancy,nicklv/Nancy,xt0rted/Nancy,horsdal/Nancy,davidallyoung/Nancy,davidallyoung/Nancy,cgourlay/Nancy,guodf/Nancy,adamhathcock/Nancy,AcklenAvenue/Nancy,cgourlay/Nancy,adamhathcock/Nancy,dbolkensteyn/Nancy,felipeleusin/Nancy,NancyFx/Nancy,sadiqhirani/Nancy,damianh/Nancy,khellang/Nancy,sroylance/Nancy,duszekmestre/Nancy,danbarua/Nancy,murador/Nancy,AIexandr/Nancy,grumpydev/Nancy,nicklv/Nancy,xt0rted/Nancy,kekekeks/Nancy,Worthaboutapig/Nancy,EliotJones/NancyTest,fly19890211/Nancy,asbjornu/Nancy,albertjan/Nancy,thecodejunkie/Nancy,ayoung/Nancy,jeff-pang/Nancy,guodf/Nancy,jongleur1983/Nancy,xt0rted/Nancy,sloncho/Nancy,jchannon/Nancy,EliotJones/NancyTest,felipeleusin/Nancy,jongleur1983/Nancy,xt0rted/Nancy,AIexandr/Nancy,charleypeng/Nancy,duszekmestre/Nancy,AcklenAvenue/Nancy,malikdiarra/Nancy,sroylance/Nancy,wtilton/Nancy,Novakov/Nancy,tareq-s/Nancy,AlexPuiu/Nancy,fly19890211/Nancy,felipeleusin/Nancy,MetSystem/Nancy,EIrwin/Nancy,vladlopes/Nancy,EliotJones/NancyTest,malikdiarra/Nancy,damianh/Nancy,thecodejunkie/Nancy,jeff-pang/Nancy,tsdl2013/Nancy,Crisfole/Nancy,charleypeng/Nancy,nicklv/Nancy,tareq-s/Nancy,JoeStead/Nancy,dbolkensteyn/Nancy,adamhathcock/Nancy,Crisfole/Nancy,tparnell8/Nancy,VQComms/Nancy,hitesh97/Nancy,grumpydev/Nancy,jeff-pang/Nancy,jchannon/Nancy,sloncho/Nancy,duszekmestre/Nancy,VQComms/Nancy,vladlopes/Nancy,adamhathcock/Nancy,grumpydev/Nancy,guodf/Nancy,danbarua/Nancy,jongleur1983/Nancy,jmptrader/Nancy,sadiqhirani/Nancy,malikdiarra/Nancy,jchannon/Nancy,damianh/Nancy,Worthaboutapig/Nancy,dbolkensteyn/Nancy,Novakov/Nancy,jchannon/Nancy,sroylance/Nancy,AlexPuiu/Nancy,anton-gogolev/Nancy,lijunle/Nancy,joebuschmann/Nancy,guodf/Nancy,grumpydev/Nancy,jmptrader/Nancy,ayoung/Nancy,blairconrad/Nancy,dbolkensteyn/Nancy,MetSystem/Nancy,VQComms/Nancy,davidallyoung/Nancy,lijunle/Nancy,ccellar/Nancy,JoeStead/Nancy,Crisfole/Nancy,hitesh97/Nancy,blairconrad/Nancy,AIexandr/Nancy,danbarua/Nancy,EIrwin/Nancy,duszekmestre/Nancy,tparnell8/Nancy,blairconrad/Nancy,nicklv/Nancy,malikdiarra/Nancy,SaveTrees/Nancy,asbjornu/Nancy,cgourlay/Nancy,anton-gogolev/Nancy,ccellar/Nancy,davidallyoung/Nancy,NancyFx/Nancy,asbjornu/Nancy,asbjornu/Nancy,vladlopes/Nancy,khellang/Nancy,tareq-s/Nancy,jongleur1983/Nancy,lijunle/Nancy,VQComms/Nancy,daniellor/Nancy,ccellar/Nancy,tareq-s/Nancy,Novakov/Nancy,NancyFx/Nancy,joebuschmann/Nancy,murador/Nancy,AlexPuiu/Nancy,cgourlay/Nancy,joebuschmann/Nancy,wtilton/Nancy,dbabox/Nancy,rudygt/Nancy,rudygt/Nancy,blairconrad/Nancy,phillip-haydon/Nancy,joebuschmann/Nancy,dbabox/Nancy,charleypeng/Nancy,EliotJones/NancyTest,AIexandr/Nancy,tsdl2013/Nancy,sloncho/Nancy,albertjan/Nancy,albertjan/Nancy,ayoung/Nancy,JoeStead/Nancy,jeff-pang/Nancy,fly19890211/Nancy,danbarua/Nancy,tsdl2013/Nancy,horsdal/Nancy,horsdal/Nancy,murador/Nancy,VQComms/Nancy,vladlopes/Nancy,AcklenAvenue/Nancy,albertjan/Nancy,Worthaboutapig/Nancy,ccellar/Nancy,hitesh97/Nancy,phillip-haydon/Nancy,murador/Nancy,AlexPuiu/Nancy,jmptrader/Nancy,Novakov/Nancy,jmptrader/Nancy,NancyFx/Nancy,EIrwin/Nancy,jchannon/Nancy,felipeleusin/Nancy,jonathanfoster/Nancy,anton-gogolev/Nancy,sadiqhirani/Nancy,asbjornu/Nancy,dbabox/Nancy,tparnell8/Nancy,kekekeks/Nancy,horsdal/Nancy,AIexandr/Nancy,rudygt/Nancy,fly19890211/Nancy,MetSystem/Nancy,jonathanfoster/Nancy,MetSystem/Nancy,charleypeng/Nancy,sloncho/Nancy,davidallyoung/Nancy,sroylance/Nancy,SaveTrees/Nancy,sadiqhirani/Nancy,SaveTrees/Nancy,daniellor/Nancy,wtilton/Nancy,SaveTrees/Nancy,tsdl2013/Nancy,phillip-haydon/Nancy,khellang/Nancy,jonathanfoster/Nancy,khellang/Nancy,charleypeng/Nancy,jonathanfoster/Nancy,tparnell8/Nancy,Worthaboutapig/Nancy,JoeStead/Nancy,anton-gogolev/Nancy,ayoung/Nancy,daniellor/Nancy,lijunle/Nancy,daniellor/Nancy | src/Nancy/Json/JsonSettings.cs | src/Nancy/Json/JsonSettings.cs | namespace Nancy.Json
{
using System.Collections.Generic;
using Converters;
/// <summary>
/// Json serializer settings
/// </summary>
public static class JsonSettings
{
/// <summary>
/// Max length of json output
/// </summary>
public static int MaxJsonLength { get; set; }
/// <summary>
/// Maximum number of recursions
/// </summary>
public static int MaxRecursions { get; set; }
/// <summary>
/// Default charset for json responses.
/// </summary>
public static string DefaultCharset { get; set; }
public static IList<JavaScriptConverter> Converters { get; set; }
static JsonSettings()
{
MaxJsonLength = 102400;
MaxRecursions = 100;
DefaultCharset = "utf-8";
Converters = new List<JavaScriptConverter>
{
new TimeSpanConverter(),
};
}
}
} | namespace Nancy.Json
{
using System.Collections.Generic;
using Converters;
/// <summary>
/// Json serializer settings
/// </summary>
public static class JsonSettings
{
/// <summary>
/// Max length of json output
/// </summary>
public static int MaxJsonLength { get; set; }
/// <summary>
/// Maximum number of recursions
/// </summary>
public static int MaxRecursions { get; set; }
/// <summary>
/// Default charset for json responses.
/// </summary>
public static string DefaultCharset { get; set; }
public static IList<JavaScriptConverter> Converters { get; set; }
static JsonSettings()
{
MaxJsonLength = 102400;
MaxRecursions = 100;
DefaultCharset = "utf8";
Converters = new List<JavaScriptConverter>
{
new TimeSpanConverter(),
};
}
}
} | mit | C# |
2c17d450dd8fbd8e098e844ac4da8634190ba823 | fix Issue #16 | danisein/Wox,Rovak/Wox,EmuxEvans/Wox,derekforeman/Wox,gnowxilef/Wox,Rovak/Wox,medoni/Wox,mika76/Wox,renzhn/Wox,kdar/Wox,mika76/Wox,orzFly/Wox,18098924759/Wox,gnowxilef/Wox,zlphoenix/Wox,qianlifeng/Wox,lances101/Wox,jondaniels/Wox,Megasware128/Wox,lances101/Wox,kdar/Wox,qianlifeng/Wox,apprentice3d/Wox,EmuxEvans/Wox,vebin/Wox,sanbinabu/Wox,Megasware128/Wox,shangvven/Wox,orzFly/Wox,vebin/Wox,derekforeman/Wox,qianlifeng/Wox,18098924759/Wox,yozora-hitagi/Saber,jondaniels/Wox,AlexCaranha/Wox,apprentice3d/Wox,apprentice3d/Wox,kdar/Wox,orzFly/Wox,shangvven/Wox,EmuxEvans/Wox,orzFly/Wox,yozora-hitagi/Saber,zlphoenix/Wox,sanbinabu/Wox,Launchify/Launchify,shangvven/Wox,kayone/Wox,kayone/Wox,sanbinabu/Wox,Rovak/Wox,renzhn/Wox,dstiert/Wox,Rovak/Wox,danisein/Wox,JohnTheGr8/Wox,dstiert/Wox,kayone/Wox,Wox-launcher/Wox,mika76/Wox,AlexCaranha/Wox,AlexCaranha/Wox,Wox-launcher/Wox,medoni/Wox,orzFly/Wox,Rovak/Wox,gnowxilef/Wox,18098924759/Wox,vebin/Wox,derekforeman/Wox,Launchify/Launchify,dstiert/Wox,JohnTheGr8/Wox | WinAlfred.Plugin.System/ThirdpartyPluginIndicator.cs | WinAlfred.Plugin.System/ThirdpartyPluginIndicator.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WinAlfred.Plugin.System
{
public class ThirdpartyPluginIndicator : BaseSystemPlugin
{
private List<PluginPair> allPlugins = new List<PluginPair>();
private Action<string> changeQuery;
protected override List<Result> QueryInternal(Query query)
{
List<Result> results = new List<Result>();
if (string.IsNullOrEmpty(query.RawQuery)) return results;
foreach (PluginMetadata metadata in allPlugins.Select(o=>o.Metadata))
{
if (metadata.ActionKeyword.StartsWith(query.RawQuery))
{
PluginMetadata metadataCopy = metadata;
Result result = new Result
{
Title = metadata.ActionKeyword,
SubTitle = string.Format("Activate {0} workflow",metadata.Name),
Score = 50,
IcoPath = "Images/work.png",
Action = () => changeQuery(metadataCopy.ActionKeyword + " "),
DontHideWinAlfredAfterSelect = true
};
results.Add(result);
}
}
return results;
}
protected override void InitInternal(PluginInitContext context)
{
allPlugins = context.Plugins;
changeQuery = context.ChangeQuery;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WinAlfred.Plugin.System
{
public class ThirdpartyPluginIndicator : BaseSystemPlugin
{
private List<PluginPair> allPlugins = new List<PluginPair>();
private Action<string> changeQuery;
protected override List<Result> QueryInternal(Query query)
{
List<Result> results = new List<Result>();
if (string.IsNullOrEmpty(query.RawQuery)) return results;
foreach (PluginMetadata metadata in allPlugins.Select(o=>o.Metadata))
{
if (metadata.ActionKeyword.StartsWith(query.RawQuery))
{
PluginMetadata metadataCopy = metadata;
Result result = new Result
{
Title = metadata.ActionKeyword,
SubTitle = string.Format("press space to active {0} workflow",metadata.Name),
Score = 50,
IcoPath = "Images/work.png",
Action = () => changeQuery(metadataCopy.ActionKeyword + " "),
DontHideWinAlfredAfterSelect = true
};
results.Add(result);
}
}
return results;
}
protected override void InitInternal(PluginInitContext context)
{
allPlugins = context.Plugins;
changeQuery = context.ChangeQuery;
}
}
}
| mit | C# |
69f1be91217bfbb53b7aa1fe95788c96cc968d3d | fix lint. | GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples | asset/quickstart/ExportAssetsTest/ExportAssetsTest.cs | asset/quickstart/ExportAssetsTest/ExportAssetsTest.cs | /*
* Copyright (c) 2018 Google LLC.
*
* 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 Google.Apis.Storage.v1.Data;
using Google.Cloud.Storage.V1;
using System;
using Xunit;
using Xunit.Abstractions;
namespace GoogleCloudSamples
{
public class ExportAssetsTest : IClassFixture<RandomBucketFixture>, System.IDisposable
{
static readonly CommandLineRunner s_runner = new CommandLineRunner
{
Command = "ExportAssets",
VoidMain = ExportAssets.Main,
};
private readonly ITestOutputHelper _testOutput;
private readonly StorageClient _storageClient = StorageClient.Create();
private readonly string _bucketName;
readonly BucketCollector _bucketCollector;
public ExportAssetsTest(ITestOutputHelper output, RandomBucketFixture bucketFixture)
{
_testOutput = output;
_bucketName = bucketFixture.BucketName;
_bucketCollector = new BucketCollector(_bucketName);
}
[Fact]
public void TestExportAsests()
{
string projectId = Environment.GetEnvironmentVariable("GOOGLE_PROJECT_ID");
string bucketName = String.Format("{0}-for-assets", projectId);
var output = s_runner.Run(bucketName);
_testOutput.WriteLine(output.Stdout);
string expectedOutput = String.Format("\"outputConfig\": {{ \"gcsDestination\": {{ \"uri\": \"gs://{0}/my-assets.txt\" }} }}", bucketName);
Assert.Contains(expectedOutput, output.Stdout);
}
public void Dispose()
{
((IDisposable)_bucketCollector).Dispose();
}
}
}
| /*
* Copyright (c) 2018 Google LLC.
*
* 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 Google.Apis.Storage.v1.Data;
using Google.Cloud.Storage.V1;
using System;
using Xunit;
using Xunit.Abstractions;
namespace GoogleCloudSamples
{
public class ExportAssetsTest: IClassFixture<RandomBucketFixture>, System.IDisposable
{
static readonly CommandLineRunner s_runner = new CommandLineRunner
{
Command = "ExportAssets",
VoidMain = ExportAssets.Main,
};
private readonly ITestOutputHelper _testOutput;
private readonly StorageClient _storageClient = StorageClient.Create();
private readonly string _bucketName;
readonly BucketCollector _bucketCollector;
public ExportAssetsTest(ITestOutputHelper output, RandomBucketFixture bucketFixture)
{
_testOutput = output;
_bucketName = bucketFixture.BucketName;
_bucketCollector = new BucketCollector(_bucketName);
}
[Fact]
public void TestExportAsests()
{
string projectId = Environment.GetEnvironmentVariable("GOOGLE_PROJECT_ID");
string bucketName = String.Format("{0}-for-assets", projectId);
var output = s_runner.Run(bucketName);
_testOutput.WriteLine(output.Stdout);
string expectedOutput = String.Format("\"outputConfig\": {{ \"gcsDestination\": {{ \"uri\": \"gs://{0}/my-assets.txt\" }} }}", bucketName);
Assert.Contains(expectedOutput, output.Stdout);
}
public void Dispose()
{
((IDisposable)_bucketCollector).Dispose();
}
}
}
| apache-2.0 | C# |
ebfb43969e2b935d5dd4f636f2e134869ab15380 | Allow connection string for configuring StorageAccountDetails (#263) | Azure/durabletask,affandar/durabletask | src/DurableTask.AzureStorage/StorageAccountDetails.cs | src/DurableTask.AzureStorage/StorageAccountDetails.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.
// ----------------------------------------------------------------------------------
namespace DurableTask.AzureStorage
{
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
/// <summary>
/// Connection details of the Azure Storage account
/// </summary>
public sealed class StorageAccountDetails
{
/// <summary>
/// The storage account credentials
/// </summary>
public StorageCredentials StorageCredentials { get; set; }
/// <summary>
/// The storage account name
/// </summary>
public string AccountName { get; set; }
/// <summary>
/// The storage account endpoint suffix
/// </summary>
public string EndpointSuffix { get; set; }
/// <summary>
/// The storage account connection string.
/// </summary>
/// <remarks>
/// If specified, this value overrides any other settings.
/// </remarks>
public string ConnectionString { get; set; }
/// <summary>
/// Convert this to its equivalent CloudStorageAccount.
/// </summary>
public CloudStorageAccount ToCloudStorageAccount()
{
if (!string.IsNullOrEmpty(this.ConnectionString))
{
return CloudStorageAccount.Parse(this.ConnectionString);
}
else
{
return new CloudStorageAccount(
this.StorageCredentials,
this.AccountName,
this.EndpointSuffix,
useHttps: true);
}
}
}
}
| // ----------------------------------------------------------------------------------
// 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 DurableTask.AzureStorage
{
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
/// <summary>
/// Connection details of the Azure Storage account
/// </summary>
public sealed class StorageAccountDetails
{
/// <summary>
/// The storage account credentials
/// </summary>
public StorageCredentials StorageCredentials { get; set; }
/// <summary>
/// The storage account name
/// </summary>
public string AccountName { get; set; }
/// <summary>
/// The storage account endpoint suffix
/// </summary>
public string EndpointSuffix { get; set; }
/// <summary>
/// Convert this to its equivalent CloudStorageAccount.
/// </summary>
public CloudStorageAccount ToCloudStorageAccount()
{
return new CloudStorageAccount(this.StorageCredentials, this.AccountName, this.EndpointSuffix, true);
}
}
}
| apache-2.0 | C# |
58b3e4f816d4c3e843522ade9d9b593ace5b6c78 | remove some namespaces | leotsarev/hardcode-analyzer | Tsarev.Analyzer.Helpers/EntityFrameworkHelpers.cs | Tsarev.Analyzer.Helpers/EntityFrameworkHelpers.cs | using System.Linq;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Tsarev.Analyzer.Helpers
{
/// <summary>
/// Set of methods that used top detect some EF patterns that shoud not be analyzed
/// </summary>
public static class EntityFrameworkHelpers
{
/// <summary>
/// If class is actually EF migration
/// </summary>
public static bool IsProbablyMigration([CanBeNull] this ClassDeclarationSyntax containingClass) =>
containingClass?.BaseList?.Types.Any(c => IsProbablyDbMigration(c.Type)) ?? false;
private static bool IsProbablyDbMigration(TypeSyntax baseClass)
{
var baseClassName = (baseClass as IdentifierNameSyntax)?.Identifier.Text;
return baseClassName == "DbMigration";
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Tsarev.Analyzer.Helpers
{
/// <summary>
/// Set of methods that used top detect some EF patterns that shoud not be analyzed
/// </summary>
public static class EntityFrameworkHelpers
{
/// <summary>
/// If class is actually EF migration
/// </summary>
public static bool IsProbablyMigration([CanBeNull] this ClassDeclarationSyntax containingClass) =>
containingClass?.BaseList?.Types.Any(c => IsProbablyDbMigration(c.Type)) ?? false;
private static bool IsProbablyDbMigration(TypeSyntax baseClass)
{
var baseClassName = (baseClass as IdentifierNameSyntax)?.Identifier.Text;
return baseClassName == "DbMigration";
}
}
}
| mit | C# |
78b88e42c5d3cb7cf749c0eba078665d42b71776 | Add guard in ExportInfo constructor. | RockFramework/Rock.StaticDependencyInjection,bfriesen/Rock.StaticDependencyInjection | src/StaticDependencyInjection/ExportInfo.Generated.cs | src/StaticDependencyInjection/ExportInfo.Generated.cs | using System;
namespace Rock.StaticDependencyInjection
{
/// <summary>
/// Provides information about an export.
/// </summary>
internal class ExportInfo
{
private const int _defaultPriority = -1;
private readonly Type _targetClass;
private readonly int _priority;
/// <summary>
/// Initializes a new instance of the <see cref="ExportInfo"/> class with
/// a priority of negative one.
/// </summary>
/// <param name="targetClass">The class to be exported.</param>
internal ExportInfo(Type targetClass)
: this(targetClass, _defaultPriority)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ExportInfo"/> class.
/// </summary>
/// <param name="targetClass">The class to be exported.</param>
/// <param name="priority">
/// The priority of the export, relative to the priority of other exports.
/// </param>
internal ExportInfo(Type targetClass, int priority)
{
if (targetClass == null)
{
throw new ArgumentNullException("targetClass");
}
if (targetClass.Assembly.ReflectionOnly)
{
targetClass = Type.GetType(targetClass.AssemblyQualifiedName);
}
_targetClass = targetClass;
_priority = priority;
}
/// <summary>
/// Gets the class to be exported.
/// </summary>
internal Type TargetClass { get { return _targetClass; } }
/// <summary>
/// Gets the priority of the export, relative to the priority of other exports.
/// The default value, if not specified in the constructor is negative one.
/// This value is used during import operations to sort the discovered classes.
/// </summary>
internal int Priority { get { return _priority; } }
/// <summary>
/// Gets or sets the name of the export. This value is compared against the
/// name parameter in various import operations.
/// </summary>
internal string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the type indicated by
/// <see cref="TargetClass"/> should be excluded from consideration during an
/// import operation.
/// </summary>
internal bool Disabled { get; set; }
}
} | using System;
namespace Rock.StaticDependencyInjection
{
/// <summary>
/// Provides information about an export.
/// </summary>
internal class ExportInfo
{
private const int _defaultPriority = -1;
private readonly Type _targetClass;
private readonly int _priority;
/// <summary>
/// Initializes a new instance of the <see cref="ExportInfo"/> class with
/// a priority of negative one.
/// </summary>
/// <param name="targetClass">The class to be exported.</param>
internal ExportInfo(Type targetClass)
: this(targetClass, _defaultPriority)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ExportInfo"/> class.
/// </summary>
/// <param name="targetClass">The class to be exported.</param>
/// <param name="priority">
/// The priority of the export, relative to the priority of other exports.
/// </param>
internal ExportInfo(Type targetClass, int priority)
{
if (targetClass.Assembly.ReflectionOnly)
{
targetClass = Type.GetType(targetClass.AssemblyQualifiedName);
}
_targetClass = targetClass;
_priority = priority;
}
/// <summary>
/// Gets the class to be exported.
/// </summary>
internal Type TargetClass { get { return _targetClass; } }
/// <summary>
/// Gets the priority of the export, relative to the priority of other exports.
/// The default value, if not specified in the constructor is negative one.
/// This value is used during import operations to sort the discovered classes.
/// </summary>
internal int Priority { get { return _priority; } }
/// <summary>
/// Gets or sets the name of the export. This value is compared against the
/// name parameter in various import operations.
/// </summary>
internal string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the type indicated by
/// <see cref="TargetClass"/> should be excluded from consideration during an
/// import operation.
/// </summary>
internal bool Disabled { get; set; }
}
} | mit | C# |
2cc90a99001168b7ce2e4e13f4d644e01d976145 | Update AssemblyInfo | pierre3/PlantUmlClassDiagramGenerator,pierre3/PlantUmlClassDiagramGenerator | PlantUmlClassDiagramGenerator/Properties/AssemblyInfo.cs | PlantUmlClassDiagramGenerator/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PlantUmlClassDiagramGenerator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlantUmlClassDiagramGenerator")]
[assembly: AssemblyCopyright("Copyright © 2015 pierre3")]
[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)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PlantUmlClassDiagramGenerator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlantUmlClassDiagramGenerator")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
12c82e96281683b087363b436723392d9dd3b66f | Add class CustomPSSnapIn stubs | mrward/Pash,WimObiwan/Pash,sburnicki/Pash,sillvan/Pash,Jaykul/Pash,ForNeVeR/Pash,WimObiwan/Pash,ForNeVeR/Pash,WimObiwan/Pash,mrward/Pash,Jaykul/Pash,WimObiwan/Pash,ForNeVeR/Pash,sburnicki/Pash,sburnicki/Pash,sillvan/Pash,ForNeVeR/Pash,sillvan/Pash,Jaykul/Pash,mrward/Pash,Jaykul/Pash,sburnicki/Pash,mrward/Pash,sillvan/Pash | Source/System.Management/Automation/CustomPSSnapIn.cs | Source/System.Management/Automation/CustomPSSnapIn.cs | // Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Management.Automation.Runspaces;
namespace System.Management.Automation
{
/// <summary>
/// Base class for other classes which represent PSSnapins.
/// </summary>
public abstract class CustomPSSnapIn : PSSnapInInstaller
{
protected CustomPSSnapIn()
{
}
public virtual Collection<CmdletConfigurationEntry> Cmdlets { get; private set; }
public virtual Collection<FormatConfigurationEntry> Formats { get; private set; }
public virtual Collection<ProviderConfigurationEntry> Providers { get; private set; }
public virtual Collection<TypeConfigurationEntry> Types { get; private set; }
}
}
| // Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/
//classtodo: Needs implementations of Runspaces.CmdletConfigurationEntry, Runspaces.FormatConfigurationEntry, Runspaces.TypeConfigurationEntry
/*
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Management.Automation.Runspaces;
namespace System.Management.Automation
{
/// <summary>
/// Base class for other classes which represent PSSnapins.
/// </summary>
public abstract class CustomPSSnapIn : PSSnapInInstaller
{
public virtual Collection<CmdletConfigurationEntry> Cmdlets { get; private set; }
public virtual Collection<FormatConfigurationEntry> Formats { get; private set; }
public virtual Collection<ProviderConfigurationEntry> Providers { get; private set; }
public virtual Collection<TypeConfigurationEntry> Types { get; private set; }
}
}*/
| bsd-3-clause | C# |
51556a809d578f159387664cf23ce26a856643b1 | Fix variables not being used inside target string | ppy/osu,EVAST9919/osu,ppy/osu,UselessToucan/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu,EVAST9919/osu,smoogipoo/osu,peppy/osu-new,johnneijzen/osu,2yangk23/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,2yangk23/osu,NeoAdonis/osu | osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs | osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Online.Chat;
namespace osu.Game.Online.API.Requests
{
public class MarkChannelAsReadRequest : APIRequest
{
private readonly Channel channel;
private readonly Message message;
public MarkChannelAsReadRequest(Channel channel, Message message)
{
this.channel = channel;
this.message = message;
}
protected override string Target => $"/chat/channels/{channel}/mark-as-read/{message}";
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Online.Chat;
namespace osu.Game.Online.API.Requests
{
public class MarkChannelAsReadRequest : APIRequest
{
private readonly Channel channel;
private readonly Message message;
public MarkChannelAsReadRequest(Channel channel, Message message)
{
this.channel = channel;
this.message = message;
}
protected override string Target => @"/chat/channels/{channel}/mark-as-read/{message}";
}
}
| mit | C# |
228c5d7f6590272a3ceec5342cf30c71eecae3bd | Document fail-fast approach for exception bag property add after results collected | RehanSaeed/Serilog.Exceptions,RehanSaeed/Serilog.Exceptions | Source/Serilog.Exceptions/Core/ExceptionPropertiesBag.cs | Source/Serilog.Exceptions/Core/ExceptionPropertiesBag.cs | namespace Serilog.Exceptions.Core
{
using System;
using System.Collections.Generic;
using Serilog.Exceptions.Filters;
internal class ExceptionPropertiesBag : IExceptionPropertiesBag
{
private readonly Type exceptionType;
private readonly IExceptionPropertyFilter filter;
private readonly Dictionary<string, object> properties = new Dictionary<string, object>();
// We keep a note on whether the results were collected to be sure that
// after that there are no changes. This is the application of fail-fast principle.
private bool resultsCollected = false;
public ExceptionPropertiesBag(Type exceptionType, IExceptionPropertyFilter filter = null)
{
this.exceptionType = exceptionType;
this.filter = filter;
}
public IReadOnlyDictionary<string, object> GetResultDictionary()
{
this.resultsCollected = true;
return this.properties;
}
public void AddProperty(string key, object value)
{
if (key == null)
{
throw new ArgumentNullException(nameof(key), "Cannot add exception property without a key");
}
if (this.resultsCollected)
{
throw new InvalidOperationException($"Cannot add exception property '{key}' to bag, after results were already collected");
}
if (this.filter != null)
{
if (this.filter.ShouldPropertyBeFiltered(this.exceptionType, key, value))
{
return;
}
}
this.properties.Add(key, value);
}
}
} | namespace Serilog.Exceptions.Core
{
using System;
using System.Collections.Generic;
using Serilog.Exceptions.Filters;
internal class ExceptionPropertiesBag : IExceptionPropertiesBag
{
private readonly Type exceptionType;
private readonly IExceptionPropertyFilter filter;
private readonly Dictionary<string, object> properties = new Dictionary<string, object>();
private bool resultsCollected = false;
public ExceptionPropertiesBag(Type exceptionType, IExceptionPropertyFilter filter = null)
{
this.exceptionType = exceptionType;
this.filter = filter;
}
public IReadOnlyDictionary<string, object> GetResultDictionary()
{
this.resultsCollected = true;
return this.properties;
}
public void AddProperty(string key, object value)
{
if (key == null)
{
throw new ArgumentNullException(nameof(key), "Cannot add exception property without a key");
}
if (this.resultsCollected)
{
throw new InvalidOperationException($"Cannot add exception property '{key}' to bag, after results were already collected");
}
if (this.filter != null)
{
if (this.filter.ShouldPropertyBeFiltered(this.exceptionType, key, value))
{
return;
}
}
this.properties.Add(key, value);
}
}
} | mit | C# |
2e0eb93a7c20896471789353d8f492581b53b875 | Fix crash in Serializer on MessageCommand.End or empty getter | Xeeynamo/KingdomHearts | kh.kh2/Messages/MsgSerializer.Text.cs | kh.kh2/Messages/MsgSerializer.Text.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace kh.kh2.Messages
{
public partial class MsgSerializer
{
public static string SerializeText(IEnumerable<MessageCommandModel> entries)
{
var sb = new StringBuilder();
foreach (var entry in entries)
sb.Append(SerializeToText(entry));
return sb.ToString();
}
public static string SerializeToText(MessageCommandModel entry)
{
if (entry.Command == MessageCommand.End)
return string.Empty;
if (entry.Command == MessageCommand.PrintText)
return entry.Text;
if (entry.Command == MessageCommand.PrintComplex)
return $"{{{entry.Text}}}";
if (entry.Command == MessageCommand.NewLine)
return "\n";
if (entry.Command == MessageCommand.Tabulation)
return "\t";
if (!_serializer.TryGetValue(entry.Command, out var serializeModel))
throw new NotImplementedException($"The command {entry.Command} serialization is not implemented yet.");
Debug.Assert(serializeModel != null, $"BUG: {nameof(serializeModel)} should never be null");
if (serializeModel.ValueGetter != null)
return $"{{:{serializeModel.Name} {serializeModel.ValueGetter(entry)}}}";
return $"{{:{serializeModel.Name}}}";
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace kh.kh2.Messages
{
public partial class MsgSerializer
{
public static string SerializeText(IEnumerable<MessageCommandModel> entries)
{
var sb = new StringBuilder();
foreach (var entry in entries)
sb.Append(SerializeToText(entry));
return sb.ToString();
}
public static string SerializeToText(MessageCommandModel entry)
{
if (entry.Command == MessageCommand.PrintText)
return entry.Text;
if (entry.Command == MessageCommand.PrintComplex)
return $"{{{entry.Text}}}";
if (entry.Command == MessageCommand.NewLine)
return "\n";
if (entry.Command == MessageCommand.Tabulation)
return "\t";
if (!_serializer.TryGetValue(entry.Command, out var serializeModel))
throw new NotImplementedException($"The command {entry.Command} serialization is not implemented yet.");
return $"{{:{serializeModel.Name} {serializeModel.ValueGetter(entry)}}}";
}
}
}
| mit | C# |
f5bdb497d0b99785ab0d855aceaeb707e768f4fb | Fix #8335: Make ConfigurationClientOptions.Version property internal. (#8336) | ayeletshpigelman/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,markcowl/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,hyonholee/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,stankovski/azure-sdk-for-net,hyonholee/azure-sdk-for-net,hyonholee/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,stankovski/azure-sdk-for-net,hyonholee/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,hyonholee/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net | sdk/appconfiguration/Azure.Data.AppConfiguration/src/ConfigurationClientOptions.cs | sdk/appconfiguration/Azure.Data.AppConfiguration/src/ConfigurationClientOptions.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using Azure.Core;
using Azure.Core.Pipeline;
namespace Azure.Data.AppConfiguration
{
/// <summary>
/// Options that allow to configure the management of the request sent to the service
/// </summary>
public class ConfigurationClientOptions : ClientOptions
{
/// <summary>
/// The latest service version supported by this client library.
/// </summary>
internal const ServiceVersion LatestVersion = ServiceVersion.V1_0;
/// <summary>
/// The versions of App Config Service supported by this client library.
/// </summary>
public enum ServiceVersion
{
#pragma warning disable CA1707 // Identifiers should not contain underscores
/// <summary>
/// Uses the latest service version
/// </summary>
V1_0 = 0
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
/// <summary>
/// Gets the <see cref="ServiceVersion"/> of the service API used when
/// making requests.
/// </summary>
internal ServiceVersion Version { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationClientOptions"/>
/// class.
/// </summary>
/// <param name="version">
/// The <see cref="ServiceVersion"/> of the service API used when
/// making requests.
/// </param>
public ConfigurationClientOptions(ServiceVersion version = LatestVersion)
{
Version = version;
this.ConfigureLogging();
}
internal string GetVersionString()
{
switch (Version)
{
case ServiceVersion.V1_0:
return "1.0";
default:
throw new ArgumentException(Version.ToString());
}
}
}
}
| // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using Azure.Core;
using Azure.Core.Pipeline;
namespace Azure.Data.AppConfiguration
{
/// <summary>
/// Options that allow to configure the management of the request sent to the service
/// </summary>
public class ConfigurationClientOptions : ClientOptions
{
/// <summary>
/// The latest service version supported by this client library.
/// </summary>
internal const ServiceVersion LatestVersion = ServiceVersion.V1_0;
/// <summary>
/// The versions of App Config Service supported by this client library.
/// </summary>
public enum ServiceVersion
{
#pragma warning disable CA1707 // Identifiers should not contain underscores
/// <summary>
/// Uses the latest service version
/// </summary>
V1_0 = 0
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
/// <summary>
/// Gets the <see cref="ServiceVersion"/> of the service API used when
/// making requests.
/// </summary>
public ServiceVersion Version { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationClientOptions"/>
/// class.
/// </summary>
/// <param name="version">
/// The <see cref="ServiceVersion"/> of the service API used when
/// making requests.
/// </param>
public ConfigurationClientOptions(ServiceVersion version = LatestVersion)
{
Version = version;
this.ConfigureLogging();
}
internal string GetVersionString()
{
switch (Version)
{
case ServiceVersion.V1_0:
return "1.0";
default:
throw new ArgumentException(Version.ToString());
}
}
}
}
| mit | C# |
8f645cc7efe285f8b5c356040616f2dd7b2d8fb1 | Apply suggestions from code review | bartdesmet/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,physhi/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,eriawan/roslyn,sharwell/roslyn,diryboy/roslyn,wvdd007/roslyn,eriawan/roslyn,KevinRansom/roslyn,sharwell/roslyn,bartdesmet/roslyn,eriawan/roslyn,wvdd007/roslyn,dotnet/roslyn,dotnet/roslyn,mavasani/roslyn,weltkante/roslyn,mavasani/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,wvdd007/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,weltkante/roslyn,physhi/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn | src/Tools/ExternalAccess/DotNetWatch/DotNetWatchEditAndContinueWorkspaceService.cs | src/Tools/ExternalAccess/DotNetWatch/DotNetWatchEditAndContinueWorkspaceService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.EditAndContinue;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.ExternalAccess.DotNetWatch
{
[ExportWorkspaceService(typeof(DotNetWatchEditAndContinueWorkspaceService))]
[Shared]
internal sealed class DotNetWatchEditAndContinueWorkspaceService : IWorkspaceService
{
private readonly SolutionActiveStatementSpanProvider _nullSolutionActiveStatementSpanProvider = (_, _) => new(ImmutableArray<TextSpan>.Empty);
private readonly IEditAndContinueWorkspaceService _workspaceService;
[ImportingConstructor]
[Obsolete("This exported object must be obtained through the MEF export provider.", error: true)]
public DotNetWatchEditAndContinueWorkspaceService(IEditAndContinueWorkspaceService workspaceService)
{
_workspaceService = workspaceService;
}
public Task OnSourceFileUpdatedAsync(Document document, CancellationToken cancellationToken)
=> _workspaceService.OnSourceFileUpdatedAsync(document, cancellationToken);
public void CommitSolutionUpdate() => _workspaceService.CommitSolutionUpdate();
public void DiscardSolutionUpdate() => _workspaceService.DiscardSolutionUpdate();
public void EndDebuggingSession() => _workspaceService.EndDebuggingSession(out _);
public void StartDebuggingSession(Solution solution) => _workspaceService.StartDebuggingSession(solution);
public void StartEditSession() => _workspaceService.StartEditSession(StubManagedEditAndContinueDebuggerService.Instance, out _);
public void EndEditSession() => _workspaceService.EndEditSession(out _);
public async ValueTask<DotNetWatchManagedModuleUpdates> EmitSolutionUpdateAsync(Solution solution, CancellationToken cancellationToken)
{
var (updates, _) = await _workspaceService.EmitSolutionUpdateAsync(solution, _nullSolutionActiveStatementSpanProvider, cancellationToken).ConfigureAwait(false);
var forwardingUpdates = new DotNetWatchManagedModuleUpdates(
(DotNetWatchManagedModuleUpdateStatus)updates.Status,
ImmutableArray.CreateRange(updates.Updates, u => new DotNetWatchManagedModuleUpdate(u.Module, u.ILDelta, u.MetadataDelta, u.PdbDelta, u.UpdatedMethods)));
return (forwardingUpdates);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.EditAndContinue;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.ExternalAccess.DotNetWatch
{
[Export]
[Shared]
internal sealed class DotNetWatchEditAndContinueWorkspaceService : IWorkspaceService
{
private readonly SolutionActiveStatementSpanProvider _nullSolutionActiveStatementSpanProvider = (_, __) => new(ImmutableArray<TextSpan>.Empty);
private readonly IEditAndContinueWorkspaceService _workspaceService;
[ImportingConstructor]
[Obsolete("This exported object must be obtained through the MEF export provider.", error: true)]
public DotNetWatchEditAndContinueWorkspaceService(IEditAndContinueWorkspaceService workspaceService)
{
_workspaceService = workspaceService;
}
public Task OnSourceFileUpdatedAsync(Document document, CancellationToken cancellationToken)
=> _workspaceService.OnSourceFileUpdatedAsync(document, cancellationToken);
public void CommitSolutionUpdate() => _workspaceService.CommitSolutionUpdate();
public void DiscardSolutionUpdate() => _workspaceService.DiscardSolutionUpdate();
public void EndDebuggingSession() => _workspaceService.EndDebuggingSession(out _);
public void StartDebuggingSession(Solution solution) => _workspaceService.StartDebuggingSession(solution);
public void StartEditSession() => _workspaceService.StartEditSession(StubManagedEditAndContinueDebuggerService.Instance, out _);
public void EndEditSession() => _workspaceService.EndEditSession(out _);
public async ValueTask<DotNetWatchManagedModuleUpdates> EmitSolutionUpdateAsync(Solution solution, CancellationToken cancellationToken)
{
var (updates, _) = await _workspaceService.EmitSolutionUpdateAsync(solution, _nullSolutionActiveStatementSpanProvider, cancellationToken).ConfigureAwait(false);
var forwardingUpdates = new DotNetWatchManagedModuleUpdates(
(DotNetWatchManagedModuleUpdateStatus)updates.Status,
ImmutableArray.CreateRange(updates.Updates, u => new DotNetWatchManagedModuleUpdate(u.Module, u.ILDelta, u.MetadataDelta, u.PdbDelta, u.UpdatedMethods)));
return (forwardingUpdates);
}
}
}
| mit | C# |
741154d653bb305699d8080d88065f2b929cdcd0 | add more failing tests more specific to the particular problem in binding with complex property path like property.item1.item2.item3 | jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,Perspex/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,akrisiun/Perspex | tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_Property.cs | tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_Property.cs | using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;
using Avalonia.Data;
using Avalonia.Markup.Parsers;
using Xunit;
namespace Avalonia.Markup.UnitTests.Parsers
{
public class ExpressionObserverBuilderTests_Property
{
[Fact]
public async Task Should_Return_BindingNotification_Error_For_Broken_Chain()
{
var data = new { Foo = new { Bar = 1 } };
var target = ExpressionObserverBuilder.Build(data, "Foo.Bar.Baz");
var result = await target.Take(1);
Assert.IsType<BindingNotification>(result);
Assert.Equal(
new BindingNotification(
new MissingMemberException("Could not find CLR property 'Baz' on '1'"), BindingErrorType.Error),
result);
GC.KeepAlive(data);
}
[Fact]
public void Should_Have_Null_ResultType_For_Broken_Chain()
{
var data = new { Foo = new { Bar = 1 } };
var target = ExpressionObserverBuilder.Build(data, "Foo.Bar.Baz");
Assert.Null(target.ResultType);
GC.KeepAlive(data);
}
[Fact]
public void Should_Update_Value_After_Root_Changes()
{
var root = new { DataContext = new { Value = "Foo" } };
var subject = new Subject<object>();
var obs = ExpressionObserverBuilder.Build(subject, "DataContext.Value");
var values = new List<object>();
obs.Subscribe(v => values.Add(v));
subject.OnNext(root);
subject.OnNext(null);
subject.OnNext(root);
Assert.Equal("Foo", values[0]);
Assert.IsType<BindingNotification>(values[1]);
var bn = values[1] as BindingNotification;
Assert.Equal(AvaloniaProperty.UnsetValue, bn.Value);
Assert.Equal(BindingErrorType.Error, bn.ErrorType);
Assert.Equal(3, values.Count);
Assert.Equal("Foo", values[2]);
}
[Fact]
public void Should_Update_Value_After_Root_Changes_With_ComplexPath()
{
var root = new { DataContext = new { Foo = new { Value = "Foo" } } };
var subject = new Subject<object>();
var obs = ExpressionObserverBuilder.Build(subject, "DataContext.Foo.Value");
var values = new List<object>();
obs.Subscribe(v => values.Add(v));
subject.OnNext(root);
subject.OnNext(null);
subject.OnNext(root);
Assert.Equal("Foo", values[0]);
Assert.IsType<BindingNotification>(values[1]);
var bn = values[1] as BindingNotification;
Assert.Equal(AvaloniaProperty.UnsetValue, bn.Value);
Assert.Equal(BindingErrorType.Error, bn.ErrorType);
Assert.Equal(3, values.Count);
Assert.Equal("Foo", values[2]);
}
}
}
| using Avalonia.Data;
using Avalonia.Markup.Parsers;
using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Avalonia.Markup.UnitTests.Parsers
{
public class ExpressionObserverBuilderTests_Property
{
[Fact]
public async Task Should_Return_BindingNotification_Error_For_Broken_Chain()
{
var data = new { Foo = new { Bar = 1 } };
var target = ExpressionObserverBuilder.Build(data, "Foo.Bar.Baz");
var result = await target.Take(1);
Assert.IsType<BindingNotification>(result);
Assert.Equal(
new BindingNotification(
new MissingMemberException("Could not find CLR property 'Baz' on '1'"), BindingErrorType.Error),
result);
GC.KeepAlive(data);
}
[Fact]
public void Should_Have_Null_ResultType_For_Broken_Chain()
{
var data = new { Foo = new { Bar = 1 } };
var target = ExpressionObserverBuilder.Build(data, "Foo.Bar.Baz");
Assert.Null(target.ResultType);
GC.KeepAlive(data);
}
}
}
| mit | C# |
63386dc390ec777a7c60f8b75cc119ba9905334f | Add comment and add masking back. | Nabile-Rahmani/osu-framework,RedNesto/osu-framework,Tom94/osu-framework,naoey/osu-framework,peppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,paparony03/osu-framework,peppy/osu-framework,naoey/osu-framework,RedNesto/osu-framework,EVAST9919/osu-framework,default0/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,Nabile-Rahmani/osu-framework,Tom94/osu-framework,ppy/osu-framework,default0/osu-framework,EVAST9919/osu-framework,paparony03/osu-framework,ZLima12/osu-framework,ppy/osu-framework | osu.Framework/Graphics/Containers/CircularContainer.cs | osu.Framework/Graphics/Containers/CircularContainer.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// A container which come with masking and automatic corner radius based on the smallest edge div 2.
/// </summary>
public class CircularContainer : Container
{
public CircularContainer()
{
Masking = true;
}
public override float CornerRadius
{
get
{
return Math.Min(DrawSize.X, DrawSize.Y) / 2f;
}
set
{
throw new InvalidOperationException($"Cannot manually set {nameof(CornerRadius)} of {nameof(CircularContainer)}.");
}
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
namespace osu.Framework.Graphics.Containers
{
public class CircularContainer : Container
{
public override float CornerRadius
{
get
{
return Math.Min(DrawSize.X, DrawSize.Y) / 2f;
}
set
{
throw new InvalidOperationException($"Cannot manually set {nameof(CornerRadius)} of {nameof(CircularContainer)}.");
}
}
}
}
| mit | C# |
b37f430309526365f8aaa0ee8a84ca895e73c99b | Add ci target | xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents | Android/GoogleDagger/build.cake | Android/GoogleDagger/build.cake |
#load "../../common.cake"
var TARGET = Argument ("t", Argument ("target", "ci"));
var DAGGERS_VERSION = "2.13";
var DAGGERS_NUGET_VERSION = DAGGERS_VERSION;
var DAGGERS_URL = $"http://central.maven.org/maven2/com/google/dagger/dagger/{DAGGERS_VERSION}/dagger-{DAGGERS_VERSION}.jar";
Task ("externals")
.WithCriteria (!FileExists ("./externals/dagger.jar"))
.Does (() =>
{
EnsureDirectoryExists ("./externals");
// Download Dependencies
DownloadFile (DAGGERS_URL, "./externals/dagger.jar");
// Update .csproj nuget versions
XmlPoke("./source/dagger/dagger.csproj", "/Project/PropertyGroup/PackageVersion", DAGGERS_NUGET_VERSION);
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
MSBuild("./GoogleDagger.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.MaxCpuCount = 0;
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("nuget")
.IsDependentOn("libs")
.Does(() =>
{
MSBuild ("./GoogleDagger.sln", c => {
c.Configuration = "Release";
c.MaxCpuCount = 0;
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("samples")
.IsDependentOn("nuget");
Task("ci")
.IsDependentOn("samples");
Task ("clean")
.Does (() =>
{
if (DirectoryExists ("./externals/"))
DeleteDirectory ("./externals", new DeleteDirectorySettings {
Recursive = true,
Force = true
});
});
RunTarget (TARGET);
|
#load "../../common.cake"
var TARGET = Argument ("t", Argument ("target", "Default"));
var DAGGERS_VERSION = "2.13";
var DAGGERS_NUGET_VERSION = DAGGERS_VERSION;
var DAGGERS_URL = $"http://central.maven.org/maven2/com/google/dagger/dagger/{DAGGERS_VERSION}/dagger-{DAGGERS_VERSION}.jar";
Task ("externals")
.WithCriteria (!FileExists ("./externals/dagger.jar"))
.Does (() =>
{
EnsureDirectoryExists ("./externals");
// Download Dependencies
DownloadFile (DAGGERS_URL, "./externals/dagger.jar");
// Update .csproj nuget versions
XmlPoke("./source/dagger/dagger.csproj", "/Project/PropertyGroup/PackageVersion", DAGGERS_NUGET_VERSION);
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
MSBuild("./GoogleDagger.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.MaxCpuCount = 0;
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("nuget")
.IsDependentOn("libs")
.Does(() =>
{
MSBuild ("./GoogleDagger.sln", c => {
c.Configuration = "Release";
c.MaxCpuCount = 0;
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("samples")
.IsDependentOn("nuget");
Task ("clean")
.Does (() =>
{
if (DirectoryExists ("./externals/"))
DeleteDirectory ("./externals", new DeleteDirectorySettings {
Recursive = true,
Force = true
});
});
RunTarget (TARGET);
| mit | C# |
129f82818e8729ee254c16cf84d24d94941975ff | put test | zhongzf/aspnetcore-demo,zhongzf/aspnetcore-demo,zhongzf/aspnetcore-demo | src/aspnetcore-demo/Program.cs | src/aspnetcore-demo/Program.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace aspnetcore_demo
{
public class Program
{
public static void Main(string[] args)
{
IConfiguration config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace aspnetcore_demo
{
public class Program
{
public static void Main(string[] args)
{
IConfiguration config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
| mit | C# |
485be2b972640a0401ae8cef6d6f891f138f753b | Fix comment explaining test | hubuk/CodeContracts,Microsoft/CodeContracts,sharwell/CodeContracts,SergeyTeplyakov/CodeContracts,danielcweber/CodeContracts,huoxudong125/CodeContracts,SergeyTeplyakov/CodeContracts,Microsoft/CodeContracts,danachap/CodeContracts,ndykman/CodeContracts,ndykman/CodeContracts,sharwell/CodeContracts,Microsoft/CodeContracts,SergeyTeplyakov/CodeContracts,danielcweber/CodeContracts,danachap/CodeContracts,ndykman/CodeContracts,hubuk/CodeContracts,huoxudong125/CodeContracts,danachap/CodeContracts,danielcweber/CodeContracts,ndykman/CodeContracts,ndykman/CodeContracts,Microsoft/CodeContracts,hubuk/CodeContracts,SergeyTeplyakov/CodeContracts,huoxudong125/CodeContracts,ndykman/CodeContracts,SergeyTeplyakov/CodeContracts,huoxudong125/CodeContracts,Microsoft/CodeContracts,Microsoft/CodeContracts,sharwell/CodeContracts,hubuk/CodeContracts,sharwell/CodeContracts,sharwell/CodeContracts,SergeyTeplyakov/CodeContracts,danielcweber/CodeContracts,ndykman/CodeContracts,danachap/CodeContracts,huoxudong125/CodeContracts,huoxudong125/CodeContracts,sharwell/CodeContracts,danielcweber/CodeContracts,hubuk/CodeContracts,danachap/CodeContracts,danachap/CodeContracts,hubuk/CodeContracts,danielcweber/CodeContracts,danachap/CodeContracts,sharwell/CodeContracts,Microsoft/CodeContracts,danielcweber/CodeContracts,huoxudong125/CodeContracts,hubuk/CodeContracts,SergeyTeplyakov/CodeContracts | Foxtrot/Tests/Sources/ComplexGeneric.cs | Foxtrot/Tests/Sources/ComplexGeneric.cs | // CodeContracts
//
// Copyright (c) Microsoft Corporation
//
// All rights reserved.
//
// MIT License
//
// 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.
//
// This is a regression test for Microsoft/CodeContracts#20:
//
// Unable to cast object of type 'System.Compiler.TypeParameter' to type 'System.Compiler.Class'.
//
// https://github.com/Microsoft/CodeContracts/issues/20
//
using System.Diagnostics.Contracts;
namespace Tests.Sources
{
// CCRewriter was unable to read this code from the IL due to an issue in CCI.
// This test just makes sure that the fix is in place.
public interface IIdentityObject<out TIdentity>
{
}
public abstract class DefaultDomainBLLBase<TPersistentDomainObjectBase, TDomainObjectBase, TDomainObject, TIdent>
where TPersistentDomainObjectBase : class, IIdentityObject<TIdent>, TDomainObjectBase
where TDomainObjectBase : class
where TDomainObject : class, TPersistentDomainObjectBase
{
protected TDomainObject GetNested<TNestedDomainObject>(TDomainObject x) where TNestedDomainObject : TDomainObject
{
return default(TDomainObject);
}
}
public abstract class DefaultSecurityDomainBLLBase<TPersistentDomainObjectBase, TDomainObjectBase, TDomainObject, TIdent>
: DefaultDomainBLLBase<TPersistentDomainObjectBase, TDomainObjectBase, TDomainObject, TIdent>
where TPersistentDomainObjectBase : class, IIdentityObject<TIdent>, TDomainObjectBase
where TDomainObjectBase : class
where TDomainObject : class, TPersistentDomainObjectBase
{
}
partial class TestMain
{
partial void Run()
{
if (!this.behave)
{
throw new System.ArgumentNullException();
}
}
public ContractFailureKind NegativeExpectedKind = ContractFailureKind.Precondition;
public string NegativeExpectedCondition = "Value cannot be null.";
}
}
| // CodeContracts
//
// Copyright (c) Microsoft Corporation
//
// All rights reserved.
//
// MIT License
//
// 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.
//
// We test here that ?? operators which are compiled to Dup if then pop else .. by C# do not cause
// unwarranted warnings in the extractor.
//
using System.Diagnostics.Contracts;
namespace Tests.Sources
{
// CCRewriter was unable to read this code from the IL due to an issue in CCI.
// This test just makes sure that the fix is in place.
public interface IIdentityObject<out TIdentity>
{
}
public abstract class DefaultDomainBLLBase<TPersistentDomainObjectBase, TDomainObjectBase, TDomainObject, TIdent>
where TPersistentDomainObjectBase : class, IIdentityObject<TIdent>, TDomainObjectBase
where TDomainObjectBase : class
where TDomainObject : class, TPersistentDomainObjectBase
{
protected TDomainObject GetNested<TNestedDomainObject>(TDomainObject x) where TNestedDomainObject : TDomainObject
{
return default(TDomainObject);
}
}
public abstract class DefaultSecurityDomainBLLBase<TPersistentDomainObjectBase, TDomainObjectBase, TDomainObject, TIdent>
: DefaultDomainBLLBase<TPersistentDomainObjectBase, TDomainObjectBase, TDomainObject, TIdent>
where TPersistentDomainObjectBase : class, IIdentityObject<TIdent>, TDomainObjectBase
where TDomainObjectBase : class
where TDomainObject : class, TPersistentDomainObjectBase
{
}
partial class TestMain
{
partial void Run()
{
if (!this.behave)
{
throw new System.ArgumentNullException();
}
}
public ContractFailureKind NegativeExpectedKind = ContractFailureKind.Precondition;
public string NegativeExpectedCondition = "Value cannot be null.";
}
}
| mit | C# |
79d2a285c7129d8620921495d248ecc870aca261 | Make EthernetDevice compile again and dispose resources better | eyecreate/tapcfg,eyecreate/tapcfg,eyecreate/tapcfg,eyecreate/tapcfg,zhanleewo/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,juhovh/tapcfg,juhovh/tapcfg,eyecreate/tapcfg,zhanleewo/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg | src/bindings/EthernetDevice.cs | src/bindings/EthernetDevice.cs |
using System;
using System.Runtime.InteropServices;
namespace TAPCfg {
public class EthernetDevice : IDisposable {
private const int MTU = 1522;
private IntPtr handle;
private bool disposed = false;
public EthernetDevice() {
handle = tapcfg_init();
}
public void Start() {
tapcfg_start(handle);
}
public byte[] Read() {
int length;
byte[] buffer = new byte[MTU];
length = tapcfg_read(handle, buffer, buffer.Length);
byte[] outbuf = new byte[length];
Array.Copy(buffer, 0, outbuf, 0, length);
return outbuf;
}
public void Write(byte[] data) {
byte[] buffer = new byte[MTU];
Array.Copy(data, 0, buffer, 0, data.Length);
int ret = tapcfg_write(handle, buffer, data.Length);
}
public void Enabled(bool enabled) {
if (enabled)
tapcfg_iface_change_status(handle, 1);
else
tapcfg_iface_change_status(handle, 0);
}
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
if (!disposed) {
if (disposing) {
// Managed resources can be disposed here
}
tapcfg_stop(handle);
tapcfg_destroy(handle);
handle = IntPtr.Zero;
disposed = true;
}
}
private static void Main(string[] args) {
EthernetDevice dev = new EthernetDevice();
dev.Start();
dev.Enabled(true);
System.Threading.Thread.Sleep(100000);
}
[DllImport("libtapcfg")]
private static extern IntPtr tapcfg_init();
[DllImport("libtapcfg")]
private static extern void tapcfg_destroy(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_start(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern void tapcfg_stop(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_has_data(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_read(IntPtr tapcfg, byte[] buf, int count);
[DllImport("libtapcfg")]
private static extern int tapcfg_write(IntPtr tapcfg, byte[] buf, int count);
[DllImport("libtapcfg")]
private static extern string tapcfg_get_ifname(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_iface_get_status(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_iface_change_status(IntPtr tapcfg, int enabled);
[DllImport("libtapcfg")]
private static extern int tapcfg_iface_set_ipv4(IntPtr tapcfg, string addr, Byte netbits);
[DllImport("libtapcfg")]
private static extern int tapcfg_iface_set_ipv6(IntPtr tapcfg, string addr, Byte netbits);
}
}
|
using System;
using System.Runtime.InteropServices;
namespace TAPCfg {
public class EthernetDevice : IDisposable {
private const int MTU = 1522;
private IntPtr handle;
public EthernetDevice() {
handle = tapcfg_init();
}
public void Start() {
tapcfg_start(handle);
}
public byte[] Read() {
int length;
byte[] buffer = new byte[MTU];
length = tapcfg_read(handle, buffer, buffer.Length);
byte[] outbuf = new byte[length];
Array.Copy(buffer, 0, outbuf, 0, length);
return outbuf;
}
public void Write(byte[] data) {
byte[] buffer = new byte[MTU];
Array.Copy(data, 0, buffer, 0, data.Length);
int ret = tapcfg_write(handle, buffer, data.Length);
}
public void Enabled(bool enabled) {
if (enabled)
tapcfg_iface_change_status(handle, 1);
else
tapcfg_iface_change_status(handle, 0);
}
public void Dispose() {
this.Dispose(true);
}
protected virtual void Dispose(bool fromDisposeMethod) {
tapcfg_stop(handle);
tapcfg_destroy(handle);
if (fromDisposeMethod) {
GC.SuppressFinalize(this);
}
}
private static void Main(string[] args) {
EthernetDevice dev = new EthernetDevice();
dev.Start();
dev.Enabled(true);
System.Threading.Thread.Sleep(100000);
}
[DllImport("libtapcfg")]
private static extern IntPtr tapcfg_init();
[DllImport("libtapcfg")]
private static extern void tapcfg_destroy(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_start(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern void tapcfg_stop(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_has_data(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_read(IntPtr tapcfg, byte[] buf, int count);
[DllImport("libtapcfg")]
private static extern int tapcfg_write(IntPtr tapcfg, byte[] buf, int count);
[DllImport("libtapcfg")]
private static extern string tapcfg_get_ifname(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_iface_get_status(IntPtr tapcfg);
[DllImport("libtapcfg")]
private static extern int tapcfg_iface_change_status(IntPtr tapcfg, int enabled);
[DllImport("libtapcfg")]
private static extern int tapcfg_iface_set_ipv4(IntPtr tapcfg, string addr, Uint8 netbits);
[DllImport("libtapcfg")]
private static extern int tapcfg_iface_set_ipv6(IntPtr tapcfg, string addr, Uint8 netbits);
}
}
| lgpl-2.1 | C# |
477bd7fa613c75a6b535324cf59e42bdb7dce669 | Change to Resolved attribute | smoogipooo/osu,peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,peppy/osu-new,UselessToucan/osu,ppy/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu | osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs | osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Updater;
namespace osu.Game.Overlays.Settings.Sections.General
{
public class UpdateSettings : SettingsSubsection
{
[Resolved(CanBeNull = true)]
private OsuGameBase game { get; set; }
[Resolved(CanBeNull = true)]
private UpdateManager updateManager { get; set; }
protected override string Header => "Updates";
[BackgroundDependencyLoader(true)]
private void load(Storage storage, OsuConfigManager config)
{
Add(new SettingsEnumDropdown<ReleaseStream>
{
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
});
if (game != null && updateManager != null)
{
Add(new SettingsButton
{
Text = "Check for updates",
Action = updateManager.CheckForUpdate,
Enabled = { Value = game.IsDeployedBuild }
});
}
if (RuntimeInfo.IsDesktop)
{
Add(new SettingsButton
{
Text = "Open osu! folder",
Action = storage.OpenInNativeExplorer,
});
}
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Updater;
namespace osu.Game.Overlays.Settings.Sections.General
{
public class UpdateSettings : SettingsSubsection
{
protected override string Header => "Updates";
[BackgroundDependencyLoader(true)]
private void load(Storage storage, OsuConfigManager config, OsuGameBase game, UpdateManager updateManager)
{
Add(new SettingsEnumDropdown<ReleaseStream>
{
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
});
if (game != null && updateManager != null)
{
Add(new SettingsButton
{
Text = "Check for updates",
Action = updateManager.CheckForUpdate,
Enabled = { Value = game.IsDeployedBuild }
});
}
if (RuntimeInfo.IsDesktop)
{
Add(new SettingsButton
{
Text = "Open osu! folder",
Action = storage.OpenInNativeExplorer,
});
}
}
}
}
| mit | C# |
9486b0e987a27bd4b2791ba2abf1d43b1438bad8 | Remove array allocation from IPAddressExtensions.Snapshot | MaggieTsang/corefx,dotnet-bot/corefx,seanshpark/corefx,cydhaselton/corefx,stone-li/corefx,weltkante/corefx,stephenmichaelf/corefx,krytarowski/corefx,rubo/corefx,krytarowski/corefx,ViktorHofer/corefx,krk/corefx,dhoehna/corefx,axelheer/corefx,lggomez/corefx,Ermiar/corefx,zhenlan/corefx,elijah6/corefx,wtgodbe/corefx,fgreinacher/corefx,ViktorHofer/corefx,cydhaselton/corefx,BrennanConroy/corefx,rjxby/corefx,mazong1123/corefx,alexperovich/corefx,gkhanna79/corefx,rahku/corefx,mmitche/corefx,dotnet-bot/corefx,nchikanov/corefx,axelheer/corefx,weltkante/corefx,billwert/corefx,Ermiar/corefx,richlander/corefx,nchikanov/corefx,MaggieTsang/corefx,stone-li/corefx,zhenlan/corefx,Petermarcu/corefx,Ermiar/corefx,rjxby/corefx,nchikanov/corefx,richlander/corefx,billwert/corefx,twsouthwick/corefx,richlander/corefx,billwert/corefx,elijah6/corefx,rubo/corefx,elijah6/corefx,dhoehna/corefx,dhoehna/corefx,JosephTremoulet/corefx,shimingsg/corefx,marksmeltzer/corefx,billwert/corefx,parjong/corefx,tijoytom/corefx,JosephTremoulet/corefx,ravimeda/corefx,axelheer/corefx,Ermiar/corefx,parjong/corefx,mmitche/corefx,cydhaselton/corefx,jlin177/corefx,parjong/corefx,richlander/corefx,YoupHulsebos/corefx,mmitche/corefx,gkhanna79/corefx,nbarbettini/corefx,rahku/corefx,billwert/corefx,marksmeltzer/corefx,parjong/corefx,YoupHulsebos/corefx,parjong/corefx,jlin177/corefx,krytarowski/corefx,the-dwyer/corefx,DnlHarvey/corefx,mazong1123/corefx,fgreinacher/corefx,stone-li/corefx,tijoytom/corefx,stephenmichaelf/corefx,the-dwyer/corefx,mmitche/corefx,JosephTremoulet/corefx,DnlHarvey/corefx,Petermarcu/corefx,nchikanov/corefx,DnlHarvey/corefx,lggomez/corefx,yizhang82/corefx,YoupHulsebos/corefx,lggomez/corefx,ViktorHofer/corefx,Petermarcu/corefx,krk/corefx,krk/corefx,mmitche/corefx,krk/corefx,ericstj/corefx,nbarbettini/corefx,seanshpark/corefx,twsouthwick/corefx,zhenlan/corefx,ptoonen/corefx,rjxby/corefx,cydhaselton/corefx,nbarbettini/corefx,YoupHulsebos/corefx,axelheer/corefx,dotnet-bot/corefx,dotnet-bot/corefx,zhenlan/corefx,YoupHulsebos/corefx,the-dwyer/corefx,weltkante/corefx,mazong1123/corefx,lggomez/corefx,stone-li/corefx,rahku/corefx,marksmeltzer/corefx,shimingsg/corefx,gkhanna79/corefx,nbarbettini/corefx,stephenmichaelf/corefx,JosephTremoulet/corefx,shimingsg/corefx,yizhang82/corefx,gkhanna79/corefx,ViktorHofer/corefx,BrennanConroy/corefx,MaggieTsang/corefx,BrennanConroy/corefx,fgreinacher/corefx,ptoonen/corefx,mazong1123/corefx,Jiayili1/corefx,rahku/corefx,jlin177/corefx,Ermiar/corefx,alexperovich/corefx,stephenmichaelf/corefx,seanshpark/corefx,seanshpark/corefx,alexperovich/corefx,mazong1123/corefx,tijoytom/corefx,ericstj/corefx,marksmeltzer/corefx,JosephTremoulet/corefx,dhoehna/corefx,Jiayili1/corefx,the-dwyer/corefx,stone-li/corefx,ViktorHofer/corefx,Petermarcu/corefx,weltkante/corefx,parjong/corefx,shimingsg/corefx,Jiayili1/corefx,jlin177/corefx,gkhanna79/corefx,twsouthwick/corefx,tijoytom/corefx,MaggieTsang/corefx,ericstj/corefx,wtgodbe/corefx,nbarbettini/corefx,Jiayili1/corefx,twsouthwick/corefx,marksmeltzer/corefx,weltkante/corefx,nbarbettini/corefx,mmitche/corefx,gkhanna79/corefx,mmitche/corefx,nchikanov/corefx,jlin177/corefx,mazong1123/corefx,zhenlan/corefx,ptoonen/corefx,stone-li/corefx,krytarowski/corefx,weltkante/corefx,JosephTremoulet/corefx,krk/corefx,cydhaselton/corefx,dhoehna/corefx,ericstj/corefx,stephenmichaelf/corefx,rjxby/corefx,rubo/corefx,ptoonen/corefx,rubo/corefx,shimingsg/corefx,lggomez/corefx,DnlHarvey/corefx,marksmeltzer/corefx,dotnet-bot/corefx,rahku/corefx,nchikanov/corefx,rahku/corefx,ericstj/corefx,ravimeda/corefx,jlin177/corefx,seanshpark/corefx,ravimeda/corefx,DnlHarvey/corefx,twsouthwick/corefx,parjong/corefx,wtgodbe/corefx,rjxby/corefx,elijah6/corefx,tijoytom/corefx,ericstj/corefx,shimingsg/corefx,richlander/corefx,yizhang82/corefx,ptoonen/corefx,richlander/corefx,elijah6/corefx,cydhaselton/corefx,wtgodbe/corefx,alexperovich/corefx,twsouthwick/corefx,ViktorHofer/corefx,dotnet-bot/corefx,ptoonen/corefx,wtgodbe/corefx,wtgodbe/corefx,zhenlan/corefx,stephenmichaelf/corefx,nchikanov/corefx,alexperovich/corefx,Petermarcu/corefx,dotnet-bot/corefx,weltkante/corefx,shimingsg/corefx,billwert/corefx,ViktorHofer/corefx,Ermiar/corefx,DnlHarvey/corefx,alexperovich/corefx,Jiayili1/corefx,jlin177/corefx,gkhanna79/corefx,the-dwyer/corefx,YoupHulsebos/corefx,MaggieTsang/corefx,krytarowski/corefx,rjxby/corefx,Petermarcu/corefx,richlander/corefx,marksmeltzer/corefx,dhoehna/corefx,DnlHarvey/corefx,krytarowski/corefx,rahku/corefx,krk/corefx,ravimeda/corefx,lggomez/corefx,Ermiar/corefx,tijoytom/corefx,yizhang82/corefx,mazong1123/corefx,seanshpark/corefx,Petermarcu/corefx,elijah6/corefx,Jiayili1/corefx,wtgodbe/corefx,tijoytom/corefx,yizhang82/corefx,lggomez/corefx,fgreinacher/corefx,the-dwyer/corefx,rjxby/corefx,zhenlan/corefx,the-dwyer/corefx,MaggieTsang/corefx,Jiayili1/corefx,axelheer/corefx,alexperovich/corefx,stone-li/corefx,stephenmichaelf/corefx,axelheer/corefx,ravimeda/corefx,ravimeda/corefx,krytarowski/corefx,yizhang82/corefx,ericstj/corefx,ptoonen/corefx,elijah6/corefx,YoupHulsebos/corefx,rubo/corefx,seanshpark/corefx,krk/corefx,nbarbettini/corefx,yizhang82/corefx,twsouthwick/corefx,dhoehna/corefx,cydhaselton/corefx,JosephTremoulet/corefx,MaggieTsang/corefx,billwert/corefx,ravimeda/corefx | src/Common/src/System/Net/Internals/IPAddressExtensions.cs | src/Common/src/System/Net/Internals/IPAddressExtensions.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.Diagnostics;
namespace System.Net.Sockets
{
public static class IPAddressExtensions
{
public static IPAddress Snapshot(this IPAddress original)
{
switch (original.AddressFamily)
{
case AddressFamily.InterNetwork:
#pragma warning disable CS0618 // IPAddress.Address is obsoleted, but it's the most efficient way to get the Int32 IPv4 address
return new IPAddress(original.Address);
#pragma warning restore CS0618
case AddressFamily.InterNetworkV6:
return new IPAddress(original.GetAddressBytes(), (uint)original.ScopeId);
}
throw new InternalException();
}
public static long GetAddress(this IPAddress thisObj)
{
byte[] addressBytes = thisObj.GetAddressBytes();
Debug.Assert(addressBytes.Length == 4);
return (long)BitConverter.ToInt32(addressBytes, 0);
}
}
}
| // 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.Diagnostics;
namespace System.Net.Sockets
{
public static class IPAddressExtensions
{
public static IPAddress Snapshot(this IPAddress original)
{
switch (original.AddressFamily)
{
case AddressFamily.InterNetwork:
return new IPAddress(original.GetAddressBytes());
case AddressFamily.InterNetworkV6:
return new IPAddress(original.GetAddressBytes(), (uint)original.ScopeId);
}
throw new InternalException();
}
public static long GetAddress(this IPAddress thisObj)
{
byte[] addressBytes = thisObj.GetAddressBytes();
Debug.Assert(addressBytes.Length == 4);
return (long)BitConverter.ToInt32(addressBytes, 0);
}
}
}
| mit | C# |
576d4eaf8d37bf1d13544a1a55e6047000122c79 | Fix missing docs in 'RequestCultureFeature' | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNet.Localization/RequestCultureFeature.cs | src/Microsoft.AspNet.Localization/RequestCultureFeature.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 Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Localization
{
/// <summary>
/// Provides the current request's culture information.
/// </summary>
public class RequestCultureFeature : IRequestCultureFeature
{
/// <summary>
/// Creates a new <see cref="RequestCultureFeature"/> with the specified <see cref="Localization.RequestCulture"/>.
/// </summary>
/// <param name="requestCulture">The <see cref="Localization.RequestCulture"/>.</param>
/// <param name="provider">The <see cref="IRequestCultureProvider"/>.</param>
public RequestCultureFeature([NotNull] RequestCulture requestCulture, IRequestCultureProvider provider)
{
RequestCulture = requestCulture;
Provider = provider;
}
/// <inheritdoc />
public RequestCulture RequestCulture { get; }
/// <inheritdoc />
public IRequestCultureProvider Provider { get; }
}
}
| // 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 Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Localization
{
/// <summary>
/// Provides the current request's culture information.
/// </summary>
public class RequestCultureFeature : IRequestCultureFeature
{
/// <summary>
/// Creates a new <see cref="RequestCultureFeature"/> with the specified <see cref="Localization.RequestCulture"/>.
/// </summary>
/// <param name="requestCulture">The <see cref="Localization.RequestCulture"/>.</param>
public RequestCultureFeature([NotNull] RequestCulture requestCulture, IRequestCultureProvider provider)
{
RequestCulture = requestCulture;
Provider = provider;
}
/// <inheritdoc />
public RequestCulture RequestCulture { get; }
/// <inheritdoc />
public IRequestCultureProvider Provider { get; }
}
}
| apache-2.0 | C# |
034d63ec039bb6942f553390c6e89d204a56b4ef | bump version to 1.5.6 and update copyright string | martin2250/OpenCNCPilot | OpenCNCPilot/Properties/AssemblyInfo.cs | OpenCNCPilot/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenCNCPilot")]
[assembly: AssemblyDescription("GCode Sender and AutoLeveller")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("martin2250")]
[assembly: AssemblyProduct("OpenCNCPilot")]
[assembly: AssemblyCopyright("Copyright ©martin2250 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.6.0")]
[assembly: AssemblyFileVersion("1.5.6.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenCNCPilot")]
[assembly: AssemblyDescription("GCode Sender and AutoLeveller")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("martin2250")]
[assembly: AssemblyProduct("OpenCNCPilot")]
[assembly: AssemblyCopyright("Copyright ©martin2250 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.5.0")]
[assembly: AssemblyFileVersion("1.5.5.0")]
| mit | C# |
0ebc6ebf218a9a0a2176d2c6ed13a7a0dec3c21b | Add strategy for glider and a row | sgrassie/gol | temporalcohesion.gol.core/DefaultGridPopulationStrategy.cs | temporalcohesion.gol.core/DefaultGridPopulationStrategy.cs | using System;
namespace temporalcohesion.gol.core
{
public interface IGridPopulationStrategy
{
Cell[,] Populate(int x, int y);
}
public class DefaultGridPopulationStrategy : IGridPopulationStrategy
{
private readonly int _seed;
public DefaultGridPopulationStrategy(int seed)
{
_seed = seed;
}
public Cell[,] Populate(int x, int y)
{
var grid = new Cell[x, y];
for (var i = 0; i < x; i++)
{
for (var j = 0; j < y; j++)
{
var cell = new Cell(i, j) { Alive = AliveOrDead(i, j) };
grid[i, j] = cell;
}
}
return grid;
}
private bool AliveOrDead(int x, int y)
{
var random = new Random(_seed);
return (((x ^ y) + random.Next()) % 5) == 0;
}
}
public class GliderPopulationStrategy : IGridPopulationStrategy
{
public Cell[,] Populate(int x, int y)
{
var grid = new Cell[x, y];
for (var i = 0; i < x; i++)
{
for (var j = 0; j < y; j++)
{
var cell = new Cell(i, j) { Alive = false };
grid[i, j] = cell;
}
}
CreateGlider(grid);
return grid;
}
private void CreateGlider(Cell[,] grid)
{
grid[2, 1].Alive = true;
grid[1, 3].Alive = true;
grid[2, 3].Alive = true;
grid[3, 3].Alive = true;
grid[3, 2].Alive = true;
}
}
public class TenCellRowPopulationStrategy : IGridPopulationStrategy
{
public Cell[,] Populate(int x, int y)
{
var grid = new Cell[x, y];
for (var i = 0; i < x; i++)
{
for (var j = 0; j < y; j++)
{
var cell = new Cell(i, j) { Alive = false };
grid[i, j] = cell;
}
}
CreateRow(grid);
return grid;
}
private void CreateRow(Cell[,] grid)
{
grid[10, 10].Alive = true;
grid[10, 11].Alive = true;
grid[10, 12].Alive = true;
grid[10, 13].Alive = true;
grid[10, 14].Alive = true;
grid[10, 15].Alive = true;
grid[10, 16].Alive = true;
grid[10, 17].Alive = true;
grid[10, 18].Alive = true;
grid[10, 19].Alive = true;
}
}
} | using System;
namespace temporalcohesion.gol.core
{
public interface IGridPopulationStrategy
{
Cell[,] Populate(int x, int y);
}
public class DefaultGridPopulationStrategy : IGridPopulationStrategy
{
private readonly int _seed;
public DefaultGridPopulationStrategy(int seed)
{
_seed = seed;
}
public Cell[,] Populate(int x, int y)
{
var grid = new Cell[x, y];
for (var i = 0; i < x; i++)
{
for (var j = 0; j < y; j++)
{
var cell = new Cell(j, i) { Alive = AliveOrDead(j, i) };
grid[j, i] = cell;
}
}
return grid;
}
private bool AliveOrDead(int x, int y)
{
var random = new Random(_seed);
return (((x ^ y) + random.Next()) % 5) == 0;
}
}
} | mit | C# |
5d88a06eba5b4fb59e7fd470eec9c3a4da69ee93 | Implement stat formulas in Memoria.ini | Albeoris/Memoria,Albeoris/Memoria,Albeoris/Memoria,Albeoris/Memoria | Assembly-CSharp/Memoria/Configuration/Access/Battle.cs | Assembly-CSharp/Memoria/Configuration/Access/Battle.cs | using System;
namespace Memoria
{
public sealed partial class Configuration
{
public static class Battle
{
public static Boolean NoAutoTrance => Instance._battle.NoAutoTrance;
public static Int32 Speed => Math.Max(Instance._battle.Speed, Instance._hacks.BattleSpeed);
public static Int32 EncounterInterval => Instance._battle.EncounterInterval;
public static Int32 EncounterInitial => Instance._battle.EncounterInitial;
public static Int32 AutoPotionOverhealLimit => Instance._battle.AutoPotionOverhealLimit;
public static Boolean GarnetConcentrate => Instance._battle.GarnetConcentrate;
public static Boolean SelectBestTarget => Instance._battle.SelectBestTarget;
public static Boolean ViviAutoAttack => Instance._battle.ViviAutoAttack;
public static Boolean CountersBetterTarget => Instance._battle.CountersBetterTarget;
public static Int32 SummonPriorityCount => Instance._battle.SummonPriorityCount;
public static Boolean CurseUseWeaponElement => Instance._battle.CurseUseWeaponElement;
public static Int32 FloatEvadeBonus => Instance._battle.FloatEvadeBonus;
public static Int32 CustomBattleFlagsMeaning => Instance._battle.CustomBattleFlagsMeaning;
public static String SpareChangeGilSpentFormula => Instance._battle.SpareChangeGilSpentFormula;
public static String StatusDurationFormula => Instance._battle.StatusDurationFormula;
public static String StatusTickFormula => Instance._battle.StatusTickFormula;
public static String SpeedStatFormula => Instance._battle.SpeedStatFormula;
public static String StrengthStatFormula => Instance._battle.StrengthStatFormula;
public static String MagicStatFormula => Instance._battle.MagicStatFormula;
public static String SpiritStatFormula => Instance._battle.SpiritStatFormula;
public static String MagicStoneStockFormula => Instance._battle.MagicStoneStockFormula;
}
}
}
| using System;
namespace Memoria
{
public sealed partial class Configuration
{
public static class Battle
{
public static Boolean NoAutoTrance => Instance._battle.NoAutoTrance;
public static Int32 Speed => Math.Max(Instance._battle.Speed, Instance._hacks.BattleSpeed);
public static Int32 EncounterInterval => Instance._battle.EncounterInterval;
public static Int32 EncounterInitial => Instance._battle.EncounterInitial;
public static Int32 AutoPotionOverhealLimit => Instance._battle.AutoPotionOverhealLimit;
public static Boolean GarnetConcentrate => Instance._battle.GarnetConcentrate;
public static Boolean SelectBestTarget => Instance._battle.SelectBestTarget;
public static Boolean ViviAutoAttack => Instance._battle.ViviAutoAttack;
public static Boolean CountersBetterTarget => Instance._battle.CountersBetterTarget;
public static Int32 SummonPriorityCount => Instance._battle.SummonPriorityCount;
public static Boolean CurseUseWeaponElement => Instance._battle.CurseUseWeaponElement;
public static Int32 FloatEvadeBonus => Instance._battle.FloatEvadeBonus;
public static Int32 CustomBattleFlagsMeaning => Instance._battle.CustomBattleFlagsMeaning;
public static String SpareChangeGilSpentFormula => Instance._battle.SpareChangeGilSpentFormula;
public static String StatusDurationFormula => Instance._battle.StatusDurationFormula;
public static String StatusTickFormula => Instance._battle.StatusTickFormula;
}
}
} | mit | C# |
0d427ca705cb7a23aa5d4902b5e19f679c7b322e | Add back using to EventSourceException | krk/coreclr,cshung/coreclr,cshung/coreclr,wtgodbe/coreclr,cshung/coreclr,krk/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,krk/coreclr,poizan42/coreclr,krk/coreclr,krk/coreclr,krk/coreclr,poizan42/coreclr,cshung/coreclr,wtgodbe/coreclr,cshung/coreclr,poizan42/coreclr,poizan42/coreclr,poizan42/coreclr,wtgodbe/coreclr,poizan42/coreclr,cshung/coreclr,wtgodbe/coreclr | src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSourceException.cs | src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSourceException.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 System.Runtime.Serialization;
#if ES_BUILD_STANDALONE
using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment;
#endif
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
namespace System.Diagnostics.Tracing
#endif
{
/// <summary>
/// Exception that is thrown when an error occurs during EventSource operation.
/// </summary>
#if !ES_BUILD_PCL
[Serializable]
#endif
public class EventSourceException : Exception
{
/// <summary>
/// Initializes a new instance of the EventSourceException class.
/// </summary>
public EventSourceException() :
base(SR.EventSource_ListenerWriteFailure) { }
/// <summary>
/// Initializes a new instance of the EventSourceException class with a specified error message.
/// </summary>
public EventSourceException(string? message) : base(message) { }
/// <summary>
/// Initializes a new instance of the EventSourceException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
public EventSourceException(string? message, Exception? innerException) : base(message, innerException) { }
#if !ES_BUILD_PCL
/// <summary>
/// Initializes a new instance of the EventSourceException class with serialized data.
/// </summary>
protected EventSourceException(SerializationInfo info, StreamingContext context) : base(info, context) { }
#endif
internal EventSourceException(Exception? innerException) :
base(SR.EventSource_ListenerWriteFailure, innerException) { }
}
}
| // 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.Runtime.Serialization;
#if ES_BUILD_STANDALONE
using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment;
#endif
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
namespace System.Diagnostics.Tracing
#endif
{
/// <summary>
/// Exception that is thrown when an error occurs during EventSource operation.
/// </summary>
#if !ES_BUILD_PCL
[Serializable]
#endif
public class EventSourceException : Exception
{
/// <summary>
/// Initializes a new instance of the EventSourceException class.
/// </summary>
public EventSourceException() :
base(SR.EventSource_ListenerWriteFailure) { }
/// <summary>
/// Initializes a new instance of the EventSourceException class with a specified error message.
/// </summary>
public EventSourceException(string? message) : base(message) { }
/// <summary>
/// Initializes a new instance of the EventSourceException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
public EventSourceException(string? message, Exception? innerException) : base(message, innerException) { }
#if !ES_BUILD_PCL
/// <summary>
/// Initializes a new instance of the EventSourceException class with serialized data.
/// </summary>
protected EventSourceException(SerializationInfo info, StreamingContext context) : base(info, context) { }
#endif
internal EventSourceException(Exception? innerException) :
base(SR.EventSource_ListenerWriteFailure, innerException) { }
}
}
| mit | C# |
4a4edc460f339113faa41155bdc9a019f7ee592e | Update JpegSkiaSharpExporter.cs | wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D/FileWriter/SkiaSharp/JpegSkiaSharpExporter.cs | src/Core2D/FileWriter/SkiaSharp/JpegSkiaSharpExporter.cs | using System;
using System.IO;
using Core2D.Containers;
using Core2D.Interfaces;
using Core2D.Renderer;
using SkiaSharp;
namespace Core2D.FileWriter.SkiaSharpJpeg
{
/// <summary>
/// SkiaSharp jpeg <see cref="IProjectExporter"/> implementation.
/// </summary>
public sealed class JpegSkiaSharpExporter : IProjectExporter
{
private readonly IShapeRenderer _renderer;
private readonly IContainerPresenter _presenter;
/// <summary>
/// Initializes a new instance of the <see cref="JpegSkiaSharpExporter"/> class.
/// </summary>
/// <param name="renderer">The shape renderer.</param>
/// <param name="presenter">The container presenter.</param>
public JpegSkiaSharpExporter(IShapeRenderer renderer, IContainerPresenter presenter)
{
_renderer = renderer;
_presenter = presenter;
}
/// <inheritdoc/>
public void Save(string path, IPageContainer container)
{
var info = new SKImageInfo((int)container.Width, (int)container.Height);
using var bitmap = new SKBitmap(info);
using (var canvas = new SKCanvas(bitmap))
{
_presenter.Render(canvas, _renderer, container, 0, 0);
}
using var image = SKImage.FromBitmap(bitmap);
using var data = image.Encode(SKEncodedImageFormat.Jpeg, 100);
using var stream = File.OpenWrite(path);
data.SaveTo(stream);
}
/// <inheritdoc/>
public void Save(string path, IDocumentContainer document)
{
throw new NotSupportedException("Saving documents as jpeg drawing is not supported.");
}
/// <inheritdoc/>
public void Save(string path, IProjectContainer project)
{
throw new NotSupportedException("Saving projects as jpeg drawing is not supported.");
}
}
}
| using System;
using System.IO;
using Core2D.Containers;
using Core2D.Interfaces;
using Core2D.Renderer;
using SkiaSharp;
namespace Core2D.FileWriter.SkiaSharpJpeg
{
/// <summary>
/// SkiaSharp jpeg <see cref="IProjectExporter"/> implementation.
/// </summary>
public sealed class JpegSkiaSharpExporter : IProjectExporter
{
private readonly IShapeRenderer _renderer;
private readonly IContainerPresenter _presenter;
/// <summary>
/// Initializes a new instance of the <see cref="JpegSkiaSharpExporter"/> class.
/// </summary>
/// <param name="renderer">The shape renderer.</param>
/// <param name="presenter">The container presenter.</param>
public JpegSkiaSharpExporter(IShapeRenderer renderer, IContainerPresenter presenter)
{
_renderer = renderer;
_presenter = presenter;
}
/// <inheritdoc/>
void IProjectExporter.Save(string path, IPageContainer container)
{
Save(path, container);
}
/// <inheritdoc/>
void IProjectExporter.Save(string path, IDocumentContainer document)
{
throw new NotSupportedException("Saving documents as jpeg drawing is not supported.");
}
/// <inheritdoc/>
void IProjectExporter.Save(string path, IProjectContainer project)
{
throw new NotSupportedException("Saving projects as jpeg drawing is not supported.");
}
private void Save(string path, IPageContainer container)
{
var info = new SKImageInfo((int)container.Width, (int)container.Height);
using var bitmap = new SKBitmap(info);
using (var canvas = new SKCanvas(bitmap))
{
_presenter.Render(canvas, _renderer, container, 0, 0);
}
using var image = SKImage.FromBitmap(bitmap);
using var data = image.Encode(SKEncodedImageFormat.Jpeg, 100);
using var stream = File.OpenWrite(path);
data.SaveTo(stream);
}
}
}
| mit | C# |
31b4904d256f29529e946b2262a3e38af01683d7 | Update XmlnsDefinitionsViewModels.cs | wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D/Serializer/Xaml/XmlnsDefinitionsViewModels.cs | src/Core2D/Serializer/Xaml/XmlnsDefinitionsViewModels.cs | using Core2D.Serializer.Xaml;
using Portable.Xaml.Markup;
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Containers", AssemblyName = "Core2D")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Data", AssemblyName = "Core2D")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Renderer", AssemblyName = "Core2D")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Shapes", AssemblyName = "Core2D")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Shapes.Path", AssemblyName = "Core2D")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Shapes.Path.Segments", AssemblyName = "Core2D")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Style", AssemblyName = "Core2D")]
[assembly: XmlnsPrefix(XamlConstants.ModelNamespace, "vm")]
| using Core2D.Serializer.Xaml;
using Portable.Xaml.Markup;
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Containers", AssemblyName = "Core2D.ViewModels")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Data", AssemblyName = "Core2D.ViewModels")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Renderer", AssemblyName = "Core2D.ViewModels")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Shapes", AssemblyName = "Core2D.ViewModels")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Shapes.Path", AssemblyName = "Core2D.ViewModels")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Shapes.Path.Segments", AssemblyName = "Core2D.ViewModels")]
[assembly: XmlnsDefinition(XamlConstants.ViewModelsNamespace, "Core2D.Style", AssemblyName = "Core2D.ViewModels")]
[assembly: XmlnsPrefix(XamlConstants.ModelNamespace, "vm")]
| mit | C# |
5b11518c90cef64cd488d561b2c0bc434c9fcfff | Disable Oracle CI databases. | sjp/Schematic,sjp/Schematic,sjp/Schematic,sjp/SJP.Schema,sjp/Schematic | src/SJP.Schematic.Oracle.Tests/Integration/OracleTest.cs | src/SJP.Schematic.Oracle.Tests/Integration/OracleTest.cs | using System.Data;
using NUnit.Framework;
using SJP.Schematic.Core;
using Microsoft.Extensions.Configuration;
namespace SJP.Schematic.Oracle.Tests.Integration
{
internal static class Config
{
public static IDbConnection Connection { get; } = OracleDialect.CreateConnectionAsync(ConnectionString).GetAwaiter().GetResult();
private static string ConnectionString => Configuration.GetConnectionString("TestDb");
private static IConfigurationRoot Configuration => new ConfigurationBuilder()
.AddJsonFile("oracle-test.json.config")
.AddJsonFile("oracle-test.json.config.local", optional: true)
.Build();
}
[Category("OracleDatabase")]
[Category("SkipWhenLiveUnitTesting")]
[TestFixture(Ignore = "No CI Oracle DB available")]
internal abstract class OracleTest
{
protected IDbConnection Connection { get; } = Config.Connection;
protected IDatabaseDialect Dialect { get; } = new OracleDialect(Config.Connection);
protected IIdentifierDefaults IdentifierDefaults { get; } = new OracleDialect(Config.Connection).GetIdentifierDefaultsAsync().GetAwaiter().GetResult();
protected IIdentifierResolutionStrategy IdentifierResolver { get; } = new DefaultOracleIdentifierResolutionStrategy();
}
}
| using System.Data;
using NUnit.Framework;
using SJP.Schematic.Core;
using Microsoft.Extensions.Configuration;
namespace SJP.Schematic.Oracle.Tests.Integration
{
internal static class Config
{
public static IDbConnection Connection { get; } = OracleDialect.CreateConnectionAsync(ConnectionString).GetAwaiter().GetResult();
private static string ConnectionString => Configuration.GetConnectionString("TestDb");
private static IConfigurationRoot Configuration => new ConfigurationBuilder()
.AddJsonFile("oracle-test.json.config")
.AddJsonFile("oracle-test.json.config.local", optional: true)
.Build();
}
[Category("OracleDatabase")]
[Category("SkipWhenLiveUnitTesting")]
[TestFixture]
internal abstract class OracleTest
{
protected IDbConnection Connection { get; } = Config.Connection;
protected IDatabaseDialect Dialect { get; } = new OracleDialect(Config.Connection);
protected IIdentifierDefaults IdentifierDefaults { get; } = new OracleDialect(Config.Connection).GetIdentifierDefaultsAsync().GetAwaiter().GetResult();
protected IIdentifierResolutionStrategy IdentifierResolver { get; } = new DefaultOracleIdentifierResolutionStrategy();
}
}
| mit | C# |
89c40e588ef5aa094a6321835f91c138a574a87e | Handle the exception when parsing the arguments | celeron533/KeepOn | KeepOn/Program.cs | KeepOn/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
namespace KeepOn
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
bool hasUnknowArgs = false;
foreach (string arg in args)
{
try
{
// /lang=zh_CN
if (arg.StartsWith("/lang"))
{
I18N.overrideLanguage = arg.Split('=')[1].Trim();
}
else
hasUnknowArgs = true;
}
catch
{
hasUnknowArgs = true;
}
}
if (hasUnknowArgs)
MessageBox.Show(
@"Set UI language:
/lang=zh_CN
/lang=en_US"
,
"Available arguments");
I18N.Init();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
bool createdNew;
// To prevent the program to be started twice
Mutex appMutex = new Mutex(true, Application.ProductName, out createdNew);
if (createdNew)
{
Application.Run(new TrayApplicationContext());
appMutex.ReleaseMutex();
}
else
{
string msg = string.Format(I18N.GetString("app.dupInstanceMsg"), Application.ProductName);
MessageBox.Show(msg, Application.ProductName,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
namespace KeepOn
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
bool hasUnknowArgs = false;
foreach (string arg in args)
{
// /lang=zh_CN
if (arg.StartsWith("/lang"))
{
I18N.overrideLanguage = arg.Split('=')[1].Trim();
}
else
hasUnknowArgs = true;
}
if (hasUnknowArgs)
MessageBox.Show(
@"/lang=zh_CN
/lang=en_US"
,
"Available arguments");
I18N.Init();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
bool createdNew;
// To prevent the program to be started twice
Mutex appMutex = new Mutex(true, Application.ProductName, out createdNew);
if (createdNew)
{
Application.Run(new TrayApplicationContext());
appMutex.ReleaseMutex();
}
else
{
string msg = string.Format(I18N.GetString("app.dupInstanceMsg"), Application.ProductName);
MessageBox.Show(msg, Application.ProductName,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
| mit | C# |
a873abf987071ead765bb8c458881c2863dfce4c | Add public method stubs for NFigStore | NFig/NFig | NFig/NFigStore.cs | NFig/NFigStore.cs | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace NFig
{
/// <summary>
/// Describes a connection to a data-store for NFig overrides and metadata. Store-providers must inherit from this class.
/// </summary>
public abstract class NFigStore<TTier, TDataCenter>
where TTier : struct
where TDataCenter : struct
{
/// <summary>
/// The deployment tier of the store.
/// </summary>
public TTier Tier { get; }
/// <summary>
/// Instantiates the base Store class.
/// </summary>
/// <param name="tier">The deployment tier which the store exists on.</param>
protected NFigStore(TTier tier)
{
Tier = tier;
}
/// <summary>
/// Gets a client for consuming NFig settings within an application.
/// </summary>
/// <typeparam name="TSettings">
/// The class which represents your settings. It must inherit from <see cref="INFigSettings{TSubApp,TTier,TDataCenter}"/> or
/// <see cref="NFigSettingsBase{TSubApp,TTier,TDataCenter}"/>.
/// </typeparam>
/// <param name="appName">The name of your application. Overrides are keyed off of this name.</param>
/// <param name="dataCenter">The data center where your application resides.</param>
public NFigAppClient<TSettings, TTier, TDataCenter> GetAppClient<TSettings>(string appName, TDataCenter dataCenter)
where TSettings : class, INFigSettings<int, TTier, TDataCenter>, new() // todo remove TSubApp
{
throw new NotImplementedException();
}
/// <summary>
/// Gets a client for administering NFig settings for a given application.
/// </summary>
/// <param name="appName">The name of the application to administer.</param>
public NFigAdminClient<TTier, TDataCenter> GetAdminClient(string appName)
{
throw new NotImplementedException();
}
/// <summary>
/// Gets the names of all applications connected to this store.
/// </summary>
public IEnumerable<string> GetAppNames() // todo: use a concrete type instead of IEnumerable
{
throw new NotImplementedException();
}
/// <summary>
/// Asynchronously gets the names of all applications connected to this store.
/// </summary>
public Task<IEnumerable<string>> GetAppNamesAsync() // todo: use a concrete type instead of IEnumerable
{
throw new NotImplementedException();
}
}
} | namespace NFig
{
/// <summary>
/// Describes a connection to a data-store for NFig overrides and metadata. Store-providers must inherit from this class.
/// </summary>
public abstract class NFigStore<TTier, TDataCenter>
where TTier : struct
where TDataCenter : struct
{
//
}
} | mit | C# |
dee819af6a2bf2610b9501a2dc52167c82dc9d5d | Set Stato Squadra - Abilitata la chiamata a OpService | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.FakePersistance.ExternalAPI/Servizi/OPService/SetStatoSquadra.cs | src/backend/SO115App.FakePersistance.ExternalAPI/Servizi/OPService/SetStatoSquadra.cs | using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using SO115App.ExternalAPI.Client;
using SO115App.Models.Classi.ServiziEsterni.OPService;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.OPService;
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
namespace SO115App.ExternalAPI.Fake.Servizi.OPService
{
public class SetStatoSquadra : ISetStatoSquadra
{
private readonly HttpClient _client;
private readonly IConfiguration _config;
public SetStatoSquadra(HttpClient client, IConfiguration config)
{
_client = client;
_config = config;
}
public async Task<HttpResponseMessage> SetStatoSquadraOPService(actionDTO action)
{
var json = JsonConvert.SerializeObject(action);
var content = new StringContent(json);
var baseurl = new Uri(_config.GetSection("UrlExternalApi").GetSection("OPService").Value);
var url = new Uri(baseurl, "api/v1/so-workshift/action");
var result = await _client.PostAsync(url, content);
return result;
//return null;
}
}
}
| using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using SO115App.ExternalAPI.Client;
using SO115App.Models.Classi.ServiziEsterni.OPService;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.OPService;
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
namespace SO115App.ExternalAPI.Fake.Servizi.OPService
{
public class SetStatoSquadra : ISetStatoSquadra
{
private readonly HttpClient _client;
private readonly IConfiguration _config;
public SetStatoSquadra(HttpClient client, IConfiguration config)
{
_client = client;
_config = config;
}
public async Task<HttpResponseMessage> SetStatoSquadraOPService(actionDTO action)
{
var json = JsonConvert.SerializeObject(action);
var content = new StringContent(json);
var baseurl = new Uri(_config.GetSection("UrlExternalApi").GetSection("OPService").Value);
var url = new Uri(baseurl, "/api/v1/so-workshift/action");
//var result = await _client.PostAsync(url, content);
//return result;
return null;
}
}
}
| agpl-3.0 | C# |
be40a5937223449e1353fc7ca54db434670f2ffc | test appHarhor -talles | Arionildo/Quiz-CWI,Arionildo/Quiz-CWI,Arionildo/Quiz-CWI | Quiz/Quiz.Web/App_Start/BundleConfig.cs | Quiz/Quiz.Web/App_Start/BundleConfig.cs | using System.Web;
using System.Web.Optimization;
namespace Quiz.Web
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/jquery.pietimer").Include(
"~/Scripts/jquery.pietimer.min.js"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
| using System.Web;
using System.Web.Optimization;
namespace Quiz.Web
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/jquery.pietimer").Include(
"~/Scripts/jquery.pietimer.js",
"~/Scripts/jquery.pietimer.min.js"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
| mit | C# |
394f305d8f2dc97686c738b2633b16e4ca13673f | Fix media type constraint on media controller | GAnatoliy/geochallenger,GAnatoliy/geochallenger | GeoChallenger.Web.Api/Controllers/MediaController.cs | GeoChallenger.Web.Api/Controllers/MediaController.cs | using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using AutoMapper;
using GeoChallenger.Services.Interfaces;
using GeoChallenger.Services.Interfaces.DTO.Media;
using GeoChallenger.Web.Api.Models.Media;
using GeoChallenger.Web.Api.Models.Pois;
namespace GeoChallenger.Web.Api.Controllers
{
[RoutePrefix("media")]
public class MediaController : ApiController
{
private readonly IMediaService _mediaService;
private readonly IMapper _mapper;
public MediaController(IMediaService mediaService, IMapper mapper)
{
_mediaService = mediaService;
_mapper = mapper;
}
[Route("")]
public async Task<IHttpActionResult> Get(string url, string size = null)
{
return Ok();
}
[Route("")]
public async Task<MediaUploadResultViewModel> Post(MediaTypeViewModel mediaType)
{
if (!Request.Content.IsMimeMultipartContent()) {
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
}
var streamProvider = await Request.Content.ReadAsMultipartAsync();
var mediaUploadResultViewModel = new MediaUploadResultViewModel();
foreach (var content in streamProvider.Contents) {
if (content.Headers.ContentType == null) {
continue;
}
var mediaUploadResultDto = await _mediaService.UploadAsync(await content.ReadAsStreamAsync(), _mapper.Map<MediaTypeDto>(mediaType));
mediaUploadResultViewModel.Names.Add(mediaUploadResultDto.Name);
mediaUploadResultViewModel.MediaLinks.Add(mediaUploadResultDto.Uri);
mediaUploadResultViewModel.ContentTypes.Add(content.Headers.ContentType.ToString());
}
return mediaUploadResultViewModel;
}
}
}
| using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using AutoMapper;
using GeoChallenger.Services.Interfaces;
using GeoChallenger.Services.Interfaces.DTO.Media;
using GeoChallenger.Web.Api.Models.Media;
using GeoChallenger.Web.Api.Models.Pois;
namespace GeoChallenger.Web.Api.Controllers
{
[RoutePrefix("media")]
public class MediaController : ApiController
{
private readonly IMediaService _mediaService;
private readonly IMapper _mapper;
public MediaController(IMediaService mediaService, IMapper mapper)
{
_mediaService = mediaService;
_mapper = mapper;
}
[Route("")]
public async Task<IHttpActionResult> Get(string url, string size = null)
{
return Ok();
}
[Route("{mediaType:MediaTypeViewModel}")]
public async Task<MediaUploadResultViewModel> Post(MediaTypeViewModel mediaType)
{
if (!Request.Content.IsMimeMultipartContent()) {
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
}
var streamProvider = await Request.Content.ReadAsMultipartAsync();
var mediaUploadResultViewModel = new MediaUploadResultViewModel();
foreach (var content in streamProvider.Contents) {
if (content.Headers.ContentType == null) {
continue;
}
var mediaUploadResultDto = await _mediaService.UploadAsync(await content.ReadAsStreamAsync(), _mapper.Map<MediaTypeDto>(mediaType));
mediaUploadResultViewModel.Names.Add(mediaUploadResultDto.Name);
mediaUploadResultViewModel.MediaLinks.Add(mediaUploadResultDto.Uri);
mediaUploadResultViewModel.ContentTypes.Add(content.Headers.ContentType.ToString());
}
return mediaUploadResultViewModel;
}
}
}
| mit | C# |
0cbb2d419fcce69b19862bb174dfec8cbf78e53d | Update Assembly version to 1.7 | ninjanye/SearchExtensions | NinjaNye.SearchExtensions/Properties/AssemblyInfo.cs | NinjaNye.SearchExtensions/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("NinjaNye.SearchExtensions")]
[assembly: AssemblyDescription("A collection of extension methods to IQueryable and IEnumerable that enable easy searching and ranking. Searches can be performed against multiple properties and support a wide range of types")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("John Nye")]
[assembly: AssemblyProduct("NinjaNye.SearchExtensions")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("NinjaNye.SearchExtensions.Tests")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0d7ebeb0-64e0-43e8-b10a-d63839cbd56c")]
// 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.7.*")]
[assembly: AssemblyFileVersion("1.7")]
| 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("NinjaNye.SearchExtensions")]
[assembly: AssemblyDescription("A collection of extension methods to IQueryable and IEnumerable that enable easy searching and ranking. Searches can be performed against multiple properties and support a wide range of types")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("John Nye")]
[assembly: AssemblyProduct("NinjaNye.SearchExtensions")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("NinjaNye.SearchExtensions.Tests")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0d7ebeb0-64e0-43e8-b10a-d63839cbd56c")]
// 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.6.*")]
[assembly: AssemblyFileVersion("1.6")]
| mit | C# |
74d472f96e44d8842cd21078adf1d710b32ef970 | Add offset as optional parameter | mstrother/BmpListener | BmpListener/Bgp/IPAddrPrefix.cs | BmpListener/Bgp/IPAddrPrefix.cs | using System;
using System.Linq;
using System.Net;
namespace BmpListener.Bgp
{
public class IPAddrPrefix
{
//TODO add offset to ctor
public IPAddrPrefix(ArraySegment<byte> data, int offset = 0, AddressFamily afi = AddressFamily.IP)
{
DecodeFromBytes(data, afi);
}
public byte Length { get; private set; }
public IPAddress Prefix { get; private set; }
public override string ToString()
{
return ($"{Prefix}/{Length}");
}
public void DecodeFromBytes(ArraySegment<byte> data, Bgp.AddressFamily afi)
{
//add length error check
Length = data.ElementAt(0);
var byteLength = (Length + 7) / 8;
var ipBytes = afi == Bgp.AddressFamily.IP
? new byte[4]
: new byte[16];
if (Length <= 0) return;
Buffer.BlockCopy(data.ToArray(), 1, ipBytes, 0, byteLength);
Prefix = new IPAddress(ipBytes);
}
}
}
| using System;
using System.Linq;
using System.Net;
namespace BmpListener.Bgp
{
public class IPAddrPrefix
{
public IPAddrPrefix(ArraySegment<byte> data, Bgp.AddressFamily afi = Bgp.AddressFamily.IP)
{
DecodeFromBytes(data, afi);
}
public byte Length { get; private set; }
public IPAddress Prefix { get; private set; }
public override string ToString()
{
return ($"{Prefix}/{Length}");
}
public void DecodeFromBytes(ArraySegment<byte> data, Bgp.AddressFamily afi)
{
//add length error check
Length = data.ElementAt(0);
var byteLength = (Length + 7) / 8;
var ipBytes = afi == Bgp.AddressFamily.IP
? new byte[4]
: new byte[16];
if (Length <= 0) return;
Buffer.BlockCopy(data.ToArray(), 1, ipBytes, 0, byteLength);
Prefix = new IPAddress(ipBytes);
}
}
}
| mit | C# |
52b9894e10022c67c13a4d7ad3a97b0ff7e0157a | Update Currency.cs | NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework | Test/AdventureWorksFunctionalModel/Sales/Currency.cs | Test/AdventureWorksFunctionalModel/Sales/Currency.cs | // Copyright Naked Objects Group Ltd, 45 Station Road, Henley on Thames, UK, RG9 1AT
// 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 NakedFunctions;
namespace AW.Types
{
[Bounded]
public record Currency
{
[Hidden]
public virtual string CurrencyCode { get; init; }
[Hidden]
public virtual string Name { get; init; }
public override string ToString() => $"{CurrencyCode} - {Name}";
[Hidden]
[Versioned]
public virtual DateTime ModifiedDate { get; init; }
public override int GetHashCode() =>base.GetHashCode();
public virtual bool Equals(Currency other) => ReferenceEquals(this, other);
}
} | // Copyright Naked Objects Group Ltd, 45 Station Road, Henley on Thames, UK, RG9 1AT
// 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 NakedFunctions;
namespace AW.Types
{
[Bounded]
public record Currency
{
[Hidden]
public virtual string CurrencyCode { get; init; }
[Hidden]
public virtual string Name { get; init; }
[Hidden]
[Versioned]
public virtual DateTime ModifiedDate { get; init; }
public override string ToString() => Name;
public override int GetHashCode() =>base.GetHashCode();
public virtual bool Equals(Currency other) => ReferenceEquals(this, other);
}
} | apache-2.0 | C# |
2bd174261115a2668bfa4aac1a717d76ac349780 | fix typo | SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery | AstroPhotoGallery/AstroPhotoGallery/Views/Home/About.cshtml | AstroPhotoGallery/AstroPhotoGallery/Views/Home/About.cshtml | @{
ViewBag.Title = "About Astrogallery";
}
<div class="container">
<h2>@ViewBag.Title</h2>
<br/>
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-sm-12">
<div>
<div class="well well-sm text-center" style="font-size: 25px; word-wrap: break-word;">Astro gallery project</div>
<br/>
<p>The project was part of the course "Software technologies" in Software University Bulgaria. It has been developed by 2 software development students with less than a year experience. The inspiration came from a website for astronomy pictures: <a style="word-break: break-all; display: inline-block" href="http://www.emilivanov.com/index2.htm" target="_blank">http://www.emilivanov.com/index2.htm</a>. The rights to use the pictures for this project have been given by Emil Ivanov and the project will be presented to him too. This project will not be used for any commercial purposes - it is a non-profit student project.
</p>
<p>Due to the small experience of the developers when the project was created, it does not pretend to be perfect from software engineering point of view. However, many hours have been dedicated to it in order to work, look and feel good.</p>
<p>The beautiful pictures are separated by categories. They can be searched by tags or by categories. Enjoy!</p>
<p>GitHub repository of the project: <a style="word-break: break-all; display: inline-block" href="https://github.com/SoftwareFans/AstroPhotoGallery" target="_blank">https://github.com/SoftwareFans/AstroPhotoGallery </a>
</p>
<p>Development team: @Html.ActionLink("Contacts", "Contacts", "Home")</p>
</div>
</div>
</div>
<br/>
</div>
</div>
</div>
| @{
ViewBag.Title = "About Astrogallery";
}
<div class="container">
<h2>@ViewBag.Title</h2>
<br/>
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-sm-12">
<div>
<div class="well well-sm text-center" style="font-size: 25px; word-wrap: break-word;">Astro gallery project</div>
<br/>
<p>The project was part of the course "Software technologies" in Software University Bulgaria. It has been developed by 2 software development students with less than a year experience. The inspiration came from a website for astronomy pictures: <a style="word-break: break-all; display: inline-block" href="http://www.emilivanov.com/index2.htm" target="_blank">http://www.emilivanov.com/index2.htm</a>. The rights to use the pictures for this project has been given by Emil Ivanov and the project will be presented to him too. This project will not be used for any commercial purposes - it is a non-profit student project.
</p>
<p>Due to the small experience of the developers when the project was created, it does not pretend to be perfect from software engineering point of view. However, many hours have been dedicated to it in order to work, look and feel good.</p>
<p>The beautiful pictures are separated by categories. They can be searched by tags or by categories. Enjoy!</p>
<p>GitHub repository of the project: <a style="word-break: break-all; display: inline-block" href="https://github.com/SoftwareFans/AstroPhotoGallery" target="_blank">https://github.com/SoftwareFans/AstroPhotoGallery </a>
</p>
<p>Development team: @Html.ActionLink("Contacts", "Contacts", "Home")</p>
</div>
</div>
</div>
<br/>
</div>
</div>
</div>
| mit | C# |
9ecae7d22ea2609c684948b71f7b0a490f4f9bb8 | use Singleton services | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | src/FilterLists.Services/DependencyInjection/Extensions/ConfigureServicesCollection.cs | src/FilterLists.Services/DependencyInjection/Extensions/ConfigureServicesCollection.cs | using AutoMapper;
using FilterLists.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace FilterLists.Services.DependencyInjection.Extensions
{
public static class ConfigureServicesCollection
{
public static void AddFilterListsServices(this IServiceCollection services, IConfiguration configuration)
{
services.AddSingleton(c => configuration);
services.AddEntityFrameworkMySql().AddDbContextPool<FilterListsDbContext>(options =>
options.UseMySql(configuration.GetConnectionString("FilterListsConnection"),
b => b.MigrationsAssembly("FilterLists.Api")));
services.TryAddSingleton<FilterListService.FilterListService>();
services.TryAddSingleton<SeedService.SeedService>();
services.TryAddSingleton<ScrapeService.ScrapeService>();
services.AddAutoMapper();
}
}
} | using AutoMapper;
using FilterLists.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace FilterLists.Services.DependencyInjection.Extensions
{
public static class ConfigureServicesCollection
{
public static void AddFilterListsServices(this IServiceCollection services, IConfiguration configuration)
{
services.AddSingleton(c => configuration);
services.AddEntityFrameworkMySql().AddDbContextPool<FilterListsDbContext>(options =>
options.UseMySql(configuration.GetConnectionString("FilterListsConnection"),
b => b.MigrationsAssembly("FilterLists.Api")));
services.TryAddScoped<SeedService.SeedService>();
services.TryAddScoped<FilterListService.FilterListService>();
services.TryAddScoped<ScrapeService.ScrapeService>();
services.AddAutoMapper();
}
}
} | mit | C# |
9ee8df443a4816155ca977352a4a776cb352d8ab | Update Dependency Resolver to include Requisition Service | ndrmc/cats,ndrmc/cats,ndrmc/cats | Web/Infrastructure/NinjectDependencyResolver.cs | Web/Infrastructure/NinjectDependencyResolver.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Cats.Data.UnitWork;
using Ninject;
using Cats.Services.EarlyWarning;
namespace Cats.Infrastructure
{
public class NinjectDependencyResolver : IDependencyResolver
{
private IKernel kernel;
public NinjectDependencyResolver()
{
this.kernel = new StandardKernel();
AddBindings();
}
public object GetService(Type serviceType)
{
return kernel.TryGet(serviceType);
}
public IEnumerable<object> GetServices(Type serviceType)
{
return kernel.GetAll(serviceType);
}
private void AddBindings()
{
kernel.Bind<IUnitOfWork>().To<UnitOfWork>();
kernel.Bind<IRegionalRequestService>().To<RegionalRequestService>();
kernel.Bind<IFDPService>().To<FDPService>();
kernel.Bind<IAdminUnitService>().To<AdminUnitService>();
kernel.Bind<IProgramService>().To<ProgramService>();
kernel.Bind<ICommodityService>().To<CommodityService>();
kernel.Bind<IRegionalRequestDetailService>().To<RegionalRequestDetailService>();
kernel.Bind<IReliefRequisitionService>().To<ReliefRequisitionService>();
kernel.Bind<IReliefRequisitionDetailService>().To<ReliefRequisitionDetailService>();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Cats.Data.UnitWork;
using Ninject;
using Cats.Services.EarlyWarning;
namespace Cats.Infrastructure
{
public class NinjectDependencyResolver : IDependencyResolver
{
private IKernel kernel;
public NinjectDependencyResolver()
{
this.kernel = new StandardKernel();
AddBindings();
}
public object GetService(Type serviceType)
{
return kernel.TryGet(serviceType);
}
public IEnumerable<object> GetServices(Type serviceType)
{
return kernel.GetAll(serviceType);
}
private void AddBindings()
{
kernel.Bind<IUnitOfWork>().To<UnitOfWork>();
kernel.Bind<IRegionalRequestService>().To<RegionalRequestService>();
kernel.Bind<IFDPService>().To<FDPService>();
kernel.Bind<IAdminUnitService>().To<AdminUnitService>();
kernel.Bind<IProgramService>().To<ProgramService>();
kernel.Bind<ICommodityService>().To<CommodityService>();
kernel.Bind<IRegionalRequestDetailService>().To<RegionalRequestDetailService>();
}
}
} | apache-2.0 | C# |
a5a2668ec8e0552bc74de2472adea878ba8d969c | Update `DriverOptionsJsonSection` comments | atata-framework/atata-configuration-json | src/Atata.Configuration.Json/DriverOptionsJsonSection.cs | src/Atata.Configuration.Json/DriverOptionsJsonSection.cs | using System.Collections.Generic;
using OpenQA.Selenium.Chromium;
namespace Atata.Configuration.Json
{
public class DriverOptionsJsonSection : JsonSection
{
public string Type { get; set; }
public Dictionary<string, OpenQA.Selenium.LogLevel> LoggingPreferences { get; set; }
public JsonSection AdditionalOptions { get; set; }
// Chrome, Firefox, Edge, InternetExplorer and Opera specific.
public JsonSection AdditionalBrowserOptions { get; set; }
public ProxyJsonSection Proxy { get; set; }
// Chrome, Firefox, Edge and Opera specific.
public string[] Arguments { get; set; }
// Chrome, Edge and Opera specific.
public string[] ExcludedArguments { get; set; }
// Chrome, Edge and Opera specific.
public string[] Extensions { get; set; }
// Chrome, Edge and Opera specific.
public string[] EncodedExtensions { get; set; }
// Chrome and Edge specific.
public string[] WindowTypes { get; set; }
// Chrome and Edge specific.
public DriverPerformanceLoggingPreferencesJsonSection PerformanceLoggingPreferences { get; set; }
// Chrome, Edge and Opera specific.
public JsonSection UserProfilePreferences { get; set; }
// Chrome, Edge and Opera specific.
public JsonSection LocalStatePreferences { get; set; }
// Firefox specific.
public DriverProfileJsonSection Profile { get; set; }
// Firefox specific.
public JsonSection Preferences { get; set; }
// Chrome and Edge specific.
public string MobileEmulationDeviceName { get; set; }
// Chrome and Edge specific.
public ChromiumMobileEmulationDeviceSettings MobileEmulationDeviceSettings { get; set; }
// Chrome, Firefox and Edge specific.
public AndroidOptionsJsonSection AndroidOptions { get; set; }
}
}
| using System.Collections.Generic;
using OpenQA.Selenium.Chromium;
namespace Atata.Configuration.Json
{
public class DriverOptionsJsonSection : JsonSection
{
public string Type { get; set; }
// Common, but actually used only by Chrome.
public Dictionary<string, OpenQA.Selenium.LogLevel> LoggingPreferences { get; set; }
public JsonSection AdditionalOptions { get; set; }
// Chrome, Firefox, Edge, InternetExplorer and Opera specific.
public JsonSection AdditionalBrowserOptions { get; set; }
public ProxyJsonSection Proxy { get; set; }
// Chrome, Firefox and Opera specific.
public string[] Arguments { get; set; }
// Chrome and Opera specific.
public string[] ExcludedArguments { get; set; }
// Chrome, Edge and Opera specific.
public string[] Extensions { get; set; }
// Chrome and Opera specific.
public string[] EncodedExtensions { get; set; }
// Chrome specific.
public string[] WindowTypes { get; set; }
// Chrome specific.
public DriverPerformanceLoggingPreferencesJsonSection PerformanceLoggingPreferences { get; set; }
// Chrome and Opera specific.
public JsonSection UserProfilePreferences { get; set; }
// Chrome and Opera specific.
public JsonSection LocalStatePreferences { get; set; }
// Firefox specific.
public DriverProfileJsonSection Profile { get; set; }
// Firefox specific.
public JsonSection Preferences { get; set; }
// Chrome specific.
public string MobileEmulationDeviceName { get; set; }
// Chrome and Edge specific.
public ChromiumMobileEmulationDeviceSettings MobileEmulationDeviceSettings { get; set; }
// Chrome and Firefox specific.
public AndroidOptionsJsonSection AndroidOptions { get; set; }
}
}
| apache-2.0 | C# |
20fa53799c0c8236d6eb0840570210a565965ecd | Add GameDataOffset for correct memory access | Figglewatts/LSDStay | LSDStay/Memory.cs | LSDStay/Memory.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace LSDStay
{
public static class Memory
{
[Flags]
public enum ProcessAccessFlags : uint
{
All = 0x001F0FFF,
Terminate = 0x00000001,
CreateThread = 0x00000002,
VMOperation = 0x00000008,
VMRead = 0x00000010,
VMWrite = 0x00000020,
DupHandle = 0x00000040,
SetInformation = 0x00000200,
QueryInformation = 0x00000400,
Synchronize = 0x00100000
}
public static readonly int PSXGameOffset = 0x171A5C;
public static int GameMemoryStartAddr = 0;
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle,
int dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress,
byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress,
byte[] lpBuffer, uint dwSize, out int lpNumberOfBytesWritten);
[DllImport("kernel32.dll")]
public static extern Int32 CloseHandle(IntPtr hProcess);
public static void GetGameDataOffset()
{
byte[] buffer = new byte[4];
int numberOfBytesRead = 0;
ReadProcessMemory((int)PSX.PSXHandle, (int)PSX.PSXProcess.MainModule.BaseAddress + PSXGameOffset, buffer, buffer.Length, ref numberOfBytesRead);
GameMemoryStartAddr = BitConverter.ToInt32(buffer, 0);
Console.WriteLine("Game start address is: " + GameMemoryStartAddr.ToString("x4"));
}
public static bool WriteMemory(Process p, IntPtr address, long v)
{
var hProc = OpenProcess((uint)ProcessAccessFlags.All, false, (int)p.Id);
var val = new byte[] { (byte)v };
int wtf = 0;
bool returnVal = WriteProcessMemory(hProc, address, val, (UInt32)val.LongLength, out wtf);
CloseHandle(hProc);
return returnVal;
}
public static string FormatToHexString(byte[] data)
{
string toReturn = "";
for (int i = 0; i < data.Length; i++)
{
toReturn += string.Format("{0:x2}", data[i]);
}
return toReturn;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace LSDStay
{
public static class Memory
{
[Flags]
public static enum ProcessAccessFlags : uint
{
All = 0x001F0FFF,
Terminate = 0x00000001,
CreateThread = 0x00000002,
VMOperation = 0x00000008,
VMRead = 0x00000010,
VMWrite = 0x00000020,
DupHandle = 0x00000040,
SetInformation = 0x00000200,
QueryInformation = 0x00000400,
Synchronize = 0x00100000
}
public static readonly int PSXGameOffset = 0x171A5C;
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle,
int dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress,
byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress,
byte[] lpBuffer, uint dwSize, out int lpNumberOfBytesWritten);
[DllImport("kernel32.dll")]
public static extern Int32 CloseHandle(IntPtr hProcess);
public static bool WriteMemory(Process p, IntPtr address, long v)
{
var hProc = OpenProcess((uint)ProcessAccessFlags.All, false, (int)p.Id);
var val = new byte[] { (byte)v };
int wtf = 0;
bool returnVal = WriteProcessMemory(hProc, address, val, (UInt32)val.LongLength, out wtf);
CloseHandle(hProc);
return returnVal;
}
public static string FormatToHexString(byte[] data)
{
string toReturn = "";
for (int i = 0; i < data.Length; i++)
{
toReturn += string.Format("{0:x2}", data[i]);
}
return toReturn;
}
}
}
| mit | C# |
7bf07a9b1ccc439f7e86ef4c54a2ddc8431098b7 | Fix tests. | exKAZUu/Code2Xml,exKAZUu/Code2Xml,exKAZUu/Code2Xml,exKAZUu/Code2Xml | Code2Xml.Languages.Ruby18.Tests/Ruby18CodeToXmlTest.cs | Code2Xml.Languages.Ruby18.Tests/Ruby18CodeToXmlTest.cs | #region License
// Copyright (C) 2011-2012 Kazunori Sakamoto
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System.IO;
using Code2Xml.Core.Tests;
using Code2Xml.Languages.Ruby18.CodeToXmls;
using IronRuby;
using NUnit.Framework;
namespace Code2Xml.Languages.Ruby18.Tests {
[TestFixture]
public class Ruby18CodeToXmlTest {
[Test]
public void コードを解析できる() {
var path = Fixture.GetInputPath(
"Ruby18", "block.rb");
Ruby18CodeToXml.Instance.GenerateFromFile(path, true);
}
[Test]
public void InvokeRubyScript() {
var DirectoryPath = Path.Combine(
"ParserScripts", "IronRubyParser");
var engine = Ruby.CreateEngine();
// ir.exe.config を参照のこと
engine.SetSearchPaths(
new[] {
DirectoryPath,
});
var scope = engine.CreateScope();
var source =
engine.CreateScriptSourceFromFile(Path.Combine(DirectoryPath, "test.rb"));
source.Execute(scope);
}
}
} | #region License
// Copyright (C) 2011-2012 Kazunori Sakamoto
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System.IO;
using Code2Xml.Core.Tests;
using Code2Xml.Languages.Ruby18.CodeToXmls;
using IronRuby;
using NUnit.Framework;
namespace Code2Xml.Languages.Ruby18.Tests {
[TestFixture]
public class Ruby18CodeToXmlTest {
[Test]
public void コードを解析できる() {
var path = Fixture.GetInputPath(
"Ruby18", "block.rb");
Ruby18CodeToXml.Instance.GenerateFromFile(path, true);
}
[Test]
public void InvokeRubyScript() {
var DirectoryPath = Path.Combine(
"ParserScripts", "IronRubyParser");
var engine = Ruby.CreateEngine();
// ir.exe.config を参照のこと
engine.SetSearchPaths(
new[] {
DirectoryPath,
});
var scope = engine.CreateScope();
var source =
engine.CreateScriptSourceFromFile("test.rb");
source.Execute(scope);
}
}
} | apache-2.0 | C# |
2a575dc6b0ccd793563bae069f1fdb607f5fbeb6 | Bump assembly version | darthwalsh/StatusServer,darthwalsh/StatusServer | StatusServer/Properties/AssemblyInfo.cs | StatusServer/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("StatusServer")]
[assembly: AssemblyDescription("Status dashboard web server")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Carl Walsh")]
[assembly: AssemblyProduct("StatusServer https://github.com/darth-walsh/StatusServer")]
[assembly: AssemblyCopyright("Copyright © 2014 - License: MIT")]
[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("b9cdd9c6-56d7-4780-a5d8-01c6ee3adf43")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: InternalsVisibleTo("Tests")]
| 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("StatusServer")]
[assembly: AssemblyDescription("Status dashboard web server")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Carl Walsh")]
[assembly: AssemblyProduct("StatusServer https://github.com/darth-walsh/StatusServer")]
[assembly: AssemblyCopyright("Copyright © 2014 - License: MIT")]
[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("b9cdd9c6-56d7-4780-a5d8-01c6ee3adf43")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: InternalsVisibleTo("Tests")]
| mit | C# |
c7535f127c1419866109a9bff60cdeba6515b43d | fix build break due to aspnet\configuration #246 | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNet.Server.Kestrel/ServerInformation.cs | src/Microsoft.AspNet.Server.Kestrel/ServerInformation.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.Framework.Configuration;
namespace Microsoft.AspNet.Server.Kestrel
{
public class ServerInformation : IServerInformation, IKestrelServerInformation
{
public ServerInformation()
{
Addresses = new List<ServerAddress>();
}
public void Initialize(IConfiguration configuration)
{
var urls = configuration["server.urls"];
if (!string.IsNullOrEmpty(urls))
{
urls = "http://+:5000/";
}
foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
var address = ServerAddress.FromUrl(url);
if (address != null)
{
Addresses.Add(address);
}
}
}
public string Name
{
get
{
return "Kestrel";
}
}
public IList<ServerAddress> Addresses { get; private set; }
public int ThreadCount { get; set; }
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.Framework.Configuration;
namespace Microsoft.AspNet.Server.Kestrel
{
public class ServerInformation : IServerInformation, IKestrelServerInformation
{
public ServerInformation()
{
Addresses = new List<ServerAddress>();
}
public void Initialize(IConfiguration configuration)
{
string urls;
if (!configuration.TryGet("server.urls", out urls))
{
urls = "http://+:5000/";
}
foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
var address = ServerAddress.FromUrl(url);
if (address != null)
{
Addresses.Add(address);
}
}
}
public string Name
{
get
{
return "Kestrel";
}
}
public IList<ServerAddress> Addresses { get; private set; }
public int ThreadCount { get; set; }
}
}
| apache-2.0 | C# |
f3c322c3b49834f8a9ed1f01ae1288eccbabc3ef | fix disable plugin not working | vebin/Wox,sanbinabu/Wox,sanbinabu/Wox,zlphoenix/Wox,AlexCaranha/Wox,kdar/Wox,jondaniels/Wox,medoni/Wox,yozora-hitagi/Saber,EmuxEvans/Wox,Launchify/Launchify,EmuxEvans/Wox,danisein/Wox,zlphoenix/Wox,Launchify/Launchify,Megasware128/Wox,18098924759/Wox,mika76/Wox,kayone/Wox,mika76/Wox,yozora-hitagi/Saber,sanbinabu/Wox,18098924759/Wox,kayone/Wox,AlexCaranha/Wox,18098924759/Wox,AlexCaranha/Wox,vebin/Wox,jondaniels/Wox,Megasware128/Wox,vebin/Wox,JohnTheGr8/Wox,dstiert/Wox,dstiert/Wox,mika76/Wox,JohnTheGr8/Wox,EmuxEvans/Wox,dstiert/Wox,kayone/Wox,kdar/Wox,danisein/Wox,kdar/Wox,medoni/Wox | Wox.Core/Plugin/QueryDispatcher/BaseQueryDispatcher.cs | Wox.Core/Plugin/QueryDispatcher/BaseQueryDispatcher.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using Wox.Infrastructure;
using Wox.Plugin;
using Wox.Core.UserSettings;
namespace Wox.Core.Plugin.QueryDispatcher
{
public abstract class BaseQueryDispatcher : IQueryDispatcher
{
protected abstract List<PluginPair> GetPlugins(Query query);
public void Dispatch(Query query)
{
foreach (PluginPair pair in GetPlugins(query))
{
var customizedPluginConfig = UserSettingStorage.Instance.
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pair.Metadata.ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
{
return;
}
PluginPair localPair = pair;
if (query.IsIntantQuery && PluginManager.IsInstantSearchPlugin(pair.Metadata))
{
DebugHelper.WriteLine(string.Format("Plugin {0} is executing instant search.", pair.Metadata.Name));
using (new Timeit(" => instant search took: "))
{
PluginManager.ExecutePluginQuery(localPair, query);
}
}
else
{
ThreadPool.QueueUserWorkItem(state =>
{
PluginManager.ExecutePluginQuery(localPair, query);
});
}
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using Wox.Infrastructure;
using Wox.Plugin;
namespace Wox.Core.Plugin.QueryDispatcher
{
public abstract class BaseQueryDispatcher : IQueryDispatcher
{
protected abstract List<PluginPair> GetPlugins(Query query);
public void Dispatch(Query query)
{
foreach (PluginPair pair in GetPlugins(query))
{
PluginPair localPair = pair;
if (query.IsIntantQuery && PluginManager.IsInstantSearchPlugin(pair.Metadata))
{
DebugHelper.WriteLine(string.Format("Plugin {0} is executing instant search.", pair.Metadata.Name));
using (new Timeit(" => instant search took: "))
{
PluginManager.ExecutePluginQuery(localPair, query);
}
}
else
{
ThreadPool.QueueUserWorkItem(state =>
{
PluginManager.ExecutePluginQuery(localPair, query);
});
}
}
}
}
}
| mit | C# |
cae4a0e5da6ae175dddb94e31d98ea071bbd40ad | Set default version number in assembly attributes to 0.0.0.0. These are now set in the appveyor.yml instead and are replaced during the build. Having a 0 version number should help highlight any issues in the build too. | autofac/Autofac.Mef | src/Autofac.Integration.Mef/Properties/AssemblyInfo.cs | src/Autofac.Integration.Mef/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
[assembly: AssemblyTitle("Autofac.Integration.Mef")]
[assembly: InternalsVisibleTo("Autofac.Tests.Integration.Mef, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyCompany("Autofac Project - http://autofac.org")]
[assembly: AssemblyProduct("Autofac")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2014 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac MEF Integration")] | using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
[assembly: AssemblyTitle("Autofac.Integration.Mef")]
[assembly: InternalsVisibleTo("Autofac.Tests.Integration.Mef, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyCompany("Autofac Project - http://autofac.org")]
[assembly: AssemblyProduct("Autofac")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.3.0")]
[assembly: AssemblyInformationalVersion("3.0.3")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2014 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Mef 3.0.3")] | mit | C# |
c100c1400a352e5f255b3e2a66c9614b82c07daf | Test commit | kpnlora/LoRaClient | src/Kpn.LoRa.Api.Stub/src/Kpn.LoRa.Api.Stub/Startup.cs | src/Kpn.LoRa.Api.Stub/src/Kpn.LoRa.Api.Stub/Startup.cs | using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Kpn.LoRa.Api.Stub
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json");
if (env.IsEnvironment("Development"))
{
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
}
builder.AddEnvironmentVariables();
Configuration = builder.Build().ReloadOnChanged("appsettings.json");
}
public IConfigurationRoot Configuration { get; set; }
// This method gets called by the runtime. Use this method to add services to the container
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvc();
services.AddSwaggerGen();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseIISPlatformHandler();
app.UseApplicationInsightsRequestTelemetry();
app.UseApplicationInsightsExceptionTelemetry();
app.UseStaticFiles();
app.UseMvc();
app.UseSwaggerGen();
app.UseSwaggerUi();
}
// Entry point for the application.
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Swashbuckle.Application;
namespace Kpn.LoRa.Api.Stub
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json");
if (env.IsEnvironment("Development"))
{
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
}
builder.AddEnvironmentVariables();
Configuration = builder.Build().ReloadOnChanged("appsettings.json");
}
public IConfigurationRoot Configuration { get; set; }
// This method gets called by the runtime. Use this method to add services to the container
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvc();
services.AddSwaggerGen();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseIISPlatformHandler();
app.UseApplicationInsightsRequestTelemetry();
app.UseApplicationInsightsExceptionTelemetry();
app.UseStaticFiles();
app.UseMvc();
app.UseSwaggerGen();
app.UseSwaggerUi();
}
// Entry point for the application.
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
}
}
| mit | C# |
a12b266aaca81b13626f7ff246770331a9373d49 | add basic login endpoint | elerch/SAML2,alexrster/SAML2 | src/Owin.Security.Saml/SamlAuthenticationExtensions.cs | src/Owin.Security.Saml/SamlAuthenticationExtensions.cs | using System;
using Owin.Security.Saml;
namespace Owin
{
/// <summary>
/// Extension methods for using <see cref="SamlAuthenticationMiddleware"/>
/// </summary>
public static class SamlAuthenticationExtensions
{
/// <summary>
/// Adds the <see cref="SamlAuthenticationMiddleware"/> into the OWIN runtime.
/// </summary>
/// <param name="app">The <see cref="IAppBuilder"/> passed to the configuration method</param>
/// <param name="options">Saml2Configuration configuration options</param>
/// <returns>The updated <see cref="IAppBuilder"/></returns>
public static IAppBuilder UseSamlAuthentication(this IAppBuilder app, SamlAuthenticationOptions options)
{
if (app == null)
{
throw new ArgumentNullException("app");
}
if (options == null) throw new ArgumentNullException("options");
app.Map(options.MetadataPath, metadataapp => {
metadataapp.Run(new SamlMetadataWriter(options.Configuration).WriteMetadataDocument);
});
app.Map("/login", loginApp => {
loginApp.Run(ctx => ctx.Response.WriteAsync("login endpoint reached"));
});
return app.Use<SamlAuthenticationMiddleware>(app, options);
}
}
} | using System;
using Microsoft.Owin.Security;
using SAML2.Config;
using Owin.Security.Saml;
namespace Owin
{
/// <summary>
/// Extension methods for using <see cref="SamlAuthenticationMiddleware"/>
/// </summary>
public static class SamlAuthenticationExtensions
{
/// <summary>
/// Adds the <see cref="SamlAuthenticationMiddleware"/> into the OWIN runtime.
/// </summary>
/// <param name="app">The <see cref="IAppBuilder"/> passed to the configuration method</param>
/// <param name="options">Saml2Configuration configuration options</param>
/// <returns>The updated <see cref="IAppBuilder"/></returns>
public static IAppBuilder UseSamlAuthentication(this IAppBuilder app, SamlAuthenticationOptions options)
{
if (app == null)
{
throw new ArgumentNullException("app");
}
if (options == null) throw new ArgumentNullException("options");
app.Map(options.MetadataPath, metadataapp => {
metadataapp.Run(new SamlMetadataWriter(options.Configuration).WriteMetadataDocument);
});
return app.Use<SamlAuthenticationMiddleware>(app, options);
}
}
} | mpl-2.0 | C# |
15736221d75b782ed83be7ac71a3a12233e948fe | enable app insights in employer finance message handlers webjob | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EmployerFinance.MessageHandlers/Program.cs | src/SFA.DAS.EmployerFinance.MessageHandlers/Program.cs | using Microsoft.Azure.WebJobs;
using System.Threading;
using System.Threading.Tasks;
using SFA.DAS.AutoConfiguration;
using SFA.DAS.EmployerFinance.MessageHandlers.DependencyResolution;
using SFA.DAS.EmployerFinance.Startup;
using Microsoft.ApplicationInsights.Extensibility;
using System.Configuration;
namespace SFA.DAS.EmployerFinance.MessageHandlers
{
public class Program
{
public static void Main()
{
TelemetryConfiguration.Active.InstrumentationKey = ConfigurationManager.AppSettings["APPINSIGHTS_INSTRUMENTATIONKEY"];
MainAsync().GetAwaiter().GetResult();
}
public static async Task MainAsync()
{
using (var container = IoC.Initialize())
{
var config = new JobHostConfiguration();
var startup = container.GetInstance<IStartup>();
if (container.GetInstance<IEnvironmentService>().IsCurrent(DasEnv.LOCAL))
{
config.UseDevelopmentSettings();
}
var jobHost = new JobHost(config);
await startup.StartAsync();
await jobHost.CallAsync(typeof(Program).GetMethod(nameof(Block)));
jobHost.RunAndBlock();
await startup.StopAsync();
}
}
[NoAutomaticTrigger]
public static async Task Block(CancellationToken cancellationToken)
{
while (!cancellationToken.IsCancellationRequested)
{
await Task.Delay(3000, cancellationToken);
}
}
}
}
| using Microsoft.Azure.WebJobs;
using System.Threading;
using System.Threading.Tasks;
using SFA.DAS.AutoConfiguration;
using SFA.DAS.EmployerFinance.MessageHandlers.DependencyResolution;
using SFA.DAS.EmployerFinance.Startup;
namespace SFA.DAS.EmployerFinance.MessageHandlers
{
public class Program
{
public static void Main()
{
MainAsync().GetAwaiter().GetResult();
}
public static async Task MainAsync()
{
using (var container = IoC.Initialize())
{
var config = new JobHostConfiguration();
var startup = container.GetInstance<IStartup>();
if (container.GetInstance<IEnvironmentService>().IsCurrent(DasEnv.LOCAL))
{
config.UseDevelopmentSettings();
}
var jobHost = new JobHost(config);
await startup.StartAsync();
await jobHost.CallAsync(typeof(Program).GetMethod(nameof(Block)));
jobHost.RunAndBlock();
await startup.StopAsync();
}
}
[NoAutomaticTrigger]
public static async Task Block(CancellationToken cancellationToken)
{
while (!cancellationToken.IsCancellationRequested)
{
await Task.Delay(3000, cancellationToken);
}
}
}
}
| mit | C# |
ff68b9c216f3724468ca546b07ab5b5c02e01e16 | Update header of AssemblyInfo | anjdreas/UnitsNet,anjdreas/UnitsNet | UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs | UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs | // Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]).
// https://github.com/angularsen/UnitsNet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
#if WINDOWS_UWP
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
#endif
[assembly: AssemblyTitle("Units.NET")]
[assembly: AssemblyDescription("Units.NET gives you all the common units of measurement and the conversions between them. It is light-weight, unit tested and supports PCL.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Andreas Gullberg Larsen")]
[assembly: AssemblyProduct("Units.NET")]
[assembly: AssemblyCopyright("Copyright (c) 2013 Andreas Gullberg Larsen ([email protected])")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("")]
[assembly: AssemblyVersion("3.55.0")]
[assembly: AssemblyFileVersion("3.55.0")]
[assembly: InternalsVisibleTo("UnitsNet.WindowsRuntimeComponent.Tests")]
| // Copyright © 2007 Andreas Gullberg Larsen ([email protected]).
// https://github.com/angularsen/UnitsNet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
#if WINDOWS_UWP
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
#endif
[assembly: AssemblyTitle("Units.NET")]
[assembly: AssemblyDescription("Units.NET gives you all the common units of measurement and the conversions between them. It is light-weight, unit tested and supports PCL.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Andreas Gullberg Larsen")]
[assembly: AssemblyProduct("Units.NET")]
[assembly: AssemblyCopyright("Copyright © 2007 Andreas Gullberg Larsen")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("")]
[assembly: AssemblyVersion("3.55.0")]
[assembly: AssemblyFileVersion("3.55.0")]
[assembly: InternalsVisibleTo("UnitsNet.WindowsRuntimeComponent.Tests")]
| mit | C# |
a10a6b6913478a5a7f864c13623898a869a75ab5 | Fix a bug in ArchiveFile that prevented it from properly detecting GZIP files. | Bloyteg/RWXViewer,Bloyteg/RWXViewer,Bloyteg/RWXViewer,Bloyteg/RWXViewer | RWXViewer/Models/ArchiveFile.cs | RWXViewer/Models/ArchiveFile.cs | using System.ComponentModel;
using System.IO;
using System.IO.Compression;
using System.Linq;
namespace RWXViewer.Models
{
public enum ArchiveType
{
Zip,
Gzip,
Unknown
}
public class ArchiveFile
{
public static Stream OpenArchiveStream(byte[] streamData)
{
var archiveType = GetArchiveType(streamData);
switch (archiveType)
{
case ArchiveType.Zip:
return OpenZipArchive(streamData);
case ArchiveType.Gzip:
return OpenGzipArchive(streamData);
default:
throw new InvalidEnumArgumentException("archiveType");
}
}
private static Stream OpenGzipArchive(byte[] streamData)
{
return new GZipStream(new MemoryStream(streamData), CompressionMode.Decompress);
}
private static Stream OpenZipArchive(byte[] streamData)
{
var zipArchive = new ZipArchive(new MemoryStream(streamData), ZipArchiveMode.Read);
return zipArchive.Entries.First().Open();
}
private static ArchiveType GetArchiveType(byte[] resultData)
{
if (resultData.Length < 4)
{
return ArchiveType.Unknown;
}
if (resultData[0] == 0x50 && resultData[1] == 0x4B && resultData[2] == 0x03 && resultData[3] == 0x04)
{
return ArchiveType.Zip;
}
if (resultData[0] == 0x1F && resultData[1] == 0x8B)
{
return ArchiveType.Gzip;
}
return ArchiveType.Unknown;
}
}
} | using System.ComponentModel;
using System.IO;
using System.IO.Compression;
using System.Linq;
namespace RWXViewer.Models
{
public enum ArchiveType
{
Zip,
Gzip,
Unknown
}
public class ArchiveFile
{
public static Stream OpenArchiveStream(byte[] streamData)
{
var archiveType = GetArchiveType(streamData);
switch (archiveType)
{
case ArchiveType.Zip:
return OpenZipArchive(streamData);
case ArchiveType.Gzip:
return OpenGzipArchive(streamData);
default:
throw new InvalidEnumArgumentException("archiveType");
}
}
private static Stream OpenGzipArchive(byte[] streamData)
{
return new GZipStream(new MemoryStream(streamData), CompressionMode.Decompress);
}
private static Stream OpenZipArchive(byte[] streamData)
{
var zipArchive = new ZipArchive(new MemoryStream(streamData), ZipArchiveMode.Read);
return zipArchive.Entries.First().Open();
}
private static ArchiveType GetArchiveType(byte[] resultData)
{
if (resultData.Length < 4)
{
return ArchiveType.Unknown;
}
if (resultData[0] == 0x50 && resultData[1] == 0x4B && resultData[2] == 0x03 && resultData[3] == 0x04)
{
return ArchiveType.Zip;
}
if (resultData[0] == 0x1F && resultData[2] == 0x8B)
{
return ArchiveType.Gzip;
}
return ArchiveType.Unknown;
}
}
} | apache-2.0 | C# |
10d1aae992815039e04b9c256617413731ffc632 | Fix code vision order in not-unity projects | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-unity/src/Rider/CodeInsights/UnityCodeInsightCodeInsightProvider.cs | resharper/resharper-unity/src/Rider/CodeInsights/UnityCodeInsightCodeInsightProvider.cs | using System.Collections.Generic;
using JetBrains.Application.UI.Controls.GotoByName;
using JetBrains.Platform.RdFramework.Util;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Host.Features.CodeInsights.Providers;
using JetBrains.Rider.Model;
namespace JetBrains.ReSharper.Plugins.Unity.Rider.CodeInsights
{
[SolutionComponent]
public class UnityCodeInsightProvider : AbstractUnityCodeInsightProvider
{
public override string ProviderId => "Unity implicit usage";
public override string DisplayName => "Unity implicit usage";
public override CodeLensAnchorKind DefaultAnchor => CodeLensAnchorKind.Top;
public override ICollection<CodeLensRelativeOrdering> RelativeOrderings { get; }
public UnityCodeInsightProvider(UnityHost host, BulbMenuComponent bulbMenu, UnitySolutionTracker tracker)
: base(host, bulbMenu)
{
RelativeOrderings = tracker.IsUnityProject.HasValue() && tracker.IsUnityProject.Value
? new CodeLensRelativeOrdering[] {new CodeLensRelativeOrderingBefore(ReferencesCodeInsightsProvider.Id)}
: new CodeLensRelativeOrdering[] {new CodeLensRelativeOrderingLast()};
}
}
} | using System.Collections.Generic;
using JetBrains.Application.UI.Controls.GotoByName;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Host.Features.CodeInsights.Providers;
using JetBrains.Rider.Model;
namespace JetBrains.ReSharper.Plugins.Unity.Rider.CodeInsights
{
[SolutionComponent]
public class UnityCodeInsightProvider : AbstractUnityCodeInsightProvider
{
public override string ProviderId => "Unity implicit usage";
public override string DisplayName => "Unity implicit usage";
public override CodeLensAnchorKind DefaultAnchor => CodeLensAnchorKind.Top;
public override ICollection<CodeLensRelativeOrdering> RelativeOrderings => new[] { new CodeLensRelativeOrderingBefore(ReferencesCodeInsightsProvider.Id)};
public UnityCodeInsightProvider(UnityHost host,BulbMenuComponent bulbMenu)
: base(host, bulbMenu)
{
}
}
} | apache-2.0 | C# |
7cbc2ce6925ed2400e2a9f213c305094496add51 | update ServiceContract AssemblyVersion | gigya/microdot | Gigya.ServiceContract/Properties/AssemblyInfo.cs | Gigya.ServiceContract/Properties/AssemblyInfo.cs | #region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#endregion
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("Gigya.ServiceContract")]
[assembly: AssemblyProduct("Gigya.ServiceContract")]
[assembly: InternalsVisibleTo("Gigya.Microdot.ServiceProxy")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("db6d3561-835e-40d5-b9d4-83951cf426df")]
[assembly: AssemblyCompany("Gigya")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyInformationalVersion("2.4.16")]// if pre-release should be in the format of "2.4.11-pre01".
[assembly: AssemblyVersion("2.4.16")]
[assembly: AssemblyFileVersion("2.4.16")]
[assembly: AssemblyDescription("")]
// 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)]
[assembly: CLSCompliant(false)] | #region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#endregion
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("Gigya.ServiceContract")]
[assembly: AssemblyProduct("Gigya.ServiceContract")]
[assembly: InternalsVisibleTo("Gigya.Microdot.ServiceProxy")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("db6d3561-835e-40d5-b9d4-83951cf426df")]
[assembly: AssemblyCompany("Gigya")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyInformationalVersion("2.4.16-pre01")]// if pre-release should be in the format of "2.4.11-pre01".
[assembly: AssemblyVersion("2.4.16")]
[assembly: AssemblyFileVersion("2.4.16")]
[assembly: AssemblyDescription("")]
// 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)]
[assembly: CLSCompliant(false)] | apache-2.0 | C# |
28c2b7af2aa06e82a91ff62bbacf1bf512d642ed | Add VerifyEmail property to UserCreateRequest. Closes #152 | auth0/auth0.net,jerriep/auth0.net,jerriep/auth0.net,jerriep/auth0.net,auth0/auth0.net | src/Auth0.ManagementApi/Models/UserCreateRequest.cs | src/Auth0.ManagementApi/Models/UserCreateRequest.cs | using Auth0.Core;
using Newtonsoft.Json;
namespace Auth0.ManagementApi.Models
{
/// <summary>
///
/// </summary>
public class UserCreateRequest : UserBase
{
/// <summary>
/// Gets or sets the connection the user belongs to.
/// </summary>
[JsonProperty("connection")]
public string Connection { get; set; }
/// <summary>
/// Gets or sets the user's password. This is mandatory on non-SMS connections.
/// </summary>
[JsonProperty("password")]
public string Password { get; set; }
/// <summary>
/// The Nickname of the user.
/// </summary>
[JsonProperty("nickname")]
public string NickName { get; set; }
/// <summary>
/// The first name of the user (if available).
/// </summary>
/// <remarks>
/// This is the given_name attribute supplied by the underlying API.
/// </remarks>
[JsonProperty("given_name")]
public string FirstName { get; set; }
/// <summary>
/// The full name of the user (e.g.: John Foo). ALWAYS GENERATED.
/// </summary>
/// <remarks>
/// This is the name attribute supplied by the underlying API.
/// </remarks>
[JsonProperty("name")]
public string FullName { get; set; }
/// <summary>
/// The last name of the user (if available).
/// </summary>
/// <remarks>
/// This is the family_name attribute supplied by the underlying API.
/// </remarks>
[JsonProperty("family_name")]
public string LastName { get; set; }
/// <summary>
/// URL pointing to the user picture (if not available, will use gravatar.com with the email). ALWAYS GENERATED
/// </summary>
[JsonProperty("picture")]
public string Picture { get; set; }
/// <summary>
/// Gets or sets whether the user's email change must be verified. True if it must be verified, otherwise false.
/// </summary>
[JsonProperty("verify_email")]
public bool? VerifyEmail { get; set; }
}
} | using Auth0.Core;
using Newtonsoft.Json;
namespace Auth0.ManagementApi.Models
{
/// <summary>
///
/// </summary>
public class UserCreateRequest : UserBase
{
/// <summary>
/// Gets or sets the connection the user belongs to.
/// </summary>
[JsonProperty("connection")]
public string Connection { get; set; }
/// <summary>
/// Gets or sets the user's password. This is mandatory on non-SMS connections.
/// </summary>
[JsonProperty("password")]
public string Password { get; set; }
/// <summary>
/// The Nickname of the user.
/// </summary>
[JsonProperty("nickname")]
public string NickName { get; set; }
/// <summary>
/// The first name of the user (if available).
/// </summary>
/// <remarks>
/// This is the given_name attribute supplied by the underlying API.
/// </remarks>
[JsonProperty("given_name")]
public string FirstName { get; set; }
/// <summary>
/// The full name of the user (e.g.: John Foo). ALWAYS GENERATED.
/// </summary>
/// <remarks>
/// This is the name attribute supplied by the underlying API.
/// </remarks>
[JsonProperty("name")]
public string FullName { get; set; }
/// <summary>
/// The last name of the user (if available).
/// </summary>
/// <remarks>
/// This is the family_name attribute supplied by the underlying API.
/// </remarks>
[JsonProperty("family_name")]
public string LastName { get; set; }
/// <summary>
/// URL pointing to the user picture (if not available, will use gravatar.com with the email). ALWAYS GENERATED
/// </summary>
[JsonProperty("picture")]
public string Picture { get; set; }
}
} | mit | C# |
0e49d8b307710217560d21750cb3fb5e2376b859 | Bump to v1.4.0 | danielwertheim/requester | buildconfig.cake | buildconfig.cake | public class BuildConfig
{
private const string Version = "1.4.0";
private const bool IsPreRelease = false;
public readonly string SrcDir = "./src/";
public readonly string OutDir = "./build/";
public string Target { get; private set; }
public string SemVer { get; private set; }
public string BuildVersion { get; private set; }
public string BuildProfile { get; private set; }
public bool IsTeamCityBuild { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var target = context.Argument("target", "Default");
var buildRevision = context.Argument("buildrevision", "0");
return new BuildConfig
{
Target = target,
SemVer = Version + (IsPreRelease ? "-b" + buildRevision : string.Empty),
BuildVersion = Version + "." + buildRevision,
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity
};
}
}
| public class BuildConfig
{
private const string Version = "1.3.2";
private const bool IsPreRelease = false;
public readonly string SrcDir = "./src/";
public readonly string OutDir = "./build/";
public string Target { get; private set; }
public string SemVer { get; private set; }
public string BuildVersion { get; private set; }
public string BuildProfile { get; private set; }
public bool IsTeamCityBuild { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var target = context.Argument("target", "Default");
var buildRevision = context.Argument("buildrevision", "0");
return new BuildConfig
{
Target = target,
SemVer = Version + (IsPreRelease ? "-b" + buildRevision : string.Empty),
BuildVersion = Version + "." + buildRevision,
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity
};
}
}
| mit | C# |
15c563d72952414ce693b6c46571793bfe8905c9 | update formatting | designsbyjuan/UnityLib | ButtonManager.cs | ButtonManager.cs | using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ButtonManager : MonoBehaviour {
public ViewManager viewManager;
public Button[] buttons;
public int fontSizeSelected = 16;
public int fontSize = 14;
private SkyboxInfo[] skyboxInfo;
private Text text;
// Use this for initialization
void Start()
{
skyboxInfo = viewManager.SkyboxList;
}
// Update is called once per frame
void Update()
{
manageSkyboxButtonState();
}
void manageSkyboxButtonState()
{
// get current skybox
string currSkyBox = viewManager.currentSkybox;
// compare current skybox name with each name in skybox list
for (int i = 0; i < skyboxInfo.Length; i++)
{
string skybox = skyboxInfo[i].name;
if (currSkyBox.Equals(skybox))
{
Text text;
text = buttons[i].transform.GetChild(0).GetComponent<Text>();
text.fontStyle = FontStyle.Bold;
text.fontSize = fontSizeSelected;
}
else
{
Text text;
text = buttons[i].transform.GetChild(0).GetComponent<Text>();
text.fontStyle = FontStyle.Normal;
text.fontSize = fontSize;
}
}
}
}
| using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ButtonManager : MonoBehaviour {
public ViewManager viewManager;
public Button[] buttons;
public int fontSizeSelected = 16;
public int fontSize = 14;
private SkyboxInfo[] skyboxInfo;
private Text text;
// Use this for initialization
void Start()
{
skyboxInfo = viewManager.SkyboxList;
}
// Update is called once per frame
void Update()
{
manageSkyboxButtonState();
}
void manageSkyboxButtonState()
{
// get current skybox
string currSkyBox = viewManager.currentSkybox;
// compare current skybox name with each name in skybox list
for (int i = 0; i < skyboxInfo.Length; i++)
{
string skybox = skyboxInfo[i].name;
if (currSkyBox.Equals(skybox))
{
Text text;
text = buttons[i].transform.GetChild(0).GetComponent<Text>();
text.fontStyle = FontStyle.Bold;
text.fontSize = fontSizeSelected;
}
else
{
Text text;
text = buttons[i].transform.GetChild(0).GetComponent<Text>();
text.fontStyle = FontStyle.Normal;
text.fontSize = fontSize;
}
}
}
}
| mit | C# |
032cb054cdac434c33fc9b2aaf4067bc04f5fbc0 | Set NUGET_PACKAGES environment variable when running MSBuild commands | nkolev92/sdk,nkolev92/sdk | test/Microsoft.NET.TestFramework/Commands/MSBuildTest.cs | test/Microsoft.NET.TestFramework/Commands/MSBuildTest.cs | // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.NET.TestFramework.Commands
{
public class MSBuildTest
{
public static readonly MSBuildTest Stage0MSBuild = new MSBuildTest(RepoInfo.DotNetHostPath);
private string DotNetHostPath { get; }
public MSBuildTest(string dotNetHostPath)
{
DotNetHostPath = dotNetHostPath;
}
public ICommand CreateCommandForTarget(string target, params string[] args)
{
var newArgs = args.ToList();
newArgs.Insert(0, $"/t:{target}");
return CreateCommand(newArgs.ToArray());
}
private ICommand CreateCommand(params string[] args)
{
var newArgs = args.ToList();
newArgs.Insert(0, $"msbuild");
ICommand command = Command.Create(DotNetHostPath, newArgs);
// Set NUGET_PACKAGES environment variable to match value from build.ps1
command = command.EnvironmentVariable("NUGET_PACKAGES", RepoInfo.PackagesPath);
return command;
}
}
} | // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.NET.TestFramework.Commands
{
public class MSBuildTest
{
public static readonly MSBuildTest Stage0MSBuild = new MSBuildTest(RepoInfo.DotNetHostPath);
private string DotNetHostPath { get; }
public MSBuildTest(string dotNetHostPath)
{
DotNetHostPath = dotNetHostPath;
}
public Command CreateCommandForTarget(string target, params string[] args)
{
var newArgs = args.ToList();
newArgs.Insert(0, $"/t:{target}");
return CreateCommand(newArgs.ToArray());
}
private Command CreateCommand(params string[] args)
{
var newArgs = args.ToList();
newArgs.Insert(0, $"msbuild");
return Command.Create(DotNetHostPath, newArgs);
}
}
} | mit | C# |
711a4894b962c3ba26c0fc6eef57ddcb6e34cb76 | add TODOs | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | src/FilterLists.Agent/ListArchiver/DownloadLists.cs | src/FilterLists.Agent/ListArchiver/DownloadLists.cs | using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using FilterLists.Agent.Entities;
using MediatR;
namespace FilterLists.Agent.ListArchiver
{
public static class DownloadLists
{
public class Command : IRequest
{
public Command(IEnumerable<ListInfo> listInfo)
{
ListInfo = listInfo;
}
public IEnumerable<ListInfo> ListInfo { get; }
}
public class Handler : AsyncRequestHandler<Command>
{
//TODO: sort lists and use domain sharding for concurrent downloads
//TODO: manual/auto-tune degrees of parallelism
private const int MaxDegreeOfParallelism = 5;
private readonly IMediator _mediator;
public Handler(IMediator mediator)
{
_mediator = mediator;
}
protected override async Task Handle(Command request, CancellationToken cancellationToken)
{
var downloader = new ActionBlock<ListInfo>(
async l => await _mediator.Send(new DownloadList.Command(l), cancellationToken),
new ExecutionDataflowBlockOptions {MaxDegreeOfParallelism = MaxDegreeOfParallelism}
);
foreach (var list in request.ListInfo)
await downloader.SendAsync(list, cancellationToken);
downloader.Complete();
await downloader.Completion;
}
}
}
} | using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using FilterLists.Agent.Entities;
using MediatR;
namespace FilterLists.Agent.ListArchiver
{
public static class DownloadLists
{
public class Command : IRequest
{
public Command(IEnumerable<ListInfo> listInfo)
{
ListInfo = listInfo;
}
public IEnumerable<ListInfo> ListInfo { get; }
}
public class Handler : AsyncRequestHandler<Command>
{
private const int MaxDegreeOfParallelism = 25;
private readonly IMediator _mediator;
public Handler(IMediator mediator)
{
_mediator = mediator;
}
protected override async Task Handle(Command request, CancellationToken cancellationToken)
{
var downloader = new ActionBlock<ListInfo>(
async l => await _mediator.Send(new DownloadList.Command(l), cancellationToken),
new ExecutionDataflowBlockOptions {MaxDegreeOfParallelism = MaxDegreeOfParallelism}
);
foreach (var list in request.ListInfo)
await downloader.SendAsync(list, cancellationToken);
downloader.Complete();
await downloader.Completion;
}
}
}
} | mit | C# |
c7325f0f775357a51f8d1c9963c825f8fc32cd2a | Add missing load delay | UselessToucan/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,peppy/osu,peppy/osu-new,ppy/osu,UselessToucan/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu | osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs | osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class UpdateableBeatmapSetCover : ModelBackedDrawable<BeatmapSetInfo>
{
private readonly BeatmapSetCoverType coverType;
public BeatmapSetInfo BeatmapSet
{
get => Model;
set => Model = value;
}
public new bool Masking
{
get => base.Masking;
set => base.Masking = value;
}
public UpdateableBeatmapSetCover(BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover)
{
this.coverType = coverType;
InternalChild = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f),
};
}
protected override double LoadDelay => 500;
protected override double TransformDuration => 400;
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad)
=> new DelayedLoadUnloadWrapper(createContentFunc, timeBeforeLoad);
protected override Drawable CreateDrawable(BeatmapSetInfo model)
{
if (model == null)
return null;
return new BeatmapSetCover(model, coverType)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
};
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class UpdateableBeatmapSetCover : ModelBackedDrawable<BeatmapSetInfo>
{
private readonly BeatmapSetCoverType coverType;
public BeatmapSetInfo BeatmapSet
{
get => Model;
set => Model = value;
}
public new bool Masking
{
get => base.Masking;
set => base.Masking = value;
}
public UpdateableBeatmapSetCover(BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover)
{
this.coverType = coverType;
InternalChild = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f),
};
}
protected override double TransformDuration => 400.0;
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad)
=> new DelayedLoadUnloadWrapper(createContentFunc, timeBeforeLoad);
protected override Drawable CreateDrawable(BeatmapSetInfo model)
{
if (model == null)
return null;
return new BeatmapSetCover(model, coverType)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
};
}
}
}
| mit | C# |
1b385de837642fe3ceda8153c609e8d23ad1f189 | Add copyright header | SimplyCodeUK/packer-strategy,SimplyCodeUK/packer-strategy,SimplyCodeUK/packer-strategy | packer-strategy/Helpers/Attributes.cs | packer-strategy/Helpers/Attributes.cs | //
// Copyright (c) Simply Code Ltd. All rights reserved.
// Licensed under the MIT License.
// See LICENSE file in the project root for full license information.
//
namespace packer_strategy.Helpers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
/// <summary> An attributes. </summary>
public static class Attributes
{
/// <summary> An Enum extension method that short name. </summary>
///
/// <param name="value"> The value to act on. </param>
///
/// <returns> A string. </returns>
public static string ShortName(this Enum value)
{
// get attributes
var field = value.GetType().GetField(value.ToString());
IEnumerable<Attribute> attributes = field.GetCustomAttributes(false);
// Description is in a hidden Attribute class called DisplayAttribute
// Not to be confused with DisplayNameAttribute
dynamic displayAttribute = null;
if (attributes.Any())
{
displayAttribute = attributes.ElementAt(0);
}
// return description
return displayAttribute?.ShortName ?? value.ToString();
}
}
}
| namespace packer_strategy.Helpers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
/// <summary> An attributes. </summary>
public static class Attributes
{
/// <summary> An Enum extension method that short name. </summary>
///
/// <param name="value"> The value to act on. </param>
///
/// <returns> A string. </returns>
public static string ShortName(this Enum value)
{
// get attributes
var field = value.GetType().GetField(value.ToString());
IEnumerable<Attribute> attributes = field.GetCustomAttributes(false);
// Description is in a hidden Attribute class called DisplayAttribute
// Not to be confused with DisplayNameAttribute
dynamic displayAttribute = null;
if (attributes.Any())
{
displayAttribute = attributes.ElementAt(0);
}
// return description
return displayAttribute?.ShortName ?? value.ToString();
}
}
}
| mit | C# |
4eca5f387756b32bfe9cceb156b9c8edd106a4aa | Set size of InputEventTypeFlag to 2 bytes | vbfox/pinvoke,AArnott/pinvoke,jmelosegui/pinvoke | src/Kernel32.Desktop/Kernel32+InputEventTypeFlag.cs | src/Kernel32.Desktop/Kernel32+InputEventTypeFlag.cs | // Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
namespace PInvoke
{
using System;
using System.Runtime.InteropServices;
/// <content>
/// Contains the <see cref="InputEventTypeFlag"/> nested type.
/// </content>
public partial class Kernel32
{
/// <summary>
/// A handle to the type of input event and the event record stored in the <see cref="INPUT_RECORD.Event"/> member.
/// </summary>
public enum InputEventTypeFlag : short
{
/// <summary>
/// The Event member contains a <see cref="FOCUS_EVENT_RECORD"/> structure. These events are used internally and should be ignored
/// </summary>
FOCUS_EVENT = 0x0010,
/// <summary>
/// The Event member contains a <see cref="KEY_EVENT_RECORD"/> structure with information about a keyboard event.
/// </summary>
KEY_EVENT = 0x0001,
/// <summary>
/// The Event member contains a <see cref="MENU_EVENT_RECORD"/> structure. These events are used internally and should be ignored.
/// </summary>
MENU_EVENT = 0x0008,
/// <summary>
/// The Event member contains a <see cref="MOUSE_EVENT_RECORD"/> structure with information about a mouse movement or button press event.
/// </summary>
MOUSE_EVENT = 0x0002,
/// <summary>
/// The Event member contains a <see cref="WINDOW_BUFFER_SIZE_RECORD"/> structure with information about the new size of the console screen buffer.
/// </summary>
WINDOW_BUFFER_SIZE_EVENT = 0x0004
}
}
}
| // Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
namespace PInvoke
{
using System;
using System.Runtime.InteropServices;
/// <content>
/// Contains the <see cref="InputEventTypeFlag"/> nested type.
/// </content>
public partial class Kernel32
{
/// <summary>
/// A handle to the type of input event and the event record stored in the <see cref="INPUT_RECORD.Event"/> member.
/// </summary>
public enum InputEventTypeFlag
{
/// <summary>
/// The Event member contains a <see cref="FOCUS_EVENT_RECORD"/> structure. These events are used internally and should be ignored
/// </summary>
FOCUS_EVENT = 0x0010,
/// <summary>
/// The Event member contains a <see cref="KEY_EVENT_RECORD"/> structure with information about a keyboard event.
/// </summary>
KEY_EVENT = 0x0001,
/// <summary>
/// The Event member contains a <see cref="MENU_EVENT_RECORD"/> structure. These events are used internally and should be ignored.
/// </summary>
MENU_EVENT = 0x0008,
/// <summary>
/// The Event member contains a <see cref="MOUSE_EVENT_RECORD"/> structure with information about a mouse movement or button press event.
/// </summary>
MOUSE_EVENT = 0x0002,
/// <summary>
/// The Event member contains a <see cref="WINDOW_BUFFER_SIZE_RECORD"/> structure with information about the new size of the console screen buffer.
/// </summary>
WINDOW_BUFFER_SIZE_EVENT = 0x0004
}
}
}
| mit | C# |
0e37dce5c981454c3116ff2d9b082d9a9f47940d | Remove ReadAsAttribute from concrete response | elastic/elasticsearch-net,elastic/elasticsearch-net | src/Nest/XPack/Watcher/PutWatch/PutWatchResponse.cs | src/Nest/XPack/Watcher/PutWatch/PutWatchResponse.cs | using System.Runtime.Serialization;
using Elasticsearch.Net;
namespace Nest
{
public class PutWatchResponse : ResponseBase
{
[DataMember(Name = "created")]
public bool Created { get; internal set; }
[DataMember(Name = "_id")]
public string Id { get; internal set; }
[DataMember(Name = "_version")]
public int Version { get; internal set; }
[DataMember(Name = "_seq_no")]
public long SequenceNumber { get; internal set; }
[DataMember(Name = "_primary_term")]
public long PrimaryTerm { get; internal set; }
}
}
| using System.Runtime.Serialization;
using Elasticsearch.Net;
namespace Nest
{
[ReadAs(typeof(PutWatchResponse))]
public class PutWatchResponse : ResponseBase
{
[DataMember(Name = "created")]
public bool Created { get; internal set; }
[DataMember(Name = "_id")]
public string Id { get; internal set; }
[DataMember(Name = "_version")]
public int Version { get; internal set; }
}
}
| apache-2.0 | C# |
5d4cf2d3e04dcc75c7835e31d844f6276db32bbf | Add exchange_rate to the Balance Transaction resource | stripe/stripe-dotnet,richardlawley/stripe.net | src/Stripe.net/Entities/StripeBalanceTransaction.cs | src/Stripe.net/Entities/StripeBalanceTransaction.cs | namespace Stripe
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class StripeBalanceTransaction : StripeEntityWithId
{
[JsonProperty("object")]
public string Object { get; set; }
[JsonProperty("amount")]
public int Amount { get; set; }
[JsonProperty("available_on")]
[JsonConverter(typeof(StripeDateTimeConverter))]
public DateTime AvailableOn { get; set; }
[JsonProperty("created")]
[JsonConverter(typeof(StripeDateTimeConverter))]
public DateTime Created { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("exchange_rate")]
public decimal? ExchangeRate { get; set; }
[JsonProperty("fee")]
public int Fee { get; set; }
[JsonProperty("fee_details")]
public List<StripeFee> FeeDetails { get; set; }
[JsonProperty("net")]
public int Net { get; set; }
#region Expandable BalanceTransactionSource
public string SourceId { get; set; }
[JsonIgnore]
public BalanceTransactionSource Source { get; set; }
[JsonProperty("source")]
internal object InternalSource
{
set
{
StringOrObject<BalanceTransactionSource>.Map(value, s => this.SourceId = s, o => this.Source = o);
}
}
#endregion
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
}
}
| namespace Stripe
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class StripeBalanceTransaction : StripeEntityWithId
{
[JsonProperty("object")]
public string Object { get; set; }
[JsonProperty("amount")]
public int Amount { get; set; }
[JsonProperty("available_on")]
[JsonConverter(typeof(StripeDateTimeConverter))]
public DateTime AvailableOn { get; set; }
[JsonProperty("created")]
[JsonConverter(typeof(StripeDateTimeConverter))]
public DateTime Created { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("fee")]
public int Fee { get; set; }
[JsonProperty("fee_details")]
public List<StripeFee> FeeDetails { get; set; }
[JsonProperty("net")]
public int Net { get; set; }
#region Expandable BalanceTransactionSource
public string SourceId { get; set; }
[JsonIgnore]
public BalanceTransactionSource Source { get; set; }
[JsonProperty("source")]
internal object InternalSource
{
set
{
StringOrObject<BalanceTransactionSource>.Map(value, s => this.SourceId = s, o => this.Source = o);
}
}
#endregion
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
}
}
| apache-2.0 | C# |
22ae9118f081c98beffd3fcbbeae181910b12575 | Rename Long to LongField | laicasaane/VFW | Assets/Plugins/Editor/Vexe/GUIs/BaseGUI/Controls/Longs.cs | Assets/Plugins/Editor/Vexe/GUIs/BaseGUI/Controls/Longs.cs | using UnityEngine;
namespace Vexe.Editor.GUIs
{
public abstract partial class BaseGUI
{
public long LongField(long value)
{
return LongField(string.Empty, value);
}
public long LongField(string label, long value)
{
return LongField(label, value, null);
}
public long LongField(string label, string tooltip, long value)
{
return LongField(label, tooltip, value, null);
}
public long LongField(string label, long value, Layout option)
{
return LongField(label, string.Empty, value, option);
}
public long LongField(string label, string tooltip, long value, Layout option)
{
return LongField(GetContent(label, tooltip), value, option);
}
public abstract long LongField(GUIContent content, long value, Layout option);
}
}
| using UnityEngine;
namespace Vexe.Editor.GUIs
{
public abstract partial class BaseGUI
{
public long Long(long value)
{
return Long(string.Empty, value);
}
public long Long(string label, long value)
{
return Long(label, value, null);
}
public long Long(string label, string tooltip, long value)
{
return Long(label, tooltip, value, null);
}
public long Long(string label, long value, Layout option)
{
return Long(label, string.Empty, value, option);
}
public long Long(string label, string tooltip, long value, Layout option)
{
return Long(GetContent(label, tooltip), value, option);
}
public abstract long Long(GUIContent content, long value, Layout option);
}
} | mit | C# |
6d1f3b73efffdb5d58e96eb14d7b4290a15e774f | update link | btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver | BTCPayServer/Views/Stores/UpdateCoinSwitchSettings.cshtml | BTCPayServer/Views/Stores/UpdateCoinSwitchSettings.cshtml | @using Microsoft.AspNetCore.Mvc.Rendering
@model UpdateCoinSwitchSettingsViewModel
@{
Layout = "../Shared/_NavLayout.cshtml";
ViewData.SetActivePageAndTitle(StoreNavPages.Index, "Update Store CoinSwitch Settings");
}
<h4>@ViewData["Title"]</h4>
<partial name="_StatusMessage" for="StatusMessage"/>
<div class="row">
<div class="col-md-10">
<form method="post">
<p>
You can obtain a merchant id at
<a href="https://coinwitch.co/switch/setup/btcpay" target="_blank">
https://coinswitch.co
</a>
</p>
<div class="form-group">
<label asp-for="MerchantId"></label>
<input asp-for="MerchantId" class="form-control"/>
<span asp-validation-for="MerchantId" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Mode"></label>
<select asp-for="Mode" asp-items="Model.Modes" class="form-control" >
</select>
</div>
<div class="form-group">
<label asp-for="Enabled"></label>
<input asp-for="Enabled" type="checkbox" class="form-check"/>
</div>
<button name="command" type="submit" value="save" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
| @using Microsoft.AspNetCore.Mvc.Rendering
@model UpdateCoinSwitchSettingsViewModel
@{
Layout = "../Shared/_NavLayout.cshtml";
ViewData.SetActivePageAndTitle(StoreNavPages.Index, "Update Store CoinSwitch Settings");
}
<h4>@ViewData["Title"]</h4>
<partial name="_StatusMessage" for="StatusMessage"/>
<div class="row">
<div class="col-md-10">
<form method="post">
<p>
You can obtain a merchant id at
<a href="https://coinswitch.co/?ref=G0UVY10JIE" target="_blank">
https://coinswitch.co
</a>
</p>
<div class="form-group">
<label asp-for="MerchantId"></label>
<input asp-for="MerchantId" class="form-control"/>
<span asp-validation-for="MerchantId" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Mode"></label>
<select asp-for="Mode" asp-items="Model.Modes" class="form-control" >
</select>
</div>
<div class="form-group">
<label asp-for="Enabled"></label>
<input asp-for="Enabled" type="checkbox" class="form-check"/>
</div>
<button name="command" type="submit" value="save" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
| mit | C# |
457a1a381a6e906b2ce7d836ae7d85b28e21cc16 | Exclude exception | ucdavis/CRP,ucdavis/CRP,ucdavis/CRP | CRP.Mvc/App_Start/LogConfig.cs | CRP.Mvc/App_Start/LogConfig.cs | using FluentNHibernate.Utils;
using Serilog;
using Serilog.Exceptions.Destructurers;
using SerilogWeb.Classic.Enrichers;
namespace CRP.Mvc
{
public static class LogConfig
{
private static bool _loggingSetup;
/// <summary>
/// Configure Application Logging
/// </summary>
public static void ConfigureLogging()
{
if (_loggingSetup) return; //only setup logging once
Log.Logger = new LoggerConfiguration()
.WriteTo.Stackify()
.Filter.ByExcluding(a => a.Exception != null && a.Exception.Message.Contains("Server cannot modify cookies after HTTP headers have been sent"))
.Enrich.With<HttpSessionIdEnricher>()
.Enrich.With<UserNameEnricher>()
.Enrich.With<ExceptionEnricher>()
.Enrich.FromLogContext()
.CreateLogger();
_loggingSetup = true;
}
}
} | using Serilog;
using Serilog.Exceptions.Destructurers;
using SerilogWeb.Classic.Enrichers;
namespace CRP.Mvc
{
public static class LogConfig
{
private static bool _loggingSetup;
/// <summary>
/// Configure Application Logging
/// </summary>
public static void ConfigureLogging()
{
if (_loggingSetup) return; //only setup logging once
Log.Logger = new LoggerConfiguration()
.WriteTo.Stackify()
.Enrich.With<HttpSessionIdEnricher>()
.Enrich.With<UserNameEnricher>()
.Enrich.With<ExceptionEnricher>()
.Enrich.FromLogContext()
.CreateLogger();
_loggingSetup = true;
}
}
} | mit | C# |
90d5c48cd0767df4ee37b4e5b6f102c87915d683 | add method to collect faults subsuming given faults | maul-esel/ssharp,isse-augsburg/ssharp,isse-augsburg/ssharp,maul-esel/ssharp,isse-augsburg/ssharp,maul-esel/ssharp,isse-augsburg/ssharp,maul-esel/ssharp,isse-augsburg/ssharp | Source/SafetySharp/Modeling/SubsumptionHelper.cs | Source/SafetySharp/Modeling/SubsumptionHelper.cs | namespace SafetySharp.Modeling
{
using System.Collections.Generic;
using Runtime;
public static class SubsumptionHelper
{
private static readonly IDictionary<Fault[], Fault[]> unprocessedSubsumptions = new Dictionary<Fault[], Fault[]>();
private static readonly IDictionary<FaultSet, FaultSet> subsumptions = new Dictionary<FaultSet, FaultSet>();
public static void Subsumes(this Fault fault, params Fault[] subsumed)
{
new[] { fault }.Subsumes(subsumed);
}
public static void Subsumes(this Fault[] faults, params Fault[] subsumed)
{
unprocessedSubsumptions.Add(faults, subsumed);
}
internal static void ProcessSubsumptions()
{
foreach (var entry in unprocessedSubsumptions)
{
var key = new FaultSet(entry.Key);
var value = new FaultSet(entry.Value);
if (subsumptions.ContainsKey(key))
subsumptions[key] = subsumptions[key].GetUnion(value);
else
subsumptions.Add(key, value);
}
unprocessedSubsumptions.Clear();
}
public static FaultSet SubsumedFaults(this FaultSet faults)
{
var subsumed = faults;
uint oldCount;
do // fixed-point iteration
{
oldCount = subsumed.Cardinality;
foreach (var subsumption in subsumptions)
{
if (subsumption.Key.IsSubsetOf(subsumed))
subsumed = subsumed.GetUnion(subsumption.Value);
}
} while (oldCount < subsumed.Cardinality);
return subsumed;
}
public static FaultSet SubsumingFaults(this FaultSet faults)
{
var subsuming = faults;
uint oldCount;
do
{
oldCount = subsuming.Cardinality;
foreach (var subsumption in subsumptions)
{
if (!subsumption.Value.GetIntersection(subsuming).IsEmpty)
subsuming = subsuming.GetUnion(subsumption.Key);
}
} while (oldCount < subsuming.Cardinality);
return subsuming;
}
}
}
| namespace SafetySharp.Modeling
{
using System.Collections.Generic;
using Runtime;
public static class SubsumptionHelper
{
private static readonly IDictionary<Fault[], Fault[]> unprocessedSubsumptions = new Dictionary<Fault[], Fault[]>();
private static readonly IDictionary<FaultSet, FaultSet> subsumptions = new Dictionary<FaultSet, FaultSet>();
public static void Subsumes(this Fault fault, params Fault[] subsumed)
{
new[] { fault }.Subsumes(subsumed);
}
public static void Subsumes(this Fault[] faults, params Fault[] subsumed)
{
unprocessedSubsumptions.Add(faults, subsumed);
}
internal static void ProcessSubsumptions()
{
foreach (var entry in unprocessedSubsumptions)
{
var key = new FaultSet(entry.Key);
var value = new FaultSet(entry.Value);
if (subsumptions.ContainsKey(key))
subsumptions[key] = subsumptions[key].GetUnion(value);
else
subsumptions.Add(key, value);
}
unprocessedSubsumptions.Clear();
}
public static FaultSet SubsumedFaults(this FaultSet faults)
{
var subsumed = faults;
uint oldCount;
do // fixed-point iteration
{
oldCount = subsumed.Cardinality;
foreach (var subsumption in subsumptions)
{
if (subsumption.Key.IsSubsetOf(subsumed))
subsumed = subsumed.GetUnion(subsumption.Value);
}
} while (oldCount < subsumed.Cardinality);
return subsumed;
}
}
}
| mit | C# |
38700dc60cf2af5d3dccc14da52e719336eea77f | Increment build number | emoacht/SnowyImageCopy | Source/SnowyImageCopy/Properties/AssemblyInfo.cs | Source/SnowyImageCopy/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Snowy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Snowy")]
[assembly: AssemblyCopyright("Copyright © 2014-2020 emoacht")]
[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("55df0585-a26e-489e-bd94-4e6a50a83e23")]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US" , UltimateResourceFallbackLocation.MainAssembly)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.2.0")]
[assembly: AssemblyFileVersion("2.2.2.0")]
// For unit test
[assembly: InternalsVisibleTo("SnowyImageCopy.Test")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Snowy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Snowy")]
[assembly: AssemblyCopyright("Copyright © 2014-2020 emoacht")]
[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("55df0585-a26e-489e-bd94-4e6a50a83e23")]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US" , UltimateResourceFallbackLocation.MainAssembly)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.1.0")]
[assembly: AssemblyFileVersion("2.2.1.0")]
// For unit test
[assembly: InternalsVisibleTo("SnowyImageCopy.Test")]
| mit | C# |
eb085baac3ea5b65a7ee004f3ff6d632ef36bb90 | Fix small spelling mistake | erooijak/oogstplanner,erooijak/oogstplanner,erooijak/oogstplanner,erooijak/oogstplanner | SowingCalendar.Tests/Controllers/CropControllerTest.cs | SowingCalendar.Tests/Controllers/CropControllerTest.cs | using System;
using System.Web.Mvc;
using NUnit.Framework;
using SowingCalendar.Controllers;
using SowingCalendar.Models;
using SowingCalendar.Repositories;
using SowingCalendar.Tests.Fakes;
namespace SowingCalendar.Tests.Controllers
{
[TestFixture]
public class CropControllerTest
{
private CropController _controller;
[TestFixtureSetUp]
public void Setup()
{
// Initialize a fake database with one crop.
var db = new FakeSowingCalendarContext
{
Crops =
{
new Crop
{
Id = 1,
Name = "Broccoli",
SowingMonths = Month.May ^ Month.June ^ Month.October ^ Month.November
}
}
};
_controller = new CropController(db);
}
[Test]
public void Controllers_Crop_From_Id_Success()
{
// Arrange
var id = 1;
var expectedResult = "Broccoli";
// Act
var viewResult = _controller.Crop(id);
var actualResult = ((Crop)viewResult.ViewData.Model).Name;
// Assert
Assert.AreEqual(expectedResult, actualResult,
"Since there is a broccoli with ID 1 in the database the crop method should return it.");
}
}
}
| using System;
using System.Web.Mvc;
using NUnit.Framework;
using SowingCalendar.Controllers;
using SowingCalendar.Models;
using SowingCalendar.Repositories;
using SowingCalendar.Tests.Fakes;
namespace SowingCalendar.Tests.Controllers
{
[TestFixture]
public class CropControllerTest
{
private CropController _controller;
[TestFixtureSetUp]
public void Setup()
{
// Initialize a fake database with one crop.
var db = new FakeSowingCalendarContext
{
Crops =
{
new Crop
{
Id = 1,
Name = "Broccoli",
SowingMonths = Month.May ^ Month.June ^ Month.October ^ Month.November
}
}
};
_controller = new CropController(db);
}
[Test]
public void Controllers_Crop_From_Id_Success()
{
// Arrange
var id = 1;
var expectedResult = "Broccoli";
// Act
var viewResult = _controller.Crop(id);
var actualResult = ((Crop)viewResult.ViewData.Model).Name;
// Assert
Assert.AreEqual(expectedResult, actualResult,
"Since there is a broccoli with ID 1 in the database the crop method should erturn it.");
}
}
}
| mit | C# |
61e188f2af35eea7516351f7df8848d13f86f000 | Correct test config | NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework | Spa/NakedObjects.Spa.Selenium.Test/tests/TestConfig.cs | Spa/NakedObjects.Spa.Selenium.Test/tests/TestConfig.cs |
namespace NakedObjects.Web.UnitTests.Selenium
{
public static class TestConfig
{
//public const string BaseUrl = "http://localhost:49998/";
public const string BaseUrl = "http://nakedobjectstest.azurewebsites.net/";
}
}
|
namespace NakedObjects.Web.UnitTests.Selenium
{
public static class TestConfig
{
public const string BaseUrl = "http://localhost:49998/";
//public const string BaseUrl = "http://nakedobjectstest.azurewebsites.net/";
}
}
| apache-2.0 | C# |
da8e211639c7e04e9bd966a166e216bc0ee838fb | Fix null assignment in default constructor | SICU-Stress-Measurement-System/frontend-cs | StressMeasurementSystem/ViewModels/PatientViewModel.cs | StressMeasurementSystem/ViewModels/PatientViewModel.cs | using System.Collections.Generic;
using StressMeasurementSystem.Models;
namespace StressMeasurementSystem.ViewModels
{
public class PatientViewModel
{
private Patient _patient;
public PatientViewModel()
{
_patient = new Patient();
}
public PatientViewModel(Patient patient)
{
_patient = patient;
}
}
} | using System.Collections.Generic;
using StressMeasurementSystem.Models;
namespace StressMeasurementSystem.ViewModels
{
public class PatientViewModel
{
private Patient _patient;
public PatientViewModel()
{
_patient = null;
}
public PatientViewModel(Patient patient)
{
_patient = patient;
}
}
} | apache-2.0 | C# |
1c1c1a5496faf2cfa46f82a310040442fc1fed4a | test edits | DnDGen/RollGen,Lirusaito/RollGen,DnDGen/RollGen,Lirusaito/RollGen | Tests/Integration/RandomWrappers/RandomWrapperTests.cs | Tests/Integration/RandomWrappers/RandomWrapperTests.cs | using System;
using D20Dice.RandomWrappers;
using NUnit.Framework;
namespace D20Dice.Test.Integration.RandomWrappers
{
[TestFixture]
public class RandomWrapperTests
{
private const Int32 MAX = 10;
private const Int32 TESTRUNS = 1000000;
private IRandomWrapper wrapper;
[SetUp]
public void Setup()
{
wrapper = new RandomWrapper(new Random());
}
[Test]
public void InRange()
{
for (var i = 0; i < TESTRUNS; i++)
{
var result = wrapper.Next(MAX);
Assert.That(result, Is.InRange<Int32>(0, MAX));
}
}
[Test]
public void HitsMinAndMax()
{
var hitMin = false;
var hitMax = false;
var count = TESTRUNS;
while (!(hitMin && hitMax) && count-- > 0)
{
var result = wrapper.Next(MAX);
hitMin |= result == 0;
hitMax |= result == MAX - 1;
}
Assert.That(hitMin, Is.True, "Did not hit minimum");
Assert.That(hitMax, Is.True, "Did not hit maximum");
}
}
} | using System;
using D20Dice.RandomWrappers;
using NUnit.Framework;
namespace D20Dice.Test.Integration.RandomWrappers
{
[TestFixture]
public class RandomWrapperTests
{
private const Int32 POSMAX = 10;
private const Int32 TESTRUNS = 1000000;
private IRandomWrapper wrapper;
[SetUp]
public void Setup()
{
wrapper = new RandomWrapper(new Random());
}
[Test]
public void InRange()
{
for (var i = 0; i < TESTRUNS; i++)
{
var result = wrapper.Next(POSMAX);
Assert.That(result, Is.InRange<Int32>(0, POSMAX));
}
}
[Test]
public void HitsMinAndMax()
{
var hitMin = false;
var hitMax = false;
var count = TESTRUNS;
while (!(hitMin && hitMax) && count-- > 0)
{
var result = wrapper.Next(POSMAX);
if (result == 0)
hitMin = true;
else if (result == POSMAX - 1)
hitMax = true;
}
Assert.That(hitMin, Is.True, "Did not hit minimum");
Assert.That(hitMax, Is.True, "Did not hit maximum");
}
}
} | mit | C# |
323cae5ca1dc67e43963d111a08eafd6dbf36bad | change version to v3.2.8 | shabtaisharon/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,SpectraLogic/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk | VersionInfo.cs | VersionInfo.cs | /*
* ******************************************************************************
* Copyright 2014-2016 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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.Reflection;
// 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.2.8.0")]
[assembly: AssemblyFileVersion("3.2.8.0")]
| /*
* ******************************************************************************
* Copyright 2014-2016 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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.Reflection;
// 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.2.7.0")]
[assembly: AssemblyFileVersion("3.2.7.0")]
| apache-2.0 | C# |
6d8be10439c612dca0028957426ba702d7edfb86 | Bump the version number | adz21c/miles | VersionInfo.cs | VersionInfo.cs | using System.Reflection;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyCompany("Adam Burton")]
[assembly: AssemblyProduct("Miles")]
[assembly: AssemblyCopyright("Copyright © Adam Burton 2016")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.2.1.0")]
| using System.Reflection;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyCompany("Adam Burton")]
[assembly: AssemblyProduct("Miles")]
[assembly: AssemblyCopyright("Copyright © Adam Burton 2016")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.2.0.0")]
| apache-2.0 | C# |
d5fd59b954ecff7125b5111c4f19fa74328301b4 | Remove editorState from model before persisting | kgiszewski/Archetype,kjac/Archetype,Nicholas-Westby/Archetype,kipusoep/Archetype,imulus/Archetype,imulus/Archetype,kipusoep/Archetype,kipusoep/Archetype,kjac/Archetype,kgiszewski/Archetype,Nicholas-Westby/Archetype,Nicholas-Westby/Archetype,kjac/Archetype,kgiszewski/Archetype,imulus/Archetype | app/Umbraco/Umbraco.Archetype/Models/ArchetypeModel.cs | app/Umbraco/Umbraco.Archetype/Models/ArchetypeModel.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Archetype.Models
{
[JsonObject]
public class ArchetypeModel : IEnumerable<ArchetypeFieldsetModel>
{
[JsonProperty("fieldsets")]
public IEnumerable<ArchetypeFieldsetModel> Fieldsets { get; set; }
public ArchetypeModel()
{
Fieldsets = new List<ArchetypeFieldsetModel>();
}
public IEnumerator<ArchetypeFieldsetModel> GetEnumerator()
{
return this.Fieldsets.Where(f => f.Disabled == false).GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
public string SerializeForPersistence()
{
var json = JObject.Parse(JsonConvert.SerializeObject(this, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }));
var propertiesToRemove = new String[] { "propertyEditorAlias", "dataTypeId", "dataTypeGuid", "hostContentType", "editorState" };
json.Descendants().OfType<JProperty>()
.Where(p => propertiesToRemove.Contains(p.Name))
.ToList()
.ForEach(x => x.Remove());
return json.ToString(Formatting.None);
}
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Archetype.Models
{
[JsonObject]
public class ArchetypeModel : IEnumerable<ArchetypeFieldsetModel>
{
[JsonProperty("fieldsets")]
public IEnumerable<ArchetypeFieldsetModel> Fieldsets { get; set; }
public ArchetypeModel()
{
Fieldsets = new List<ArchetypeFieldsetModel>();
}
public IEnumerator<ArchetypeFieldsetModel> GetEnumerator()
{
return this.Fieldsets.Where(f => f.Disabled == false).GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
public string SerializeForPersistence()
{
// clear the editor state before serializing (it's temporary state data)
foreach(var property in Fieldsets.SelectMany(f => f.Properties.Where(p => p.EditorState != null)).ToList())
{
property.EditorState = null;
}
var json = JObject.Parse(JsonConvert.SerializeObject(this, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }));
var propertiesToRemove = new String[] { "propertyEditorAlias", "dataTypeId", "dataTypeGuid", "hostContentType" };
json.Descendants().OfType<JProperty>()
.Where(p => propertiesToRemove.Contains(p.Name))
.ToList()
.ForEach(x => x.Remove());
return json.ToString(Formatting.None);
}
}
}
| mit | C# |
e51a179342294a38c6a83670d1b1ed21b3c00d4e | fix wrong exception type | HarshPoint/HarshPoint,the-ress/HarshPoint,NaseUkolyCZ/HarshPoint | HarshPoint/Error.cs | HarshPoint/Error.cs | using System;
using System.Globalization;
namespace HarshPoint
{
internal static class Error
{
public static Exception ArgumentNull(String paramName)
{
return new ArgumentNullException(paramName);
}
public static Exception InvalidOperation(String message)
{
return new InvalidOperationException(message);
}
public static Exception InvalidOperation(String format, params Object[] args)
{
return new InvalidOperationException(
Format(format, args)
);
}
private static String Format(String format, Object[] args)
{
return String.Format(
CultureInfo.CurrentUICulture,
format,
args
);
}
}
}
| using System;
using System.Globalization;
namespace HarshPoint
{
internal static class Error
{
public static Exception ArgumentNull(String paramName)
{
return new ArgumentNullException(paramName);
}
public static Exception InvalidOperation(String message)
{
return new Exception(message);
}
public static Exception InvalidOperation(String format, params Object[] args)
{
return new InvalidOperationException(
Format(format, args)
);
}
private static String Format(String format, Object[] args)
{
return String.Format(
CultureInfo.CurrentUICulture,
format,
args
);
}
}
}
| bsd-2-clause | C# |
72ecfb918e8920332b43a90b21ccc3dff61658a6 | fix code review issue. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Controls/LockScreen/PinLockScreenViewModel.cs | WalletWasabi.Gui/Controls/LockScreen/PinLockScreenViewModel.cs | using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Helpers;
using System;
using System.Reactive;
using ReactiveUI;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using WalletWasabi.Gui.Helpers;
namespace WalletWasabi.Gui.Controls.LockScreen
{
public class PinLockScreenViewModel : ViewModelBase, ILockScreenViewModel
{
private LockScreenViewModel ParentVM { get; }
private CompositeDisposable Disposables { get; }
public ReactiveCommand<string, Unit> KeyPadCommand { get; }
private ObservableAsPropertyHelper<bool> _isLocked;
public bool IsLocked => _isLocked?.Value ?? false;
private string _pinInput;
public string PinInput
{
get => _pinInput;
set => this.RaiseAndSetIfChanged(ref _pinInput, value);
}
public PinLockScreenViewModel(LockScreenViewModel lockScreenViewModel)
{
ParentVM = Guard.NotNull(nameof(lockScreenViewModel), lockScreenViewModel);
Disposables = new CompositeDisposable();
KeyPadCommand = ReactiveCommand.Create<string>((arg) =>
{
if (arg == "BACK")
{
if (PinInput.Length > 0)
{
PinInput = PinInput.Substring(0, PinInput.Length - 1);
}
}
else if (arg == "CLEAR")
{
PinInput = string.Empty;
}
else
{
PinInput += arg;
}
});
this.WhenAnyValue(x => x.PinInput)
.Throttle(TimeSpan.FromSeconds(1))
.Where(x => !string.IsNullOrWhiteSpace(x))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x =>
{
if (ParentVM.PinHash != HashHelpers.GenerateSha256Hash(x))
{
NotificationHelpers.Error("PIN is incorrect!");
}
});
this.WhenAnyValue(x => x.PinInput)
.Select(Guard.Correct)
.Where(x => x.Length != 0)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x =>
{
if (ParentVM.PinHash == HashHelpers.GenerateSha256Hash(x))
{
ParentVM.IsLocked = false;
PinInput = string.Empty;
}
});
_isLocked = ParentVM
.WhenAnyValue(x => x.IsLocked)
.ObserveOn(RxApp.MainThreadScheduler)
.ToProperty(this, x => x.IsLocked)
.DisposeWith(Disposables);
this.WhenAnyValue(x => x.IsLocked)
.Where(x => !x)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(_ => PinInput = string.Empty);
}
public void Dispose()
{
Disposables?.Dispose();
}
}
}
| using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Helpers;
using System;
using System.Reactive;
using ReactiveUI;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using WalletWasabi.Gui.Helpers;
namespace WalletWasabi.Gui.Controls.LockScreen
{
public class PinLockScreenViewModel : ViewModelBase, ILockScreenViewModel
{
private LockScreenViewModel ParentVM { get; }
private CompositeDisposable Disposables { get; }
public ReactiveCommand<string, Unit> KeyPadCommand { get; }
private ObservableAsPropertyHelper<bool> _isLocked;
public bool IsLocked => _isLocked?.Value ?? false;
private string _pinInput;
public string PinInput
{
get => _pinInput;
set => this.RaiseAndSetIfChanged(ref _pinInput, value);
}
public PinLockScreenViewModel(LockScreenViewModel lockScreenViewModel)
{
ParentVM = Guard.NotNull(nameof(lockScreenViewModel), lockScreenViewModel);
Disposables = new CompositeDisposable();
KeyPadCommand = ReactiveCommand.Create<string>((arg) =>
{
if (arg == "BACK")
{
if (PinInput.Length > 0)
{
PinInput = PinInput.Substring(0, PinInput.Length - 1);
}
}
else if (arg == "CLEAR")
{
PinInput = string.Empty;
}
else
{
PinInput += arg;
}
});
this.WhenAnyValue(x => x.PinInput)
.Throttle(TimeSpan.FromSeconds(1))
.ObserveOn(RxApp.MainThreadScheduler)
.Where(x => !string.IsNullOrWhiteSpace(x))
.Subscribe(x =>
{
if (ParentVM.PinHash != HashHelpers.GenerateSha256Hash(x))
{
NotificationHelpers.Error("PIN is incorrect!");
}
});
this.WhenAnyValue(x => x.PinInput)
.Select(Guard.Correct)
.Where(x => x.Length != 0)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x =>
{
if (ParentVM.PinHash == HashHelpers.GenerateSha256Hash(x))
{
ParentVM.IsLocked = false;
PinInput = string.Empty;
}
});
_isLocked = ParentVM
.WhenAnyValue(x => x.IsLocked)
.ObserveOn(RxApp.MainThreadScheduler)
.ToProperty(this, x => x.IsLocked)
.DisposeWith(Disposables);
this.WhenAnyValue(x => x.IsLocked)
.Where(x => !x)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(_ => PinInput = string.Empty);
}
public void Dispose()
{
Disposables?.Dispose();
}
}
}
| mit | C# |
70b5c01d994b25660f969e2694ffd514ff5fd06d | Remove dead code. | EamonNerbonne/ExpressionToCode,asd-and-Rizzo/ExpressionToCode | ExpressionToCodeLib/PAssert.cs | ExpressionToCodeLib/PAssert.cs | using System;
using System.Linq.Expressions;
namespace ExpressionToCodeLib
{
public static class PAssert
{
[Obsolete("Prefer PAssert.That: IsTrue is provided for compatibility with PowerAssert.NET")]
public static void IsTrue(Expression<Func<bool>> assertion)
{
That(assertion);
}
public static void That(Expression<Func<bool>> assertion, string msg = null, bool emit = false)
{
var compiled = emit ? ExpressionCompiler.Compile(assertion) : assertion.Compile();
bool ok = false;
try {
ok = compiled();
} catch (Exception e) {
throw Err(assertion, msg ?? "failed with exception", e);
}
if (!ok) {
throw Err(assertion, msg ?? "failed", null);
}
}
static Exception Err(Expression<Func<bool>> assertion, string msg, Exception innerException)
=> UnitTestingFailure.AssertionExceptionFactory(ValuesOnStalksCodeAnnotator.AnnotatedToCode(assertion.Body, msg, true), innerException);
}
}
| #if true
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace ExpressionToCodeLib
{
public static class PAssert
{
[Obsolete("Prefer PAssert.That: IsTrue is provided for compatibility with PowerAssert.NET")]
public static void IsTrue(Expression<Func<bool>> assertion)
{
That(assertion);
}
public static void That(Expression<Func<bool>> assertion, string msg = null, bool emit = false)
{
var compiled = emit ? ExpressionCompiler.Compile(assertion) : assertion.Compile();
bool ok = false;
try {
ok = compiled();
} catch(Exception e) {
throw Err(assertion, msg ?? "failed with exception", e);
}
if(!ok) {
throw Err(assertion, msg ?? "failed", null);
}
}
static Exception Err(Expression<Func<bool>> assertion, string msg, Exception innerException) => UnitTestingFailure.AssertionExceptionFactory(ValuesOnStalksCodeAnnotator.AnnotatedToCode(assertion.Body, msg, true), innerException);
}
}
#else
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace ExpressionToCodeLib {
public static class PAssert {
public static void IsTrue(Expression<Func<bool>> assertion) { That(assertion, "PAssert.IsTrue failed for:"); }
private const string FullNewLine = "\r\n";
private static string MergeExceptionMessages(string multilineExpressionDisplay, string customMsg, Exception e = null)
{
if (string.IsNullOrEmpty(customMsg)) {
if (e != null) {
return "Expression threw: " + e.ToString() + FullNewLine + multilineExpressionDisplay;
}
customMsg = "failed";
}
else if (customMsg.Contains('\n')) {
return customMsg + (customMsg.EndsWith("\n") ? FullNewLine : string.Empty) + multilineExpressionDisplay;
}
int insertPos = multilineExpressionDisplay.IndexOfAny(new char[] { '\r', '\n' });
if (insertPos >= 0) {
return multilineExpressionDisplay.Insert(insertPos, " " + customMsg);
}
return multilineExpressionDisplay + " " + customMsg;
}
public static void That(Expression<Func<bool>> assertion, string msg = null) {
var compiled = assertion.Compile();
bool? ok;
try {
ok = compiled();
} catch (Exception e) {
msg = MergeExceptionMessages(ExpressionToCode.AnnotatedToCode(assertion.Body), msg, e);
throw UnitTestingFailure.AssertionExceptionFactory(msg, e);
}
if (ok == false) {
msg = MergeExceptionMessages(ExpressionToCode.AnnotatedToCode(assertion.Body), msg);
throw UnitTestingFailure.AssertionExceptionFactory(msg, null);
}
}
}
}
#endif
| apache-2.0 | C# |
7a315cd408fa0e753d54b596c537c7bd9b44613a | Bump version to 2.2.0.0 | InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform | Files/Packaging/GlobalAssemblyInfo.cs | Files/Packaging/GlobalAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Infinnity Solutions")]
[assembly: AssemblyProduct("InfinniPlatform")]
[assembly: AssemblyCopyright("Copyright © Infinnity Solutions 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyConfiguration("")]
// TeamCity File Content Replacer: Add build number
// Look in: */Packaging/GlobalAssemblyInfo.cs
// Find what: ((AssemblyVersion|AssemblyFileVersion)\s*\(\s*@?\")(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)\.(?<build>[0-9]+)(\"\s*\))
// Replace with: $1$3.$4.$5.\%build.number%$7
[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
// TeamCity File Content Replacer: Add VCS hash
// Look in: */Packaging/GlobalAssemblyInfo.cs
// Find what: (AssemblyInformationalVersion\s*\(\s*@?\").*?(\"\s*\))
// Replace with: $1\%build.vcs.number%$2
[assembly: AssemblyInformationalVersion("")] | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Infinnity Solutions")]
[assembly: AssemblyProduct("InfinniPlatform")]
[assembly: AssemblyCopyright("Copyright © Infinnity Solutions 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyConfiguration("")]
// TeamCity File Content Replacer: Add build number
// Look in: */Packaging/GlobalAssemblyInfo.cs
// Find what: ((AssemblyVersion|AssemblyFileVersion)\s*\(\s*@?\")(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)\.(?<build>[0-9]+)(\"\s*\))
// Replace with: $1$3.$4.$5.\%build.number%$7
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
// TeamCity File Content Replacer: Add VCS hash
// Look in: */Packaging/GlobalAssemblyInfo.cs
// Find what: (AssemblyInformationalVersion\s*\(\s*@?\").*?(\"\s*\))
// Replace with: $1\%build.vcs.number%$2
[assembly: AssemblyInformationalVersion("")] | agpl-3.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.