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
ddbff6c3af36c4287ab97303072b81c73a8dffe2
Fix detectors link to the slot
projectkudu/kudu,projectkudu/kudu,EricSten-MSFT/kudu,projectkudu/kudu,EricSten-MSFT/kudu,projectkudu/kudu,EricSten-MSFT/kudu,projectkudu/kudu,EricSten-MSFT/kudu,EricSten-MSFT/kudu
Kudu.Services.Web/Detectors/Default.cshtml
Kudu.Services.Web/Detectors/Default.cshtml
@{ var ownerName = Environment.GetEnvironmentVariable("WEBSITE_OWNER_NAME") ?? ""; var subscriptionId = ownerName; var resourceGroup = Environment.GetEnvironmentVariable("WEBSITE_RESOURCE_GROUP") ?? ""; var siteName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") ?? ""; var hostName = Environment.GetEnvironmentVariable("HTTP_HOST") ?? ""; var index = ownerName.IndexOf('+'); if (index >= 0) { subscriptionId = ownerName.Substring(0, index); } string detectorPath; if (Kudu.Core.Helpers.OSDetector.IsOnWindows()) { detectorPath = "diagnostics%2Favailability%2Fanalysis"; } else { detectorPath = "detectors%2FLinuxAppDown"; } var hostNameIndex = hostName.IndexOf('.'); if (hostNameIndex >= 0) { hostName = hostName.Substring(0, hostNameIndex); } var runtimeSuffxIndex = siteName.IndexOf("__"); if (runtimeSuffxIndex >= 0) { siteName = siteName.Substring(0, runtimeSuffxIndex); } // Get the slot name if (!hostName.Equals(siteName, StringComparison.CurrentCultureIgnoreCase)) { var slotNameIndex = siteName.Length; if (hostName.Length > slotNameIndex && hostName[slotNameIndex] == '-') { // Fix up hostName by replacing "-SLOTNAME" with "/slots/SLOTNAME" var slotName = hostName.Substring(slotNameIndex + 1); hostName = hostName.Substring(0, slotNameIndex) + "/slots/" + slotName; } } var detectorDeepLink = "https://portal.azure.com/?websitesextension_ext=asd.featurePath%3D" + detectorPath + "#resource/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Web/sites/" + hostName + "/troubleshoot"; Response.Redirect(detectorDeepLink); }
@{ var ownerName = Environment.GetEnvironmentVariable("WEBSITE_OWNER_NAME") ?? ""; var subscriptionId = ownerName; var resourceGroup = Environment.GetEnvironmentVariable("WEBSITE_RESOURCE_GROUP") ?? ""; var siteName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") ?? ""; var index = ownerName.IndexOf('+'); if (index >= 0) { subscriptionId = ownerName.Substring(0, index); } string detectorPath; if (Kudu.Core.Helpers.OSDetector.IsOnWindows()) { detectorPath = "diagnostics%2Favailability%2Fanalysis"; } else { detectorPath = "detectors%2FLinuxAppDown"; } var detectorDeepLink = "https://portal.azure.com/?websitesextension_ext=asd.featurePath%3D" + detectorPath + "#resource/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Web/sites/" + siteName + "/troubleshoot"; Response.Redirect(detectorDeepLink); }
apache-2.0
C#
ba1ab7ade47c01e37fe55c8d4995e5d8b2b46966
Remove unused fields
JLChnToZ/LuckyPlayer
LuckyPlayer/LuckyPlayer/LuckyController.cs
LuckyPlayer/LuckyPlayer/LuckyController.cs
using System; using JLChnToZ.LuckyPlayer.WeightedRandomizer; namespace JLChnToZ.LuckyPlayer { /// <summary> /// A dynamic weight controller but will affects by and to the player's luckyness. /// </summary> /// <typeparam name="T"></typeparam> /// <remarks>You can inherit this class to add customizaton</remarks> public class LuckyController<T>: IItemWeight<T>, ISuccessCallback<T> { internal protected readonly double rare; internal protected double baseRarity; internal protected PlayerLuck luckInstance; internal protected double fineTune; internal protected DestinyTuner<T> destinyTuner; /// <summary> /// Constructor. /// </summary> /// <param name="rare">The rarity which will affects the player's luckyness.</param> /// <param name="baseRarity">Alterable rarity value</param> public LuckyController(double rare, double baseRarity = 1, DestinyTuner<T> destinyTuner = null) { this.rare = rare; this.baseRarity = baseRarity; this.destinyTuner = destinyTuner ?? DestinyTuner<T>.Default; ResetFineTuneWeight(); } /// <summary> /// Same usage as <see cref="IItemWeight{T}.GetWeight(T)"/> /// </summary> public virtual double GetWeight(T item) { if(luckInstance == null) return baseRarity / Math.Pow(2, rare); return baseRarity * Math.Pow(2, luckInstance.Luckyness - rare) * fineTune; } /// <summary> /// Calls when on item successfully selected, it will take away a bit probs by percentage of <see cref="fineTuneOnSuccess"/>. /// </summary> /// <param name="item">The selected item</param> public virtual void OnSuccess(T item) { destinyTuner.TuneDestinyOnSuccess(this); } internal protected virtual void ResetFineTuneWeight() { fineTune = 1; } } }
using System; using JLChnToZ.LuckyPlayer.WeightedRandomizer; namespace JLChnToZ.LuckyPlayer { /// <summary> /// A dynamic weight controller but will affects by and to the player's luckyness. /// </summary> /// <typeparam name="T"></typeparam> /// <remarks>You can inherit this class to add customizaton</remarks> public class LuckyController<T>: IItemWeight<T>, ISuccessCallback<T> { /// <summary> /// Take a couple percentage of probs when success. /// </summary> public static double fineTuneOnSuccess = -0.0001; internal protected readonly double rare; internal protected double baseRarity; internal protected PlayerLuck luckInstance; internal protected double fineTune; internal protected DestinyTuner<T> destinyTuner; /// <summary> /// Constructor. /// </summary> /// <param name="rare">The rarity which will affects the player's luckyness.</param> /// <param name="baseRarity">Alterable rarity value</param> public LuckyController(double rare, double baseRarity = 1, DestinyTuner<T> destinyTuner = null) { this.rare = rare; this.baseRarity = baseRarity; this.destinyTuner = destinyTuner ?? DestinyTuner<T>.Default; ResetFineTuneWeight(); } /// <summary> /// Same usage as <see cref="IItemWeight{T}.GetWeight(T)"/> /// </summary> public virtual double GetWeight(T item) { if(luckInstance == null) return baseRarity / Math.Pow(2, rare); return baseRarity * Math.Pow(2, luckInstance.Luckyness - rare) * fineTune; } /// <summary> /// Calls when on item successfully selected, it will take away a bit probs by percentage of <see cref="fineTuneOnSuccess"/>. /// </summary> /// <param name="item">The selected item</param> public virtual void OnSuccess(T item) { destinyTuner.TuneDestinyOnSuccess(this); } internal protected virtual void ResetFineTuneWeight() { fineTune = 1; } } }
mit
C#
61f6319b4add64c31a2de3576db988689fa024a3
添加了对AppDomain应用域的未捕获异常的处理。 :palm_tree: :shirt:
Zongsoft/Zongsoft.Daemon.Launcher
Program.cs
Program.cs
/* * Authors: * 钟峰(Popeye Zhong) <zongsoft@gmail.com> * * Copyright (C) 2013 Zongsoft Corporation <http://www.zongsoft.com> * * This file is part of Zongsoft.Daemon.Launcher. * * Zongsoft.Daemon.Launcher is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * Zongsoft.Daemon.Launcher 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 * Lesser General Public License for more details. * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * You should have received a copy of the GNU Lesser General Public * License along with Zongsoft.Daemon.Launcher; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ using System; namespace Zongsoft.Daemon.Launcher { internal static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> internal static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException; Zongsoft.Plugins.Application.Start(ApplicationContext.Current, args); } private static void AppDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var exception = e.ExceptionObject as Exception; var level = e.IsTerminating ? Zongsoft.Diagnostics.LogLevel.Fatal : Zongsoft.Diagnostics.LogLevel.Error; if(exception == null) Zongsoft.Diagnostics.Logger.Log(level, "UnhandledException", e.ExceptionObject); else Zongsoft.Diagnostics.Logger.Log(level, exception); } } }
/* * Authors: * 钟峰(Popeye Zhong) <zongsoft@gmail.com> * * Copyright (C) 2013 Zongsoft Corporation <http://www.zongsoft.com> * * This file is part of Zongsoft.Daemon.Launcher. * * Zongsoft.Daemon.Launcher is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * Zongsoft.Daemon.Launcher 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 * Lesser General Public License for more details. * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * You should have received a copy of the GNU Lesser General Public * License along with Zongsoft.Daemon.Launcher; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ using System; namespace Zongsoft.Daemon.Launcher { internal static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> internal static void Main(string[] args) { Zongsoft.Plugins.Application.Start(ApplicationContext.Current, args); } } }
lgpl-2.1
C#
241ba1d81c50ec64f8d6389e749c77bca0e27285
Revert "add cache for optional conversations. (C# to F#)"
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
Tweek.JPad.Utils/JPadRulesParserAdapter.cs
Tweek.JPad.Utils/JPadRulesParserAdapter.cs
using Engine.Core.Context; using Engine.Core.Rules; using Engine.DataTypes; using Tweek.JPad; using LanguageExt; using System; namespace Tweek.JPad.Utils { public class AnonymousRule : IRule { private readonly Func<GetContextValue, Option<ConfigurationValue>> fn; public AnonymousRule(Func<GetContextValue, Option<ConfigurationValue>> fn) { this.fn = fn; } public Option<ConfigurationValue> GetValue(GetContextValue fullContext) => fn(fullContext); } public class AnonymousParser : IRuleParser { private readonly Func<string, IRule> fn; public AnonymousParser(Func<string, IRule> fn) { this.fn = fn; } public IRule Parse(string source) => fn(source); } public class JPadRulesParserAdapter { public static IRuleParser Convert(JPadParser parser) { return new AnonymousParser((source) => { var compiled = parser.Parse.Invoke(source); return new AnonymousRule(context => FSharp.fs(compiled.Invoke((s) => context.Invoke(s).ToFSharp())) .Map(ConfigurationValue.New)); }); } } }
using Engine.Core.Context; using Engine.Core.Rules; using Engine.DataTypes; using Tweek.JPad; using System.Collections.Specialized; using LanguageExt; using System; namespace Tweek.JPad.Utils { public class AnonymousRule : IRule { private readonly Func<GetContextValue, Option<ConfigurationValue>> fn; public AnonymousRule(Func<GetContextValue, Option<ConfigurationValue>> fn) { this.fn = fn; } public Option<ConfigurationValue> GetValue(GetContextValue fullContext) => fn(fullContext); } public class AnonymousParser : IRuleParser { private readonly Func<string, IRule> fn; public AnonymousParser(Func<string, IRule> fn) { this.fn = fn; } public IRule Parse(string source) => fn(source); } public class JPadRulesParserAdapter { public static IRuleParser Convert(JPadParser parser) { return new AnonymousParser((source) => { var dictionary = new ListDictionary(); var compiled = parser.Parse.Invoke(source); return new AnonymousRule(context => FSharp.fs(compiled.Invoke((s) => { if (!dictionary.Contains(s)) { dictionary[s] = context.Invoke(s).ToFSharp(); } return (Microsoft.FSharp.Core.FSharpOption<string>)dictionary[s]; })).Map(ConfigurationValue.New)); }); } } }
mit
C#
f92e8425be868c76f4d6091551da3c026906263b
Add move towards method for vectors
dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo
DynamixelServo.Quadruped/Vector3Extensions.cs
DynamixelServo.Quadruped/Vector3Extensions.cs
using System.Numerics; namespace DynamixelServo.Quadruped { public static class Vector3Extensions { public static Vector3 Normal(this Vector3 vector) { return Vector3.Normalize(vector); } public static bool Similar(this Vector3 a, Vector3 b, float marginOfError = float.Epsilon) { return Vector3.Distance(a, b) <= marginOfError; } public static Vector3 MoveTowards(this Vector3 current, Vector3 target, float distance) { var transport = target - current; var len = transport.Length(); if (len < distance) { return target; } return current + transport.Normal() * distance; } } }
using System.Numerics; namespace DynamixelServo.Quadruped { public static class Vector3Extensions { public static Vector3 Normal(this Vector3 vector) { return Vector3.Normalize(vector); } public static bool Similar(this Vector3 a, Vector3 b, float marginOfError = float.Epsilon) { return Vector3.Distance(a, b) <= marginOfError; } } }
apache-2.0
C#
07e252cb3739521c367de5c27975b015de46516a
fix and licenses
eljeko/Untiled2D
Assets/PixelPerfectCamera.cs
Assets/PixelPerfectCamera.cs
/* * * Copyright 2014 Stefano Linguerri * * 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. * */ /** * For this Script thanks to: * * http://aidtech-game.com/pixel-perfect-camera-unity-2d/ * bu Alan Mcklin * */ using UnityEngine; using System.Collections; public class PixelPerfectCamera : MonoBehaviour { float unitsPerPixel; public float textureUnitsSize = 100f; void Start () { unitsPerPixel = 1f / textureUnitsSize; Camera.main.orthographicSize = (Screen.height / 2f) * unitsPerPixel; } }
/* * * Copyright 2014 Stefano Linguerri * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using UnityEngine; using System.Collections; public class PixelPerfectCamera : MonoBehaviour { float unitsPerPixel; public float textureUnitsSize = 100f; void Start () { unitsPerPixel = 1f / textureUnitsSize; Camera.main.orthographicSize = (Screen.height / 2f) * unitsPerPixel; } }
apache-2.0
C#
a8894285e3eceeb3622ad35979f9c3d1874dd7d6
move comment next to moved impl
ServiceStack/ServiceStack.Examples,zhaokunfay/ServiceStack.Examples,zhaokunfay/ServiceStack.Examples,ServiceStack/ServiceStack.Examples,assaframan/MoviesRestForAppHarbor,zhaokunfay/ServiceStack.Examples,ServiceStack/ServiceStack.Examples,ServiceStack/ServiceStack.Examples,assaframan/MoviesRestForAppHarbor,assaframan/MoviesRestForAppHarbor,zhaokunfay/ServiceStack.Examples
src/Backbone.Todos/Global.asax.cs
src/Backbone.Todos/Global.asax.cs
using System; using ServiceStack.Redis; using ServiceStack.ServiceInterface; using ServiceStack.WebHost.Endpoints; //The entire C# source code for the ServiceStack + Redis TODO REST backend. There is no other .cs :) namespace Backbone.Todos { //REST Resource DTO public class Todo { public long Id { get; set; } public string Content { get; set; } public int Order { get; set; } public bool Done { get; set; } } //Todo REST Service implementation public class TodoService : RestServiceBase<Todo> { public IRedisClientsManager RedisManager { get; set; } //Injected by IOC public override object OnGet(Todo request) { //return all todos if (request.Id == default(long)) return RedisManager.ExecAs<Todo>(r => r.GetAll()); //return single todo return RedisManager.ExecAs<Todo>(r => r.GetById(request.Id)); } //Handles creaing a new and updating existing todo public override object OnPost(Todo todo) { RedisManager.ExecAs<Todo>(r => { //Get next id for new todo if (todo.Id == default(long)) todo.Id = r.GetNextSequence(); r.Store(todo); }); return todo; } public override object OnDelete(Todo request) { RedisManager.ExecAs<Todo>(r => r.DeleteById(request.Id)); return null; } } //Configure ServiceStack.NET web service host public class AppHost : AppHostBase { //Tell ServiceStack the name and where to find your web services public AppHost() : base("Backbone.js TODO", typeof(TodoService).Assembly) { } public override void Configure(Funq.Container container) { //Register Redis factory in Funq IOC container.Register<IRedisClientsManager>(new BasicRedisClientManager("localhost:6379")); //Register user-defined REST Paths Routes .Add<Todo>("/todos") .Add<Todo>("/todos/{Id}"); } } public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { new AppHost().Init(); //Start ServiceStack App } } }
using System; using ServiceStack.Redis; using ServiceStack.ServiceInterface; using ServiceStack.WebHost.Endpoints; //The entire C# source code for the ServiceStack + Redis TODO REST backend. There is no other .cs :) namespace Backbone.Todos { //Register REST Paths public class Todo //REST Resource DTO { public long Id { get; set; } public string Content { get; set; } public int Order { get; set; } public bool Done { get; set; } } //Todo REST Service implementation public class TodoService : RestServiceBase<Todo> { public IRedisClientsManager RedisManager { get; set; } //Injected by IOC public override object OnGet(Todo request) { //return all todos if (request.Id == default(long)) return RedisManager.ExecAs<Todo>(r => r.GetAll()); //return single todo return RedisManager.ExecAs<Todo>(r => r.GetById(request.Id)); } //Handles creaing a new and updating existing todo public override object OnPost(Todo todo) { RedisManager.ExecAs<Todo>(r => { //Get next id for new todo if (todo.Id == default(long)) todo.Id = r.GetNextSequence(); r.Store(todo); }); return todo; } public override object OnDelete(Todo request) { RedisManager.ExecAs<Todo>(r => r.DeleteById(request.Id)); return null; } } //Configure ServiceStack.NET web service host public class AppHost : AppHostBase { //Tell ServiceStack the name and where to find your web services public AppHost() : base("Backbone.js TODO", typeof(TodoService).Assembly) { } public override void Configure(Funq.Container container) { //Register Redis factory in Funq IOC container.Register<IRedisClientsManager>(new BasicRedisClientManager("localhost:6379")); Routes .Add<Todo>("/todos") .Add<Todo>("/todos/{Id}"); } } public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { new AppHost().Init(); //Start ServiceStack App } } }
bsd-3-clause
C#
d0900465ddedd0652d99dd66ed76728189715446
Remove prerelease tag from CommonAssemblyInfo.cs
chocolatey/nuget-chocolatey,indsoft/NuGet2,chocolatey/nuget-chocolatey,chocolatey/nuget-chocolatey,indsoft/NuGet2,chocolatey/nuget-chocolatey,indsoft/NuGet2,indsoft/NuGet2,indsoft/NuGet2,chocolatey/nuget-chocolatey,indsoft/NuGet2,chocolatey/nuget-chocolatey
Common/CommonAssemblyInfo.cs
Common/CommonAssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Outercurve Foundation")] [assembly: AssemblyProduct("NuGet")] [assembly: AssemblyCopyright("\x00a9 Outercurve Foundation. All rights reserved.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] // When built on the build server, the NuGet release version is specified in // Build\Build.proj. // When built locally, the NuGet release version is the values specified in this file. #if !FIXED_ASSEMBLY_VERSION [assembly: AssemblyVersion("2.8.3.0")] [assembly: AssemblyInformationalVersion("2.8.3")] #endif [assembly: NeutralResourcesLanguage("en-US")]
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Outercurve Foundation")] [assembly: AssemblyProduct("NuGet")] [assembly: AssemblyCopyright("\x00a9 Outercurve Foundation. All rights reserved.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] // When built on the build server, the NuGet release version is specified in // Build\Build.proj. // When built locally, the NuGet release version is the values specified in this file. #if !FIXED_ASSEMBLY_VERSION [assembly: AssemblyVersion("2.8.3.0")] [assembly: AssemblyInformationalVersion("2.8.3-alpha0001")] #endif [assembly: NeutralResourcesLanguage("en-US")]
apache-2.0
C#
9902fc9a72ac6c887ef5404af10a4bf747396159
Improve label
Sebazzz/IFS,Sebazzz/IFS,Sebazzz/IFS,Sebazzz/IFS
src/IFS.Web/Models/UploadModel.cs
src/IFS.Web/Models/UploadModel.cs
// ****************************************************************************** // © 2016 Sebastiaan Dammann - damsteen.nl // // File: : UploadModel.cs // Project : IFS.Web // ****************************************************************************** namespace IFS.Web.Models { using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Core; using Core.Upload; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Rendering; public class UploadModel { public FileIdentifier FileIdentifier { get; set; } [Required(ErrorMessage = "Please select a file to upload")] [FileSizeValidation] [Display(Name = "Your file")] public IFormFile File { get; set; } [Display] public DateTime Expiration { get; set; } [Display(Name = "When will the file expiration start counting?")] public ExpirationMode ExpirationMode { get; set; } public long SuggestedFileSize { get; set; } public IEnumerable<SelectListItem> AvailableExpiration { get; set; } } public class UploadFileInProgressModel { public string FileName { get; set; } public FileIdentifier FileIdentifier { get; set; } } public class UploadProgressModel { public long Current { get; set; } public long Total { get; set; } public string FileName { get; set; } public string Performance { get; set; } public int Percent { get; set; } } }
// ****************************************************************************** // © 2016 Sebastiaan Dammann - damsteen.nl // // File: : UploadModel.cs // Project : IFS.Web // ****************************************************************************** namespace IFS.Web.Models { using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Core; using Core.Upload; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Rendering; public class UploadModel { public FileIdentifier FileIdentifier { get; set; } [Required(ErrorMessage = "Please select a file to upload")] [FileSizeValidation] [Display(Name = "Your file")] public IFormFile File { get; set; } [Display] public DateTime Expiration { get; set; } [Display(Name = "When will the file expire?")] public ExpirationMode ExpirationMode { get; set; } public long SuggestedFileSize { get; set; } public IEnumerable<SelectListItem> AvailableExpiration { get; set; } } public class UploadFileInProgressModel { public string FileName { get; set; } public FileIdentifier FileIdentifier { get; set; } } public class UploadProgressModel { public long Current { get; set; } public long Total { get; set; } public string FileName { get; set; } public string Performance { get; set; } public int Percent { get; set; } } }
mit
C#
4be3379ad24159ef32acb919564c64e6468e98c3
Clean up test results from previous build
lockoncode/LockOnCode.VirtualMachine,lockoncode/LockOnCode.VirtualMachine
build.cake
build.cake
#addin "Cake.Incubator" #tool "nuget:?package=xunit.runner.console" var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); // Path to the project.json var projDir = ""; // Project Directory var solutionFile = "LockOnCode.VirtualMachine.sln"; // Solution file if needed var outputDir = Directory("Build") + Directory(configuration); // The output directory the build artifacts saved too var report = outputDir; var xunitReport = report; var buildSettings = new DotNetCoreBuildSettings { Framework = "netcoreapp1.1", Configuration = "Release", OutputDirectory = outputDir }; Task("Clean") .Does(() => { if (DirectoryExists(outputDir)) { DeleteDirectory(outputDir, recursive:true); } //Clean test output var directoryToScanForTestResults = "./**/*.prx"; var testResultFiles = GetFiles(directoryToScanForTestResults); DeleteFiles(testResultFiles); }); Task("Restore") .Does(() => { DotNetCoreRestore(solutionFile); }); Task("Build") .IsDependentOn("Clean") .IsDependentOn("Restore") .Does(() => { DotNetCoreBuild(solutionFile, buildSettings); }); Task("UnitTest") .IsDependentOn("Build") .Does(() => { Information("Start Running Tests"); var testSettings = new DotNetCoreTestSettings { NoBuild = true, DiagnosticOutput = true, Configuration = "Debug", Logger = "trx", OutputDirectory = outputDir }; Information(Environment.CurrentDirectory); var directoryToScanForTests = "./**/*Tests.csproj"; Information("Scanning directory for tests: " + directoryToScanForTests); var testProjects = GetFiles(directoryToScanForTests); foreach(var testProject in testProjects) { Information("Found Test Project: " + testProject); DotNetCoreTest(testProject.ToString(), testSettings); } }); Task("Package") .IsDependentOn("Build") .Does(() => { var packSettings = new DotNetCorePackSettings { OutputDirectory = outputDir, NoBuild = true }; //DotNetCorePack(projJson, packSettings); }); ////////////////////////////////////////////////////////////////////// // TASK TARGETS ////////////////////////////////////////////////////////////////////// Task("Default") .IsDependentOn("UnitTest"); ////////////////////////////////////////////////////////////////////// // EXECUTION ////////////////////////////////////////////////////////////////////// RunTarget(target);
#addin "Cake.Incubator" #tool "nuget:?package=xunit.runner.console" var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); // Path to the project.json var projDir = ""; // Project Directory var solutionFile = "LockOnCode.VirtualMachine.sln"; // Solution file if needed var outputDir = Directory("Build") + Directory(configuration); // The output directory the build artifacts saved too var report = outputDir; var xunitReport = report; var buildSettings = new DotNetCoreBuildSettings { Framework = "netcoreapp1.1", Configuration = "Release", OutputDirectory = outputDir }; Task("Clean") .Does(() => { if (DirectoryExists(outputDir)) { DeleteDirectory(outputDir, recursive:true); } }); Task("Restore") .Does(() => { DotNetCoreRestore(solutionFile); }); Task("Build") .IsDependentOn("Clean") .IsDependentOn("Restore") .Does(() => { DotNetCoreBuild(solutionFile, buildSettings); }); Task("UnitTest") .IsDependentOn("Build") .Does(() => { Information("Start Running Tests"); var testSettings = new DotNetCoreTestSettings { NoBuild = true, DiagnosticOutput = true, Configuration = "Debug", Logger = "trx", OutputDirectory = outputDir }; Information(Environment.CurrentDirectory); var directoryToScanForTests = "./**/*Tests.csproj"; Information("Scanning directory for tests: " + directoryToScanForTests); var testProjects = GetFiles(directoryToScanForTests); foreach(var testProject in testProjects) { Information("Found Test Project: " + testProject); DotNetCoreTest(testProject.ToString(), testSettings); } }); Task("Package") .IsDependentOn("Build") .Does(() => { var packSettings = new DotNetCorePackSettings { OutputDirectory = outputDir, NoBuild = true }; //DotNetCorePack(projJson, packSettings); }); ////////////////////////////////////////////////////////////////////// // TASK TARGETS ////////////////////////////////////////////////////////////////////// Task("Default") .IsDependentOn("UnitTest"); ////////////////////////////////////////////////////////////////////// // EXECUTION ////////////////////////////////////////////////////////////////////// RunTarget(target);
mit
C#
8e4e83d39eb35aad46036464672acf3d60e6d0c5
Fix build issues with 4.12
serioussam909/UE4-DialogueSystem,artemavrin/UE4-DialogueSystem,artemavrin/UE4-DialogueSystem,serioussam909/UE4-DialogueSystem,artemavrin/UE4-DialogueSystem,serioussam909/UE4-DialogueSystem
Source/DialogueSystem/DialogueSystem.Build.cs
Source/DialogueSystem/DialogueSystem.Build.cs
//Copyright (c) 2016 Artem A. Mavrin and other contributors using UnrealBuildTool; public class DialogueSystem : ModuleRules { public DialogueSystem(TargetInfo Target) { PrivateIncludePaths.AddRange( new string[] {"DialogueSystem/Private"}); PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", "UMG", "SlateCore", "Slate", "AIModule", "GameplayTasks" } ); } }
//Copyright (c) 2016 Artem A. Mavrin and other contributors using UnrealBuildTool; public class DialogueSystem : ModuleRules { public DialogueSystem(TargetInfo Target) { PrivateIncludePaths.AddRange( new string[] {"DialogueSystem/Private"}); PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", "UMG", "SlateCore", "Slate", "AIModule" } ); } }
mit
C#
d17942e79c70fe12ad0098b683979dbbad874686
Update expression to match dots following dots
mlorbetske/templating,mlorbetske/templating
src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ValueForms/DefaultSafeNamespaceValueFormModel.cs
src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ValueForms/DefaultSafeNamespaceValueFormModel.cs
using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Newtonsoft.Json.Linq; namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects.ValueForms { public class DefaultSafeNamespaceValueFormModel : IValueForm { public DefaultSafeNamespaceValueFormModel() { } public static readonly string FormName = "safe_namespace"; public virtual string Identifier => FormName; public string Name => Identifier; public IValueForm FromJObject(string name, JObject configuration) { throw new NotImplementedException(); } public virtual string Process(IReadOnlyDictionary<string, IValueForm> forms, string value) { string workingValue = Regex.Replace(value, @"(^\s+|\s+$)", ""); workingValue = Regex.Replace(workingValue, @"(((?<=\.)|^)((?=\d)|\.)|[^\w\.])", "_"); return workingValue; } } }
using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Newtonsoft.Json.Linq; namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects.ValueForms { public class DefaultSafeNamespaceValueFormModel : IValueForm { public DefaultSafeNamespaceValueFormModel() { } public static readonly string FormName = "safe_namespace"; public virtual string Identifier => FormName; public string Name => Identifier; public IValueForm FromJObject(string name, JObject configuration) { throw new NotImplementedException(); } public virtual string Process(IReadOnlyDictionary<string, IValueForm> forms, string value) { string workingValue = Regex.Replace(value, @"(^\s+|\s+$)", ""); workingValue = Regex.Replace(workingValue, @"(((?<=\.)|^)(?=\d)|[^\w\.])", "_"); return workingValue; } } }
mit
C#
e5a41aff8def250c6c0ea69798fbdb5661535d47
Update ILoggingSetup.cs
tiksn/TIKSN-Framework
TIKSN.Core/Analytics/Logging/ILoggingSetup.cs
TIKSN.Core/Analytics/Logging/ILoggingSetup.cs
using Microsoft.Extensions.Logging; namespace TIKSN.Analytics.Logging { public interface ILoggingSetup { void Setup(ILoggingBuilder loggingBuilder); } }
using Microsoft.Extensions.Logging; namespace TIKSN.Analytics.Logging { public interface ILoggingSetup { void Setup(ILoggingBuilder loggingBuilder); } }
mit
C#
59eba96e9f61d5febd894fc4fa77e6cb59638e1c
Fix ProblemDescription Tests
bluehands/WebApiHypermediaExtensions,bluehands/WebApiHypermediaExtensions
Source/RESTyard.Client.Extensions/Extensions.Test/ProblemStringReaderTests/JsonProblemStringReaderTestBase.cs
Source/RESTyard.Client.Extensions/Extensions.Test/ProblemStringReaderTests/JsonProblemStringReaderTestBase.cs
namespace Extensions.Test.ProblemStringReaderTests { public class JsonProblemStringReaderTestBase : ProblemStringReaderTestBase { public virtual void Initializer() { ProblemString = @"{ ""Title"": ""SomeProblem"", ""Type"": ""UnitTestProblem"", ""Detail"": ""This Unit Test was unexpectedly green"", ""Status"": 42 }"; } } }
namespace Extensions.Test.ProblemStringReaderTests { public class JsonProblemStringReaderTestBase : ProblemStringReaderTestBase { public virtual void Initializer() { ProblemString = @"{ ""Title"": ""SomeProblem"", ""ProblemType"": ""UnitTestProblem"", ""Detail"": ""This Unit Test was unexpectedly green"", ""StatusCode"": 42 }"; } } }
mit
C#
4c1db5602fc9596dbba4ae86380ec400a79c5da2
バージョン番号を更新。
YKSoftware/YKToolkit.Controls
YKToolkit.Controls/Properties/AssemblyInfo.cs
YKToolkit.Controls/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("YKToolkit.Controls")] #if NET4 [assembly: AssemblyDescription(".NET Framework 4.0 用 の WPF カスタムコントロールライブラリです。")] #else [assembly: AssemblyDescription("WPF カスタムコントロールライブラリです。")] #endif [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("YKSoftware")] [assembly: AssemblyProduct("YKToolkit.Controls")] [assembly: AssemblyCopyright("Copyright © 2015 YKSoftware")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly:ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyVersion("2.3.8.0")]
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("YKToolkit.Controls")] #if NET4 [assembly: AssemblyDescription(".NET Framework 4.0 用 の WPF カスタムコントロールライブラリです。")] #else [assembly: AssemblyDescription("WPF カスタムコントロールライブラリです。")] #endif [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("YKSoftware")] [assembly: AssemblyProduct("YKToolkit.Controls")] [assembly: AssemblyCopyright("Copyright © 2015 YKSoftware")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly:ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyVersion("2.3.7.0")]
mit
C#
8746c47321aa67ed7a29f49cbcf2c4c3a5bb3186
clean up
asipe/Nucs,asipe/Nucs
src/Nucs.Console/Program.cs
src/Nucs.Console/Program.cs
namespace Nucs.Console { internal class Program { private static void Main(string[] args) {} } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Nucs.Console { class Program { static void Main(string[] args) { } } }
mit
C#
4a8025efc3ec3ac36e7c20df8982c79789b22642
Fix exception when a WaitForm task finishes before the form appears.
electroly/sqlnotebook,electroly/sqlnotebook,electroly/sqlnotebook
src/SqlNotebook/WaitForm.cs
src/SqlNotebook/WaitForm.cs
// SQL Notebook // Copyright (C) 2016 Brian Luft // // 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.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace SqlNotebook { public partial class WaitForm : Form { public Task WaitTask; public Exception ResultException { get; private set; } public WaitForm(string title, string text, Action action) { InitializeComponent(); Text = title; _infoTxt.Text = text; WaitTask = Task.Run(() => { try { action(); } catch (Exception ex) { ResultException = ex; } while (!IsHandleCreated) { Thread.Sleep(1); } BeginInvoke(new MethodInvoker(() => { DialogResult = ResultException == null ? DialogResult.OK : DialogResult.Abort; Close(); })); }); } } }
// SQL Notebook // Copyright (C) 2016 Brian Luft // // 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.Threading.Tasks; using System.Windows.Forms; namespace SqlNotebook { public partial class WaitForm : Form { public Task WaitTask; public Exception ResultException { get; private set; } public WaitForm(string title, string text, Action action) { InitializeComponent(); Text = title; _infoTxt.Text = text; WaitTask = Task.Run(() => { try { action(); } catch (Exception ex) { ResultException = ex; } BeginInvoke(new MethodInvoker(() => { DialogResult = ResultException == null ? DialogResult.OK : DialogResult.Abort; Close(); })); }); } } }
mit
C#
d3d533d136ec9429e29d0420feb7790ecbe0ee3c
update AssemblyInfo
okolobaxa/uploadcare-csharp
UploadcareCSharp/Properties/AssemblyInfo.cs
UploadcareCSharp/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("UploadcareCSharp")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UploadcareCSharp")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: InternalsVisibleTo("UploadcareCSharp.Tests")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("149a9148-12ef-4f31-9cc7-c13918cb93cd")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.3.1")] [assembly: AssemblyFileVersion("0.3.1")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("UploadcareCSharp")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UploadcareCSharp")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: InternalsVisibleTo("UploadcareCSharp.Tests")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("149a9148-12ef-4f31-9cc7-c13918cb93cd")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.3.0")] [assembly: AssemblyFileVersion("0.3.0")]
mit
C#
d16cbb34219a27898dcfdc8a1d253c52539441c4
Update Constants.cs
peejster/DormRoomMonitor
DormRoomMonitor/Constants.cs
DormRoomMonitor/Constants.cs
namespace DormRoomMonitor { /// <summary> /// General constant variables /// </summary> public static class GeneralConstants { // This variable should be set to false for devices, unlike the Raspberry Pi, that have GPU support public const bool DisableLiveCameraFeed = true; // Oxford Face API Primary should be entered here // You can obtain a subscription key for Face API by following the instructions here: https://www.projectoxford.ai/doc/general/subscription-key-mgmt public const string OxfordAPIKey = "b2b1adb22ce44bcc91e5cdfe2afb4f53"; // Name of the folder in which all Whitelist data is stored public const string WhiteListFolderName = "Facial Recognition Door Whitelist"; } /// <summary> /// Constant variables that hold messages to be read via the SpeechHelper class /// </summary> public static class SpeechContants { public const string InitialGreetingMessage = "Welcome to the Facial Recognition Door! Speech has been initialized."; public const string VisitorNotRecognizedMessage = "Sorry! I don't recognize you, so I cannot open the door."; public const string NoCameraMessage = "Sorry! It seems like your camera has not been fully initialized."; public static string GeneralGreetigMessage(string visitorName) { return "Welcome to the Facial Recognition Door " + visitorName + "! I will open the door for you."; } } /// <summary> /// Constant variables that hold values used to interact with device Gpio /// </summary> public static class GpioConstants { // The GPIO pin that the PIR motion sensor is attached to public const int PirPin = 5; // The GPIO pin that the door lock is attached to public const int DoorLockPinID = 6; // The amount of time in seconds that the door will remain unlocked for public const int DoorLockOpenDurationSeconds = 10; } }
namespace DormRoomMonitor { /// <summary> /// General constant variables /// </summary> public static class GeneralConstants { // This variable should be set to false for devices, unlike the Raspberry Pi, that have GPU support public const bool DisableLiveCameraFeed = true; // Oxford Face API Primary should be entered here // You can obtain a subscription key for Face API by following the instructions here: https://www.projectoxford.ai/doc/general/subscription-key-mgmt public const string OxfordAPIKey = "b2b1adb22ce44bcc91e5cdfe2afb4f53"; // Name of the folder in which all Whitelist data is stored public const string WhiteListFolderName = "Facial Recognition Door Whitelist"; } /// <summary> /// Constant variables that hold messages to be read via the SpeechHelper class /// </summary> public static class SpeechContants { public const string InitialGreetingMessage = "Welcome to the Facial Recognition Door! Speech has been initialized."; public const string VisitorNotRecognizedMessage = "Sorry! I don't recognize you, so I cannot open the door."; public const string NoCameraMessage = "Sorry! It seems like your camera has not been fully initialized."; public static string GeneralGreetigMessage(string visitorName) { return "Welcome to the Facial Recognition Door " + visitorName + "! I will open the door for you."; } } /// <summary> /// Constant variables that hold values used to interact with device Gpio /// </summary> public static class GpioConstants { // The GPIO pin that the doorbell button is attached to public const int ButtonPinID = 5; // The GPIO pin that the door lock is attached to public const int DoorLockPinID = 6; // The amount of time in seconds that the door will remain unlocked for public const int DoorLockOpenDurationSeconds = 10; } }
mit
C#
e7c931c0a0886061f0cb04815157d88e96c744f5
use new flag so we only enable async lightbulbs for people with this fix
shyamnamboodiripad/roslyn,mavasani/roslyn,weltkante/roslyn,diryboy/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,diryboy/roslyn,diryboy/roslyn,mavasani/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,weltkante/roslyn,sharwell/roslyn,dotnet/roslyn,sharwell/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn
src/EditorFeatures/Core/Implementation/Suggestions/SuggestionsOptions.cs
src/EditorFeatures/Core/Implementation/Suggestions/SuggestionsOptions.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 Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions { internal static class SuggestionsOptions { private const string FeatureName = "SuggestionsOptions"; public static readonly Option2<bool?> Asynchronous = new(FeatureName, nameof(Asynchronous), defaultValue: null, new RoamingProfileStorageLocation("TextEditor.Specific.Suggestions.Asynchronous2")); public static readonly Option2<bool> AsynchronousFeatureFlag = new(FeatureName, nameof(AsynchronousFeatureFlag), defaultValue: false, new FeatureFlagStorageLocation("Roslyn.AsynchronousQuickActions2")); } }
// 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 Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions { internal static class SuggestionsOptions { private const string FeatureName = "SuggestionsOptions"; public static readonly Option2<bool?> Asynchronous = new(FeatureName, nameof(Asynchronous), defaultValue: null, new RoamingProfileStorageLocation("TextEditor.Specific.Suggestions.Asynchronous2")); public static readonly Option2<bool> AsynchronousFeatureFlag = new(FeatureName, nameof(AsynchronousFeatureFlag), defaultValue: false, new FeatureFlagStorageLocation("Roslyn.AsynchronousQuickActions")); } }
mit
C#
7a6b874117d289f1aa5eee17225533f614ad2416
Reformat IB2Client
coryrwest/B2.NET
src/IB2Client.cs
src/IB2Client.cs
using System.Threading; using System.Threading.Tasks; using B2Net.Models; namespace B2Net { public interface IB2Client { IBuckets Buckets { get; } IFiles Files { get; } ILargeFiles LargeFiles { get; } Task<B2Options> Authorize(CancellationToken cancelToken = default(CancellationToken)); } }
using System.Threading; using System.Threading.Tasks; using B2Net.Models; namespace B2Net { public interface IB2Client { IBuckets Buckets { get; } IFiles Files { get; } ILargeFiles LargeFiles { get; } Task<B2Options> Authorize(CancellationToken cancelToken = default(CancellationToken)); } }
mit
C#
8d230f2bd8492ad31f4656519a682b5edeb4f139
Disable JSON datetime parsing to local time
adasescu/cf-dotnet-sdk
cf-net-sdk-pcl/Util.cs
cf-net-sdk-pcl/Util.cs
using cf_net_sdk.Client.Data; using cf_net_sdk.Interfaces; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace cf_net_sdk { public class Util { private static JsonSerializerSettings jsonSettings = new JsonSerializerSettings { DateParseHandling = DateParseHandling.None }; public static PagedResponse<T> DeserializePage<T>(string value) { PagedResponse<T> page = new PagedResponse<T>(); page.Properties = JsonConvert.DeserializeObject<PageProperties>(value, jsonSettings); page.Resources = DeserializeJsonArray<T>(value).ToList<T>(); return page; } public static T[] DeserializeJsonArray<T>(string value) { JsonReader reader = new JsonTextReader(new StringReader(value)); reader.DateParseHandling = DateParseHandling.None; var obj = JObject.Load(reader); if (obj["resources"] == null) { throw new Exception("Value contains no resources"); } return obj["resources"].Select(Deserialize<T>).ToArray(); } public static T DeserializeJson<T>(string value) { JsonReader reader = new JsonTextReader(new StringReader(value)); reader.DateParseHandling = DateParseHandling.None; var obj = JObject.Load(reader); return Deserialize<T>(obj); } internal static T Deserialize<T>(JToken value) { if (value["entity"] != null) { var o = JsonConvert.DeserializeObject<T>(value["entity"].ToString()); if (value["metadata"] != null) { ((IResponse)o).EntityMetadata = JsonConvert.DeserializeObject<Metadata>(value["metadata"].ToString(), jsonSettings); } return (T)Convert.ChangeType(o, typeof(T)); } else { return JsonConvert.DeserializeObject<T>(value.ToString(), jsonSettings); } } } }
using cf_net_sdk.Client.Data; using cf_net_sdk.Interfaces; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace cf_net_sdk { public class Util { public static PagedResponse<T> DeserializePage<T>(string value) { PagedResponse<T> page = new PagedResponse<T>(); page.Properties = JsonConvert.DeserializeObject<PageProperties>(value); page.Resources = DeserializeJsonArray<T>(value).ToList<T>(); return page; } public static T[] DeserializeJsonArray<T>(string value) { var obj = JObject.Parse(value); if (obj["resources"] == null) { throw new Exception("Value contains no resources"); } return obj["resources"].Select(Deserialize<T>).ToArray(); } public static T DeserializeJson<T>(string value) { var obj = JObject.Parse(value); return Deserialize<T>(obj); } internal static T Deserialize<T>(JToken value) { if (value["entity"] != null) { var o = JsonConvert.DeserializeObject<T>(value["entity"].ToString()); if (value["metadata"] != null) { ((IResponse)o).EntityMetadata = JsonConvert.DeserializeObject<Metadata>(value["metadata"].ToString()); } return (T)Convert.ChangeType(o, typeof(T)); } else { return JsonConvert.DeserializeObject<T>(value.ToString()); } } } }
apache-2.0
C#
8604de484e403ebac2e3a1f12464bb75a8d6b62a
Add new config value for testing scenarios related to duplicate PAYE schemes. This will be deleted
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs
src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs
using System.Collections.Generic; namespace SFA.DAS.EmployerApprenticeshipsService.Domain.Configuration { public class EmployerApprenticeshipsServiceConfiguration { public CompaniesHouseConfiguration CompaniesHouse { get; set; } public EmployerConfiguration Employer { get; set; } public string ServiceBusConnectionString { get; set; } public IdentityServerConfiguration Identity { get; set; } public SmtpConfiguration SmtpServer { get; set; } public string DashboardUrl { get; set; } public HmrcConfiguration Hmrc { get; set; } } public class HmrcConfiguration { public string BaseUrl { get; set; } public string ClientId { get; set; } public string Scope { get; set; } public string ClientSecret { get; set; } public bool DuplicatesCheck { get; set; } } public class IdentityServerConfiguration { public bool UseFake { get; set; } public string ClientId { get; set; } public string ClientSecret { get; set; } public string BaseAddress { get; set; } } public class EmployerConfiguration { public string DatabaseConnectionString { get; set; } } public class CompaniesHouseConfiguration { public string ApiKey { get; set; } } public class SmtpConfiguration { public string ServerName { get; set; } public string UserName { get; set; } public string Password { get; set; } public string Port { get; set; } } }
using System.Collections.Generic; namespace SFA.DAS.EmployerApprenticeshipsService.Domain.Configuration { public class EmployerApprenticeshipsServiceConfiguration { public CompaniesHouseConfiguration CompaniesHouse { get; set; } public EmployerConfiguration Employer { get; set; } public string ServiceBusConnectionString { get; set; } public IdentityServerConfiguration Identity { get; set; } public SmtpConfiguration SmtpServer { get; set; } public string DashboardUrl { get; set; } public HmrcConfiguration Hmrc { get; set; } } public class HmrcConfiguration { public string BaseUrl { get; set; } public string ClientId { get; set; } public string Scope { get; set; } public string ClientSecret { get; set; } } public class IdentityServerConfiguration { public bool UseFake { get; set; } public string ClientId { get; set; } public string ClientSecret { get; set; } public string BaseAddress { get; set; } } public class EmployerConfiguration { public string DatabaseConnectionString { get; set; } } public class CompaniesHouseConfiguration { public string ApiKey { get; set; } } public class SmtpConfiguration { public string ServerName { get; set; } public string UserName { get; set; } public string Password { get; set; } public string Port { get; set; } } }
mit
C#
28ea4a00acf22743d78d09f2b92496e58cd5652e
Update test helper for metadata service to support nested classes or categories
Kentico/KInspector,Kentico/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,Kentico/KInspector,ChristopherJennings/KInspector,ChristopherJennings/KInspector,ChristopherJennings/KInspector
KenticoInspector.Reports.Tests/Helpers/MockReportMetadataServiceHelper.cs
KenticoInspector.Reports.Tests/Helpers/MockReportMetadataServiceHelper.cs
using System; using System.Reflection; using KenticoInspector.Core; using KenticoInspector.Core.Models; using KenticoInspector.Core.Services.Interfaces; using Moq; namespace KenticoInspector.Reports.Tests.Helpers { public static class MockReportMetadataServiceHelper { public static Mock<IReportMetadataService> GetReportMetadataService() { return new Mock<IReportMetadataService>(MockBehavior.Strict); } /// <summary> /// Sets up <see cref="IReportMetadataService"/> to return a new <see cref="Labels"/> instead of the real metadata. /// This is because the metadata does not influence the data retrieved by the report. /// </summary> /// <param name="mockReportMetadataService">Mocked <see cref="IReportMetadataService"/>.</param> /// <param name="report"><see cref="IReport"/> being tested.</param> /// <returns><see cref="IReportMetadataService"/> configured for the <see cref="IReport"/>.</returns> public static Mock<IReportMetadataService> SetupReportMetadataService<T>(Mock<IReportMetadataService> mockReportMetadataService, IReport report) where T : new() { var fakeMetadata = new ReportMetadata<T>() { Terms = new T() }; UpdatePropertiesOfObject(fakeMetadata.Terms); mockReportMetadataService.Setup(p => p.GetReportMetadata<T>(report.Codename)).Returns(fakeMetadata); return mockReportMetadataService; } private static void UpdatePropertiesOfObject<T>(T objectToUpdate) where T : new() { var objectProperties = objectToUpdate.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var property in objectProperties) { if (property.PropertyType == typeof(Term)) { property.SetValue(objectToUpdate, (Term)property.Name); } else if (property.PropertyType.IsClass) { var childObject = Activator.CreateInstance(property.PropertyType); UpdatePropertiesOfObject(childObject); property.SetValue(objectToUpdate, childObject); } } } } }
using System.Reflection; using KenticoInspector.Core; using KenticoInspector.Core.Models; using KenticoInspector.Core.Services.Interfaces; using Moq; namespace KenticoInspector.Reports.Tests.Helpers { public static class MockReportMetadataServiceHelper { public static Mock<IReportMetadataService> GetReportMetadataService() { return new Mock<IReportMetadataService>(MockBehavior.Strict); } /// <summary> /// Sets up <see cref="IReportMetadataService"/> to return a new <see cref="Labels"/> instead of the real metadata. /// This is because the metadata does not influence the data retrieved by the report. /// </summary> /// <param name="mockReportMetadataService">Mocked <see cref="IReportMetadataService"/>.</param> /// <param name="report"><see cref="IReport"/> being tested.</param> /// <returns><see cref="IReportMetadataService"/> configured for the <see cref="IReport"/>.</returns> public static Mock<IReportMetadataService> SetupReportMetadataService<T>(Mock<IReportMetadataService> mockReportMetadataService, IReport report) where T : new() { var fakeMetadata = new ReportMetadata<T>() { Terms = new T() }; var properties = fakeMetadata.Terms.GetType() .GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var property in properties) { property.SetValue(fakeMetadata.Terms, (Term)property.Name); } mockReportMetadataService.Setup(p => p.GetReportMetadata<T>(report.Codename)).Returns(fakeMetadata); return mockReportMetadataService; } } }
mit
C#
0c28c95785cb18e256c3d5d3580f87c371646895
修改文档类型大小,否则Word之类的文件无法上传!
Mozlite/Mozlite.Core,Mozlite/Mozlite.Core
Mozlite.Core/FileProviders/StorageFileInfo.cs
Mozlite.Core/FileProviders/StorageFileInfo.cs
using Mozlite.Data.Metadata; namespace Mozlite.FileProviders { /// <summary> /// 存储文件。 /// </summary> [Table("core_Medias_Storages")] public class StorageFileInfo { /// <summary> /// 文件Id。 /// </summary> [Identity] public int FileId { get; set; } /// <summary> /// 文件名。 /// </summary> [Size(32)] public string Name { get; set; } /// <summary> /// 内容类型。 /// </summary> [Size(256)] public string ContentType { get; set; } /// <summary> /// 引用次数。 /// </summary> public int Reference { get; set; } /// <summary> /// 大小。 /// </summary> public long Length { get; set; } private string _path; /// <summary> /// 媒体路径。 /// </summary> public string Path { get { if (_path == null && Name != null) _path = $"{Name[1]}\\{Name[3]}\\{Name[12]}\\{Name[16]}\\{Name[20]}\\{Name}.moz"; return _path; } } } }
using Mozlite.Data.Metadata; namespace Mozlite.FileProviders { /// <summary> /// 存储文件。 /// </summary> [Table("core_Medias_Storages")] public class StorageFileInfo { /// <summary> /// 文件Id。 /// </summary> [Identity] public int FileId { get; set; } /// <summary> /// 文件名。 /// </summary> [Size(32)] public string Name { get; set; } /// <summary> /// 内容类型。 /// </summary> [Size(64)] public string ContentType { get; set; } /// <summary> /// 引用次数。 /// </summary> public int Reference { get; set; } /// <summary> /// 大小。 /// </summary> public long Length { get; set; } private string _path; /// <summary> /// 媒体路径。 /// </summary> public string Path { get { if (_path == null && Name != null) _path = $"{Name[1]}\\{Name[3]}\\{Name[12]}\\{Name[16]}\\{Name[20]}\\{Name}.moz"; return _path; } } } }
bsd-2-clause
C#
9ed298a9956e983673d879db5057afd8dba4eab0
Simplify XSerializerSerializerConfiguration.
peteraritchie/Rock.Core,bfriesen/Rock.Core,RockFramework/Rock.Core
Rock.Core.XSerializer/Serialization/XSerializerSerializerConfiguration.cs
Rock.Core.XSerializer/Serialization/XSerializerSerializerConfiguration.cs
using System; using System.Collections.Generic; using System.Text; using System.Xml.Serialization; namespace Rock.Serialization { public class XSerializerSerializerConfiguration : IXSerializerSerializerConfiguration { public XSerializerSerializerConfiguration() { RootElementNameMap = new Dictionary<Type, string>(); Redact = true; } public XmlSerializerNamespaces Namespaces { get; set; } public Encoding Encoding { get; set; } public string DefaultNamespace { get; set; } public bool Indent { get; set; } public bool AlwaysEmitTypes { get; set; } public bool Redact { get; set; } public bool TreatEmptyElementAsString { get; set; } public bool EmitNil { get; set; } IReadOnlyDictionary<Type, string> IXSerializerSerializerConfiguration.RootElementNameMap { get { return RootElementNameMap; } } public Dictionary<Type, string> RootElementNameMap { get; set; } } }
using System; using System.Collections.Generic; using System.Text; using System.Xml.Serialization; namespace Rock.Serialization { public class XSerializerSerializerConfiguration : IXSerializerSerializerConfiguration { private readonly Dictionary<Type, string> _rootElementNameMap = new Dictionary<Type, string>(); public XSerializerSerializerConfiguration() { Namespaces = new XmlSerializerNamespaces(); Encoding = Encoding.UTF8; Redact = true; } public XmlSerializerNamespaces Namespaces { get; set; } public Encoding Encoding { get; set; } public string DefaultNamespace { get; set; } public bool Indent { get; set; } public bool AlwaysEmitTypes { get; set; } public bool Redact { get; set; } public bool TreatEmptyElementAsString { get; set; } public bool EmitNil { get; set; } IReadOnlyDictionary<Type, string> IXSerializerSerializerConfiguration.RootElementNameMap { get { return _rootElementNameMap; } } public IDictionary<Type, string> RootElementNameMap { get { return _rootElementNameMap; } set { _rootElementNameMap.Clear(); if (value != null) { foreach (var kvp in value) { _rootElementNameMap.Add(kvp.Key, kvp.Value); } } } } } }
mit
C#
0258f6bcd19067e400021196aea5b19ce975dbf6
Fix for https://github.com/visualeyes/halcyon/issues/51
visualeyes/halcyon
src/Halcyon.Mvc/HAL/Json/JsonHalOutputFormatter.cs
src/Halcyon.Mvc/HAL/Json/JsonHalOutputFormatter.cs
using Halcyon.HAL; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.Net.Http.Headers; using Newtonsoft.Json; using System; using System.Buffers; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Primitives; namespace Halcyon.Web.HAL.Json { public class JsonHalOutputFormatter : IOutputFormatter { public const string HalJsonType = "application/hal+json"; private readonly IEnumerable<string> halJsonMediaTypes; private readonly JsonOutputFormatter jsonFormatter; public JsonHalOutputFormatter(IEnumerable<string> halJsonMediaTypes = null) { if(halJsonMediaTypes == null) halJsonMediaTypes = new string[] { HalJsonType }; var serializerSettings = JsonSerializerSettingsProvider.CreateSerializerSettings(); this.jsonFormatter = new JsonOutputFormatter(serializerSettings, ArrayPool<Char>.Create()); this.halJsonMediaTypes = halJsonMediaTypes; } public JsonHalOutputFormatter(JsonSerializerSettings serializerSettings, IEnumerable<string> halJsonMediaTypes = null) { if(halJsonMediaTypes == null) halJsonMediaTypes = new string[] { HalJsonType }; this.jsonFormatter = new JsonOutputFormatter(serializerSettings, ArrayPool<Char>.Create()); this.halJsonMediaTypes = halJsonMediaTypes; } public bool CanWriteResult(OutputFormatterCanWriteContext context) { return context.ObjectType == typeof(HALResponse); } public async Task WriteAsync(OutputFormatterWriteContext context) { string mediaType = context.ContentType.HasValue ? context.ContentType.Value : null; object value = null; var halResponse = ((HALResponse)context.Object); // If it is a HAL response but set to application/json - convert to a plain response var serializer = JsonSerializer.Create(); if(!halResponse.Config.ForceHAL && !halJsonMediaTypes.Contains(mediaType)) { value = halResponse.ToPlainResponse(serializer); } else { value = halResponse.ToJObject(serializer); } var jsonContext = new OutputFormatterWriteContext(context.HttpContext, context.WriterFactory, value.GetType(), value); jsonContext.ContentType = new StringSegment(mediaType); await jsonFormatter.WriteAsync(jsonContext); } } }
using Halcyon.HAL; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.Net.Http.Headers; using Newtonsoft.Json; using System; using System.Buffers; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Halcyon.Web.HAL.Json { public class JsonHalOutputFormatter : IOutputFormatter { public const string HalJsonType = "application/hal+json"; private readonly IEnumerable<string> halJsonMediaTypes; private readonly JsonOutputFormatter jsonFormatter; public JsonHalOutputFormatter(IEnumerable<string> halJsonMediaTypes = null) { if(halJsonMediaTypes == null) halJsonMediaTypes = new string[] { HalJsonType }; var serializerSettings = JsonSerializerSettingsProvider.CreateSerializerSettings(); this.jsonFormatter = new JsonOutputFormatter(serializerSettings, ArrayPool<Char>.Create()); this.halJsonMediaTypes = halJsonMediaTypes; } public JsonHalOutputFormatter(JsonSerializerSettings serializerSettings, IEnumerable<string> halJsonMediaTypes = null) { if(halJsonMediaTypes == null) halJsonMediaTypes = new string[] { HalJsonType }; this.jsonFormatter = new JsonOutputFormatter(serializerSettings, ArrayPool<Char>.Create()); this.halJsonMediaTypes = halJsonMediaTypes; } public bool CanWriteResult(OutputFormatterCanWriteContext context) { return context.ObjectType == typeof(HALResponse); } public async Task WriteAsync(OutputFormatterWriteContext context) { string mediaType = context.ContentType.HasValue ? context.ContentType.Value : null; object value = null; var halResponse = ((HALResponse)context.Object); // If it is a HAL response but set to application/json - convert to a plain response var serializer = JsonSerializer.Create(); if(!halResponse.Config.ForceHAL && !halJsonMediaTypes.Contains(mediaType)) { value = halResponse.ToPlainResponse(serializer); } else { value = halResponse.ToJObject(serializer); } var jsonContext = new OutputFormatterWriteContext(context.HttpContext, context.WriterFactory, value.GetType(), value); await jsonFormatter.WriteAsync(jsonContext); } } }
mit
C#
6516457361610d70259e72366213db45aa6353eb
update diagnostic demo to get the service from the registry
DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
Assets/MixedRealityToolkit.Examples/Demos/Diagnostics/Scripts/DiagnosticsDemoControls.cs
Assets/MixedRealityToolkit.Examples/Demos/Diagnostics/Scripts/DiagnosticsDemoControls.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using Microsoft.MixedReality.Toolkit.Diagnostics; using Microsoft.MixedReality.Toolkit.Utilities; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.Examples.Demos { public class DiagnosticsDemoControls : MonoBehaviour { private IMixedRealityDiagnosticsSystem diagnosticsSystem = null; private IMixedRealityDiagnosticsSystem DiagnosticsSystem { get { if (diagnosticsSystem == null) { MixedRealityServiceRegistry.TryGetService<IMixedRealityDiagnosticsSystem>(out diagnosticsSystem); } return diagnosticsSystem; } } private async void Start() { await new WaitUntil(() => DiagnosticsSystem != null); // Ensure the diagnostic visualizations are turned on. DiagnosticsSystem.ShowDiagnostics = true; } /// <summary> /// Shows or hides all enabled diagnostics. /// </summary> public void OnToggleDiagnostics() { DiagnosticsSystem.ShowDiagnostics = !DiagnosticsSystem.ShowDiagnostics; } /// <summary> /// Shows or hides the profiler display. /// </summary> public void OnToggleProfiler() { DiagnosticsSystem.ShowProfiler = !DiagnosticsSystem.ShowProfiler; } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using Microsoft.MixedReality.Toolkit.Utilities; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.Examples.Demos { public class DiagnosticsDemoControls : MonoBehaviour { private async void Start() { if (!MixedRealityToolkit.Instance.ActiveProfile.IsDiagnosticsSystemEnabled) { Debug.LogWarning("Diagnostics system is disabled. To run this demo, it needs to be enabled. Check your configuration settings."); return; } await new WaitUntil(() => MixedRealityToolkit.DiagnosticsSystem != null); // Turn on the diagnostic visualizations for this demo. MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = true; } /// <summary> /// Shows or hides all enabled diagnostics. /// </summary> public void OnToggleDiagnostics() { MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = !MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics; } /// <summary> /// Shows or hides the profiler display. /// </summary> public void OnToggleProfiler() { MixedRealityToolkit.DiagnosticsSystem.ShowProfiler = !MixedRealityToolkit.DiagnosticsSystem.ShowProfiler; } } }
mit
C#
b65d9d9131f06fbe6257b4d4ae568b8a187ac739
Handle PlatformAction's before keys
default0/osu-framework,peppy/osu-framework,peppy/osu-framework,default0/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,Nabile-Rahmani/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework
osu.Framework/Input/PlatformActionContainer.cs
osu.Framework/Input/PlatformActionContainer.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Input.Bindings; using osu.Framework.Platform; namespace osu.Framework.Input { /// <summary> /// Provides actions that are expected to have different key bindings per platform. /// The framework will always contain one top-level instance of this class, but extra instances /// can be created to handle events that should trigger specifically on a focused drawable. /// Will send repeat events by default. /// </summary> public class PlatformActionContainer : KeyBindingContainer<PlatformAction>, IHandleGlobalInput { private GameHost host; [BackgroundDependencyLoader] private void load(GameHost host) { this.host = host; } public override IEnumerable<KeyBinding> DefaultKeyBindings => host.PlatformKeyBindings; protected override bool Prioritised => true; protected override bool SendRepeats => true; } public struct PlatformAction { public PlatformActionType ActionType; public PlatformActionMethod? ActionMethod; public PlatformAction(PlatformActionType actionType, PlatformActionMethod? actionMethod = null) { ActionType = actionType; ActionMethod = actionMethod; } } public enum PlatformActionType { Cut, Copy, Paste, SelectAll, CharPrevious, CharNext, WordPrevious, WordNext, LineStart, LineEnd } public enum PlatformActionMethod { Move, Select, Delete } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Input.Bindings; using osu.Framework.Platform; namespace osu.Framework.Input { /// <summary> /// Provides actions that are expected to have different key bindings per platform. /// The framework will always contain one top-level instance of this class, but extra instances /// can be created to handle events that should trigger specifically on a focused drawable. /// Will send repeat events by default. /// </summary> public class PlatformActionContainer : KeyBindingContainer<PlatformAction>, IHandleGlobalInput { private GameHost host; [BackgroundDependencyLoader] private void load(GameHost host) { this.host = host; } public override IEnumerable<KeyBinding> DefaultKeyBindings => host.PlatformKeyBindings; protected override bool SendRepeats => true; } public struct PlatformAction { public PlatformActionType ActionType; public PlatformActionMethod? ActionMethod; public PlatformAction(PlatformActionType actionType, PlatformActionMethod? actionMethod = null) { ActionType = actionType; ActionMethod = actionMethod; } } public enum PlatformActionType { Cut, Copy, Paste, SelectAll, CharPrevious, CharNext, WordPrevious, WordNext, LineStart, LineEnd } public enum PlatformActionMethod { Move, Select, Delete } }
mit
C#
994c61a553927d06d993c16087447be86b6bf9c2
Improve GetIndistinguishableOutputs
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Extensions/NBitcoinExtensions.cs
WalletWasabi/Extensions/NBitcoinExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using WalletWasabi.Helpers; using WalletWasabi.Models; namespace NBitcoin { public static class NBitcoinExtensions { public static TxoRef ToTxoRef(this OutPoint me) => new TxoRef(me); public static IEnumerable<TxoRef> ToTxoRefs(this TxInList me) { foreach (var input in me) { yield return input.PrevOut.ToTxoRef(); } } public static IEnumerable<Coin> GetCoins(this TxOutList me, Script script) { return me.AsCoins().Where(c => c.ScriptPubKey == script); } public static string ToHex(this IBitcoinSerializable me) { return ByteHelpers.ToHex(me.ToBytes()); } public static void FromHex(this IBitcoinSerializable me, string hex) { Guard.NotNullOrEmptyOrWhitespace(nameof(hex), hex); me.FromBytes(ByteHelpers.FromHex(hex)); } public static IEnumerable<(Money value, int count)> GetIndistinguishableOutputs(this Transaction me) { return me.Outputs.GroupBy(x => x.Value) .ToDictionary(x => x.Key, y => y.Count()) .Select(x => (x.Key, x.Value)); } public static int GetAnonymitySet(this Transaction me, int outputIndex) { var output = me.Outputs[outputIndex]; return me.GetIndistinguishableOutputs().Single(x => x.value == output.Value).count; } public static int GetMixin(this Transaction me, uint outputIndex) { var output = me.Outputs[outputIndex]; return me.GetIndistinguishableOutputs().Single(x => x.value == output.Value).count - 1; } public static bool HasWitness(this TxIn me) { Guard.NotNull(nameof(me), me); bool notNull = me.WitScript != null; bool notEmpty = me.WitScript != WitScript.Empty; return notNull && notEmpty; } } }
using System; using System.Collections.Generic; using System.Linq; using WalletWasabi.Helpers; using WalletWasabi.Models; namespace NBitcoin { public static class NBitcoinExtensions { public static TxoRef ToTxoRef(this OutPoint me) => new TxoRef(me); public static IEnumerable<TxoRef> ToTxoRefs(this TxInList me) { foreach (var input in me) { yield return input.PrevOut.ToTxoRef(); } } public static IEnumerable<Coin> GetCoins(this TxOutList me, Script script) { return me.AsCoins().Where(c => c.ScriptPubKey == script); } public static string ToHex(this IBitcoinSerializable me) { return ByteHelpers.ToHex(me.ToBytes()); } public static void FromHex(this IBitcoinSerializable me, string hex) { Guard.NotNullOrEmptyOrWhitespace(nameof(hex), hex); me.FromBytes(ByteHelpers.FromHex(hex)); } public static IEnumerable<(Money value, int count)> GetIndistinguishableOutputs(this Transaction me) { var ret = new List<(Money Value, int count)>(); foreach (Money v in me.Outputs.Select(x => x.Value).Distinct()) { ret.Add((v, me.Outputs.Count(x => x.Value == v))); } return ret; } public static int GetAnonymitySet(this Transaction me, int outputIndex) { var output = me.Outputs[outputIndex]; return me.GetIndistinguishableOutputs().Single(x => x.value == output.Value).count; } public static int GetMixin(this Transaction me, uint outputIndex) { var output = me.Outputs[outputIndex]; return me.GetIndistinguishableOutputs().Single(x => x.value == output.Value).count - 1; } public static bool HasWitness(this TxIn me) { Guard.NotNull(nameof(me), me); bool notNull = me.WitScript != null; bool notEmpty = me.WitScript != WitScript.Empty; return notNull && notEmpty; } } }
mit
C#
bda53e7c2dccb7cfe4dea9bf93294ba73c7dffec
Set InternalsVisibleTo CarouselView (#164)
Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms
Xamarin.Forms.Core/Properties/AssemblyInfo.cs
Xamarin.Forms.Core/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using Xamarin.Forms; using Xamarin.Forms.Internals; [assembly: AssemblyTitle("Xamarin.Forms.Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The Page "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. //[assembly: AssemblyVersion("1.0.*")] // 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("")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.iOS")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.iOS.Classic")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.Android")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.UAP")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.WinRT")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.WinRT.Tablet")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.WinRT.Phone")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.WP8")] [assembly: InternalsVisibleTo("iOSUnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Controls")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.Design")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.UnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.Android.UnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.WP8.UnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Xaml")] [assembly: InternalsVisibleTo("Xamarin.Forms.Maps")] [assembly: InternalsVisibleTo("Xamarin.Forms.Maps.iOS")] [assembly: InternalsVisibleTo("Xamarin.Forms.Maps.iOS.Classic")] [assembly: InternalsVisibleTo("Xamarin.Forms.Maps.Android")] [assembly: InternalsVisibleTo("Xamarin.Forms.Xaml.UnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.UITests")] //[assembly:InternalsVisibleTo("Xamarin.Forms.Core.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.iOS.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.Android.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.Windows.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.iOS.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Android.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Loader")] [assembly: InternalsVisibleTo("Xamarin.Forms.UITest.Validator")] [assembly: InternalsVisibleTo("Xamarin.Forms.Build.Tasks")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform")] [assembly: InternalsVisibleTo("Xamarin.Forms.Pages")] [assembly: InternalsVisibleTo("Xamarin.Forms.Pages.UnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.CarouselView")] [assembly: Preserve]
using System.Reflection; using System.Runtime.CompilerServices; using Xamarin.Forms; using Xamarin.Forms.Internals; [assembly: AssemblyTitle("Xamarin.Forms.Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The Page "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. //[assembly: AssemblyVersion("1.0.*")] // 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("")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.iOS")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.iOS.Classic")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.Android")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.UAP")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.WinRT")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.WinRT.Tablet")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.WinRT.Phone")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform.WP8")] [assembly: InternalsVisibleTo("iOSUnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Controls")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.Design")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.UnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.Android.UnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.WP8.UnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Xaml")] [assembly: InternalsVisibleTo("Xamarin.Forms.Maps")] [assembly: InternalsVisibleTo("Xamarin.Forms.Maps.iOS")] [assembly: InternalsVisibleTo("Xamarin.Forms.Maps.iOS.Classic")] [assembly: InternalsVisibleTo("Xamarin.Forms.Maps.Android")] [assembly: InternalsVisibleTo("Xamarin.Forms.Xaml.UnitTests")] [assembly: InternalsVisibleTo("Xamarin.Forms.UITests")] //[assembly:InternalsVisibleTo("Xamarin.Forms.Core.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.iOS.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.Android.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Core.Windows.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.iOS.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Android.UITests")] [assembly: InternalsVisibleTo("Xamarin.Forms.Loader")] [assembly: InternalsVisibleTo("Xamarin.Forms.UITest.Validator")] [assembly: InternalsVisibleTo("Xamarin.Forms.Build.Tasks")] [assembly: InternalsVisibleTo("Xamarin.Forms.Platform")] [assembly: InternalsVisibleTo("Xamarin.Forms.Pages")] [assembly: InternalsVisibleTo("Xamarin.Forms.Pages.UnitTests")] [assembly: Preserve]
mit
C#
79d4fb4d25f2bc6186ee72aa58ecf25d30d5d333
Make sure timerdecoratortest always succeeds
Hammerstad/Moya
TestMoya.Runner/Runners/TimerDecoratorTests.cs
TestMoya.Runner/Runners/TimerDecoratorTests.cs
using System.Threading; namespace TestMoya.Runner.Runners { using System; using System.Reflection; using Moq; using Moya.Attributes; using Moya.Models; using Moya.Runner.Runners; using Xunit; public class TimerDecoratorTests { private readonly Mock<ITestRunner> testRunnerMock; private TimerDecorator timerDecorator; public TimerDecoratorTests() { testRunnerMock = new Mock<ITestRunner>(); } [Fact] public void TimerDecoratorExecuteRunsMethod() { timerDecorator = new TimerDecorator(testRunnerMock.Object); bool methodRun = false; MethodInfo method = ((Action)(() => methodRun = true)).Method; testRunnerMock .Setup(x => x.Execute(method)) .Callback(() => methodRun = true) .Returns(new TestResult()); timerDecorator.Execute(method); Assert.True(methodRun); } [Fact] public void TimerDecoratorExecuteAddsDurationToResult() { MethodInfo method = ((Action)TestClass.MethodWithMoyaAttribute).Method; timerDecorator = new TimerDecorator(new StressTestRunner()); var result = timerDecorator.Execute(method); Assert.True(result.Duration > 0); } public class TestClass { [Stress] public static void MethodWithMoyaAttribute() { Thread.Sleep(1); } } } }
namespace TestMoya.Runner.Runners { using System; using System.Reflection; using Moq; using Moya.Attributes; using Moya.Models; using Moya.Runner.Runners; using Xunit; public class TimerDecoratorTests { private readonly Mock<ITestRunner> testRunnerMock; private TimerDecorator timerDecorator; public TimerDecoratorTests() { testRunnerMock = new Mock<ITestRunner>(); } [Fact] public void TimerDecoratorExecuteRunsMethod() { timerDecorator = new TimerDecorator(testRunnerMock.Object); bool methodRun = false; MethodInfo method = ((Action)(() => methodRun = true)).Method; testRunnerMock .Setup(x => x.Execute(method)) .Callback(() => methodRun = true) .Returns(new TestResult()); timerDecorator.Execute(method); Assert.True(methodRun); } [Fact] public void TimerDecoratorExecuteAddsDurationToResult() { MethodInfo method = ((Action)TestClass.MethodWithMoyaAttribute).Method; timerDecorator = new TimerDecorator(new StressTestRunner()); var result = timerDecorator.Execute(method); Assert.True(result.Duration > 0); } public class TestClass { [Stress] public static void MethodWithMoyaAttribute() { } } } }
mit
C#
4b8bbfc78d6169092cdde5002cc9fe808c621cb4
Tidy up the display of the side bar.
alastairs/cgowebsite,alastairs/cgowebsite
src/CGO.Web/Views/Shared/_Sidebar.cshtml
src/CGO.Web/Views/Shared/_Sidebar.cshtml
@using CGO.Web.Models @model IEnumerable<SideBarSection> <div class="col-lg-3"> <div class="well"> <ul class="nav nav-stacked"> @foreach (var sideBarSection in Model) { <li class="navbar-header">@sideBarSection.Title</li> foreach (var link in sideBarSection.Links) { @SideBarLink(link) } } </ul> </div> </div> @helper SideBarLink(SideBarLink link) { if (link.IsActive) { <li class="active"><a href="@link.Uri" title="@link.Title">@link.Title</a></li> } else { <li><a href="@link.Uri" title="@link.Title">@link.Title</a></li> } }
@using CGO.Web.Models @model IEnumerable<SideBarSection> <div class="span3"> <div class="well sidebar-nav"> <ul class="nav nav-list"> @foreach (var sideBarSection in Model) { <li class="nav-header">@sideBarSection.Title</li> foreach (var link in sideBarSection.Links) { @SideBarLink(link) } } </ul> </div> </div> @helper SideBarLink(SideBarLink link) { if (link.IsActive) { <li class="active"><a href="@link.Uri" title="@link.Title">@link.Title</a></li> } else { <li><a href="@link.Uri" title="@link.Title">@link.Title</a></li> } }
mit
C#
814a5b3802b890006e4bc18d9a837a4ffbb21c1e
Update AllanRitchie.cs (#696)
planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin
src/Firehose.Web/Authors/AllanRitchie.cs
src/Firehose.Web/Authors/AllanRitchie.cs
using System; using System.Collections.Generic; using System.ServiceModel.Syndication; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class AllanRitchie : IAmAXamarinMVP, IAmAMicrosoftMVP, IFilterMyBlogPosts { public string FirstName => "Allan"; public string LastName => "Ritchie"; public string StateOrRegion => "Toronto, Canada"; public string EmailAddress => "allan.ritchie@gmail.com"; public string ShortBioOrTagLine => ""; public Uri WebSite => new Uri("https://allancritchie.net"); public string TwitterHandle => "allanritchie911"; public string GitHubHandle => "aritchie"; public string GravatarHash => "5f22bd04ca38ed4d0a5225d0825e0726"; public GeoPosition Position => new GeoPosition(43.6425701,-79.3892455); public string FeedLanguageCode => "en"; // my feed is prebuilt by wyam and has a dedicated rss feed for xamarin content - thus all items are "good" public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://allancritchie.net/feed.rss"); } } public bool Filter(SyndicationItem item) => true; } }
using System; using System.Collections.Generic; using System.ServiceModel.Syndication; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class AllanRitchie : IAmAXamarinMVP, IAmAMicrosoftMVP, IFilterMyBlogPosts { public string FirstName => "Allan"; public string LastName => "Ritchie"; public string StateOrRegion => "Toronto, Canada"; public string EmailAddress => "allan.ritchie@gmail.com"; public string ShortBioOrTagLine => ""; public Uri WebSite => new Uri("https://allancritchie.net"); public string TwitterHandle => "allanritchie911"; public string GitHubHandle => "aritchie"; public string GravatarHash => "5f22bd04ca38ed4d0a5225d0825e0726"; public GeoPosition Position => new GeoPosition(43.6425701,-79.3892455); public string FeedLanguageCode => "en"; // my feed is prebuilt by wyam and has a dedicated rss feed for xamarin content - thus all items are "good" public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://allancritchie.net/xamarin.rss"); } } public bool Filter(SyndicationItem item) => true; } }
mit
C#
d676921e482f7ca4af493e15d455a801e80c9f24
Update BradleyWyatt.cs
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/BradleyWyatt.cs
src/Firehose.Web/Authors/BradleyWyatt.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class BradleyWyatt : IAmACommunityMember { public string FirstName => "Bradley"; public string LastName => "Wyatt"; public string ShortBioOrTagLine => "Finding wayt to do the most work with the least effort possible"; public string StateOrRegion => "Chicago, IL, USA"; public string EmailAddress => "brad@thelazyadministrator.com"; public string TwitterHandle => "bwya77"; public string GitHubHandle => "bwya77"; public string GravatarHash => "c4eaa00e143c7abb1362dc9a8a48da09"; public GeoPosition Position => new GeoPosition(41.8779810,-87.634656); public Uri WebSite => new Uri("https://www.thelazyadministrator.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.thelazyadministrator.com/feed/"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class BradleyWyatt : IAmACommunityMember { public string FirstName => "Bradley"; public string LastName => "Wyatt"; public string ShortBioOrTagLine => "Finding wayt to do the most work with the least effort possible"; public string StateOrRegion => "Chicago"; public string EmailAddress => "brad@thelazyadministrator.com"; public string GravatarHash => "c4eaa00e143c7abb1362dc9a8a48da09"; public string TwitterHandle => "bwya77"; public string GitHubHandle => "bwya77"; public Uri WebSite => new Uri("https://www.thelazyadministrator.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.thelazyadministrator.com/feed/"); } } } }
mit
C#
2e9469231fe6cae957bdf332c6a00600098e888b
Fix spelling mistake in MessageGetStrategy
BundledSticksInkorperated/Discore
src/Discore/MessageGetStrategy.cs
src/Discore/MessageGetStrategy.cs
namespace Discore { /// <summary> /// Represents a strategy used when retrieving messages from the Discord API. /// </summary> public enum MessageGetStrategy { /// <summary> /// Will return messages before and after the base message. /// </summary> Around, /// <summary> /// Will return messages before the base message. /// </summary> Before, /// <summary> /// Will return messages after the base message. /// </summary> After } }
namespace Discore { /// <summary> /// Represents a strategy used when retrieving messages from the Discord API. /// </summary> public enum MessageGetStrategy { /// <summary> /// Will return messages before and after the base message. /// </summary> Around, /// <summary> /// Will return messages before the base message. /// </summary> Before, /// <summary> /// Will return message after the base message. /// </summary> After } }
mit
C#
3a0a03b8a3d085e300ce3ed43d4a25045cab95e2
Add null check
ZixiangBoy/dnlib,ilkerhalil/dnlib,picrap/dnlib,modulexcite/dnlib,Arthur2e5/dnlib,kiootic/dnlib,yck1509/dnlib,jorik041/dnlib,0xd4d/dnlib
src/DotNet/MemberMDInitializer.cs
src/DotNet/MemberMDInitializer.cs
// dnlib: See LICENSE.txt for more info using System.Collections.Generic; using dnlib.Threading; namespace dnlib.DotNet { /// <summary> /// Methods to load properties to make sure they're initialized /// </summary> static class MemberMDInitializer { /// <summary> /// Read every collection element /// </summary> /// <typeparam name="T">Collection element type</typeparam> /// <param name="coll">Collection</param> public static void Initialize<T>(IEnumerable<T> coll) { if (coll == null) return; foreach (var c in coll.GetSafeEnumerable()) { } } /// <summary> /// Load the object instance /// </summary> /// <param name="o">The value (ignored)</param> public static void Initialize(object o) { } } }
// dnlib: See LICENSE.txt for more info using System.Collections.Generic; using dnlib.Threading; namespace dnlib.DotNet { /// <summary> /// Methods to load properties to make sure they're initialized /// </summary> static class MemberMDInitializer { /// <summary> /// Read every collection element /// </summary> /// <typeparam name="T">Collection element type</typeparam> /// <param name="coll">Collection</param> public static void Initialize<T>(IEnumerable<T> coll) { foreach (var c in coll.GetSafeEnumerable()) { } } /// <summary> /// Load the object instance /// </summary> /// <param name="o">The value (ignored)</param> public static void Initialize(object o) { } } }
mit
C#
184a462b3c34e10866afcc6e83e05dbb1375797f
Rename IsEmail to IsEmailAddress
boumenot/Grobid.NET
src/Grobid/HeaderFeatureVector.cs
src/Grobid/HeaderFeatureVector.cs
namespace Grobid.NET { public class HeaderFeatureVector { public string Text { get; set; } public string AsLowerCase { get; set; } public string Prefix1 { get; set; } public string Prefix2 { get; set; } public string Prefix3 { get; set; } public string Prefix4 { get; set; } public string Suffix1 { get; set; } public string Suffix2 { get; set; } public string Suffix3 { get; set; } public string Suffix4 { get; set; } public BlockStatus BlockStatus { get; set; } public LineStatus LineStatus { get; set; } public FontStatus FontStatus { get; set; } public FontSizeStatus FontSizeStatus { get; set; } public bool IsBold { get; set; } public bool IsItalic { get; set; } public bool IsRotation { get; set; } public Capitalization Capitalization { get; set; } public Digit Digit { get; set; } public bool IsSingleChar { get; set; } public bool IsProperName { get; set; } public bool IsDictionaryWord { get; set; } public bool IsFirstName { get; set; } public bool IsLocationName { get; set; } public bool IsYear { get; set; } public bool IsMonth { get; set; } public bool IsEmailAddress { get; set; } public bool IsHttp { get; set; } public bool HasDash { get; set; } public Punctuation Punctuation { get; set; } } }
namespace Grobid.NET { public class HeaderFeatureVector { public string Text { get; set; } public string AsLowerCase { get; set; } public string Prefix1 { get; set; } public string Prefix2 { get; set; } public string Prefix3 { get; set; } public string Prefix4 { get; set; } public string Suffix1 { get; set; } public string Suffix2 { get; set; } public string Suffix3 { get; set; } public string Suffix4 { get; set; } public BlockStatus BlockStatus { get; set; } public LineStatus LineStatus { get; set; } public FontStatus FontStatus { get; set; } public FontSizeStatus FontSizeStatus { get; set; } public bool IsBold { get; set; } public bool IsItalic { get; set; } public bool IsRotation { get; set; } public Capitalization Capitalization { get; set; } public Digit Digit { get; set; } public bool IsSingleChar { get; set; } public bool IsProperName { get; set; } public bool IsDictionaryWord { get; set; } public bool IsFirstName { get; set; } public bool IsLocationName { get; set; } public bool IsYear { get; set; } public bool IsMonth { get; set; } public bool IsEmail { get; set; } public bool IsHttp { get; set; } public bool HasDash { get; set; } public Punctuation Punctuation { get; set; } } }
apache-2.0
C#
ee3a8e7b6254bb16b1f1281a5fa480c24b297441
Enable fat tests.
zarlo/Cosmos,jp2masa/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,jp2masa/Cosmos,CosmosOS/Cosmos,fanoI/Cosmos,tgiphil/Cosmos,jp2masa/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,tgiphil/Cosmos,trivalik/Cosmos,fanoI/Cosmos,trivalik/Cosmos,tgiphil/Cosmos,trivalik/Cosmos,fanoI/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos
Tests/Cosmos.TestRunner.Core/TestKernelSets.cs
Tests/Cosmos.TestRunner.Core/TestKernelSets.cs
using System; using System.Collections.Generic; namespace Cosmos.TestRunner.Core { public static class TestKernelSets { public static IEnumerable<Type> GetStableKernelTypes() { yield return typeof(VGACompilerCrash.Kernel); yield return typeof(Cosmos.Compiler.Tests.Bcl.Kernel); yield return typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel); yield return typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel); yield return typeof(SimpleStructsAndArraysTest.Kernel); yield return typeof(Cosmos.Compiler.Tests.Exceptions.Kernel); yield return typeof(Cosmos.Compiler.Tests.LinqTests.Kernel); yield return typeof(Cosmos.Compiler.Tests.MethodTests.Kernel); yield return typeof(Cosmos.Kernel.Tests.IO.Kernel); yield return typeof(Cosmos.Kernel.Tests.Fat.Kernel); //yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel); //yield return typeof(FrotzKernel.Kernel); } } }
using System; using System.Collections.Generic; namespace Cosmos.TestRunner.Core { public static class TestKernelSets { public static IEnumerable<Type> GetStableKernelTypes() { yield return typeof(VGACompilerCrash.Kernel); yield return typeof(Cosmos.Compiler.Tests.Bcl.Kernel); yield return typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel); yield return typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel); yield return typeof(SimpleStructsAndArraysTest.Kernel); yield return typeof(Cosmos.Compiler.Tests.Exceptions.Kernel); yield return typeof(Cosmos.Compiler.Tests.LinqTests.Kernel); yield return typeof(Cosmos.Compiler.Tests.MethodTests.Kernel); yield return typeof(Cosmos.Kernel.Tests.IO.Kernel); //yield return typeof(Cosmos.Kernel.Tests.Fat.Kernel); //yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel); //yield return typeof(FrotzKernel.Kernel); } } }
bsd-3-clause
C#
986941ed703decfac428f36bba0da07f063b3c5a
use ternary operator
kusl/Tree
VisualTree/TreeLibrary/BinarySearchTreeNode.cs
VisualTree/TreeLibrary/BinarySearchTreeNode.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TreeLibrary { public sealed class BinarySearchTreeNode { public BinarySearchTreeNode LeftChild { get; set; } public BinarySearchTreeNode RightChild { get; set; } public int? Value { get; set; } public BinarySearchTreeNode() { LeftChild = null; RightChild = null; Value = null; } public BinarySearchTreeNode(int value) { LeftChild = null; RightChild = null; Value = value; } public bool Equals(int value) { return this.Value == value ? true : false; } public bool IsLessThan(int value) { return this.Value < value ? true : false; } public bool IsGreaterThan(int value) { return this.Value > value ? true : false; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TreeLibrary { public sealed class BinarySearchTreeNode { public BinarySearchTreeNode LeftChild { get; set; } public BinarySearchTreeNode RightChild { get; set; } public int? Value { get; set; } public BinarySearchTreeNode() { LeftChild = null; RightChild = null; Value = null; } public BinarySearchTreeNode(int value) { LeftChild = null; RightChild = null; Value = value; } public bool Equals(int value) { if (this.Value == value) { return true; } else { return false; } } public bool IsLessThan(int value) { if (this.Value < value) { return true; } else { return false; } } public bool IsGreaterThan(int value) { if (this.Value > value) { return true; } else { return false; } } } }
agpl-3.0
C#
8b88fa4c16cd113376ba5140a57182d0f8bc4b8f
remove whitespace
agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov
WebAPI.Dashboard/App_Start/NinjectWebCommon.cs
WebAPI.Dashboard/App_Start/NinjectWebCommon.cs
using System; using System.Web; using Microsoft.Web.Infrastructure.DynamicModuleHelper; using Ninject; using Ninject.Web.Common; using Ninject.Web.Common.WebHost; using WebAPI.Common.Ninject.Modules; using WebAPI.Dashboard; using WebAPI.Dashboard.Ninject.Modules; [assembly: WebActivatorEx.PreApplicationStartMethod(typeof(NinjectWebCommon), "Start")] [assembly: WebActivatorEx.ApplicationShutdownMethod(typeof(NinjectWebCommon), "Stop")] namespace WebAPI.Dashboard { public static class NinjectWebCommon { private static readonly Bootstrapper Bootstrapper = new Bootstrapper(); /// <summary> /// Starts the application /// </summary> public static void Start() { DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule)); DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule)); Bootstrapper.Initialize(CreateKernel); } /// <summary> /// Stops the application. /// </summary> public static void Stop() { Bootstrapper.ShutDown(); } /// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { App.Kernel = new StandardKernel(); try { App.Kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel); App.Kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>(); RegisterServices(App.Kernel); return App.Kernel; } catch { App.Kernel.Dispose(); throw; } } /// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Load(typeof(RavenModule).Assembly); kernel.Load(typeof(FormsAuthModule).Assembly); } } }
using System; using System.Web; using Microsoft.Web.Infrastructure.DynamicModuleHelper; using Ninject; using Ninject.Web.Common; using Ninject.Web.Common.WebHost; using WebAPI.Common.Ninject.Modules; using WebAPI.Dashboard; using WebAPI.Dashboard.Ninject.Modules; [assembly: WebActivatorEx.PreApplicationStartMethod(typeof(NinjectWebCommon), "Start")] [assembly: WebActivatorEx.ApplicationShutdownMethod(typeof(NinjectWebCommon), "Stop")] namespace WebAPI.Dashboard { public static class NinjectWebCommon { private static readonly Bootstrapper Bootstrapper = new Bootstrapper(); /// <summary> /// Starts the application /// </summary> public static void Start() { DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule)); DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule)); Bootstrapper.Initialize(CreateKernel); } /// <summary> /// Stops the application. /// </summary> public static void Stop() { Bootstrapper.ShutDown(); } /// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { App.Kernel = new StandardKernel(); try { App.Kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel); App.Kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>(); RegisterServices(App.Kernel); return App.Kernel; } catch { App.Kernel.Dispose(); throw; } } /// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Load(typeof(RavenModule).Assembly); kernel.Load(typeof (FormsAuthModule).Assembly); } } }
mit
C#
b1a3b38c1a6dcfeaeb1088d77509547208ee8aeb
Add summaryField ObjectType #117
smartsheet-platform/smartsheet-csharp-sdk,smartsheet-platform/smartsheet-csharp-sdk
main/Smartsheet/Api/Models/SearchObjectType.cs
main/Smartsheet/Api/Models/SearchObjectType.cs
// #[license] // SmartsheetClient SDK for C# // %% // Copyright (C) 2014 SmartsheetClient // %% // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // %[license] using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.Runtime.Serialization; namespace Smartsheet.Api.Models { /// <summary> /// Represents object types. /// </summary> [JsonConverter(typeof(StringEnumConverter))] public enum SearchObjectType { // ObjectType must also be in all lower case when building the path. // Below, the EnumMembers turn the enums into lowercase only during serialization into JSON object [EnumMember(Value = "attachment")] ATTACHMENT, [EnumMember(Value = "discussion")] DISCUSSION, [EnumMember(Value = "folder")] FOLDER, [EnumMember(Value = "report")] REPORT, [EnumMember(Value = "row")] ROW, [EnumMember(Value = "sheet")] SHEET, [EnumMember(Value = "sight")] SIGHT, [EnumMember(Value = "summaryField")] SUMMARY_FIELD, [EnumMember(Value = "template")] TEMPLATE, [EnumMember(Value = "workspace")] WORKSPACE } }
// #[license] // SmartsheetClient SDK for C# // %% // Copyright (C) 2014 SmartsheetClient // %% // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // %[license] using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.Runtime.Serialization; namespace Smartsheet.Api.Models { /// <summary> /// Represents object types. /// </summary> [JsonConverter(typeof(StringEnumConverter))] public enum SearchObjectType { // ObjectType must also be in all lower case when building the path. // Below, the EnumMembers turn the enums into lowercase only during serialization into JSON object [EnumMember(Value = "row")] ROW, [EnumMember(Value = "sheet")] SHEET, [EnumMember(Value = "report")] REPORT, [EnumMember(Value = "template")] TEMPLATE, [EnumMember(Value = "discussion")] DISCUSSION, [EnumMember(Value = "attachment")] ATTACHMENT, [EnumMember(Value = "sight")] SIGHT, [EnumMember(Value = "folder")] FOLDER, [EnumMember(Value = "workspace")] WORKSPACE } }
apache-2.0
C#
2991804e5d34e36a7396a3a0580ff178fed9db52
remove unnecessary comments
matiii/Dijkstra.NET
src/Dijkstra.NET/Dijkstra.NET/Model/Node.cs
src/Dijkstra.NET/Dijkstra.NET/Model/Node.cs
namespace Dijkstra.NET.Model { using System; using System.Collections.Generic; using Contract; public class Node<T, TEdgeCustom>: INode<T, TEdgeCustom> where TEdgeCustom: IEquatable<TEdgeCustom> { public Node(uint key, T item) { Key = key; Item = item; Distance = Int32.MaxValue; } public IList<Edge<T, TEdgeCustom>> Children { get; } = new List<Edge<T, TEdgeCustom>>(); public uint Key { get; } public T Item { get; } public int Distance { get; set; } } }
namespace Dijkstra.NET.Model { using System; using System.Collections.Generic; using Contract; public class Node<T, TEdgeCustom>: INode<T, TEdgeCustom> where TEdgeCustom: IEquatable<TEdgeCustom> { public Node(uint key, T item) { Key = key; Item = item; Distance = Int32.MaxValue; } public IList<Edge<T, TEdgeCustom>> Children { get; } = new List<Edge<T, TEdgeCustom>>(); public uint Key { get; } public T Item { get; } public int Distance { get; set; } //public override int GetHashCode() => Key.GetHashCode(); //public override bool Equals(object obj) //{ // var that = obj as Node<T, TEdgeCustom>; // if (that == null || that.Key != Key) // return false; // return true; //} } }
mit
C#
8f09e9b910f36f877e748b91e1f4aeb90ddcab64
Update BohdanBenetskyi.cs (#715)
planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin
src/Firehose.Web/Authors/BohdanBenetskyi.cs
src/Firehose.Web/Authors/BohdanBenetskyi.cs
using Firehose.Web.Infrastructure; using System; using System.Collections.Generic; namespace Firehose.Web.Authors { public class BohdanBenetskyi : IAmACommunityMember { public string FirstName => "Bohdan"; public string LastName => "Benetskyi"; public string StateOrRegion => "Warsaw, Poland"; public string EmailAddress => "benetskyybogdan@gmail.com"; public string ShortBioOrTagLine => "Xamarin MVP, co-organizer of Xamarin Local Events in Rzeszow"; public Uri WebSite => new Uri("https://benetskyybogdan.medium.com/"); public string TwitterHandle => "bbenetskyy"; public string GitHubHandle => "bbenetskyy"; public string GravatarHash => "8bfa7db9239c2969b79468a58c8dd066"; public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://medium.com/feed/@benetskyybogdan/"); } } public GeoPosition Position => new GeoPosition(52.237049, 21.017532); public string FeedLanguageCode => "en"; } }
//using Firehose.Web.Infrastructure; //using System; //using System.Collections.Generic; //namespace Firehose.Web.Authors //{ // public class BohdanBenetskyi : IAmACommunityMember // { // public string FirstName => "Bohdan"; // public string LastName => "Benetskyi"; // public string StateOrRegion => "Rzeszow, Poland"; // public string EmailAddress => "benetskyybogdan@gmail.com"; // public string ShortBioOrTagLine => "Xamarin Software Developer, co-organizer of Xamarin Local Events in Rzeszow, Local CSS at Xamarin Advocate"; // public Uri WebSite => new Uri("https://medium.com/@benetskyybogdan/"); // public string TwitterHandle => "bbenetskyy"; // public string GitHubHandle => "bbenetskyy"; // public string GravatarHash => "8bfa7db9239c2969b79468a58c8dd066"; // public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://medium.com/feed/@benetskyybogdan/"); } } // public GeoPosition Position => new GeoPosition(50.041187, 21.999121); // public string FeedLanguageCode => "en"; // } //}
mit
C#
2e52a3ff10c90d3f83451bb5ab54c39ef99f4377
Fix code analysis
github/VisualStudio,shaunstanislaus/VisualStudio,ChristopherHackett/VisualStudio,modulexcite/VisualStudio,pwz3n0/VisualStudio,HeadhunterXamd/VisualStudio,GuilhermeSa/VisualStudio,8v060htwyc/VisualStudio,SaarCohen/VisualStudio,bbqchickenrobot/VisualStudio,GProulx/VisualStudio,amytruong/VisualStudio,AmadeusW/VisualStudio,github/VisualStudio,luizbon/VisualStudio,Dr0idKing/VisualStudio,yovannyr/VisualStudio,github/VisualStudio,mariotristan/VisualStudio,YOTOV-LIMITED/VisualStudio,bradthurber/VisualStudio,naveensrinivasan/VisualStudio,radnor/VisualStudio,nulltoken/VisualStudio
src/GitHub.Exports/ViewModels/IViewModel.cs
src/GitHub.Exports/ViewModels/IViewModel.cs
using System; namespace GitHub.ViewModels { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")] public interface IViewModel { } }
using System; namespace GitHub.ViewModels { public interface IViewModel { } }
mit
C#
de968c1842027d55da5d639782cad31b90fae2c7
Allow Leeroy to run until canceled in test mode.
LogosBible/Leeroy
src/Leeroy/Program.cs
src/Leeroy/Program.cs
using System; using System.Linq; using System.Runtime.InteropServices; using System.ServiceProcess; using System.Threading; using System.Threading.Tasks; namespace Leeroy { static class Program { /// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { if (args.FirstOrDefault() == "/test") { var tokenSource = new CancellationTokenSource(); Overseer overseer = new Overseer(tokenSource.Token, "BradleyGrainger", "Configuration", "master"); var task = Task.Factory.StartNew(overseer.Run, tokenSource, TaskCreationOptions.LongRunning); MessageBox(IntPtr.Zero, "Leeroy is running. Click OK to stop.", "Leeroy", 0); tokenSource.Cancel(); try { task.Wait(); } catch (AggregateException) { // TODO: verify this contains a single OperationCanceledException } // shut down task.Dispose(); tokenSource.Dispose(); } else { ServiceBase.Run(new ServiceBase[] { new Service() }); } } [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int MessageBox(IntPtr hWnd, String text, String caption, int options); } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceProcess; using System.Text; using System.Threading; namespace Leeroy { static class Program { /// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { if (args.FirstOrDefault() == "/test") { Overseer overseer = new Overseer(new CancellationTokenSource().Token, "BradleyGrainger", "Configuration", "master"); overseer.Run(null); } else { ServiceBase.Run(new ServiceBase[] { new Service() }); } } } }
mit
C#
fce392770fc300042aa4780a5147a69b5f8ee230
Update - Mar 07
motix/MotiNet-Core
src/MotiNet.Core/GenericResult.cs
src/MotiNet.Core/GenericResult.cs
using System.Collections.Generic; using System.Linq; namespace MotiNet { public class GenericResult { private static readonly GenericResult _success = new GenericResult { Succeeded = true }; private List<GenericError> _errors = new List<GenericError>(); public bool Succeeded { get; protected set; } public IEnumerable<GenericError> Errors => _errors; public static GenericResult Success => _success; public static GenericResult Failed(params GenericError[] errors) { var result = new GenericResult { Succeeded = false }; if (errors != null) { result._errors.AddRange(errors); } return result; } public static GenericResult GetResult(IEnumerable<GenericError> errors) { return errors.Count() > 0 ? Failed(errors.ToArray()) : Success; } public override string ToString() { return Succeeded ? "Succeeded" : $"Failed: {string.Join(", ", Errors.Select(x => x.Code).ToList())}"; } } }
using System.Collections.Generic; using System.Linq; namespace MotiNet { public class GenericResult { private static readonly GenericResult _success = new GenericResult { Succeeded = true }; private List<GenericError> _errors = new List<GenericError>(); public bool Succeeded { get; protected set; } public IEnumerable<GenericError> Errors => _errors; public static GenericResult Success => _success; public static GenericResult Failed(params GenericError[] errors) { var result = new GenericResult { Succeeded = false }; if (errors != null) { result._errors.AddRange(errors); } return result; } public override string ToString() { return Succeeded ? "Succeeded" : $"Failed: {string.Join(", ", Errors.Select(x => x.Code).ToList())}"; } } }
mit
C#
a9c56d5feb498948c18fca1e463ca12913163a61
Fix #1841 - Add Support Email Address to Contact Us page
ScottShingler/NuGetGallery,projectkudu/SiteExtensionGallery,mtian/SiteExtensionGallery,mtian/SiteExtensionGallery,mtian/SiteExtensionGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,projectkudu/SiteExtensionGallery,projectkudu/SiteExtensionGallery,skbkontur/NuGetGallery,skbkontur/NuGetGallery,grenade/NuGetGallery_download-count-patch,ScottShingler/NuGetGallery,skbkontur/NuGetGallery,grenade/NuGetGallery_download-count-patch
src/NuGetGallery/Views/Pages/Contact.cshtml
src/NuGetGallery/Views/Pages/Contact.cshtml
@{ ViewBag.Title = "Contact Us"; } <article class="contact"> <h2> Contact Us </h2> <p> Need help with NuGet? Let us know! </p> <h3>Having problems using a specific package?</h3> <p> If you're having trouble installing a specific package, try contacting the owner of that package first. You can reach them using the "Contact Owners" link on the package details page. </p> <h3>Is a package violating a license or otherwise abusive?</h3> <p> If you feel that a package is violating the license of software you own or is violating our terms of service, use the "Report Abuse" link on the package details page to report it directly to us. </p> <h3>Found a bug in NuGet or the website NuGet.org?</h3> <p> If you're having trouble with the <strong>NuGet.org Website</strong>, file a bug on the NuGet Gallery <a href="https://github.com/NuGet/NuGetGallery/issues">Issue Tracker</a>. </p> <p> If you're having trouble with the <strong>NuGet client tools</strong> (the Visual Studio extension, WebMatrix extension, NuGet.exe command line tool, etc.), file a bug on the NuGet Client <a href="https://nuget.codeplex.com/workitem/list/basic">Issue Tracker</a> </p> <h3>Talk to the NuGet development team and wider NuGet community</h3> <p> For support and general discussions we have the NuGet <a href="http://nuget.codeplex.com/discussions">discussion boards</a>. </p> <p> Need help with your NuGet.org account? Please feel free to <span id="emailUs"></span> </p> </article> @section BottomScripts { <script type="text/javascript"> $(function () { var part1 = "support"; var part2 = "nuget.org"; var part3 = "email us"; var link = $("<a>").attr("href", "mailto:" + part1 + "@@" + part2).text(part3); $("#emailUs").append(link); }); </script> }
@{ ViewBag.Title = "Contact Us"; } <article class="contact"> <h2> Contact Us </h2> <p> Need help with NuGet? Let us know! </p> <h3>Having problems using a specific package?</h3> <p> If you're having trouble installing a specific package, try contacting the owner of that package first. You can reach them using the "Contact Owners" link on the package details page. </p> <h3>Is a package violating a license or otherwise abusive?</h3> <p> If you feel that a package is violating the license of software you own or is violating our terms of service, use the "Report Abuse" link on the package details page to report it directly to us. </p> <h3>Found a bug in NuGet or the website NuGet.org?</h3> <p> If you're having trouble with the <strong>NuGet.org Website</strong>, file a bug on the NuGet Gallery <a href="https://github.com/NuGet/NuGetGallery/issues">Issue Tracker</a>. </p> <p> If you're having trouble with the <strong>NuGet client tools</strong> (the Visual Studio extension, WebMatrix extension, NuGet.exe command line tool, etc.), file a bug on the NuGet Client <a href="https://nuget.codeplex.com/workitem/list/basic">Issue Tracker</a> </p> <h3>Talk to the NuGet development team and wider NuGet community</h3> <p> For support and general discussions we have the NuGet <a href="http://nuget.codeplex.com/discussions">discussion boards</a>. </p> </article>
apache-2.0
C#
0295d05745a74873c21b38daafa3f53a52d8ff4c
use helper
cedrozor/myrtille,cedrozor/myrtille
Myrtille.Web/GetHash.aspx.cs
Myrtille.Web/GetHash.aspx.cs
/* Myrtille: A native HTML4/5 Remote Desktop Protocol client. Copyright(c) 2014-2018 Cedric Coste Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.IO; using System.Security.Cryptography; using System.Web.UI; using Myrtille.Helpers; namespace Myrtille.Web { public partial class GetHash : Page { /// <summary> /// retrieve the mouse cursor from the remote session and send it to the browser /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load( object sender, EventArgs e) { try { // retrieve params using (StreamWriter sw = new StreamWriter(Response.OutputStream)) { String password = Request.QueryString["Password"]; String encrypted = RDPCryptoHelper.EncryptPassword(password); sw.WriteLine(encrypted); } } catch (Exception exc) { System.Diagnostics.Trace.TraceError("Failed"); } } } }
/* Myrtille: A native HTML4/5 Remote Desktop Protocol client. Copyright(c) 2014-2018 Cedric Coste Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.IO; using System.Security.Cryptography; using System.Web.UI; namespace Myrtille.Web { public partial class GetHash : Page { /// <summary> /// retrieve the mouse cursor from the remote session and send it to the browser /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load( object sender, EventArgs e) { try { // retrieve params using (StreamWriter sw = new StreamWriter(Response.OutputStream)) { String password = Request.QueryString["Password"]; byte [] ea = ProtectedData.Protect(System.Text.Encoding.Unicode.GetBytes(password), null, DataProtectionScope.LocalMachine); foreach (byte b in ea) sw.Write(b.ToString("X2")); sw.WriteLine(); } } catch (Exception exc) { System.Diagnostics.Trace.TraceError("Failed"); } } } }
apache-2.0
C#
a527461b162a6d0cc6d898ce4a992d252337992d
Test su Console
alberto-chiesa/SlxUniAx
SlxUniAxTest/Program.cs
SlxUniAxTest/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Gianos.UniLib; namespace Gianos.SlxUniAxTest { class Program { static void Main(string[] args) { //var dbHandler = new DbHandler(".\\ACA2008", "BVSLX_PROD", "sa", "masterkey"); //var dbHandler = new DbHandler(".\\ACA2008", "BVSLX_PROD", "sysdba", "masterkey"); //var fields = dbHandler.ReadTableDataFromSLXDb(); var model = new SLXModelHandler(@"C:\Users\ACA.GIANOS\Documents\Dev\bvweb\Model"); var fields = model.FindEntityModels(); var dbHandler = new DbHandler(".\\ACA2008", "BVSLX_PROD", "sysdba", "masterkey"); fields = dbHandler.ReadTableDataFromSLXDb(fields); var f = fields["BVSTORE"]["COD_COUNTRY"]; //model.SetUnicodeOnSlxField(f, true); dbHandler.SetUnicodeOnDbField(f, true); //var s = dbHandler.GetCreateScriptForIndexes("C_BASE_TABLE", "NETSALEEUR"); //Console.Write(s); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Gianos.UniLib; namespace Gianos.SlxUniAxTest { class Program { static void Main(string[] args) { //var dbHandler = new DbHandler(".\\ACA2008", "BVSLX_PROD", "sa", "masterkey"); var dbHandler = new DbHandler(".\\ACA2008", "BVSLX_PROD", "sysdba", "masterkey"); } } }
mit
C#
662286ad8b7e24f28230f2243666e728f565816a
Use pattern matching
oocx/acme.net
src/Oocx.Asn1PKCS/Asn1BaseTypes/Asn1Serializer.cs
src/Oocx.Asn1PKCS/Asn1BaseTypes/Asn1Serializer.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace Oocx.Asn1PKCS.Asn1BaseTypes { public class Asn1Serializer : IAsn1Serializer { public IEnumerable<byte> Serialize(IAsn1Element element, int depth = 0) { string tabs = ""; for (int i = 0; i < depth; i++) { tabs += "\t"; } Trace.WriteLine($"{tabs}{element.GetType().Name} {element.Tag:x} (Total Size: {element.Size} Bytes, Data: {element.Length} Bytes)"); yield return element.Tag; foreach (var b in element.LengthBytes) yield return b; if (element is BitString bitString) { //yield return ((BitString)element).UnusedBits; } if (element is Asn1Primitive asn1Primitive) { foreach (var b in asn1Primitive.Data) yield return b; } else if (element is Asn1Container asn1Container) { foreach (var b in asn1Container.Children.SelectMany(e => Serialize(e, depth+1))) { yield return b; } } else { throw new Exception("Unknown Asn1 element type: " + element.GetType().FullName); } } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace Oocx.Asn1PKCS.Asn1BaseTypes { public class Asn1Serializer : IAsn1Serializer { public IEnumerable<byte> Serialize(IAsn1Element element, int depth = 0) { string tabs = ""; for (int i = 0; i < depth; i++) { tabs += "\t"; } Trace.WriteLine($"{tabs}{element.GetType().Name} {element.Tag:x} (Total Size: {element.Size} Bytes, Data: {element.Length} Bytes)"); yield return element.Tag; foreach (var b in element.LengthBytes) yield return b; if (element is BitString) { //yield return ((BitString)element).UnusedBits; } if (element is Asn1Primitive) { foreach (var b in ((Asn1Primitive)element).Data) yield return b; } else if (element is Asn1Container) { foreach (var b in ((Asn1Container) element).Children.SelectMany(e => Serialize(e, depth+1))) { yield return b; } } else { throw new Exception("Unknown Asn1 element type: " + element.GetType().FullName); } } } }
mit
C#
3ff53a3e8fccfd3e269a26945e1881666ff1c28b
Make sure extension-based metadata fallback works.
GNOME/f-spot,mans0954/f-spot,dkoeb/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,Yetangitu/f-spot,nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,dkoeb/f-spot,mans0954/f-spot,mono/f-spot,mono/f-spot,dkoeb/f-spot,Sanva/f-spot,GNOME/f-spot,GNOME/f-spot,dkoeb/f-spot,GNOME/f-spot,mans0954/f-spot,mans0954/f-spot,mans0954/f-spot,GNOME/f-spot,NguyenMatthieu/f-spot,nathansamson/F-Spot-Album-Exporter,Sanva/f-spot,mono/f-spot,nathansamson/F-Spot-Album-Exporter,Yetangitu/f-spot,mono/f-spot,Yetangitu/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,Sanva/f-spot,dkoeb/f-spot,NguyenMatthieu/f-spot,mono/f-spot,mono/f-spot,Yetangitu/f-spot,dkoeb/f-spot,nathansamson/F-Spot-Album-Exporter,Yetangitu/f-spot,NguyenMatthieu/f-spot
src/Utils/Metadata.cs
src/Utils/Metadata.cs
using Hyena; using TagLib; using System; using GLib; namespace FSpot.Utils { public static class Metadata { public static TagLib.Image.File Parse (SafeUri uri) { // Detect mime-type var gfile = FileFactory.NewForUri (uri); var info = gfile.QueryInfo ("standard::content-type", FileQueryInfoFlags.None, null); var mime = info.ContentType; if (mime.StartsWith ("application/x-extension-")) { // Works around broken metadata detection - https://bugzilla.gnome.org/show_bug.cgi?id=624781 mime = String.Format ("taglib/{0}", mime.Substring (24)); } // Parse file var res = new GIOTagLibFileAbstraction () { Uri = uri }; var sidecar_uri = uri.ReplaceExtension (".xmp"); var sidecar_res = new GIOTagLibFileAbstraction () { Uri = sidecar_uri }; TagLib.Image.File file = null; try { file = TagLib.File.Create (res, mime, ReadStyle.Average) as TagLib.Image.File; } catch (Exception) { Hyena.Log.DebugFormat ("Loading of metadata failed for file: {0}, trying extension fallback", uri); try { file = TagLib.File.Create (res, ReadStyle.Average) as TagLib.Image.File; } catch (Exception e) { Hyena.Log.DebugFormat ("Loading of metadata failed for file: {0}", uri); Hyena.Log.DebugException (e); return null; } } // Load XMP sidecar var sidecar_file = GLib.FileFactory.NewForUri (sidecar_uri); if (sidecar_file.Exists) { file.ParseXmpSidecar (sidecar_res); } return file; } } }
using Hyena; using TagLib; using System; using GLib; namespace FSpot.Utils { public static class Metadata { public static TagLib.Image.File Parse (SafeUri uri) { // Detect mime-type var gfile = FileFactory.NewForUri (uri); var info = gfile.QueryInfo ("standard::content-type", FileQueryInfoFlags.None, null); var mime = info.ContentType; if (mime.StartsWith ("application/x-extension-")) { // Works around broken metadata detection - https://bugzilla.gnome.org/show_bug.cgi?id=624781 mime = String.Format ("taglib/{0}", mime.Substring (24)); } // Parse file var res = new GIOTagLibFileAbstraction () { Uri = uri }; var sidecar_uri = uri.ReplaceExtension (".xmp"); var sidecar_res = new GIOTagLibFileAbstraction () { Uri = sidecar_uri }; TagLib.Image.File file = null; try { file = TagLib.File.Create (res, mime, ReadStyle.Average) as TagLib.Image.File; } catch (Exception e) { Hyena.Log.DebugFormat ("Loading of Metadata failed for file: {0}", uri); Hyena.Log.DebugException (e); return null; } // Load XMP sidecar var sidecar_file = GLib.FileFactory.NewForUri (sidecar_uri); if (sidecar_file.Exists) { file.ParseXmpSidecar (sidecar_res); } return file; } } }
mit
C#
7de6bf57515bbf1eaefaae4a6cdcf8d84d342b47
Fix cake script to search tests
rmterra/NesZord
build.cake
build.cake
#addin Cake.Coveralls #tool "xunit.runner.console" #tool "nuget:?package=OpenCover" #tool coveralls.io var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); var outDir = "./artifacts"; var solution = "./src/NesZord.sln"; var testProjects = $"./src/**/bin/{configuration}/*.Tests.dll"; var coveralls_token = EnvironmentVariable("COVERALLS_REPO_TOKEN") ?? "undefined"; Task("Restore-NuGet-Packages") .Does(() => { NuGetRestore(solution); }); Task("Build") .IsDependentOn("Restore-NuGet-Packages") .Does(() => { MSBuild(solution, new MSBuildSettings { Configuration = configuration, Verbosity = Verbosity.Minimal, ToolVersion = MSBuildToolVersion.VS2017 }); }); Task("RunTests") .IsDependentOn("Build") .Does(() => { OpenCover(tool => { tool.XUnit2(testProjects, new XUnit2Settings { ShadowCopy = false, XmlReport = true, OutputDirectory = outDir }); }, new FilePath("./coverage.xml"), new OpenCoverSettings() .WithFilter("+[NesZord.*]*") .WithFilter("-[NesZord.Tests.*]*")); }); Task("Upload-Coverage-Report") .IsDependentOn("RunTests") .Does(() => { CoverallsIo("./coverage.xml", new CoverallsIoSettings() { RepoToken = coveralls_token }); }); Task("Default") .IsDependentOn("RunTests"); Task("AppVeyor") .IsDependentOn("Upload-Coverage-Report"); RunTarget(target);
#addin Cake.Coveralls #tool "xunit.runner.console" #tool "nuget:?package=OpenCover" #tool coveralls.io var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); var outDir = "./artifacts"; var solution = "./src/NesZord.sln"; var testProjects = $"./src/**/bin/{configuration}/*.Tests.New.dll"; var coveralls_token = EnvironmentVariable("COVERALLS_REPO_TOKEN") ?? "undefined"; Task("Restore-NuGet-Packages") .Does(() => { NuGetRestore(solution); }); Task("Build") .IsDependentOn("Restore-NuGet-Packages") .Does(() => { MSBuild(solution, new MSBuildSettings { Configuration = configuration, Verbosity = Verbosity.Minimal, ToolVersion = MSBuildToolVersion.VS2017 }); }); Task("RunTests") .IsDependentOn("Build") .Does(() => { OpenCover(tool => { tool.XUnit2(testProjects, new XUnit2Settings { ShadowCopy = false, XmlReport = true, OutputDirectory = outDir }); }, new FilePath("./coverage.xml"), new OpenCoverSettings() .WithFilter("+[NesZord.*]*") .WithFilter("-[NesZord.Tests.*]*")); }); Task("Upload-Coverage-Report") .IsDependentOn("RunTests") .Does(() => { CoverallsIo("./coverage.xml", new CoverallsIoSettings() { RepoToken = coveralls_token }); }); Task("Default") .IsDependentOn("RunTests"); Task("AppVeyor") .IsDependentOn("Upload-Coverage-Report"); RunTarget(target);
apache-2.0
C#
8d9b882edefb600df1914c859ab38e0e40ff533a
remove todos only
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Portal.Worker/Program.cs
src/SFA.DAS.EAS.Portal.Worker/Program.cs
using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SFA.DAS.EAS.Portal.DependencyResolution; using SFA.DAS.EAS.Portal.Worker.Startup; using SFA.DAS.EAS.Portal.Startup; using SFA.DAS.EAS.Portal.Worker.StartupJobs; namespace SFA.DAS.EAS.Portal.Worker { class Program { static async Task Main(string[] args) { using (var host = CreateHostBuilder(args).Build()) { await host.StartAsync(); var jobHost = host.Services.GetService<IJobHost>(); await jobHost.CallAsync(nameof(CreateReadStoreDatabaseJob.CreateReadStoreDatabase)); await host.WaitForShutdownAsync(); } } private static IHostBuilder CreateHostBuilder(string[] args) => new HostBuilder() .ConfigureDasWebJobs() .ConfigureDasAppConfiguration(args) .ConfigureDasLogging() .UseApplicationInsights() .UseDasEnvironment() .UseConsoleLifetime() .ConfigureServices(s => s.AddApplicationServices()) .ConfigureServices(s => s.AddCosmosDatabase()) .ConfigureServices(s => s.AddDasNServiceBus()); } }
using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SFA.DAS.EAS.Portal.DependencyResolution; using SFA.DAS.EAS.Portal.Worker.Startup; using SFA.DAS.EAS.Portal.Startup; using SFA.DAS.EAS.Portal.Worker.StartupJobs; namespace SFA.DAS.EAS.Portal.Worker { class Program { static async Task Main(string[] args) { using (var host = CreateHostBuilder(args).Build()) { await host.StartAsync(); var jobHost = host.Services.GetService<IJobHost>(); await jobHost.CallAsync(nameof(CreateReadStoreDatabaseJob.CreateReadStoreDatabase)); await host.WaitForShutdownAsync(); } } private static IHostBuilder CreateHostBuilder(string[] args) => new HostBuilder() .ConfigureDasWebJobs() .ConfigureDasAppConfiguration(args) .ConfigureDasLogging() //todo: need to check logging/redis/use of localhost:6379 locally .UseApplicationInsights() // todo: need to add APPINSIGHTS_INSTRUMENTATIONKEY to config somewhere. where does it normally live? we could store it in table storage .UseDasEnvironment() .UseConsoleLifetime() .ConfigureServices(s => s.AddApplicationServices()) .ConfigureServices(s => s.AddCosmosDatabase()) .ConfigureServices(s => s.AddDasNServiceBus()); } }
mit
C#
887a3f3e2834def69ef7fa399cfd8c89444fe464
Fix preposition for exclusive fullscreen prompt
peppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu,ppy/osu
osu.Game/Localisation/LayoutSettingsStrings.cs
osu.Game/Localisation/LayoutSettingsStrings.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.Localisation; namespace osu.Game.Localisation { public static class LayoutSettingsStrings { private const string prefix = @"osu.Game.Resources.Localisation.LayoutSettings"; /// <summary> /// "Checking for fullscreen capabilities..." /// </summary> public static LocalisableString CheckingForFullscreenCapabilities => new TranslatableString(getKey(@"checking_for_fullscreen_capabilities"), @"Checking for fullscreen capabilities..."); /// <summary> /// "osu! is running in exclusive fullscreen, guaranteeing low latency!" /// </summary> public static LocalisableString OsuIsRunningExclusiveFullscreen => new TranslatableString(getKey(@"osu_is_running_exclusive_fullscreen"), @"osu! is running in exclusive fullscreen, guaranteeing low latency!"); /// <summary> /// "Unable to run exclusive fullscreen. You&#39;ll still experience some input latency." /// </summary> public static LocalisableString UnableToRunExclusiveFullscreen => new TranslatableString(getKey(@"unable_to_run_exclusive_fullscreen"), @"Unable to run exclusive fullscreen. You'll still experience some input latency."); /// <summary> /// "Using fullscreen on macOS makes interacting with the menu bar and spaces no longer work, and may lead to freezes if a system dialog is presented. Using borderless is recommended." /// </summary> public static LocalisableString FullscreenMacOSNote => new TranslatableString(getKey(@"fullscreen_macos_note"), @"Using fullscreen on macOS makes interacting with the menu bar and spaces no longer work, and may lead to freezes if a system dialog is presented. Using borderless is recommended."); /// <summary> /// "Excluding overlays" /// </summary> public static LocalisableString ScaleEverythingExcludingOverlays => new TranslatableString(getKey(@"scale_everything_excluding_overlays"), @"Excluding overlays"); /// <summary> /// "Everything" /// </summary> public static LocalisableString ScaleEverything => new TranslatableString(getKey(@"scale_everything"), @"Everything"); /// <summary> /// "Gameplay" /// </summary> public static LocalisableString ScaleGameplay => new TranslatableString(getKey(@"scale_gameplay"), @"Gameplay"); /// <summary> /// "Off" /// </summary> public static LocalisableString ScalingOff => new TranslatableString(getKey(@"scaling_off"), @"Off"); private static string getKey(string key) => $@"{prefix}:{key}"; } }
// 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.Localisation; namespace osu.Game.Localisation { public static class LayoutSettingsStrings { private const string prefix = @"osu.Game.Resources.Localisation.LayoutSettings"; /// <summary> /// "Checking for fullscreen capabilities..." /// </summary> public static LocalisableString CheckingForFullscreenCapabilities => new TranslatableString(getKey(@"checking_for_fullscreen_capabilities"), @"Checking for fullscreen capabilities..."); /// <summary> /// "osu! is running exclusive fullscreen, guaranteeing low latency!" /// </summary> public static LocalisableString OsuIsRunningExclusiveFullscreen => new TranslatableString(getKey(@"osu_is_running_exclusive_fullscreen"), @"osu! is running exclusive fullscreen, guaranteeing low latency!"); /// <summary> /// "Unable to run exclusive fullscreen. You&#39;ll still experience some input latency." /// </summary> public static LocalisableString UnableToRunExclusiveFullscreen => new TranslatableString(getKey(@"unable_to_run_exclusive_fullscreen"), @"Unable to run exclusive fullscreen. You'll still experience some input latency."); /// <summary> /// "Using fullscreen on macOS makes interacting with the menu bar and spaces no longer work, and may lead to freezes if a system dialog is presented. Using borderless is recommended." /// </summary> public static LocalisableString FullscreenMacOSNote => new TranslatableString(getKey(@"fullscreen_macos_note"), @"Using fullscreen on macOS makes interacting with the menu bar and spaces no longer work, and may lead to freezes if a system dialog is presented. Using borderless is recommended."); /// <summary> /// "Excluding overlays" /// </summary> public static LocalisableString ScaleEverythingExcludingOverlays => new TranslatableString(getKey(@"scale_everything_excluding_overlays"), @"Excluding overlays"); /// <summary> /// "Everything" /// </summary> public static LocalisableString ScaleEverything => new TranslatableString(getKey(@"scale_everything"), @"Everything"); /// <summary> /// "Gameplay" /// </summary> public static LocalisableString ScaleGameplay => new TranslatableString(getKey(@"scale_gameplay"), @"Gameplay"); /// <summary> /// "Off" /// </summary> public static LocalisableString ScalingOff => new TranslatableString(getKey(@"scaling_off"), @"Off"); private static string getKey(string key) => $@"{prefix}:{key}"; } }
mit
C#
741d372fa57c1d7afc1955db1130c0551d5d855a
Change Sitecore sign in URL to /sitecore/login (#314)
kamsar/Unicorn,kamsar/Unicorn
src/Unicorn/ControlPanel/Controls/AccessDenied.cs
src/Unicorn/ControlPanel/Controls/AccessDenied.cs
using System.Web; using System.Web.UI; namespace Unicorn.ControlPanel.Controls { internal class AccessDenied : IControlPanelControl { public void Render(HtmlTextWriter writer) { writer.Write("<h4>Access Denied</h4>"); writer.WriteLine("<!--"); writer.WriteLine(" ("); writer.WriteLine(" _ ) )"); writer.WriteLine(" _,(_)._ (("); writer.WriteLine(" ___,(_______). )"); writer.WriteLine(" ,\'__. / \\ /\\_"); writer.WriteLine(" /,\' / |\"\"| \\ / /"); writer.WriteLine("| | | |__| |,\' /"); writer.WriteLine(" \\`.| /"); writer.WriteLine(" `. : : /"); writer.WriteLine(" `. :.,\'"); writer.WriteLine(" `-.________,-\'"); writer.WriteLine("-->"); writer.Write($"<p>You need to <a href=\"/sitecore/login?returnUrl={HttpUtility.UrlEncode(HttpContext.Current.Request.Url.PathAndQuery)}\">sign in to Sitecore as an administrator</a> to use the Unicorn control panel.</p>"); HttpContext.Current.Response.TrySkipIisCustomErrors = true; // Returning 401 is causing issues on Sitecore 9. See #287 https://github.com/SitecoreUnicorn/Unicorn/issues/287 // Returning 418 I'm a Teapot, instead. Unicorn refuses to brew coffee to people not authenticated. // Assuming it is doubtful Sitecore has, or will ever, do any special handling for this situation. HttpContext.Current.Response.StatusCode = 418; } } }
using System.Web; using System.Web.UI; namespace Unicorn.ControlPanel.Controls { internal class AccessDenied : IControlPanelControl { public void Render(HtmlTextWriter writer) { writer.Write("<h4>Access Denied</h4>"); writer.WriteLine("<!--"); writer.WriteLine(" ("); writer.WriteLine(" _ ) )"); writer.WriteLine(" _,(_)._ (("); writer.WriteLine(" ___,(_______). )"); writer.WriteLine(" ,\'__. / \\ /\\_"); writer.WriteLine(" /,\' / |\"\"| \\ / /"); writer.WriteLine("| | | |__| |,\' /"); writer.WriteLine(" \\`.| /"); writer.WriteLine(" `. : : /"); writer.WriteLine(" `. :.,\'"); writer.WriteLine(" `-.________,-\'"); writer.WriteLine("-->"); writer.Write("<p>You need to <a href=\"/sitecore/admin/login.aspx?ReturnUrl={0}\">sign in to Sitecore as an administrator</a> to use the Unicorn control panel.</p>", HttpUtility.UrlEncode(HttpContext.Current.Request.Url.PathAndQuery)); HttpContext.Current.Response.TrySkipIisCustomErrors = true; // Returning 401 is causing issues on Sitecore 9. See #287 https://github.com/SitecoreUnicorn/Unicorn/issues/287 // Returning 418 I'm a Teapot, instead. Unicorn refuses to brew coffee to people not authenticated. // Assuming it is doubtful Sitecore has, or will ever, do any special handling for this situation. HttpContext.Current.Response.StatusCode = 418; } } }
mit
C#
0109753b0078a0630e656be8501ec2e2f340483d
Change Bridge.Translator -> Bridge.Compiler for Bridge.Translator's `AssemblyInfo` `[AssemblyProduct]`
bridgedotnet/Bridge,AndreyZM/Bridge,AndreyZM/Bridge,bridgedotnet/Bridge,AndreyZM/Bridge,bridgedotnet/Bridge,AndreyZM/Bridge,bridgedotnet/Bridge
Compiler/Translator/Properties/AssemblyInfo.cs
Compiler/Translator/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Bridge.Compiler")] [assembly: AssemblyProduct("Bridge.Compiler")] [assembly: AssemblyDescription("Bridge.NET Compiler")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("ac6f7c4d-87e1-4f66-912b-6fe33383543c")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Bridge.Translator")] [assembly: AssemblyProduct("Bridge.Translator")] [assembly: AssemblyDescription("Bridge.NET Translator")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("ac6f7c4d-87e1-4f66-912b-6fe33383543c")]
apache-2.0
C#
8fae55bea950d06c83395a1c56d85d0618b8a576
Correct what is sent to output pane (#97)
nanoframework/nf-Visual-Studio-extension,Eclo/nf-Visual-Studio-extension,Eclo/nf-Visual-Studio-extension,Eclo/nf-Visual-Studio-extension
source/VisualStudio.Extension/Extensions/IVsOutputWindowPaneExtensions.cs
source/VisualStudio.Extension/Extensions/IVsOutputWindowPaneExtensions.cs
// // Copyright (c) 2017 The nanoFramework project contributors // See LICENSE file in the project root for full license information. // using Microsoft.VisualStudio.Shell.Interop; using System; namespace nanoFramework.Tools.VisualStudio.Extension { public static class IVsOutputWindowPaneExtensions { /// <summary> /// Writes text to the output window pane followed by a line terminator /// </summary> /// <param name="pane"></param> /// <param name="pszOutputString">Text to be appended to the output window pane.</param> public static void OutputStringAsLine(this IVsOutputWindowPane pane, string pszOutputString) { pane.OutputString(pszOutputString + Environment.NewLine); } } }
// // Copyright (c) 2017 The nanoFramework project contributors // See LICENSE file in the project root for full license information. // using Microsoft.VisualStudio.Shell.Interop; using System; namespace nanoFramework.Tools.VisualStudio.Extension { public static class IVsOutputWindowPaneExtensions { /// <summary> /// Writes text to the output window pane followed by a line terminator /// </summary> /// <param name="pane"></param> /// <param name="pszOutputString">Text to be appended to the output window pane.</param> public static void OutputStringAsLine(this IVsOutputWindowPane pane, string pszOutputString) { pane.OutputString(pane + Environment.NewLine); } } }
mit
C#
4cde3fd9872ed0fa801c45acb9c2850e31c1738c
Revert change to .NET desktop default directory logic
couchbase/couchbase-lite-net,couchbase/couchbase-lite-net,couchbase/couchbase-lite-net
src/Couchbase.Lite.Support.NetDesktop/Support/DefaultDirectoryResolver.cs
src/Couchbase.Lite.Support.NetDesktop/Support/DefaultDirectoryResolver.cs
// // DefaultDirectoryResolver.cs // // Copyright (c) 2017 Couchbase, 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 System; using System.IO; using Couchbase.Lite.DI; namespace Couchbase.Lite.Support { // NOTE: AppContext.BaseDirectory is not entirely reliable, but there is no other choice // It seems to usually be in the right place? [CouchbaseDependency] internal sealed class DefaultDirectoryResolver : IDefaultDirectoryResolver { #region IDefaultDirectoryResolver public string DefaultDirectory() { var baseDirectory = AppContext.BaseDirectory ?? throw new RuntimeException("BaseDirectory was null, cannot continue..."); return Path.Combine(baseDirectory, "CouchbaseLite"); } #endregion } }
// // DefaultDirectoryResolver.cs // // Copyright (c) 2017 Couchbase, 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 System; using System.IO; using Couchbase.Lite.DI; namespace Couchbase.Lite.Support { // NOTE: AppContext.BaseDirectory is not entirely reliable, but there is no other choice // It seems to usually be in the right place? [CouchbaseDependency] internal sealed class DefaultDirectoryResolver : IDefaultDirectoryResolver { #region IDefaultDirectoryResolver public string DefaultDirectory() { var dllDirectory = Path.GetDirectoryName(typeof(DefaultDirectoryResolver).Assembly.Location); return Path.Combine(dllDirectory, "CouchbaseLite"); } #endregion } }
apache-2.0
C#
f62992ccfa8f1c270d6452f090e241a51f07e058
clean comment
bitzhuwei/CSharpGL,bitzhuwei/CSharpGL,bitzhuwei/CSharpGL
Demos/DeferredShading/ManyCubesNode.shaders.cs
Demos/DeferredShading/ManyCubesNode.shaders.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using CSharpGL; namespace DeferredShading { partial class ManyCubesNode { private const string firstPassVert = @"#version 330 core in vec3 vPosition; in vec3 vColor; uniform mat4 MVP; out vec3 passColor; void main() { gl_Position = MVP * vec4(vPosition, 1); passColor = vColor; } "; private const string firstPassFrag = @"#version 330 core in vec3 passColor; layout (location = 0) out vec3 vFragColor; void main() { vFragColor = passColor; } "; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using CSharpGL; namespace DeferredShading { partial class ManyCubesNode { private const string firstPassVert = @"#version 330 core in vec3 vPosition; // per-vertex position in vec3 vColor; // per-vertex normal uniform mat4 MVP; // combined model view projection matrix out vec3 passColor; void main() { gl_Position = MVP * vec4(vPosition, 1); passColor = vColor; } "; private const string firstPassFrag = @"#version 330 core in vec3 passColor; layout (location = 0) out vec3 vFragColor; void main() { vFragColor = passColor; } "; } }
mit
C#
c8bdfc09527b99948fa12d094bad6059f85f093d
Update Config info for AzureProvisioningConfig
johnkors/azure-sdk-tools,antonba/azure-sdk-tools,DinoV/azure-sdk-tools,johnkors/azure-sdk-tools,Madhukarc/azure-sdk-tools,Madhukarc/azure-sdk-tools,akromm/azure-sdk-tools,akromm/azure-sdk-tools,DinoV/azure-sdk-tools,markcowl/azure-sdk-tools,antonba/azure-sdk-tools,markcowl/azure-sdk-tools,DinoV/azure-sdk-tools,markcowl/azure-sdk-tools,johnkors/azure-sdk-tools,Madhukarc/azure-sdk-tools,markcowl/azure-sdk-tools,johnkors/azure-sdk-tools,akromm/azure-sdk-tools,Madhukarc/azure-sdk-tools,DinoV/azure-sdk-tools,antonba/azure-sdk-tools,antonba/azure-sdk-tools,Madhukarc/azure-sdk-tools,johnkors/azure-sdk-tools,akromm/azure-sdk-tools,akromm/azure-sdk-tools,DinoV/azure-sdk-tools,markcowl/azure-sdk-tools,antonba/azure-sdk-tools
WindowsAzurePowershell/src/Management.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureProvisioningConfigInfo.cs
WindowsAzurePowershell/src/Management.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureProvisioningConfigInfo.cs
using System; // ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- namespace Microsoft.WindowsAzure.Management.ServiceManagement.Test.FunctionalTests.ConfigDataInfo { using Microsoft.Samples.WindowsAzure.ServiceManagement; public class AzureProvisioningConfigInfo { public OS OS; public readonly string Password; public CertificateSettingList Certs = new CertificateSettingList(); public string LinuxUser = (string) null; public string Option = (string) null; public string JoinDomain = (string)null; public string Domain = (string)null; public string DomainUserName = (string)null; public string DomainPassword = (string)null; public bool Reset = false; public bool DisableAutomaticUpdate = false; public bool DisableSSH = false; public bool NoRDPEndpoint = false; public bool NoSSHEndpoint = false; public AzureProvisioningConfigInfo(string option, string joinDomain, string domain, string domainUserName, string domainPassword, string password, bool resetPasswordFirstLogon) { this.Option = option; this.Password = password; this.Domain = domain; this.JoinDomain = joinDomain; this.DomainUserName = domainUserName; this.DomainPassword = domainPassword; this.Reset = resetPasswordFirstLogon; } public AzureProvisioningConfigInfo(OS os, string user, string password) { this.OS = os; this.Password = password; this.LinuxUser = user; } public AzureProvisioningConfigInfo(OS os, string password) { this.OS = os; this.Password = password; } public AzureProvisioningConfigInfo(OS os, CertificateSettingList certs, string password) { this.OS = os; this.Password = password; foreach (CertificateSetting cert in certs) { Certs.Add(cert); } } public Model.PersistentVM Vm { get; set; } } }
using System; // ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- namespace Microsoft.WindowsAzure.Management.ServiceManagement.Test.FunctionalTests.ConfigDataInfo { public class AzureProvisioningConfigInfo { public readonly OS OS; public readonly string Password; public AzureProvisioningConfigInfo(OS os, string password) { this.OS = os; this.Password = password; } public Model.PersistentVM Vm { get; set; } } }
apache-2.0
C#
b50462728e726526fc47666b6a7d6501579529a7
Fix license header
peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework
osu.Framework/Graphics/OpenGL/DepthValue.cs
osu.Framework/Graphics/OpenGL/DepthValue.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Runtime.CompilerServices; namespace osu.Framework.Graphics.OpenGL { /// <summary> /// The depth value used to draw 2D objects to the screen. /// Starts at -1f and increments to 1f for each <see cref="Drawable"/> which draws a hull through <see cref="DrawNode.DrawHull"/>. /// </summary> public class DepthValue { /// <summary> /// A safe value, such that rounding issues don't occur within 16-bit float precision. /// </summary> private const float increment = 0.001f; /// <summary> /// Calculated as (1 - (-1)) / increment - 1. /// -1 is subtracted since a depth of 1.0f conflicts with the default backbuffer clear value. /// </summary> private const int max_count = 1999; private float depth = -1; private int count; [MethodImpl(MethodImplOptions.AggressiveInlining)] public float Increment() { depth += increment; count++; return depth; } public bool CanIncrement { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => count != max_count - 1; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator float(DepthValue d) => d.depth; } }
// Copyright (c) 2007-2019 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Runtime.CompilerServices; namespace osu.Framework.Graphics.OpenGL { /// <summary> /// The depth value used to draw 2D objects to the screen. /// Starts at -1f and increments to 1f for each <see cref="Drawable"/> which draws a hull through <see cref="DrawNode.DrawHull"/>. /// </summary> public class DepthValue { /// <summary> /// A safe value, such that rounding issues don't occur within 16-bit float precision. /// </summary> private const float increment = 0.001f; /// <summary> /// Calculated as (1 - (-1)) / increment - 1. /// -1 is subtracted since a depth of 1.0f conflicts with the default backbuffer clear value. /// </summary> private const int max_count = 1999; private float depth = -1; private int count; [MethodImpl(MethodImplOptions.AggressiveInlining)] public float Increment() { depth += increment; count++; return depth; } public bool CanIncrement { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => count != max_count - 1; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator float(DepthValue d) => d.depth; } }
mit
C#
d489a77fe18c3a3f06b1cccb733fdb8a410bcb39
remove new container and comment
smoogipooo/osu,johnneijzen/osu,NeoAdonis/osu,smoogipoo/osu,EVAST9919/osu,peppy/osu,ZLima12/osu,EVAST9919/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,johnneijzen/osu,peppy/osu,UselessToucan/osu,ppy/osu,peppy/osu,2yangk23/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,ZLima12/osu,smoogipoo/osu
osu.Game/Screens/Play/ReplayPlayerLoader.cs
osu.Game/Screens/Play/ReplayPlayerLoader.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.Game.Scoring; namespace osu.Game.Screens.Play { public class ReplayPlayerLoader : PlayerLoader { private readonly ScoreInfo scoreInfo; public ReplayPlayerLoader(Score score) : base(() => new ReplayPlayer(score)) { scoreInfo = score.ScoreInfo; } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = base.CreateChildDependencies(parent); Mods.Value = scoreInfo.Mods; Ruleset.Value = scoreInfo.Ruleset; return dependencies; } } }
// 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.Game.Scoring; namespace osu.Game.Screens.Play { public class ReplayPlayerLoader : PlayerLoader { private readonly ScoreInfo scoreInfo; public ReplayPlayerLoader(Score score) : base(() => new ReplayPlayer(score)) { scoreInfo = score.ScoreInfo; } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); // Overwrite the global mods here for use in the mod hud. Mods.Value = scoreInfo.Mods; Ruleset.Value = scoreInfo.Ruleset; return dependencies; } } }
mit
C#
fae0d2eab2aebf8ed8d20af3288ecbff6a5f8284
Update AssemblyInfo.cs
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
src/Core2D.SkiaDemo/Properties/AssemblyInfo.cs
src/Core2D.SkiaDemo/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; [assembly: ComVisible(false)] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Core2D.SkiaDemo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Core2D.SkiaDemo")] [assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
a5c9d0c4942fe7e0bb01addad11b6dba3ef05834
Make ReadOnlyCollection override Collection<T>.IsReadOnly
saynomoo/cecil,cgourlay/cecil,joj/cecil,furesoft/cecil,ttRevan/cecil,SiliconStudio/Mono.Cecil,gluck/cecil,mono/cecil,jbevain/cecil,xen2/cecil,kzu/cecil,fnajera-rac-de/cecil,sailro/cecil
Mono.Collections.Generic/ReadOnlyCollection.cs
Mono.Collections.Generic/ReadOnlyCollection.cs
// // ReadOnlyCollection.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // 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.Collections; using System .Collections.Generic; namespace Mono.Collections.Generic { public sealed class ReadOnlyCollection<T> : Collection<T>, ICollection<T>, IList { static ReadOnlyCollection<T> empty; public static ReadOnlyCollection<T> Empty { get { return empty ?? (empty = new ReadOnlyCollection<T> ()); } } bool ICollection<T>.IsReadOnly { get { return true; } } bool IList.IsReadOnly { get { return true; } } private ReadOnlyCollection () { } public ReadOnlyCollection (T [] array) { if (array == null) throw new ArgumentNullException (); this.items = array; this.size = array.Length; } public ReadOnlyCollection (Collection<T> collection) { if (collection == null) throw new ArgumentNullException (); this.items = collection.items; this.size = collection.size; } internal override void Grow (int desired) { throw new InvalidOperationException (); } protected override void OnAdd (T item, int index) { throw new InvalidOperationException (); } protected override void OnClear () { throw new InvalidOperationException (); } protected override void OnInsert (T item, int index) { throw new InvalidOperationException (); } protected override void OnRemove (T item, int index) { throw new InvalidOperationException (); } protected override void OnSet (T item, int index) { throw new InvalidOperationException (); } } }
// // ReadOnlyCollection.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // 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.Collections; namespace Mono.Collections.Generic { public sealed class ReadOnlyCollection<T> : Collection<T>, IList { static ReadOnlyCollection<T> empty; public static ReadOnlyCollection<T> Empty { get { return empty ?? (empty = new ReadOnlyCollection<T> ()); } } bool IList.IsReadOnly { get { return true; } } private ReadOnlyCollection () { } public ReadOnlyCollection (T [] array) { if (array == null) throw new ArgumentNullException (); this.items = array; this.size = array.Length; } public ReadOnlyCollection (Collection<T> collection) { if (collection == null) throw new ArgumentNullException (); this.items = collection.items; this.size = collection.size; } internal override void Grow (int desired) { throw new InvalidOperationException (); } protected override void OnAdd (T item, int index) { throw new InvalidOperationException (); } protected override void OnClear () { throw new InvalidOperationException (); } protected override void OnInsert (T item, int index) { throw new InvalidOperationException (); } protected override void OnRemove (T item, int index) { throw new InvalidOperationException (); } protected override void OnSet (T item, int index) { throw new InvalidOperationException (); } } }
mit
C#
2da795254e0a1f607e3b0af3848f53b96039c712
Simplify SafeHandleBase
felipebz/ndapi
Ndapi/Core/Handles/SafeHandleBase.cs
Ndapi/Core/Handles/SafeHandleBase.cs
using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; namespace Ndapi.Core.Handles { internal abstract class SafeHandleBase : SafeHandleZeroOrMinusOneIsInvalid { protected SafeHandleBase() : base(true) { } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] protected abstract bool ReleaseHandleImpl(); protected override sealed bool ReleaseHandle() => ReleaseHandleImpl(); } }
using System; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; namespace Ndapi.Core.Handles { internal abstract class SafeHandleBase : SafeHandle { protected SafeHandleBase() : base(IntPtr.Zero, true) { } public override bool IsInvalid => handle == IntPtr.Zero; [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] protected abstract bool ReleaseHandleImpl(); protected override sealed bool ReleaseHandle() => ReleaseHandleImpl(); } }
mit
C#
1310e2d6c1eb586b445c3fdf2133e622b45a33a5
Make sure to End StaticContent.
jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos
data/layouts/default/StaticContentModule.cs
data/layouts/default/StaticContentModule.cs
using System; using System.IO; using Manos; // // This the default StaticContentModule that comes with all Manos apps // if you do not wish to serve any static content with Manos you can // remove its route handler from <YourApp>.cs's constructor and delete // this file. // // All Content placed on the Content/ folder should be handled by this // module. // namespace $APPNAME { public class StaticContentModule : ManosModule { public StaticContentModule () { Get (".*", Content); } public static void Content (IManosContext ctx) { string path = ctx.Request.LocalPath; if (path.StartsWith ("/")) path = path.Substring (1); if (File.Exists (path)) { ctx.Response.SendFile (path); } else ctx.Response.StatusCode = 404; ctx.Response.End (); } } }
using System; using System.IO; using Manos; // // This the default StaticContentModule that comes with all Manos apps // if you do not wish to serve any static content with Manos you can // remove its route handler from <YourApp>.cs's constructor and delete // this file. // // All Content placed on the Content/ folder should be handled by this // module. // namespace $APPNAME { public class StaticContentModule : ManosModule { public StaticContentModule () { Get (".*", Content); } public static void Content (IManosContext ctx) { string path = ctx.Request.LocalPath; if (path.StartsWith ("/")) path = path.Substring (1); if (File.Exists (path)) { ctx.Response.SendFile (path); } else ctx.Response.StatusCode = 404; } } }
mit
C#
428243d22d0f8e962f80703f3279e733672f3551
Update IotApp.cs
simonlaroche/akka.net,simonlaroche/akka.net
docs/examples/Tutorials/Tutorial1/IotApp.cs
docs/examples/Tutorials/Tutorial1/IotApp.cs
using System; using Akka.Actor; namespace Tutorials.Tutorial1 { #region iot-app public class IotApp { public static void Init() { using (var system = ActorSystem.Create("iot-system")) { // Create top level supervisor var supervisor = system.ActorOf(IotSupervisor.Props(), "iot-supervisor"); // Exit the system after ENTER is pressed Console.ReadLine(); } } } #endregion }
using System; using Akka.Actor; namespace Tutorials.Tutorial1 { #region iot-app public class IotApp { public static void Init() { using (var system = ActorSystem.Create("iot-system")) { // Create top level supervisor var supervisor = system.ActorOf(Props.Create<IotSupervisor>(), "iot-supervisor"); // Exit the system after ENTER is pressed Console.ReadLine(); } } } #endregion }
apache-2.0
C#
1460b1abd6f204695b937cf0e4384fb6f1a94301
Introduce `isProduction` to determine the request URL
TwilioDevEd/clicktocall-csharp,TwilioDevEd/clicktocall-csharp,TwilioDevEd/clicktocall-mvc4,TwilioDevEd/clicktocall-csharp,TwilioDevEd/clicktocall-mvc4
ClickToCall.Web/Controllers/CallCenterController.cs
ClickToCall.Web/Controllers/CallCenterController.cs
using System.Configuration; using System.Linq; using System.Web.Mvc; using ClickToCall.Web.Models; using ClickToCall.Web.Services; using Twilio.TwiML.Mvc; namespace ClickToCall.Web.Controllers { public class CallCenterController : TwilioController { private readonly INotificationService _notificationService; public CallCenterController() : this(new NotificationService()) { } public CallCenterController(INotificationService notificationService) { _notificationService = notificationService; } public ActionResult Index() { return View(); } /// <summary> /// Handle a POST from our web form and connect a call via REST API /// </summary> [HttpPost] public ActionResult Call(CallViewModel callViewModel) { if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(m => m.Errors) .Select(e => e.ErrorMessage) .ToList(); var errorMessage = string.Join(". ", errors); return Json(new { success = false, message = errorMessage }); } var twilioNumber = ConfigurationManager.AppSettings["TwilioNumber"]; var uriHandler = GetUri(callViewModel.SalesNumber); _notificationService.MakePhoneCall(twilioNumber, callViewModel.UserNumber, uriHandler); return Json(new { success = true, message = "Phone call incoming!"}); } private string GetUri(string salesNumber, bool isProduction = false) { if (isProduction) { return Url.Action("Connect", "Call", null, Request.Url.Scheme); } var requestUrlScheme = Request.Url.Scheme; var domain = ConfigurationManager.AppSettings["TestDomain"]; var urlAction = Url.Action("Connect", "Call", new { salesNumber }); return $"{requestUrlScheme}://{domain}{urlAction}"; } } }
using System.Configuration; using System.Linq; using System.Web.Mvc; using ClickToCall.Web.Models; using ClickToCall.Web.Services; using Twilio.TwiML.Mvc; namespace ClickToCall.Web.Controllers { public class CallCenterController : TwilioController { private readonly INotificationService _notificationService; public CallCenterController() : this(new NotificationService()) { } public CallCenterController(INotificationService notificationService) { _notificationService = notificationService; } public ActionResult Index() { return View(); } /// <summary> /// Handle a POST from our web form and connect a call via REST API /// </summary> [HttpPost] public ActionResult Call(CallViewModel callViewModel) { if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(m => m.Errors) .Select(e => e.ErrorMessage) .ToList(); var errorMessage = string.Join(". ", errors); return Json(new { success = false, message = errorMessage }); } var twilioNumber = ConfigurationManager.AppSettings["TwilioNumber"]; var uriHandler = GetUri(callViewModel.SalesNumber); _notificationService.MakePhoneCall(twilioNumber, callViewModel.UserNumber, uriHandler); return Json(new { success = true, message = "Phone call incoming!"}); } private string GetUri(string salesNumber) { if (IsProductionHost(Request.Url.Host)) { return Url.Action("Connect", "Call", null, Request.Url.Scheme); } var requestUrlScheme = Request.Url.Scheme; var domain = ConfigurationManager.AppSettings["TestDomain"]; var urlAction = Url.Action("Connect", "Call", new { salesNumber }); return $"{requestUrlScheme}://{domain}{urlAction}"; } private static bool IsProductionHost(string host) { var isNgrok = host.Contains("ngrok.io"); var isExample = host.Equals("www.example.com"); return !(isNgrok || isExample); } } }
mit
C#
d343f8de0f7c3e641420205823afe0365b1d2cf7
Add IDocument interface to build viewmodel classes
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
R7.University/Models/DocumentInfo.cs
R7.University/Models/DocumentInfo.cs
// // DocumentInfo.cs // // Author: // Roman M. Yagodin <roman.yagodin@gmail.com> // // Copyright (c) 2015 // // 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 DotNetNuke.ComponentModel.DataAnnotations; namespace R7.University { interface IDocument { int DocumentID { get; set; } int? DocumentTypeID { get; set; } string ItemID { get; set; } string Title { get; set; } string Url { get; set; } int SortIndex { get; set; } DateTime? StartDate { get; set; } DateTime? EndDate { get; set; } } [TableName ("University_Documents")] [PrimaryKey ("DocumentID", AutoIncrement = true)] [Serializable] public class DocumentInfo: IDocument { #region IDocument implementation public int DocumentID { get; set; } public int? DocumentTypeID { get; set; } public string ItemID { get; set; } public string Title { get; set; } public string Url { get; set; } public int SortIndex { get; set; } public DateTime? StartDate { get; set; } public DateTime? EndDate { get; set; } #endregion [IgnoreColumn] public bool IsPublished { get { var now = DateTime.Now; return (StartDate == null || now >= StartDate) && (EndDate == null || now < EndDate); } } [IgnoreColumn] public DocumentTypeInfo DocumentType { get; set; } } }
// // DocumentInfo.cs // // Author: // Roman M. Yagodin <roman.yagodin@gmail.com> // // Copyright (c) 2015 // // 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 DotNetNuke.ComponentModel.DataAnnotations; namespace R7.University { [TableName ("University_Documents")] [PrimaryKey ("DocumentID", AutoIncrement = true)] [Serializable] public class DocumentInfo { #region Properties public int DocumentID { get; set; } public int? DocumentTypeID { get; set; } public string ItemID { get; set; } public string Title { get; set; } public string Url { get; set; } public int SortIndex { get; set; } public DateTime? StartDate { get; set; } public DateTime? EndDate { get; set; } #endregion [IgnoreColumn] public bool IsPublished { get { var now = DateTime.Now; return (StartDate == null || now >= StartDate) && (EndDate == null || now < EndDate); } } [IgnoreColumn] public DocumentTypeInfo DocumentType { get; set; } } }
agpl-3.0
C#
000ab2c728acc7a4fb15d633019fbbef9fb9eabe
Update CommonAssemblyInfo.cs for automated build
scz2011/WebApi,congysu/WebApi,LianwMS/WebApi,lungisam/WebApi,lungisam/WebApi,chimpinano/WebApi,abkmr/WebApi,yonglehou/WebApi,chimpinano/WebApi,congysu/WebApi,LianwMS/WebApi,lewischeng-ms/WebApi,yonglehou/WebApi,scz2011/WebApi,abkmr/WebApi,lewischeng-ms/WebApi
src/CommonAssemblyInfo.cs
src/CommonAssemblyInfo.cs
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Microsoft Open Technologies, Inc")] [assembly: AssemblyCopyright("© Microsoft Open Technologies, Inc. All rights reserved.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] #if ASPNETMVC && ASPNETWEBPAGES #error Runtime projects cannot define both ASPNETMVC and ASPNETWEBPAGES #elif ASPNETMVC [assembly: AssemblyVersion("5.0.0.0")] // ASPNETMVC [assembly: AssemblyFileVersion("5.0.0.0")] // ASPNETMVC [assembly: AssemblyProduct("Microsoft ASP.NET MVC")] #elif ASPNETWEBPAGES [assembly: AssemblyVersion("3.0.0.0")] // ASPNETWEBPAGES [assembly: AssemblyFileVersion("3.0.0.0")] // ASPNETWEBPAGES [assembly: AssemblyProduct("Microsoft ASP.NET Web Pages")] #else #error Runtime projects must define either ASPNETMVC or ASPNETWEBPAGES #endif [assembly: NeutralResourcesLanguage("en-US")]
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] #if ASPNETMVC && ASPNETWEBPAGES #error Runtime projects cannot define both ASPNETMVC and ASPNETWEBPAGES #endif #if ASPNETMVC [assembly: AssemblyVersion("5.0.0.0")] [assembly: AssemblyFileVersion("5.0.0.0")] [assembly: AssemblyProduct("Microsoft ASP.NET MVC")] #elif ASPNETWEBPAGES [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.0.0")] [assembly: AssemblyProduct("Microsoft ASP.NET Web Pages")] #else #error Runtime projects must define either ASPNETMVC or ASPNETWEBPAGES #endif [assembly: NeutralResourcesLanguage("en-US")]
mit
C#
33d12bd43a638885436db8bd974d3eac29c4fd54
Update task-scheduler on import.
grae22/TeamTracker
TeamTracker/FileImportExport.aspx.cs
TeamTracker/FileImportExport.aspx.cs
using System; using System.IO; using System.Web; using TeamTracker; public partial class FileImportExport : System.Web.UI.Page { //--------------------------------------------------------------------------- protected void Page_Load( object sender, EventArgs e ) { // Bounce back to main page if session has expired. if( Session[ SettingsLogin.SES_SETTINGS_LOGGED_IN ] == null || (bool)Session[ SettingsLogin.SES_SETTINGS_LOGGED_IN ] == false ) { Server.Transfer( "Default.aspx" ); } } //--------------------------------------------------------------------------- protected void PerformImport( object sender, EventArgs e ) { string filename = HttpRuntime.CodegenDir + "/ToImport"; FileUploader.SaveAs( filename ); Result.Text = string.Format( "{0} ({1} bytes)<br /><br />", FileUploader.PostedFile.FileName, FileUploader.PostedFile.ContentLength ); Result.Text = FileImport.Import( filename ); // We call this in case the daily status reset time has changed. TaskScheduler.Start(); } //--------------------------------------------------------------------------- protected void PerformExport( object sender, EventArgs e ) { string results = ""; try { Result.Text = ""; string filename = HttpRuntime.CodegenDir + "/TeamTrackerExport.txt"; results = FileExport.Export( filename ); if( File.Exists( filename ) ) { FileInfo info = new FileInfo( filename ); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader( "Content-Disposition", "attachment; filename=" + info.Name ); Response.AddHeader( "Content-Length", info.Length.ToString() ); Response.ContentType = "text/plain"; Response.Flush(); Response.TransmitFile( info.FullName ); Response.Flush(); Response.SuppressContent = true; try { File.Delete( filename ); } catch( Exception ) { // Ignore. } } } catch( Exception ex ) { Result.Text = ex.Message; } finally { Result.Text += "<br /><br />" + results; } } //--------------------------------------------------------------------------- }
using System; using System.IO; using System.Web; using TeamTracker; public partial class FileImportExport : System.Web.UI.Page { //--------------------------------------------------------------------------- protected void Page_Load( object sender, EventArgs e ) { // Bounce back to main page if session has expired. if( Session[ SettingsLogin.SES_SETTINGS_LOGGED_IN ] == null || (bool)Session[ SettingsLogin.SES_SETTINGS_LOGGED_IN ] == false ) { Server.Transfer( "Default.aspx" ); } } //--------------------------------------------------------------------------- protected void PerformImport( object sender, EventArgs e ) { string filename = HttpRuntime.CodegenDir + "/ToImport"; FileUploader.SaveAs( filename ); Result.Text = string.Format( "{0} ({1} bytes)<br /><br />", FileUploader.PostedFile.FileName, FileUploader.PostedFile.ContentLength ); Result.Text = FileImport.Import( filename ); } //--------------------------------------------------------------------------- protected void PerformExport( object sender, EventArgs e ) { string results = ""; try { Result.Text = ""; string filename = HttpRuntime.CodegenDir + "/TeamTrackerExport.txt"; results = FileExport.Export( filename ); if( File.Exists( filename ) ) { FileInfo info = new FileInfo( filename ); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader( "Content-Disposition", "attachment; filename=" + info.Name ); Response.AddHeader( "Content-Length", info.Length.ToString() ); Response.ContentType = "text/plain"; Response.Flush(); Response.TransmitFile( info.FullName ); Response.Flush(); Response.SuppressContent = true; try { File.Delete( filename ); } catch( Exception ) { // Ignore. } } } catch( Exception ex ) { Result.Text = ex.Message; } finally { Result.Text += "<br /><br />" + results; } } //--------------------------------------------------------------------------- }
mit
C#
455b63d67888e8f6f6fc6de6e8198412c415345e
Update tests to use the new End method. Also update UploadFile as the name isnt sent anymore.
jacksonh/manos,jmptrader/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos
test/TestApp/StreamTestsModule.cs
test/TestApp/StreamTestsModule.cs
// // Copyright (C) 2010 Jackson Harper (jackson@manosdemono.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // using Manos; using Manos.IO; using Manos.Http; using System; using System.Linq; using System.Text; namespace TestApp { public class StreamTestsModule : ManosModule { public void EchoLocalPath (IManosContext ctx) { ctx.Response.End (ctx.Request.LocalPath); } public void EchoInt (IManosContext ctx, int the_int) { ctx.Response.End (the_int.ToString ()); } public void EchoString (IManosContext ctx, string the_string) { ctx.Response.End (the_string); } public void ReverseString (IManosContext ctx, string the_string) { // This is intentionally awful, as its trying to test the stream // Write it normally, then try to overwrite it with the new value ctx.Response.Write (the_string); ctx.Response.Stream.Position = 0; byte [] data = Encoding.Default.GetBytes (the_string); for (int i = data.Length; i >= 0; --i) { ctx.Response.Stream.Write (data, i, 1); } ctx.Response.End (); } public void MultiplyString (IManosContext ctx, string the_string, int amount) { // Create all the data for the string, then do all the writing long start = ctx.Response.Stream.Position; ctx.Response.Write (the_string); long len = ctx.Response.Stream.Position - start; ctx.Response.Stream.SetLength (len * amount); ctx.Response.Stream.Position = start; for (int i = 0; i < amount; i++) { ctx.Response.Write (the_string); } ctx.Response.End (); } public void SendFile (IManosContext ctx, string name) { ctx.Response.SendFile (name); ctx.Response.End (); } public void UploadFile (IManosContext ctx, string name) { UploadedFile file = ctx.Request.Files.Values.First (); byte [] data = new byte [file.Contents.Length]; file.Contents.Read (data, 0, data.Length); ctx.Response.End (data); } } }
// // Copyright (C) 2010 Jackson Harper (jackson@manosdemono.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // using Manos; using Manos.IO; using Manos.Http; using System; using System.Text; namespace TestApp { public class StreamTestsModule : ManosModule { public void EchoLocalPath (IManosContext ctx) { ctx.Response.Write (ctx.Request.LocalPath); } public void EchoInt (IManosContext ctx, int the_int) { ctx.Response.Write (the_int.ToString ()); } public void EchoString (IManosContext ctx, string the_string) { ctx.Response.Write (the_string); } public void ReverseString (IManosContext ctx, string the_string) { // This is intentionally awful, as its trying to test the stream // Write it normally, then try to overwrite it with the new value ctx.Response.Write (the_string); ctx.Response.Stream.Position = 0; byte [] data = Encoding.Default.GetBytes (the_string); for (int i = data.Length; i >= 0; --i) { ctx.Response.Stream.Write (data, i, 1); } } public void MultiplyString (IManosContext ctx, string the_string, int amount) { // Create all the data for the string, then do all the writing long start = ctx.Response.Stream.Position; ctx.Response.Write (the_string); long len = ctx.Response.Stream.Position - start; ctx.Response.Stream.SetLength (len * amount); ctx.Response.Stream.Position = start; for (int i = 0; i < amount; i++) { ctx.Response.Write (the_string); } } public void SendFile (IManosContext ctx, string name) { ctx.Response.SendFile (name); } public void UploadFile (IManosContext ctx, string name) { UploadedFile file = ctx.Request.Files [name]; byte [] data = new byte [file.Contents.Length]; file.Contents.Read (data, 0, data.Length); ctx.Response.Write (data); } } }
mit
C#
88d411839793060cee90b1d71c0fc79801d74959
Address PR feedback
stone-li/corefx,ericstj/corefx,Priya91/corefx-1,twsouthwick/corefx,rjxby/corefx,alexperovich/corefx,Ermiar/corefx,axelheer/corefx,alexperovich/corefx,krk/corefx,seanshpark/corefx,the-dwyer/corefx,Jiayili1/corefx,ravimeda/corefx,ellismg/corefx,tijoytom/corefx,the-dwyer/corefx,cydhaselton/corefx,Petermarcu/corefx,lggomez/corefx,mmitche/corefx,Ermiar/corefx,mmitche/corefx,billwert/corefx,zhenlan/corefx,wtgodbe/corefx,jlin177/corefx,yizhang82/corefx,ViktorHofer/corefx,shmao/corefx,richlander/corefx,BrennanConroy/corefx,ericstj/corefx,Chrisboh/corefx,Ermiar/corefx,nchikanov/corefx,tstringer/corefx,Jiayili1/corefx,wtgodbe/corefx,marksmeltzer/corefx,dotnet-bot/corefx,yizhang82/corefx,weltkante/corefx,dotnet-bot/corefx,Jiayili1/corefx,alphonsekurian/corefx,rahku/corefx,ravimeda/corefx,SGuyGe/corefx,ellismg/corefx,jhendrixMSFT/corefx,rahku/corefx,rjxby/corefx,lggomez/corefx,alphonsekurian/corefx,mazong1123/corefx,yizhang82/corefx,elijah6/corefx,ptoonen/corefx,MaggieTsang/corefx,SGuyGe/corefx,tijoytom/corefx,stone-li/corefx,shmao/corefx,shmao/corefx,dotnet-bot/corefx,cartermp/corefx,jhendrixMSFT/corefx,rahku/corefx,wtgodbe/corefx,khdang/corefx,stephenmichaelf/corefx,jlin177/corefx,tijoytom/corefx,tstringer/corefx,wtgodbe/corefx,krytarowski/corefx,BrennanConroy/corefx,manu-silicon/corefx,ericstj/corefx,richlander/corefx,cydhaselton/corefx,Priya91/corefx-1,shimingsg/corefx,khdang/corefx,DnlHarvey/corefx,the-dwyer/corefx,dhoehna/corefx,nchikanov/corefx,twsouthwick/corefx,elijah6/corefx,stone-li/corefx,cartermp/corefx,ViktorHofer/corefx,elijah6/corefx,tijoytom/corefx,SGuyGe/corefx,alphonsekurian/corefx,krytarowski/corefx,dhoehna/corefx,cydhaselton/corefx,shimingsg/corefx,iamjasonp/corefx,tstringer/corefx,dhoehna/corefx,MaggieTsang/corefx,stephenmichaelf/corefx,Chrisboh/corefx,DnlHarvey/corefx,twsouthwick/corefx,yizhang82/corefx,seanshpark/corefx,adamralph/corefx,krk/corefx,krytarowski/corefx,gkhanna79/corefx,yizhang82/corefx,ViktorHofer/corefx,rubo/corefx,weltkante/corefx,nchikanov/corefx,nbarbettini/corefx,richlander/corefx,Ermiar/corefx,ellismg/corefx,YoupHulsebos/corefx,rjxby/corefx,lggomez/corefx,nchikanov/corefx,alexperovich/corefx,billwert/corefx,shimingsg/corefx,JosephTremoulet/corefx,Petermarcu/corefx,manu-silicon/corefx,krk/corefx,Petermarcu/corefx,elijah6/corefx,rubo/corefx,ellismg/corefx,shimingsg/corefx,ViktorHofer/corefx,nbarbettini/corefx,dsplaisted/corefx,Petermarcu/corefx,MaggieTsang/corefx,Jiayili1/corefx,JosephTremoulet/corefx,DnlHarvey/corefx,ptoonen/corefx,jlin177/corefx,twsouthwick/corefx,dotnet-bot/corefx,krk/corefx,alexperovich/corefx,Petermarcu/corefx,twsouthwick/corefx,alphonsekurian/corefx,richlander/corefx,yizhang82/corefx,manu-silicon/corefx,rjxby/corefx,cartermp/corefx,ptoonen/corefx,parjong/corefx,khdang/corefx,billwert/corefx,wtgodbe/corefx,mmitche/corefx,parjong/corefx,seanshpark/corefx,gkhanna79/corefx,parjong/corefx,ericstj/corefx,Chrisboh/corefx,Chrisboh/corefx,dhoehna/corefx,YoupHulsebos/corefx,mmitche/corefx,rahku/corefx,gkhanna79/corefx,fgreinacher/corefx,krytarowski/corefx,dotnet-bot/corefx,DnlHarvey/corefx,alphonsekurian/corefx,mazong1123/corefx,SGuyGe/corefx,JosephTremoulet/corefx,jlin177/corefx,elijah6/corefx,ravimeda/corefx,krk/corefx,ViktorHofer/corefx,nchikanov/corefx,SGuyGe/corefx,billwert/corefx,mazong1123/corefx,DnlHarvey/corefx,ravimeda/corefx,parjong/corefx,krytarowski/corefx,JosephTremoulet/corefx,shmao/corefx,Priya91/corefx-1,manu-silicon/corefx,cartermp/corefx,twsouthwick/corefx,seanshpark/corefx,adamralph/corefx,cydhaselton/corefx,axelheer/corefx,krk/corefx,SGuyGe/corefx,gkhanna79/corefx,weltkante/corefx,jhendrixMSFT/corefx,mazong1123/corefx,MaggieTsang/corefx,YoupHulsebos/corefx,ptoonen/corefx,rjxby/corefx,Chrisboh/corefx,parjong/corefx,nbarbettini/corefx,gkhanna79/corefx,khdang/corefx,MaggieTsang/corefx,richlander/corefx,YoupHulsebos/corefx,jlin177/corefx,stone-li/corefx,dhoehna/corefx,Petermarcu/corefx,stephenmichaelf/corefx,zhenlan/corefx,stone-li/corefx,elijah6/corefx,ericstj/corefx,ericstj/corefx,JosephTremoulet/corefx,seanshpark/corefx,rjxby/corefx,twsouthwick/corefx,dhoehna/corefx,ericstj/corefx,krytarowski/corefx,zhenlan/corefx,dsplaisted/corefx,marksmeltzer/corefx,cydhaselton/corefx,nbarbettini/corefx,billwert/corefx,marksmeltzer/corefx,richlander/corefx,the-dwyer/corefx,weltkante/corefx,Priya91/corefx-1,Ermiar/corefx,jhendrixMSFT/corefx,ViktorHofer/corefx,marksmeltzer/corefx,seanshpark/corefx,BrennanConroy/corefx,krytarowski/corefx,zhenlan/corefx,mazong1123/corefx,wtgodbe/corefx,nbarbettini/corefx,cartermp/corefx,ptoonen/corefx,yizhang82/corefx,ViktorHofer/corefx,DnlHarvey/corefx,Jiayili1/corefx,rubo/corefx,shimingsg/corefx,Jiayili1/corefx,iamjasonp/corefx,richlander/corefx,tijoytom/corefx,mazong1123/corefx,cartermp/corefx,rahku/corefx,iamjasonp/corefx,the-dwyer/corefx,fgreinacher/corefx,YoupHulsebos/corefx,stephenmichaelf/corefx,cydhaselton/corefx,Priya91/corefx-1,nbarbettini/corefx,ellismg/corefx,axelheer/corefx,wtgodbe/corefx,Ermiar/corefx,khdang/corefx,rubo/corefx,the-dwyer/corefx,stone-li/corefx,Ermiar/corefx,weltkante/corefx,elijah6/corefx,ravimeda/corefx,alexperovich/corefx,stephenmichaelf/corefx,dsplaisted/corefx,weltkante/corefx,manu-silicon/corefx,rahku/corefx,the-dwyer/corefx,axelheer/corefx,iamjasonp/corefx,ptoonen/corefx,adamralph/corefx,zhenlan/corefx,stephenmichaelf/corefx,nchikanov/corefx,shmao/corefx,alexperovich/corefx,marksmeltzer/corefx,manu-silicon/corefx,Priya91/corefx-1,mmitche/corefx,lggomez/corefx,dotnet-bot/corefx,rjxby/corefx,fgreinacher/corefx,mmitche/corefx,billwert/corefx,MaggieTsang/corefx,Petermarcu/corefx,nbarbettini/corefx,zhenlan/corefx,lggomez/corefx,jlin177/corefx,billwert/corefx,manu-silicon/corefx,gkhanna79/corefx,tijoytom/corefx,MaggieTsang/corefx,DnlHarvey/corefx,jlin177/corefx,Chrisboh/corefx,shimingsg/corefx,krk/corefx,rubo/corefx,parjong/corefx,dhoehna/corefx,alphonsekurian/corefx,YoupHulsebos/corefx,mmitche/corefx,ravimeda/corefx,zhenlan/corefx,marksmeltzer/corefx,axelheer/corefx,alphonsekurian/corefx,jhendrixMSFT/corefx,weltkante/corefx,seanshpark/corefx,ravimeda/corefx,JosephTremoulet/corefx,JosephTremoulet/corefx,nchikanov/corefx,ptoonen/corefx,stephenmichaelf/corefx,Jiayili1/corefx,fgreinacher/corefx,tstringer/corefx,ellismg/corefx,rahku/corefx,jhendrixMSFT/corefx,dotnet-bot/corefx,stone-li/corefx,cydhaselton/corefx,mazong1123/corefx,jhendrixMSFT/corefx,shmao/corefx,iamjasonp/corefx,iamjasonp/corefx,gkhanna79/corefx,axelheer/corefx,lggomez/corefx,marksmeltzer/corefx,tstringer/corefx,shmao/corefx,khdang/corefx,shimingsg/corefx,iamjasonp/corefx,tijoytom/corefx,tstringer/corefx,lggomez/corefx,alexperovich/corefx,parjong/corefx,YoupHulsebos/corefx
src/Common/src/System/StrongToWeakReference.cs
src/Common/src/System/StrongToWeakReference.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics; namespace System { /// <summary>Provides an object wrapper that can transition between strong and weak references to the object.</summary> internal sealed class StrongToWeakReference<T> : WeakReference where T : class { private T _strongRef; /// <summary>Initializes the instance with a strong reference to the specified object.</summary> /// <param name="obj">The object to wrap.</param> public StrongToWeakReference(T obj) : base(obj) { Debug.Assert(obj != null, "Expected non-null obj"); _strongRef = obj; } /// <summary>Drops the strong reference to the object, keeping only a weak reference.</summary> public void MakeWeak() => _strongRef = null; /// <summary>Restores the strong reference, assuming the object hasn't yet been collected.</summary> public void MakeStrong() { _strongRef = WeakTarget; Debug.Assert(_strongRef != null, $"Expected non-null {nameof(_strongRef)} after setting"); } /// <summary>Gets the wrapped object.</summary> public new T Target => _strongRef ?? WeakTarget; /// <summary>Gets the wrapped object via its weak reference.</summary> private T WeakTarget => base.Target as T; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace System { /// <summary>Provides an object wrapper that can transition between strong and weak references to the object.</summary> internal sealed class StrongToWeakReference<T> : WeakReference where T : class { private T _strongRef; /// <summary>Initializes the instance with a strong reference to the specified object.</summary> /// <param name="obj">The object to wrap.</param> public StrongToWeakReference(T obj) : base(obj) { _strongRef = obj; } /// <summary>Drops the strong reference to the object, keeping only a weak reference.</summary> public void MakeWeak() => _strongRef = null; /// <summary>Restores the strong reference, assuming the object hasn't yet been collected.</summary> public void MakeStrong() => _strongRef = WeakTarget; /// <summary>Gets the wrapped object.</summary> public new T Target => _strongRef ?? WeakTarget; /// <summary>Gets the wrapped object via its weak reference.</summary> private T WeakTarget => base.Target as T; } }
mit
C#
ba0f822ede5fd54341945410cc639008caed72c8
Test Team Foundation Service
bbenetskyy/WinParse
WinParse/WinParse.WinForms/Person.cs
WinParse/WinParse.WinForms/Person.cs
using System; namespace WinParse.WinForms { internal class Person { private string firstName; private string secondName; private string comments; public Person(string firstName, string secondName) { this.firstName = firstName; this.secondName = secondName; comments = String.Empty; } public Person(string firstName, string secondName, string comments) : this(firstName, secondName) { this.comments = comments; } public string FirstName { get { return firstName; } set { firstName = value; } } public string SecondName { get { return secondName; } set { secondName = value; } } public string Comments { get { return comments; } set { comments = value; } } } }
using System; namespace WinParse.WinForms { internal class Person { private string firstName; private string secondName; private string comments; public Person(string firstName, string secondName) { this.firstName = firstName; this.secondName = secondName; comments = String.Empty; } public Person(string firstName, string secondName, string comments) : this(firstName, secondName) { this.comments = comments; } public string FirstName { get { return firstName; } set { firstName = value; } } public string SecondName { get { return secondName; } set { secondName = value; } } public string Comments { get { return comments; } set { comments = value; } } } }
unlicense
C#
5544d3636e94a5d1fcbad9a87e8ec99c0ac6a84c
fix main menu issue
danbolt/ggj-jan-2017
Pumpkin/Assets/Source/UI/Screens/MainMenuManager.cs
Pumpkin/Assets/Source/UI/Screens/MainMenuManager.cs
using UnityEngine; using System.Collections; public class MainMenuManager : MonoBehaviour { private GuiManager uiManagerInstance; // Use this for initialization void Start () { uiManagerInstance = GuiManager.Instance; } // Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.Space)) { this.OnStartGameClicked(); } } public void OnStartGameClicked() { if (uiManagerInstance) { uiManagerInstance.TriggerGameplayStart(); } } public void OnShowCreditsClicked() { if (uiManagerInstance) { uiManagerInstance.ShowSettings(); } } public void OnShowSettingsClicked() { if (uiManagerInstance) { uiManagerInstance.ShowSettings(); } } }
using UnityEngine; using System.Collections; public class MainMenuManager : MonoBehaviour { private GuiManager uiManagerInstance; // Use this for initialization void Start () { uiManagerInstance = GuiManager.Instance; } // Update is called once per frame void Update() { if (Input.GetButton("Fire1")) { this.OnStartGameClicked(); } } public void OnStartGameClicked() { if (uiManagerInstance) { uiManagerInstance.TriggerGameplayStart(); } } public void OnShowCreditsClicked() { if (uiManagerInstance) { uiManagerInstance.ShowSettings(); } } public void OnShowSettingsClicked() { if (uiManagerInstance) { uiManagerInstance.ShowSettings(); } } }
mit
C#
3cb7989b928059f71374e32d72897909d2cd3b40
Change newlines to Environment.NewLine
psforever/GameLauncher
PSLauncher/ClientINI.cs
PSLauncher/ClientINI.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; namespace PSLauncher { class ClientINI { string inipath; public ClientINI(String inipath) { this.inipath = inipath; } public void writeEntries(List<ServerEntry> entries, int primaryIndex=0) { FileStream writer = File.Open(this.inipath, FileMode.Create); // reorder based on primary index if(primaryIndex != 0) { entries.Insert(0, entries[primaryIndex]); entries.RemoveAt(primaryIndex + 1); } System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fvi.FileVersion; string contents = "# FILE AUTOGENERATED BY PSForever Launcher " + version + Environment.NewLine; contents += "[network]" + Environment.NewLine; for(int i = 0; i < entries.Count; i++) { ServerEntry entry = entries[i]; contents += "# Name: " + entry.name + Environment.NewLine; // we only want login0 to be used, but have the rest written there for manual editing as well contents += String.Format("{3}login{0}={1}:{2}" + Environment.NewLine, i, entry.hostname, entry.port, i == 0 ? "" : "#"); } byte[] outBytes = Encoding.ASCII.GetBytes(contents); writer.Write(outBytes, 0, outBytes.Length); writer.Close(); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; namespace PSLauncher { class ClientINI { string inipath; public ClientINI(String inipath) { this.inipath = inipath; } public void writeEntries(List<ServerEntry> entries, int primaryIndex=0) { FileStream writer = File.Open(this.inipath, FileMode.Create); // reorder based on primary index if(primaryIndex != 0) { entries.Insert(0, entries[primaryIndex]); entries.RemoveAt(primaryIndex + 1); } System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fvi.FileVersion; string contents = "# FILE AUTOGENERATED BY PSForever Launcher " + version + "\n"; contents += "[network]\n"; for(int i = 0; i < entries.Count; i++) { ServerEntry entry = entries[i]; contents += "# Name: " + entry.name + "\n"; // we only want login0 to be used, but have the rest written there for manual editing as well contents += String.Format("{3}login{0}={1}:{2}\n", i, entry.hostname, entry.port, i == 0 ? "" : "#"); } byte[] outBytes = Encoding.ASCII.GetBytes(contents); writer.Write(outBytes, 0, outBytes.Length); writer.Close(); } } }
mit
C#
7733e893251e59a9aa9fd87c47fe3c812bb09b82
Add AddinUrl
sevoku/MonoDevelop.Xwt
Properties/AddinInfo.cs
Properties/AddinInfo.cs
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")]
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")]
mit
C#
793acfe174786431d7ffb20cddeb4be28b95199c
Set an exception message for ReturnStatusMessage
neuecc/MagicOnion
src/MagicOnion.Server/ReturnStatusException.cs
src/MagicOnion.Server/ReturnStatusException.cs
using Grpc.Core; using System; namespace MagicOnion { public class ReturnStatusException : Exception { public StatusCode StatusCode { get; private set; } public string Detail { get; private set; } public ReturnStatusException(StatusCode statusCode, string detail) : base($"The method has returned the status code '{statusCode}'." + (string.IsNullOrWhiteSpace(detail) ? "" : $" (Detail={detail})")) { this.StatusCode = statusCode; this.Detail = detail; } public Status ToStatus() { return new Status(StatusCode, Detail ?? ""); } } }
using Grpc.Core; using System; namespace MagicOnion { public class ReturnStatusException : Exception { public StatusCode StatusCode { get; private set; } public string Detail { get; private set; } public ReturnStatusException(StatusCode statusCode, string detail) { this.StatusCode = statusCode; this.Detail = detail; } public Status ToStatus() { return new Status(StatusCode, Detail ?? ""); } } }
mit
C#
bf42665769b78a382ed68a8479ff7725446d995e
Remove debug messages
JoshuaBrockschmidt/blockland_script_playerarchiver
packages.cs
packages.cs
package PLYRARCH_package { function secureClientCmd_ClientJoin(%name, %objid, %bl_id, %var1, %var2, %admin, %superadmin) { PLYRARCH_addPlayer(%bl_id, %name); parent::secureClientCmd_ClientJoin(%name, %objid, %bl_id, %var1, %var2, %admin, %superadmin); } function secureClientCmd_ClientDrop(%name, %objid) { parent::secureClientCmd_ClientDrop(%name, %objid); } };
package PLYRARCH_package { function secureClientCmd_ClientJoin(%name, %objid, %bl_id, %var1, %var2, %admin, %superadmin) { echo("secureClientCmd_ClientJoin() has been called..."); echo("%name:" SPC %name); echo("%objid:" SPC %objid); echo("%bl_id:" SPC %bl_id); echo("%var1:" SPC %var1); echo("%var2:" SPC %var2); echo("%admin:" SPC %admin); echo("%superadmin:" SPC %superadmin); PLYRARCH_addPlayer(%bl_id, %name); parent::secureClientCmd_ClientJoin(%name, %objid, %bl_id, %var1, %var2, %admin, %superadmin); } function secureClientCmd_ClientDrop(%name, %objid) { echo("secureClientCmd_ClientDrop"); echo("%name:" SPC %name); echo("%objid:" SPC %objid); parent::secureClientCmd_ClientDrop(%name, %objid); } };
unlicense
C#
71b6789136b786d36163c8f5bb576f8f8f932d28
Fix post-merge conflict
ZLima12/osu,naoey/osu,UselessToucan/osu,smoogipooo/osu,johnneijzen/osu,johnneijzen/osu,ppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,2yangk23/osu,ZLima12/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,DrabWeb/osu,NeoAdonis/osu,DrabWeb/osu,EVAST9919/osu,2yangk23/osu,EVAST9919/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,naoey/osu,DrabWeb/osu,peppy/osu,naoey/osu,peppy/osu-new
osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs
osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { public class SliderBodyPiece : CompositeDrawable { private readonly Slider slider; private readonly SnakingSliderBody body; public SliderBodyPiece(Slider slider) { this.slider = slider; InternalChild = body = new SnakingSliderBody(slider) { AccentColour = Color4.Transparent, PathWidth = slider.Scale * 64 }; slider.PositionChanged += _ => updatePosition(); } [BackgroundDependencyLoader] private void load(OsuColour colours) { body.BorderColour = colours.Yellow; updatePosition(); } private void updatePosition() => Position = slider.StackedPosition; protected override void Update() { base.Update(); Size = body.Size; OriginPosition = body.PathOffset; // Need to cause one update body.UpdateProgress(0); } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { public class SliderBodyPiece : CompositeDrawable { private readonly Slider slider; private readonly SliderBody body; public SliderBodyPiece(Slider slider) { this.slider = slider; InternalChild = body = new SliderBody(slider) { AccentColour = Color4.Transparent, PathWidth = slider.Scale * 64 }; slider.PositionChanged += _ => updatePosition(); } [BackgroundDependencyLoader] private void load(OsuColour colours) { body.BorderColour = colours.Yellow; updatePosition(); } private void updatePosition() => Position = slider.StackedPosition; protected override void Update() { base.Update(); Size = body.Size; OriginPosition = body.PathOffset; // Need to cause one update body.UpdateProgress(0); } } }
mit
C#
602e75f842d9286dc917a8cbaafb03359178223a
Update version info for LogBridge.Log4Net.
TorbenRahbekKoch/LogBridge
Source/LogBridge.Log4Net/Properties/AssemblyInfo.cs
Source/LogBridge.Log4Net/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("SoftwarePassion.LogBridge.Log4Net")] [assembly: AssemblyDescription("A Log Bridge for Log4Net.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Software Passion")] [assembly: AssemblyProduct("LogBridge.Log4Net")] [assembly: AssemblyCopyright("Copyright © Torben Rahbek Koch 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("de9172ad-b54d-4a08-a43a-624091fed650")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.1")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SoftwarePassion.LogBridge.Log4Net")] [assembly: AssemblyDescription("A Log Bridge for Log4Net.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Software Passion")] [assembly: AssemblyProduct("LogBridge.Log4Net")] [assembly: AssemblyCopyright("Copyright © Torben Rahbek Koch 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("de9172ad-b54d-4a08-a43a-624091fed650")] // 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")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")]
mit
C#
c775562d917749a72052298a9df49284a360009b
Enlarge the scope of SA1600 supression to whole test project
RehanSaeed/Serilog.Exceptions,RehanSaeed/Serilog.Exceptions
Tests/Serilog.Exceptions.Test/GlobalSuppressions.cs
Tests/Serilog.Exceptions.Test/GlobalSuppressions.cs
// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Test project classes do not need to be documented")]
// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Test project classes do not need to be documented", Scope = "type", Target = "~T:Serilog.Exceptions.Test.Destructurers.ReflectionBasedDestructurerTest")]
mit
C#
c50edb351730b743a1f5ccf5c007185fac20bbd8
remove tab
peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework
osu.Framework.Tests/IO/ShaderRegexTest.cs
osu.Framework.Tests/IO/ShaderRegexTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Text.RegularExpressions; using NUnit.Framework; using osu.Framework.Graphics.Shaders; namespace osu.Framework.Tests.IO { [TestFixture] public class ShaderRegexTest { private readonly Regex shaderAttributeRegex = new Regex(ShaderPart.SHADER_ATTRIBUTE_PATTERN); [Test] public void TestComment() { const string test_string = "// The following implementation using mix and step may be faster, but stackoverflow indicates it is in fact a lot slower on some GPUs."; performInvalidAttributeTest(test_string); } [Test] public void TestNonAttribute() { const string test_string = "varying vec3 name"; performInvalidAttributeTest(test_string); } [Test] public void TestValidAttribute() { const string test_string = "attribute lowp float name;"; performValidAttributeTest(test_string); } [Test] public void TestSpacedAttribute() { const string test_string = " attribute float name ;"; performValidAttributeTest(test_string); } [Test] public void TestNoPrecisionQualifier() { const string test_string = "attribute float name"; performValidAttributeTest(test_string); } private void performValidAttributeTest(string testString) { var match = shaderAttributeRegex.Match(testString); Assert.IsTrue(match.Success); Assert.AreEqual("name", match.Groups[1].Value.Trim()); } private void performInvalidAttributeTest(string testString) { var match = shaderAttributeRegex.Match(testString); Assert.IsFalse(match.Success); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Text.RegularExpressions; using NUnit.Framework; using osu.Framework.Graphics.Shaders; namespace osu.Framework.Tests.IO { [TestFixture] public class ShaderRegexTest { private readonly Regex shaderAttributeRegex = new Regex(ShaderPart.SHADER_ATTRIBUTE_PATTERN); [Test] public void TestComment() { const string test_string = " // The following implementation using mix and step may be faster, but stackoverflow indicates it is in fact a lot slower on some GPUs."; performInvalidAttributeTest(test_string); } [Test] public void TestNonAttribute() { const string test_string = "varying vec3 name"; performInvalidAttributeTest(test_string); } [Test] public void TestValidAttribute() { const string test_string = "attribute lowp float name;"; performValidAttributeTest(test_string); } [Test] public void TestSpacedAttribute() { const string test_string = " attribute float name ;"; performValidAttributeTest(test_string); } [Test] public void TestNoPrecisionQualifier() { const string test_string = "attribute float name"; performValidAttributeTest(test_string); } private void performValidAttributeTest(string testString) { var match = shaderAttributeRegex.Match(testString); Assert.IsTrue(match.Success); Assert.AreEqual("name", match.Groups[1].Value.Trim()); } private void performInvalidAttributeTest(string testString) { var match = shaderAttributeRegex.Match(testString); Assert.IsFalse(match.Success); } } }
mit
C#
81186f8423198b76a97a2d9846281d4a612cbe56
Apply beatmap converter mods in DifficultyCalculator
NeoAdonis/osu,EVAST9919/osu,UselessToucan/osu,peppy/osu,DrabWeb/osu,ppy/osu,Nabile-Rahmani/osu,naoey/osu,johnneijzen/osu,2yangk23/osu,DrabWeb/osu,ppy/osu,ZLima12/osu,peppy/osu,naoey/osu,Frontear/osuKyzer,NeoAdonis/osu,smoogipooo/osu,smoogipoo/osu,2yangk23/osu,NeoAdonis/osu,naoey/osu,UselessToucan/osu,EVAST9919/osu,smoogipoo/osu,ppy/osu,peppy/osu,johnneijzen/osu,UselessToucan/osu,ZLima12/osu,DrabWeb/osu,smoogipoo/osu,peppy/osu-new
osu.Game/Beatmaps/DifficultyCalculator.cs
osu.Game/Beatmaps/DifficultyCalculator.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Objects; using System.Collections.Generic; using osu.Game.Rulesets.Mods; using osu.Framework.Timing; using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Game.Beatmaps { public abstract class DifficultyCalculator { protected double TimeRate = 1; public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null); } public abstract class DifficultyCalculator<T> : DifficultyCalculator where T : HitObject { protected readonly Beatmap<T> Beatmap; protected readonly Mod[] Mods; protected DifficultyCalculator(Beatmap beatmap, Mod[] mods = null) { Mods = mods ?? new Mod[0]; var converter = CreateBeatmapConverter(beatmap); foreach (var mod in Mods.OfType<IApplicableToBeatmapConverter<T>>()) mod.ApplyToBeatmapConverter(converter); Beatmap = converter.Convert(beatmap); ApplyMods(Mods); PreprocessHitObjects(); } protected virtual void ApplyMods(Mod[] mods) { var clock = new StopwatchClock(); mods.OfType<IApplicableToClock>().ForEach(m => m.ApplyToClock(clock)); TimeRate = clock.Rate; foreach (var mod in Mods.OfType<IApplicableToDifficulty>()) mod.ApplyToDifficulty(Beatmap.BeatmapInfo.BaseDifficulty); foreach (var mod in mods.OfType<IApplicableToHitObject<T>>()) foreach (var obj in Beatmap.HitObjects) mod.ApplyToHitObject(obj); foreach (var h in Beatmap.HitObjects) h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BaseDifficulty); } protected virtual void PreprocessHitObjects() { } protected abstract BeatmapConverter<T> CreateBeatmapConverter(Beatmap beatmap); } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Objects; using System.Collections.Generic; using osu.Game.Rulesets.Mods; using osu.Framework.Timing; using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Game.Beatmaps { public abstract class DifficultyCalculator { protected double TimeRate = 1; public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null); } public abstract class DifficultyCalculator<T> : DifficultyCalculator where T : HitObject { protected readonly Beatmap<T> Beatmap; protected readonly Mod[] Mods; protected DifficultyCalculator(Beatmap beatmap, Mod[] mods = null) { Beatmap = CreateBeatmapConverter(beatmap).Convert(beatmap); Mods = mods ?? new Mod[0]; ApplyMods(Mods); PreprocessHitObjects(); } protected virtual void ApplyMods(Mod[] mods) { var clock = new StopwatchClock(); mods.OfType<IApplicableToClock>().ForEach(m => m.ApplyToClock(clock)); TimeRate = clock.Rate; foreach (var mod in Mods.OfType<IApplicableToDifficulty>()) mod.ApplyToDifficulty(Beatmap.BeatmapInfo.BaseDifficulty); foreach (var mod in mods.OfType<IApplicableToHitObject<T>>()) foreach (var obj in Beatmap.HitObjects) mod.ApplyToHitObject(obj); foreach (var h in Beatmap.HitObjects) h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BaseDifficulty); } protected virtual void PreprocessHitObjects() { } protected abstract BeatmapConverter<T> CreateBeatmapConverter(Beatmap beatmap); } }
mit
C#
9cfc04919cb19a341626a2251a8d4c5018f5ff9d
create test message viewmodel should set default properties
Odonno/Modern-Gitter
Gitter/Gitter.UnitTests/ViewModels/MessageTests.cs
Gitter/Gitter.UnitTests/ViewModels/MessageTests.cs
using Gitter.ViewModel.Concrete; using GitterSharp.Model; using System; using Xunit; namespace Gitter.UnitTests.ViewModels { public class MessageTests { [Fact] public void CreateMessage_Should_SetMessage() { // Arrange var message = new Message(); var messageViewModel = new MessageViewModel(message); // Act // Assert Assert.Same(message, messageViewModel.Message); } [Fact] public void CreateMessage_Should_SetDefaultProperties() { // Arrange var message = new Message { Id = "123456", Text = "my message", Html = "<div>my message</div>", SentDate = DateTime.Now, UnreadByCurrent = false }; var messageViewModel = new MessageViewModel(message); // Act // Assert Assert.Equal("123456", messageViewModel.Id); Assert.Equal("my message", messageViewModel.Text); Assert.Equal("<div>my message</div>", messageViewModel.Html); Assert.Equal(DateTime.Now.ToString(), messageViewModel.SentDate.ToString()); Assert.Null(messageViewModel.User); Assert.True(messageViewModel.Read); } } }
using Gitter.ViewModel.Concrete; using GitterSharp.Model; using Xunit; namespace Gitter.UnitTests.ViewModels { public class MessageTests { [Fact] public void CreateMessage_Should_SetMessage() { // Arrange var message = new Message(); var messageViewModel = new MessageViewModel(message); // Act // Assert Assert.Same(message, messageViewModel.Message); } } }
apache-2.0
C#
3ae1496c3df328fbac76376bebbd701ae5a75e10
Fix rename bug.
JohanLarsson/Gu.ChangeTracking,JohanLarsson/Gu.State,JohanLarsson/Gu.State
Gu.State.Tests/DiffTests/FieldValues/Dictionary.cs
Gu.State.Tests/DiffTests/FieldValues/Dictionary.cs
namespace Gu.State.Tests.DiffTests.FieldValues { public class Dictionary : DictionaryTests { public override Diff DiffBy<T>(T x, T y, ReferenceHandling referenceHandling) { return Gu.State.DiffBy.FieldValues(x, y, referenceHandling); } } }
namespace Gu.State.Tests.DiffTests.FieldValues { public class Dictionary : DictionaryTests { public override Diff DiffBy<T>(T x, T y, ReferenceHandling referenceHandling) { return DiffBy.FieldValues(x, y, referenceHandling); } } }
mit
C#
d0ccdcaec0cfb97d900926ec1c7a34a495539850
Modify startup.cs
Kagamine/ForumR,Kagamine/ForumR
src/ForumR/Startup.cs
src/ForumR/Startup.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity; using Microsoft.Extensions.DependencyInjection; using ForumR.Models; namespace ForumR { public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddEntityFramework() .AddNpgsql() .AddDbContext<ForumContext>(x => x.UseNpgsql("User ID=postgres;Password=123456;Host=localhost;Port=5432;Database=ForumR;")); services.AddIdentity<User, IdentityRole<long>>(x => { x.Password.RequireDigit = false; x.Password.RequiredLength = 0; x.Password.RequireLowercase = false; x.Password.RequireNonLetterOrDigit = false; x.Password.RequireUppercase = false; x.User.AllowedUserNameCharacters = null; }) .AddDefaultTokenProviders() .AddEntityFrameworkStores<ForumContext>(); services.AddFileUpload() .AddEntityFrameworkStorage<ForumContext>(); services.AddMvc(); services.AddSignalR(); services.AddAntiXss(); } public void Configure(IApplicationBuilder app) { app.UseIISPlatformHandler(); app.UseIdentity(); app.UseStaticFiles(); app.UseSignalR(); app.UseAutoAjax(); app.UseFileUpload(); app.UseMvcWithDefaultRoute(); } public static void Main(string[] args) => WebApplication.Run<Startup>(args); } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity; using Microsoft.Extensions.DependencyInjection; using ForumR.Models; namespace ForumR { public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddEntityFramework() .AddNpgsql() .AddDbContext<ForumContext>(x => x.UseNpgsql("User ID=postgres;Password=123456;Host=localhost;Port=5432;Database=ForumR;")); services.AddIdentity<User, IdentityRole<long>>(x => { x.Password.RequireDigit = false; x.Password.RequiredLength = 0; x.Password.RequireLowercase = false; x.Password.RequireNonLetterOrDigit = false; x.Password.RequireUppercase = false; x.User.AllowedUserNameCharacters = null; }) .AddDefaultTokenProviders() .AddEntityFrameworkStores<ForumContext>(); services.AddFileUpload() .AddEntityFrameworkStorage<ForumContext>(); services.AddMvc() .AddTemplate(); services.AddSignalR(); services.AddAntiXss(); } public void Configure(IApplicationBuilder app) { app.UseIISPlatformHandler(); app.UseIdentity(); app.UseStaticFiles(); app.UseSignalR(); app.UseAutoAjax("/assets/shared/scripts/jquery.autoajax.js"); app.UseFileUpload("/assets/shared/scripts/jquery.fileupload.js"); app.UseMvcWithDefaultRoute(); } public static void Main(string[] args) => WebApplication.Run<Startup>(args); } }
mit
C#
c2051585d039db402f602cf01efcb1f118277117
add more event stuff
mzrimsek/scheduler,mzrimsek/scheduler,mzrimsek/scheduler
Repositories/EventRepository.cs
Repositories/EventRepository.cs
using System.Collections.Generic; using System.Linq; using scheduler.Data; using scheduler.Models.DatabaseModels; namespace scheduler.Repositories { public class EventRepository { private readonly ApplicationDbContext _context; public EventRepository(ApplicationDbContext context) { _context = context; } public Event GetById(int id) { return _context.Events.SingleOrDefault(x => x.Id == id); } public List<Event> GetByCreatedId(int createdId) { return _context.Events.Where(x => x.CreatedById == createdId).ToList(); } public void Create(Event newEvent) { _context.Add(newEvent); _context.SaveChanges(); } public void Update(Event eventToUpdate) { var existingEvent = GetById(eventToUpdate.Id); existingEvent.Title = eventToUpdate.Title; existingEvent.Description = eventToUpdate.Description; existingEvent.StartTime = eventToUpdate.StartTime; existingEvent.EndTime = eventToUpdate.EndTime; _context.SaveChanges(); } } }
using System.Collections.Generic; using System.Linq; using scheduler.Data; using scheduler.Models.DatabaseModels; namespace scheduler.Repositories { public class EventRepository { private readonly ApplicationDbContext _context; public EventRepository(ApplicationDbContext context) { _context = context; } public Event GetById(int id) { return _context.Events.SingleOrDefault(x => x.Id == id); } public List<Event> GetByCreatedId(int createdId) { return _context.Events.Where(x => x.CreatedById == createdId).ToList(); } } }
mit
C#
63ed582b17db06893c2f2fdeab98441f157e1f85
add the hero the list all unlocks command
overtools/OWLib
DataTool/ToolLogic/List/ListAllUnlocks.cs
DataTool/ToolLogic/List/ListAllUnlocks.cs
using System.Collections.Generic; using System.Linq; using DataTool.DataModels; using DataTool.DataModels.Hero; using DataTool.Flag; using DataTool.Helper; using DataTool.JSON; using TankLib; using TankLib.STU.Types; using static DataTool.Program; namespace DataTool.ToolLogic.List { [Tool("list-all-unlocks", Description = "List all unlocks", CustomFlags = typeof(ListFlags), IsSensitive = true)] public class ListAllUnlocks : JSONTool, ITool { public void Parse(ICLIFlags toolFlags) { var allUnlocks = new Dictionary<teResourceGUID, UnlockAll>(); foreach (var key in TrackedFiles[0xA5]) { var guid = (teResourceGUID) key; if (!allUnlocks.ContainsKey(guid)) { var unlock = new UnlockAll(key); if (unlock.GUID != 0) { allUnlocks[guid] = unlock; } } } var heroes = TrackedFiles[0x75].Select(STUHelper.GetInstance<STUHero>); foreach (var stuHero in heroes) { var hero = new Hero(stuHero); var progression = new ProgressionUnlocks(stuHero); foreach (var unlock in progression.IterateUnlocks()) { if (allUnlocks.ContainsKey(unlock.GUID)) { allUnlocks[unlock.GUID].Hero = hero.Name; } } } if (toolFlags is ListFlags flags) { OutputJSON(allUnlocks, flags); } } } public class UnlockAll : Unlock { public string Hero; public UnlockAll(ulong guid) : base(guid) { } } }
using System.Linq; using DataTool.DataModels; using DataTool.Flag; using DataTool.JSON; using static DataTool.Program; namespace DataTool.ToolLogic.List { [Tool("list-all-unlocks", Description = "List hero unlocks", CustomFlags = typeof(ListFlags), IsSensitive = true)] public class ListAllUnlocks : JSONTool, ITool { public void Parse(ICLIFlags toolFlags) { var data = TrackedFiles[0xA5].Select(key => new Unlock(key)).Where(unlock => unlock.GUID != 0).ToList(); if (toolFlags is ListFlags flags) { OutputJSON(data, flags); } } } }
mit
C#
9394e9a37131b007aeaedab053307fb5a4d62202
Update ProcChat2.cs
akrischer/procjam-three-musketeers,akrischer/procjam-three-musketeers
MoodRingChatroom/Assets/Scripts/Tyler/ProcChat2.cs
MoodRingChatroom/Assets/Scripts/Tyler/ProcChat2.cs
//This code was written following Brent Farris' "Simple Chat System" tutorial on Youtube.com //https://www.youtube.com/watch?v=yS_kX8RrovQ using UnityEngine; using System.Collections.Generic; public class ProcChat2 : MonoBehaviour { int GUIWidth = 350, GUIHeight = 500; public List<string> chatHistory = new List<string>(); private string currentMessage = string.Empty; public Vector2 scrollPosition; public int sadness = 0; public int happiness = 0; public int anger = 0; public int fear = 0; public int disgust = 0; public int surprise = 0; private void OnGUI() { if (!Network.isClient) { return; } GUILayout.Space (20); GUILayout.BeginHorizontal (GUILayout.Width (GUIWidth)); currentMessage = GUILayout.TextField (currentMessage); if (GUILayout.Button ("Send") || (Input.GetKeyDown(KeyCode.Return))) { if(!string.IsNullOrEmpty(currentMessage.Trim())) { networkView.RPC("ChatMessage", RPCMode.AllBuffered, new object[] {currentMessage }); currentMessage = string.Empty; } } GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, true, false, GUILayout.Width(GUIWidth), GUILayout.Height(Screen.height/2)); for (int i = chatHistory.Count - 1; i >= 0; i--) GUILayout.Label(chatHistory[i]); GUILayout.EndScrollView(); } [RPC] public void ChatMessage(string message) { chatHistory.Add (message); } }
//This code was written following Brent Farris' "Simple Chat System" tutorial on Youtube.com //https://www.youtube.com/watch?v=yS_kX8RrovQ using UnityEngine; using System.Collections.Generic; public class ProcChat2 : MonoBehaviour { int GUIWidth = 350, GUIHeight = 500; public List<string> chatHistory = new List<string>(); private string currentMessage = string.Empty; public Vector2 scrollPosition; public int sadness = 0; public int happiness = 0; public int anger = 0; public int fear = 0; public int disgust = 0; public int surprise = 0; private void OnGUI() { if (!NetworkMenu.Connected) { return; } GUILayout.Space (20); GUILayout.BeginHorizontal (GUILayout.Width (GUIWidth)); currentMessage = GUILayout.TextField (currentMessage); if (GUILayout.Button ("Send") || (Input.GetKeyDown(KeyCode.Return))) { if(!string.IsNullOrEmpty(currentMessage.Trim())) { networkView.RPC("ChatMessage", RPCMode.AllBuffered, new object[] {currentMessage }); currentMessage = string.Empty; } } GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, true, false, GUILayout.Width(GUIWidth), GUILayout.Height(Screen.height/2)); for (int i = chatHistory.Count - 1; i >= 0; i--) GUILayout.Label(chatHistory[i]); GUILayout.EndScrollView(); } [RPC] public void ChatMessage(string message) { chatHistory.Add (message); } }
artistic-2.0
C#
0b7a19ef5751fe8bf8d887d27b030880dbd2add8
Use a unique file for every test
ali-ince/akka.net,eisendle/akka.net,amichel/akka.net,simonlaroche/akka.net,heynickc/akka.net,alexpantyukhin/akka.net,willieferguson/akka.net,eisendle/akka.net,Micha-kun/akka.net,jordansjones/akka.net,nanderto/akka.net,Silv3rcircl3/akka.net,derwasp/akka.net,willieferguson/akka.net,alexpantyukhin/akka.net,heynickc/akka.net,Silv3rcircl3/akka.net,jordansjones/akka.net,amichel/akka.net,simonlaroche/akka.net,ali-ince/akka.net,derwasp/akka.net,nanderto/akka.net,Micha-kun/akka.net
src/core/Akka.Streams.Tests.TCK/FilePublisherTest.cs
src/core/Akka.Streams.Tests.TCK/FilePublisherTest.cs
//----------------------------------------------------------------------- // <copyright file="FilePublisherTest.cs" company="Akka.NET Project"> // Copyright (C) 2015-2016 Lightbend Inc. <http://www.lightbend.com> // Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net> // </copyright> //----------------------------------------------------------------------- using System.IO; using System.Linq; using Akka.IO; using Akka.Streams.Dsl; using Akka.Streams.TestKit.Tests; using Reactive.Streams; namespace Akka.Streams.Tests.TCK { class FilePublisherTest : AkkaPublisherVerification<ByteString> { private const int ChunkSize = 256; private const int Elements = 1000; private static int _counter; private readonly FileInfo _file; public FilePublisherTest() : base(Utils.UnboundedMailboxConfig.WithFallback(AkkaSpec.TestConfig)) { _file = new FileInfo(Path.Combine(Path.GetTempPath(), $"file-source-tck-{_counter++}.tmp")); var chunk = Enumerable.Range(1, ChunkSize).Select(_ => "x").Aggregate("", (s, s1) => s + s1); using (var writer = _file.CreateText()) for (var i = 0; i < Elements; i++) writer.Write(chunk); } protected override void AfterShutdown() => _file.Delete(); public override IPublisher<ByteString> CreatePublisher(long elements) => FileIO.FromFile(_file, 512) .Take(elements) .RunWith(Sink.AsPublisher<ByteString>(false), Materializer); public override long MaxElementsFromPublisher { get; } = Elements; } }
//----------------------------------------------------------------------- // <copyright file="FilePublisherTest.cs" company="Akka.NET Project"> // Copyright (C) 2015-2016 Lightbend Inc. <http://www.lightbend.com> // Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net> // </copyright> //----------------------------------------------------------------------- using System.IO; using System.Linq; using Akka.Dispatch; using Akka.IO; using Akka.Streams.Dsl; using Akka.Streams.TestKit.Tests; using Reactive.Streams; namespace Akka.Streams.Tests.TCK { class FilePublisherTest : AkkaPublisherVerification<ByteString> { private const int ChunkSize = 256; private const int Elements = 1000; private FileInfo _file; public FilePublisherTest() : base(Utils.UnboundedMailboxConfig.WithFallback(AkkaSpec.TestConfig)) { _file = new FileInfo(Path.Combine(Path.GetTempPath(), "file-source-tck.tmp")); var chunk = Enumerable.Range(1, ChunkSize).Select(_ => "x").Aggregate("", (s, s1) => s + s1); using (var writer = _file.CreateText()) for (var i = 0; i < Elements; i++) writer.Write(chunk); } protected override void AfterShutdown() => _file.Delete(); public override IPublisher<ByteString> CreatePublisher(long elements) => FileIO.FromFile(_file, 512) .Take(elements) .RunWith(Sink.AsPublisher<ByteString>(false), Materializer); public override long MaxElementsFromPublisher { get; } = Elements; } }
apache-2.0
C#
3370ba3011ea13b835267ed3e58f9a0ee078147f
Add constraint.
pak21/bggapi.net
BGGAPI.NET/AutomapperExtensions.cs
BGGAPI.NET/AutomapperExtensions.cs
using System; using AutoMapper; namespace BGGAPI { public static class AutoMapperExtensions { public static void NullSafeConvertUsing<TSource, TDestination>( this IMappingExpression<TSource, TDestination> mappingExpression, Func<TSource, TDestination> mappingFunction) where TSource : class { mappingExpression.ConvertUsing(src => src == null ? default(TDestination) : mappingFunction(src)); } } }
using System; using AutoMapper; namespace BGGAPI { public static class AutoMapperExtensions { public static void NullSafeConvertUsing<TSource, TDestination>(this IMappingExpression<TSource, TDestination> mappingExpression, Func<TSource, TDestination> mappingFunction) { mappingExpression.ConvertUsing(src => src == null ? default(TDestination) : mappingFunction(src)); } } }
mit
C#
ab9630e0bd95353e9c6dac15fa805eec4894c322
change namespace of MainClass
mooware/mooftpserv
bin/Main.cs
bin/Main.cs
using System; using mooftpserv; namespace mooftpserv { class MainClass { public static void Main(string[] args) { Server srv = new Server("0.0.0.0", 9999); srv.Run(); } } }
using System; using mooftpserv; namespace mooftpserv.bin { class MainClass { public static void Main(string[] args) { Server srv = new Server("0.0.0.0", 9999); srv.Run(); } } }
mit
C#
ae5f0423755b0590d37e698f1f7eed99ca976121
Fix typo
BialJam/NieWiemAndrzejuNaprawdeNieWiem
Bialjam/Assets/Gra/LightManager.cs
Bialjam/Assets/Gra/LightManager.cs
using UnityEngine; using System.Collections; public class LightManager { Material LightOnMaterial; Material LightOffMaterial; public bool IsOn; // Use this for initialization public void UpdateLights() { GameObject[] allLights = GameObject.FindGameObjectsWithTag ("Light"); foreach (GameObject i in allLights) { i.SetActive (IsOn); } SpriteRenderer[] bitmaps = GameObject.FindObjectsOfType<SpriteRenderer>(); if (IsOn) { foreach (SpriteRenderer i in bitmaps) { i.material = LightOnMaterial; } } else { foreach (SpriteRenderer i in bitmaps) { i.material = LightOffMaterial; } } } public void SetLights(bool enabled) { if (IsOn != enabled) { IsOn = enabled; UpdateLights (); } } private static LightManager instance; public static LightManager Instance { get { if(instance==null) { instance = new LightManager(); instance.LightOnMaterial = Resources.Load("Materials/LightOnMaterial", typeof(Material)) as Material; instance.LightOffMaterial = Resources.Load("Materials/LightOffMaterial", typeof(Material)) as Material; } return instance; } } }
using UnityEngine; using System.Collections; public class LightManager { Material LightOnMaterial; Material LightOffMaterial; public bool IsOn; // Use this for initialization public void UpdateLights() { GameObject[] allLights = GameObject.FindGameObjectsWithTag ("Light"); foreach (GameObject i in allLights) { i.SetActive (isOn); } SpriteRenderer[] bitmaps = GameObject.FindObjectsOfType<SpriteRenderer>(); if (isOn) { foreach (SpriteRenderer i in bitmaps) { i.material = LightOnMaterial; } } else { foreach (SpriteRenderer i in bitmaps) { i.material = LightOffMaterial; } } } public void SetLights(bool enabled) { if (isOn != enabled) { isOn = enabled; UpdateLights (); } } private static LightManager instance; public static LightManager Instance { get { if(instance==null) { instance = new LightManager(); instance.LightOnMaterial = Resources.Load("Materials/LightOnMaterial", typeof(Material)) as Material; instance.LightOffMaterial = Resources.Load("Materials/LightOffMaterial", typeof(Material)) as Material; } return instance; } } }
cc0-1.0
C#
4e7c92ce35ec7341902043491771cf6d335811a4
Update IMetricTelemeter.cs
tiksn/TIKSN-Framework
TIKSN.Core/Analytics/Telemetry/IMetricTelemeter.cs
TIKSN.Core/Analytics/Telemetry/IMetricTelemeter.cs
using System.Threading.Tasks; namespace TIKSN.Analytics.Telemetry { public interface IMetricTelemeter { Task TrackMetric(string metricName, decimal metricValue); } }
using System.Threading.Tasks; namespace TIKSN.Analytics.Telemetry { public interface IMetricTelemeter { Task TrackMetric(string metricName, decimal metricValue); } }
mit
C#
cd8bb36661e3f9a7d6c9e0400ad51436d6a7e416
bump Version
blackpanther989/ArchiSteamFarm,blackpanther989/ArchiSteamFarm
ArchiSteamFarm/SharedInfo.cs
ArchiSteamFarm/SharedInfo.cs
/* _ _ _ ____ _ _____ / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| Copyright 2015-2016 Łukasz "JustArchi" Domeradzki Contact: JustArchi@JustArchi.net Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.Reflection; namespace ArchiSteamFarm { internal static class SharedInfo { internal enum EUserInputType : byte { Unknown, DeviceID, Login, Password, PhoneNumber, SMS, SteamGuard, SteamParentalPIN, RevocationCode, TwoFactorAuthentication, WCFHostname } internal const string VersionNumber = "2.1.5.5"; internal const string Copyright = "Copyright © ArchiSteamFarm 2015-2016"; internal const string GithubRepo = "Blackpanther989/ArchiSteamFarm"; internal const string ServiceName = "ArchiSteamFarm"; internal const string ServiceDescription = "ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously."; internal const string EventLog = ServiceName; internal const string EventLogSource = EventLog + "Logger"; internal const string ASF = "ASF"; internal const string ASFDirectory = "ArchiSteamFarm"; internal const string ConfigDirectory = "config"; internal const string DebugDirectory = "debug"; internal const string LogFile = "log.txt"; internal const ulong ArchiSteamID = 76561198006963719; internal const ulong ASFGroupSteamID = 103582791440160998; internal const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases"; // GitHub API is HTTPS only internal const string GlobalConfigFileName = ASF + ".json"; internal const string GlobalDatabaseFileName = ASF + ".db"; internal static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version; } }
/* _ _ _ ____ _ _____ / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| Copyright 2015-2016 Łukasz "JustArchi" Domeradzki Contact: JustArchi@JustArchi.net Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.Reflection; namespace ArchiSteamFarm { internal static class SharedInfo { internal enum EUserInputType : byte { Unknown, DeviceID, Login, Password, PhoneNumber, SMS, SteamGuard, SteamParentalPIN, RevocationCode, TwoFactorAuthentication, WCFHostname } internal const string VersionNumber = "2.1.5.4"; internal const string Copyright = "Copyright © ArchiSteamFarm 2015-2016"; internal const string GithubRepo = "Blackpanther989/ArchiSteamFarm"; internal const string ServiceName = "ArchiSteamFarm"; internal const string ServiceDescription = "ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously."; internal const string EventLog = ServiceName; internal const string EventLogSource = EventLog + "Logger"; internal const string ASF = "ASF"; internal const string ASFDirectory = "ArchiSteamFarm"; internal const string ConfigDirectory = "config"; internal const string DebugDirectory = "debug"; internal const string LogFile = "log.txt"; internal const ulong ArchiSteamID = 76561198006963719; internal const ulong ASFGroupSteamID = 103582791440160998; internal const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases"; // GitHub API is HTTPS only internal const string GlobalConfigFileName = ASF + ".json"; internal const string GlobalDatabaseFileName = ASF + ".db"; internal static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version; } }
apache-2.0
C#
77eab84521a2d6fd1fd4b8543ae24fe43c343751
fix build break
superyyrrzz/docfx,superyyrrzz/docfx,sergey-vershinin/docfx,928PJY/docfx,hellosnow/docfx,pascalberger/docfx,dotnet/docfx,DuncanmaMSFT/docfx,928PJY/docfx,sergey-vershinin/docfx,LordZoltan/docfx,hellosnow/docfx,LordZoltan/docfx,LordZoltan/docfx,hellosnow/docfx,superyyrrzz/docfx,DuncanmaMSFT/docfx,LordZoltan/docfx,928PJY/docfx,pascalberger/docfx,sergey-vershinin/docfx,pascalberger/docfx,dotnet/docfx,dotnet/docfx
src/docfx/SubCommands/PackCommandCreator.cs
src/docfx/SubCommands/PackCommandCreator.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.SubCommands { using Microsoft.DocAsCode; using Microsoft.DocAsCode.Plugins; // TODO: currently disabled // [CommandOption("pack", "Pack exsiting YAML files to external reference")] internal sealed class PackCommandCreator : CommandCreator<PackCommandOptions, PackCommand> { public override PackCommand CreateCommand(PackCommandOptions options, ISubCommandController controller) { return new PackCommand(options); } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.SubCommands { using Microsoft.DocAsCode; using Microsoft.DocAsCode.Plugins; // TODO: currently disabled // [CommandOption("pack", "Pack exsiting YAML files to external reference")] internal sealed class PackCommandCreator : CommandCreator<PackCommandOptions, PackCommand> { public override PackCommand CreateCommand(ExportCommandOptions options, ISubCommandController controller) { return new PackCommand(options); } } }
mit
C#
9260d1c24ddefe09992a39fd74ba6a9eec2f928d
Fix incorrect scroll time calculation.
ZLima12/osu,smoogipoo/osu,peppy/osu,peppy/osu,ppy/osu,Drezi126/osu,ZLima12/osu,ppy/osu,2yangk23/osu,naoey/osu,Frontear/osuKyzer,johnneijzen/osu,Damnae/osu,DrabWeb/osu,peppy/osu,ppy/osu,peppy/osu-new,EVAST9919/osu,johnneijzen/osu,NeoAdonis/osu,naoey/osu,naoey/osu,Nabile-Rahmani/osu,EVAST9919/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,DrabWeb/osu,nyaamara/osu,UselessToucan/osu,smoogipoo/osu,tacchinotacchi/osu,RedNesto/osu,DrabWeb/osu,UselessToucan/osu,smoogipooo/osu,UselessToucan/osu,osu-RP/osu-RP,2yangk23/osu
osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs
osu.Game.Modes.Taiko/Objects/TaikoHitObject.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.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Modes.Objects; namespace osu.Game.Modes.Taiko.Objects { public abstract class TaikoHitObject : HitObject { /// <summary> /// HitCircle radius. /// </summary> public const float CIRCLE_RADIUS = 42f; /// <summary> /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a <see cref="ControlPoint.BeatLength"/> of 1000ms. /// </summary> private const double scroll_time = 6000; /// <summary> /// Our adjusted <see cref="scroll_time"/> taking into consideration local <see cref="ControlPoint.BeatLength"/> and other speed multipliers. /// </summary> public double ScrollTime; /// <summary> /// Whether this HitObject is a "strong" type. /// Strong hit objects give more points for hitting the hit object with both keys. /// </summary> public bool IsStrong; /// <summary> /// Whether this HitObject is in Kiai time. /// </summary> public bool Kiai { get; protected set; } public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { base.ApplyDefaults(timing, difficulty); ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000) / difficulty.SliderMultiplier; ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; if (overridePoint != null) Kiai |= overridePoint.KiaiMode; } } }
// 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.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Modes.Objects; namespace osu.Game.Modes.Taiko.Objects { public abstract class TaikoHitObject : HitObject { /// <summary> /// HitCircle radius. /// </summary> public const float CIRCLE_RADIUS = 42f; /// <summary> /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a <see cref="ControlPoint.BeatLength"/> of 1000ms. /// </summary> private const double scroll_time = 6000; /// <summary> /// Our adjusted <see cref="scroll_time"/> taking into consideration local <see cref="ControlPoint.BeatLength"/> and other speed multipliers. /// </summary> public double ScrollTime; /// <summary> /// Whether this HitObject is a "strong" type. /// Strong hit objects give more points for hitting the hit object with both keys. /// </summary> public bool IsStrong; /// <summary> /// Whether this HitObject is in Kiai time. /// </summary> public bool Kiai { get; protected set; } public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { base.ApplyDefaults(timing, difficulty); ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) / 1000) / (difficulty.SliderMultiplier * timing.SpeedMultiplierAt(StartTime)); ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; if (overridePoint != null) Kiai |= overridePoint.KiaiMode; } } }
mit
C#
7bfc17ad320ecae5ab78711dbeba793f8acdcaa2
Update src/Abp.ZeroCore.EntityFrameworkCore/EntityHistory/EntitySnapshotManager.cs
ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,luchaoshuai/aspnetboilerplate,verdentk/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,verdentk/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ilyhacker/aspnetboilerplate,carldai0106/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,carldai0106/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,carldai0106/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate
src/Abp.ZeroCore.EntityFrameworkCore/EntityHistory/EntitySnapshotManager.cs
src/Abp.ZeroCore.EntityFrameworkCore/EntityHistory/EntitySnapshotManager.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Abp.Dependency; using Abp.Domain.Entities; using Abp.Domain.Repositories; using Abp.EntityFramework; using Abp.EntityFrameworkCore.Repositories; using Abp.Events.Bus.Entities; using Abp.Json; using Microsoft.EntityFrameworkCore; namespace Abp.EntityHistory { public class EntitySnapshotManager : EntitySnapshotManagerBase { private readonly IRepository<EntityChange, long> _entityChangeRepository; public EntitySnapshotManager(IRepository<EntityChange, long> entityChangeRepository) { _entityChangeRepository = entityChangeRepository; } protected override async Task<TEntity> GetEntityById<TEntity, TPrimaryKey>(TPrimaryKey id) { return await _entityChangeRepository.GetDbContext() .Set<TEntity>().AsQueryable().FirstOrDefaultAsync(CreateEqualityExpressionForId<TEntity, TPrimaryKey>(id)); } protected override IQueryable<EntityChange> GetEntityChanges<TEntity, TPrimaryKey>(TPrimaryKey id, DateTime snapshotTime) { string fullName = typeof(TEntity).FullName; var idJson = id.ToJsonString(); return _entityChangeRepository.GetAll() //select all changes which created after snapshot time .Where(x => x.EntityTypeFullName == fullName && x.EntityId == idJson && x.ChangeTime > snapshotTime && x.ChangeType != EntityChangeType.Created) .OrderByDescending(x => x.ChangeTime); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Abp.Dependency; using Abp.Domain.Entities; using Abp.Domain.Repositories; using Abp.EntityFramework; using Abp.EntityFrameworkCore.Repositories; using Abp.Events.Bus.Entities; using Abp.Json; using Microsoft.EntityFrameworkCore; namespace Abp.EntityHistory { public class EntitySnapshotManager : EntitySnapshotManagerBase { private readonly IRepository<EntityChange, long> _entityChangeRepository; public EntitySnapshotManager(IRepository<EntityChange, long> entityChangeRepository) { _entityChangeRepository = entityChangeRepository; } protected override async Task<TEntity> GetEntityById<TEntity, TPrimaryKey>(TPrimaryKey id) { return await _entityChangeRepository.GetDbContext() .Set<TEntity>().AsQueryable().FirstOrDefaultAsync(base.CreateEqualityExpressionForId<TEntity, TPrimaryKey>(id)); } protected override IQueryable<EntityChange> GetEntityChanges<TEntity, TPrimaryKey>(TPrimaryKey id, DateTime snapshotTime) { string fullName = typeof(TEntity).FullName; var idJson = id.ToJsonString(); return _entityChangeRepository.GetAll() //select all changes which created after snapshot time .Where(x => x.EntityTypeFullName == fullName && x.EntityId == idJson && x.ChangeTime > snapshotTime && x.ChangeType != EntityChangeType.Created) .OrderByDescending(x => x.ChangeTime); } } }
mit
C#