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
467444fd7a95748a95260a394cf66cf825891694
Remove the training link
reactiveui/website,reactiveui/website,reactiveui/website,reactiveui/website
input/_Navbar.cshtml
input/_Navbar.cshtml
@{ var pages = new Dictionary<string, string> { { "Blog", Context.GetLink("blog") }, { "Book", Context.GetLink("book") }, { "Documentation", Context.GetLink("docs") }, { "Extensions", Context.GetLink("reactive-extensions") }, { "API", Context.GetLink("api") }, { "Contribute", Context.GetLink("contribute") }, { "Discussions", "https://github.com/reactiveui/ReactiveUI/discussions" }, { "Slack", Context.GetLink("slack") }, { "Support", Context.GetLink("support") }, }; foreach(var currentPage in pages) { var activeClass = Context.GetLink(Document).StartsWith(currentPage.Value) ? "active" : null; <li class="@activeClass"> <a href="@currentPage.Value">@Html.Raw(currentPage.Key)</a> </li> } <li> <a class="github" href="https://github.com/reactiveui/reactiveui"> <img src="@Context.GetLink("/assets/img/GitHub-Mark-32px.png")" alt="GitHub" /> </a> </li> }
@{ var pages = new Dictionary<string, string> { { "Blog", Context.GetLink("blog") }, { "Training", Context.GetLink("training") }, { "Book", Context.GetLink("book") }, { "Documentation", Context.GetLink("docs") }, { "Extensions", Context.GetLink("reactive-extensions") }, { "API", Context.GetLink("api") }, { "Contribute", Context.GetLink("contribute") }, { "Discussions", "https://github.com/reactiveui/ReactiveUI/discussions" }, { "Slack", Context.GetLink("slack") }, { "Support", Context.GetLink("support") }, }; foreach(var currentPage in pages) { var activeClass = Context.GetLink(Document).StartsWith(currentPage.Value) ? "active" : null; <li class="@activeClass"> <a href="@currentPage.Value">@Html.Raw(currentPage.Key)</a> </li> } <li> <a class="github" href="https://github.com/reactiveui/reactiveui"> <img src="@Context.GetLink("/assets/img/GitHub-Mark-32px.png")" alt="GitHub" /> </a> </li> }
mit
C#
fac20769c369ee682eef20808cf0e3e1fdc40aea
Fix SandBox.LoginPost redirect issue (empty ReturnUrl).
ianbattersby/Simple.Http,markrendle/Simple.Web,markrendle/Simple.Web,markrendle/Simple.Web,ianbattersby/Simple.Http,ianbattersby/Simple.Http
src/Sandbox/LoginPost.cs
src/Sandbox/LoginPost.cs
namespace Sandbox { using System; using Models; using Simple.Web; using Simple.Web.Authentication; using Simple.Web.Behaviors; using Simple.Web.Helpers; [UriTemplate("/login")] public class LoginPost : IPost<Login>, ILogin { private static readonly Guid MarkGuid = new Guid("B3EDB5DEFECD42779FBE0D7771D13AD2"); public Status Post(Login login) { string redirectLocation; if (login.UserName == "mark" && login.Password == "password") { redirectLocation = string.IsNullOrWhiteSpace(login.ReturnUrl) ? "/" : login.ReturnUrl; this.LoggedInUser = new User(MarkGuid, "Mark"); } else { redirectLocation = UriFromType.Get(() => new LoginForm { ReturnUrl = login.ReturnUrl }).ToString(); } return Status.SeeOther(redirectLocation); } public IUser LoggedInUser { get; private set; } } }
namespace Sandbox { using System; using Models; using Simple.Web; using Simple.Web.Authentication; using Simple.Web.Behaviors; using Simple.Web.Helpers; [UriTemplate("/login")] public class LoginPost : IPost<Login>, ILogin { private static readonly Guid MarkGuid = new Guid("B3EDB5DEFECD42779FBE0D7771D13AD2"); public Status Post(Login login) { string redirectLocation; if (login.UserName == "mark" && login.Password == "password") { redirectLocation = login.ReturnUrl; LoggedInUser = new User(MarkGuid, "Mark"); } else { redirectLocation = UriFromType.Get(() => new LoginForm {ReturnUrl = login.ReturnUrl}).ToString(); } return Status.SeeOther(redirectLocation); } public IUser LoggedInUser { get; private set; } } }
mit
C#
88642323010d16b48740d178e53cd6342c58f113
Add http.host and http.path annotations
criteo/zipkin4net,criteo/zipkin4net
zipkin4net-aspnetcore/Criteo.Profiling.Tracing.Middleware/TracingMiddleware.cs
zipkin4net-aspnetcore/Criteo.Profiling.Tracing.Middleware/TracingMiddleware.cs
using System; using Microsoft.AspNetCore.Builder; using Criteo.Profiling.Tracing; using Criteo.Profiling.Tracing.Utils; using Microsoft.AspNetCore.Http.Extensions; namespace Criteo.Profiling.Tracing.Middleware { public static class TracingMiddleware { public static void UseTracing(this IApplicationBuilder app, string serviceName) { var extractor = new Middleware.ZipkinHttpTraceExtractor(); app.Use(async (context, next) => { Trace trace; var request = context.Request; if (!extractor.TryExtract(request.Headers, out trace)) { trace = Trace.Create(); } Trace.Current = trace; using (new ServerTrace(serviceName, request.Method)) { trace.Record(Annotations.Tag("http.host", request.Host.ToString())); trace.Record(Annotations.Tag("http.uri", UriHelper.GetDisplayUrl(request))); trace.Record(Annotations.Tag("http.path", request.Path)); await TraceHelper.TracedActionAsync(next()); } }); } } }
using System; using Microsoft.AspNetCore.Builder; using Criteo.Profiling.Tracing; using Criteo.Profiling.Tracing.Utils; namespace Criteo.Profiling.Tracing.Middleware { public static class TracingMiddleware { public static void UseTracing(this IApplicationBuilder app, string serviceName) { var extractor = new Middleware.ZipkinHttpTraceExtractor(); app.Use(async (context, next) => { Trace trace; var request = context.Request; if (!extractor.TryExtract(request.Headers, out trace)) { trace = Trace.Create(); } Trace.Current = trace; using (new ServerTrace(serviceName, request.Method)) { trace.Record(Annotations.Tag("http.uri", request.Path)); await TraceHelper.TracedActionAsync(next()); } }); } } }
apache-2.0
C#
e3274ed908492ff478076da270c6ba1071b27034
Make translation work with inheritance
pdfforge/translatable
Source/TranslationTest/MainWindowTranslation.cs
Source/TranslationTest/MainWindowTranslation.cs
namespace Translatable.TranslationTest { public class MainWindowTranslation : ITranslatable { protected IPluralBuilder PluralBuilder { get; set; } = new DefaultPluralBuilder(); public string Title { get; protected set; } = "Main window title"; public string SampleText { get; protected set; } = "This is my content\r\nwith multiple lines"; public string Messages { get; protected set; } = "Messages"; [Context("Some context")] public string Messages2 { get; protected set; } = "Messages"; protected string[] NewMessagesText { get; set; } = { "You have {0} new message", "You have {0} new messages" }; [TranslatorComment("This page is intentionally left blank")] public string MissingTranslation { get; set; } = "This translation might be \"missing\""; public EnumTranslation<TestEnum>[] TestEnumTranslation { get; protected set; } = EnumTranslation<TestEnum>.CreateDefaultEnumTranslation(); public string FormatMessageText(int messages) { var translation = PluralBuilder.GetPlural(messages, NewMessagesText); return string.Format(translation, messages); } } public class TestTranslation : MainWindowTranslation { public string Text { get; private set; } = "Test"; } }
namespace Translatable.TranslationTest { public class MainWindowTranslation : ITranslatable { private IPluralBuilder PluralBuilder { get; set; } = new DefaultPluralBuilder(); public string Title { get; private set; } = "Main window title"; public string SampleText { get; private set; } = "This is my content\r\nwith multiple lines"; public string Messages { get; private set; } = "Messages"; [Context("Some context")] public string Messages2 { get; private set; } = "Messages"; private string[] NewMessagesText { get; set; } = {"You have {0} new message", "You have {0} new messages"}; [TranslatorComment("This page is intentionally left blank")] public string MissingTranslation { get; set; } = "This translation might be \"missing\""; public EnumTranslation<TestEnum>[] TestEnumTranslation { get; private set; } = EnumTranslation<TestEnum>.CreateDefaultEnumTranslation(); public string FormatMessageText(int messages) { var translation = PluralBuilder.GetPlural(messages, NewMessagesText); return string.Format(translation, messages); } } }
mit
C#
65a405346b9549858fd2ad25bd4a6040dec89132
Update RunPoolingSystem.cs
cdrandin/Simple-Object-Pooling
Source/RunPoolingSystem.cs
Source/RunPoolingSystem.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; public class RunPoolingSystem : MonoBehaviour { public bool test; public List<GameObject> objects_to_pool; public List<GameObject> objects_in_the_pool; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.Space)) { GameObject obj = null; obj = PoolingSystem.instance.PS_Instantiate(objects_to_pool[Random.Range(0, objects_to_pool.Count)], new Vector3(Random.Range(-5.0f, 5.0f), 3.0f, Random.Range(-5.0f, 5.0f)), Quaternion.identity); if(obj == null) return; objects_in_the_pool.Add(obj); } else if(Input.GetKeyDown(KeyCode.Backspace)) { if(objects_in_the_pool.Count > 0) { int i = Random.Range(0, objects_in_the_pool.Count); if(!test) { PoolingSystem.instance.PS_Destroy(objects_in_the_pool[i]); } else { PoolingSystem.instance.PS_Destroy(objects_in_the_pool[i]); } objects_in_the_pool.RemoveAt(i); } } } }
using UnityEngine; using System.Collections; using System.Collections.Generic; public class RunPoolingSystem : MonoBehaviour { public List<GameObject> objects_to_pool; public List<GameObject> objects_in_the_pool; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.Space)) { GameObject obj = PoolingSystem.instance.PS_Instantiate(objects_to_pool[Random.Range(0, objects_to_pool.Count)], new Vector3(Random.Range(-5.0f, 5.0f), 3.0f, Random.Range(-5.0f, 5.0f)), Quaternion.identity); if(obj == null) return; objects_in_the_pool.Add(obj); } else if(Input.GetKeyDown(KeyCode.Backspace)) { if(objects_in_the_pool.Count > 0) { int i = Random.Range(0, objects_in_the_pool.Count); PoolingSystem.instance.PS_Destroy(objects_in_the_pool[i]); objects_in_the_pool.RemoveAt(i); } } } }
mit
C#
f1fa3c6c5608026a50a035dc8189788ac518e219
Update SynologyConnectionSettings.cs
DotNetDevs/Synology,DotNetDevs/Synology
Synology/Settings/SynologyConnectionSettings.cs
Synology/Settings/SynologyConnectionSettings.cs
using Synology.Interfaces; namespace Synology.Settings { public class SynologyConnectionSettings : ISynologyConnectionSettings { public string WebApiUrl { get; } public string Username { get; } public string Password { get; } public string BaseHost { get; } public bool SslEnabled { get; } public int Port { get; } public SynologyConnectionSettings(string baseHost, string username, string password, bool ssl = false, int port = 5000, int sslPort = 5001) { var usedPort = ssl ? sslPort : port; Username = username; Password = password; WebApiUrl = $"http{(ssl ? "s" : string.Empty)}://{baseHost}:{usedPort}/webapi/"; BaseHost = baseHost; SslEnabled = ssl; Port = usedPort; } } }
using Synology.Interfaces; namespace Synology.Settings { public class SynologyConnectionSettings : ISynologyConnectionSettings { public string WebApiUrl { get; } public string Username { get; } public string Password { get; } public string BaseHost { get; } public bool SslEnabled { get; } public int Port { get; } public SynologyConnectionSettings(string baseHost, string username, string password, bool ssl = false, int port = 5000, int sslPort = 5001) { var usedPort = ssl ? sslPort : port; Username = username; Password = Password; WebApiUrl = $"http{(ssl ? "s" : string.Empty)}://{baseHost}:{usedPort}/webapi/"; BaseHost = baseHost; SslEnabled = ssl; Port = usedPort; } } }
apache-2.0
C#
7ed124fe88aff9d6a5ca3a7a18fc7657bb7b0bfe
Fix assembly load bug.
terry-u16/MaterialChartPlugin
MaterialChartPlugin/MaterialChartPlugin.cs
MaterialChartPlugin/MaterialChartPlugin.cs
using Grabacr07.KanColleViewer.Composition; using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Text; using System.Threading.Tasks; using MaterialChartPlugin.Views; using MaterialChartPlugin.ViewModels; using Livet; namespace MaterialChartPlugin { [Export(typeof(IPlugin))] [ExportMetadata("Guid", "56B66906-608A-4BCC-9FE2-6B3B0093F377")] [ExportMetadata("Title", "MaterialChart")] [ExportMetadata("Description", "資材の推移を折れ線グラフで表示します。")] [ExportMetadata("Version", "0.1.0")] [ExportMetadata("Author", "@terry_u16")] [Export(typeof(ITool))] [Export(typeof(IRequestNotify))] public class MaterialChartPlugin : IPlugin, ITool, IRequestNotify { private ToolViewModel viewModel; public event EventHandler<NotifyEventArgs> NotifyRequested; public string Name => "Material"; public void InvokeNotifyRequested(NotifyEventArgs e) => this.NotifyRequested?.Invoke(this, e); // タブ表示する度に new されてしまうが、毎回 new しないとグラフが正常に表示されない模様? public object View => new ToolView() { DataContext = viewModel }; static MaterialChartPlugin() { try { // このクラスの何らかのメンバーにアクセスされたら読み込み // 読み込みに失敗したら例外が投げられてプラグインだけが死ぬ(はず) System.Reflection.Assembly.LoadFrom("protobuf-net.dll"); System.Reflection.Assembly.LoadFrom("System.Windows.Controls.DataVisualization.Toolkit.dll"); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); throw; } } public MaterialChartPlugin() { viewModel = new ToolViewModel(this); } public void Initialize() { viewModel.Initialize(); } } }
using Grabacr07.KanColleViewer.Composition; using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Text; using System.Threading.Tasks; using MaterialChartPlugin.Views; using MaterialChartPlugin.ViewModels; using Livet; namespace MaterialChartPlugin { [Export(typeof(IPlugin))] [ExportMetadata("Guid", "56B66906-608A-4BCC-9FE2-6B3B0093F377")] [ExportMetadata("Title", "MaterialChart")] [ExportMetadata("Description", "資材の推移を折れ線グラフで表示します。")] [ExportMetadata("Version", "0.1.0")] [ExportMetadata("Author", "@terry_u16")] [Export(typeof(ITool))] [Export(typeof(IRequestNotify))] public class MaterialChartPlugin : IPlugin, ITool, IRequestNotify { private ToolViewModel viewModel; public event EventHandler<NotifyEventArgs> NotifyRequested; public string Name => "Material"; public void InvokeNotifyRequested(NotifyEventArgs e) => this.NotifyRequested?.Invoke(this, e); // タブ表示する度に new されてしまうが、毎回 new しないとグラフが正常に表示されない模様? public object View => new ToolView() { DataContext = viewModel }; static MaterialChartPlugin() { try { // このクラスの何らかのメンバーにアクセスされたら読み込み // 読み込みに失敗したら例外が投げられてプラグインだけが死ぬ(はず) System.Reflection.Assembly.LoadFrom("protobuf-net.dll"); System.Reflection.Assembly.LoadFrom("Sparrow.Chart.Wpf.40.dll"); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); throw; } } public MaterialChartPlugin() { viewModel = new ToolViewModel(this); } public void Initialize() { viewModel.Initialize(); } } }
mit
C#
5213950ab2755b2e4aaadc19d9f589c3b069165b
Update Parser.cs
Mooophy/cs143,Mooophy/cs143,Mooophy/cs143,Mooophy/cs143,Mooophy/cs143
Dragon/Source/Parser.cs
Dragon/Source/Parser.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Dragon { public class Parser { private Lexer _lexer; private Token _look; public Env Top; public int Used; public Parser(Lexer lex) { this._lexer = lex; this.Move(); this.Top = null; this.Used = 0; } public void Move () { _look = _lexer.scan(); } public void Error(string msg) { //note The book here is lex.line, but Line is static member, so this might be a bug. throw new Exception("near line " + Lexer.Line + ": " + msg); } public void Match(int tag) { if (_look.TagValue == tag) this.Move(); else this.Error("syntax error"); } //.. } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Dragon { public class Parser { private Lexer _lexer; private Token _look; public Env Top; public int Used; public Parser(Lexer lex) { this._lexer = lex; this.Move(); this.Top = null; this.Used = 0; } public void Move () { _look = _lexer.scan(); } public void Error(string msg) { //note The book here is lex.line, but Line is static member, so this might be a bug. throw new Exception("near line " + Lexer.Line + ": " + msg); } public void Match(int tag) { if (_look.TagValue == tag) this.Move(); else this.Error("syntax error"); } } }
mit
C#
f19987f0f69a86e2217bd5081d55ae03d87c120d
disable test parallelization
nrjohnstone/Fluency
test/Fluency.Tests/Properties/AssemblyInfo.cs
test/Fluency.Tests/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Xunit; // 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("Fluency.Tests")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Fluency.Tests")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2c7dee80-12f8-410e-abd9-7a98bdb84ad2")] // 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")] // Some tests are using static configuration so no parallelization [assembly: CollectionBehavior(DisableTestParallelization = true)]
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("Fluency.Tests")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Fluency.Tests")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2c7dee80-12f8-410e-abd9-7a98bdb84ad2")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
a4eac0c7ca795f791a3dfce95bddf97635c33125
Make extract area test actually test something.
itinero/routing,itinero/routing
test/Itinero.Test/RouterDbExtractAreaTests.cs
test/Itinero.Test/RouterDbExtractAreaTests.cs
/* * Licensed to SharpSoftware under one or more contributor * license agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. * * SharpSoftware licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using NUnit.Framework; using Itinero.LocalGeo; using Itinero.Graphs.Directed; using System.IO; using Itinero.Attributes; using System.Linq; using Itinero.Data.Network.Restrictions; using Itinero.Data.Contracted; using System.Collections.Generic; using Itinero.Algorithms.Search.Hilbert; using Itinero.Data; namespace Itinero.Test { /// <summary> /// Contains tests for the router db extension methods to extract areas. /// </summary> [TestFixture] public class RouterDbExtractAreaTests { /// <summary> /// Tests extracting a boundingbox from network 5. /// </summary> [Test] public void TestSaveLoadNetwork5() { var routerDb = new RouterDb(); routerDb.AddSupportedVehicle(Itinero.Osm.Vehicles.Vehicle.Car); routerDb.LoadTestNetwork( System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( "Itinero.Test.test_data.networks.network5.geojson")); routerDb.Sort(); var newRouterDb = routerDb.ExtractArea(52.35246589354224f, 6.662435531616211f, 52.35580134510498f, 6.667134761810303f); Assert.AreEqual(11, newRouterDb.Network.VertexCount); } } }
/* * Licensed to SharpSoftware under one or more contributor * license agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. * * SharpSoftware licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using NUnit.Framework; using Itinero.LocalGeo; using Itinero.Graphs.Directed; using System.IO; using Itinero.Attributes; using System.Linq; using Itinero.Data.Network.Restrictions; using Itinero.Data.Contracted; using System.Collections.Generic; using Itinero.Algorithms.Search.Hilbert; using Itinero.Data; namespace Itinero.Test { /// <summary> /// Contains tests for the router db extension methods to extract areas. /// </summary> [TestFixture] public class RouterDbExtractAreaTests { /// <summary> /// Tests extracting a boundingbox from network 5. /// </summary> [Test] public void TestSaveLoadNetwork5() { var routerDb = new RouterDb(); routerDb.AddSupportedVehicle(Itinero.Osm.Vehicles.Vehicle.Car); routerDb.LoadTestNetwork( System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( "Itinero.Test.test_data.networks.network5.geojson")); routerDb.Sort(); var newRouterDb = routerDb.ExtractArea(52.35246589354224f, 6.662435531616211f, 52.35580134510498f, 6.667134761810303f); var json = newRouterDb.GetGeoJson(); } } }
apache-2.0
C#
9614805fa0905e7c0dd455c383652e08ff26906f
Fix #21
Mataniko/IV-Play
Forms/Propertiesview.cs
Forms/Propertiesview.cs
#region using IV_Play.Data; using System; using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; #endregion namespace IV_Play { /// <summary> /// Rom Properties view /// </summary> public partial class PropertiesView : Form { private Game _game; public PropertiesView(Game game) { InitializeComponent(); try { _game = new XmlParser().ReadGameByName(game.Name.Replace("fav_","")); } catch { _game = game; } } protected override void OnKeyUp(KeyEventArgs e) { if (e.KeyCode == Keys.Escape) Close(); base.OnKeyUp(e); } private void PopulateForm() { _layoutPanel.BackgroundImage = SettingsManager.BackgroundImage; Text = string.Format("IV/Play {0} Properties", _game.Description); _txtDesc.Text = _game.Description; _txtManu.Text = _game.Manufacturer; _txtName.Text = _game.Name.Replace("fav_", ""); _txtYear.Text = _game.Year; _txtColors.Text = _game.Colors; _txtStatus.Text = _game.Driver; _txtCPU.Text = _game.CPU; _txtRoms.Text = _game.Roms; _txtClone.Text = _game.CloneOf; _txtSource.Text = _game.SourceFile; _txtInput.Text = _game.Input; _txtSound.Text = _game.Sound; _txtScreen.Text = _game.Display; } private void PropertiesView_Load(object sender, EventArgs e) { PopulateForm(); } private void _btnClose_Click(object sender, EventArgs e) { Close(); } } }
#region using IV_Play.Data; using System; using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; #endregion namespace IV_Play { /// <summary> /// Rom Properties view /// </summary> public partial class PropertiesView : Form { private Game _game; public PropertiesView(Game game) { InitializeComponent(); try { _game = new XmlParser().ReadGameByName(game.Name); } catch { _game = game; } } protected override void OnKeyUp(KeyEventArgs e) { if (e.KeyCode == Keys.Escape) Close(); base.OnKeyUp(e); } private void PopulateForm() { _layoutPanel.BackgroundImage = SettingsManager.BackgroundImage; Text = string.Format("IV/Play {0} Properties", _game.Description); _txtDesc.Text = _game.Description; _txtManu.Text = _game.Manufacturer; _txtName.Text = _game.Name.Replace("fav_", ""); _txtYear.Text = _game.Year; _txtColors.Text = _game.Colors; _txtStatus.Text = _game.Driver; _txtCPU.Text = _game.CPU; _txtRoms.Text = _game.Roms; _txtClone.Text = _game.CloneOf; _txtSource.Text = _game.SourceFile; _txtInput.Text = _game.Input; _txtSound.Text = _game.Sound; _txtScreen.Text = _game.Display; } private void PropertiesView_Load(object sender, EventArgs e) { PopulateForm(); } private void _btnClose_Click(object sender, EventArgs e) { Close(); } } }
mit
C#
96d732ce748635a9d5dbab24a7beef63faa18aa4
make private
dotnet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,bartdesmet/roslyn,bartdesmet/roslyn
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfoCacheService.MetadataInfo.cs
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfoCacheService.MetadataInfo.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.FindSymbols.SymbolTree { internal sealed partial class SymbolTreeInfoCacheService { private readonly struct MetadataInfo { /// <summary> /// Can't be null. Even if we weren't able to read in metadata, we'll still create an empty /// index. /// </summary> public readonly SymbolTreeInfo SymbolTreeInfo; /// <summary> /// The set of projects that are referencing this metadata-index. When this becomes empty we can dump the /// index from memory. /// </summary> /// <remarks> /// <para>Accesses to this collection must lock the set.</para> /// </remarks> public readonly HashSet<ProjectId> ReferencingProjects; public MetadataInfo(SymbolTreeInfo info, HashSet<ProjectId> referencingProjects) { Contract.ThrowIfNull(info); SymbolTreeInfo = info; ReferencingProjects = referencingProjects; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.FindSymbols.SymbolTree { internal sealed partial class SymbolTreeInfoCacheService { public readonly struct MetadataInfo { /// <summary> /// Can't be null. Even if we weren't able to read in metadata, we'll still create an empty /// index. /// </summary> public readonly SymbolTreeInfo SymbolTreeInfo; /// <summary> /// The set of projects that are referencing this metadata-index. When this becomes empty we can dump the /// index from memory. /// </summary> /// <remarks> /// <para>Accesses to this collection must lock the set.</para> /// </remarks> public readonly HashSet<ProjectId> ReferencingProjects; public MetadataInfo(SymbolTreeInfo info, HashSet<ProjectId> referencingProjects) { Contract.ThrowIfNull(info); SymbolTreeInfo = info; ReferencingProjects = referencingProjects; } } } }
mit
C#
601ea8463bb03bb113310172cd0e880bd8523a89
Update "Database"
DRFP/Personal-Library
_Build/PersonalLibrary/Library/Database.cs
_Build/PersonalLibrary/Library/Database.cs
using Library.Model; using System; using System.Collections.Generic; namespace Library { public class Database { public static List<Book> Books() { var books = new List<Book>(); books.Add(new Book { slfID = 1, booTitle = "Title", booDescription = "Description", booAuthor = "Author", booPublisher = "Publisher", booPublishedDate = DateTime.Now.ToString(), booPageCount = 100, booRating = 5.0, booRatingsCount = 1000, booInformationURL = "Information URL", booPreviewURL = "Preview URL" }); return books; } public static List<Shelf> Shelves() { var shelves = new List<Shelf>(); shelves.Add(new Shelf { slfName = "Reading now" }); shelves.Add(new Shelf { slfName = "To read" }); shelves.Add(new Shelf { slfName = "Have read" }); return shelves; } } }
using Library.Model; using System; using System.Collections.Generic; namespace Library { public class Database { public static List<Book> Books() { var books = new List<Book>(); books.Add(new Book { slfID = 1, booTitle = "Title", booDescription = "Description", booAuthor = "Author", booPublisher = "Publisher", booPublishedDate = DateTime.Now, booPageCount = 100, booRating = 5.0, booRatingsCount = 1000, booInformationURL = "Information URL", booPreviewURL = "Preview URL" }); return books; } public static List<Shelf> Shelves() { var shelves = new List<Shelf>(); shelves.Add(new Shelf { slfName = "Reading now", slfDescription = "" }); shelves.Add(new Shelf { slfName = "To read", slfDescription = "" }); shelves.Add(new Shelf { slfName = "Have read", slfDescription = "" }); return shelves; } } }
mit
C#
259e64579b867f4e1aa0538b6885af308140cff4
fix incorrect case comparison
nerai/CMenu
src/ExampleMenu/Util.cs
src/ExampleMenu/Util.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using ConsoleMenu; namespace ExampleMenu { public class Util { /// <summary> /// Loose string comparison. Returns the best match using increasingly inaccurate comparisons. /// Also makes sure there is a sole match at that level of accuracy. /// /// Spaces in the select string are ignored. /// /// The levels are: /// <list> /// <item>Perfect match (abcd in abcd)</item> /// <item>Prefix match (ab in abcd)</item> /// <item>Containing match (bc in abcd)</item> /// <item>Matching ordered sequence of characters (bd in abcd)</item> /// </list> /// </summary> public static string LooseSelect (IEnumerable<string> source, string select, StringComparison sc) { select = select.Replace (" ", ""); var ec = sc.GetCorrespondingComparer (); var matches = new List<string> (); int bestQuality = 0; foreach (var s in source) { int quality = -1; if (s.Equals (select, sc)) { quality = 10; } else if (s.StartsWith (select, sc)) { quality = 8; } else if (s.Contains (select, sc)) { quality = 6; } else if (StringContainsSequence (s, select)) { quality = 3; } if (quality >= bestQuality) { if (quality > bestQuality) { bestQuality = quality; matches.Clear (); } matches.Add (s); } } if (matches.Count == 1) { return matches[0]; } if (matches.Count > 1) { Console.WriteLine ("Identifier not unique: " + select); } else { Console.WriteLine ("Could not find identifier: " + select); } return null; } private static bool StringContainsSequence ( string str, string sequence, StringComparison sc) { int i = 0; foreach (var c in sequence) { i = str.IndexOf (c.ToString (), i, sc); if (i == -1) { return false; } i++; } return true; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using ConsoleMenu; namespace ExampleMenu { public class Util { /// <summary> /// Loose string comparison. Returns the best match using increasingly inaccurate comparisons. /// Also makes sure there is a sole match at that level of accuracy. /// /// Spaces in the select string are ignored. /// /// The levels are: /// <list> /// <item>Perfect match (abcd in abcd)</item> /// <item>Prefix match (ab in abcd)</item> /// <item>Containing match (bc in abcd)</item> /// <item>Matching ordered sequence of characters (bd in abcd)</item> /// </list> /// </summary> public static string LooseSelect (IEnumerable<string> source, string select, StringComparison sc) { select = select.Replace (" ", ""); var ec = sc.GetCorrespondingComparer (); var matches = new List<string> (); int bestQuality = 0; foreach (var s in source) { int quality = -1; if (s.Equals (select, sc)) { quality = 10; } else if (s.StartsWith (select, sc)) { quality = 8; } else if (s.Contains (select, sc)) { quality = 6; } else if (StringContainsSequence (s, select)) { quality = 3; } if (quality >= bestQuality) { if (quality > bestQuality) { bestQuality = quality; matches.Clear (); } matches.Add (s); } } if (matches.Count == 1) { return matches[0]; } if (matches.Count > 1) { Console.WriteLine ("Identifier not unique: " + select); } else { Console.WriteLine ("Could not find identifier: " + select); } return null; } private static bool StringContainsSequence (string str, string sequence) { int i = 0; foreach (var c in sequence) { i = str.IndexOf (c, i) + 1; if (i == 0) { return false; } } return true; } } }
mit
C#
5888fa4654b5f97e0093b590979faee48e2ddb45
fix update sdk version number
NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity
ncmb_unity/Assets/NCMB/Script/CommonConstant.cs
ncmb_unity/Assets/NCMB/Script/CommonConstant.cs
/******* Copyright 2017 FUJITSU CLOUD TECHNOLOGIES LIMITED All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. **********/ using System.Collections; namespace NCMB.Internal { //通信種別 internal enum ConnectType { //GET通信 GET, //POST通信 POST, //PUT通信 PUT, //DELETE通信 DELETE } /// <summary> /// 定数を定義する共通用のクラスです /// </summary> internal static class CommonConstant { //service public static readonly string DOMAIN = "mb.api.cloud.nifty.com";//ドメイン public static readonly string DOMAIN_URL = "https://mb.api.cloud.nifty.com";//ドメインのURL public static readonly string API_VERSION = "2013-09-01";//APIバージョン public static readonly string SDK_VERSION = "3.2.1"; //SDKバージョン //DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください } }
/******* Copyright 2017 FUJITSU CLOUD TECHNOLOGIES LIMITED All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. **********/ using System.Collections; namespace NCMB.Internal { //通信種別 internal enum ConnectType { //GET通信 GET, //POST通信 POST, //PUT通信 PUT, //DELETE通信 DELETE } /// <summary> /// 定数を定義する共通用のクラスです /// </summary> internal static class CommonConstant { //service public static readonly string DOMAIN = "mb.api.cloud.nifty.com";//ドメイン public static readonly string DOMAIN_URL = "https://mb.api.cloud.nifty.com";//ドメインのURL public static readonly string API_VERSION = "2013-09-01";//APIバージョン public static readonly string SDK_VERSION = "3.2.0"; //SDKバージョン //DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください } }
apache-2.0
C#
05ae25fb6943689897b2b6578353f7da6581ee98
Make tests actually test the string output
smoogipooo/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework
osu.Framework.Tests/Input/KeyCombinationTest.cs
osu.Framework.Tests/Input/KeyCombinationTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Input.Bindings; namespace osu.Framework.Tests.Input { [TestFixture] public class KeyCombinationTest { private static readonly object[][] key_combination_display_test_cases = { new object[] { new KeyCombination(InputKey.Alt, InputKey.F4), "Alt-F4" }, new object[] { new KeyCombination(InputKey.D, InputKey.Control), "Ctrl-D" }, new object[] { new KeyCombination(InputKey.Shift, InputKey.F, InputKey.Control), "Ctrl-Shift-F" }, new object[] { new KeyCombination(InputKey.Alt, InputKey.Control, InputKey.Super, InputKey.Shift), "Ctrl-Alt-Shift-Win" } }; [TestCaseSource(nameof(key_combination_display_test_cases))] public void TestKeyCombinationDisplayOrder(KeyCombination keyCombination, string expectedRepresentation) => Assert.That(keyCombination.ReadableString(), Is.EqualTo(expectedRepresentation)); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Input.Bindings; using osu.Framework.Input.States; using osuTK.Input; using KeyboardState = osu.Framework.Input.States.KeyboardState; namespace osu.Framework.Tests.Input { [TestFixture] public class KeyCombinationTest { [Test] public void TestKeyCombinationDisplayTrueOrder() { var keyCombination1 = new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.R); var keyCombination2 = new KeyCombination(InputKey.R, InputKey.Shift, InputKey.Control); Assert.AreEqual(keyCombination1.ReadableString(), keyCombination2.ReadableString()); } [Test] public void TestKeyCombinationFromKeyboardStateDisplayTrueOrder() { var keyboardState = new KeyboardState(); keyboardState.Keys.Add(Key.R); keyboardState.Keys.Add(Key.LShift); keyboardState.Keys.Add(Key.LControl); var keyCombination1 = KeyCombination.FromInputState(new InputState(keyboard: keyboardState)); var keyCombination2 = new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.R); Assert.AreEqual(keyCombination1.ReadableString(), keyCombination2.ReadableString()); } } }
mit
C#
08e2f32bca371cc535538b6fca249893d0ce5b40
Fix Screensaver inhibit/uninhibit
mono/f-spot,mono/f-spot,Yetangitu/f-spot,mans0954/f-spot,Sanva/f-spot,NguyenMatthieu/f-spot,mans0954/f-spot,mans0954/f-spot,NguyenMatthieu/f-spot,mono/f-spot,GNOME/f-spot,GNOME/f-spot,mono/f-spot,Sanva/f-spot,mono/f-spot,mans0954/f-spot,dkoeb/f-spot,mono/f-spot,Yetangitu/f-spot,dkoeb/f-spot,dkoeb/f-spot,dkoeb/f-spot,GNOME/f-spot,dkoeb/f-spot,Yetangitu/f-spot,dkoeb/f-spot,Sanva/f-spot,mans0954/f-spot,NguyenMatthieu/f-spot,Yetangitu/f-spot,GNOME/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,GNOME/f-spot,Yetangitu/f-spot,NguyenMatthieu/f-spot,mans0954/f-spot,Sanva/f-spot
src/Core/FSpot.Platform/FSpot.Platform/ScreenSaver.cs
src/Core/FSpot.Platform/FSpot.Platform/ScreenSaver.cs
// // ScreenSaver.cs // // Author: // Stephane Delcroix <sdelcroix@src.gnome.org> // Stephen Shaw <sshaw@decriptor.com> // // Copyright (C) 2007-2009 Novell, Inc. // Copyright (C) 2007-2009 Stephane Delcroix // // 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.Runtime.InteropServices; using DBus; using Hyena; namespace FSpot.Platform { [Interface ("org.gnome.SessionManager")] public interface IScreenSaver { uint Inhibit (string appname, uint toplevel_xid, string reason, uint flags); void UnInhibit (uint cookie); } public static class ScreenSaver { const string DBUS_INTERFACE = "org.gnome.SessionManager"; const string DBUS_PATH = "/org/gnome/SessionManager"; private static IScreenSaver screensaver; private static IScreenSaver GnomeScreenSaver { get { if (screensaver == null) screensaver = Bus.Session.GetObject<IScreenSaver> (DBUS_INTERFACE, new ObjectPath (DBUS_PATH)); return screensaver; } } private static bool inhibited = false; private static uint cookie = 0; private static uint toplevel_xid = 0; // 8: Inhibit the session being marked as idle private static uint flags = 8; public static uint Inhibit (string reason ) { if (inhibited) return cookie; Log.InformationFormat ("Inhibit screensaver for {0}", reason); try { cookie = GnomeScreenSaver.Inhibit ("f-spot", toplevel_xid, reason, flags); inhibited = true; } catch (Exception ex) { Log.Exception ("Error Inhibiting the screensaver", ex); } return cookie; } public static void UnInhibit () { if (!inhibited) return; Log.Information ("UnInhibit screensaver"); try { GnomeScreenSaver.UnInhibit (cookie); inhibited = false; } catch (Exception ex) { Log.Exception ("Error UnInhibiting the screensaver", ex); } } } }
// // ScreenSaver.cs // // Author: // Stephane Delcroix <sdelcroix@src.gnome.org> // // Copyright (C) 2007-2009 Novell, Inc. // Copyright (C) 2007-2009 Stephane Delcroix // // 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.Runtime.InteropServices; using DBus; using Hyena; namespace FSpot.Platform { [Interface ("org.gnome.ScreenSaver")] public interface IScreenSaver { uint Inhibit (string appname, string reason); void UnInhibit (uint cookie); void Lock (); } public static class ScreenSaver { private static IScreenSaver screensaver; private static IScreenSaver GnomeScreenSaver { get { if (screensaver == null) screensaver = Bus.Session.GetObject<IScreenSaver> ("org.gnome.ScreenSaver", new ObjectPath ("/org/gnome/ScreenSaver")); return screensaver; } } private static bool inhibited = false; private static uint cookie = 0; public static uint Inhibit (string reason ) { if (inhibited) return cookie; Log.InformationFormat ("Inhibit screensaver for {0}", reason); try { cookie = GnomeScreenSaver.Inhibit ("f-spot", reason); inhibited = true; } catch (Exception ex) { Log.Exception ("Error Inhibiting the screensaver", ex); } return cookie; } public static void UnInhibit () { if (!inhibited) return; Log.Information ("UnInhibit screensaver"); try { GnomeScreenSaver.UnInhibit (cookie); inhibited = false; } catch (Exception ex) { Log.Exception ("Error UnInhibiting the screensaver", ex); } } } }
mit
C#
51475e73663fa2d6ea75b8f3094855740fd85c62
Remove partial declaration
vazgriz/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary,vazgriz/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary
CSGL.Vulkan/VkPhysicalDeviceMemoryProperties.cs
CSGL.Vulkan/VkPhysicalDeviceMemoryProperties.cs
using System; using System.Collections.Generic; namespace CSGL.Vulkan { public struct VkMemoryType { public VkMemoryPropertyFlags propertyFlags; public int heapIndex; internal VkMemoryType(Unmanaged.VkMemoryType other) { propertyFlags = other.propertyFlags; heapIndex = (int)other.heapIndex; } } public struct VkMemoryHeap { public long size; public VkMemoryHeapFlags flags; internal VkMemoryHeap(Unmanaged.VkMemoryHeap other) { size = (long)other.size; flags = other.flags; } } public class VkPhysicalDeviceMemoryProperties { public IList<VkMemoryType> MemoryTypes { get; private set; } public IList<VkMemoryHeap> MemoryHeaps { get; private set; } internal VkPhysicalDeviceMemoryProperties(Unmanaged.VkPhysicalDeviceMemoryProperties other) { var types = new List<VkMemoryType>((int)other.memoryTypeCount); for (int i = 0; i < (int)other.memoryTypeCount; i++) { types.Add(new VkMemoryType(other.GetMemoryTypes(i))); } MemoryTypes = types.AsReadOnly(); var heaps = new List<VkMemoryHeap>((int)other.memoryHeapCount); for (int i = 0; i < (int)other.memoryHeapCount; i++) { heaps.Add(new VkMemoryHeap(other.GetMemoryHeaps(i))); } MemoryHeaps = heaps.AsReadOnly(); } } }
using System; using System.Collections.Generic; namespace CSGL.Vulkan { public partial struct VkMemoryType { public VkMemoryPropertyFlags propertyFlags; public int heapIndex; internal VkMemoryType(Unmanaged.VkMemoryType other) { propertyFlags = other.propertyFlags; heapIndex = (int)other.heapIndex; } } public partial struct VkMemoryHeap { public long size; public VkMemoryHeapFlags flags; internal VkMemoryHeap(Unmanaged.VkMemoryHeap other) { size = (long)other.size; flags = other.flags; } } public class VkPhysicalDeviceMemoryProperties { public IList<VkMemoryType> MemoryTypes { get; private set; } public IList<VkMemoryHeap> MemoryHeaps { get; private set; } internal VkPhysicalDeviceMemoryProperties(Unmanaged.VkPhysicalDeviceMemoryProperties other) { var types = new List<VkMemoryType>((int)other.memoryTypeCount); for (int i = 0; i < (int)other.memoryTypeCount; i++) { types.Add(new VkMemoryType(other.GetMemoryTypes(i))); } MemoryTypes = types.AsReadOnly(); var heaps = new List<VkMemoryHeap>((int)other.memoryHeapCount); for (int i = 0; i < (int)other.memoryHeapCount; i++) { heaps.Add(new VkMemoryHeap(other.GetMemoryHeaps(i))); } MemoryHeaps = heaps.AsReadOnly(); } } }
mit
C#
3313a0d787fba546c6520cc89f210b49310c3505
Update Program.cs
jbogard/MediatR
samples/MediatR.Examples.Stashbox/Program.cs
samples/MediatR.Examples.Stashbox/Program.cs
using Stashbox; using Stashbox.Configuration; using System; using System.IO; using System.Threading.Tasks; namespace MediatR.Examples.Stashbox { class Program { static Task Main() { var writer = new WrappingWriter(Console.Out); var mediator = BuildMediator(writer); return Runner.Run(mediator, writer, "Stashbox"); } private static IMediator BuildMediator(WrappingWriter writer) { var container = new StashboxContainer() .RegisterInstance<TextWriter>(writer) .Register<ServiceFactory>(c => c.WithFactory(r => r.Resolve)) .RegisterAssemblies(new[] { typeof(Mediator).Assembly, typeof(Ping).Assembly }, serviceTypeSelector: Rules.ServiceRegistrationFilters.Interfaces, registerSelf: false); return container.Resolve<IMediator>(); } } }
using Stashbox; using Stashbox.Configuration; using System; using System.IO; using System.Threading.Tasks; namespace MediatR.Examples.Stashbox { class Program { static Task Main() { var writer = new WrappingWriter(Console.Out); var mediator = BuildMediator(writer); return Runner.Run(mediator, writer, "Stashbox"); } private static IMediator BuildMediator(WrappingWriter writer) { var container = new StashboxContainer(); container.RegisterInstance<TextWriter>(writer); container.Register<ServiceFactory>(c => c.WithFactory(r => r.Resolve)); container.RegisterAssemblies(new[] { typeof(Mediator).Assembly, typeof(Ping).Assembly }, serviceTypeSelector: Rules.ServiceRegistrationFilters.Interfaces, registerSelf: false); return container.Resolve<IMediator>(); } } }
apache-2.0
C#
2825cbcd856ceea71ab394b02ab6096807f62456
Update the version number from 1.0.0.0 to 1.1.0.0.
treytomes/DB2LinqPadDriver
DB2DataContextDriver/Properties/AssemblyInfo.cs
DB2DataContextDriver/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("DB2 Data Context Driver for LINQPad")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Trey Tomes")] [assembly: AssemblyProduct("DB2 Data Context Driver for LINQPad")] [assembly: AssemblyCopyright("Copyright © Trey Tomes 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8d314d9d-e23f-49d6-8351-99341a4a40a9")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
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("DB2 Data Context Driver for LINQPad")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Trey Tomes")] [assembly: AssemblyProduct("DB2 Data Context Driver for LINQPad")] [assembly: AssemblyCopyright("Copyright © Trey Tomes 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8d314d9d-e23f-49d6-8351-99341a4a40a9")] // 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#
2524ebb93f0ae26d3f8a6ec495e6af82034375fe
Add basic Get for a post
tvanfosson/dapper-integration-testing
DapperTesting/Core/Data/DapperPostRepository.cs
DapperTesting/Core/Data/DapperPostRepository.cs
using System; using System.Collections.Generic; using System.Linq; using Dapper; using DapperTesting.Core.Model; namespace DapperTesting.Core.Data { public class DapperPostRepository : DapperRepositoryBase, IPostRepository { public DapperPostRepository(IConnectionFactory connectionFactory, string connectionStringName) : base(connectionFactory, connectionStringName) { } public void Create(Post post) { throw new NotImplementedException(); } public void AddDetails(int postId, PostDetails details) { throw new NotImplementedException(); } public bool Delete(int postId) { throw new NotImplementedException(); } public bool DeleteDetails(int detailsId) { throw new NotImplementedException(); } public List<Post> GetPostsForUser(int userId) { throw new NotImplementedException(); } public Post Get(int id) { const string sql = "SELECT * FROM [Posts] WHERE [Id] = @postId"; var post = Fetch(c => c.Query<Post>(sql, new { postId = id })).SingleOrDefault(); return post; } public PostDetails GetDetails(int postId, int sequence) { throw new NotImplementedException(); } public bool Update(Post post) { throw new NotImplementedException(); } public bool UpdateDetails(PostDetails details) { throw new NotImplementedException(); } } }
using System; using System.Collections.Generic; using DapperTesting.Core.Model; namespace DapperTesting.Core.Data { public class DapperPostRepository : DapperRepositoryBase, IPostRepository { public DapperPostRepository(IConnectionFactory connectionFactory, string connectionStringName) : base(connectionFactory, connectionStringName) { } public void Create(Post post) { throw new NotImplementedException(); } public void AddDetails(int postId, PostDetails details) { throw new NotImplementedException(); } public bool Delete(int postId) { throw new NotImplementedException(); } public bool DeleteDetails(int detailsId) { throw new NotImplementedException(); } public List<Post> GetPostsForUser(int userId) { throw new NotImplementedException(); } public Post Get(int id) { throw new NotImplementedException(); } public PostDetails GetDetails(int postId, int sequence) { throw new NotImplementedException(); } public bool Update(Post post) { throw new NotImplementedException(); } public bool UpdateDetails(PostDetails details) { throw new NotImplementedException(); } } }
mit
C#
b5e04c5d6c17ebe429eff45bfa89b441ff2c1646
Use the full library name of libc (#2213)
mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp
binding/Binding.Shared/PlatformConfiguration.cs
binding/Binding.Shared/PlatformConfiguration.cs
using System; using System.Runtime.InteropServices; #if WINDOWS_UWP using Windows.ApplicationModel; using Windows.System; #endif #if HARFBUZZ namespace HarfBuzzSharp #else namespace SkiaSharp #endif { internal static class PlatformConfiguration { private const string LibCLibrary = "libc"; public static bool IsUnix { get; } public static bool IsWindows { get; } public static bool IsMac { get; } public static bool IsLinux { get; } public static bool IsArm { get; } public static bool Is64Bit { get; } static PlatformConfiguration () { #if WINDOWS_UWP IsMac = false; IsLinux = false; IsUnix = false; IsWindows = true; var arch = Package.Current.Id.Architecture; const ProcessorArchitecture arm64 = (ProcessorArchitecture)12; IsArm = arch == ProcessorArchitecture.Arm || arch == arm64; #else IsMac = RuntimeInformation.IsOSPlatform (OSPlatform.OSX); IsLinux = RuntimeInformation.IsOSPlatform (OSPlatform.Linux); IsUnix = IsMac || IsLinux; IsWindows = RuntimeInformation.IsOSPlatform (OSPlatform.Windows); var arch = RuntimeInformation.ProcessArchitecture; IsArm = arch == Architecture.Arm || arch == Architecture.Arm64; #endif Is64Bit = IntPtr.Size == 8; } private static string linuxFlavor; public static string LinuxFlavor { get { if (!IsLinux) return null; if (!string.IsNullOrEmpty (linuxFlavor)) return linuxFlavor; // we only check for musl/glibc right now if (!IsGlibc) return "musl"; return null; } set => linuxFlavor = value; } #if WINDOWS_UWP public static bool IsGlibc { get; } #else private static readonly Lazy<bool> isGlibcLazy = new Lazy<bool> (IsGlibcImplementation); public static bool IsGlibc => IsLinux && isGlibcLazy.Value; private static bool IsGlibcImplementation () { try { gnu_get_libc_version (); return true; } catch (TypeLoadException) { return false; } } [DllImport (LibCLibrary, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] private static extern IntPtr gnu_get_libc_version (); #endif } }
using System; using System.Runtime.InteropServices; #if WINDOWS_UWP using Windows.ApplicationModel; using Windows.System; #endif #if HARFBUZZ namespace HarfBuzzSharp #else namespace SkiaSharp #endif { internal static class PlatformConfiguration { public static bool IsUnix { get; } public static bool IsWindows { get; } public static bool IsMac { get; } public static bool IsLinux { get; } public static bool IsArm { get; } public static bool Is64Bit { get; } static PlatformConfiguration () { #if WINDOWS_UWP IsMac = false; IsLinux = false; IsUnix = false; IsWindows = true; var arch = Package.Current.Id.Architecture; const ProcessorArchitecture arm64 = (ProcessorArchitecture)12; IsArm = arch == ProcessorArchitecture.Arm || arch == arm64; #else IsMac = RuntimeInformation.IsOSPlatform (OSPlatform.OSX); IsLinux = RuntimeInformation.IsOSPlatform (OSPlatform.Linux); IsUnix = IsMac || IsLinux; IsWindows = RuntimeInformation.IsOSPlatform (OSPlatform.Windows); var arch = RuntimeInformation.ProcessArchitecture; IsArm = arch == Architecture.Arm || arch == Architecture.Arm64; #endif Is64Bit = IntPtr.Size == 8; } private static string linuxFlavor; public static string LinuxFlavor { get { if (!IsLinux) return null; if (!string.IsNullOrEmpty (linuxFlavor)) return linuxFlavor; // we only check for musl/glibc right now if (!IsGlibc) return "musl"; return null; } set => linuxFlavor = value; } #if WINDOWS_UWP public static bool IsGlibc { get; } #else private static readonly Lazy<bool> isGlibcLazy = new Lazy<bool> (IsGlibcImplementation); public static bool IsGlibc => IsLinux && isGlibcLazy.Value; private static bool IsGlibcImplementation () { try { gnu_get_libc_version (); return true; } catch (TypeLoadException) { return false; } } [DllImport ("c", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] private static extern IntPtr gnu_get_libc_version (); #endif } }
mit
C#
86848941873534272fbf67f7ebe4bf257d602cc4
Fix the build
tgstation/tgstation-server-tools,Cyberboss/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server,tgstation/tgstation-server
src/Tgstation.Server.Host/IO/ISynchronousIOManager.cs
src/Tgstation.Server.Host/IO/ISynchronousIOManager.cs
using System.Collections.Generic; using System.Threading; namespace Tgstation.Server.Host.IO { /// <summary> /// For accessing the disk in a synchronous manner /// </summary> interface ISynchronousIOManager { /// <summary> /// Enumerate files in a given <paramref name="path"/> /// </summary> /// <param name="path">The path to look for files in</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param> /// <returns>A <see cref="IEnumerable{T}"/> of file names in <paramref name="path"/></returns> IEnumerable<string> GetFiles(string path, CancellationToken cancellationToken); /// <summary> /// Enumerate directories in a given <paramref name="path"/> /// </summary> /// <param name="path">The path to look for directories in</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param> /// <returns>A <see cref="IEnumerable{T}"/> of directory names in <paramref name="path"/></returns> IEnumerable<string> GetDirectories(string path, CancellationToken cancellationToken); /// <summary> /// Read the <see cref="byte"/>s of a file at a given <paramref name="path"/> /// </summary> /// <param name="path">The path of the file to read</param> /// <returns>A <see cref="byte"/> array representing the contents of the file at <paramref name="path"/></returns> byte[] ReadFile(string path); /// <summary> /// Write <paramref name="data"/> to a file at a given <paramref name="path"/>. /// </summary> /// <param name="path">The path to the file to write</param> /// <param name="data">The new contents of the file</param> /// <param name="sha1InOut">The function only succeeds if this parameter matches the SHA-1 hash of the contents of the current file. Contains the SHA1 of the file on disk once the function returns</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param> /// <returns><see langword="true"/> on success, <see langword="false"/> if the operation failed due to <paramref name="sha1InOut"/> not matching the file's contents</returns> bool WriteFileChecked(string path, byte[] data, ref string sha1InOut, CancellationToken cancellationToken); /// <summary> /// Checks if a given <paramref name="path"/> is a directory /// </summary> /// <param name="path">The path to check</param> /// <returns><see langword="true"/> if <paramref name="path"/> is a directory, <see langword="false"/> otherwise</returns> bool IsDirectory(string path); } }
using System.Collections.Generic; using System.Threading; namespace Tgstation.Server.Host.IO { /// <summary> /// For accessing the disk in a synchronous manner /// </summary> interface ISynchronousIOManager { /// <summary> /// Enumerate files in a given <paramref name="path"/> /// </summary> /// <param name="path">The path to look for files in</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param> /// <returns>A <see cref="IEnumerable{T}"/> of file names in <paramref name="path"/></returns> IEnumerable<string> GetFiles(string path, CancellationToken cancellationToken); /// <summary> /// Enumerate directories in a given <paramref name="path"/> /// </summary> /// <param name="path">The path to look for directories in</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param> /// <returns>A <see cref="IEnumerable{T}"/> of directory names in <paramref name="path"/></returns> IEnumerable<string> GetDirectories(string path, CancellationToken cancellationToken); /// <summary> /// Read the <see cref="byte"/>s of a file at a given <paramref name="path"/> /// </summary> /// <param name="path">The path of the file to read</param> /// <returns>A <see cref="byte"/> array representing the contents of the file at <paramref name="path"/></returns> byte[] ReadFile(string path); /// <summary> /// Write <paramref name="data"/> to a file at a given <paramref name="path"/>. /// </summary> /// <param name="path">The path to the file to write</param> /// <param name="data">The new contents of the file</param> /// <param name="sha1InOut">The function only succeeds if this parameter matches the SHA-1 hash of the contents of the current file. Contains the SHA1 of the file on disk once the function returns</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param> /// <returns><see langword="true"/> on success, <see langword="false"/> if the operation failed due to <paramref name="previousSha1"/> not matching the file's contents</returns> bool WriteFileChecked(string path, byte[] data, ref string sha1InOut, CancellationToken cancellationToken); /// <summary> /// Checks if a given <paramref name="path"/> is a directory /// </summary> /// <param name="path">The path to check</param> /// <returns><see langword="true"/> if <paramref name="path"/> is a directory, <see langword="false"/> otherwise</returns> bool IsDirectory(string path); } }
agpl-3.0
C#
b8b355d813a931cc067a2275c80da2dc7c43b29a
Fix ComplexNavigationsOwnedQuery tests
azabluda/InfoCarrier.Core
test/InfoCarrier.Core.FunctionalTests/InMemory/ComplexNavigationsOwnedQueryInfoCarrierFixture.cs
test/InfoCarrier.Core.FunctionalTests/InMemory/ComplexNavigationsOwnedQueryInfoCarrierFixture.cs
namespace InfoCarrier.Core.FunctionalTests.InMemory { using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestModels.ComplexNavigationsModel; public class ComplexNavigationsOwnedQueryInfoCarrierFixture : ComplexNavigationsOwnedQueryFixtureBase<TestStoreBase> { private readonly InfoCarrierTestHelper<ComplexNavigationsContext> helper; public ComplexNavigationsOwnedQueryInfoCarrierFixture() { this.helper = InMemoryTestStore<ComplexNavigationsContext>.CreateHelper( this.OnModelCreating, opt => new ComplexNavigationsContext(opt), ctx => ComplexNavigationsModelInitializer.Seed(ctx, tableSplitting: true)); } public override TestStoreBase CreateTestStore() => this.helper.CreateTestStore(); public override ComplexNavigationsContext CreateContext(TestStoreBase testStore) => this.helper.CreateInfoCarrierContext(testStore); } }
namespace InfoCarrier.Core.FunctionalTests.InMemory { using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestModels.ComplexNavigationsModel; public class ComplexNavigationsOwnedQueryInfoCarrierFixture : ComplexNavigationsOwnedQueryFixtureBase<TestStoreBase> { private readonly InfoCarrierTestHelper<ComplexNavigationsContext> helper; public ComplexNavigationsOwnedQueryInfoCarrierFixture() { this.helper = InMemoryTestStore<ComplexNavigationsContext>.CreateHelper( this.OnModelCreating, opt => new ComplexNavigationsContext(opt), ctx => ComplexNavigationsModelInitializer.Seed(ctx)); } public override TestStoreBase CreateTestStore() => this.helper.CreateTestStore(); public override ComplexNavigationsContext CreateContext(TestStoreBase testStore) => this.helper.CreateInfoCarrierContext(testStore); } }
mit
C#
259d97bcfd11d2738c18579a88f20180128f4456
Fix restarting in build breaking the game
plrusek/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare,uulltt/NitoriWare
Assets/Scripts/Global/MicrogameCollection.cs
Assets/Scripts/Global/MicrogameCollection.cs
using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; [ExecuteInEditMode] public class MicrogameCollection : MonoBehaviour { [SerializeField] private List<Stage.Microgame> finishedMicrogames, stageReadyMicrogames, unfinishedMicrogames, bossMicrogames; public enum Restriction { All, StageReady, Finished } public void updateMicrogames() { finishedMicrogames = new List<Stage.Microgame>(); stageReadyMicrogames = new List<Stage.Microgame>(); unfinishedMicrogames = new List<Stage.Microgame>(); bossMicrogames = new List<Stage.Microgame>(); string[] microgameDirectories = Directory.GetDirectories(Application.dataPath + "/Resources/Microgames/_Finished/"); for (int i = 0; i < microgameDirectories.Length; i++) { string[] dirs = microgameDirectories[i].Split('/'); string microgameId = dirs[dirs.Length - 1]; finishedMicrogames.Add(new Stage.Microgame(microgameId)); } microgameDirectories = Directory.GetDirectories(Application.dataPath + "/Resources/Microgames/"); for (int i = 0; i < microgameDirectories.Length; i++) { string[] dirs = microgameDirectories[i].Split('/'); string microgameId = dirs[dirs.Length - 1]; if (!microgameId.StartsWith("_")) { if (MicrogameTraits.findMicrogameTraits(microgameId, 1, true).isStageReady) stageReadyMicrogames.Add(new Stage.Microgame(microgameId)); else unfinishedMicrogames.Add(new Stage.Microgame(microgameId)); } } microgameDirectories = Directory.GetDirectories(Application.dataPath + "/Resources/Microgames/_Bosses/"); for (int i = 0; i < microgameDirectories.Length; i++) { string[] dirs = microgameDirectories[i].Split('/'); string microgameId = dirs[dirs.Length - 1]; bossMicrogames.Add(new Stage.Microgame(microgameId)); } } /// <summary> /// Returns a copied list of all microgames available in the game, with the given restriction on completeness, does not include bosses /// </summary> /// <param name="restriction"></param> /// <returns></returns> public List<Stage.Microgame> getMicrogames(Restriction restriction) { List<Stage.Microgame> returnList = new List<Stage.Microgame>(finishedMicrogames); if (restriction != Restriction.Finished) { returnList.AddRange(stageReadyMicrogames); if (restriction == Restriction.All) returnList.AddRange(unfinishedMicrogames); } return returnList; } /// <summary> /// Returns a copied list of all boss microgmaes, regardless of completion /// </summary> /// <returns></returns> public List<Stage.Microgame> getBossMicrogames() { List<Stage.Microgame> returnList = new List<Stage.Microgame>(bossMicrogames); return returnList; } }
using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; [ExecuteInEditMode] public class MicrogameCollection : MonoBehaviour { [SerializeField] private List<Stage.Microgame> finishedMicrogames, stageReadyMicrogames, unfinishedMicrogames, bossMicrogames; public enum Restriction { All, StageReady, Finished } void Start() { updateMicrogames(); } public void updateMicrogames() { finishedMicrogames = new List<Stage.Microgame>(); stageReadyMicrogames = new List<Stage.Microgame>(); unfinishedMicrogames = new List<Stage.Microgame>(); bossMicrogames = new List<Stage.Microgame>(); string[] microgameDirectories = Directory.GetDirectories(Application.dataPath + "/Resources/Microgames/_Finished/"); for (int i = 0; i < microgameDirectories.Length; i++) { string[] dirs = microgameDirectories[i].Split('/'); string microgameId = dirs[dirs.Length - 1]; finishedMicrogames.Add(new Stage.Microgame(microgameId)); } microgameDirectories = Directory.GetDirectories(Application.dataPath + "/Resources/Microgames/"); for (int i = 0; i < microgameDirectories.Length; i++) { string[] dirs = microgameDirectories[i].Split('/'); string microgameId = dirs[dirs.Length - 1]; if (!microgameId.StartsWith("_")) { if (MicrogameTraits.findMicrogameTraits(microgameId, 1, true).isStageReady) stageReadyMicrogames.Add(new Stage.Microgame(microgameId)); else unfinishedMicrogames.Add(new Stage.Microgame(microgameId)); } } microgameDirectories = Directory.GetDirectories(Application.dataPath + "/Resources/Microgames/_Bosses/"); for (int i = 0; i < microgameDirectories.Length; i++) { string[] dirs = microgameDirectories[i].Split('/'); string microgameId = dirs[dirs.Length - 1]; bossMicrogames.Add(new Stage.Microgame(microgameId)); } } /// <summary> /// Returns a copied list of all microgames available in the game, with the given restriction on completeness, does not include bosses /// </summary> /// <param name="restriction"></param> /// <returns></returns> public List<Stage.Microgame> getMicrogames(Restriction restriction) { List<Stage.Microgame> returnList = new List<Stage.Microgame>(finishedMicrogames); if (restriction != Restriction.Finished) { returnList.AddRange(stageReadyMicrogames); if (restriction == Restriction.All) returnList.AddRange(unfinishedMicrogames); } return returnList; } /// <summary> /// Returns a copied list of all boss microgmaes, regardless of completion /// </summary> /// <returns></returns> public List<Stage.Microgame> getBossMicrogames() { List<Stage.Microgame> returnList = new List<Stage.Microgame>(bossMicrogames); return returnList; } }
mit
C#
13d92530b3939085ed8fde879a32a813dd9cf892
Add missing documentation to Kernel32 native methods class.
danpierce1/Colore,Sharparam/Colore,CoraleStudios/Colore,WolfspiritM/Colore
Corale.Colore/Native/Kernel32/NativeMethods.cs
Corale.Colore/Native/Kernel32/NativeMethods.cs
// --------------------------------------------------------------------------------------- // <copyright file="NativeMethods.cs" company="Corale"> // Copyright © 2015 by Adam Hellberg and Brandon Scott. // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // Disclaimer: Corale and/or Colore is in no way affiliated with Razer and/or any // of its employees and/or licensors. Corale, Adam Hellberg, and/or Brandon Scott // do not take responsibility for any harm caused, direct or indirect, to any // Razer peripherals via the use of Colore. // // "Razer" is a trademark of Razer USA Ltd. // </copyright> // --------------------------------------------------------------------------------------- namespace Corale.Colore.Native.Kernel32 { using System; using System.Runtime.InteropServices; /// <summary> /// Native methods from <c>kernel32</c> module. /// </summary> internal static class NativeMethods { /// <summary> /// Name of the DLL from which functions are imported. /// </summary> private const string DllName = "kernel32.dll"; [DllImport(DllName, CharSet = CharSet.Ansi, EntryPoint = "GetProcAddress", ExactSpelling = true, SetLastError = true)] internal static extern IntPtr GetProcAddress(IntPtr module, string procName); [DllImport(DllName, CharSet = CharSet.Ansi, EntryPoint = "LoadLibrary", SetLastError = true)] internal static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string filename); } }
// --------------------------------------------------------------------------------------- // <copyright file="NativeMethods.cs" company="Corale"> // Copyright © 2015 by Adam Hellberg and Brandon Scott. // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // Disclaimer: Corale and/or Colore is in no way affiliated with Razer and/or any // of its employees and/or licensors. Corale, Adam Hellberg, and/or Brandon Scott // do not take responsibility for any harm caused, direct or indirect, to any // Razer peripherals via the use of Colore. // // "Razer" is a trademark of Razer USA Ltd. // </copyright> // --------------------------------------------------------------------------------------- namespace Corale.Colore.Native.Kernel32 { using System; using System.Runtime.InteropServices; /// <summary> /// Native methods from <c>kernel32</c> module. /// </summary> internal static class NativeMethods { private const string DllName = "kernel32.dll"; [DllImport(DllName, CharSet = CharSet.Ansi, EntryPoint = "GetProcAddress", ExactSpelling = true, SetLastError = true)] internal static extern IntPtr GetProcAddress(IntPtr module, string procName); [DllImport(DllName, CharSet = CharSet.Ansi, EntryPoint = "LoadLibrary", SetLastError = true)] internal static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string filename); } }
mit
C#
d1251222ccfcbebf763c7f8732db00a7b40f8fb2
Add SlopeTo, AngleTo, NearestPointOnLine
SaberSnail/GoldenAnvil.Utility
GoldenAnvil.Utility.Windows/PointUtility.cs
GoldenAnvil.Utility.Windows/PointUtility.cs
using System; using System.Windows; namespace GoldenAnvil.Utility.Windows { public static class PointUtility { public static Point WithOffset(this Point point, Point that) { return new Point(point.X + that.X, point.Y + that.Y); } public static double DistanceTo(this Point point, Point target) { var dx = point.X - target.X; var dy = point.Y - target.Y; return Math.Sqrt((dx * dx) + (dy * dy)); } public static double SlopeTo(this Point point, Point target) { return (target.Y - point.Y) / (target.X - point.X); } public static double AngleTo(this Point point, Point target) { return Math.Atan2(target.Y - point.Y, target.X - point.X); } public static Vector VectorTo(this Point point, Point target) { return new Vector(target.X - point.X, target.Y - point.Y); } public static Point NearestPointOnLine(this Point point, Point target1, Point target2) { if (target1.X == target2.X) return new Point(target1.X, point.Y); var slope = target1.SlopeTo(target2); var offset = target1.Y - (slope * target1.X); var x = (point.X + slope * (point.Y - offset)) / (1.0 + (slope * slope)); var y = ((slope * point.X) + (slope * slope * point.Y) + slope) / (1 + (slope * slope)); return new Point(x, y); } public static Point RotateAround(this Point point, Point center, double angleInRadians) { var cosA = Math.Cos(angleInRadians); var sinA = Math.Sin(angleInRadians); var x = point.X - center.X; var y = point.Y - center.Y; x = x * cosA - y * sinA; y = x * sinA + y * cosA; return new Point(x + center.X, y + center.Y); } } }
using System; using System.Windows; namespace GoldenAnvil.Utility.Windows { public static class PointUtility { public static Point WithOffset(this Point point, Point that) { return new Point(point.X + that.X, point.Y + that.Y); } public static double DistanceTo(this Point point, Point target) { var dx = point.X - target.X; var dy = point.Y - target.Y; return Math.Sqrt((dx * dx) + (dy * dy)); } public static Vector VectorTo(this Point point, Point target) { return new Vector(target.X - point.X, target.Y - point.Y); } public static Point RotateAround(this Point point, Point center, double angleInRadians) { var cosA = Math.Cos(angleInRadians); var sinA = Math.Sin(angleInRadians); var x = point.X - center.X; var y = point.Y - center.Y; x = x * cosA - y * sinA; y = x * sinA + y * cosA; return new Point(x + center.X, y + center.Y); } } }
mit
C#
c399073595222ab8b692a8ed549257c54e6800ff
バージョンアップ。
kingkino/Implem.Pleasanter,Implem/Implem.Pleasanter,kingkino/Implem.Pleasanter,Implem/Implem.Pleasanter,Implem/Implem.Pleasanter
Implem.Pleasanter/Properties/AssemblyInfo.cs
Implem.Pleasanter/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Implem.Pleasanter")] [assembly: AssemblyDescription("Web tool that helps the efficiency of business")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Implem.Pleasanter")] [assembly: AssemblyCopyright("Copyright © Implem Inc 2014 - 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("ec0d3d5b-8879-462b-835f-ff1737a01543")] [assembly: AssemblyVersion("0.38.1.*")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Implem.Pleasanter")] [assembly: AssemblyDescription("Web tool that helps the efficiency of business")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Implem.Pleasanter")] [assembly: AssemblyCopyright("Copyright © Implem Inc 2014 - 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("ec0d3d5b-8879-462b-835f-ff1737a01543")] [assembly: AssemblyVersion("0.37.153.*")]
agpl-3.0
C#
65fd796e09ed4c39f0ea56e57886a4e3db15365c
Fix Plugin registration namespace
sevoku/MonoDevelop.Xwt
Properties/AddinInfo.cs
Properties/AddinInfo.cs
using Mono.Addins; [assembly:Addin ( "Xwt", Namespace = "MonoDevelop", Version = "1.0" )] [assembly:AddinName ("Xwt Project Support")] [assembly:AddinCategory ("IDE extensions")] [assembly:AddinDescription ( "Adds Xwt cross-platform UI project and file templates, " + "including executable projects for supported Xwt backends and " + "automatic platform detection.")] [assembly:AddinAuthor ("Vsevolod Kukol")] [assembly:AddinUrl ("https://github.com/sevoku/MonoDevelop.Xwt.git")]
using Mono.Addins; [assembly:Addin ( "MonoDevelop.Xwt", Namespace = "MonoDevelop.Xwt", Version = "1.0" )] [assembly:AddinName ("Xwt Project Support")] [assembly:AddinCategory ("IDE extensions")] [assembly:AddinDescription ( "Adds Xwt cross-platform UI project and file templates, " + "including executable projects for supported Xwt backends and " + "automatic platform detection.")] [assembly:AddinAuthor ("Vsevolod Kukol")] [assembly:AddinUrl ("https://github.com/sevoku/MonoDevelop.Xwt.git")]
mit
C#
0469c3a2fd9b07e963ac3a8aaca7b5007a428235
Remove ArchiveLaterTask if content item is deleted (#8308)
hbulzy/Orchard,LaserSrl/Orchard,LaserSrl/Orchard,OrchardCMS/Orchard,LaserSrl/Orchard,hbulzy/Orchard,Lombiq/Orchard,OrchardCMS/Orchard,LaserSrl/Orchard,hbulzy/Orchard,hbulzy/Orchard,Lombiq/Orchard,hbulzy/Orchard,LaserSrl/Orchard,OrchardCMS/Orchard,OrchardCMS/Orchard,Lombiq/Orchard,Lombiq/Orchard,Lombiq/Orchard,OrchardCMS/Orchard
src/Orchard.Web/Modules/Orchard.ArchiveLater/Handlers/ArchiveLaterPartHandler.cs
src/Orchard.Web/Modules/Orchard.ArchiveLater/Handlers/ArchiveLaterPartHandler.cs
using Orchard.ArchiveLater.Models; using Orchard.ArchiveLater.Services; using Orchard.ContentManagement.Handlers; namespace Orchard.ArchiveLater.Handlers { public class ArchiveLaterPartHandler : ContentHandler { private readonly IArchiveLaterService _archiveLaterService; public ArchiveLaterPartHandler(IArchiveLaterService archiveLaterService) { _archiveLaterService = archiveLaterService; OnLoading<ArchiveLaterPart>((context, part) => LazyLoadHandlers(part)); OnVersioning<ArchiveLaterPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart)); OnRemoved<ArchiveLaterPart>((context, part) => _archiveLaterService.RemoveArchiveLaterTasks(part.ContentItem)); OnDestroyed<ArchiveLaterPart>((context, part) => _archiveLaterService.RemoveArchiveLaterTasks(part.ContentItem)); } protected void LazyLoadHandlers(ArchiveLaterPart part) { part.ScheduledArchiveUtc.Loader(() => _archiveLaterService.GetScheduledArchiveUtc(part)); } } }
using Orchard.ArchiveLater.Models; using Orchard.ArchiveLater.Services; using Orchard.ContentManagement.Handlers; namespace Orchard.ArchiveLater.Handlers { public class ArchiveLaterPartHandler : ContentHandler { private readonly IArchiveLaterService _archiveLaterService; public ArchiveLaterPartHandler(IArchiveLaterService archiveLaterService) { _archiveLaterService = archiveLaterService; OnLoading<ArchiveLaterPart>((context, part) => LazyLoadHandlers(part)); OnVersioning<ArchiveLaterPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart)); } protected void LazyLoadHandlers(ArchiveLaterPart part) { part.ScheduledArchiveUtc.Loader(() => _archiveLaterService.GetScheduledArchiveUtc(part)); } } }
bsd-3-clause
C#
4344d78a4d960a71490a186f822a5b9c94a3bbb8
Make inputexception message tests more robust
gregsochanik/SevenDigital.Api.Wrapper,danbadge/SevenDigital.Api.Wrapper,emashliles/SevenDigital.Api.Wrapper,bnathyuw/SevenDigital.Api.Wrapper,bettiolo/SevenDigital.Api.Wrapper,AnthonySteele/SevenDigital.Api.Wrapper,mattgray/SevenDigital.Api.Wrapper,danhaller/SevenDigital.Api.Wrapper,luiseduardohdbackup/SevenDigital.Api.Wrapper,raoulmillais/SevenDigital.Api.Wrapper,minkaotic/SevenDigital.Api.Wrapper
src/SevenDigital.Api.Wrapper.Integration.Tests/Exceptions/ErrorConditionTests.cs
src/SevenDigital.Api.Wrapper.Integration.Tests/Exceptions/ErrorConditionTests.cs
using System; using NUnit.Framework; using SevenDigital.Api.Schema; using SevenDigital.Api.Wrapper.Exceptions; using SevenDigital.Api.Schema.ArtistEndpoint; using SevenDigital.Api.Schema.LockerEndpoint; namespace SevenDigital.Api.Wrapper.Integration.Tests.Exceptions { [TestFixture] public class ErrorConditionTests { [Test] public void Should_fail_with_input_parameter_exception_if_xml_error_returned() { // -- Deliberate error response Console.WriteLine("Trying artist/details without artistId parameter..."); var apiXmlException = Assert.Throws<InputParameterException>(() => Api<Artist>.Create.Please()); Assert.That(apiXmlException.ErrorCode, Is.EqualTo(ErrorCode.RequiredParameterMissing)); Assert.That(apiXmlException.Message, Is.StringStarting("Missing parameter artistId")); } [Test] public void Should_fail_with_non_xml_exception_if_plaintext_error_returned_eg_unauthorised() { // -- Deliberate unauthorized response Console.WriteLine("Trying user/locker without any credentials..."); var apiXmlException = Assert.Throws<OAuthException>(() => Api<Locker>.Create.Please()); Assert.That(apiXmlException.ResponseBody, Is.EqualTo("OAuth authentication error: Resource requires access token")); } } }
using System; using NUnit.Framework; using SevenDigital.Api.Schema; using SevenDigital.Api.Wrapper.Exceptions; using SevenDigital.Api.Schema.ArtistEndpoint; using SevenDigital.Api.Schema.LockerEndpoint; namespace SevenDigital.Api.Wrapper.Integration.Tests.Exceptions { [TestFixture] public class ErrorConditionTests { [Test] public void Should_fail_with_input_parameter_exception_if_xml_error_returned() { // -- Deliberate error response Console.WriteLine("Trying artist/details without artistId parameter..."); var apiXmlException = Assert.Throws<InputParameterException>(() => Api<Artist>.Create.Please()); Assert.That(apiXmlException.ErrorCode, Is.EqualTo(ErrorCode.RequiredParameterMissing)); Assert.That(apiXmlException.Message, Is.EqualTo("Missing parameter artistId")); } [Test] public void Should_fail_with_non_xml_exception_if_plaintext_error_returned_eg_unauthorised() { // -- Deliberate unauthorized response Console.WriteLine("Trying user/locker without any credentials..."); var apiXmlException = Assert.Throws<OAuthException>(() => Api<Locker>.Create.Please()); Assert.That(apiXmlException.ResponseBody, Is.EqualTo("OAuth authentication error: Resource requires access token")); } } }
mit
C#
aa497df0804c403a35e667a6c027e99899b31738
Update TiledMapImporter.cs
eumario/Nez,ericmbernier/Nez,prime31/Nez,Blucky87/Nez,prime31/Nez,prime31/Nez
Nez.PipelineImporter/Tiled/TiledMapImporter.cs
Nez.PipelineImporter/Tiled/TiledMapImporter.cs
using System; using System.IO; using System.Xml.Serialization; using Microsoft.Xna.Framework.Content.Pipeline; namespace Nez.TiledMaps { [ContentImporter( ".tmx", DefaultProcessor = "TiledMapProcessor", DisplayName = "Tiled Map Importer" )] public class TiledMapImporter : ContentImporter<TmxMap> { public override TmxMap Import( string filename, ContentImporterContext context ) { if( filename == null ) throw new ArgumentNullException( nameof( filename ) ); using( var reader = new StreamReader( filename ) ) { context.Logger.LogMessage( "Deserializing filename: {0}", filename ); var serializer = new XmlSerializer( typeof( TmxMap ) ); var map = (TmxMap)serializer.Deserialize( reader ); var xmlSerializer = new XmlSerializer( typeof( TmxTileset ) ); foreach( var l in map.layers ) context.Logger.LogMessage( "Deserialized Layer: {0}", l ); foreach( var o in map.objectGroups ) context.Logger.LogMessage( "Deserialized ObjectGroup: {0}, object count: {1}", o.name, o.objects.Count ); context.Logger.LogMessage( "" ); for( var i = 0; i < map.tilesets.Count; i++ ) { var tileset = map.tilesets[i]; if( !string.IsNullOrWhiteSpace( tileset.source ) ) { var directoryName = Path.GetDirectoryName( filename ); var tilesetLocation = tileset.source.Replace( '/', Path.DirectorySeparatorChar ); var filePath = Path.Combine( directoryName, tilesetLocation ); var normExtTilesetPath = new DirectoryInfo( filePath ).FullName; context.Logger.LogMessage( "Reading External Tileset File: " + normExtTilesetPath ); using( var file = new StreamReader( filePath ) ) { map.tilesets[i] = (TmxTileset)xmlSerializer.Deserialize( file ); map.tilesets[i].fixImagePath( filename, tileset.source ); map.tilesets[i].firstGid = tileset.firstGid; } } else { tileset.mapFolder = Path.GetDirectoryName( Path.GetFullPath( filename ) ); } } return map; } } } }
using System; using System.IO; using System.Xml.Serialization; using Microsoft.Xna.Framework.Content.Pipeline; namespace Nez.TiledMaps { [ContentImporter( ".tmx", DefaultProcessor = "TiledMapProcessor", DisplayName = "Tiled Map Importer" )] public class TiledMapImporter : ContentImporter<TmxMap> { public override TmxMap Import( string filename, ContentImporterContext context ) { if( filename == null ) throw new ArgumentNullException( nameof( filename ) ); using( var reader = new StreamReader( filename ) ) { context.Logger.LogMessage( "Deserializing filename: {0}", filename ); var serializer = new XmlSerializer( typeof( TmxMap ) ); var map = (TmxMap)serializer.Deserialize( reader ); var xmlSerializer = new XmlSerializer( typeof( TmxTileset ) ); foreach( var l in map.layers ) context.Logger.LogMessage( "Deserialized Layer: {0}", l ); foreach( var o in map.objectGroups ) context.Logger.LogMessage( "Deserialized ObjectGroup: {0}, object count: {1}", o.name, o.objects.Count ); context.Logger.LogMessage( "" ); for( var i = 0; i < map.tilesets.Count; i++ ) { var tileset = map.tilesets[i]; if( !string.IsNullOrWhiteSpace( tileset.source ) ) { var directoryName = Path.GetDirectoryName( filename ); var tilesetLocation = tileset.source.Replace( '/', Path.DirectorySeparatorChar ); var filePath = Path.Combine( directoryName, tilesetLocation ); var normExtTilesetPath = new DirectoryInfo( filePath ).FullName; context.Logger.LogMessage( "Reading External Tileset File: " + normExtTilesetPath ); using( var file = new StreaReader( filePath ) ) { map.tilesets[i] = (TmxTileset)xmlSerializer.Deserialize( file ); map.tilesets[i].fixImagePath( filename, tileset.source ); map.tilesets[i].firstGid = tileset.firstGid; } } else { tileset.mapFolder = Path.GetDirectoryName( Path.GetFullPath( filename ) ); } } return map; } } } }
mit
C#
5a02e477bfc0f52a9fb273faaa3b574517999aee
Create temp directories in temp folder
BenPhegan/NuGet.Extensions
NuGet.Extensions.Tests/TestData/Isolation.cs
NuGet.Extensions.Tests/TestData/Isolation.cs
using System.IO; namespace NuGet.Extensions.Tests.TestData { public class Isolation { public static DirectoryInfo GetIsolatedTestSolutionDir() { var solutionDir = new DirectoryInfo(GetRandomTempDirectoryPath()); CopyFilesRecursively(new DirectoryInfo(Paths.TestSolutionForAdapterFolder), solutionDir); return solutionDir; } private static string GetRandomTempDirectoryPath() { return Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); } public static DirectoryInfo GetIsolatedPackageSourceFromThisSolution() { var packageSource = new DirectoryInfo(GetRandomTempDirectoryPath()); CopyFilesRecursively(new DirectoryInfo("../packages"), packageSource); return packageSource; } public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) { if (!target.Exists) target.Create(); foreach (DirectoryInfo dir in source.GetDirectories()) CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name)); foreach (FileInfo file in source.GetFiles()) file.CopyTo(Path.Combine(target.FullName, file.Name)); } } }
using System.IO; namespace NuGet.Extensions.Tests.TestData { public class Isolation { public static DirectoryInfo GetIsolatedTestSolutionDir() { var solutionDir = new DirectoryInfo(Path.GetRandomFileName()); CopyFilesRecursively(new DirectoryInfo(Paths.TestSolutionForAdapterFolder), solutionDir); return solutionDir; } public static DirectoryInfo GetIsolatedPackageSourceFromThisSolution() { var packageSource = new DirectoryInfo(Path.GetRandomFileName()); CopyFilesRecursively(new DirectoryInfo("../packages"), packageSource); return packageSource; } public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) { if (!target.Exists) target.Create(); foreach (DirectoryInfo dir in source.GetDirectories()) CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name)); foreach (FileInfo file in source.GetFiles()) file.CopyTo(Path.Combine(target.FullName, file.Name)); } } }
mit
C#
16219ef84137fc2a3c5ecc7429b2d045f587a1f6
fix DbContext creation
rfavillejr/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2,kjnilsson/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2,kjnilsson/Thinktecture.IdentityServer.v2,rfavillejr/Thinktecture.IdentityServer.v2,rfavillejr/Thinktecture.IdentityServer.v2,kjnilsson/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2
src/Libraries/Thinktecture.IdentityServer.Core.Repositories/IdentityServerConfigurationContext.cs
src/Libraries/Thinktecture.IdentityServer.Core.Repositories/IdentityServerConfigurationContext.cs
/* * Copyright (c) Dominick Baier. All rights reserved. * see license.txt */ using System; using System.Configuration; using System.Data.Common; using System.Data.Entity; using System.Data.Entity.ModelConfiguration.Conventions; using Thinktecture.IdentityServer.Repositories.Sql.Configuration; namespace Thinktecture.IdentityServer.Repositories.Sql { public class IdentityServerConfigurationContext : DbContext { public DbSet<GlobalConfiguration> GlobalConfiguration { get; set; } public DbSet<WSFederationConfiguration> WSFederation { get; set; } public DbSet<KeyMaterialConfiguration> Keys { get; set; } public DbSet<WSTrustConfiguration> WSTrust { get; set; } public DbSet<FederationMetadataConfiguration> FederationMetadata { get; set; } public DbSet<OAuth2Configuration> OAuth2 { get; set; } public DbSet<SimpleHttpConfiguration> SimpleHttp { get; set; } public DbSet<DiagnosticsConfiguration> Diagnostics { get; set; } public DbSet<ClientCertificates> ClientCertificates { get; set; } public DbSet<Delegation> Delegation { get; set; } public DbSet<RelyingParties> RelyingParties { get; set; } public DbSet<IdentityProvider> IdentityProviders { get; set; } public DbSet<Client> Clients { get; set; } public DbSet<CodeToken> CodeTokens { get; set; } public static Func<IdentityServerConfigurationContext> FactoryMethod { get; set; } public IdentityServerConfigurationContext() : base("name=IdentityServerConfiguration") { } public IdentityServerConfigurationContext(DbConnection conn) : base(conn, true) { } public IdentityServerConfigurationContext(IDatabaseInitializer<IdentityServerConfigurationContext> initializer) { Database.SetInitializer(initializer); } public static IdentityServerConfigurationContext Get() { if (FactoryMethod != null) return FactoryMethod(); return new IdentityServerConfigurationContext(); } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Conventions.Remove<PluralizingTableNameConvention>(); base.OnModelCreating(modelBuilder); } } }
/* * Copyright (c) Dominick Baier. All rights reserved. * see license.txt */ using System; using System.Configuration; using System.Data.Common; using System.Data.Entity; using System.Data.Entity.ModelConfiguration.Conventions; using Thinktecture.IdentityServer.Repositories.Sql.Configuration; namespace Thinktecture.IdentityServer.Repositories.Sql { public class IdentityServerConfigurationContext : DbContext { public DbSet<GlobalConfiguration> GlobalConfiguration { get; set; } public DbSet<WSFederationConfiguration> WSFederation { get; set; } public DbSet<KeyMaterialConfiguration> Keys { get; set; } public DbSet<WSTrustConfiguration> WSTrust { get; set; } public DbSet<FederationMetadataConfiguration> FederationMetadata { get; set; } public DbSet<OAuth2Configuration> OAuth2 { get; set; } public DbSet<SimpleHttpConfiguration> SimpleHttp { get; set; } public DbSet<DiagnosticsConfiguration> Diagnostics { get; set; } public DbSet<ClientCertificates> ClientCertificates { get; set; } public DbSet<Delegation> Delegation { get; set; } public DbSet<RelyingParties> RelyingParties { get; set; } public DbSet<IdentityProvider> IdentityProviders { get; set; } public DbSet<Client> Clients { get; set; } public DbSet<CodeToken> CodeTokens { get; set; } public static Func<IdentityServerConfigurationContext> FactoryMethod { get; set; } public IdentityServerConfigurationContext() : base("name=IdentityServerConfiguration") { } public IdentityServerConfigurationContext(DbConnection conn) : base(conn, true) { } public IdentityServerConfigurationContext(IDatabaseInitializer<IdentityServerConfigurationContext> initializer) { Database.SetInitializer(initializer); } public static IdentityServerConfigurationContext Get() { if (FactoryMethod != null) return FactoryMethod(); var cs = ConfigurationManager.ConnectionStrings["IdentityServerConfiguration"].ConnectionString; var conn = Database.DefaultConnectionFactory.CreateConnection(cs); return new IdentityServerConfigurationContext(conn); } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Conventions.Remove<PluralizingTableNameConvention>(); base.OnModelCreating(modelBuilder); } } }
bsd-3-clause
C#
0d9554647ac05f5a913c27b0f8da66d7a664daaf
fix examples
acple/ParsecSharp
ParsecSharp.Examples/ReversePolishCalculator.cs
ParsecSharp.Examples/ReversePolishCalculator.cs
using System; using System.Linq; using static ParsecSharp.Parser; using static ParsecSharp.Text; namespace ParsecSharp.Examples { // 逆ポーランド記法の式をパーサで計算してみるネタ public static class ReversePolishCalculator { // 整数または小数にマッチし、double にして返す private static readonly Parser<char, double> Num = Optional(Char('-') | Char('+'), '+') .Append(Many1(DecDigit())) .Append(Optional(Char('.').Append(Many1(DecDigit())), Enumerable.Empty<char>())) .ToDouble(); // 四則演算子にマッチし、二項演算関数にマップ private static readonly Parser<char, Func<double, double, double>> Op = Choice( Char('+').Map(_ => (Func<double, double, double>)((x, y) => x + y)), Char('-').Map(_ => (Func<double, double, double>)((x, y) => x - y)), Char('*').Map(_ => (Func<double, double, double>)((x, y) => x * y)), Char('/').Map(_ => (Func<double, double, double>)((x, y) => x / y))); // 各要素間のデリミタ、今回は一文字空白にハードコード private static readonly Parser<char, Unit> Delimiter = WhiteSpace().Ignore(); // 式を表す再帰実行パーサ // 左再帰の定義: expr = expr expr op / num // 左再帰の除去: expr = num *( expr op ) private static readonly Parser<char, double> Expr = Num.Chain(x => from _ in Delimiter from y in Expr from __ in Delimiter from func in Op select func(x, y)); // パーサの実行 public static Result<char, double> Parse(string source) => Expr.End().Parse(source); } }
using System; using System.Linq; using static ParsecSharp.Parser; using static ParsecSharp.Text; namespace ParsecSharp.Examples { // 逆ポーランド記法の式をパーサで計算してみるネタ public static class ReversePolishCalculator { // 整数または小数にマッチし、double にして返す private static readonly Parser<char, double> num = Optional(Char('-'), '+') .Append(Many1(DecDigit())) .Append(Optional(Char('.').Append(Many1(DecDigit())), Enumerable.Empty<char>())) .AsString().Map(double.Parse); // 四則演算子にマッチし、二項演算関数にマップ private static readonly Parser<char, Func<double, double, double>> op = Choice( Char('+').Map(_ => (Func<double, double, double>)((x, y) => x + y)), Char('-').Map(_ => (Func<double, double, double>)((x, y) => x - y)), Char('*').Map(_ => (Func<double, double, double>)((x, y) => x * y)), Char('/').Map(_ => (Func<double, double, double>)((x, y) => x / y))); // 各要素間のデリミタ、今回は一文字空白にハードコード private static readonly Parser<char, Unit> delimiter = WhiteSpace().Ignore(); // 式を表す再帰実行パーサ // 左再帰の定義: expr = expr expr op / num // 左再帰の除去: expr = num *( expr op ) private static readonly Parser<char, double> expr = num.Chain(x => from _ in delimiter from y in expr from __ in delimiter from func in op select func(x, y)); // パーサの実行 public static Result<char, double> Parse(string source) => expr.End().Parse(source); } }
mit
C#
5dca357ffc4aded5a1f67d00e4864fdb7a65ec58
Remove duplicate config
joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
JoinRpg.Portal/Helpers/ApiSecretsStorage.cs
JoinRpg.Portal/Helpers/ApiSecretsStorage.cs
using System.Configuration; using JetBrains.Annotations; namespace JoinRpg.Portal.Helpers { [UsedImplicitly] internal class ApiSecretsStorage { internal static string GoogleClientId => ConfigurationManager.AppSettings["GoogleClientId"]; internal static string GoogleClientSecret => ConfigurationManager.AppSettings["GoogleClientSecret"]; internal static string VkClientId => ConfigurationManager.AppSettings["VkClientId"]; internal static string VkClientSecret => ConfigurationManager.AppSettings["VkClientSecret"]; internal static string XsrfKey => ConfigurationManager.AppSettings["XsrfKey"]; } }
using System.Configuration; using JetBrains.Annotations; using JoinRpg.Dal.Impl; using JoinRpg.Services.Interfaces; namespace JoinRpg.Portal.Helpers { [UsedImplicitly] internal class ApiSecretsStorage : IMailGunConfig, IJoinDbContextConfiguration { public string ApiDomain => ConfigurationManager.AppSettings["MailGunApiDomain"]; string IMailGunConfig.ApiKey => ConfigurationManager.AppSettings["MailGunApiKey"]; public string ServiceEmail => "support@" + ApiDomain; internal static string GoogleClientId => ConfigurationManager.AppSettings["GoogleClientId"]; internal static string GoogleClientSecret => ConfigurationManager.AppSettings["GoogleClientSecret"]; internal static string VkClientId => ConfigurationManager.AppSettings["VkClientId"]; internal static string VkClientSecret => ConfigurationManager.AppSettings["VkClientSecret"]; internal static string XsrfKey => ConfigurationManager.AppSettings["XsrfKey"]; string IJoinDbContextConfiguration.ConnectionString => ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; } }
mit
C#
37ef42a633586abc13e43bdad74731b25ad55742
Add RemainingTime and env vars to dotnetcore2.0 example
lambci/docker-lambda,lambci/docker-lambda,lambci/docker-lambda,lambci/docker-lambda,lambci/docker-lambda,lambci/docker-lambda,lambci/docker-lambda
examples/dotnetcore2.0/Function.cs
examples/dotnetcore2.0/Function.cs
// Compile with: // docker run --rm -v "$PWD":/var/task lambci/lambda:build-dotnetcore2.0 dotnet publish -c Release -o pub // Run with: // docker run --rm -v "$PWD"/pub:/var/task lambci/lambda:dotnetcore2.0 test::test.Function::FunctionHandler "some" using System; using System.Collections; using Amazon.Lambda.Core; [assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] namespace test { public class Function { public string FunctionHandler(object inputEvent, ILambdaContext context) { context.Logger.Log($"inputEvent: {inputEvent}"); LambdaLogger.Log($"RemainingTime: {context.RemainingTime}"); foreach (DictionaryEntry kv in Environment.GetEnvironmentVariables()) { context.Logger.Log($"{kv.Key}={kv.Value}"); } return "Hello World!"; } } }
// Compile with: // docker run --rm -v "$PWD":/var/task lambci/lambda:build-dotnetcore2.0 dotnet publish -c Release -o pub // Run with: // docker run --rm -v "$PWD"/pub:/var/task lambci/lambda:dotnetcore2.0 test::test.Function::FunctionHandler "some" using Amazon.Lambda.Core; [assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] namespace test { public class Function { public string FunctionHandler(object inputEvent, ILambdaContext context) { context.Logger.Log($"inputEvent: {inputEvent}"); return "Hello World!"; } } }
mit
C#
c7ae1825dd9e87dee13418e983bb546dbcfe51a9
Fix for new Boo assemblies.
ayende/rhino-dsl
Rhino.DSL.Tests/OrderDSL/BaseOrderActionsDSL.cs
Rhino.DSL.Tests/OrderDSL/BaseOrderActionsDSL.cs
namespace Rhino.DSL.Tests.OrderDSL { using System.Collections; using System.Collections.Specialized; using Boo.Lang; using Boo.Lang.Compiler.Ast; public abstract class BaseOrderActionsDSL { public delegate bool Condition(); public delegate void Action(); protected OrderedDictionary conditionsAndActions = new OrderedDictionary(); public User User; public Order Order; public decimal discountPrecentage; public bool shouldSuggestUpgradeToPreferred; public bool shouldApplyFreeShipping; protected void addDiscountPrecentage(decimal precentage) { this.discountPrecentage = precentage; } protected void suggestUpgradeToPreferred() { shouldSuggestUpgradeToPreferred = true; } protected void applyFreeShipping() { shouldApplyFreeShipping = true; } [Meta] public static Expression when(Expression expression, Expression action) { BlockExpression condition = new BlockExpression(); condition.Body.Add(new ReturnStatement(expression)); return new MethodInvocationExpression( new ReferenceExpression("When"), condition, action ); } protected void When(Condition condition, Action action) { conditionsAndActions[condition] = action; } public abstract void Prepare(); public void Execute() { foreach (DictionaryEntry entry in conditionsAndActions) { Condition condition = (Condition) entry.Key; if(condition()) { Action action = (Action) entry.Value; action(); break; } } } } }
namespace Rhino.DSL.Tests.OrderDSL { using System.Collections; using System.Collections.Specialized; using Boo.Lang.Compiler.Ast; using Boo.Lang.Compiler.MetaProgramming; public abstract class BaseOrderActionsDSL { public delegate bool Condition(); public delegate void Action(); protected OrderedDictionary conditionsAndActions = new OrderedDictionary(); public User User; public Order Order; public decimal discountPrecentage; public bool shouldSuggestUpgradeToPreferred; public bool shouldApplyFreeShipping; protected void addDiscountPrecentage(decimal precentage) { this.discountPrecentage = precentage; } protected void suggestUpgradeToPreferred() { shouldSuggestUpgradeToPreferred = true; } protected void applyFreeShipping() { shouldApplyFreeShipping = true; } [Meta] public static Expression when(Expression expression, Expression action) { BlockExpression condition = new BlockExpression(); condition.Body.Add(new ReturnStatement(expression)); return new MethodInvocationExpression( new ReferenceExpression("When"), condition, action ); } protected void When(Condition condition, Action action) { conditionsAndActions[condition] = action; } public abstract void Prepare(); public void Execute() { foreach (DictionaryEntry entry in conditionsAndActions) { Condition condition = (Condition) entry.Key; if(condition()) { Action action = (Action) entry.Value; action(); break; } } } } }
bsd-3-clause
C#
64cb282734dcc729dff0ac6c7bcbb1738ea26ea3
comment out ProfilerFilterAttribute for now
AlejandroCano/framework,avifatal/framework,signumsoftware/framework,avifatal/framework,AlejandroCano/framework,signumsoftware/framework
Signum.React/Filters/ProfilerFilterAttribute.cs
Signum.React/Filters/ProfilerFilterAttribute.cs
using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Filters; using Signum.Utilities; using Signum.Utilities.ExpressionTrees; using System; using System.Linq; namespace Signum.React.Filters { [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] public class ProfilerActionSplitterAttribute : Attribute { readonly string? requestKey; public ProfilerActionSplitterAttribute(string? requestKey = null) { this.requestKey = requestKey; } public string? RequestKey { get { return requestKey; } } public static string GetActionDescription(FilterContext actionContext) { var cad = (ControllerActionDescriptor)actionContext.ActionDescriptor; var action = cad.ControllerName + "." + cad.ActionName; //var attr = cad.MethodInfo.GetCustomAttributes(true).OfType<ProfilerActionSplitterAttribute>().FirstOrDefault(); //if (attr != null) //{ // var obj = attr.RequestKey == null ? null : actionContext.ActionDescriptor.RouteValues.GetOrThrow(attr.RequestKey, "Argument '{0}' not found in: " + cad.MethodInfo.MethodSignature()); // if (obj != null) // action += " " + obj.ToString(); //} return action; } } }
using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Filters; using Signum.Utilities; using Signum.Utilities.ExpressionTrees; using System; using System.Linq; namespace Signum.React.Filters { [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] public class ProfilerActionSplitterAttribute : Attribute { readonly string? requestKey; public ProfilerActionSplitterAttribute(string? requestKey = null) { this.requestKey = requestKey; } public string? RequestKey { get { return requestKey; } } public static string GetActionDescription(FilterContext actionContext) { var cad = (ControllerActionDescriptor)actionContext.ActionDescriptor; var action = cad.ControllerName + "." + cad.ActionName; var attr = cad.MethodInfo.GetCustomAttributes(true).OfType<ProfilerActionSplitterAttribute>().FirstOrDefault(); if (attr != null) { var obj = attr.RequestKey == null ? null : actionContext.ActionDescriptor.RouteValues.GetOrThrow(attr.RequestKey, "Argument '{0}' not found in: " + cad.MethodInfo.MethodSignature()); if (obj != null) action += " " + obj.ToString(); } return action; } } }
mit
C#
148be8c4107aed0e2082c2a63b52bb6e1b7ed136
Remove use of SqlServerDatabase!
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
samples/IdentitySample.Mvc/Models/SampleData.cs
samples/IdentitySample.Mvc/Models/SampleData.cs
using System; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity.SqlServer; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.OptionsModel; namespace IdentitySample.Models { public static class SampleData { public static async Task InitializeIdentityDatabaseAsync(IServiceProvider serviceProvider) { using (var db = serviceProvider.GetRequiredService<ApplicationDbContext>()) { if (await db.Database.EnsureCreatedAsync()) { await CreateAdminUser(serviceProvider); } } } /// <summary> /// Creates a store manager user who can manage the inventory. /// </summary> /// <param name="serviceProvider"></param> /// <returns></returns> private static async Task CreateAdminUser(IServiceProvider serviceProvider) { var options = serviceProvider.GetRequiredService<IOptions<IdentityDbContextOptions>>().Options; const string adminRole = "Administrator"; var userManager = serviceProvider.GetRequiredService<UserManager<ApplicationUser>>(); var roleManager = serviceProvider.GetRequiredService<RoleManager<IdentityRole>>(); if (!await roleManager.RoleExistsAsync(adminRole)) { await roleManager.CreateAsync(new IdentityRole(adminRole)); } var user = await userManager.FindByNameAsync(options.DefaultAdminUserName); if (user == null) { user = new ApplicationUser { UserName = options.DefaultAdminUserName }; await userManager.CreateAsync(user, options.DefaultAdminPassword); await userManager.AddToRoleAsync(user, adminRole); await userManager.AddClaimAsync(user, new Claim("ManageStore", "Allowed")); } } } }
using System; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity.SqlServer; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.OptionsModel; namespace IdentitySample.Models { public static class SampleData { public static async Task InitializeIdentityDatabaseAsync(IServiceProvider serviceProvider) { using (var db = serviceProvider.GetRequiredService<ApplicationDbContext>()) { var sqlServerDatabase = db.Database as SqlServerDatabase; if (sqlServerDatabase != null) { if (await sqlServerDatabase.EnsureCreatedAsync()) { await CreateAdminUser(serviceProvider); } } else { await CreateAdminUser(serviceProvider); } } } /// <summary> /// Creates a store manager user who can manage the inventory. /// </summary> /// <param name="serviceProvider"></param> /// <returns></returns> private static async Task CreateAdminUser(IServiceProvider serviceProvider) { var options = serviceProvider.GetRequiredService<IOptions<IdentityDbContextOptions>>().Options; const string adminRole = "Administrator"; var userManager = serviceProvider.GetRequiredService<UserManager<ApplicationUser>>(); var roleManager = serviceProvider.GetRequiredService<RoleManager<IdentityRole>>(); if (!await roleManager.RoleExistsAsync(adminRole)) { await roleManager.CreateAsync(new IdentityRole(adminRole)); } var user = await userManager.FindByNameAsync(options.DefaultAdminUserName); if (user == null) { user = new ApplicationUser { UserName = options.DefaultAdminUserName }; await userManager.CreateAsync(user, options.DefaultAdminPassword); await userManager.AddToRoleAsync(user, adminRole); await userManager.AddClaimAsync(user, new Claim("ManageStore", "Allowed")); } } } }
apache-2.0
C#
5afbb1eb5a6cbe915d510a2979bf58473f805127
add canonical link
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
src/FilterLists.Web/Views/Shared/_Layout.cshtml
src/FilterLists.Web/Views/Shared/_Layout.cshtml
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>FilterLists | @ViewData["Title"]</title> <base href="~/"/> <meta name="description" content="FilterLists is the independent, comprehensive directory of filter and host lists for advertisements, trackers, malware, and annoyances. By Collin M. Barrett."/> <link rel="icon" type="image/png" href="icon_filterlists.png"> <link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true"/> <link rel="canonical" href="https://filterlists.com/"> <environment exclude="Development"> <link rel="stylesheet" href="~/dist/site.css" asp-append-version="true"/> </environment> </head> <body> @RenderBody() <script src="~/dist/vendor.js" asp-append-version="true"></script> @RenderSection("scripts", false) <noscript> <p>FilterLists is built with ReactJS and therefore requires first-party JavaScript to be enabled. We do not use any third-party JavaScript, and your privacy is very important to us. If you prefer not to enable JavaScript or your browser does not support it, the data is largely available on <a href="https://github.com/collinbarrett/FilterLists">our GitHub repo</a>.</p> </noscript> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>FilterLists | @ViewData["Title"]</title> <base href="~/"/> <meta name="description" content="FilterLists is the independent, comprehensive directory of filter and host lists for advertisements, trackers, malware, and annoyances. By Collin M. Barrett."/> <link rel="icon" type="image/png" href="icon_filterlists.png"> <link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true"/> <environment exclude="Development"> <link rel="stylesheet" href="~/dist/site.css" asp-append-version="true"/> </environment> </head> <body> @RenderBody() <script src="~/dist/vendor.js" asp-append-version="true"></script> @RenderSection("scripts", false) <noscript> <p>FilterLists is built with ReactJS and therefore requires first-party JavaScript to be enabled. We do not use any third-party JavaScript, and your privacy is very important to us. If you prefer not to enable JavaScript or your browser does not support it, the data is largely available on <a href="https://github.com/collinbarrett/FilterLists">our GitHub repo</a>.</p> </noscript> </body> </html>
mit
C#
0c4cd6fde5d5b7c11a8a92f1d9db95efe4d28089
fix VersionFilterAttribute for the exception case
avifatal/framework,AlejandroCano/framework,signumsoftware/framework,signumsoftware/framework,avifatal/framework,AlejandroCano/framework
Signum.React/Filters/VersionFilterAttribute.cs
Signum.React/Filters/VersionFilterAttribute.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net.Http.Headers; using System.Reflection; using System.Threading; using System.Threading.Tasks; using System.Web; using System.Web.Http.Controllers; using System.Web.Http.Filters; namespace Signum.React.Filters { public class VersionFilterAttribute : ActionFilterAttribute { //In Global.asax: VersionFilterAttribute.CurrentVersion = CustomAssembly.GetName().Version.ToString() public static string CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); public override void OnActionExecuted(HttpActionExecutedContext actionContext) { base.OnActionExecuted(actionContext); if (actionContext.Response != null) actionContext.Response.Headers.Add("X-App-Version", CurrentVersion); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net.Http.Headers; using System.Reflection; using System.Threading; using System.Threading.Tasks; using System.Web; using System.Web.Http.Controllers; using System.Web.Http.Filters; namespace Signum.React.Filters { public class VersionFilterAttribute : ActionFilterAttribute { //In Global.asax: VersionFilterAttribute.CurrentVersion = CustomAssembly.GetName().Version.ToString() public static string CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); public override void OnActionExecuted(HttpActionExecutedContext actionContext) { base.OnActionExecuted(actionContext); SetHeader(actionContext.Response.Headers); } private void SetHeader(HttpResponseHeaders headers) { if (!headers.Contains("X-App-Version")) headers.Add("X-App-Version", CurrentVersion); } public override async Task OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken) { await base.OnActionExecutedAsync(actionExecutedContext, cancellationToken); SetHeader(actionExecutedContext.Response.Headers); } } }
mit
C#
8fd418ffc1fb9f64c74399b7622493d81a791126
Add default ApplicationConfigurationException constructor
appharbor/appharbor-cli
src/AppHarbor/ApplicationConfigurationException.cs
src/AppHarbor/ApplicationConfigurationException.cs
using System; namespace AppHarbor { public class ApplicationConfigurationException : Exception { public ApplicationConfigurationException() { } public ApplicationConfigurationException(string message) : base(message) { } } }
using System; namespace AppHarbor { public class ApplicationConfigurationException : Exception { public ApplicationConfigurationException(string message) : base(message) { } } }
mit
C#
358f7a587b6885386d68253bfeee3234338aae65
Update PopupAction.cs
wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors,XamlBehaviors/XamlBehaviors,XamlBehaviors/XamlBehaviors
src/Avalonia.Xaml.Interactions/Core/PopupAction.cs
src/Avalonia.Xaml.Interactions/Core/PopupAction.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Metadata; using Avalonia.Xaml.Interactivity; namespace Avalonia.Xaml.Interactions.Core { /// <summary> /// An action that displays a Popup for the associated control when executed. /// </summary> /// <remarks>If the associated control is of type IControl than popup inherits control DataContext.</remarks> public sealed class PopupAction : AvaloniaObject, IAction { private Popup _popup = null; /// <summary> /// Identifies the <seealso cref="ChildProperty"/> avalonia property. /// </summary> public static readonly AvaloniaProperty<Control> ChildProperty = AvaloniaProperty.Register<PopupAction, Control>(nameof(Child)); /// <summary> /// Gets or sets the popup Child control. This is a avalonia property. /// </summary> [Content] public Control Child { get { return this.GetValue(ChildProperty); } set { this.SetValue(ChildProperty, value); } } /// <inheritdoc/> public object Execute(object sender, object parameter) { if (_popup == null) { _popup = new Popup() { PlacementMode = PlacementMode.Pointer, PlacementTarget = sender as Control, StaysOpen = false }; var control = sender as IControl; if (control != null) { BindToDataContext(control, _popup); } } _popup.Child = Child; _popup.Open(); return null; } private static void BindToDataContext(IControl source, IControl target) { if (source == null) throw new ArgumentNullException(nameof(source)); if (target == null) throw new ArgumentNullException(nameof(target)); var data = source.GetObservable(Control.DataContextProperty); if (data != null) { target.Bind(Control.DataContextProperty, data); } } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Metadata; using Avalonia.Xaml.Interactivity; namespace Avalonia.Xaml.Interactions.Core { public sealed class PopupAction : AvaloniaObject, IAction { public static readonly AvaloniaProperty<Control> ChildProperty = AvaloniaProperty.Register<PopupAction, Control>(nameof(Child)); [Content] public Control Child { get { return this.GetValue(ChildProperty); } set { this.SetValue(ChildProperty, value); } } private Popup _popup = null; public object Execute(object sender, object parameter) { if (_popup == null) { _popup = new Popup() { PlacementMode = PlacementMode.Pointer, PlacementTarget = sender as Control, StaysOpen = false }; var control = sender as IControl; if (control != null) { BindToDataContext(control, _popup); } } _popup.Child = Child; _popup.Open(); return null; } private static void BindToDataContext(IControl source, IControl target) { if (source == null) throw new ArgumentNullException(nameof(source)); if (target == null) throw new ArgumentNullException(nameof(target)); var data = source.GetObservable(Control.DataContextProperty); if (data != null) { target.Bind(Control.DataContextProperty, data); } } } }
mit
C#
893708a4c46047af6fb14bc0f2c33b3ca6adc527
Fix faulty assert in Utilities.SelectBucketIndex (dotnet/coreclr#17863)
mmitche/corefx,ericstj/corefx,Jiayili1/corefx,ViktorHofer/corefx,Jiayili1/corefx,Jiayili1/corefx,ericstj/corefx,ericstj/corefx,Jiayili1/corefx,Jiayili1/corefx,ViktorHofer/corefx,shimingsg/corefx,ViktorHofer/corefx,shimingsg/corefx,ViktorHofer/corefx,mmitche/corefx,ericstj/corefx,mmitche/corefx,ptoonen/corefx,ptoonen/corefx,ViktorHofer/corefx,ptoonen/corefx,ptoonen/corefx,shimingsg/corefx,shimingsg/corefx,shimingsg/corefx,wtgodbe/corefx,mmitche/corefx,Jiayili1/corefx,wtgodbe/corefx,Jiayili1/corefx,BrennanConroy/corefx,BrennanConroy/corefx,wtgodbe/corefx,mmitche/corefx,shimingsg/corefx,shimingsg/corefx,mmitche/corefx,wtgodbe/corefx,ericstj/corefx,ptoonen/corefx,ptoonen/corefx,mmitche/corefx,BrennanConroy/corefx,ptoonen/corefx,ericstj/corefx,wtgodbe/corefx,ericstj/corefx,wtgodbe/corefx,ViktorHofer/corefx,wtgodbe/corefx,ViktorHofer/corefx
src/Common/src/CoreLib/System/Buffers/Utilities.cs
src/Common/src/CoreLib/System/Buffers/Utilities.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; using System.Runtime.CompilerServices; namespace System.Buffers { internal static class Utilities { [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static int SelectBucketIndex(int bufferSize) { Debug.Assert(bufferSize >= 0); uint bitsRemaining = ((uint)bufferSize - 1) >> 4; int poolIndex = 0; if (bitsRemaining > 0xFFFF) { bitsRemaining >>= 16; poolIndex = 16; } if (bitsRemaining > 0xFF) { bitsRemaining >>= 8; poolIndex += 8; } if (bitsRemaining > 0xF) { bitsRemaining >>= 4; poolIndex += 4; } if (bitsRemaining > 0x3) { bitsRemaining >>= 2; poolIndex += 2; } if (bitsRemaining > 0x1) { bitsRemaining >>= 1; poolIndex += 1; } return poolIndex + (int)bitsRemaining; } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static int GetMaxSizeForBucket(int binIndex) { int maxSize = 16 << binIndex; Debug.Assert(maxSize >= 0); return maxSize; } } }
// 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; using System.Runtime.CompilerServices; namespace System.Buffers { internal static class Utilities { [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static int SelectBucketIndex(int bufferSize) { Debug.Assert(bufferSize > 0); uint bitsRemaining = ((uint)bufferSize - 1) >> 4; int poolIndex = 0; if (bitsRemaining > 0xFFFF) { bitsRemaining >>= 16; poolIndex = 16; } if (bitsRemaining > 0xFF) { bitsRemaining >>= 8; poolIndex += 8; } if (bitsRemaining > 0xF) { bitsRemaining >>= 4; poolIndex += 4; } if (bitsRemaining > 0x3) { bitsRemaining >>= 2; poolIndex += 2; } if (bitsRemaining > 0x1) { bitsRemaining >>= 1; poolIndex += 1; } return poolIndex + (int)bitsRemaining; } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static int GetMaxSizeForBucket(int binIndex) { int maxSize = 16 << binIndex; Debug.Assert(maxSize >= 0); return maxSize; } } }
mit
C#
a9863b8951e330af7689211a0507c4b5f6ad735f
Remove extra using declaration.
mohtamohit/CppSharp,inordertotest/CppSharp,nalkaro/CppSharp,xistoso/CppSharp,inordertotest/CppSharp,SonyaSa/CppSharp,zillemarco/CppSharp,txdv/CppSharp,inordertotest/CppSharp,u255436/CppSharp,Samana/CppSharp,KonajuGames/CppSharp,ddobrev/CppSharp,ddobrev/CppSharp,genuinelucifer/CppSharp,zillemarco/CppSharp,mydogisbox/CppSharp,zillemarco/CppSharp,u255436/CppSharp,xistoso/CppSharp,mohtamohit/CppSharp,u255436/CppSharp,genuinelucifer/CppSharp,mono/CppSharp,inordertotest/CppSharp,u255436/CppSharp,mono/CppSharp,imazen/CppSharp,mono/CppSharp,ktopouzi/CppSharp,Samana/CppSharp,ktopouzi/CppSharp,mono/CppSharp,mydogisbox/CppSharp,imazen/CppSharp,KonajuGames/CppSharp,nalkaro/CppSharp,ktopouzi/CppSharp,xistoso/CppSharp,nalkaro/CppSharp,Samana/CppSharp,SonyaSa/CppSharp,genuinelucifer/CppSharp,mono/CppSharp,txdv/CppSharp,imazen/CppSharp,KonajuGames/CppSharp,mono/CppSharp,Samana/CppSharp,Samana/CppSharp,zillemarco/CppSharp,txdv/CppSharp,u255436/CppSharp,ktopouzi/CppSharp,inordertotest/CppSharp,SonyaSa/CppSharp,ktopouzi/CppSharp,xistoso/CppSharp,genuinelucifer/CppSharp,zillemarco/CppSharp,mydogisbox/CppSharp,SonyaSa/CppSharp,nalkaro/CppSharp,mohtamohit/CppSharp,KonajuGames/CppSharp,imazen/CppSharp,ddobrev/CppSharp,nalkaro/CppSharp,mohtamohit/CppSharp,ddobrev/CppSharp,txdv/CppSharp,SonyaSa/CppSharp,KonajuGames/CppSharp,mydogisbox/CppSharp,mohtamohit/CppSharp,mydogisbox/CppSharp,txdv/CppSharp,imazen/CppSharp,genuinelucifer/CppSharp,xistoso/CppSharp,ddobrev/CppSharp
src/Generator/Passes/ResolveIncompleteDeclsPass.cs
src/Generator/Passes/ResolveIncompleteDeclsPass.cs
using System; namespace CppSharp.Passes { public class ResolveIncompleteDeclsPass : TranslationUnitPass { public ResolveIncompleteDeclsPass() { } public override bool VisitClassDecl(Class @class) { if (@class.Ignore) return false; if (!@class.IsIncomplete) goto Out; if (@class.CompleteDeclaration != null) goto Out; @class.CompleteDeclaration = Library.FindCompleteClass( @class.QualifiedName); if (@class.CompleteDeclaration == null) Console.WriteLine("Unresolved declaration: {0}", @class.Name); Out: return base.VisitClassDecl(@class); } } public static class ResolveIncompleteDeclsExtensions { public static void ResolveIncompleteDecls(this PassBuilder builder) { var pass = new ResolveIncompleteDeclsPass(); builder.AddPass(pass); } } }
using System; using CppSharp.Types; namespace CppSharp.Passes { public class ResolveIncompleteDeclsPass : TranslationUnitPass { public ResolveIncompleteDeclsPass() { } public override bool VisitClassDecl(Class @class) { if (@class.Ignore) return false; if (!@class.IsIncomplete) goto Out; if (@class.CompleteDeclaration != null) goto Out; @class.CompleteDeclaration = Library.FindCompleteClass( @class.QualifiedName); if (@class.CompleteDeclaration == null) Console.WriteLine("Unresolved declaration: {0}", @class.Name); Out: return base.VisitClassDecl(@class); } } public static class ResolveIncompleteDeclsExtensions { public static void ResolveIncompleteDecls(this PassBuilder builder) { var pass = new ResolveIncompleteDeclsPass(); builder.AddPass(pass); } } }
mit
C#
63f04116a37db1917497fd836941864c9347db7f
add timeout to spec
Weingartner/SolidworksAddinFramework
SolidworksAddinFramework.Spec/ModelDocSpecs.cs
SolidworksAddinFramework.Spec/ModelDocSpecs.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Concurrency; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using FluentAssertions; using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using Xunit; using XUnit; using XUnit.Solidworks.Addin; using SolidworksAddinFramework.Events; namespace SolidworksAddinFramework.Spec { public class ModelDocSpecs : SolidWorksSpec { /// <summary> /// Interactive test example. /// </summary> /// <returns></returns> [SolidworksFact] public Task CanSelect() { return CreatePartDoc(async doc => { var modeller = (IModeler) SwApp.GetModeler(); var box = modeller.CreateBox(0.1, 0.1, 0.1); var part = (PartDoc) doc; part.CreateFeatureFromBody3(box, false, 0); await doc.SelectionObservable((selectTypeE, mark) => true).FirstAsync().Timeout(TimeSpan.FromSeconds(5)); }); } [Fact] public void MethodGroupConversionAreCached() { Func<int> fn = () => 10; var a = ((Func<int>) fn.Invoke); var b = (Func<int>) fn.Invoke; // This is expected Assert.Equal( true, object.ReferenceEquals(a,a)); // This is not expected ( or I'm not convinced it will always be so ) Assert.Equal(true, a == b); Assert.Equal(true, object.ReferenceEquals(a,b)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Concurrency; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using FluentAssertions; using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using Xunit; using XUnit; using XUnit.Solidworks.Addin; using SolidworksAddinFramework.Events; namespace SolidworksAddinFramework.Spec { public class ModelDocSpecs : SolidWorksSpec { /// <summary> /// Interactive test example. /// </summary> /// <returns></returns> [SolidworksFact] public Task CanSelect() { return CreatePartDoc(async doc => { var modeller = (IModeler) SwApp.GetModeler(); var box = modeller.CreateBox(0.1, 0.1, 0.1); var part = (PartDoc) doc; part.CreateFeatureFromBody3(box, false, 0); await doc.SelectionObservable((selectTypeE, mark) => true).FirstAsync(); }); } [Fact] public void MethodGroupConversionAreCached() { Func<int> fn = () => 10; var a = ((Func<int>) fn.Invoke); var b = (Func<int>) fn.Invoke; // This is expected Assert.Equal( true, object.ReferenceEquals(a,a)); // This is not expected ( or I'm not convinced it will always be so ) Assert.Equal(true, a == b); Assert.Equal(true, object.ReferenceEquals(a,b)); } } }
mit
C#
07f0b651364f4b5400cadb517783c117920e6694
Bump version to 0.9.1.0
github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity,mpOzelot/Unity,mpOzelot/Unity
common/SolutionInfo.cs
common/SolutionInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyProduct("GitHub for Unity")] [assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)] [assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)] [assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)] [assembly: ComVisible(false)] [assembly: AssemblyCompany("GitHub, Inc.")] [assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)] //Required for NSubstitute [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)] //Required for Unity compilation [assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)] namespace System { internal static class AssemblyVersionInformation { internal const string Version = "0.9.1.0"; } }
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyProduct("GitHub for Unity")] [assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)] [assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)] [assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)] [assembly: ComVisible(false)] [assembly: AssemblyCompany("GitHub, Inc.")] [assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)] //Required for NSubstitute [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)] //Required for Unity compilation [assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)] namespace System { internal static class AssemblyVersionInformation { internal const string Version = "0.9.0.0"; } }
mit
C#
28584f8be9d020b931c001a8cf2aaa5eb1045208
fix the build
JeremyKuhne/WInterop,JeremyKuhne/WInterop,JeremyKuhne/WInterop,JeremyKuhne/WInterop
src/Tests/WInterop.Tests/Theming/ThemesTests.cs
src/Tests/WInterop.Tests/Theming/ThemesTests.cs
// Copyright (c) Jeremy W. Kuhne. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using FluentAssertions; using WInterop.Windows; using Xunit; namespace WindowsTests { public class ThemesTests { [Fact] public unsafe void GetCurrentThemeName() { string themeName = Windows.GetCurrentThemeName(); // Name would be something like: C:\WINDOWS\resources\themes\Aero\Aero.msstyles themeName.Length.Should().BeGreaterThan(0); themeName.Should().EndWith(".msstyles"); } } }
// Copyright (c) Jeremy W. Kuhne. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using FluentAssertions; using WInterop.Windows; using Xunit; namespace WindowsTests { public class ThemesTests { [Fact] public unsafe void GetCurrentThemeName() { string themeName = Themes.GetCurrentThemeName(); // Name would be something like: C:\WINDOWS\resources\themes\Aero\Aero.msstyles themeName.Length.Should().BeGreaterThan(0); themeName.Should().EndWith(".msstyles"); } } }
mit
C#
7ed52f44d9cc773350fdbc224b4e013267d831ae
fix type of fallback in MemberAssignBinder
maul-esel/CobaltAHK,maul-esel/CobaltAHK
CobaltAHK/ExpressionTree/MemberAssignBinder.cs
CobaltAHK/ExpressionTree/MemberAssignBinder.cs
using System; using System.Dynamic; #if CustomDLR using Microsoft.Scripting.Ast; #else using System.Linq.Expressions; #endif namespace CobaltAHK.ExpressionTree { public class MemberAssignBinder : SetMemberBinder { public MemberAssignBinder(string member) : base(member, true) { } public override DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion) { if (!target.HasValue || !value.HasValue) { return Defer(target, value); } // todo: special properties like base, builtin obj functions etc. // todo: .NET types return errorSuggestion ?? new DynamicMetaObject( ThrowOnFailure(target.Expression, value.Expression), BindingRestrictions.GetTypeRestriction(target.Expression, target.LimitType)); } private Expression ThrowOnFailure(Expression target, Expression value) { return Expression.Block( Expression.Throw(Expression.New(typeof(InvalidOperationException))), // todo: supply message Generator.NULL ); } } }
using System; using System.Dynamic; #if CustomDLR using Microsoft.Scripting.Ast; #else using System.Linq.Expressions; #endif namespace CobaltAHK.ExpressionTree { public class MemberAssignBinder : SetMemberBinder { public MemberAssignBinder(string member) : base(member, true) { } public override DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion) { if (!target.HasValue || !value.HasValue) { return Defer(target, value); } // todo: special properties like base, builtin obj functions etc. // todo: .NET types return errorSuggestion ?? new DynamicMetaObject( ThrowOnFailure(target.Expression, value.Expression), BindingRestrictions.GetTypeRestriction(target.Expression, target.LimitType)); } private Expression ThrowOnFailure(Expression target, Expression value) { return Expression.Throw(Expression.New(typeof(InvalidOperationException))); // todo: supply message } } }
mit
C#
34166e2977a49453ec7775c959f7b8d09b2efdd5
Add reference links to original material.
countincognito/Zametek.Utility
src/Zametek.Utility/SafeTypes/SafeEnumString.cs
src/Zametek.Utility/SafeTypes/SafeEnumString.cs
using System; namespace Zametek.Utility { /// <summary> /// Based on the following: /// https://docs.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/enumeration-classes-over-enum-types /// https://lostechies.com/jimmybogard/2008/08/12/enumeration-classes/ /// https://stackoverflow.com/questions/630803/associating-enums-with-strings-in-c-sharp /// https://www.meziantou.net/smart-enums-type-safe-enums-in-dotnet.htm /// </summary> public abstract class SafeEnumString<T> : SafeEnumBase<string>, IEquatable<T>, IComparable<T>, IComparable where T : SafeEnumString<T> { public SafeEnumString(string value) : base(value) { if (string.IsNullOrWhiteSpace(value)) { throw new ArgumentNullException(nameof(value)); } } public static implicit operator string(SafeEnumString<T> other) => other?.Value; public virtual bool Equals(T other) => other is null ? false : string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); public override bool Equals(object other) => other is null ? false : string.Equals(Value, other.ToString(), StringComparison.OrdinalIgnoreCase); public static bool operator ==(SafeEnumString<T> left, SafeEnumString<T> right) => left is null ? right is null : left.Equals(right); public static bool operator !=(SafeEnumString<T> left, SafeEnumString<T> right) => left is null ? !(right is null) : !left.Equals(right); public static bool operator <(SafeEnumString<T> left, SafeEnumString<T> right) => left is null ? !(right is null) : left.CompareTo(right) < 0; public static bool operator <=(SafeEnumString<T> left, SafeEnumString<T> right) => left is null || left.CompareTo(right) <= 0; public static bool operator >(SafeEnumString<T> left, SafeEnumString<T> right) => !(left is null) && left.CompareTo(right) > 0; public static bool operator >=(SafeEnumString<T> left, SafeEnumString<T> right) => left is null ? right is null : left.CompareTo(right) >= 0; public virtual int CompareTo(T other) => other is null ? -1 : string.Compare(Value, other.ToString(), StringComparison.OrdinalIgnoreCase); public virtual int CompareTo(object other) => CompareTo(other as T); public override int GetHashCode() => Value.GetHashCode(); public override string ToString() => Value; } }
using System; namespace Zametek.Utility { public abstract class SafeEnumString<T> : SafeEnumBase<string>, IEquatable<T>, IComparable<T>, IComparable where T : SafeEnumString<T> { public SafeEnumString(string value) : base(value) { if (string.IsNullOrWhiteSpace(value)) { throw new ArgumentNullException(nameof(value)); } } public static implicit operator string(SafeEnumString<T> other) => other?.Value; public virtual bool Equals(T other) => other is null ? false : string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); public override bool Equals(object other) => other is null ? false : string.Equals(Value, other.ToString(), StringComparison.OrdinalIgnoreCase); public static bool operator ==(SafeEnumString<T> left, SafeEnumString<T> right) => left is null ? right is null : left.Equals(right); public static bool operator !=(SafeEnumString<T> left, SafeEnumString<T> right) => left is null ? !(right is null) : !left.Equals(right); public static bool operator <(SafeEnumString<T> left, SafeEnumString<T> right) => left is null ? !(right is null) : left.CompareTo(right) < 0; public static bool operator <=(SafeEnumString<T> left, SafeEnumString<T> right) => left is null || left.CompareTo(right) <= 0; public static bool operator >(SafeEnumString<T> left, SafeEnumString<T> right) => !(left is null) && left.CompareTo(right) > 0; public static bool operator >=(SafeEnumString<T> left, SafeEnumString<T> right) => left is null ? right is null : left.CompareTo(right) >= 0; public virtual int CompareTo(T other) => other is null ? -1 : string.Compare(Value, other.ToString(), StringComparison.OrdinalIgnoreCase); public virtual int CompareTo(object other) => CompareTo(other as T); public override int GetHashCode() => Value.GetHashCode(); public override string ToString() => Value; } }
bsd-2-clause
C#
50a072ac774cc8fa9d0c48fb0a8f5405b0a837df
Add tests for Spinner.Wait(Task)
prescottadam/ConsoleWritePrettyOneDay
ConsoleWritePrettyOneDay.Tests/SpinnerTests.cs
ConsoleWritePrettyOneDay.Tests/SpinnerTests.cs
using System; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ConsoleWritePrettyOneDay.Tests { [TestClass] public class SpinnerTests { [TestMethod] public void Wait_ExecutesAction() { // ARRANGE bool result = false; Action action = () => { result = true; }; // ACT Spinner.Wait(action); // ASSERT Assert.IsTrue(result); } [TestMethod] [ExpectedException(typeof(ApplicationException))] public void Wait_ThrowException_WhenActionThrowsException() { // ARRANGE Action action = () => { throw new ApplicationException(); }; // ACT Spinner.Wait(action); // ASSERT } [TestMethod] public void Wait_ExecutesTask() { // ARRANGE bool result = false; Task task = Task.Run(() => { result = true; }); // ACT Spinner.Wait(task); // ASSERT Assert.IsTrue(result); } [TestMethod] public void Wait_DoesNotThrowException_WhenTaskThrowsException() { // ARRANGE Task task = Task.Run(() => { throw new ApplicationException(); }); // ACT Spinner.Wait(task); // ASSERT Assert.IsTrue(task.IsFaulted); Assert.IsTrue(task.Exception is AggregateException); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ConsoleWritePrettyOneDay.Tests { [TestClass] public class SpinnerTests { [TestMethod] public void Wait_ExecutesAction() { // ARRANGE bool result = false; Action action = () => { result = true; }; // ACT Spinner.Wait(action); // ASSERT Assert.IsTrue(result); } [TestMethod] [ExpectedException(typeof(ApplicationException))] public void Wait_ThrowException_WhenActionThrowsException() { // ARRANGE Action action = () => { throw new ApplicationException(); }; // ACT Spinner.Wait(action); // ASSERT } } }
mit
C#
0408a256f71eb95ca69b789a3b4d46381f86f644
Update tests
aalhour/C-Sharp-Algorithms
UnitTest/AlgorithmsTests/BinarySearcherTest.cs
UnitTest/AlgorithmsTests/BinarySearcherTest.cs
using System.Collections.Generic; using Xunit; using Algorithms.Search; namespace UnitTest.AlgorithmsTests { public static class BinarySearcherTest { [Fact] public static void BinarySearchTest() { //list of ints IList<int> list = new List<int> { 9, 3, 7, 1, 6, 10 }; IList<int> sortedList = new List<int> { 1, 3, 6, 7, 9, 10 }; BinarySearcher<int> intSearcher = new BinarySearcher<int>(list, Comparer<int>.Default); int numToSearch = 6; int itemIndex = intSearcher.BinarySearch(numToSearch); int expectedIndex = sortedList.IndexOf(numToSearch); Assert.Equal(expectedIndex, itemIndex); Assert.Equal(numToSearch, intSearcher.Current); numToSearch = 20; int itemNotExists = intSearcher.BinarySearch(numToSearch); Assert.Equal(-1, itemNotExists); intSearcher.Dispose(); //list of strings IList<string> animals = new List<string> {"lion", "cat", "tiger", "bee", "sparrow"}; IList<string> sortedAnimals = new List<string> { "bee", "cat", "lion", "sparrow", "tiger" }; BinarySearcher<string> strSearcher = new BinarySearcher<string>(animals, Comparer<string>.Default); string itemToSearch = "bee"; int actualIndex = strSearcher.BinarySearch(itemToSearch); int expectedAnimalIndex = sortedAnimals.IndexOf(itemToSearch); Assert.Equal(expectedAnimalIndex, actualIndex); Assert.Equal(itemToSearch, strSearcher.Current); strSearcher.Dispose(); } [Fact] public static void NullCollectionExceptionTest() { IList<int> list = null; Assert.Throws<System.NullReferenceException>(() => new BinarySearcher<int>(list, Comparer<int>.Default)); } } }
using System.Collections.Generic; using Xunit; using Algorithms.Search; namespace UnitTest.AlgorithmsTests { public static class BinarySearcherTest { [Fact] public static void MergeSortTest() { //a list of int IList<int> list = new List<int> {9, 3, 7, 1, 6, 10}; IList<int> sortedList = BinarySearcher.MergeSort<int>(list); IList<int> expectedList = new List<int> { 1, 3, 6, 7, 9, 10 }; Assert.Equal(expectedList, sortedList); //a list of strings IList<string> animals = new List<string> {"lion", "cat", "tiger", "bee"}; IList<string> sortedAnimals = BinarySearcher.MergeSort<string>(animals); IList<string> expectedAnimals = new List<string> {"bee", "cat", "lion", "tiger"}; Assert.Equal(expectedAnimals, sortedAnimals); } [Fact] public static void BinarySearchTest() { //list of ints IList<int> list = new List<int> { 9, 3, 7, 1, 6, 10 }; IList<int> sortedList = BinarySearcher.MergeSort<int>(list); int itemIndex = BinarySearcher.BinarySearch<int>(list, 6); int expectedIndex = sortedList.IndexOf(6); Assert.Equal(expectedIndex, itemIndex); //list of strings IList<string> animals = new List<string> {"lion", "cat", "tiger", "bee", "sparrow"}; IList<string> sortedAnimals = BinarySearcher.MergeSort<string>(animals); int actualIndex = BinarySearcher.BinarySearch<string>(animals, "cat"); int expectedAnimalIndex = sortedAnimals.IndexOf("cat"); Assert.Equal(expectedAnimalIndex, actualIndex); } [Fact] public static void NullCollectionExceptionTest() { IList<int> list = null; Assert.Throws<System.NullReferenceException>(() => BinarySearcher.BinarySearch<int>(list,0)); } } }
mit
C#
f7db600776ad1a4d2e42f935d4a62f577727d320
Bump lobby name
samoatesgames/Ludumdare30,samoatesgames/Ludumdare30,SamOatesJams/Ludumdare30,samoatesgames/Ludumdare30,SamOatesJams/Ludumdare30,SamOatesJams/Ludumdare30
Unity/Assets/Scripts/Network/NetworkManager.cs
Unity/Assets/Scripts/Network/NetworkManager.cs
using UnityEngine; using System.Collections; public class NetworkManager : MonoBehaviour { private bool m_isConnectedToLobby = false; public GameObject LocalPlayer = null; // Use this for initialization void Start () { PhotonNetwork.autoJoinLobby = false; } // Update is called once per frame void Update () { if (!m_isConnectedToLobby && !PhotonNetwork.connected) { Debug.Log("Connecting to the Photon Master Server. Calling: PhotonNetwork.ConnectUsingSettings();"); m_isConnectedToLobby = true; PhotonNetwork.ConnectUsingSettings("2." + Application.loadedLevel); } } /// <summary> /// Called when connected to the master serber /// </summary> public virtual void OnConnectedToMaster() { if (PhotonNetwork.networkingPeer.AvailableRegions != null) { Debug.LogWarning("List of available regions counts " + PhotonNetwork.networkingPeer.AvailableRegions.Count + ". First: " + PhotonNetwork.networkingPeer.AvailableRegions[0] + " \t Current Region: " + PhotonNetwork.networkingPeer.CloudRegion); } var roomOptions = new RoomOptions() { isOpen = true, isVisible = true, maxPlayers = 10 }; PhotonNetwork.JoinOrCreateRoom("RobotsTestv2", roomOptions, TypedLobby.Default); } public virtual void OnFailedToConnectToPhoton(DisconnectCause cause) { Debug.LogError("Cause: " + cause); } public void OnJoinedRoom() { var spawn = SpawnManager.Instance.GetSpawm((Team)Random.Range(0, 1)); var player = PhotonNetwork.Instantiate("Player", spawn.transform.position, spawn.transform.rotation, 0); player.name = "LocalPlayer"; PhotonNetwork.playerName = "Player-" + (PhotonNetwork.playerList.Length + 1); var camera = player.transform.Find("Camera").gameObject; camera.SetActive(true); var collider = player.GetComponent<Collider>(); collider.enabled = true; var body = player.GetComponent<Rigidbody>(); body.isKinematic = false; var movement = player.GetComponent<PlayerMovement>(); movement.enabled = true; var shoot = player.GetComponent<PlayerShoot>(); shoot.enabled = true; } public virtual void OnJoinedLobby() { Debug.Log("OnJoinedLobby()."); } }
using UnityEngine; using System.Collections; public class NetworkManager : MonoBehaviour { private bool m_isConnectedToLobby = false; public GameObject LocalPlayer = null; // Use this for initialization void Start () { PhotonNetwork.autoJoinLobby = false; } // Update is called once per frame void Update () { if (!m_isConnectedToLobby && !PhotonNetwork.connected) { Debug.Log("Connecting to the Photon Master Server. Calling: PhotonNetwork.ConnectUsingSettings();"); m_isConnectedToLobby = true; PhotonNetwork.ConnectUsingSettings("2." + Application.loadedLevel); } } /// <summary> /// Called when connected to the master serber /// </summary> public virtual void OnConnectedToMaster() { if (PhotonNetwork.networkingPeer.AvailableRegions != null) { Debug.LogWarning("List of available regions counts " + PhotonNetwork.networkingPeer.AvailableRegions.Count + ". First: " + PhotonNetwork.networkingPeer.AvailableRegions[0] + " \t Current Region: " + PhotonNetwork.networkingPeer.CloudRegion); } var roomOptions = new RoomOptions() { isOpen = true, isVisible = true, maxPlayers = 10 }; PhotonNetwork.JoinOrCreateRoom("RobotsTest", roomOptions, TypedLobby.Default); } public virtual void OnFailedToConnectToPhoton(DisconnectCause cause) { Debug.LogError("Cause: " + cause); } public void OnJoinedRoom() { var spawn = SpawnManager.Instance.GetSpawm((Team)Random.Range(0, 1)); var player = PhotonNetwork.Instantiate("Player", spawn.transform.position, spawn.transform.rotation, 0); player.name = "LocalPlayer"; PhotonNetwork.playerName = "Player-" + (PhotonNetwork.playerList.Length + 1); var camera = player.transform.Find("Camera").gameObject; camera.SetActive(true); var collider = player.GetComponent<Collider>(); collider.enabled = true; var body = player.GetComponent<Rigidbody>(); body.isKinematic = false; var movement = player.GetComponent<PlayerMovement>(); movement.enabled = true; var shoot = player.GetComponent<PlayerShoot>(); shoot.enabled = true; } public virtual void OnJoinedLobby() { Debug.Log("OnJoinedLobby()."); } }
mit
C#
c0d81a4dfa251f4c6e62d117c86a72821e15643b
Add comments for XBox360PlayerIndex enum
mina-asham/XBox360ControllerManager
XBox360ControllerManager/XBox360PlayerIndex.cs
XBox360ControllerManager/XBox360PlayerIndex.cs
namespace XBox360ControllerManager { /// <summary> /// Represent player/gamepad index /// </summary> public enum XBox360PlayerIndex : ushort { /// <summary> /// Player one /// </summary> One = 0, /// <summary> /// Player two /// </summary> Two = 1, /// <summary> /// Player three /// </summary> Three = 2, /// <summary> /// Player four /// </summary> Four = 3 } }
namespace XBox360ControllerManager { public enum XBox360PlayerIndex : ushort { One = 0, Two = 1, Three = 2, Four = 3 } }
mit
C#
59686f6a90b72d5bbd442123b98bb2737074396f
fix exception when server have no errors
ramzzzay/GalleryMVC_With_Auth,ramzzzay/GalleryMVC_With_Auth,ramzzzay/GalleryMVC_With_Auth
GalleryMVC_With_Auth/Views/Errors/Index.cshtml
GalleryMVC_With_Auth/Views/Errors/Index.cshtml
@model Exception <h2>Ошибка!</h2> @if (Server.GetLastError()!= null) { <h3>Server.GetLastError().Message</h3> }
@model Exception <h2>Ошибка!</h2> @Server.GetLastError().Message
apache-2.0
C#
b517744283639277c58b573d1c6184daa3ea5847
Check if property exists before accessing or setting it
mono-soc-2013/gstreamer-sharp,mono-soc-2013/gstreamer-sharp,mono-soc-2013/gstreamer-sharp
sources/custom/Object.cs
sources/custom/Object.cs
// Copyright (C) 2013 Stephan Sundermann <stephansundermann@gmail.com> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.Runtime.InteropServices; namespace Gst { public class PropertyNotFoundException : Exception {} partial class Object { [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr g_object_class_find_property (IntPtr klass, IntPtr name); bool PropertyExists (string name) { var ptr = g_object_class_find_property (GType.GetClassPtr (), GLib.Marshaller.StringToPtrGStrdup (name)); var result = ptr != IntPtr.Zero; GLib.Marshaller.Free (ptr); return result; } public object this[string property] { get { if (PropertyExists (property)) { GLib.Value v = GetProperty (property); object o = v.Val; v.Dispose (); return o; } else throw new PropertyNotFoundException (); } set { if (PropertyExists (property)) { GLib.Value v = new GLib.Value (this, property); v.Val = value; SetProperty (property, v); v.Dispose (); } else throw new PropertyNotFoundException (); } } public void Connect (string signal, SignalHandler handler) { DynamicSignal.Connect (this, signal, handler); } public void Disconnect (string signal, SignalHandler handler) { DynamicSignal.Disconnect (this, signal, handler); } public void Connect (string signal, Delegate handler) { DynamicSignal.Connect (this, signal, handler); } public void Disconnect (string signal, Delegate handler) { DynamicSignal.Disconnect (this, signal, handler); } public object Emit (string signal, params object[] parameters) { return DynamicSignal.Emit (this, signal, parameters); } } }
// Copyright (C) 2013 Stephan Sundermann <stephansundermann@gmail.com> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. namespace Gst { using System; using System.Runtime.InteropServices; partial class Object { public object this[string property] { get { GLib.Value v = GetProperty (property); object o = v.Val; v.Dispose (); return o; } set { GLib.Value v = new GLib.Value (this, property); v.Val = value; SetProperty (property, v); v.Dispose (); } } public void Connect (string signal, SignalHandler handler) { DynamicSignal.Connect (this, signal, handler); } public void Disconnect (string signal, SignalHandler handler) { DynamicSignal.Disconnect (this, signal, handler); } public void Connect (string signal, Delegate handler) { DynamicSignal.Connect (this, signal, handler); } public void Disconnect (string signal, Delegate handler) { DynamicSignal.Disconnect (this, signal, handler); } public object Emit (string signal, params object[] parameters) { return DynamicSignal.Emit (this, signal, parameters); } } }
agpl-3.0
C#
42497889a928adedeacf9767613ae3b3045f77bf
Update UmbracoMicrosoftAuthExtensions.cs
umbraco/UmbracoIdentityExtensions
src/App_Start/UmbracoMicrosoftAuthExtensions.cs
src/App_Start/UmbracoMicrosoftAuthExtensions.cs
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using System.Web; using Microsoft.Owin; using Owin; using Umbraco.Core; using Umbraco.Web.Security.Identity; using Microsoft.Owin.Security.MicrosoftAccount; namespace $rootnamespace$ { public static class UmbracoMicrosoftAuthExtensions { /// <summary> /// Configure microsoft account sign-in /// </summary> /// <param name="app"></param> /// <param name="clientId"></param> /// <param name="clientSecret"></param> /// <param name="caption"></param> /// <param name="style"></param> /// <param name="icon"></param> /// <remarks> /// /// Nuget installation: /// Microsoft.Owin.Security.MicrosoftAccount /// /// Microsoft account documentation for ASP.Net Identity can be found: /// /// http://www.asp.net/web-api/overview/security/external-authentication-services#MICROSOFT /// http://blogs.msdn.com/b/webdev/archive/2012/09/19/configuring-your-asp-net-application-for-microsoft-oauth-account.aspx /// /// Microsoft apps can be created here: /// /// http://go.microsoft.com/fwlink/?LinkID=144070 /// /// </remarks> public static void ConfigureBackOfficeMicrosoftAuth(this IAppBuilder app, string clientId, string clientSecret, string caption = "Microsoft", string style = "btn-microsoft", string icon = "fa-windows") { var msOptions = new MicrosoftAccountAuthenticationOptions { ClientId = clientId, ClientSecret = clientSecret, SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType }; msOptions.ForUmbracoBackOffice(style, icon); msOptions.Caption = caption; app.UseMicrosoftAccountAuthentication(msOptions); } } }
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using System.Web; using Microsoft.Owin; using Owin; using Umbraco.Core; using Umbraco.Web.Security.Identity; using Microsoft.Owin.Security.MicrosoftAccount; namespace $rootnamespace$ { public static class UmbracoGoogleAuthExtensions { /// <summary> /// Configure microsoft account sign-in /// </summary> /// <param name="app"></param> /// <param name="clientId"></param> /// <param name="clientSecret"></param> /// <param name="caption"></param> /// <param name="style"></param> /// <param name="icon"></param> /// <remarks> /// /// Nuget installation: /// Microsoft.Owin.Security.MicrosoftAccount /// /// Microsoft account documentation for ASP.Net Identity can be found: /// /// http://www.asp.net/web-api/overview/security/external-authentication-services#MICROSOFT /// http://blogs.msdn.com/b/webdev/archive/2012/09/19/configuring-your-asp-net-application-for-microsoft-oauth-account.aspx /// /// Microsoft apps can be created here: /// /// http://go.microsoft.com/fwlink/?LinkID=144070 /// /// </remarks> public static void ConfigureBackOfficeMicrosoftAuth(this IAppBuilder app, string clientId, string clientSecret, string caption = "Microsoft", string style = "btn-microsoft", string icon = "fa-windows") { var msOptions = new MicrosoftAccountAuthenticationOptions { ClientId = clientId, ClientSecret = clientSecret, SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType }; msOptions.ForUmbracoBackOffice(style, icon); msOptions.Caption = caption; app.UseMicrosoftAccountAuthentication(msOptions); } } }
mit
C#
f85f5d5f535f228ba7f9d08b4c884dd93937dcc2
change return value SimpleBizwebService post and get method to string
vinhch/BizwebSharp
src/BizwebSharp/Services/SimpleBizwebService.cs
src/BizwebSharp/Services/SimpleBizwebService.cs
using System.Collections.Generic; using System.Threading.Tasks; using BizwebSharp.Infrastructure; using RestSharp.Portable; namespace BizwebSharp.Services { public class SimpleBizwebService : BaseService { public SimpleBizwebService(BizwebAuthorizationState authState) : base(authState) { } public async Task<string> GetAsync(string apiPath) { var req = RequestEngine.CreateRequest(apiPath, Method.GET); using (var client = RequestEngine.CreateClient(_AuthState)) { return await RequestEngine.ExecuteRequestToStringAsync(client, req, ExecutionPolicy); } } private async Task<string> PostOrPutAsync(Method method, string apiPath, object data, string rootElement = null) { var req = RequestEngine.CreateRequest(apiPath, method, rootElement); if (string.IsNullOrEmpty(rootElement)) { req.AddJsonBody(data); } else { var body = new Dictionary<string, object> { {rootElement, data} }; req.AddJsonBody(body); } using (var client = RequestEngine.CreateClient(_AuthState)) { return await RequestEngine.ExecuteRequestToStringAsync(client, req, ExecutionPolicy); } } public async Task<string> PostAsync(string apiPath, object data, string rootElement = null) { return await PostOrPutAsync(Method.POST, apiPath, data, rootElement); } public async Task<string> PutAsync(string apiPath, object data, string rootElement = null) { return await PostOrPutAsync(Method.PUT, apiPath, data, rootElement); } public async Task DeleteAsync(string apiPath) { var req = RequestEngine.CreateRequest(apiPath, Method.DELETE); using (var client = RequestEngine.CreateClient(_AuthState)) { await RequestEngine.ExecuteRequestToStringAsync(client, req, ExecutionPolicy); } } } }
using System.Collections.Generic; using System.Threading.Tasks; using BizwebSharp.Infrastructure; using RestSharp.Portable; namespace BizwebSharp.Services { public class SimpleBizwebService : BaseService { public SimpleBizwebService(BizwebAuthorizationState authState) : base(authState) { } public async Task<string> GetAsync(string apiPath) { var req = RequestEngine.CreateRequest(apiPath, Method.GET); using (var client = RequestEngine.CreateClient(_AuthState)) { return await RequestEngine.ExecuteRequestToStringAsync(client, req, ExecutionPolicy); } } private async Task<object> PostOrPutAsync(Method method, string apiPath, object data, string rootElement = null) { var req = RequestEngine.CreateRequest(apiPath, method, rootElement); if (string.IsNullOrEmpty(rootElement)) { req.AddJsonBody(data); } else { var body = new Dictionary<string, object> { {rootElement, data} }; req.AddJsonBody(body); } using (var client = RequestEngine.CreateClient(_AuthState)) { return await RequestEngine.ExecuteRequestToStringAsync(client, req, ExecutionPolicy); } } public async Task<object> PostAsync(string apiPath, object data, string rootElement = null) { return await PostOrPutAsync(Method.POST, apiPath, data, rootElement); } public async Task<object> PutAsync(string apiPath, object data, string rootElement = null) { return await PostOrPutAsync(Method.PUT, apiPath, data, rootElement); } public async Task DeleteAsync(string apiPath) { var req = RequestEngine.CreateRequest(apiPath, Method.DELETE); using (var client = RequestEngine.CreateClient(_AuthState)) { await RequestEngine.ExecuteRequestToStringAsync(client, req, ExecutionPolicy); } } } }
mit
C#
10f01c5e3d25d9a1e305ac11028fa9a40ceb090e
Fix merging mistake
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Crypto/CoordinatorParameters.cs
WalletWasabi/Crypto/CoordinatorParameters.cs
using WalletWasabi.Crypto.Groups; namespace WalletWasabi.Crypto { public class CoordinatorParameters { public CoordinatorParameters(GroupElement cw, GroupElement i) { Cw = CryptoGuard.NotNullOrInfinity(nameof(cw), cw); I = CryptoGuard.NotNullOrInfinity(nameof(i), i); } public GroupElement Cw { get; } public GroupElement I { get; } } }
using WalletWasabi.Crypto.Groups; namespace WalletWasabi.Crypto { public class CoordinatorParameters { public CoordinatorParameters(GroupElement cw, GroupElement i) { Cw = CryptoGuard.NotInfinity(nameof(cw), cw); I = CryptoGuard.NotInfinity(nameof(i), i); } public GroupElement Cw { get; } public GroupElement I { get; } } }
mit
C#
eac0abed3a383082ae054e4f9e58342452ef4a03
Fix #242
zapadi/redmine-net-api
src/redmine-net-api/Internals/XmlTextReaderBuilder.cs
src/redmine-net-api/Internals/XmlTextReaderBuilder.cs
using System.IO; using System.Xml; namespace Redmine.Net.Api.Internals { public static class XmlTextReaderBuilder { #if NET20 public static XmlReader Create(StringReader stringReader) { return XmlReader.Create(stringReader, new XmlReaderSettings() { ProhibitDtd = true, XmlResolver = null, IgnoreComments = true, IgnoreWhitespace = true, }); } public static XmlReader Create(string xml) { using (var stringReader = new StringReader(xml)) { return XmlReader.Create(stringReader, new XmlReaderSettings() { ProhibitDtd = true, XmlResolver = null, IgnoreComments = true, IgnoreWhitespace = true, }); } } #else public static XmlTextReader Create(StringReader stringReader) { return new XmlTextReader(stringReader) { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null, WhitespaceHandling = WhitespaceHandling.None }; } public static XmlTextReader Create(string xml) { using (var stringReader = new StringReader(xml)) { return new XmlTextReader(stringReader) { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null, WhitespaceHandling = WhitespaceHandling.None }; } } #endif } }
using System.IO; using System.Xml; namespace Redmine.Net.Api.Internals { internal static class XmlTextReaderBuilder { #if NET20 public static XmlReader Create(StringReader stringReader) { return XmlReader.Create(stringReader, new XmlReaderSettings() { ProhibitDtd = true, XmlResolver = null, IgnoreComments = true, IgnoreWhitespace = true, }); } public static XmlReader Create(string stringReader) { return XmlReader.Create(stringReader, new XmlReaderSettings() { ProhibitDtd = true, XmlResolver = null, IgnoreComments = true, IgnoreWhitespace = true, }); } #else public static XmlTextReader Create(StringReader stringReader) { return new XmlTextReader(stringReader) { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null, WhitespaceHandling = WhitespaceHandling.None }; } public static XmlTextReader Create(string stringReader) { return new XmlTextReader(stringReader) { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null, WhitespaceHandling = WhitespaceHandling.None }; } #endif } }
apache-2.0
C#
3b25539b725493d8d8de9d858c1e7636061aca44
Use the AvailableVariables property instead of doing GetProperties() everywhere.
ermshiperete/GitVersion,dpurge/GitVersion,ermshiperete/GitVersion,dpurge/GitVersion,gep13/GitVersion,Philo/GitVersion,pascalberger/GitVersion,onovotny/GitVersion,asbjornu/GitVersion,onovotny/GitVersion,onovotny/GitVersion,dpurge/GitVersion,gep13/GitVersion,DanielRose/GitVersion,dpurge/GitVersion,pascalberger/GitVersion,ermshiperete/GitVersion,JakeGinnivan/GitVersion,ParticularLabs/GitVersion,FireHost/GitVersion,dazinator/GitVersion,dazinator/GitVersion,asbjornu/GitVersion,DanielRose/GitVersion,ParticularLabs/GitVersion,JakeGinnivan/GitVersion,GitTools/GitVersion,DanielRose/GitVersion,ermshiperete/GitVersion,GitTools/GitVersion,Philo/GitVersion,FireHost/GitVersion,JakeGinnivan/GitVersion,pascalberger/GitVersion,JakeGinnivan/GitVersion
src/GitVersionTask.Tests/GetVersionTaskTests.cs
src/GitVersionTask.Tests/GetVersionTaskTests.cs
using System.Linq; using GitVersion; using GitVersionTask; using Microsoft.Build.Framework; using NUnit.Framework; using Shouldly; [TestFixture] public class GetVersionTaskTests { [Test] public void OutputsShouldMatchVariableProvider() { var taskProperties = typeof(GetVersion) .GetProperties() .Where(p => p.GetCustomAttributes(typeof(OutputAttribute), false).Any()) .Select(p => p.Name); var variablesProperties = VersionVariables.AvailableVariables; taskProperties.ShouldBe(variablesProperties, ignoreOrder: true); } }
using System.Linq; using GitVersion; using GitVersionTask; using Microsoft.Build.Framework; using NUnit.Framework; using Shouldly; [TestFixture] public class GetVersionTaskTests { [Test] public void OutputsShouldMatchVariableProvider() { var taskProperties = typeof(GetVersion) .GetProperties() .Where(p => p.GetCustomAttributes(typeof(OutputAttribute), false).Any()) .Select(p => p.Name); var variablesProperties = typeof(VersionVariables) .GetProperties() .Select(p => p.Name) .Except(new[] { "AvailableVariables", "Item" }); taskProperties.ShouldBe(variablesProperties, ignoreOrder: true); } }
mit
C#
542be9d417ae93177a0db79ef79419451a54c25b
Update AssemblyInfo.cs
PixelsForGlory/ProceduralVoxelMesh,afuzzyllama/ProceduralVoxelMesh
ProceduralVoxelMesh/Properties/AssemblyInfo.cs
ProceduralVoxelMesh/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("ProceduralVoxelMesh")] [assembly: AssemblyDescription("Library to create procedural voxel meshes in Unity3D")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("afuzzyllama")] [assembly: AssemblyProduct("ProceduralVoxelMesh")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4fe5e259-e4c2-49ca-892e-e3a952be5a65")] // 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")]
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("ProceduralVoxelMesh")] [assembly: AssemblyDescription("Library to create procedural voxel meshes in Unity3D")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("afuzzyllama")] [assembly: AssemblyProduct("ProceduralVoxelMesh")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4fe5e259-e4c2-49ca-892e-e3a952be5a65")] // 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.*")] [assembly: AssemblyFileVersion("1.0.*")]
mit
C#
40a0e8421aade3bb799e8a59273cfeb7ecff3e91
Change from Log to LogError when reporting a python error
zentuit/soomla-unity3d-core,vedi/soomla-unity3d-core,zentuit/soomla-unity3d-core,zentuit/soomla-unity3d-core,ravalum/soomla-unity3d-core,noctorus/soomla-unity3d-core,ravalum/soomla-unity3d-core,ravalum/soomla-unity3d-core,noctorus/soomla-unity3d-core,vedi/soomla-unity3d-core,ravalum/soomla-unity3d-core,ravalum/soomla-unity3d-core,vedi/soomla-unity3d-core,vedi/soomla-unity3d-core,noctorus/soomla-unity3d-core,vedi/soomla-unity3d-core,noctorus/soomla-unity3d-core,zentuit/soomla-unity3d-core,noctorus/soomla-unity3d-core
Soomla/Assets/Soomla/Editor/SoomlaPostBuild.cs
Soomla/Assets/Soomla/Editor/SoomlaPostBuild.cs
using UnityEngine; using System.Collections; using UnityEditor.Callbacks; using UnityEditor; using System.Diagnostics; using System.IO; public class PostProcessScriptStarter : MonoBehaviour { [PostProcessBuild(1000)] public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { #if UNITY_IOS string buildToolsDir = Application.dataPath + @"/Soomla/Editor/build-tools"; string searchPattern = "Soomla_*.py"; // This would be for you to construct your prefix DirectoryInfo di = new DirectoryInfo(buildToolsDir); FileInfo[] files = di.GetFiles(searchPattern); foreach (FileInfo fi in files) { Process proc = new Process(); proc.StartInfo.FileName = "python2.6"; int prefixLength = "Soomla_".Length; string targetModule = fi.Name.Substring(prefixLength, fi.Name.Length - ".py".Length - prefixLength); Soomla.ISoomlaPostBuildTool tool = Soomla.SoomlaPostBuildTools.GetTool(targetModule); string metaData = ""; if (tool != null) { metaData = tool.GetToolMetaData(target); metaData = (metaData != null) ? metaData : ""; } // UnityEngine.Debug.Log("Trying to run: " + fi.FullName + " " + metaData); proc.StartInfo.Arguments = string.Format("\"{0}\" \"{1}\" \"{2}\"", fi.FullName, pathToBuiltProject, metaData); proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.Start(); // string output = proc.StandardOutput.ReadToEnd(); string err = proc.StandardError.ReadToEnd(); proc.WaitForExit(); // UnityEngine.Debug.Log("out: " + output); if (proc.ExitCode != 0) { UnityEngine.Debug.LogError("error: " + err + " code: " + proc.ExitCode); } } #endif } }
using UnityEngine; using System.Collections; using UnityEditor.Callbacks; using UnityEditor; using System.Diagnostics; using System.IO; public class PostProcessScriptStarter : MonoBehaviour { [PostProcessBuild(1000)] public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { #if UNITY_IOS string buildToolsDir = Application.dataPath + @"/Soomla/Editor/build-tools"; string searchPattern = "Soomla_*.py"; // This would be for you to construct your prefix DirectoryInfo di = new DirectoryInfo(buildToolsDir); FileInfo[] files = di.GetFiles(searchPattern); foreach (FileInfo fi in files) { Process proc = new Process(); proc.StartInfo.FileName = "python2.6"; int prefixLength = "Soomla_".Length; string targetModule = fi.Name.Substring(prefixLength, fi.Name.Length - ".py".Length - prefixLength); Soomla.ISoomlaPostBuildTool tool = Soomla.SoomlaPostBuildTools.GetTool(targetModule); string metaData = ""; if (tool != null) { metaData = tool.GetToolMetaData(target); metaData = (metaData != null) ? metaData : ""; } // UnityEngine.Debug.Log("Trying to run: " + fi.FullName + " " + metaData); proc.StartInfo.Arguments = string.Format("\"{0}\" \"{1}\" \"{2}\"", fi.FullName, pathToBuiltProject, metaData); proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.Start(); // string output = proc.StandardOutput.ReadToEnd(); string err = proc.StandardError.ReadToEnd(); proc.WaitForExit(); // UnityEngine.Debug.Log("out: " + output); if (proc.ExitCode != 0) { UnityEngine.Debug.Log("error: " + err + " code: " + proc.ExitCode); } } #endif } }
apache-2.0
C#
89eb27b8a014ab2904cddc1a0a7cf465c3deea60
change MediaFilesPerPage
Borayvor/ASP.NET-MVC-CourseProject,Borayvor/ASP.NET-MVC-CourseProject,Borayvor/ASP.NET-MVC-CourseProject
EntertainmentSystem/Common/EntertainmentSystem.Common/Constants/GlobalConstants.cs
EntertainmentSystem/Common/EntertainmentSystem.Common/Constants/GlobalConstants.cs
namespace EntertainmentSystem.Common.Constants { public class GlobalConstants { public const string StringEmpty = ""; public const string AdministratorRoleName = "Administrator"; public const string AdministratorAreaName = "Administration"; public const string ModeratorRoleName = "Moderator"; public const string ModeratorAreaName = "Moderators"; public const string ForumAreaName = "Forum"; public const string MediaAreaName = "Media"; public const int PasswordMinLength = 3; public const int HomeLastContentCount = 3; public const int ForumStartPage = 1; public const int ForumPostsPerPage = 5; public const int ForumCommentsPerPage = 4; public const int ForumItemCacheDuration = 60 * 1; // 1 min. public const int MediaStartPage = 1; public const int MediaFilesPerPage = 4; public const int MediaHomeCacheDuration = 60 * 5; // 5 min. public const int UserUserNameMinLength = 2; public const int UserUserNameMaxLength = 256; public const int UserFirstNameMinLength = 2; public const int UserFirstNameMaxLength = 100; public const int UserLastNameMinLength = 2; public const int UserLastNameMaxLength = 100; public const int UserAvatarImageUrlMaxLength = 1024; public const int UserEmailMaxLength = 256; public const int MediaCategoryNameMinLength = 1; public const int MediaCategoryNameMaxLength = 512; public const int MediaCollectionNameMinLength = 1; public const int MediaCollectionNameMaxLength = 512; public const int MediaContentTitleMinLength = 1; public const int MediaContentTitleMaxLength = 256; public const int MediaContentDescriptionMaxLength = 2000; public const int MediaContentContentUrlMinLength = 1; public const int MediaContentContentUrlMaxLength = 1024; public const int MediaContentCoverImageUrlMaxLength = 1024; public const int PostTitleMinLength = 2; public const int PostTitleMaxLength = 256; public const int PostContentMinLength = 2; public const int PostContentMaxLength = 2000; public const int PostCategoryNameMinLength = 1; public const int PostCategoryNameMaxLength = 512; public const int PostCommentContentMinLength = 2; public const int PostCommentContentMaxLength = 2000; public const int PostTagNameMinLength = 2; public const int PostTagNameMaxLength = 50; } }
namespace EntertainmentSystem.Common.Constants { public class GlobalConstants { public const string StringEmpty = ""; public const string AdministratorRoleName = "Administrator"; public const string AdministratorAreaName = "Administration"; public const string ModeratorRoleName = "Moderator"; public const string ModeratorAreaName = "Moderators"; public const string ForumAreaName = "Forum"; public const string MediaAreaName = "Media"; public const int PasswordMinLength = 3; public const int HomeLastContentCount = 3; public const int ForumStartPage = 1; public const int ForumPostsPerPage = 5; public const int ForumCommentsPerPage = 4; public const int ForumItemCacheDuration = 60 * 1; // 1 min. public const int MediaStartPage = 1; public const int MediaFilesPerPage = 2; public const int MediaHomeCacheDuration = 60 * 5; // 5 min. public const int UserUserNameMinLength = 2; public const int UserUserNameMaxLength = 256; public const int UserFirstNameMinLength = 2; public const int UserFirstNameMaxLength = 100; public const int UserLastNameMinLength = 2; public const int UserLastNameMaxLength = 100; public const int UserAvatarImageUrlMaxLength = 1024; public const int UserEmailMaxLength = 256; public const int MediaCategoryNameMinLength = 1; public const int MediaCategoryNameMaxLength = 512; public const int MediaCollectionNameMinLength = 1; public const int MediaCollectionNameMaxLength = 512; public const int MediaContentTitleMinLength = 1; public const int MediaContentTitleMaxLength = 256; public const int MediaContentDescriptionMaxLength = 2000; public const int MediaContentContentUrlMinLength = 1; public const int MediaContentContentUrlMaxLength = 1024; public const int MediaContentCoverImageUrlMaxLength = 1024; public const int PostTitleMinLength = 2; public const int PostTitleMaxLength = 256; public const int PostContentMinLength = 2; public const int PostContentMaxLength = 2000; public const int PostCategoryNameMinLength = 1; public const int PostCategoryNameMaxLength = 512; public const int PostCommentContentMinLength = 2; public const int PostCommentContentMaxLength = 2000; public const int PostTagNameMinLength = 2; public const int PostTagNameMaxLength = 50; } }
mit
C#
118289877c2409c723413f0967853f50779f0248
Update SDK version to 4.0.3
NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity
ncmb_unity/Assets/NCMB/Script/CommonConstant.cs
ncmb_unity/Assets/NCMB/Script/CommonConstant.cs
/******* Copyright 2017-2020 FUJITSU CLOUD TECHNOLOGIES LIMITED All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. **********/ using System.Collections; namespace NCMB.Internal { //通信種別 internal enum ConnectType { //GET通信 GET, //POST通信 POST, //PUT通信 PUT, //DELETE通信 DELETE } /// <summary> /// 定数を定義する共通用のクラスです /// </summary> internal static class CommonConstant { //service public static readonly string DOMAIN = "mbaas.api.nifcloud.com";//ドメイン public static readonly string DOMAIN_URL = "https://mbaas.api.nifcloud.com";//ドメインのURL public static readonly string API_VERSION = "2013-09-01";//APIバージョン public static readonly string SDK_VERSION = "4.0.4"; //SDKバージョン //DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください } }
/******* Copyright 2017-2020 FUJITSU CLOUD TECHNOLOGIES LIMITED All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. **********/ using System.Collections; namespace NCMB.Internal { //通信種別 internal enum ConnectType { //GET通信 GET, //POST通信 POST, //PUT通信 PUT, //DELETE通信 DELETE } /// <summary> /// 定数を定義する共通用のクラスです /// </summary> internal static class CommonConstant { //service public static readonly string DOMAIN = "mbaas.api.nifcloud.com";//ドメイン public static readonly string DOMAIN_URL = "https://mbaas.api.nifcloud.com";//ドメインのURL public static readonly string API_VERSION = "2013-09-01";//APIバージョン public static readonly string SDK_VERSION = "4.0.3"; //SDKバージョン //DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください } }
apache-2.0
C#
bd4db65a43ca87ab2af786c26b80cb5c4586aab2
update email
lderache/LeTruck,lderache/LeTruck,lderache/LeTruck
src/mvc5/TheTruck.Web/Views/Home/Contact.cshtml
src/mvc5/TheTruck.Web/Views/Home/Contact.cshtml
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <p> We would love to hear your feedback about products and suggestions. </p> <address> <strong>Support:</strong> <a href="mailto:letruckteam@outlook.com">letruckteam@outlook.com</a><br /> </address>
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <p> We would love to hear your feedback about products and suggestions. </p> <address> <strong>Support:</strong> <a href="mailto:contact@letruck.net">contact@letruck.net</a><br /> </address>
mit
C#
347661f0d0cfb6057621dc86c66d2adcc78ba9b2
Fix unit test
okolobaxa/uploadcare-csharp
Uploadcare.Tests/Uploaders/FileUploaderTest.cs
Uploadcare.Tests/Uploaders/FileUploaderTest.cs
using System.IO; using System.Threading.Tasks; using Uploadcare.Upload; using Xunit; namespace Uploadcare.Tests.Uploaders { public class FileUploaderTest { [Fact] public async Task fileuploader_upload_assert() { var client = UploadcareClient.DemoClient(); var file = new FileInfo("1.jpg"); var uploader = new FileUploader(client); var result = await uploader.Upload(file); Assert.NotNull(result.Uuid); } [Fact] public async Task fileuploader_upload_bytes() { var client = UploadcareClient.DemoClient(); var file = new FileInfo("Lenna.png"); var bytes = File.ReadAllBytes(file.FullName); var uploader = new FileUploader(client); var result = await uploader.Upload(bytes, file.Name); Assert.NotNull(result.Uuid); } } }
using System.IO; using System.Threading.Tasks; using Uploadcare.Upload; using Xunit; namespace Uploadcare.Tests.Uploaders { public class FileUploaderTest { [Fact] public async Task fileuploader_upload_assert() { var client = UploadcareClient.DemoClient(); var file = new FileInfo("12.jpg"); var uploader = new FileUploader(client); var result = await uploader.Upload(file); Assert.NotNull(result.Uuid); } [Fact] public async Task fileuploader_upload_bytes() { var client = UploadcareClient.DemoClient(); var file = new FileInfo("Lenna.png"); var bytes = File.ReadAllBytes(file.FullName); var uploader = new FileUploader(client); var result = await uploader.Upload(bytes, file.Name); Assert.NotNull(result.Uuid); } } }
mit
C#
b41aa578ff8781a71935ab8cf24296448cf51dd9
Change masking char.
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Controls/TogglePasswordBox.cs
WalletWasabi.Gui/Controls/TogglePasswordBox.cs
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Data; using Avalonia.Styling; using System; using ReactiveUI; using System.Reactive.Linq; namespace WalletWasabi.Gui.Controls { public class TogglePasswordBox : ExtendedTextBox, IStyleable { Type IStyleable.StyleKey => typeof(TogglePasswordBox); public static readonly StyledProperty<bool> IsPasswordVisibleProperty = AvaloniaProperty.Register<TogglePasswordBox, bool>(nameof(IsPasswordVisible), defaultBindingMode: BindingMode.TwoWay); public bool IsPasswordVisible { get => GetValue(IsPasswordVisibleProperty); set => SetValue(IsPasswordVisibleProperty, value); } public TogglePasswordBox() { UseFloatingWatermark = true; Watermark = "Password"; this.GetObservable(IsPasswordVisibleProperty) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { IsPasswordVisible = x; }); this.WhenAnyValue(x => x.IsPasswordVisible) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { PasswordChar = x ? '\0' : '\u2022'; }); } protected override bool IsCopyEnabled => false; protected override void OnTemplateApplied(TemplateAppliedEventArgs e) { base.OnTemplateApplied(e); var maskedButton = e.NameScope.Get<Button>("PART_MaskedButton"); maskedButton.WhenAnyValue(x => x.IsPressed) .Where(x => x) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => { IsPasswordVisible = !IsPasswordVisible; }); } } }
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Data; using Avalonia.Styling; using System; using ReactiveUI; using System.Reactive.Linq; namespace WalletWasabi.Gui.Controls { public class TogglePasswordBox : ExtendedTextBox, IStyleable { Type IStyleable.StyleKey => typeof(TogglePasswordBox); public static readonly StyledProperty<bool> IsPasswordVisibleProperty = AvaloniaProperty.Register<TogglePasswordBox, bool>(nameof(IsPasswordVisible), defaultBindingMode: BindingMode.TwoWay); public bool IsPasswordVisible { get => GetValue(IsPasswordVisibleProperty); set => SetValue(IsPasswordVisibleProperty, value); } public TogglePasswordBox() { UseFloatingWatermark = true; Watermark = "Password"; this.GetObservable(IsPasswordVisibleProperty) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { IsPasswordVisible = x; }); this.WhenAnyValue(x => x.IsPasswordVisible) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { PasswordChar = x ? '\0' : '*'; }); } protected override bool IsCopyEnabled => false; protected override void OnTemplateApplied(TemplateAppliedEventArgs e) { base.OnTemplateApplied(e); var maskedButton = e.NameScope.Get<Button>("PART_MaskedButton"); maskedButton.WhenAnyValue(x => x.IsPressed) .Where(x => x) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => { IsPasswordVisible = !IsPasswordVisible; }); } } }
mit
C#
708a48760754c5edc38f0ce3cd21f4da72784c3e
Switch to version 1.2.6
rbouallou/Zebus,AtwooTM/Zebus,biarne-a/Zebus,Abc-Arbitrage/Zebus
src/SharedVersionInfo.cs
src/SharedVersionInfo.cs
using System.Reflection; [assembly: AssemblyVersion("1.2.6")] [assembly: AssemblyFileVersion("1.2.6")] [assembly: AssemblyInformationalVersion("1.2.6")]
using System.Reflection; [assembly: AssemblyVersion("1.2.5")] [assembly: AssemblyFileVersion("1.2.5")] [assembly: AssemblyInformationalVersion("1.2.5")]
mit
C#
7914c322381f1fb3207d045bf0c574bab0648ef7
Use XWT's default size for ComboBoxEntry
iainx/xwt,mono/xwt,sevoku/xwt,cra0zy/xwt,akrisiun/xwt,mminns/xwt,mminns/xwt,steffenWi/xwt,hamekoz/xwt,TheBrainTech/xwt,lytico/xwt,antmicro/xwt,directhex/xwt,residuum/xwt,hwthomas/xwt
Xwt.WPF/Xwt.WPFBackend/ComboBoxEntryBackend.cs
Xwt.WPF/Xwt.WPFBackend/ComboBoxEntryBackend.cs
// // ComboBoxEntryBackend.cs // // Author: // Eric Maupin <ermau@xamarin.com> // // Copyright (c) 2012 Xamarin, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using Xwt.Backends; namespace Xwt.WPFBackend { public class ComboBoxEntryBackend : ComboBoxBackend, IComboBoxEntryBackend { public ComboBoxEntryBackend() { ComboBox.IsEditable = true; this.textBackend = new ComboBoxTextEntryBackend (ComboBox); } public ITextEntryBackend TextEntryBackend { get { return this.textBackend; } } public void SetTextColumn (int column) { if (ComboBox.DisplayMemberPath != null) ComboBox.DisplayMemberPath = ".[" + column + "]"; } protected override double DefaultNaturalWidth { get { return -1; } } private readonly ComboBoxTextEntryBackend textBackend; } }
// // ComboBoxEntryBackend.cs // // Author: // Eric Maupin <ermau@xamarin.com> // // Copyright (c) 2012 Xamarin, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using Xwt.Backends; namespace Xwt.WPFBackend { public class ComboBoxEntryBackend : ComboBoxBackend, IComboBoxEntryBackend { public ComboBoxEntryBackend() { ComboBox.IsEditable = true; this.textBackend = new ComboBoxTextEntryBackend (ComboBox); } public ITextEntryBackend TextEntryBackend { get { return this.textBackend; } } public void SetTextColumn (int column) { if (ComboBox.DisplayMemberPath != null) ComboBox.DisplayMemberPath = ".[" + column + "]"; } private readonly ComboBoxTextEntryBackend textBackend; } }
mit
C#
7bcfc6b83723b33e6c0e5463498292aadd18bed2
add OnCollisionEnter2D and move NotifyBirdDied to virtual method to allow stubbing in tests
nrjohnstone/flappybird-unity
unity-flappybirds/Assets/Scripts/BirdController.cs
unity-flappybirds/Assets/Scripts/BirdController.cs
using UnityEngine; namespace Assets.Scripts { public class BirdController { public float upForce = 150f; public bool isDead { get; private set; } private readonly IAnimator _anim; private readonly IRigidbody2D _rb2d; private readonly IInput _input; public BirdController(IInput input, IAnimator anim, IRigidbody2D rb2D) { _input = input; _anim = anim; _rb2d = rb2D; } public void Update() { if (isDead == false) { if (_input.IsLeftMouseButtonDown()) { _rb2d.velocity = Vector2.zero; _rb2d.AddForce(new Vector2(0, upForce)); _anim.SetTrigger("Flap"); } } } public void OnCollisionEnter2D(Collision2D other) { _rb2d.velocity = Vector2.zero; isDead = true; _anim.SetTrigger("Die"); NotifyBirdDied(); } protected virtual void NotifyBirdDied() { GameControl.instance.BirdDied(); } } }
using UnityEngine; namespace Assets.Scripts { public class BirdController { public float upForce = 150f; private bool isDead = false; private readonly IAnimator _anim; private readonly IRigidbody2D _rb2d; private readonly IInput _input; public BirdController(IInput input, IAnimator anim, IRigidbody2D rb2D) { _input = input; _anim = anim; _rb2d = rb2D; } public void Update() { if (isDead == false) { if (_input.IsLeftMouseButtonDown()) { _rb2d.velocity = Vector2.zero; _rb2d.AddForce(new Vector2(0, upForce)); _anim.SetTrigger("Flap"); } } } } }
cc0-1.0
C#
c4bb5196e914a0e888bc11815becfe17e7dbea65
fix #159
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 => GetBattleSpeed(); 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; private static Int32 GetBattleSpeed() { Int32 value = Math.Max(Instance._battle.Speed, Instance._hacks.BattleSpeed); if (value == 0) return 0; // Ozma Battle if (FF9StateSystem.Battle.FF9Battle.map.nextMapNo == 2952) // EVT_CHOCO_CH_FGD_0 return 0; return value; } } } }
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; } } }
mit
C#
0e4e9a9c1c48321e66bd1307ebad70c361f7c7b6
Update DisplayHideRowColumnHeaders.cs
maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET
Examples/CSharp/Worksheets/Display/DisplayHideRowColumnHeaders.cs
Examples/CSharp/Worksheets/Display/DisplayHideRowColumnHeaders.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Worksheets.Display { public class DisplayHideRowColumnHeaders { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Creating a file stream containing the Excel file to be opened FileStream fstream = new FileStream(dataDir + "book1.xls", FileMode.Open); //Instantiating a Workbook object //Opening the Excel file through the file stream Workbook workbook = new Workbook(fstream); //Accessing the first worksheet in the Excel file Worksheet worksheet = workbook.Worksheets[0]; //Hiding the headers of rows and columns worksheet.IsRowColumnHeadersVisible = false; //Saving the modified Excel file workbook.Save(dataDir + "output.out.xls"); //Closing the file stream to free all resources fstream.Close(); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Worksheets.Display { public class DisplayHideRowColumnHeaders { public static void Main(string[] args) { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Creating a file stream containing the Excel file to be opened FileStream fstream = new FileStream(dataDir + "book1.xls", FileMode.Open); //Instantiating a Workbook object //Opening the Excel file through the file stream Workbook workbook = new Workbook(fstream); //Accessing the first worksheet in the Excel file Worksheet worksheet = workbook.Worksheets[0]; //Hiding the headers of rows and columns worksheet.IsRowColumnHeadersVisible = false; //Saving the modified Excel file workbook.Save(dataDir + "output.out.xls"); //Closing the file stream to free all resources fstream.Close(); } } }
mit
C#
8442489aa773a11609da66cf732f7099a3e7b2f4
Add comments to constructors, use constructor chaining.
jcheng31/WundergroundAutocomplete.NET
WundergroundClient/Autocomplete/AutocompleteRequest.cs
WundergroundClient/Autocomplete/AutocompleteRequest.cs
using System; namespace WundergroundClient.Autocomplete { enum ResultFilter { CitiesOnly, HurricanesOnly, CitiesAndHurricanes } class AutocompleteRequest { private const String BaseUrl = "http://autocomplete.wunderground.com/"; private readonly String _searchString; private readonly ResultFilter _filter; private readonly String _countryCode; /// <summary> /// Creates a request to search for cities. /// </summary> /// <param name="city">The full or partial name of a city to look for.</param> public AutocompleteRequest(String city) : this(city, ResultFilter.CitiesOnly, null) { } /// <summary> /// Creates a general query for cities, hurricanes, or both. /// </summary> /// <param name="query">The full or partial name to be looked up.</param> /// <param name="filter">The types of results that are expected.</param> public AutocompleteRequest(String query, ResultFilter filter) : this(query, filter, null) { } /// <summary> /// Creates a query for cities, hurricanes, or both, /// restricted to a particular country. /// /// Note: Wunderground does not use the standard ISO country codes. /// See http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching /// </summary> /// <param name="query">The full or partial name to be looked up.</param> /// <param name="filter">The types of results that are expected.</param> /// <param name="countryCode">The Wunderground country code to restrict results to.</param> public AutocompleteRequest(String query, ResultFilter filter, String countryCode) { _searchString = query; _filter = filter; _countryCode = countryCode; } //public async Task<String> ExecuteAsync() //{ //} } }
using System; namespace WundergroundClient.Autocomplete { enum ResultFilter { CitiesOnly, HurricanesOnly, CitiesAndHurricanes } class AutocompleteRequest { private String _searchString; private ResultFilter _filter = ResultFilter.CitiesOnly; private String _countryCode = null; public AutocompleteRequest(String searchString) { _searchString = searchString; } public AutocompleteRequest(String query, ResultFilter filter) { _searchString = query; _filter = filter; } public AutocompleteRequest(String searchString, ResultFilter filter, string countryCode) { _searchString = searchString; _filter = filter; _countryCode = countryCode; } //public async Task<String> ExecuteAsync() //{ //} } }
mit
C#
9b834e3ac6f2abb5892c3a953653eea1c4e6e35e
change tests to work with NUnit 3.7.x
jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets
NunitUpgrade/NunitUpgrade/TestsForNUnit3/DebtCalculatorTestNew.cs
NunitUpgrade/NunitUpgrade/TestsForNUnit3/DebtCalculatorTestNew.cs
using System; using System.IO; using MyBizLogic; using NUnit.Framework; namespace TestsForNUnit3 { /// <summary> /// NUnit 3.7.x tests /// </summary> [TestFixture] public class DebtCalculatorTestNew { private DebtCalculator _testee; [OneTimeSetUp] public void SetUp() { _testee = new DebtCalculator(); } [Test] public void Calculation_can_only_be_called_with_valid_CalculatorMethods() { var nonExistingMethod = (CalculatorMethod)111; Assert.Throws<ArgumentOutOfRangeException>(() => _testee.ByMethod(nonExistingMethod)); } [Test] public void Extended_calculation_isnt_allowed() { Assert.That(() => _testee.ByMethod(CalculatorMethod.Extended), Throws.TypeOf<MyException>() .With.Message.EqualTo("Invalid calulation method")); } [Test] public void Data_can_be_loaded_from_file_system() { var sourcePath = TestContext.CurrentContext.TestDirectory + @"\TestData\2017.txt"; var targetPath = TestContext.CurrentContext.TestDirectory + @"\TestResult\2017_calculated.txt"; var result = _testee.BatchProcessing(sourcePath, targetPath); Assert.That(result, Does.StartWith("Success")); //Expect(result, Does.StartWith("Success")); Assert.IsTrue(File.Exists(targetPath)); } [Ignore("reason why this test is ignored")] [Test] public void Something() { // Nobody knows why this no longer runs } } }
using System; using System.IO; using MyBizLogic; using NUnit.Framework; namespace TestsForNUnit3 { [TestFixture] class DebtCalculatorTestOld : AssertionHelper { private DebtCalculator _testee; [TestFixtureSetUp] public void SetUp() { _testee = new DebtCalculator(); } [Test] [ExpectedException(typeof(ArgumentOutOfRangeException))] public void Calculation_can_only_be_called_with_valid_CalculatorMethods() { var nonExistingMethod = (CalculatorMethod)111; _testee.ByMethod(nonExistingMethod); } [Test] [ExpectedException(typeof(MyException), ExpectedMessage = "Invalid calulation method")] public void Extended_calculation_isnt_allowed() { _testee.ByMethod(CalculatorMethod.Extended); } [Test] public void Data_can_be_loaded_from_file_system() { var sourcePath = @".\TestData\2017.txt"; var targetPath = @".\TestResult\2017_calculated.txt"; var result = _testee.BatchProcessing(sourcePath, targetPath); Expect(result, Is.StringStarting("Success")); Assert.IsTrue(File.Exists(targetPath)); } [Ignore] [Test] public void Something() { // Nobody knows why this no longer runs } } }
apache-2.0
C#
7c00a9944936a22aab6e59c51a6fbe2b4cacfbf4
Initialize the server with a report-state command
openstardrive/server,openstardrive/server,openstardrive/server
OpenStardriveServer/HostedServices/ServerInitializationService.cs
OpenStardriveServer/HostedServices/ServerInitializationService.cs
using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using OpenStardriveServer.Domain; using OpenStardriveServer.Domain.Database; using OpenStardriveServer.Domain.Systems; namespace OpenStardriveServer.HostedServices; public class ServerInitializationService : BackgroundService { private readonly IRegisterSystemsCommand registerSystemsCommand; private readonly ISqliteDatabaseInitializer sqliteDatabaseInitializer; private readonly ILogger<ServerInitializationService> logger; private readonly ICommandRepository commandRepository; public ServerInitializationService(IRegisterSystemsCommand registerSystemsCommand, ISqliteDatabaseInitializer sqliteDatabaseInitializer, ILogger<ServerInitializationService> logger, ICommandRepository commandRepository) { this.sqliteDatabaseInitializer = sqliteDatabaseInitializer; this.logger = logger; this.commandRepository = commandRepository; this.registerSystemsCommand = registerSystemsCommand; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { logger.LogInformation("Registering systems..."); registerSystemsCommand.Register(); logger.LogInformation("Initializing database..."); await sqliteDatabaseInitializer.Initialize(); await commandRepository.Save(new Command { Type = "report-state" }); logger.LogInformation("Server ready"); } }
using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using OpenStardriveServer.Domain.Database; using OpenStardriveServer.Domain.Systems; namespace OpenStardriveServer.HostedServices; public class ServerInitializationService : BackgroundService { private readonly IRegisterSystemsCommand registerSystemsCommand; private readonly ISqliteDatabaseInitializer sqliteDatabaseInitializer; private readonly ILogger<ServerInitializationService> logger; public ServerInitializationService(IRegisterSystemsCommand registerSystemsCommand, ISqliteDatabaseInitializer sqliteDatabaseInitializer, ILogger<ServerInitializationService> logger) { this.sqliteDatabaseInitializer = sqliteDatabaseInitializer; this.logger = logger; this.registerSystemsCommand = registerSystemsCommand; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { logger.LogInformation("Registering systems..."); registerSystemsCommand.Register(); logger.LogInformation("Initializing database..."); await sqliteDatabaseInitializer.Initialize(); logger.LogInformation("Server ready"); } }
apache-2.0
C#
dadbe2b8f5884aee5065742a25039899c988584d
fix noob error
aritchie/userdialogs
src/Acr.UserDialogs.Shared/UserDialogs.cs
src/Acr.UserDialogs.Shared/UserDialogs.cs
using System; #if __ANDROID__ using Android.App; using Acr.Support.Android; #endif namespace Acr.UserDialogs { public static class UserDialogs { static readonly Lazy<IUserDialogs> instance = new Lazy<IUserDialogs>(() => { #if PCL throw new ArgumentException("This is the PCL library, not the platform library. You must install the nuget package in your main executable/application project?"); #elif __ANDROID__ throw new ArgumentException("In android, you must call UserDialogs.Init(Activity) from your first activity"); #else return new UserDialogsImpl(); #endif }); #if __ANDROID__ /// <summary> /// Initialize android user dialogs /// </summary> public static void Init(Func<Activity> topActivityFactory) { Instance = new UserDialogsImpl(topActivityFactory); } /// <summary> /// Initialize android user dialogs /// </summary> public static void Init(Application app) { ActivityLifecycleCallbacks.Register(app); Init((() => ActivityLifecycleCallbacks.CurrentTopActivity)); } /// <summary> /// Initialize android user dialogs /// </summary> public static void Init(Activity activity) { ActivityLifecycleCallbacks.Register(activity); Init((() => ActivityLifecycleCallbacks.CurrentTopActivity)); } #endif static IUserDialogs customInstance; public static IUserDialogs Instance { get { return customInstance ?? instance.Value; } set { customInstance = value; } } } }
using System; #if __ANDROID__ using Android.App; using Acr.Support.Android; #endif namespace Acr.UserDialogs { public static class UserDialogs { static readonly Lazy<IUserDialogs> instance = new Lazy<IUserDialogs>(() => { #if PCL throw new ArgumentException("This is the PCL library, not the platform library. You must install the nuget package in your main "executable" project?"); #elif __ANDROID__ throw new ArgumentException("In android, you must call UserDialogs.Init(Activity) from your first activity"); #else return new UserDialogsImpl(); #endif }); #if __ANDROID__ /// <summary> /// Initialize android user dialogs /// </summary> public static void Init(Func<Activity> topActivityFactory) { Instance = new UserDialogsImpl(topActivityFactory); } /// <summary> /// Initialize android user dialogs /// </summary> public static void Init(Application app) { ActivityLifecycleCallbacks.Register(app); Init((() => ActivityLifecycleCallbacks.CurrentTopActivity)); } /// <summary> /// Initialize android user dialogs /// </summary> public static void Init(Activity activity) { ActivityLifecycleCallbacks.Register(activity); Init((() => ActivityLifecycleCallbacks.CurrentTopActivity)); } #endif static IUserDialogs customInstance; public static IUserDialogs Instance { get { return customInstance ?? instance.Value; } set { customInstance = value; } } } }
mit
C#
07df8a683f25f88e4bc5922a35ce2eb70a35ef56
Fix typo in TokenErrorResult.cs (#2742)
MienDev/IdentityServer4,IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4
src/Endpoints/Results/TokenErrorResult.cs
src/Endpoints/Results/TokenErrorResult.cs
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System.Threading.Tasks; using IdentityServer4.Hosting; using Microsoft.AspNetCore.Http; using IdentityServer4.Extensions; using System; using IdentityServer4.ResponseHandling; namespace IdentityServer4.Endpoints.Results { internal class TokenErrorResult : IEndpointResult { public TokenErrorResponse Response { get; } public TokenErrorResult(TokenErrorResponse error) { if (error.Error.IsMissing()) throw new ArgumentNullException(nameof(error.Error), "Error must be set"); Response = error; } public async Task ExecuteAsync(HttpContext context) { context.Response.StatusCode = 400; context.Response.SetNoCache(); var dto = new ResultDto { error = Response.Error, error_description = Response.ErrorDescription }; if (Response.Custom.IsNullOrEmpty()) { await context.Response.WriteJsonAsync(dto); } else { var jobject = ObjectSerializer.ToJObject(dto); jobject.AddDictionary(Response.Custom); await context.Response.WriteJsonAsync(jobject); } } internal class ResultDto { public string error { get; set; } public string error_description { get; set; } } } }
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System.Threading.Tasks; using IdentityServer4.Hosting; using Microsoft.AspNetCore.Http; using IdentityServer4.Extensions; using System; using IdentityServer4.ResponseHandling; namespace IdentityServer4.Endpoints.Results { internal class TokenErrorResult : IEndpointResult { public TokenErrorResponse Response { get; } public TokenErrorResult(TokenErrorResponse error) { if (error.Error.IsMissing()) throw new ArgumentNullException("Error must be set", nameof(error.Error)); Response = error; } public async Task ExecuteAsync(HttpContext context) { context.Response.StatusCode = 400; context.Response.SetNoCache(); var dto = new ResultDto { error = Response.Error, error_description = Response.ErrorDescription }; if (Response.Custom.IsNullOrEmpty()) { await context.Response.WriteJsonAsync(dto); } else { var jobject = ObjectSerializer.ToJObject(dto); jobject.AddDictionary(Response.Custom); await context.Response.WriteJsonAsync(jobject); } } internal class ResultDto { public string error { get; set; } public string error_description { get; set; } } } }
apache-2.0
C#
80a1a271d8c1a8a863888c232a20049437ea3c2e
Update DiagnosticAnalyzer.cs
filipw/RemoveRegionAnalyzerAndCodeFix
RemoveRegionAnalyzerAndCodeFix/RemoveRegionAnalyzerAndCodeFix/DiagnosticAnalyzer.cs
RemoveRegionAnalyzerAndCodeFix/RemoveRegionAnalyzerAndCodeFix/DiagnosticAnalyzer.cs
using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; namespace RemoveRegionAnalyzerAndCodeFix { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class RemoveRegionAnalyzer : DiagnosticAnalyzer { public const string DiagnosticId = "RemoveRegionAnalyzer"; private static readonly LocalizableString Title = new LocalizableResourceString(nameof(Resources.AnalyzerTitle), Resources.ResourceManager, typeof(Resources)); private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormat), Resources.ResourceManager, typeof(Resources)); private static readonly LocalizableString Description = new LocalizableResourceString(nameof(Resources.AnalyzerDescription), Resources.ResourceManager, typeof(Resources)); private const string Category = "Naming"; private static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } } public override void Initialize(AnalysisContext context) { context.RegisterSyntaxNodeAction(AnalyzeNode, ImmutableArray.Create(SyntaxKind.RegionDirectiveTrivia, SyntaxKind.EndRegionDirectiveTrivia)); } private static void AnalyzeNode(SyntaxNodeAnalysisContext context) { var diagnostic = Diagnostic.Create(Rule, context.Node.GetLocation()); context.ReportDiagnostic(diagnostic); } } }
using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; namespace RemoveRegionAnalyzerAndCodeFix { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class RemoveRegionAnalyzer : DiagnosticAnalyzer { public const string DiagnosticId = "RemoveRegionAnalyzer"; private static readonly LocalizableString Title = new LocalizableResourceString(nameof(Resources.AnalyzerTitle), Resources.ResourceManager, typeof(Resources)); private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormat), Resources.ResourceManager, typeof(Resources)); private static readonly LocalizableString Description = new LocalizableResourceString(nameof(Resources.AnalyzerDescription), Resources.ResourceManager, typeof(Resources)); private const string Category = "Naming"; private static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } } public override void Initialize(AnalysisContext context) { context.RegisterSyntaxNodeAction(AnalyzeNode, ImmutableArray.Create(SyntaxKind.RegionDirectiveTrivia, SyntaxKind.EndRegionDirectiveTrivia)); } private static void AnalyzeNode(SyntaxNodeAnalysisContext context) { var diagnostic = Diagnostic.Create(Rule, context.Node.GetLocation(), context.Node.GetText().ToString().Replace(Environment.NewLine, string.Empty)); context.ReportDiagnostic(diagnostic); } } }
mit
C#
39d6c8370e6cf2f5004094427072e164e9d1500c
Add XML comments to TermSettingsAttribute
atata-framework/atata,YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata
src/Atata/Attributes/TermSettingsAttribute.cs
src/Atata/Attributes/TermSettingsAttribute.cs
using System; namespace Atata { /// <summary> /// Specifies the term settings. /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)] public class TermSettingsAttribute : MulticastAttribute, ITermSettings { public TermSettingsAttribute() { } public TermSettingsAttribute(TermCase termCase) { Case = termCase; } public TermSettingsAttribute(TermMatch match) { Match = match; } public TermSettingsAttribute(TermMatch match, TermCase termCase) { Match = match; Case = termCase; } /// <summary> /// Gets the match. /// </summary> public new TermMatch Match { get { return Properties.Get(nameof(Match), TermMatch.Equals); } private set { Properties[nameof(Match)] = value; } } /// <summary> /// Gets the term case. /// </summary> public TermCase Case { get { return Properties.Get(nameof(Case), TermCase.None); } private set { Properties[nameof(Case)] = value; } } /// <summary> /// Gets or sets the format. /// </summary> public string Format { get { return Properties.Get<string>(nameof(Format)); } set { Properties[nameof(Format)] = value; } } } }
using System; namespace Atata { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)] public class TermSettingsAttribute : MulticastAttribute, ITermSettings { public TermSettingsAttribute() { } public TermSettingsAttribute(TermCase termCase) { Case = termCase; } public TermSettingsAttribute(TermMatch match) { Match = match; } public TermSettingsAttribute(TermMatch match, TermCase termCase) { Match = match; Case = termCase; } /// <summary> /// Gets the match. /// </summary> public new TermMatch Match { get { return Properties.Get(nameof(Match), TermMatch.Equals); } private set { Properties[nameof(Match)] = value; } } /// <summary> /// Gets the term case. /// </summary> public TermCase Case { get { return Properties.Get(nameof(Case), TermCase.None); } private set { Properties[nameof(Case)] = value; } } /// <summary> /// Gets or sets the format. /// </summary> public string Format { get { return Properties.Get<string>(nameof(Format)); } set { Properties[nameof(Format)] = value; } } } }
apache-2.0
C#
0a78a4f8f19a3f7c79dc2f03097e418275099f90
Support single hyphen argument.
ejball/Facility,FacilityApi/Facility
src/Facility.Definition/Console/ArgsReader.cs
src/Facility.Definition/Console/ArgsReader.cs
using System; using System.Collections.Generic; using System.Linq; namespace Facility.Definition.Console { /// <summary> /// Helps process command-line arguments. /// </summary> public sealed class ArgsReader { /// <summary> /// Creates a reader for the specified command-line arguments. /// </summary> public ArgsReader(IEnumerable<string> args) { if (args == null) throw new ArgumentNullException(nameof(args)); m_args = args.ToList(); } /// <summary> /// Reads the specified flag, returning true if it is found. /// </summary> public bool ReadFlag(string name) { if (name == null) throw new ArgumentNullException(nameof(name)); if (name.Length == 0) throw new ArgumentException("Flag name must not be empty.", nameof(name)); var names = name.Split('|'); if (names.Length > 1) return names.Any(ReadFlag); int index = m_args.IndexOf(RenderOption(name)); if (index == -1) return false; m_args.RemoveAt(index); return true; } /// <summary> /// Reads the specified option, returning null if it is missing. /// </summary> public string ReadOption(string name) { if (name == null) throw new ArgumentNullException(nameof(name)); if (name.Length == 0) throw new ArgumentException("Option name must not be empty.", nameof(name)); var names = name.Split('|'); if (names.Length > 1) return names.Select(ReadOption).FirstOrDefault(x => x != null); int index = m_args.IndexOf(RenderOption(name)); if (index == -1) return null; if (index + 1 >= m_args.Count) throw new ArgsReaderException($"Missing value after '{RenderOption(name)}'."); string value = m_args[index + 1]; if (IsOption(value)) throw new ArgsReaderException($"Missing value after '{RenderOption(name)}'."); m_args.RemoveAt(index); m_args.RemoveAt(index); return value; } /// <summary> /// Reads the next non-option argument, or null if none remain. /// </summary> public string ReadArgument() { if (m_args.Count == 0) return null; string value = m_args[0]; if (IsOption(value)) throw new ArgsReaderException($"Unexpected option '{value}'."); m_args.RemoveAt(0); return value; } /// <summary> /// Confirms that all arguments were processed. /// </summary> public void VerifyComplete() { if (m_args.Count != 0) throw new ArgsReaderException($"Unexpected {(IsOption(m_args[0]) ? "option" : "argument")} '{m_args[0]}'."); } private static bool IsOption(string value) { return value.Length >= 2 && value[0] == '-' && value != "--"; } private static string RenderOption(string name) { return name.Length == 1 ? $"-{name}" : $"--{name}"; } readonly List<string> m_args; } }
using System; using System.Collections.Generic; using System.Linq; namespace Facility.Definition.Console { /// <summary> /// Helps process command-line arguments. /// </summary> public sealed class ArgsReader { /// <summary> /// Creates a reader for the specified command-line arguments. /// </summary> public ArgsReader(IReadOnlyList<string> args) { m_args = args.ToList(); } /// <summary> /// Reads the specified flag, returning true if it is found. /// </summary> public bool ReadFlag(string name) { if (name == null) throw new ArgumentNullException(nameof(name)); if (name.Length == 0) throw new ArgumentException("Flag name must not be empty.", nameof(name)); var names = name.Split('|'); if (names.Length > 1) return names.Any(ReadFlag); int index = m_args.IndexOf(RenderOption(name)); if (index == -1) return false; m_args.RemoveAt(index); return true; } /// <summary> /// Reads the specified option, returning null if it is missing. /// </summary> public string ReadOption(string name) { if (name == null) throw new ArgumentNullException(nameof(name)); if (name.Length == 0) throw new ArgumentException("Option name must not be empty.", nameof(name)); var names = name.Split('|'); if (names.Length > 1) return names.Select(ReadOption).FirstOrDefault(x => x != null); int index = m_args.IndexOf(RenderOption(name)); if (index == -1) return null; if (index + 1 >= m_args.Count) throw new ArgsReaderException($"Missing value after '{RenderOption(name)}'."); string value = m_args[index + 1]; if (value[0] == '-') throw new ArgsReaderException($"Missing value after '{RenderOption(name)}'."); m_args.RemoveAt(index); m_args.RemoveAt(index); return value; } /// <summary> /// Reads the next non-option argument, or null if none remain. /// </summary> public string ReadArgument() { if (m_args.Count == 0) return null; string value = m_args[0]; if (value[0] == '-') throw new ArgsReaderException($"Unexpected option '{value}'."); m_args.RemoveAt(0); return value; } /// <summary> /// Confirms that all arguments were processed. /// </summary> public void VerifyComplete() { if (m_args.Count != 0) throw new ArgsReaderException($"Unexpected {(m_args[0][0] == '-' ? "option" : "argument")} '{m_args[0]}'."); } private static string RenderOption(string name) { return name.Length == 1 ? $"-{name}" : $"--{name}"; } readonly List<string> m_args; } }
mit
C#
af28a5d36fcfbd77c4d1ad3e8f4040cf5c98ba6e
Add Version/PackageIdentity to CatalogPageEntity.
StephenClearyApps/NetStandardTypes,StephenClearyApps/NetStandardTypes,StephenClearyApps/NetStandardTypes,StephenClearyApps/NetStandardTypes
src/NuGetCatalog/CatalogPageEntry.cs
src/NuGetCatalog/CatalogPageEntry.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json.Linq; using NuGet.Packaging.Core; using NuGet.Versioning; using static NuGetCatalog.Globals; namespace NuGetCatalog { public sealed class CatalogPageEntry { private readonly JToken _content; internal CatalogPageEntry(dynamic content) { _content = content; } public PackageIdentity PackageIdentity => new PackageIdentity(Id, NuGetVersion.Parse(Version)); public string Id => (string) _content["nuget:id"]; public string Version => (string)_content["nuget:version"]; public async Task<CatalogPackage> GetPackageAsync() { var url = (string)_content["@id"]; if (url == null) throw UnrecognizedJson(); return new CatalogPackage(await Client.GetJsonAsync(url)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json.Linq; using static NuGetCatalog.Globals; namespace NuGetCatalog { public sealed class CatalogPageEntry { private readonly JToken _content; internal CatalogPageEntry(dynamic content) { _content = content; } public string Id => (string) _content["nuget:id"]; public async Task<CatalogPackage> GetPackageAsync() { var url = (string)_content["@id"]; if (url == null) throw UnrecognizedJson(); return new CatalogPackage(await Client.GetJsonAsync(url)); } } }
mit
C#
c1908075bf771314181c4d7a1799cd1037505b8e
Use new resource name
stofte/ream-query
src/ReamQuery.Resources/Resources.cs
src/ReamQuery.Resources/Resources.cs
namespace ReamQuery.Resource { using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading; using Newtonsoft.Json; public static class Resources { static Assembly _assembly; static IEnumerable<string> _names; static string _metadataPrefix; static Resources() { _assembly = typeof(Resources).Assembly; _names = _assembly.GetManifestResourceNames(); _metadataPrefix = string.Format("{0}.MetadataFiles", typeof(Resources).Assembly.GetName().Name); } public static IEnumerable<Stream> Metadata() { foreach(var name in _names) { if (name.StartsWith(_metadataPrefix)) { yield return _assembly.GetManifestResourceStream(name); } } } public static IEnumerable<string> List() { var stream = _assembly.GetManifestResourceStream(Validate("ref-list.json")); using (var ms = new MemoryStream()) { stream.CopyTo(ms); var json = Encoding.Default.GetString(ms.ToArray()); return JsonConvert.DeserializeObject<IEnumerable<string>>(json); } } static string Validate(string name) { if (!_names.Contains(name)) { throw new ArgumentException("Invalid name"); } return name; } } }
namespace ReamQuery.Resource { using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading; using Newtonsoft.Json; public static class Resources { static Assembly _assembly; static IEnumerable<string> _names; static string _metadataPrefix; static Resources() { _assembly = typeof(Resources).Assembly; _names = _assembly.GetManifestResourceNames(); _metadataPrefix = string.Format("{0}.metadata_files", typeof(Resources).Assembly.GetName().Name); } public static IEnumerable<Stream> Metadata() { foreach(var name in _names) { if (name.StartsWith(_metadataPrefix)) { yield return _assembly.GetManifestResourceStream(name); } } } public static IEnumerable<string> List() { var stream = _assembly.GetManifestResourceStream(Validate("ref-list.json")); using (var ms = new MemoryStream()) { stream.CopyTo(ms); var json = Encoding.Default.GetString(ms.ToArray()); return JsonConvert.DeserializeObject<IEnumerable<string>>(json); } } static string Validate(string name) { if (!_names.Contains(name)) { throw new ArgumentException("Invalid name"); } return name; } } }
mit
C#
36ed634b5a0ca429f8486cedc42349d5adcad349
Remove a useless line.
tangxuehua/enode,Aaron-Liu/enode
src/ENode/Command/Impl/DefaultCommandService.cs
src/ENode/Command/Impl/DefaultCommandService.cs
using System; using System.Threading; using ENode.Infrastructure; namespace ENode.Commanding { public class DefaultCommandService : ICommandService { private ICommandQueueRouter _commandQueueRouter; private ICommandAsyncResultManager _commandAsyncResultManager; public DefaultCommandService( ICommandQueueRouter commandQueueRouter, ICommandAsyncResultManager commandAsyncResultManager) { _commandQueueRouter = commandQueueRouter; _commandAsyncResultManager = commandAsyncResultManager; } public void Send(ICommand command, Action<CommandAsyncResult> callback = null) { var commandQueue = _commandQueueRouter.Route(command); if (commandQueue == null) { throw new Exception("Could not route the command to an appropriate command queue."); } if (callback != null) { _commandAsyncResultManager.Add(command.Id, new CommandAsyncResult(callback)); } commandQueue.Enqueue(command); } public void Execute(ICommand command) { var commandQueue = _commandQueueRouter.Route(command); if (commandQueue == null) { throw new Exception("Could not route the command to an appropriate command queue."); } var waitHandle = new ManualResetEvent(false); var commandAsyncResult = new CommandAsyncResult(waitHandle); _commandAsyncResultManager.Add(command.Id, commandAsyncResult); commandQueue.Enqueue(command); waitHandle.WaitOne(command.MillisecondsTimeout); _commandAsyncResultManager.Remove(command.Id); if (!commandAsyncResult.IsCompleted) { throw new CommandTimeoutException(command.Id, command.GetType()); } else if (commandAsyncResult.Exception != null) { throw new CommandExecuteException(command.Id, command.GetType(), commandAsyncResult.Exception); } else if (commandAsyncResult.ErrorMessage != null) { throw new CommandExecuteException(command.Id, command.GetType(), commandAsyncResult.ErrorMessage); } } } }
using System; using System.Threading; using ENode.Infrastructure; namespace ENode.Commanding { public class DefaultCommandService : ICommandService { private ICommandQueueRouter _commandQueueRouter; private ICommandAsyncResultManager _commandAsyncResultManager; public DefaultCommandService( ICommandQueueRouter commandQueueRouter, IProcessingCommandCache processingCommandCache, ICommandAsyncResultManager commandAsyncResultManager) { _commandQueueRouter = commandQueueRouter; _commandAsyncResultManager = commandAsyncResultManager; } public void Send(ICommand command, Action<CommandAsyncResult> callback = null) { var commandQueue = _commandQueueRouter.Route(command); if (commandQueue == null) { throw new Exception("Could not route the command to an appropriate command queue."); } if (callback != null) { _commandAsyncResultManager.Add(command.Id, new CommandAsyncResult(callback)); } commandQueue.Enqueue(command); } public void Execute(ICommand command) { var commandQueue = _commandQueueRouter.Route(command); if (commandQueue == null) { throw new Exception("Could not route the command to an appropriate command queue."); } var waitHandle = new ManualResetEvent(false); var commandAsyncResult = new CommandAsyncResult(waitHandle); _commandAsyncResultManager.Add(command.Id, commandAsyncResult); commandQueue.Enqueue(command); waitHandle.WaitOne(command.MillisecondsTimeout); _commandAsyncResultManager.Remove(command.Id); if (!commandAsyncResult.IsCompleted) { throw new CommandTimeoutException(command.Id, command.GetType()); } else if (commandAsyncResult.Exception != null) { throw new CommandExecuteException(command.Id, command.GetType(), commandAsyncResult.Exception); } else if (commandAsyncResult.ErrorMessage != null) { throw new CommandExecuteException(command.Id, command.GetType(), commandAsyncResult.ErrorMessage); } } } }
mit
C#
235d74f4ba2b1d51d8659ae6ca5bcf3fb63ac943
Add Check
sunkaixuan/SqlSugar
Src/Asp.Net/SqlSugar/CacheScheme/CacheSchemeMain.cs
Src/Asp.Net/SqlSugar/CacheScheme/CacheSchemeMain.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SqlSugar { internal class CacheSchemeMain { public static T GetOrCreate<T>(ICacheService cacheService, QueryBuilder queryBuilder, Func<T> getData, int cacheDurationInSeconds, SqlSugarProvider context) { CacheKey key = CacheKeyBuider.GetKey(context, queryBuilder); string keyString = key.ToString(); var result = cacheService.GetOrCreate(keyString, getData, cacheDurationInSeconds); return result; } public static void RemoveCache(ICacheService cacheService, string tableName) { if (cacheService == null) { return; } var keys = cacheService.GetAllKey<string>(); if (keys.HasValue()) { foreach (var item in keys) { if (item.ToLower().Contains(UtilConstants.Dot + tableName.ToLower() + UtilConstants.Dot)) { cacheService.Remove<string>(item); } } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SqlSugar { internal class CacheSchemeMain { public static T GetOrCreate<T>(ICacheService cacheService, QueryBuilder queryBuilder, Func<T> getData, int cacheDurationInSeconds, SqlSugarProvider context) { CacheKey key = CacheKeyBuider.GetKey(context, queryBuilder); string keyString = key.ToString(); var result = cacheService.GetOrCreate(keyString, getData, cacheDurationInSeconds); return result; } public static void RemoveCache(ICacheService cacheService, string tableName) { var keys = cacheService.GetAllKey<string>(); if (keys.HasValue()) { foreach (var item in keys) { if (item.ToLower().Contains(UtilConstants.Dot + tableName.ToLower() + UtilConstants.Dot)) { cacheService.Remove<string>(item); } } } } } }
apache-2.0
C#
532f173c62e37d77bab74b8f9bf491e7981e182c
Increase version number
cryovat/gengo-dotnet
Winterday.External.Gengo/Properties/AssemblyInfo.cs
Winterday.External.Gengo/Properties/AssemblyInfo.cs
// // AssemblyInfo.cs // // Author: // Jarl Erik Schmidt <github@jarlerik.com> // // Copyright (c) 2013 Jarl Erik Schmidt // // 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.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("Winterday.External.Gengo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("winterday.net")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("Jarl Erik Schmidt")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly:InternalsVisibleTo("Winterday.External.Gengo.Tests")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("0.9.0.5")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
// // AssemblyInfo.cs // // Author: // Jarl Erik Schmidt <github@jarlerik.com> // // Copyright (c) 2013 Jarl Erik Schmidt // // 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.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("Winterday.External.Gengo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("winterday.net")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("Jarl Erik Schmidt")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly:InternalsVisibleTo("Winterday.External.Gengo.Tests")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("0.9.0.4")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
mit
C#
5820793d1119f82bfeb772a835cfdd220277a356
Make TestMultiplayerRoomContainer inherit TestRoomContainer
peppy/osu,smoogipoo/osu,peppy/osu-new,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu
osu.Game/Tests/Visual/Multiplayer/TestMultiplayerRoomContainer.cs
osu.Game/Tests/Visual/Multiplayer/TestMultiplayerRoomContainer.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.Multiplayer; using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Lounge.Components; using osu.Game.Tests.Visual.OnlinePlay; namespace osu.Game.Tests.Visual.Multiplayer { public class TestMultiplayerRoomContainer : TestRoomContainer { protected override Container<Drawable> Content => content; private readonly Container content; [Cached(typeof(MultiplayerClient))] public readonly TestMultiplayerClient Client; [Cached(typeof(IRoomManager))] public readonly TestMultiplayerRoomManager RoomManager; [Cached] public readonly Bindable<FilterCriteria> Filter = new Bindable<FilterCriteria>(new FilterCriteria()); [Cached] public readonly OngoingOperationTracker OngoingOperationTracker; public TestMultiplayerRoomContainer() { RelativeSizeAxes = Axes.Both; RoomManager = new TestMultiplayerRoomManager(); Client = new TestMultiplayerClient(RoomManager); OngoingOperationTracker = new OngoingOperationTracker(); AddRangeInternal(new Drawable[] { Client, RoomManager, OngoingOperationTracker, content = new Container { RelativeSizeAxes = Axes.Both } }); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.Multiplayer; using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Lounge.Components; namespace osu.Game.Tests.Visual.Multiplayer { public class TestMultiplayerRoomContainer : Container { protected override Container<Drawable> Content => content; private readonly Container content; [Cached(typeof(MultiplayerClient))] public readonly TestMultiplayerClient Client; [Cached(typeof(IRoomManager))] public readonly TestMultiplayerRoomManager RoomManager; [Cached] public readonly Bindable<FilterCriteria> Filter = new Bindable<FilterCriteria>(new FilterCriteria()); [Cached] public readonly OngoingOperationTracker OngoingOperationTracker; public TestMultiplayerRoomContainer() { RelativeSizeAxes = Axes.Both; RoomManager = new TestMultiplayerRoomManager(); Client = new TestMultiplayerClient(RoomManager); OngoingOperationTracker = new OngoingOperationTracker(); AddRangeInternal(new Drawable[] { Client, RoomManager, OngoingOperationTracker, content = new Container { RelativeSizeAxes = Axes.Both } }); } } }
mit
C#
4e6b240e77c80ee4e0ebef669d4f62b68c54ad47
Clean up Translation code health test
evildour/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,iantalarico/google-cloud-dotnet,benwulfe/google-cloud-dotnet,jskeet/google-cloud-dotnet,evildour/google-cloud-dotnet,chrisdunelm/google-cloud-dotnet,googleapis/google-cloud-dotnet,googleapis/google-cloud-dotnet,chrisdunelm/gcloud-dotnet,benwulfe/google-cloud-dotnet,iantalarico/google-cloud-dotnet,jskeet/google-cloud-dotnet,chrisdunelm/google-cloud-dotnet,evildour/google-cloud-dotnet,chrisdunelm/google-cloud-dotnet,benwulfe/google-cloud-dotnet,iantalarico/google-cloud-dotnet,jskeet/gcloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet
apis/Google.Cloud.Translation.V2/Google.Cloud.Translation.V2.Tests/CodeHealthTest.cs
apis/Google.Cloud.Translation.V2/Google.Cloud.Translation.V2.Tests/CodeHealthTest.cs
// Copyright 2017 Google 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 // // 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.Cloud.ClientTesting; using Xunit; namespace Google.Cloud.Translation.V2.Tests { public class CodeHealthTest { [Fact] public void PrivateFields() { CodeHealthTester.AssertAllFieldsPrivate(typeof(TranslationClient)); } [Fact] public void SealedClasses() { CodeHealthTester.AssertClassesAreSealedOrAbstract(typeof(TranslationClient)); } } }
// Copyright 2017 Google 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 // // 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.Cloud.ClientTesting; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using Xunit; namespace Google.Cloud.Translation.V2.Tests { public class CodeHealthTest { // TODO: Remove the autogenerated type exemptions when we depend on the package instead. [Fact] public void PrivateFields() { CodeHealthTester.AssertAllFieldsPrivate(typeof(TranslationClient), GetExemptedTypes()); } [Fact] public void SealedClasses() { CodeHealthTester.AssertClassesAreSealedOrAbstract(typeof(TranslationClient), GetExemptedTypes()); } private static IEnumerable<Type> GetExemptedTypes() => typeof(TranslationClient).GetTypeInfo().Assembly.DefinedTypes .Where(t => t.Namespace.StartsWith("Google.Apis.")) .Select(t => t.AsType()) .ToList(); } }
apache-2.0
C#
cf5ada1d4bbc4b1476971644ee0451a0c37e95c9
Update TextFieldDriver.cs
phillipsj/Orchard,Codinlab/Orchard,Dolphinsimon/Orchard,grapto/Orchard.CloudBust,grapto/Orchard.CloudBust,Serlead/Orchard,SzymonSel/Orchard,hannan-azam/Orchard,SouleDesigns/SouleDesigns.Orchard,johnnyqian/Orchard,jimasp/Orchard,sfmskywalker/Orchard,fassetar/Orchard,tobydodds/folklife,omidnasri/Orchard,yersans/Orchard,omidnasri/Orchard,jagraz/Orchard,li0803/Orchard,Praggie/Orchard,sfmskywalker/Orchard,phillipsj/Orchard,Fogolan/OrchardForWork,hannan-azam/Orchard,xkproject/Orchard,tobydodds/folklife,hbulzy/Orchard,SouleDesigns/SouleDesigns.Orchard,SzymonSel/Orchard,OrchardCMS/Orchard,Dolphinsimon/Orchard,Lombiq/Orchard,rtpHarry/Orchard,sfmskywalker/Orchard,jtkech/Orchard,OrchardCMS/Orchard,li0803/Orchard,jagraz/Orchard,armanforghani/Orchard,yersans/Orchard,johnnyqian/Orchard,IDeliverable/Orchard,mvarblow/Orchard,grapto/Orchard.CloudBust,li0803/Orchard,abhishekluv/Orchard,LaserSrl/Orchard,ehe888/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard,LaserSrl/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,OrchardCMS/Orchard,abhishekluv/Orchard,gcsuk/Orchard,vairam-svs/Orchard,IDeliverable/Orchard,SzymonSel/Orchard,aaronamm/Orchard,abhishekluv/Orchard,jtkech/Orchard,OrchardCMS/Orchard,SouleDesigns/SouleDesigns.Orchard,hannan-azam/Orchard,grapto/Orchard.CloudBust,Codinlab/Orchard,Praggie/Orchard,johnnyqian/Orchard,xkproject/Orchard,brownjordaninternational/OrchardCMS,hbulzy/Orchard,ehe888/Orchard,jchenga/Orchard,tobydodds/folklife,Praggie/Orchard,rtpHarry/Orchard,omidnasri/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,gcsuk/Orchard,Serlead/Orchard,Codinlab/Orchard,Dolphinsimon/Orchard,gcsuk/Orchard,jchenga/Orchard,ehe888/Orchard,Serlead/Orchard,jtkech/Orchard,xkproject/Orchard,abhishekluv/Orchard,jtkech/Orchard,fassetar/Orchard,LaserSrl/Orchard,omidnasri/Orchard,grapto/Orchard.CloudBust,jchenga/Orchard,omidnasri/Orchard,omidnasri/Orchard,sfmskywalker/Orchard,brownjordaninternational/OrchardCMS,yersans/Orchard,jersiovic/Orchard,aaronamm/Orchard,jersiovic/Orchard,omidnasri/Orchard,tobydodds/folklife,Praggie/Orchard,bedegaming-aleksej/Orchard,rtpHarry/Orchard,hannan-azam/Orchard,jersiovic/Orchard,AdvantageCS/Orchard,IDeliverable/Orchard,jimasp/Orchard,grapto/Orchard.CloudBust,abhishekluv/Orchard,hbulzy/Orchard,Lombiq/Orchard,AdvantageCS/Orchard,fassetar/Orchard,Dolphinsimon/Orchard,armanforghani/Orchard,vairam-svs/Orchard,LaserSrl/Orchard,ehe888/Orchard,bedegaming-aleksej/Orchard,gcsuk/Orchard,bedegaming-aleksej/Orchard,AdvantageCS/Orchard,ehe888/Orchard,aaronamm/Orchard,tobydodds/folklife,Praggie/Orchard,SouleDesigns/SouleDesigns.Orchard,mvarblow/Orchard,Serlead/Orchard,aaronamm/Orchard,armanforghani/Orchard,Lombiq/Orchard,sfmskywalker/Orchard,Fogolan/OrchardForWork,jagraz/Orchard,Codinlab/Orchard,AdvantageCS/Orchard,abhishekluv/Orchard,rtpHarry/Orchard,vairam-svs/Orchard,jtkech/Orchard,jimasp/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,bedegaming-aleksej/Orchard,phillipsj/Orchard,bedegaming-aleksej/Orchard,jersiovic/Orchard,LaserSrl/Orchard,phillipsj/Orchard,brownjordaninternational/OrchardCMS,fassetar/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,jchenga/Orchard,brownjordaninternational/OrchardCMS,Serlead/Orchard,li0803/Orchard,jagraz/Orchard,gcsuk/Orchard,fassetar/Orchard,johnnyqian/Orchard,xkproject/Orchard,mvarblow/Orchard,Lombiq/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,mvarblow/Orchard,sfmskywalker/Orchard,xkproject/Orchard,omidnasri/Orchard,sfmskywalker/Orchard,hbulzy/Orchard,OrchardCMS/Orchard,SzymonSel/Orchard,Fogolan/OrchardForWork,Fogolan/OrchardForWork,yersans/Orchard,Codinlab/Orchard,brownjordaninternational/OrchardCMS,jimasp/Orchard,jersiovic/Orchard,tobydodds/folklife,phillipsj/Orchard,SzymonSel/Orchard,IDeliverable/Orchard,IDeliverable/Orchard,armanforghani/Orchard,johnnyqian/Orchard,vairam-svs/Orchard,AdvantageCS/Orchard,jchenga/Orchard,mvarblow/Orchard,Fogolan/OrchardForWork,armanforghani/Orchard,jagraz/Orchard,rtpHarry/Orchard,hannan-azam/Orchard,aaronamm/Orchard,Lombiq/Orchard,vairam-svs/Orchard,Dolphinsimon/Orchard,omidnasri/Orchard,jimasp/Orchard,li0803/Orchard,hbulzy/Orchard,yersans/Orchard
src/Orchard.Web/Modules/Orchard.Fields/Drivers/TextFieldDriver.cs
src/Orchard.Web/Modules/Orchard.Fields/Drivers/TextFieldDriver.cs
using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Fields; using Orchard.Core.Common.Settings; using Orchard.Tokens; using System; using System.Collections.Generic; namespace Orchard.Fields.Drivers { // The original driver of the TextField is in Orchard.Core, where tokenization can not be used. // This driver was added so the default value of the TextField can be tokenized. public class TextFieldDriver : ContentFieldDriver<TextField> { private readonly ITokenizer _tokenizer; public TextFieldDriver(ITokenizer tokenizer) { _tokenizer = tokenizer; } protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater, dynamic shapeHelper) { var settings = field.PartFieldDefinition.Settings.GetModel<TextFieldSettings>(); if (!String.IsNullOrEmpty(settings.DefaultValue) && (String.IsNullOrEmpty(field.Value) || field.Value.Equals(settings.DefaultValue))) { field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary<string, object> { { "Content", part.ContentItem } }); } return null; } } }
using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Fields; using Orchard.Core.Common.Settings; using Orchard.Tokens; using System; using System.Collections.Generic; namespace Orchard.Fields.Drivers { // The original driver of the TextField is in Orchard.Core, where tokenization can not be used. // This driver was added so the default value of the TextField can be tokenized. public class TextFieldDriver : ContentFieldDriver<TextField> { private readonly ITokenizer _tokenizer; public TextFieldDriver(ITokenizer tokenizer) { _tokenizer = tokenizer; } protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater, dynamic shapeHelper) { var settings = field.PartFieldDefinition.Settings.GetModel<TextFieldSettings>(); if (String.IsNullOrEmpty(field.Value) && !String.IsNullOrEmpty(settings.DefaultValue)) { field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary<string, object> { { "Content", part.ContentItem } }); } return null; } } }
bsd-3-clause
C#
4317cf56925c84dd3506d4e5f0b2943b8bc3eeb4
Fix options provider.
reaction1989/roslyn,brettfo/roslyn,aelij/roslyn,sharwell/roslyn,dotnet/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,reaction1989/roslyn,wvdd007/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,bartdesmet/roslyn,sharwell/roslyn,eriawan/roslyn,tmat/roslyn,diryboy/roslyn,wvdd007/roslyn,weltkante/roslyn,diryboy/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn,aelij/roslyn,bartdesmet/roslyn,eriawan/roslyn,aelij/roslyn,dotnet/roslyn,bartdesmet/roslyn,mgoertz-msft/roslyn,tannergooding/roslyn,AmadeusW/roslyn,tannergooding/roslyn,KevinRansom/roslyn,davkean/roslyn,eriawan/roslyn,tannergooding/roslyn,dotnet/roslyn,AlekseyTs/roslyn,panopticoncentral/roslyn,genlu/roslyn,gafter/roslyn,panopticoncentral/roslyn,mavasani/roslyn,davkean/roslyn,weltkante/roslyn,AmadeusW/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,davkean/roslyn,jasonmalinowski/roslyn,heejaechang/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,AlekseyTs/roslyn,tmat/roslyn,stephentoub/roslyn,heejaechang/roslyn,stephentoub/roslyn,mgoertz-msft/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,genlu/roslyn,physhi/roslyn,brettfo/roslyn,weltkante/roslyn,stephentoub/roslyn,diryboy/roslyn,reaction1989/roslyn,KirillOsenkov/roslyn,panopticoncentral/roslyn,mavasani/roslyn,gafter/roslyn,gafter/roslyn,physhi/roslyn,brettfo/roslyn,ErikSchierboom/roslyn,shyamnamboodiripad/roslyn,jmarolf/roslyn,heejaechang/roslyn,KevinRansom/roslyn,tmat/roslyn,CyrusNajmabadi/roslyn,physhi/roslyn,jmarolf/roslyn,shyamnamboodiripad/roslyn,KirillOsenkov/roslyn,jmarolf/roslyn
src/Workspaces/Core/Portable/Editing/GenerationOptionsProvider.cs
src/Workspaces/Core/Portable/Editing/GenerationOptionsProvider.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Composition; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; namespace Microsoft.CodeAnalysis.Editing { [ExportOptionProvider, Shared] internal class GenerationOptionsProvider : IOptionProvider { [ImportingConstructor] public GenerationOptionsProvider() { } public ImmutableArray<IOption> Options { get; } = GenerationOptions.AllOptions; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Composition; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; namespace Microsoft.CodeAnalysis.Editing { [ExportOptionProvider, Shared] internal class GenerationOptionsProvider : IOptionProvider { [ImportingConstructor] public GenerationOptionsProvider() { } public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>( GenerationOptions.PlaceSystemNamespaceFirst); } }
mit
C#
b54eb56169e08757e85abe78b1113e7425108717
Move new judgement binding to `LoadComplete` to ensure containers are loaded
smoogipoo/osu,peppy/osu,peppy/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu
osu.Game/Screens/Play/HUD/HealthDisplay.cs
osu.Game/Screens/Play/HUD/HealthDisplay.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; namespace osu.Game.Screens.Play.HUD { /// <summary> /// A container for components displaying the current player health. /// Gets bound automatically to the <see cref="Rulesets.Scoring.HealthProcessor"/> when inserted to <see cref="DrawableRuleset.Overlays"/> hierarchy. /// </summary> public abstract class HealthDisplay : Container { private Bindable<bool> showHealthbar; [Resolved] protected HealthProcessor HealthProcessor { get; private set; } public Bindable<double> Current { get; } = new BindableDouble(1) { MinValue = 0, MaxValue = 1 }; protected virtual void Flash(JudgementResult result) { } [BackgroundDependencyLoader(true)] private void load(HUDOverlay hud) { Current.BindTo(HealthProcessor.Health); if (hud != null) { showHealthbar = hud.ShowHealthbar.GetBoundCopy(); showHealthbar.BindValueChanged(healthBar => this.FadeTo(healthBar.NewValue ? 1 : 0, HUDOverlay.FADE_DURATION, HUDOverlay.FADE_EASING), true); } } protected override void LoadComplete() { base.LoadComplete(); HealthProcessor.NewJudgement += onNewJudgement; } private void onNewJudgement(JudgementResult judgement) { if (judgement.IsHit && judgement.Type != HitResult.IgnoreHit) Flash(judgement); } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); if (HealthProcessor != null) HealthProcessor.NewJudgement -= onNewJudgement; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; namespace osu.Game.Screens.Play.HUD { /// <summary> /// A container for components displaying the current player health. /// Gets bound automatically to the <see cref="Rulesets.Scoring.HealthProcessor"/> when inserted to <see cref="DrawableRuleset.Overlays"/> hierarchy. /// </summary> public abstract class HealthDisplay : Container { private Bindable<bool> showHealthbar; [Resolved] protected HealthProcessor HealthProcessor { get; private set; } public Bindable<double> Current { get; } = new BindableDouble(1) { MinValue = 0, MaxValue = 1 }; protected virtual void Flash(JudgementResult result) { } [BackgroundDependencyLoader(true)] private void load(HUDOverlay hud) { Current.BindTo(HealthProcessor.Health); HealthProcessor.NewJudgement += onNewJudgement; if (hud != null) { showHealthbar = hud.ShowHealthbar.GetBoundCopy(); showHealthbar.BindValueChanged(healthBar => this.FadeTo(healthBar.NewValue ? 1 : 0, HUDOverlay.FADE_DURATION, HUDOverlay.FADE_EASING), true); } } private void onNewJudgement(JudgementResult judgement) { if (judgement.IsHit && judgement.Type != HitResult.IgnoreHit) Flash(judgement); } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); if (HealthProcessor != null) HealthProcessor.NewJudgement -= onNewJudgement; } } }
mit
C#
a856fdcd55f34d20cf4e36dd527af4de2d3c4f2a
Update StringExtensions.cs
UnityCommunity/UnityLibrary
Assets/Scripts/Extensions/StringExtensions.cs
Assets/Scripts/Extensions/StringExtensions.cs
using UnityEngine; using System.Globalization; // e.g. "#FFFFFF".ToColor() namespace UnityLibrary { public static class StringExtensions { public static Color ToColor(this string hex) { hex = hex.Replace("0x", ""); hex = hex.Replace("#", ""); byte a = 255; byte r = byte.Parse(hex.Substring(0,2), NumberStyles.HexNumber); byte g = byte.Parse(hex.Substring(2,2), NumberStyles.HexNumber); byte b = byte.Parse(hex.Substring(4,2), NumberStyles.HexNumber); if (hex.Length == 8) a = byte.Parse(hex.Substring(6,2), NumberStyles.HexNumber); return new Color32(r,g,b,a); } } }
using UnityEngine; using System.Globalization; namespace UnityLibrary { public static class StringExtensions { public static Color ToColor(this string hex) { hex = hex.Replace("0x", ""); hex = hex.Replace("#", ""); byte a = 255; byte r = byte.Parse(hex.Substring(0,2), NumberStyles.HexNumber); byte g = byte.Parse(hex.Substring(2,2), NumberStyles.HexNumber); byte b = byte.Parse(hex.Substring(4,2), NumberStyles.HexNumber); if (hex.Length == 8) a = byte.Parse(hex.Substring(6,2), NumberStyles.HexNumber); return new Color32(r,g,b,a); } } }
mit
C#
898c49c19db9ab54cd5eaf2bd91156aaac5b573d
remove unnecessary assignments
naoey/osu,NeoAdonis/osu,smoogipooo/osu,ZLima12/osu,EVAST9919/osu,peppy/osu,2yangk23/osu,ppy/osu,ZLima12/osu,UselessToucan/osu,johnneijzen/osu,Frontear/osuKyzer,ppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu-new,DrabWeb/osu,UselessToucan/osu,naoey/osu,NeoAdonis/osu,NeoAdonis/osu,Nabile-Rahmani/osu,2yangk23/osu,johnneijzen/osu,peppy/osu,EVAST9919/osu,DrabWeb/osu,peppy/osu,UselessToucan/osu,DrabWeb/osu,smoogipoo/osu,naoey/osu
osu.Game/Overlays/BeatmapSet/HeaderButton.cs
osu.Game/Overlays/BeatmapSet/HeaderButton.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Framework.Allocation; namespace osu.Game.Overlays.BeatmapSet { public class HeaderButton : TriangleButton { public HeaderButton() { Height = 0; RelativeSizeAxes = Axes.Y; } [BackgroundDependencyLoader] private void load() { BackgroundColour = OsuColour.FromHex(@"094c5f"); Triangles.ColourLight = OsuColour.FromHex(@"0f7c9b"); Triangles.ColourDark = OsuColour.FromHex(@"094c5f"); Triangles.TriangleScale = 1.5f; } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Framework.Allocation; namespace osu.Game.Overlays.BeatmapSet { public class HeaderButton : TriangleButton { public HeaderButton() { Height = 0; RelativeSizeAxes = Axes.Y; } [BackgroundDependencyLoader] private void load() { Masking = true; CornerRadius = 3; BackgroundColour = OsuColour.FromHex(@"094c5f"); Triangles.ColourLight = OsuColour.FromHex(@"0f7c9b"); Triangles.ColourDark = OsuColour.FromHex(@"094c5f"); Triangles.TriangleScale = 1.5f; } } }
mit
C#
0166a4795031f2f0a52f1751cad548a4c499a1d8
add route attribute for change accessibilty api
B1naryStudio/Azimuth,B1naryStudio/Azimuth
Azimuth/ApiControllers/PlaylistsController.cs
Azimuth/ApiControllers/PlaylistsController.cs
using System.IdentityModel; using System; using System.Management.Instrumentation; using System.Net; using System.Net.Http; using System.Threading.Tasks; using System.Web.Http; using Azimuth.Services; using Azimuth.Shared.Enums; namespace Azimuth.ApiControllers { public class PlaylistsController : ApiController { private readonly IPlaylistService _playlistService; public PlaylistsController(IPlaylistService playlistService) { _playlistService = playlistService; } [HttpGet] public HttpResponseMessage GetPublicPlaylists() { return Request.CreateResponse(HttpStatusCode.OK, _playlistService.GetPublicPlaylists()); } [HttpPut] [Route("api/playlists/put/")] public HttpResponseMessage SetPlaylistAccessibilty(int id, Accessibilty accessibilty) { try { _playlistService.SetAccessibilty(id, accessibilty); return Request.CreateResponse(HttpStatusCode.OK); } catch (BadRequestException ex) { return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message); } } [HttpGet] public async Task<HttpResponseMessage> GetPlayListById(int id) { try { return Request.CreateResponse(HttpStatusCode.OK, _playlistService.GetPlaylistById(id)); } catch (InstanceNotFoundException ex) { return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex); } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); } } } }
using System.IdentityModel;  using System; using System.Data.SqlClient; using System.IdentityModel; using System.Management.Instrumentation; using System.Net; using System.Net.Http; using System.Threading.Tasks; using System.Web.Http; using Azimuth.Services; using Azimuth.Shared.Enums; namespace Azimuth.ApiControllers { public class PlaylistsController : ApiController { private readonly IPlaylistService _playlistService; public PlaylistsController(IPlaylistService playlistService) { _playlistService = playlistService; } [HttpGet] public HttpResponseMessage GetPublicPlaylists() { return Request.CreateResponse(HttpStatusCode.OK, _playlistService.GetPublicPlaylists()); } [HttpPut] public HttpResponseMessage SetPlaylistAccessibilty(int playlistId, Accessibilty accessibilty) { try { _playlistService.SetAccessibilty(playlistId, accessibilty); return Request.CreateResponse(HttpStatusCode.OK); } catch (BadRequestException ex) { return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message); } } [HttpGet] public async Task<HttpResponseMessage> GetPlayListById(int id) { try { return Request.CreateResponse(HttpStatusCode.OK, _playlistService.GetPlaylistById(id)); } catch (InstanceNotFoundException ex) { return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex); } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); } } } }
mit
C#
b3943e706a721f5c7aef70d872e282d46ecdeada
Update List.cshtml
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/Units/List.cshtml
Battery-Commander.Web/Views/Units/List.cshtml
@model IEnumerable<Unit> <div class="page-header"> <h1>Units @Html.ActionLink("Add New", "New", "Units", null, new { @class = "btn btn-default btn-xs" })</h1> </div> <table class="table table-striped"> <thead> <tr> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Name)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().UIC)</th> <th></th> </tr> </thead> <tbody> @foreach (var unit in Model) { <tr> <td>@Html.DisplayFor(s => unit)</td> <td>@Html.DisplayFor(s => unit.UIC)</td> <td> @Html.ActionLink("Soldiers", "Index", "Soldiers", new { unit = unit.Id }, new { @class = "btn btn-default btn-xs" }) @Html.ActionLink("Vehicles", "Index", "Vehicles", new { Units = new int[] { unit.Id } }, new { @class = "btn btn-default btn-xs" }) @Html.ActionLink("Edit", "Edit", new { unit.Id }, new { @class = "btn btn-default btn-xs" }) @Html.RouteLink("Reports", "Unit.Reports", new { unitId = unit.Id }, new { @class = "btn btn-default btn-xs" }) </td> </tr> } </tbody> </table>
@model IEnumerable<Unit> <div class="page-header"> <h1>Units @Html.ActionLink("Add New", "New", "Units", null, new { @class = "btn btn-default btn-xs" })</h1> </div> <table class="table table-striped"> <thead> <tr> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Name)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().UIC)</th> <th></th> </tr> </thead> <tbody> @foreach (var unit in Model) { <tr> <td>@Html.DisplayFor(s => unit)</td> <td>@Html.DisplayFor(s => unit.UIC)</td> <td> @Html.ActionLink("Soldiers", "Index", "Soldiers", new { unit = unit.Id }, new { @class = "btn btn-default btn-xs" }) @Html.ActionLink("Vehicles", "Index", "Vehicles", new { Units = new int[] { unit.Id } }, new { @class = "btn btn-default btn-xs" }) @Html.ActionLink("Edit", "Edit", new { unit.Id }, new { @class = "btn btn-default btn-xs" }) @Html.RouteLink("Reports", "Unit.Reports", new { unit.Id }, new { @class = "btn btn-default btn-xs" }) </td> </tr> } </tbody> </table>
mit
C#
3e828a6521917bb2d0eac85b7f3668ff73415bae
Remove second build step from TC, thanks to Sean
rippo/testing.casperjs.presentation.vscode.50mins,rippo/testing.casperjs.presentation.vscode.50mins,rippo/testing.casperjs.presentation.vscode.50mins,rippo/testing.casperjs.presentation.vscode.50mins
Casper.Mvc/Casper.Mvc/Views/Home/Index.cshtml
Casper.Mvc/Casper.Mvc/Views/Home/Index.cshtml
@{ViewBag.Title = "Home";} <div class="jumbotron"> <h1>CasperJS Testing!!!</h1> <p>CasperJS is a navigation scripting & testing utility for PhantomJS written in Javascript</p> <p><a target="_blank" href="http://casperjs.org/" class="btn btn-primary btn-lg" role="button">Learn more</a></p> </div> <div class="row"> <div class="col-xs-1 imgbg"> <img src="~/Content/casperjs-logo.png" style="width: 100%;" /> </div> <div class="col-xs-5"> In case you haven’t seen CasperJS yet, go and take a look, it’s an extremely useful companion to PhantomJS. <a href="http://ariya.ofilabs.com/2012/03/phantomjs-and-travis-ci.html" target="_blank">Ariya Hidayat</a>, creator of Phantomjs </div> <div class="col-xs-1 imgbg"> <img src="~/Content/phantomjs-logo.png" style="width: 100%;" /> </div> <div class="col-xs-5"> <a href="http://phantomjs.org/" target="_blank">PhantomJS</a> is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. </div> </div>
@{ViewBag.Title = "Home";} <div class="jumbotron"> <h1>CasperJS Testing!</h1> <p>CasperJS is a navigation scripting & testing utility for PhantomJS written in Javascript</p> <p><a target="_blank" href="http://casperjs.org/" class="btn btn-primary btn-lg" role="button">Learn more</a></p> </div> <div class="row"> <div class="col-xs-1 imgbg"> <img src="~/Content/casperjs-logo.png" style="width: 100%;" /> </div> <div class="col-xs-5"> In case you haven’t seen CasperJS yet, go and take a look, it’s an extremely useful companion to PhantomJS. <a href="http://ariya.ofilabs.com/2012/03/phantomjs-and-travis-ci.html" target="_blank">Ariya Hidayat</a>, creator of Phantomjs </div> <div class="col-xs-1 imgbg"> <img src="~/Content/phantomjs-logo.png" style="width: 100%;" /> </div> <div class="col-xs-5"> <a href="http://phantomjs.org/" target="_blank">PhantomJS</a> is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. </div> </div>
mit
C#
c369ecea27a4cfa48fbe5708d0188d249b4ff521
Bump Build
tsebring/ArkSavegameToolkitNet
ArkSavegameToolkitNet/Properties/AssemblyInfo.cs
ArkSavegameToolkitNet/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("ARK Savegame Toolkit .NET")] [assembly: AssemblyDescription("Library for reading ARK Survival Evolved savegame files using .NET.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ArkSavegameToolkitNet")] [assembly: AssemblyCopyright("Copyright © 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)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2b78ed8e-a311-49bd-b4ac-8787f829ad17")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.9.0.2")] [assembly: AssemblyFileVersion("1.9.0.2")] [assembly: InternalsVisibleTo("ArkSavegameToolkitNet.Domain")]
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("ARK Savegame Toolkit .NET")] [assembly: AssemblyDescription("Library for reading ARK Survival Evolved savegame files using .NET.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ArkSavegameToolkitNet")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2b78ed8e-a311-49bd-b4ac-8787f829ad17")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.9.0.0")] [assembly: AssemblyFileVersion("1.9.0.0")] [assembly: InternalsVisibleTo("ArkSavegameToolkitNet.Domain")]
mit
C#
c5a073cee84589a4ed093610b5374f44037f8069
Improve enable paybutton view
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
BTCPayServer/Views/Stores/PayButtonEnable.cshtml
BTCPayServer/Views/Stores/PayButtonEnable.cshtml
@{ Layout = "../Shared/_NavLayout.cshtml"; ViewData.SetActivePageAndTitle(StoreNavPages.PayButton, "Please confirm you want to allow outside world to create invoices in your store (via API)."); ViewBag.MainTitle = "Pay Button"; } <div class="row"> <div class="col-md-10"> <form method="post"> <div class="form-group"> <p> To start using Pay Buttons you need to explicitly turn on this feature. Once you do so, any 3rd party entity will be able to create an invoice on your instance store (via API for example). The POS app is preauthorised and does not need this enabled. </p> @Html.Hidden("EnableStore", true) <button name="command" type="submit" value="save" class="btn btn-lg btn-primary px-4"> Allow outside world to create invoices via API </button> </div> </form> </div> </div>
@{ Layout = "../Shared/_NavLayout.cshtml"; ViewData.SetActivePageAndTitle(StoreNavPages.PayButton, "Please confirm you want to allow outside world to create invoices in your store (via API)."); ViewBag.MainTitle = "Pay Button"; } <div class="row"> <div class="col-md-10"> <form method="post"> <div class="form-group"> <p> To start using Pay Buttons you need to explicitly turn on this feature. Once you do so, any 3rd party entity will be able to create an invoice on your instance store (via API for example). </p> @Html.Hidden("EnableStore", true) <button name="command" type="submit" value="save" class="btn btn-primary">Allow outside world to create invoices via API (POS app is preauthorised and does not need this enabled).</button> </div> </form> </div> </div>
mit
C#
3e4d5a81ab681e6dc7db1ed452878cce0c657edb
Update IExchangeRateRepository.cs
tiksn/TIKSN-Framework
TIKSN.Core/Finance/ForeignExchange/Data/IExchangeRateRepository.cs
TIKSN.Core/Finance/ForeignExchange/Data/IExchangeRateRepository.cs
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using TIKSN.Data; namespace TIKSN.Finance.ForeignExchange.Data { public interface IExchangeRateRepository : IQueryRepository<ExchangeRateEntity, int>, IRepository<ExchangeRateEntity> { Task<ExchangeRateEntity> GetOrDefaultAsync( int foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTimeOffset asOn, CancellationToken cancellationToken); Task<int> GetMaximalIdAsync(CancellationToken cancellationToken); Task<IReadOnlyCollection<ExchangeRateEntity>> SearchAsync( int foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTimeOffset dateFrom, DateTimeOffset dateTo, CancellationToken cancellationToken); } }
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using TIKSN.Data; namespace TIKSN.Finance.ForeignExchange.Data { public interface IExchangeRateRepository : IQueryRepository<ExchangeRateEntity, int>, IRepository<ExchangeRateEntity> { Task<ExchangeRateEntity> GetOrDefaultAsync( int foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTimeOffset asOn, CancellationToken cancellationToken); Task<int> GetMaximalIdAsync(CancellationToken cancellationToken); Task<IReadOnlyCollection<ExchangeRateEntity>> SearchAsync( int foreignExchangeID, string baseCurrencyCode, string counterCurrencyCode, DateTimeOffset dateFrom, DateTimeOffset dateTo, CancellationToken cancellationToken); } }
mit
C#