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
a69adef5412ed5b8b3b77efa38f2c80e6114f05c
Remove Console debug output
bbqchickenrobot/rethinkdb-net,kangkot/rethinkdb-net,bbqchickenrobot/rethinkdb-net,kangkot/rethinkdb-net,nkreipke/rethinkdb-net,LukeForder/rethinkdb-net,nkreipke/rethinkdb-net,Ernesto99/rethinkdb-net,LukeForder/rethinkdb-net,Ernesto99/rethinkdb-net
rethinkdb-net/DatumConverters/DatumConverterFactoryExtensions.cs
rethinkdb-net/DatumConverters/DatumConverterFactoryExtensions.cs
using System; namespace RethinkDb { public static class DatumConverterFactoryExtensions { public static bool TryGet<T>(this IDatumConverterFactory datumConverterFactory, out IDatumConverter<T> datumConverter) { return datumConverterFactory.TryGet<T>(datumConverterFactory, out datumConverter); } public static IDatumConverter<T> Get<T>(this IDatumConverterFactory datumConverterFactory) { if (datumConverterFactory == null) throw new ArgumentNullException("datumConverterFactory"); return datumConverterFactory.Get<T>(datumConverterFactory); } public static IDatumConverter<T> Get<T>(this IDatumConverterFactory datumConverterFactory, IDatumConverterFactory rootDatumConverterFactory) { if (datumConverterFactory == null) throw new ArgumentNullException("datumConverterFactory"); if (rootDatumConverterFactory == null) throw new ArgumentNullException("rootDatumConverterFactory"); IDatumConverter<T> retval; if (datumConverterFactory.TryGet<T>(rootDatumConverterFactory, out retval)) return retval; else throw new NotSupportedException(String.Format("Datum converter is not availble for type {0}", typeof(T))); } } }
using System; namespace RethinkDb { public static class DatumConverterFactoryExtensions { public static bool TryGet<T>(this IDatumConverterFactory datumConverterFactory, out IDatumConverter<T> datumConverter) { return datumConverterFactory.TryGet<T>(datumConverterFactory, out datumConverter); } public static IDatumConverter<T> Get<T>(this IDatumConverterFactory datumConverterFactory) { if (datumConverterFactory == null) throw new ArgumentNullException("datumConverterFactory"); Console.WriteLine("DatumConverterFactoryExtensions.Get({0})", datumConverterFactory); return datumConverterFactory.Get<T>(datumConverterFactory); } public static IDatumConverter<T> Get<T>(this IDatumConverterFactory datumConverterFactory, IDatumConverterFactory rootDatumConverterFactory) { if (datumConverterFactory == null) throw new ArgumentNullException("datumConverterFactory"); if (rootDatumConverterFactory == null) throw new ArgumentNullException("rootDatumConverterFactory"); Console.WriteLine("DatumConverterFactoryExtensions.Get({0}, {0})", datumConverterFactory, rootDatumConverterFactory); IDatumConverter<T> retval; if (datumConverterFactory.TryGet<T>(rootDatumConverterFactory, out retval)) return retval; else throw new NotSupportedException(String.Format("Datum converter is not availble for type {0}", typeof(T))); } } }
apache-2.0
C#
99ae3595c3fac6b0c3e01abba5561776415ff3e1
change to assemblyinfo.cs
TrueNorthIT/Elmah
TrueNorth.Elmah/Properties/AssemblyInfo.cs
TrueNorth.Elmah/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("TrueNorth.Elmah")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TrueNorth.Elmah")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c55fb63d-6c56-43bc-823b-360196c8c2ad")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0.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("TrueNorth.Elmah")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TrueNorth.Elmah")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c55fb63d-6c56-43bc-823b-360196c8c2ad")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0.*")]
mit
C#
ecd6f48ddd64efa751bccfcbc19499deba33fdad
Add build version autoincrement
GAnatoliy/ViewModelLoader
ViewModelLoader/Properties/AssemblyInfo.cs
ViewModelLoader/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("ViewModelLoader")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ViewModelLoader")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("26173ffd-2a06-4dee-941d-fd3164cf4054")] // 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")]
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("ViewModelLoader")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ViewModelLoader")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("26173ffd-2a06-4dee-941d-fd3164cf4054")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
a6ec80d737c9b7d6fd6903f8ab8b50652bd851dd
Revert "Embedded native widgets should also participate in sizing"
residuum/xwt,TheBrainTech/xwt,iainx/xwt,steffenWi/xwt,cra0zy/xwt,hwthomas/xwt,antmicro/xwt,mono/xwt,akrisiun/xwt,hamekoz/xwt,lytico/xwt
Xwt/Xwt.Backends/IEmbeddedWidgetBackend.cs
Xwt/Xwt.Backends/IEmbeddedWidgetBackend.cs
// // IEmbeddedWidgetBackend.cs // // Author: // Lluis Sanchez <lluis@xamarin.com> // // Copyright (c) 2013 Xamarin Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Xwt.Backends { public interface IEmbeddedWidgetBackend: IWidgetBackend { void SetContent (object nativeWidget); } [BackendType (typeof(IEmbeddedWidgetBackend))] internal class EmbeddedNativeWidget: Widget { object nativeWidget; Widget sourceWidget; class EmbeddedNativeWidgetBackendHost: WidgetBackendHost<EmbeddedNativeWidget,IEmbeddedWidgetBackend> { protected override void OnBackendCreated () { Backend.SetContent (Parent.nativeWidget); base.OnBackendCreated (); } } protected override Xwt.Backends.BackendHost CreateBackendHost () { return new EmbeddedNativeWidgetBackendHost (); } public void Initialize (object nativeWidget, Widget sourceWidget) { this.nativeWidget = nativeWidget; this.sourceWidget = sourceWidget; } protected override Size OnGetPreferredSize (SizeConstraint widthConstraint, SizeConstraint heightConstraint) { if (sourceWidget != null) return sourceWidget.Surface.GetPreferredSize (widthConstraint, heightConstraint); else return Size.Zero; } } }
// // IEmbeddedWidgetBackend.cs // // Author: // Lluis Sanchez <lluis@xamarin.com> // // Copyright (c) 2013 Xamarin Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Xwt.Backends { public interface IEmbeddedWidgetBackend: IWidgetBackend { void SetContent (object nativeWidget); } [BackendType (typeof(IEmbeddedWidgetBackend))] internal class EmbeddedNativeWidget: Widget { object nativeWidget; Widget sourceWidget; class EmbeddedNativeWidgetBackendHost: WidgetBackendHost<EmbeddedNativeWidget,IEmbeddedWidgetBackend> { protected override void OnBackendCreated () { Backend.SetContent (Parent.nativeWidget); base.OnBackendCreated (); } } protected override Xwt.Backends.BackendHost CreateBackendHost () { return new EmbeddedNativeWidgetBackendHost (); } public void Initialize (object nativeWidget, Widget sourceWidget) { this.nativeWidget = nativeWidget; this.sourceWidget = sourceWidget; } protected override Size OnGetPreferredSize (SizeConstraint widthConstraint, SizeConstraint heightConstraint) { if (sourceWidget != null) return sourceWidget.Surface.GetPreferredSize (widthConstraint, heightConstraint); else return base.OnGetPreferredSize (widthConstraint, heightConstraint); } } }
mit
C#
6425753a289f255055fd07a0a9a5a48d5191171a
Bump version to 0.7.2
ar3cka/Journalist
src/SolutionInfo.cs
src/SolutionInfo.cs
// <auto-generated/> using System.Reflection; [assembly: AssemblyProductAttribute("Journalist")] [assembly: AssemblyVersionAttribute("0.7.2")] [assembly: AssemblyInformationalVersionAttribute("0.7.2")] [assembly: AssemblyFileVersionAttribute("0.7.2")] [assembly: AssemblyCompanyAttribute("Anton Mednonogov")] namespace System { internal static class AssemblyVersionInformation { internal const string Version = "0.7.2"; } }
// <auto-generated/> using System.Reflection; [assembly: AssemblyProductAttribute("Journalist")] [assembly: AssemblyVersionAttribute("0.7.1")] [assembly: AssemblyInformationalVersionAttribute("0.7.1")] [assembly: AssemblyFileVersionAttribute("0.7.1")] [assembly: AssemblyCompanyAttribute("Anton Mednonogov")] namespace System { internal static class AssemblyVersionInformation { internal const string Version = "0.7.1"; } }
apache-2.0
C#
2e0df5a339ecd4b524046fe799beeec4bb7a449c
update sample
stefangordon/GeoTiffSharp
Sample/Program.cs
Sample/Program.cs
using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using GeoTiffSharp; namespace Sample { class Program { public const string tiffPath = @"..\..\..\SampleData\sample.tif"; public const string objPath = @"..\..\..\SampleData\ObjSample\GC.obj"; static void Main(string[] args) { // OBJ Testing var objMetadataOutput = Path.Combine(Path.GetDirectoryName(objPath), "objSample.json"); if (File.Exists(objMetadataOutput)) File.Delete(objMetadataOutput); var objBinaryOutput = Path.Combine(Path.GetDirectoryName(objPath), "objSample.dat"); if (File.Exists(objBinaryOutput)) File.Delete(objBinaryOutput); var objBitmapOutput = Path.Combine(Path.GetDirectoryName(objPath), "objSample.bmp"); if (File.Exists(objBitmapOutput)) File.Delete(objBitmapOutput); var objConverter = new GeoObj(); objConverter.ConvertToHeightMap(objPath, objBinaryOutput, objMetadataOutput, objBitmapOutput); // Save metadata var outputManifestPath = Path.Combine(Path.GetDirectoryName(tiffPath), "tiffSample.json"); if (File.Exists(outputManifestPath)) File.Delete(outputManifestPath); // Save image var outputPath = Path.Combine(Path.GetDirectoryName(tiffPath), "tiffSample.dat"); if (File.Exists(outputPath)) File.Delete(outputPath); var bitmapPath = Path.Combine(Path.GetDirectoryName(tiffPath), "tiffSample.bmp"); if (File.Exists(bitmapPath)) File.Delete(bitmapPath); using (GeoTiff tiffConverter = new GeoTiff()) { tiffConverter.ConvertToHeightMap(tiffPath, outputPath, outputManifestPath, bitmapPath); } } } }
using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using GeoTiffSharp; namespace Sample { class Program { public const string tiffPath = @"..\..\..\SampleData\sample.tif"; public const string objPath = @"..\..\..\SampleData\ObjSample\GC.obj"; static void Main(string[] args) { // OBJ Testing var objMetadataOutput = Path.Combine(Path.GetDirectoryName(objPath), "objMetadata.json"); if (File.Exists(objMetadataOutput)) File.Delete(objMetadataOutput); var objBinaryOutput = Path.Combine(Path.GetDirectoryName(objPath), "objBinary.dat"); if (File.Exists(objBinaryOutput)) File.Delete(objBinaryOutput); var objBitmapOutput = Path.Combine(Path.GetDirectoryName(objPath), "objDiagnostic.bmp"); if (File.Exists(objBitmapOutput)) File.Delete(objBitmapOutput); var objConverter = new GeoObj(); objConverter.ConvertToHeightMap(objPath, objBinaryOutput, objMetadataOutput, objBitmapOutput); // Save metadata var outputManifestPath = Path.Combine(Path.GetDirectoryName(tiffPath), "metadata.json"); if (File.Exists(outputManifestPath)) File.Delete(outputManifestPath); // Save image var outputPath = Path.Combine(Path.GetDirectoryName(tiffPath), "binary.dat"); if (File.Exists(outputPath)) File.Delete(outputPath); var bitmapPath = Path.Combine(Path.GetDirectoryName(tiffPath), "diagnostic.bmp"); if (File.Exists(bitmapPath)) File.Decrypt(bitmapPath); using (GeoTiff tiffConverter = new GeoTiff()) { tiffConverter.ConvertToHeightMap(tiffPath, outputPath, outputManifestPath, bitmapPath); } } } }
mit
C#
fcc0d40be0a9e6ade35b4ccc211b9a7f9b4cc8e0
Remove commented code
mkoscielniak/SSMScripter
SSMScripter/RunCommand.cs
SSMScripter/RunCommand.cs
using System; using EnvDTE; using EnvDTE80; using Microsoft.SqlServer.Management.UI.VSIntegration; using Microsoft.SqlServer.Management.UI.VSIntegration.Editors; using Microsoft.VisualStudio.CommandBars; using SSMScripter.Integration; using SSMScripter.Properties; using SSMScripter.Runner; using SSMScripter.Scripter; namespace SSMScripter { class RunCommand : ICommand { private readonly DTE2 _app; private readonly AddIn _addin; private readonly RunAction _runAction; public RunCommand(DTE2 app, AddIn addin, RunAction runAction) { Name = "SSMScripterRun"; _app = app; _addin = addin; _runAction = runAction; } public string Name { get; protected set; } public void Bind() { var commandBars = (CommandBars)_app.CommandBars; var commands = (Commands2)_app.Commands; object[] guids = null; Command command = commands.AddNamedCommand2( _addin, Name, "Run tool", "Run tool", false, Resources.ScriptCommandIcon, ref guids, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton); command.Bindings = new object[] { "Global::Ctrl+F12" }; } public string Execute() { return _runAction.Execute(); } } }
using System; using EnvDTE; using EnvDTE80; using Microsoft.SqlServer.Management.UI.VSIntegration; using Microsoft.SqlServer.Management.UI.VSIntegration.Editors; using Microsoft.VisualStudio.CommandBars; using SSMScripter.Integration; using SSMScripter.Properties; using SSMScripter.Runner; using SSMScripter.Scripter; namespace SSMScripter { class RunCommand : ICommand { private readonly DTE2 _app; private readonly AddIn _addin; private readonly RunAction _runAction; public RunCommand(DTE2 app, AddIn addin, RunAction runAction) { Name = "SSMScripterRun"; _app = app; _addin = addin; _runAction = runAction; } public string Name { get; protected set; } public void Bind() { var commandBars = (CommandBars)_app.CommandBars; var commands = (Commands2)_app.Commands; object[] guids = null; Command command = commands.AddNamedCommand2( _addin, Name, "Run tool", "Run tool", false, Resources.ScriptCommandIcon, ref guids, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton); command.Bindings = new object[] { "Global::Ctrl+F12" }; //CommandBar resultGridCommandBar = commandBars["SQL Results Grid Tab Context"]; //command.AddControl(resultGridCommandBar); //CommandBar sqlEditorCommandBar = commandBars["SQL Files Editor Context"]; //command.AddControl(sqlEditorCommandBar); } public string Execute() { return _runAction.Execute(); } } }
mit
C#
b5f5a7ac1581292af4c6a196aed093338de8661b
Rename some classes to better match the service API.
DartVS/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS,modulexcite/DartVS
DanTup.DartAnalysis/Commands/ServerVersion.cs
DanTup.DartAnalysis/Commands/ServerVersion.cs
using System; using System.Threading.Tasks; namespace DanTup.DartAnalysis { class ServerVersionRequest : Request<Response<ServerVersionResponse>> { public string method = "server.getVersion"; } class ServerVersionResponse { public string version = null; } public static class ServerVersionRequestImplementation { public static async Task<Version> GetServerVersion(this DartAnalysisService service) { var response = await service.Service.Send(new ServerVersionRequest()); return Version.Parse(response.result.version); } } }
using System; using System.Threading.Tasks; namespace DanTup.DartAnalysis { class VersionRequest : Request<Response<VersionResponse>> { public string method = "server.getVersion"; } class VersionResponse { public string version = null; } public static class VersionRequestImplementation { public static async Task<Version> GetServerVersion(this DartAnalysisService service) { var response = await service.Service.Send(new VersionRequest()); return Version.Parse(response.result.version); } } }
mit
C#
eb563d160c713dd6baf2ed89c3fae60879f03fd9
rebuild stats now are tenant aware
selganor74/Jarvis.Framework,ProximoSrl/Jarvis.Framework,selganor74/Jarvis.Framework,selganor74/Jarvis.Framework
Jarvis.Framework.Kernel/Support/MetricsHelper.cs
Jarvis.Framework.Kernel/Support/MetricsHelper.cs
using Jarvis.Framework.Kernel.MultitenantSupport; using Metrics; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Jarvis.Framework.Kernel.Support { /// <summary> /// Class to centralize metrics based on Metrics.NET /// </summary> public static class MetricsHelper { private const String _checkpointToDispatchGaugeName ="checkpoint-to-dispatch"; public static void SetCheckpointCountToDispatch(String slotName, Func<Double> valueProvider) { String gaugeName; if (!string.IsNullOrEmpty(slotName)) { gaugeName = _checkpointToDispatchGaugeName + "-" + slotName; } else { gaugeName = _checkpointToDispatchGaugeName; } if (!String.IsNullOrWhiteSpace(TenantContext.CurrentTenantId)) { gaugeName = "t[" + TenantContext.CurrentTenantId + "]" + gaugeName; } Metric.Gauge(gaugeName, valueProvider, Unit.Items); } } }
using Metrics; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Jarvis.Framework.Kernel.Support { /// <summary> /// Class to centralize metrics based on Metrics.NET /// </summary> public static class MetricsHelper { private const String _checkpointToDispatchGaugeName ="checkpoint-to-dispatch"; public static void SetCheckpointCountToDispatch(String slotName, Func<Double> valueProvider) { String gaugeName; if (!string.IsNullOrEmpty(slotName)) { gaugeName = _checkpointToDispatchGaugeName + "-" + slotName; } else { gaugeName = _checkpointToDispatchGaugeName; } Metric.Gauge(gaugeName, valueProvider, Unit.Items); } } }
mit
C#
70950b8267fc452f25971eb9c5599649f56ba0d0
Remove useless code
AlexCaranha/Wox,kayone/Wox,kayone/Wox,dstiert/Wox,Megasware128/Wox,shangvven/Wox,derekforeman/Wox,derekforeman/Wox,Launchify/Launchify,qianlifeng/Wox,lances101/Wox,sanbinabu/Wox,JohnTheGr8/Wox,vebin/Wox,yozora-hitagi/Saber,qianlifeng/Wox,mika76/Wox,yozora-hitagi/Saber,lances101/Wox,apprentice3d/Wox,medoni/Wox,Wox-launcher/Wox,Launchify/Launchify,AlexCaranha/Wox,renzhn/Wox,Wox-launcher/Wox,AlexCaranha/Wox,kayone/Wox,danisein/Wox,zlphoenix/Wox,zlphoenix/Wox,sanbinabu/Wox,mika76/Wox,danisein/Wox,gnowxilef/Wox,mika76/Wox,shangvven/Wox,Megasware128/Wox,kdar/Wox,gnowxilef/Wox,qianlifeng/Wox,dstiert/Wox,18098924759/Wox,kdar/Wox,jondaniels/Wox,vebin/Wox,kdar/Wox,apprentice3d/Wox,medoni/Wox,EmuxEvans/Wox,sanbinabu/Wox,18098924759/Wox,apprentice3d/Wox,shangvven/Wox,EmuxEvans/Wox,gnowxilef/Wox,derekforeman/Wox,EmuxEvans/Wox,renzhn/Wox,JohnTheGr8/Wox,vebin/Wox,18098924759/Wox,dstiert/Wox,jondaniels/Wox
Wox.Plugin.System/SuggestionSources/Google.cs
Wox.Plugin.System/SuggestionSources/Google.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Xml; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using Wox.Infrastructure; using YAMP.Numerics; namespace Wox.Plugin.System.SuggestionSources { public class Google : AbstractSuggestionSource { public override List<string> GetSuggestions(string query) { try { var response = HttpRequest.CreateGetHttpResponse( "https://www.google.com/complete/search?output=chrome&q=" + Uri.EscapeUriString(query), null, null, null); var stream = response.GetResponseStream(); if (stream != null) { var body = new StreamReader(stream).ReadToEnd(); var json = JsonConvert.DeserializeObject(body) as JContainer; if (json != null) { var results = json[1] as JContainer; if (results != null) { return results.OfType<JValue>().Select(o => o.Value).OfType<string>().ToList(); } } } } catch { } return null; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Xml; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using Wox.Infrastructure; using YAMP.Numerics; namespace Wox.Plugin.System.SuggestionSources { public class Google : AbstractSuggestionSource { public override List<string> GetSuggestions(string query) { try { var response = HttpRequest.CreateGetHttpResponse( "https://www.google.com/complete/search?output=chrome&q=" + Uri.EscapeUriString(query), null, null, null); var stream = response.GetResponseStream(); if (stream != null) { var body = new StreamReader(stream).ReadToEnd(); var json = JsonConvert.DeserializeObject(body) as JContainer; if (json != null) { var results = json[1] as JContainer; if (results != null) { var j = results.OfType<JValue>().Select(o => o.Value); return results.OfType<JValue>().Select(o => o.Value).OfType<string>().ToList(); } } } } catch { } return null; } } }
mit
C#
6470b47d069889443b5c9e817467b26a56b91765
Revert "..."
Ciber-Norge/ntnuntappd,Ciber-Norge/ntnuntappd,Ciber-Norge/ntnuntappd
CiBeer/CiBeer/CiBeer/Views/Beer/Edit.cshtml
CiBeer/CiBeer/CiBeer/Views/Beer/Edit.cshtml
@model CiBeer.Models.BeerModel @{ ViewBag.Title = "Edit"; } <h2>Edit</h2> @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-horizontal"> <h4>BeerModel</h4> <hr /> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.Id) <div class="form-group"> @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @Html.LabelFor(model => model.Type, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Type, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Type, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @Html.LabelFor(model => model.Brewery, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Brewery, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Brewery, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Save" class="btn btn-default" /> </div> </div> </div> } <div> @Html.ActionLink("Back to List", "Index") </div> @section Scripts { @Scripts.Render("~/bundles/jqueryval") }
@model CiBeer.Models.BeerModel @{ ViewBag.Title = "Edit"; } <h2>Edit</h2> @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-horizontal"> <h4>BeerModel</h4> <hr /> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.Id) <div class="form-group"> @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @Html.LabelFor(model => model.Type, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Type, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Type, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @Html.LabelFor(model => model.Brewery, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Brewery, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Brewery, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Save" class="btn btn-default" /> </div> </div> </div> } <div> @Html.ActionLink("Back to List", "Index") </div> @section Scripts { @Scripts.Render("~/bundles/jqueryval") }
apache-2.0
C#
36a3b145af565bafd7ca7cb47ce820a90d7cafa1
Clean up comments in DateTimeOffsetProvider and consolidate code
chinwobble/allReady,HamidMosalla/allReady,anobleperson/allReady,anobleperson/allReady,arst/allReady,chinwobble/allReady,forestcheng/allReady,c0g1t8/allReady,MisterJames/allReady,stevejgordon/allReady,HTBox/allReady,binaryjanitor/allReady,jonatwabash/allReady,colhountech/allReady,chinwobble/allReady,forestcheng/allReady,jonatwabash/allReady,shanecharles/allReady,forestcheng/allReady,jonatwabash/allReady,GProulx/allReady,pranap/allReady,anobleperson/allReady,arst/allReady,stevejgordon/allReady,binaryjanitor/allReady,mipre100/allReady,mgmccarthy/allReady,gitChuckD/allReady,VishalMadhvani/allReady,arst/allReady,HamidMosalla/allReady,mipre100/allReady,pranap/allReady,BillWagner/allReady,colhountech/allReady,BillWagner/allReady,mgmccarthy/allReady,enderdickerson/allReady,shanecharles/allReady,anobleperson/allReady,bcbeatty/allReady,chinwobble/allReady,mipre100/allReady,MisterJames/allReady,BillWagner/allReady,JowenMei/allReady,colhountech/allReady,arst/allReady,MisterJames/allReady,gitChuckD/allReady,MisterJames/allReady,pranap/allReady,JowenMei/allReady,dpaquette/allReady,binaryjanitor/allReady,VishalMadhvani/allReady,mgmccarthy/allReady,HTBox/allReady,shanecharles/allReady,enderdickerson/allReady,dpaquette/allReady,shanecharles/allReady,VishalMadhvani/allReady,c0g1t8/allReady,forestcheng/allReady,jonatwabash/allReady,BillWagner/allReady,gitChuckD/allReady,enderdickerson/allReady,HTBox/allReady,GProulx/allReady,stevejgordon/allReady,bcbeatty/allReady,dpaquette/allReady,mgmccarthy/allReady,binaryjanitor/allReady,enderdickerson/allReady,HamidMosalla/allReady,JowenMei/allReady,gitChuckD/allReady,GProulx/allReady,pranap/allReady,dpaquette/allReady,HTBox/allReady,bcbeatty/allReady,VishalMadhvani/allReady,mipre100/allReady,GProulx/allReady,stevejgordon/allReady,c0g1t8/allReady,HamidMosalla/allReady,bcbeatty/allReady,JowenMei/allReady,c0g1t8/allReady,colhountech/allReady
AllReadyApp/Web-App/AllReady/Providers/IDateTimeOffsetProvider.cs
AllReadyApp/Web-App/AllReady/Providers/IDateTimeOffsetProvider.cs
using System; namespace AllReady.Providers { public interface IDateTimeOffsetProvider { DateTimeOffset AdjustDateTimeOffsetTo(string timeZoneId, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0); DateTimeOffset AdjustDateTimeOffsetTo(TimeZoneInfo timeZoneInfo, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0); void AdjustDateTimeOffsetTo(string timeZoneId, DateTimeOffset startDateTimeOffset, DateTimeOffset endDateTimeOffset, out DateTimeOffset convertedStartDate, out DateTimeOffset convertedEndDate); } public class DateTimeOffsetProvider : IDateTimeOffsetProvider { public DateTimeOffset AdjustDateTimeOffsetTo(string timeZoneId, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0) { return AdjustDateTimeOffsetTo(FindSystemTimeZoneBy(timeZoneId), dateTimeOffset, hour, minute, second); } public DateTimeOffset AdjustDateTimeOffsetTo(TimeZoneInfo timeZoneInfo, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0) { return new DateTimeOffset(dateTimeOffset.Year, dateTimeOffset.Month, dateTimeOffset.Day, hour, minute, second, timeZoneInfo.GetUtcOffset(dateTimeOffset)); } public void AdjustDateTimeOffsetTo(string timeZoneId, DateTimeOffset startDateTimeOffset, DateTimeOffset endDateTimeOffset, out DateTimeOffset convertedStartDate, out DateTimeOffset convertedEndDate) { var timeZoneInfo = FindSystemTimeZoneBy(timeZoneId); convertedStartDate = new DateTimeOffset(startDateTimeOffset.Year, startDateTimeOffset.Month, startDateTimeOffset.Day, 0, 0, 0, timeZoneInfo.GetUtcOffset(startDateTimeOffset)); convertedEndDate = new DateTimeOffset(endDateTimeOffset.Year, endDateTimeOffset.Month, endDateTimeOffset.Day, 0, 0, 0, timeZoneInfo.GetUtcOffset(endDateTimeOffset); } private static TimeZoneInfo FindSystemTimeZoneBy(string timeZoneId) { return TimeZoneInfo.FindSystemTimeZoneById(timeZoneId); } } }
using System; namespace AllReady.Providers { public interface IDateTimeOffsetProvider { DateTimeOffset AdjustDateTimeOffsetTo(string timeZoneId, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0); DateTimeOffset AdjustDateTimeOffsetTo(TimeZoneInfo timeZoneInfo, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0); void AdjustDateTimeOffsetTo(string timeZoneId, DateTimeOffset startDateTimeOffset, DateTimeOffset endDateTimeOffset, out DateTimeOffset convertedStartDate, out DateTimeOffset convertedEndDate); } public class DateTimeOffsetProvider : IDateTimeOffsetProvider { public DateTimeOffset AdjustDateTimeOffsetTo(string timeZoneId, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0) { var timeZoneInfo = FindSystemTimeZoneBy(timeZoneId); return AdjustDateTimeOffsetTo(timeZoneInfo, dateTimeOffset, hour, minute, second); } public DateTimeOffset AdjustDateTimeOffsetTo(TimeZoneInfo timeZoneInfo, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0) { var timeSpan = timeZoneInfo.GetUtcOffset(dateTimeOffset); return new DateTimeOffset(dateTimeOffset.Year, dateTimeOffset.Month, dateTimeOffset.Day, hour, minute, second, timeSpan); } //only thing I don't like about this signature is we lose the ability to pass in the hour, minute and second optionally... if we did, the sig of this method would start to look pretty ugly //OR, we put the onus on the caller to make sure the correct hour/minute/second are attached to the start/endDateTimeOffset values provided to the method public void AdjustDateTimeOffsetTo(string timeZoneId, DateTimeOffset startDateTimeOffset, DateTimeOffset endDateTimeOffset, out DateTimeOffset convertedStartDate, out DateTimeOffset convertedEndDate) { var timeZoneInfo = FindSystemTimeZoneBy(timeZoneId); var startDateTimeSpan = timeZoneInfo.GetUtcOffset(startDateTimeOffset); var endDateTimeSpan = timeZoneInfo.GetUtcOffset(endDateTimeOffset); convertedStartDate = new DateTimeOffset(startDateTimeOffset.Year, startDateTimeOffset.Month, startDateTimeOffset.Day, 0, 0, 0, startDateTimeSpan); convertedEndDate = new DateTimeOffset(endDateTimeOffset.Year, endDateTimeOffset.Month, endDateTimeOffset.Day, 0, 0, 0, endDateTimeSpan); } private static TimeZoneInfo FindSystemTimeZoneBy(string timeZoneId) { return TimeZoneInfo.FindSystemTimeZoneById(timeZoneId); } } }
mit
C#
d8d0d800c076e6a5de045cb8a095cceb42e45e25
Update assembly version
collector-bank/common-restapi-aspnet
Collector.Common.Infrastructure.WebApi/Properties/AssemblyInfo.cs
Collector.Common.Infrastructure.WebApi/Properties/AssemblyInfo.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="Collector AB"> // Copyright © Collector AB. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Collector.Common.Infrastructure.WebApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Collector.Common.Infrastructure.WebApi")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bd2f012d-cc2e-45cf-8d33-52ab06c315e3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.3")] [assembly: AssemblyFileVersion("0.1.3")]
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="Collector AB"> // Copyright © Collector AB. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Collector.Common.Infrastructure.WebApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Collector.Common.Infrastructure.WebApi")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bd2f012d-cc2e-45cf-8d33-52ab06c315e3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.2")] [assembly: AssemblyFileVersion("0.1.2")]
apache-2.0
C#
fc69fde8d25d05505b03ccb60658f2433f627fa6
Fix getType() when parsing commands
rit-sse-mycroft/core
Mycroft/Cmd/Command.cs
Mycroft/Cmd/Command.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization.Json; using System.Text; using System.Threading.Tasks; using Mycroft.Cmd; using Mycroft.App; using Mycroft.Cmd.Sys; using Mycroft.Cmd.App; using Mycroft.Cmd.Msg; using Mycroft.Server; namespace Mycroft.Cmd { public abstract class Command { /// <summary> /// Parses a Mycroft command from a JSON object /// </summary> /// <returns> /// Returns the Command object that needs to be routed through the system /// </returns> public static Command Parse(String input, AppInstance instance) { // TODO error handling - catch exceptions, then create a new Command // that contains the error to send back // Break the message body into the type token and the JSON blob, // then delegate to the specific command parser (MsgCmd.Parse(), AppCmd.Parse(), etc.) String type = getType(input); if (type != null) { String rawData = input.Substring(input.IndexOf('{')); Console.Write(rawData); if (type.StartsWith("MSG")) { return MsgCommand.Parse(type, rawData, instance); } else if (type.StartsWith("APP")) { return AppCommand.Parse(type, rawData, instance); } else if (type.StartsWith("SYS")) { return SysCommand.Parse(type, rawData, instance); } } //TODO standardize return null; } public static String getType(String input) { // Needs error handling? return input.Substring(0, input.IndexOf(" ")); } public virtual void VisitAppInstance(AppInstance appInstance) { } public virtual void VisitServer(TcpServer server) { } public virtual void VisitRegistry(Registry registry) { } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization.Json; using System.Text; using System.Threading.Tasks; using Mycroft.Cmd; using Mycroft.App; using Mycroft.Cmd.Sys; using Mycroft.Cmd.App; using Mycroft.Cmd.Msg; using Mycroft.Server; namespace Mycroft.Cmd { public abstract class Command { /// <summary> /// Parses a Mycroft command from a JSON object /// </summary> /// <returns> /// Returns the Command object that needs to be routed through the system /// </returns> public static Command Parse(String input, AppInstance instance) { // TODO error handling - catch exceptions, then create a new Command // that contains the error to send back // Break the message body into the type token and the JSON blob, // then delegate to the specific command parser (MsgCmd.Parse(), AppCmd.Parse(), etc.) String type = getType(input); if (type != null) { String rawData = input.Substring(input.IndexOf('{')); Console.Write(rawData); if (type.StartsWith("MSG")) { return MsgCommand.Parse(type, rawData, instance); } else if (type.StartsWith("APP")) { return AppCommand.Parse(type, rawData, instance); } else if (type.StartsWith("SYS")) { return SysCommand.Parse(type, rawData, instance); } } //TODO standardize return null; } public static String getType(String input) { // get type is in a new method for testing purposes if (input.Length >= 3) { return input.Substring(0, 3); } //malformed json //TODO standardize return null; } public virtual void VisitAppInstance(AppInstance appInstance) { } public virtual void VisitServer(TcpServer server) { } public virtual void VisitRegistry(Registry registry) { } } }
bsd-3-clause
C#
fb97c8bd4ec8d283eb92dc225cea8c7f5dc833fe
Make Record IComparable
StanJav/language-ext,louthy/language-ext,StefanBertels/language-ext
LanguageExt.Core/DataTypes/Record/Record.cs
LanguageExt.Core/DataTypes/Record/Record.cs
using System; using System.Runtime.Serialization; namespace LanguageExt { /// <summary> /// Base class for types that are 'records'. A record has a set of readonly *fields( /// that make up its data structure. By deriving from this you get structural equality, /// structural ordering (`IComparable`), structural hashing (`GetHashCode`) as well as the /// operators `==`, `!=`, `<`, `<=`, `>`, `>=`, /// </summary> /// <typeparam name="RECORDTYPE"></typeparam> [Serializable] public abstract class Record<RECORDTYPE> : IEquatable<RECORDTYPE>, IComparable<RECORDTYPE>, IComparable where RECORDTYPE : Record<RECORDTYPE> { protected Record() { } protected Record(SerializationInfo info, StreamingContext context) => RecordType<RECORDTYPE>.SetObjectData((RECORDTYPE)this, info); public static bool operator==(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.EqualityTyped((RECORDTYPE)x, (RECORDTYPE)y); public static bool operator !=(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => !(x == y); public static bool operator >(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)x, (RECORDTYPE)y) > 0; public static bool operator >=(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)x, (RECORDTYPE)y) >= 0; public static bool operator <(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)x, (RECORDTYPE)y) < 0; public static bool operator <=(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)x, (RECORDTYPE)y) <= 0; public override int GetHashCode() => RecordType<RECORDTYPE>.Hash((RECORDTYPE)this); public override bool Equals(object obj) => RecordType<RECORDTYPE>.Equality((RECORDTYPE)this, obj); public virtual int CompareTo(RECORDTYPE other) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)this, other); public virtual bool Equals(RECORDTYPE other) => RecordType<RECORDTYPE>.EqualityTyped((RECORDTYPE)this, other); public override string ToString() => RecordType<RECORDTYPE>.ToString((RECORDTYPE)this); public virtual void GetObjectData(SerializationInfo info, StreamingContext context) => RecordType<RECORDTYPE>.GetObjectData((RECORDTYPE)this, info); public int CompareTo(object obj) => obj is RECORDTYPE rt ? CompareTo(rt) : 1; } }
using System; using System.Runtime.Serialization; namespace LanguageExt { /// <summary> /// Base class for types that are 'records'. A record has a set of readonly *fields( /// that make up its data structure. By deriving from this you get structural equality, /// structural ordering (`IComparable`), structural hashing (`GetHashCode`) as well as the /// operators `==`, `!=`, `<`, `<=`, `>`, `>=`, /// </summary> /// <typeparam name="RECORDTYPE"></typeparam> [Serializable] public abstract class Record<RECORDTYPE> : IEquatable<RECORDTYPE>, IComparable<RECORDTYPE> where RECORDTYPE : Record<RECORDTYPE> { protected Record() { } protected Record(SerializationInfo info, StreamingContext context) => RecordType<RECORDTYPE>.SetObjectData((RECORDTYPE)this, info); public static bool operator==(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.EqualityTyped((RECORDTYPE)x, (RECORDTYPE)y); public static bool operator !=(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => !(x == y); public static bool operator >(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)x, (RECORDTYPE)y) > 0; public static bool operator >=(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)x, (RECORDTYPE)y) >= 0; public static bool operator <(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)x, (RECORDTYPE)y) < 0; public static bool operator <=(Record<RECORDTYPE> x, Record<RECORDTYPE> y) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)x, (RECORDTYPE)y) <= 0; public override int GetHashCode() => RecordType<RECORDTYPE>.Hash((RECORDTYPE)this); public override bool Equals(object obj) => RecordType<RECORDTYPE>.Equality((RECORDTYPE)this, obj); public virtual int CompareTo(RECORDTYPE other) => RecordType<RECORDTYPE>.Compare((RECORDTYPE)this, other); public virtual bool Equals(RECORDTYPE other) => RecordType<RECORDTYPE>.EqualityTyped((RECORDTYPE)this, other); public override string ToString() => RecordType<RECORDTYPE>.ToString((RECORDTYPE)this); public virtual void GetObjectData(SerializationInfo info, StreamingContext context) => RecordType<RECORDTYPE>.GetObjectData((RECORDTYPE)this, info); } }
mit
C#
a02ca290a757cd815c5ba456507f17bd6f62d16d
Correct display of spaces
magenta-aps/cprbroker,magenta-aps/cprbroker,OS2CPRbroker/cprbroker,magenta-aps/cprbroker,OS2CPRbroker/cprbroker
PART/Source/CprBroker/Web/Pages/Controls/MessageDisplayer.ascx.cs
PART/Source/CprBroker/Web/Pages/Controls/MessageDisplayer.ascx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace CprBroker.Web.Pages.Controls { public partial class MessageDisplayer : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { this.PreRender += MessageDisplayer_PreRender; } public readonly List<string> AlertMessages = new List<string>(); void MessageDisplayer_PreRender(object sender, EventArgs e) { // Render script elements this.divMessages.InnerHtml = string .Join("<br><br>", this.AlertMessages.ToArray()) .Replace("\r\n","<br>") .Replace(" ","&nbsp;"); if (AlertMessages.Count > 0) { string val = "<script language=\"javascript\">" + "openDialog('dialog-box')" + "</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "alerts", val); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace CprBroker.Web.Pages.Controls { public partial class MessageDisplayer : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { this.PreRender += MessageDisplayer_PreRender; } public readonly List<string> AlertMessages = new List<string>(); void MessageDisplayer_PreRender(object sender, EventArgs e) { // Render script elements this.divMessages.InnerHtml = string .Join("<br><br>", this.AlertMessages.ToArray()) .Replace("\r\n","<br>"); if (AlertMessages.Count > 0) { string val = "<script language=\"javascript\">" + "openDialog('dialog-box')" + "</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "alerts", val); } } } }
mpl-2.0
C#
83de210790d7194454374f5a9e0390dec6b7ddba
Remove unused method
chris-peterson/Kekiri
src/Core/Kekiri/Impl/ReflectionExtensions.cs
src/Core/Kekiri/Impl/ReflectionExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace Kekiri.Impl { static class ReflectionExtensions { public static KeyValuePair<string, object>[] BindParameters(this MethodBase method, KeyValuePair<string, object>[] supportedParameters) { supportedParameters = supportedParameters ?? new KeyValuePair<string, object>[0]; var methodParameters = method.GetParameters(); return supportedParameters .Where(supportedParam => methodParameters.Any(p => p.Name.Equals(supportedParam.Key, StringComparison.OrdinalIgnoreCase))) .ToArray(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace Kekiri.Impl { static class ReflectionExtensions { public static TAttribute AttributeOrDefault<TAttribute>(this Type type) where TAttribute : class { return type.GetTypeInfo().GetCustomAttributes(typeof(TAttribute), true) .SingleOrDefault() as TAttribute; } public static KeyValuePair<string, object>[] BindParameters(this MethodBase method, KeyValuePair<string, object>[] supportedParameters) { supportedParameters = supportedParameters ?? new KeyValuePair<string, object>[0]; var methodParameters = method.GetParameters(); return supportedParameters .Where(supportedParam => methodParameters.Any(p => p.Name.Equals(supportedParam.Key, StringComparison.OrdinalIgnoreCase))) .ToArray(); } } }
mit
C#
f640d04b29a9c71e47cbd063f27fee08f72d34e7
Fix unit test for 2 pages initial data
89sos98/LiteDB,falahati/LiteDB,masterdidoo/LiteDB,mbdavid/LiteDB,masterdidoo/LiteDB,RytisLT/LiteDB,falahati/LiteDB,RytisLT/LiteDB,89sos98/LiteDB
LiteDB.Tests/Database/ShrinkDatabaseTest.cs
LiteDB.Tests/Database/ShrinkDatabaseTest.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; using System.Linq; using System.Threading.Tasks; using System.Collections; using System.Collections.Generic; using System.Text; namespace LiteDB.Tests { public class LargeDoc { public ObjectId Id { get; set; } public Guid Guid { get; set; } public string Lorem { get; set; } } [TestClass] public class ShrinkDatabaseTest { [TestMethod] public void ShrinkDatabaseTest_Test() { using (var file = new TempFile()) using (var db = new LiteDatabase(file.Filename)) { var col = db.GetCollection<LargeDoc>("col"); col.Insert(GetDocs(1, 10000)); db.DropCollection("col"); // full disk usage var size = file.Size; var r = db.Shrink(); // only header page Assert.AreEqual(8192, size - r); } } private IEnumerable<LargeDoc> GetDocs(int initial, int count) { for (var i = initial; i < initial + count; i++) { yield return new LargeDoc { Guid = Guid.NewGuid(), Lorem = TempFile.LoremIpsum(10, 15, 2, 3, 3) }; } } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.IO; using System.Linq; using System.Threading.Tasks; using System.Collections; using System.Collections.Generic; using System.Text; namespace LiteDB.Tests { public class LargeDoc { public ObjectId Id { get; set; } public Guid Guid { get; set; } public string Lorem { get; set; } } [TestClass] public class ShrinkDatabaseTest { [TestMethod] public void ShrinkDatabaseTest_Test() { using (var file = new TempFile()) using (var db = new LiteDatabase(file.Filename)) { var col = db.GetCollection<LargeDoc>("col"); col.Insert(GetDocs(1, 10000)); db.DropCollection("col"); // full disk usage var size = file.Size; var r = db.Shrink(); // only header page Assert.AreEqual(4096, size - r); } } private IEnumerable<LargeDoc> GetDocs(int initial, int count) { for (var i = initial; i < initial + count; i++) { yield return new LargeDoc { Guid = Guid.NewGuid(), Lorem = TempFile.LoremIpsum(10, 15, 2, 3, 3) }; } } } }
mit
C#
c1e98f9360d3fc4ee6fd1e2333c4fbca2696c59a
Add a non-generic object cache
Microsoft/dotnet-apiport,twsouthwick/dotnet-apiport,conniey/dotnet-apiport,JJVertical/dotnet-apiport,conniey/dotnet-apiport,Microsoft/dotnet-apiport,mjrousos/dotnet-apiport,mjrousos/dotnet-apiport,conniey/dotnet-apiport,twsouthwick/dotnet-apiport,JJVertical/dotnet-apiport,Microsoft/dotnet-apiport
src/Microsoft.Fx.Portability/IObjectCache.cs
src/Microsoft.Fx.Portability/IObjectCache.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Threading.Tasks; namespace Microsoft.Fx.Portability { public interface IObjectCache : IDisposable { Task UpdateAsync(); DateTimeOffset LastUpdated { get; } } public interface IObjectCache<TObject> : IObjectCache { TObject Value { get; } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Threading.Tasks; namespace Microsoft.Fx.Portability { public interface IObjectCache<TObject> : IDisposable { TObject Value { get; } DateTimeOffset LastUpdated { get; } Task UpdateAsync(); } }
mit
C#
7598157cf6669b7e75272174f6a294fc069f2e85
use assembly full name in the InternalsVisibleTo attribute so that sign build will pass
herveyw/azure-sdk-for-net,jamestao/azure-sdk-for-net,AuxMon/azure-sdk-for-net,kagamsft/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,mabsimms/azure-sdk-for-net,shipram/azure-sdk-for-net,xindzhan/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,ailn/azure-sdk-for-net,shipram/azure-sdk-for-net,mihymel/azure-sdk-for-net,samtoubia/azure-sdk-for-net,dominiqa/azure-sdk-for-net,pilor/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,peshen/azure-sdk-for-net,olydis/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,xindzhan/azure-sdk-for-net,amarzavery/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,btasdoven/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,oaastest/azure-sdk-for-net,r22016/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,scottrille/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,smithab/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,relmer/azure-sdk-for-net,cwickham3/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,nemanja88/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,shutchings/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,Nilambari/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,stankovski/azure-sdk-for-net,mabsimms/azure-sdk-for-net,ogail/azure-sdk-for-net,herveyw/azure-sdk-for-net,pomortaz/azure-sdk-for-net,jamestao/azure-sdk-for-net,hyonholee/azure-sdk-for-net,oburlacu/azure-sdk-for-net,jtlibing/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,pattipaka/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,lygasch/azure-sdk-for-net,begoldsm/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,samtoubia/azure-sdk-for-net,jtlibing/azure-sdk-for-net,akromm/azure-sdk-for-net,herveyw/azure-sdk-for-net,nacaspi/azure-sdk-for-net,kagamsft/azure-sdk-for-net,vladca/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jamestao/azure-sdk-for-net,pinwang81/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,oaastest/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,AzCiS/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,pankajsn/azure-sdk-for-net,ogail/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,bgold09/azure-sdk-for-net,shutchings/azure-sdk-for-net,pankajsn/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,nathannfan/azure-sdk-for-net,btasdoven/azure-sdk-for-net,jamestao/azure-sdk-for-net,AuxMon/azure-sdk-for-net,dominiqa/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,marcoippel/azure-sdk-for-net,djyou/azure-sdk-for-net,namratab/azure-sdk-for-net,markcowl/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,gubookgu/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,nemanja88/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,begoldsm/azure-sdk-for-net,pinwang81/azure-sdk-for-net,robertla/azure-sdk-for-net,yoreddy/azure-sdk-for-net,juvchan/azure-sdk-for-net,alextolp/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,atpham256/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,mihymel/azure-sdk-for-net,hovsepm/azure-sdk-for-net,peshen/azure-sdk-for-net,juvchan/azure-sdk-for-net,namratab/azure-sdk-for-net,pomortaz/azure-sdk-for-net,tpeplow/azure-sdk-for-net,makhdumi/azure-sdk-for-net,pattipaka/azure-sdk-for-net,AzCiS/azure-sdk-for-net,abhing/azure-sdk-for-net,atpham256/azure-sdk-for-net,Nilambari/azure-sdk-for-net,mabsimms/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,yoreddy/azure-sdk-for-net,kagamsft/azure-sdk-for-net,hyonholee/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,pilor/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,naveedaz/azure-sdk-for-net,smithab/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,btasdoven/azure-sdk-for-net,AzCiS/azure-sdk-for-net,tpeplow/azure-sdk-for-net,hyonholee/azure-sdk-for-net,bgold09/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,nemanja88/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,yoreddy/azure-sdk-for-net,dominiqa/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,hovsepm/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,pinwang81/azure-sdk-for-net,naveedaz/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,oburlacu/azure-sdk-for-net,dasha91/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,amarzavery/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,shuagarw/azure-sdk-for-net,guiling/azure-sdk-for-net,samtoubia/azure-sdk-for-net,bgold09/azure-sdk-for-net,zaevans/azure-sdk-for-net,amarzavery/azure-sdk-for-net,zaevans/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,abhing/azure-sdk-for-net,enavro/azure-sdk-for-net,lygasch/azure-sdk-for-net,dasha91/azure-sdk-for-net,Nilambari/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,olydis/azure-sdk-for-net,mihymel/azure-sdk-for-net,pilor/azure-sdk-for-net,ailn/azure-sdk-for-net,shutchings/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,peshen/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,relmer/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,ailn/azure-sdk-for-net,nathannfan/azure-sdk-for-net,vladca/azure-sdk-for-net,shipram/azure-sdk-for-net,gubookgu/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,oaastest/azure-sdk-for-net,djyou/azure-sdk-for-net,pomortaz/azure-sdk-for-net,vladca/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,dasha91/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,tpeplow/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,abhing/azure-sdk-for-net,pankajsn/azure-sdk-for-net,atpham256/azure-sdk-for-net,shuagarw/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,robertla/azure-sdk-for-net,pattipaka/azure-sdk-for-net,robertla/azure-sdk-for-net,alextolp/azure-sdk-for-net,stankovski/azure-sdk-for-net,rohmano/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,hovsepm/azure-sdk-for-net,jtlibing/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,smithab/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,olydis/azure-sdk-for-net,scottrille/azure-sdk-for-net,cwickham3/azure-sdk-for-net,enavro/azure-sdk-for-net,hyonholee/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,xindzhan/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,rohmano/azure-sdk-for-net,ogail/azure-sdk-for-net,shuagarw/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,rohmano/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,lygasch/azure-sdk-for-net,scottrille/azure-sdk-for-net,juvchan/azure-sdk-for-net,guiling/azure-sdk-for-net,djyou/azure-sdk-for-net,nacaspi/azure-sdk-for-net,enavro/azure-sdk-for-net,begoldsm/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,oburlacu/azure-sdk-for-net,r22016/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,makhdumi/azure-sdk-for-net,samtoubia/azure-sdk-for-net,cwickham3/azure-sdk-for-net,AuxMon/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,hyonholee/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,zaevans/azure-sdk-for-net,marcoippel/azure-sdk-for-net,nathannfan/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,gubookgu/azure-sdk-for-net,namratab/azure-sdk-for-net,akromm/azure-sdk-for-net,marcoippel/azure-sdk-for-net,akromm/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,relmer/azure-sdk-for-net,makhdumi/azure-sdk-for-net,guiling/azure-sdk-for-net,alextolp/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,r22016/azure-sdk-for-net,naveedaz/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net
src/Search/Search/Properties/AssemblyInfo.cs
src/Search/Search/Properties/AssemblyInfo.cs
// // Copyright (c) Microsoft. 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.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft Azure Search Library")] [assembly: AssemblyDescription("Makes it easy to develop a .NET application that uses Azure Search.")] [assembly: AssemblyVersion("0.9.0.0")] [assembly: AssemblyFileVersion("0.10.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] #if CODESIGN [assembly: InternalsVisibleTo("Search.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] #else [assembly: InternalsVisibleTo("Search.Tests")] #endif
// // Copyright (c) Microsoft. 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.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft Azure Search Library")] [assembly: AssemblyDescription("Makes it easy to develop a .NET application that uses Azure Search.")] [assembly: AssemblyVersion("0.9.0.0")] [assembly: AssemblyFileVersion("0.10.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] [assembly: InternalsVisibleTo("Search.Tests")]
apache-2.0
C#
deaa21e2df972da792d1e815a1a75d42b8726ef1
Update ConfigReader.cs
AnkRaiza/cordova-plugin-config-reader,AnkRaiza/cordova-plugin-config-reader,AnkRaiza/cordova-plugin-config-reader
src/wp8/ConfigReader.cs
src/wp8/ConfigReader.cs
using System; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using Microsoft.Phone.Controls; using System.Windows.Controls.Primitives; using System.Windows.Media; using Windows.Storage; using System.Diagnostics; using System.IO; using System.IO.IsolatedStorage; namespace WPCordovaClassLib.Cordova.Commands { public class ConfigReader : BaseCommand { public void get(string options) { string[] args = JSON.JsonHelper.Deserialize<string[]>(options); string preferenceName = args[0]; try { // Get the pref. IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings; string val = (string)appSettings[preferenceName]; DispatchCommandResult(new PluginResult(PluginResult.Status.OK, val)); } catch (Exception) { DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR), "error"); } } } }
using System; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using Microsoft.Phone.Controls; using System.Windows.Controls.Primitives; using System.Windows.Media; using Windows.Storage; using System.Diagnostics; using System.IO; namespace WPCordovaClassLib.Cordova.Commands { public class ConfigReader : BaseCommand { public void get(string options) { string[] args = JSON.JsonHelper.Deserialize<string[]>(options); string preferenceName = args[0]; try { // Get the pref. IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings; string val = (string)appSettings[preferenceName]; DispatchCommandResult(new PluginResult(PluginResult.Status.OK, val)); } catch (Exception) { DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR), "error"); } } } }
mit
C#
0bba686136ab614f4ab9be822bd572b98b248584
Clean up RequestReader
murador/xsp,stormleoxia/xsp,stormleoxia/xsp,murador/xsp,murador/xsp,stormleoxia/xsp,stormleoxia/xsp,arthot/xsp,arthot/xsp,murador/xsp,arthot/xsp,arthot/xsp
src/Mono.WebServer.Apache/RequestReader.cs
src/Mono.WebServer.Apache/RequestReader.cs
// // RequestReader.cs // // Authors: // Daniel Lopez Ridruejo // Gonzalo Paniagua Javier // // Copyright (c) 2002 Daniel Lopez Ridruejo. // (c) 2002,2003 Ximian, Inc. // All rights reserved. // (C) Copyright 2004-2008 Novell, Inc. (http://www.novell.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 System.Net.Sockets; namespace Mono.WebServer { public class RequestReader { public ModMonoRequest Request { get; private set; } public RequestReader (Socket client) { Request = new ModMonoRequest (client); } public string GetUriPath () { string path = Request.GetUri (); int dot = path.LastIndexOf ('.'); int slash = (dot != -1) ? path.IndexOf ('/', dot) : 0; if (dot > 0 && slash > 0) path = path.Substring (0, slash); return path; } public string GetPhysicalPath () { return Request.GetPhysicalPath (); } public void Decline () { Request.Decline (); } public void NotFound () { Request.NotFound (); } public bool ShuttingDown { get { return Request.ShuttingDown; } } } }
// // RequestReader.cs // // Authors: // Daniel Lopez Ridruejo // Gonzalo Paniagua Javier // // Copyright (c) 2002 Daniel Lopez Ridruejo. // (c) 2002,2003 Ximian, Inc. // All rights reserved. // (C) Copyright 2004-2008 Novell, Inc. (http://www.novell.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 System; using System.Web; using System.Collections; using System.Configuration; using System.Globalization; using System.IO; using System.Net.Sockets; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Mono.Security.X509; using Mono.Security.X509.Extensions; namespace Mono.WebServer { public class RequestReader { ModMonoRequest request; public ModMonoRequest Request { get { return request; } } public RequestReader (Socket client) { this.request = new ModMonoRequest (client); } public string GetUriPath () { string path = request.GetUri (); int dot = path.LastIndexOf ('.'); int slash = (dot != -1) ? path.IndexOf ('/', dot) : 0; if (dot > 0 && slash > 0) path = path.Substring (0, slash); return path; } public string GetPhysicalPath () { return request.GetPhysicalPath (); } public void Decline () { request.Decline (); } public void NotFound () { request.NotFound (); } public bool ShuttingDown { get { return request.ShuttingDown; } } } }
mit
C#
a24960b35bbd3ced6fd5517f02782a1213d58465
Remove unused search
feliwir/openSage,feliwir/openSage
src/OpenSage.Game/Navigation/Navigation.cs
src/OpenSage.Game/Navigation/Navigation.cs
using System; using System.Collections.Generic; using System.Text; using OpenSage.Data.Map; namespace OpenSage.Navigation { class Navigation { Graph _graph; public Navigation(BlendTileData tileData) { var width = tileData.Impassability.GetLength(0); var height = tileData.Impassability.GetLength(1); _graph = new Graph(width, height); for (int x = 0; x < _graph.Width; x++) { for (int y = 0; y < _graph.Height; y++) { bool passable = tileData.Impassability[x, y]; _graph.GetNode(x, y).Passability = passable ? Passability.Passable : Passability.Impassable; } } } } }
using System; using System.Collections.Generic; using System.Text; using OpenSage.Data.Map; namespace OpenSage.Navigation { class Navigation { Graph _graph; public Navigation(BlendTileData tileData) { var width = tileData.Impassability.GetLength(0); var height = tileData.Impassability.GetLength(1); _graph = new Graph(width, height); for (int x = 0; x < _graph.Width; x++) { for (int y = 0; y < _graph.Height; y++) { bool passable = tileData.Impassability[x, y]; _graph.GetNode(x, y).Passability = passable ? Passability.Passable : Passability.Impassable; } } var route = _graph.Search(_graph.GetNode(5, 5), _graph.GetNode(20, 20)); } } }
mit
C#
9c674b9c8a350b6551dc28e038b6735fcb2a98a9
add XML document to TheoremAttribute.
jwChung/Experimentalism,jwChung/Experimentalism
src/Experimental/TheoremAttribute.cs
src/Experimental/TheoremAttribute.cs
using Xunit; namespace Jwc.Experimental { /// <summary> /// 테스트 메소드를 가리키기 위한 어트리뷰트이며, test runner에 의해 실행된다. /// </summary> public class TheoremAttribute : FactAttribute { } }
using Xunit; namespace Jwc.Experimental { public class TheoremAttribute : FactAttribute { } }
mit
C#
1c7d65d304de1b09687254b1f27e0b9301fa1d64
Update Arg.cs
ipjohnson/Grace
src/Grace/DependencyInjection/Arg.cs
src/Grace/DependencyInjection/Arg.cs
namespace Grace.DependencyInjection { /// <summary> /// Arg helper /// </summary> public class Arg { /// <summary> /// Any arguement of type T /// </summary> /// <typeparam name="T">type of arg</typeparam> /// <returns>default T value</returns> public static T Any<T>() { return default(T); } } }
namespace Grace.DependencyInjection { /// <summary> /// Arg helper /// </summary> public class Arg { /// <summary> /// Any arguement of type T /// </summary> /// <typeparam name="T">type of arg</typeparam> /// <returns>default T value</returns> public static T Any<T>() { return default(T); } } }
mit
C#
f6a08725130ae69405e2ed86bc4a7e493704509d
Fix ordering issue
terrajobst/nquery-vnext
src/NQuery/Optimization/Optimizer.cs
src/NQuery/Optimization/Optimizer.cs
using System.Collections.Generic; using NQuery.Binding; namespace NQuery.Optimization { internal static class Optimizer { public static BoundQuery Optimize(BoundQuery query) { var optmizedRelation = Optimize(query.Relation); return new BoundQuery(optmizedRelation, query.OutputColumns); } private static BoundRelation Optimize(BoundRelation relation) { foreach (var step in GetOptimizationSteps()) relation = step.RewriteRelation(relation); return relation; } public static IEnumerable<BoundTreeRewriter> GetOptimizationSteps() { // TODO: This shouldn't be necessary yield return new DerivedTableRemover(); // Instantiate CTEs yield return new CommonTableExpressionInstantiator(); // Expand full outer joins yield return new FullOuterJoinExpander(); // Remove unused values yield return new UnusedValueSlotRemover(); // Expand subqueries yield return new SubqueryExpander(); // TODO: semi join simplification // TODO: decorrelation yield return new OuterJoinRemover(); // selection pushing yield return new SelectionPusher(); // join linearization yield return new JoinLinearizer(); // TODO: outer join reordering // TODO: join order optimization yield return new JoinOrderer(); // after the join ordering, we need to push selections again yield return new SelectionPusher(); // TODO: at most one row reordering // TODO: push computations // physical op choosing yield return new HashMatchPhysicalOperatorChooser(); yield return new AggregationPhysicalOperatorChooser(); yield return new ConcatenationPhysicalOperatorChooser(); // TODO: null scan optimization } } }
using System.Collections.Generic; using NQuery.Binding; namespace NQuery.Optimization { internal static class Optimizer { public static BoundQuery Optimize(BoundQuery query) { var optmizedRelation = Optimize(query.Relation); return new BoundQuery(optmizedRelation, query.OutputColumns); } private static BoundRelation Optimize(BoundRelation relation) { foreach (var step in GetOptimizationSteps()) relation = step.RewriteRelation(relation); return relation; } public static IEnumerable<BoundTreeRewriter> GetOptimizationSteps() { // TODO: This shouldn't be necessary yield return new DerivedTableRemover(); // Instantiate CTEs yield return new CommonTableExpressionInstantiator(); // Remove unused values yield return new UnusedValueSlotRemover(); // Expand full outer joins yield return new FullOuterJoinExpander(); // Expand subqueries yield return new SubqueryExpander(); // TODO: semi join simplification // TODO: decorrelation yield return new OuterJoinRemover(); // selection pushing yield return new SelectionPusher(); // join linearization yield return new JoinLinearizer(); // TODO: outer join reordering // TODO: join order optimization yield return new JoinOrderer(); // after the join ordering, we need to push selections again yield return new SelectionPusher(); // TODO: at most one row reordering // TODO: push computations // physical op choosing yield return new HashMatchPhysicalOperatorChooser(); yield return new AggregationPhysicalOperatorChooser(); yield return new ConcatenationPhysicalOperatorChooser(); // TODO: null scan optimization } } }
mit
C#
2a4fc59f22b237f06532609f1af6d5dfb8dfcba5
Correct KB to KiB, etc
canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor
src/SyncTrayzor/Utils/FormatUtils.cs
src/SyncTrayzor/Utils/FormatUtils.cs
using SyncTrayzor.Localization; using SyncTrayzor.Properties.Strings; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SyncTrayzor.Utils { public static class FormatUtils { private static readonly string[] sizes = { "B", "KiB", "MiB", "GiB" }; public static string BytesToHuman(double bytes, int decimalPlaces = 0) { // http://stackoverflow.com/a/281679/1086121 int order = 0; while (bytes >= 1024 && order + 1 < sizes.Length) { order++; bytes = bytes / 1024; } var placesFmtString = new String('0', decimalPlaces); return String.Format("{0:0." + placesFmtString + "}{1}", bytes, sizes[order]); } public static string TimeSpanToTimeAgo(TimeSpan timeSpan) { if (timeSpan.TotalDays > 365) { int years = (int)Math.Ceiling((float)timeSpan.Days / 365); return Localizer.F(Resources.TimeAgo_Years, years); } if (timeSpan.TotalDays > 1.0) return Localizer.F(Resources.TimeAgo_Days, (int)timeSpan.TotalDays); if (timeSpan.TotalHours > 1.0) return Localizer.F(Resources.TimeAgo_Hours, (int)timeSpan.TotalHours); if (timeSpan.TotalMinutes > 1.0) return Localizer.F(Resources.TimeAgo_Minutes, (int)timeSpan.TotalMinutes); return Resources.TimeAgo_JustNow; } } }
using SyncTrayzor.Localization; using SyncTrayzor.Properties.Strings; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SyncTrayzor.Utils { public static class FormatUtils { private static readonly string[] sizes = { "B", "KB", "MB", "GB" }; public static string BytesToHuman(double bytes, int decimalPlaces = 0) { // http://stackoverflow.com/a/281679/1086121 int order = 0; while (bytes >= 1024 && order + 1 < sizes.Length) { order++; bytes = bytes / 1024; } var placesFmtString = new String('0', decimalPlaces); return String.Format("{0:0." + placesFmtString + "}{1}", bytes, sizes[order]); } public static string TimeSpanToTimeAgo(TimeSpan timeSpan) { if (timeSpan.TotalDays > 365) { int years = (int)Math.Ceiling((float)timeSpan.Days / 365); return Localizer.F(Resources.TimeAgo_Years, years); } if (timeSpan.TotalDays > 1.0) return Localizer.F(Resources.TimeAgo_Days, (int)timeSpan.TotalDays); if (timeSpan.TotalHours > 1.0) return Localizer.F(Resources.TimeAgo_Hours, (int)timeSpan.TotalHours); if (timeSpan.TotalMinutes > 1.0) return Localizer.F(Resources.TimeAgo_Minutes, (int)timeSpan.TotalMinutes); return Resources.TimeAgo_JustNow; } } }
mit
C#
06380095b46bc20463cf39d59e15fd5f69850a51
Remove forward slashes from paths. (#323)
kubernetes-client/csharp,kubernetes-client/csharp
src/KubernetesClient/KubernetesClientConfiguration.InCluster.cs
src/KubernetesClient/KubernetesClientConfiguration.InCluster.cs
using System; using System.IO; using k8s.Exceptions; namespace k8s { public partial class KubernetesClientConfiguration { private static string ServiceAccountPath = Path.Combine(new string[] { "var", "run", "secrets", "kubernetes.io", "serviceaccount/" }); private const string ServiceAccountTokenKeyFileName = "token"; private const string ServiceAccountRootCAKeyFileName = "ca.crt"; public static Boolean IsInCluster() { var host = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_HOST"); var port = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_PORT"); if (string.IsNullOrWhiteSpace(host) || string.IsNullOrWhiteSpace(port)) { return false; } var tokenPath = Path.Combine(ServiceAccountPath, ServiceAccountTokenKeyFileName); if (!File.Exists(tokenPath)) { return false; } var certPath = Path.Combine(ServiceAccountPath, ServiceAccountRootCAKeyFileName); return File.Exists(certPath); } public static KubernetesClientConfiguration InClusterConfig() { if (!IsInCluster()) { throw new KubeConfigException( "unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined"); } var token = File.ReadAllText(Path.Combine(ServiceAccountPath, ServiceAccountTokenKeyFileName)); var rootCAFile = Path.Combine(ServiceAccountPath, ServiceAccountRootCAKeyFileName); var host = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_HOST"); var port = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_PORT"); return new KubernetesClientConfiguration { Host = new UriBuilder("https", host, Convert.ToInt32(port)).ToString(), AccessToken = token, SslCaCerts = CertUtils.LoadPemFileCert(rootCAFile) }; } } }
using System; using System.IO; using k8s.Exceptions; namespace k8s { public partial class KubernetesClientConfiguration { private const string ServiceAccountPath = "/var/run/secrets/kubernetes.io/serviceaccount/"; private const string ServiceAccountTokenKeyFileName = "token"; private const string ServiceAccountRootCAKeyFileName = "ca.crt"; public static Boolean IsInCluster() { var host = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_HOST"); var port = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_PORT"); if (string.IsNullOrWhiteSpace(host) || string.IsNullOrWhiteSpace(port)) { return false; } var tokenPath = Path.Combine(ServiceAccountPath, ServiceAccountTokenKeyFileName); if (!File.Exists(tokenPath)) { return false; } var certPath = Path.Combine(ServiceAccountPath, ServiceAccountRootCAKeyFileName); return File.Exists(certPath); } public static KubernetesClientConfiguration InClusterConfig() { if (!IsInCluster()) { throw new KubeConfigException( "unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined"); } var token = File.ReadAllText(Path.Combine(ServiceAccountPath, ServiceAccountTokenKeyFileName)); var rootCAFile = Path.Combine(ServiceAccountPath, ServiceAccountRootCAKeyFileName); var host = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_HOST"); var port = Environment.GetEnvironmentVariable("KUBERNETES_SERVICE_PORT"); return new KubernetesClientConfiguration { Host = new UriBuilder("https", host, Convert.ToInt32(port)).ToString(), AccessToken = token, SslCaCerts = CertUtils.LoadPemFileCert(rootCAFile) }; } } }
apache-2.0
C#
de3097e142b2e0959cfe269f9dc6bd29cffb6d58
update Logging/MicrosoftLoggingLoggerExtensions.cs namespace
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
src/WeihanLi.Common/Logging/MicrosoftLoggingLoggerExtensions.cs
src/WeihanLi.Common/Logging/MicrosoftLoggingLoggerExtensions.cs
using System; namespace Microsoft.Extensions.Logging { public static class LoggerExtensions { #region Info public static void Info(this ILogger logger, string msg, params object[] parameters) => logger.LogInformation(msg, parameters); public static void Info(this ILogger logger, Exception ex, string msg) => logger.LogInformation(ex, msg); #endregion Info #region Trace public static void Trace(this ILogger logger, string msg, params object[] parameters) => logger.LogTrace(msg, parameters); public static void Trace(this ILogger logger, Exception ex, string msg) => logger.LogTrace(ex, msg); public static void Trace(this ILogger logger, Exception ex) => logger.LogTrace(ex, ex?.Message); #endregion Trace #region Debug public static void Debug(this ILogger logger, string msg, params object[] parameters) => logger.LogDebug(msg, parameters); public static void Debug(this ILogger logger, Exception ex, string msg) => logger.LogDebug(ex, msg); public static void Debug(this ILogger logger, Exception ex) => logger.LogDebug(ex, ex?.Message); #endregion Debug #region Warn public static void Warn(this ILogger logger, string msg, params object[] parameters) => logger.LogWarning(msg, parameters); public static void Warn(this ILogger logger, Exception ex, string msg) => logger.LogWarning(ex, msg); public static void Warn(this ILogger logger, Exception ex) => logger.LogWarning(ex, ex?.Message); #endregion Warn #region Error public static void Error(this ILogger logger, string msg, params object[] parameters) => logger.LogError(msg, parameters); public static void Error(this ILogger logger, Exception ex, string msg) => logger.LogError(ex, msg); public static void Error(this ILogger logger, Exception ex) => logger.LogError(ex, ex?.Message); #endregion Error #region Fatal public static void Fatal(this ILogger logger, string msg, params object[] parameters) => logger.LogCritical(msg, parameters); public static void Fatal(this ILogger logger, Exception ex, string msg) => logger.LogCritical(ex, msg); public static void Fatal(this ILogger logger, Exception ex) => logger.LogCritical(ex, ex?.Message); #endregion Fatal } }
using System; using Microsoft.Extensions.Logging; namespace WeihanLi.Common.Logging { public static class LoggerExtensions { #region Info public static void Info(this ILogger logger, string msg, params object[] parameters) => logger.LogInformation(msg, parameters); public static void Info(this ILogger logger, Exception ex, string msg) => logger.LogInformation(ex, msg); #endregion Info #region Trace public static void Trace(this ILogger logger, string msg, params object[] parameters) => logger.LogTrace(msg, parameters); public static void Trace(this ILogger logger, Exception ex, string msg) => logger.LogTrace(ex, msg); public static void Trace(this ILogger logger, Exception ex) => logger.LogTrace(ex, ex?.Message); #endregion Trace #region Debug public static void Debug(this ILogger logger, string msg, params object[] parameters) => logger.LogDebug(msg, parameters); public static void Debug(this ILogger logger, Exception ex, string msg) => logger.LogDebug(ex, msg); public static void Debug(this ILogger logger, Exception ex) => logger.LogDebug(ex, ex?.Message); #endregion Debug #region Warn public static void Warn(this ILogger logger, string msg, params object[] parameters) => logger.LogWarning(msg, parameters); public static void Warn(this ILogger logger, Exception ex, string msg) => logger.LogWarning(ex, msg); public static void Warn(this ILogger logger, Exception ex) => logger.LogWarning(ex, ex?.Message); #endregion Warn #region Error public static void Error(this ILogger logger, string msg, params object[] parameters) => logger.LogError(msg, parameters); public static void Error(this ILogger logger, Exception ex, string msg) => logger.LogError(ex, msg); public static void Error(this ILogger logger, Exception ex) => logger.LogError(ex, ex?.Message); #endregion Error #region Fatal public static void Fatal(this ILogger logger, string msg, params object[] parameters) => logger.LogCritical(msg, parameters); public static void Fatal(this ILogger logger, Exception ex, string msg) => logger.LogCritical(ex, msg); public static void Fatal(this ILogger logger, Exception ex) => logger.LogCritical(ex, ex?.Message); #endregion Fatal } }
mit
C#
75623f73d1fd635ddace9d36ee28eeabe6030531
Fix GC KeepAlive test
cshung/coreclr,krk/coreclr,krk/coreclr,poizan42/coreclr,mmitche/coreclr,wtgodbe/coreclr,cshung/coreclr,poizan42/coreclr,krk/coreclr,krk/coreclr,cshung/coreclr,poizan42/coreclr,mmitche/coreclr,wtgodbe/coreclr,krk/coreclr,wtgodbe/coreclr,cshung/coreclr,poizan42/coreclr,cshung/coreclr,mmitche/coreclr,mmitche/coreclr,wtgodbe/coreclr,mmitche/coreclr,krk/coreclr,poizan42/coreclr,cshung/coreclr,wtgodbe/coreclr,mmitche/coreclr,poizan42/coreclr,wtgodbe/coreclr
tests/src/GC/API/GC/KeepAlive.cs
tests/src/GC/API/GC/KeepAlive.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. /* * Tests GC.KeepAlive(obj), where obj is the Object reference whose * finalizer you don't want called until after the call to KeepAlive. * * Changes: * -Added Dummy2 object whose finalizer should get called for comparison * * Notes: * - passes with complus_jitminops set* * - passes with complus_gcstress = 0,1,2,3,4 * - passes in debug mode */ using System; using System.Runtime.CompilerServices; public class Test { public static bool visited1 = false; public static bool visited2 = false; public class Dummy { ~Dummy() { // this finalizer should not get called until after // the call to GC.KeepAlive(obj) Console.WriteLine("In Finalize() of Dummy"); visited1 = true; } } public class Dummy2 { ~Dummy2() { // this finalizer should get called after // the call to GC.WaitForPendingFinalizers() Console.WriteLine("In Finalize() of Dummy2"); visited2 = true; } } [MethodImplAttribute(MethodImplOptions.NoInlining)] public static void RunTest2() { Dummy2 obj2 = new Dummy2(); obj2 = null; } public static bool RunTest() { bool success = false; Dummy obj = new Dummy(); RunTest2(); // *uncomment the for loop to make test fail with complus_jitminops set // by design as per briansul //for (int i=0; i<5; i++) { GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); //} success = (visited1 == false) && (visited2 == true); GC.KeepAlive(obj); // will keep obj alive until this point return success; } public static int Main() { bool success = RunTest(); if (success) { Console.WriteLine("Test for KeepAlive() passed!"); return 100; } else { Console.WriteLine("Test for KeepAlive() failed!"); return 1; } } }
// 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. /* * Tests GC.KeepAlive(obj), where obj is the Object reference whose * finalizer you don't want called until after the call to KeepAlive. * * Changes: * -Added Dummy2 object whose finalizer should get called for comparison * * Notes: * - passes with complus_jitminops set* * - passes with complus_gcstress = 0,1,2,3,4 * - passes in debug mode */ using System; using System.Runtime.CompilerServices; public class Test { public static bool visited1 = false; public static bool visited2 = false; public class Dummy { ~Dummy() { // this finalizer should not get called until after // the call to GC.KeepAlive(obj) Console.WriteLine("In Finalize() of Dummy"); visited1 = true; } } public class Dummy2 { ~Dummy2() { // this finalizer should get called after // the call to GC.WaitForPendingFinalizers() Console.WriteLine("In Finalize() of Dummy2"); visited2 = true; } } [MethodImplAttribute(MethodImplOptions.NoInlining)] public static void RunTest2() { Dummy2 obj2 = new Dummy2(); obj2 = null; } public static void RunTest() { Dummy obj = new Dummy(); RunTest2(); // *uncomment the for loop to make test fail with complus_jitminops set // by design as per briansul //for (int i=0; i<5; i++) { GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); //} GC.KeepAlive(obj); // will keep obj alive until this point } public static int Main() { RunTest(); if ((visited1 == false) && (visited2 == true)) { Console.WriteLine("Test for KeepAlive() passed!"); return 100; } else { Console.WriteLine("Test for KeepAlive() failed!"); return 1; } } }
mit
C#
2848c7ae60892f43f61d633d2b61a54027a45ed1
Revert unnecessary change
peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework
osu.Framework.Tests/Visual/Audio/TestSceneLoopingSample.cs
osu.Framework.Tests/Visual/Audio/TestSceneLoopingSample.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; namespace osu.Framework.Tests.Visual.Audio { public class TestSceneLoopingSample : FrameworkTestScene { private SampleChannel sampleChannel; private ISampleStore samples; [BackgroundDependencyLoader] private void load(ISampleStore samples) { this.samples = samples; } [Test] public void TestLoopingToggle() { AddStep("create sample", createSample); AddAssert("not looping", () => !sampleChannel.Looping); AddStep("enable looping", () => sampleChannel.Looping = true); AddStep("play sample", () => sampleChannel.Play()); AddUntilStep("is playing", () => sampleChannel.Playing); AddWaitStep("wait", 10); AddAssert("is still playing", () => sampleChannel.Playing); AddStep("disable looping", () => sampleChannel.Looping = false); AddUntilStep("ensure stops", () => !sampleChannel.Playing); } [Test] public void TestStopWhileLooping() { AddStep("create sample", createSample); AddStep("enable looping", () => sampleChannel.Looping = true); AddStep("play sample", () => sampleChannel.Play()); AddWaitStep("wait", 10); AddAssert("is playing", () => sampleChannel.Playing); AddStep("stop playing", () => sampleChannel.Stop()); AddUntilStep("not playing", () => !sampleChannel.Playing); } private void createSample() { sampleChannel?.Dispose(); sampleChannel = samples.Get("tone.wav"); // reduce volume of the tone due to how loud it normally is. if (sampleChannel != null) sampleChannel.Volume.Value = 0.05; } protected override void Dispose(bool isDisposing) { sampleChannel?.Dispose(); base.Dispose(isDisposing); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; namespace osu.Framework.Tests.Visual.Audio { public class TestSceneLoopingSample : FrameworkTestScene { private SampleChannel sampleChannel; private ISampleStore samples; [BackgroundDependencyLoader] private void load(ISampleStore samples) { this.samples = samples; } [Test] public void TestLoopingToggle() { AddStep("create sample", createSample); AddAssert("not looping", () => !sampleChannel.Looping); AddStep("enable looping", () => sampleChannel.Looping = true); AddStep("play sample", () => sampleChannel.Play()); AddUntilStep("is playing", () => sampleChannel.Playing); AddWaitStep("wait", 10); AddAssert("is still playing", () => sampleChannel.Playing); AddStep("disable looping", () => sampleChannel.Looping = false); AddUntilStep("ensure stops", () => !sampleChannel.Playing); } [Test] public void TestStopWhileLooping() { AddStep("create sample", createSample); AddStep("enable looping", () => sampleChannel.Looping = true); AddStep("pl ay sample", () => sampleChannel.Play()); AddWaitStep("wait", 10); AddAssert("is playing", () => sampleChannel.Playing); AddStep("stop playing", () => sampleChannel.Stop()); AddUntilStep("not playing", () => !sampleChannel.Playing); } private void createSample() { sampleChannel?.Dispose(); sampleChannel = samples.Get("tone.wav"); // reduce volume of the tone due to how loud it normally is. if (sampleChannel != null) sampleChannel.Volume.Value = 0.05; } protected override void Dispose(bool isDisposing) { sampleChannel?.Dispose(); base.Dispose(isDisposing); } } }
mit
C#
cffe34562c9a8eecf5a97af6cd1adac9614044cb
add win check in Grid
svmnotn/friendly-guacamole
Assets/src/data/Grid.cs
Assets/src/data/Grid.cs
public class Grid { Cell[,] grid; public Grid() { this.grid = new Cell[,] { {Cell.def, Cell.def, Cell.def}, {Cell.def, Cell.def, Cell.def}, {Cell.def, Cell.def, Cell.def} }; } public Grid(Cell[,] grid) { this.grid = grid; } public bool Play(Vector pos, Player p) { if (grid [pos.x, pos.y].played) { return false; } grid [pos.x, pos.y] = new Cell(p); return true; } public Cell GetCell(Vector pos) { return grid [pos.x, pos.y]; } public string TypeAt(Vector pos){ var cell = GetCell (pos); if (!cell.played) { return ""; } return cell.player.type; } public bool Played(Vector pos){ return GetCell (pos).played; } public Winner Check(Vector pos) { return new Winner(); } }
public class Grid { Cell[,] grid = { {Cell.def, Cell.def, Cell.def}, {Cell.def, Cell.def, Cell.def}, {Cell.def, Cell.def, Cell.def} }; public bool play(Vector pos, Player p) { if (grid [pos.x, pos.y].played) { return false; } grid [pos.x, pos.y] = new Cell(p.type); return true; } public Cell cell(Vector pos) { return grid [pos.x, pos.y]; } }
mit
C#
7bf74093cddf42f6bfc99d9df79f4193378e517e
Enable the default files when ASP.NET Core is serving the static content.
daxnet/apworks-examples,daxnet/apworks-examples,daxnet/apworks-examples,daxnet/apworks-examples
src/TaskList/Startup.cs
src/TaskList/Startup.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Apworks.Integration.AspNetCore; using Apworks.Integration.AspNetCore.Configuration; using Apworks.Repositories.MongoDB; namespace Apworks.Examples.TaskList { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); var mongoServer = this.Configuration["mongo:server"]; var mongoPort = Convert.ToInt32(this.Configuration["mongo:port"]); var mongoDatabase = this.Configuration["mongo:db"]; services.AddApworks() .WithDataServiceSupport( new DataServiceConfigurationOptions( new MongoRepositoryContext( new MongoRepositorySettings(mongoServer, mongoPort, mongoDatabase)))) .Configure(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseDefaultFiles(); app.UseStaticFiles(); app.EnrichDataServiceExceptionResponse(); app.UseCors(builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseMvc(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Apworks.Integration.AspNetCore; using Apworks.Integration.AspNetCore.Configuration; using Apworks.Repositories.MongoDB; namespace Apworks.Examples.TaskList { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); var mongoServer = this.Configuration["mongo:server"]; var mongoPort = Convert.ToInt32(this.Configuration["mongo:port"]); var mongoDatabase = this.Configuration["mongo:db"]; services.AddApworks() .WithDataServiceSupport( new DataServiceConfigurationOptions( new MongoRepositoryContext( new MongoRepositorySettings(mongoServer, mongoPort, mongoDatabase)))) .Configure(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseStaticFiles(); app.EnrichDataServiceExceptionResponse(); app.UseCors(builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseMvc(); } } }
apache-2.0
C#
abf9e85f3f0e7eaa318c18b9b0d768a63707aa2f
Add Mouse Look Tracking to player character
JasonMiletta/LDJam-39---Out-of-Power
Assets/PlayerMovement.cs
Assets/PlayerMovement.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float movementSpeed = 1.0f; private bool isMovementLocked = false; // Use this for initialization void Start () { } // Update is called once per frame void Update () { look(); if (isMovementLocked) { movement(); } } private void look() { var ray = Camera.main.ScreenToWorldPoint(Input.mousePosition); Debug.DrawRay(Camera.main.transform.position, ray, Color.yellow); transform.LookAt(ray, new Vector3(0, 0, -1)); transform.eulerAngles = new Vector3(0, transform.eulerAngles.y, 0); } private void movement() { var x = Input.GetAxis("Horizontal") * Time.deltaTime * movementSpeed; var z = Input.GetAxis("Vertical") * Time.deltaTime * movementSpeed; transform.Translate(x, 0, z, Space.World); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float movementSpeed = 1.0f; // Use this for initialization void Start () { } // Update is called once per frame void Update () { var x = Input.GetAxis("Horizontal") * Time.deltaTime * movementSpeed; var z = Input.GetAxis("Vertical") * Time.deltaTime * movementSpeed; transform.Translate(x, 0, z); } }
cc0-1.0
C#
dd6723948b8127103ea991f1febd8278f9235b8b
Remove dead code
rsdn/nitra,JetBrains/Nitra,JetBrains/Nitra,rsdn/nitra
Nitra.Visualizer/MainWindow.xaml.Highlighting.cs
Nitra.Visualizer/MainWindow.xaml.Highlighting.cs
using ICSharpCode.AvalonEdit.Highlighting; using Nitra.ClientServer.Messages; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; namespace Nitra.Visualizer { public partial class MainWindow { readonly Dictionary<int, HighlightingColor> _highlightingStyles = new Dictionary<int, HighlightingColor>(); ImmutableArray<SpanInfo> _spanInfos = ImmutableArray<SpanInfo>.Empty; private void textBox1_HighlightLine(object sender, HighlightLineEventArgs e) { try { var line = e.Line; var spans = _spanInfos; foreach (var span in spans) { var start = line.Offset; var end = line.Offset + line.Length; if (start > span.Span.EndPos || end < span.Span.StartPos) continue; var spanClassId = span.SpanClassId; var color = _highlightingStyles[spanClassId]; var startOffset = Math.Max(line.Offset, span.Span.StartPos); var endOffset = Math.Min(line.EndOffset, span.Span.EndPos); var section = new HighlightedSection { Offset = startOffset, Length = endOffset - startOffset, Color = color }; e.Sections.Add(section); } } catch (Exception ex) { Debug.WriteLine(ex.GetType().Name + ":" + ex.Message); } } private void UpdateSpanInfos(ServerMessage.KeywordHighlightingCreated keywordHighlighting) { _spanInfos = keywordHighlighting.spanInfos; _text.TextArea.TextView.Redraw(); } private void UpdateHighlightingStyles(ServerMessage.LanguageLoaded languageInfo) { foreach (var spanClassInfo in languageInfo.spanClassInfos) _highlightingStyles[spanClassInfo.Id] = new HighlightingColor { Foreground = new SimpleHighlightingBrush(ColorFromArgb(spanClassInfo.ForegroundColor)) }; } private void ResetHighlightingStyles() { _highlightingStyles.Clear(); } } }
using ICSharpCode.AvalonEdit.Highlighting; using Nitra.ClientServer.Messages; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; namespace Nitra.Visualizer { public partial class MainWindow { readonly Dictionary<int, HighlightingColor> _highlightingStyles = new Dictionary<int, HighlightingColor>(); ImmutableArray<SpanInfo> _spanInfos = ImmutableArray<SpanInfo>.Empty; private void textBox1_HighlightLine(object sender, HighlightLineEventArgs e) { try { var line = e.Line; var spans = _spanInfos; foreach (var span in spans) { var start = line.Offset; var end = line.Offset + line.Length; if (start > span.Span.EndPos || end < span.Span.StartPos) continue; var spanClassId = span.SpanClassId; var color = _highlightingStyles[spanClassId]; var startOffset = Math.Max(line.Offset, span.Span.StartPos); var endOffset = Math.Min(line.EndOffset, span.Span.EndPos); var section = new HighlightedSection { Offset = startOffset, Length = endOffset - startOffset, Color = color }; e.Sections.Add(section); } } catch (Exception ex) { Debug.WriteLine(ex.GetType().Name + ":" + ex.Message); } } private void UpdateSpanInfos(ServerMessage.KeywordHighlightingCreated keywordHighlighting) { if (keywordHighlighting.Version != _textVersion) return; _spanInfos = keywordHighlighting.spanInfos; _text.TextArea.TextView.Redraw(); } private void UpdateHighlightingStyles(ServerMessage.LanguageLoaded languageInfo) { foreach (var spanClassInfo in languageInfo.spanClassInfos) _highlightingStyles[spanClassInfo.Id] = new HighlightingColor { Foreground = new SimpleHighlightingBrush(ColorFromArgb(spanClassInfo.ForegroundColor)) }; } private void ResetHighlightingStyles() { _highlightingStyles.Clear(); } } }
apache-2.0
C#
7f64012cfc022c82fd12605dd65ea06a02112c16
Remove seek
NeoAdonis/osu,ppy/osu,peppy/osu,2yangk23/osu,peppy/osu,ppy/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,2yangk23/osu,smoogipoo/osu,smoogipooo/osu,EVAST9919/osu,johnneijzen/osu,NeoAdonis/osu,johnneijzen/osu,peppy/osu-new,UselessToucan/osu,EVAST9919/osu,smoogipoo/osu
osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs
osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Rulesets.Osu; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestSceneNowPlayingOverlay : OsuTestScene { [Cached] private MusicController musicController = new MusicController(); private WorkingBeatmap currentBeatmap; private NowPlayingOverlay nowPlayingOverlay; [BackgroundDependencyLoader] private void load() { Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); nowPlayingOverlay = new NowPlayingOverlay { Origin = Anchor.Centre, Anchor = Anchor.Centre }; Add(musicController); Add(nowPlayingOverlay); } [Test] public void TestShowHideDisable() { AddStep(@"show", () => nowPlayingOverlay.Show()); AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state); AddStep(@"hide", () => nowPlayingOverlay.Hide()); } [Test] public void TestPrevTrackBehavior() { AddStep(@"Play track", () => { musicController.NextTrack(); currentBeatmap = Beatmap.Value; }); AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000)); AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000); AddAssert(@"Check action is restart track", () => musicController.PreviousTrack() == PreviousTrackResult.Restart); AddAssert(@"Check track didn't change", () => currentBeatmap == Beatmap.Value); AddAssert(@"Check action is not restart", () => musicController.PreviousTrack() != PreviousTrackResult.Restart); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Rulesets.Osu; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestSceneNowPlayingOverlay : OsuTestScene { [Cached] private MusicController musicController = new MusicController(); private WorkingBeatmap currentBeatmap; private NowPlayingOverlay nowPlayingOverlay; [BackgroundDependencyLoader] private void load() { Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); nowPlayingOverlay = new NowPlayingOverlay { Origin = Anchor.Centre, Anchor = Anchor.Centre }; Add(musicController); Add(nowPlayingOverlay); } [Test] public void TestShowHideDisable() { AddStep(@"show", () => nowPlayingOverlay.Show()); AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state); AddStep(@"hide", () => nowPlayingOverlay.Hide()); } [Test] public void TestPrevTrackBehavior() { AddStep(@"Play track", () => { musicController.NextTrack(); currentBeatmap = Beatmap.Value; }); AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000)); AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000); AddAssert(@"Check action is restart track", () => musicController.PreviousTrack() == PreviousTrackResult.Restart); AddAssert(@"Check track didn't change", () => currentBeatmap == Beatmap.Value); AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000)); AddAssert(@"Check action is not restart", () => musicController.PreviousTrack() != PreviousTrackResult.Restart); } } }
mit
C#
2960800f2a705b75f97865012489f69fa9729ba2
Use TitleSuffix then grouping positions
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
R7.University/entities/OccupiedPositionInfoEx.cs
R7.University/entities/OccupiedPositionInfoEx.cs
using System; using System.Linq; using System.Collections.Generic; using DotNetNuke.Data; using DotNetNuke.ComponentModel.DataAnnotations; using DotNetNuke.Entities.Portals; using DotNetNuke.Entities.Users; namespace R7.University { // More attributes for class: // Set caching for table: [Cacheable("R7.University_OccupiedPositions", CacheItemPriority.Default, 20)] // Explicit mapping declaration: [DeclareColumns] // More attributes for class properties: // Custom column name: [ColumnName("OccupiedPositionID")] // Explicit include column: [IncludeColumn] // Note: DAL 2 have no AutoJoin analogs from PetaPOCO at this time [TableName ("vw_University_OccupiedPositions")] [PrimaryKey ("OccupiedPositionID", AutoIncrement = false)] [Scope ("DivisionID")] public class OccupiedPositionInfoEx : OccupiedPositionInfo { /// <summary> /// Empty default cstor /// </summary> public OccupiedPositionInfoEx () { } #region Extended (external) properties // NOTE: [ReadOnlyColumn] attribute prevents data from loading? public string PositionShortTitle { get; set; } public string PositionTitle { get; set; } public string DivisionShortTitle { get; set; } public string DivisionTitle { get; set; } public int PositionWeight { get; set; } public string HomePage { get; set; } public int? ParentDivisionID { get; set; } #endregion /// <summary> /// Groups the occupied positions in same division /// </summary> /// <returns>The occupied positions.</returns> /// <param name="occupiedPositions">The occupied positions groupped by division.</param> public static IEnumerable<OccupiedPositionInfoEx> GroupByDivision (IEnumerable<OccupiedPositionInfoEx> occupiedPositions) { var opList = occupiedPositions.ToList (); for (var i = 0; i < opList.Count; i++) { // first combine position short title with it's suffix opList [i].PositionShortTitle = Utils.FormatList (" ", opList [i].PositionShortTitle, opList[i].TitleSuffix); for (var j = i + 1; j < opList.Count; ) { if (opList [i].DivisionID == opList [j].DivisionID) { opList [i].PositionShortTitle += ", " + Utils.FormatList(" ", opList [j].PositionShortTitle, opList[j].TitleSuffix); // remove groupped item opList.RemoveAt (j); } else j++; } } return opList; } } }
using System; using System.Linq; using System.Collections.Generic; using DotNetNuke.Data; using DotNetNuke.ComponentModel.DataAnnotations; using DotNetNuke.Entities.Portals; using DotNetNuke.Entities.Users; namespace R7.University { // More attributes for class: // Set caching for table: [Cacheable("R7.University_OccupiedPositions", CacheItemPriority.Default, 20)] // Explicit mapping declaration: [DeclareColumns] // More attributes for class properties: // Custom column name: [ColumnName("OccupiedPositionID")] // Explicit include column: [IncludeColumn] // Note: DAL 2 have no AutoJoin analogs from PetaPOCO at this time [TableName ("vw_University_OccupiedPositions")] [PrimaryKey ("OccupiedPositionID", AutoIncrement = false)] [Scope ("DivisionID")] public class OccupiedPositionInfoEx : OccupiedPositionInfo { /// <summary> /// Empty default cstor /// </summary> public OccupiedPositionInfoEx () { } #region Extended (external) properties // NOTE: [ReadOnlyColumn] attribute prevents data from loading? public string PositionShortTitle { get; set; } public string PositionTitle { get; set; } public string DivisionShortTitle { get; set; } public string DivisionTitle { get; set; } public int PositionWeight { get; set; } public string HomePage { get; set; } public int? ParentDivisionID { get; set; } #endregion /// <summary> /// Groups the occupied positions in same division /// </summary> /// <returns>The occupied positions.</returns> /// <param name="occupiedPositions">The occupied positions groupped by division.</param> public static IEnumerable<OccupiedPositionInfoEx> GroupByDivision (IEnumerable<OccupiedPositionInfoEx> occupiedPositions) { var opList = occupiedPositions.ToList (); for (var i = 0; i < opList.Count; i++) { for (var j = i + 1; j < opList.Count; ) { if (opList [i].DivisionID == opList [j].DivisionID) { opList [i].PositionShortTitle += ", " + opList [j].PositionShortTitle; opList.RemoveAt (j); } else j++; } } return opList; } } }
agpl-3.0
C#
13ee3dcb3d5715aefae7982bda76aebdd27784f9
add home page
LordMike/TMDbLib
TMDbLib/Objects/General/TranslationData.cs
TMDbLib/Objects/General/TranslationData.cs
using Newtonsoft.Json; namespace TMDbLib.Objects.General { public class TranslationData { [JsonProperty("name")] public string Name { get; set; } [JsonProperty("overview")] public string Overview { get; set; } [JsonProperty("homepage")] public string HomePage { get; set; } [JsonProperty("tagline")] public string Tagline { get; set; } } }
using Newtonsoft.Json; namespace TMDbLib.Objects.General { public class TranslationData { [JsonProperty("name")] public string Name { get; set; } [JsonProperty("overview")] public string Overview { get; set; } [JsonProperty("tagline")] public string Tagline { get; set; } } }
mit
C#
7a4a4603a37f90512e662d1bff540dd21e8cdc10
Concatenate messages if they differ. Check times are close together.
CamTechConsultants/CvsntGitImporter
Commit.cs
Commit.cs
/* * John Hall <john.hall@xjtag.com> * Copyright (c) Midas Yellow Ltd. All rights reserved. */ using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace CvsGitConverter { /// <summary> /// Represents a set of changes to files committed in one go. /// </summary> class Commit : IEnumerable<FileRevision> { private readonly List<FileRevision> m_commits = new List<FileRevision>(); private DateTime? m_time; private string m_message; private List<string> m_errors; public readonly string CommitId; public DateTime Time { get { if (m_time.HasValue) return m_time.Value; var time = m_commits.Select(c => c.Time).Min(); m_time = time; return time; } } public string Message { get { if (m_message == null) m_message = String.Join(Environment.NewLine + Environment.NewLine, m_commits.Select(c => c.Message).Distinct()); return m_message; } } public IEnumerable<string> Errors { get { return m_errors ?? Enumerable.Empty<string>(); } } public Commit(string commitId) { CommitId = commitId; } public void Add(FileRevision commit) { m_time = null; m_message = null; m_commits.Add(commit); } public bool Verify() { m_errors = null; var authors = m_commits.Select(c => c.Author).Distinct(); if (authors.Count() > 1) AddError("Multiple authors found: {0}", String.Join(", ", authors)); var times = m_commits.Select(c => c.Time).Distinct(); if (times.Max() - times.Min() >= TimeSpan.FromMinutes(1)) AddError("Times vary too much: {0}", String.Join(", ", times)); return !Errors.Any(); } public IEnumerator<FileRevision> GetEnumerator() { return m_commits.GetEnumerator(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return m_commits.GetEnumerator(); } private void AddError(string format, params object[] args) { var msg = String.Format(format, args); if (m_errors == null) m_errors = new List<string>() { msg }; else m_errors.Add(msg); } } }
/* * John Hall <john.hall@xjtag.com> * Copyright (c) Midas Yellow Ltd. All rights reserved. */ using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace CvsGitConverter { /// <summary> /// Represents a set of changes to files committed in one go. /// </summary> class Commit : IEnumerable<FileRevision> { private readonly List<FileRevision> m_commits = new List<FileRevision>(); private DateTime? m_time; private List<string> m_errors; public readonly string CommitId; public DateTime Time { get { if (m_time.HasValue) return m_time.Value; var time = m_commits.Select(c => c.Time).Min(); m_time = time; return time; } } public IEnumerable<string> Errors { get { return m_errors ?? Enumerable.Empty<string>(); } } public Commit(string commitId) { CommitId = commitId; } public void Add(FileRevision commit) { m_time = null; m_commits.Add(commit); } public bool Verify() { m_errors = null; var authors = m_commits.Select(c => c.Author).Distinct(); if (authors.Count() > 1) AddError("Multiple authors found: {0}", String.Join(", ", authors)); var messages = m_commits.Select(c => c.Message).Distinct(); if (messages.Count() > 1) AddError("Multiple messages found:\r\n{0}", String.Join("\r\n----------------\r\n", messages)); return !Errors.Any(); } public IEnumerator<FileRevision> GetEnumerator() { return m_commits.GetEnumerator(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return m_commits.GetEnumerator(); } private void AddError(string format, params object[] args) { var msg = String.Format(format, args); if (m_errors == null) m_errors = new List<string>() { msg }; else m_errors.Add(msg); } } }
mit
C#
dc7a667ebaccfdfa097afaac4dd17503ee308fed
Remove Ipc repository
awaescher/RepoZ,awaescher/RepoZ
RepoZ.Ipc/Repository.cs
RepoZ.Ipc/Repository.cs
namespace RepoZ.Ipc { [System.Diagnostics.DebuggerDisplay("{Name}")] public class Repository { public static Repository FromString(string value) { var parts = value?.Split(new string[] { "::" }, System.StringSplitOptions.None); var partsCount = parts?.Length ?? 0; var validFormat = partsCount == 3 || partsCount == 4; if (!validFormat) return null; return new Repository() { Name = parts[0], BranchWithStatus = parts[1], Path = parts[2], HasUnpushedChanges = parts.Length > 3 && parts[3] == "1", }; } public override string ToString() { if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(BranchWithStatus) || string.IsNullOrEmpty(Path)) return ""; return $"{Name}::{BranchWithStatus}::{Path}::{(HasUnpushedChanges ? "1" : "0")}"; } public string Name { get; set; } public string BranchWithStatus { get; set; } public string Path { get; set; } public string[] ReadAllBranches() => new string[0]; public bool HasUnpushedChanges { get; set; } public string SafePath { // use '/' for linux systems and bash command line (will work on cmd and powershell as well) get => Path?.Replace(@"\", "/") ?? ""; } } }
namespace RepoZ.Ipc { [System.Diagnostics.DebuggerDisplay("{Name}")] public class Repository { public static Repository FromString(string value) { var parts = value?.Split(new string[] { "::" }, System.StringSplitOptions.None); var partsCount = parts?.Length ?? 0; var validFormat = partsCount == 3 || partsCount == 4; if (!validFormat) return null; return new Repository() { Name = parts[0], BranchWithStatus = parts[1], Path = parts[2], HasUnpushedChanges = parts.Length > 3 && parts[3] == "1", }; } public override string ToString() { if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(BranchWithStatus) || string.IsNullOrEmpty(Path)) return ""; return $"{Name}::{BranchWithStatus}::{Path}::{(HasUnpushedChanges ? "1" : "0")}"; } public string Name { get; set; } public string BranchWithStatus { get; set; } public string Path { get; set; } public string[] AllBranches { get; set; } public bool HasUnpushedChanges { get; set; } public string SafePath { // use '/' for linux systems and bash command line (will work on cmd and powershell as well) get => Path?.Replace(@"\", "/") ?? ""; } } }
mit
C#
1a8c39ca1f31fba4246aacc79623eb6bdd7a575d
Fix bug where image created with .WithSize/WithBoxSize wouldn't be sized correctly in an Image widget
mminns/xwt,sevoku/xwt,hamekoz/xwt,residuum/xwt,steffenWi/xwt,TheBrainTech/xwt,mminns/xwt,cra0zy/xwt,hwthomas/xwt,lytico/xwt,iainx/xwt,mono/xwt,akrisiun/xwt,directhex/xwt,antmicro/xwt
Xwt.Gtk/Xwt.GtkBackend/ImageViewBackend.cs
Xwt.Gtk/Xwt.GtkBackend/ImageViewBackend.cs
// // ImageViewBackend.cs // // Author: // Lluis Sanchez <lluis@xamarin.com> // // Copyright (c) 2011 Xamarin Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; using Xwt.Drawing; namespace Xwt.GtkBackend { public class ImageViewBackend: WidgetBackend, IImageViewBackend { public override void Initialize () { Widget = new Gtk.Image (); Widget.Show (); } protected new Gtk.Image Widget { get { return (Gtk.Image)base.Widget; } set { base.Widget = value; } } public void SetImage (Image image) { if (image == null) throw new ArgumentNullException ("nativeImage"); Gdk.Pixbuf pbuf = Toolkit.GetBackend (image) as Gdk.Pixbuf; if (pbuf == null) pbuf = Toolkit.GetBackend (image.ToBitmap ()) as Gdk.Pixbuf; if (pbuf == null) throw new ArgumentException ("image is not of the expected type", "image"); if (image.HasFixedSize && (pbuf.Width != (int)image.Size.Width || pbuf.Height != (int)image.Size.Height)) pbuf = pbuf.ScaleSimple ((int)image.Size.Width, (int)image.Size.Height, Gdk.InterpType.Bilinear); Widget.Pixbuf = pbuf; } } }
// // ImageViewBackend.cs // // Author: // Lluis Sanchez <lluis@xamarin.com> // // Copyright (c) 2011 Xamarin Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; using Xwt.Drawing; namespace Xwt.GtkBackend { public class ImageViewBackend: WidgetBackend, IImageViewBackend { public override void Initialize () { Widget = new Gtk.Image (); Widget.Show (); } protected new Gtk.Image Widget { get { return (Gtk.Image)base.Widget; } set { base.Widget = value; } } public void SetImage (Image image) { if (image == null) throw new ArgumentNullException ("nativeImage"); Gdk.Pixbuf pbuf = Toolkit.GetBackend (image) as Gdk.Pixbuf; if (pbuf == null) pbuf = Toolkit.GetBackend (image.ToBitmap ()) as Gdk.Pixbuf; if (pbuf == null) throw new ArgumentException ("image is not of the expected type", "image"); Widget.Pixbuf = pbuf; } } }
mit
C#
329b547fd981da7c8070ce03ef0694de9fd064b2
Update FixedRateCurrencyConverter.cs
tiksn/TIKSN-Framework
TIKSN.Core/Finance/FixedRateCurrencyConverter.cs
TIKSN.Core/Finance/FixedRateCurrencyConverter.cs
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace TIKSN.Finance { public class FixedRateCurrencyConverter : ICurrencyConverter { private readonly decimal rate; public FixedRateCurrencyConverter(CurrencyPair pair, decimal rate) { this.CurrencyPair = pair ?? throw new ArgumentNullException(nameof(pair)); if (rate > decimal.Zero) { this.rate = rate; } else { throw new ArgumentException("Rate cannot be negative or zero.", "Rate"); } } public CurrencyPair CurrencyPair { get; } public Task<Money> ConvertCurrencyAsync(Money baseMoney, CurrencyInfo counterCurrency, DateTimeOffset asOn, CancellationToken cancellationToken) { var requiredPair = new CurrencyPair(baseMoney.Currency, counterCurrency); if (this.CurrencyPair == requiredPair) { return Task.FromResult(new Money(this.CurrencyPair.CounterCurrency, baseMoney.Amount * this.rate)); } throw new ArgumentException("Unsupported currency pair."); } public Task<IEnumerable<CurrencyPair>> GetCurrencyPairsAsync(DateTimeOffset asOn, CancellationToken cancellationToken) { IEnumerable<CurrencyPair> singleItemList = new List<CurrencyPair> {this.CurrencyPair}; return Task.FromResult(singleItemList); } public Task<decimal> GetExchangeRateAsync(CurrencyPair pair, DateTimeOffset asOn, CancellationToken cancellationToken) { if (this.CurrencyPair == pair) { return Task.FromResult(this.rate); } throw new ArgumentException("Unsupported currency pair."); } } }
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace TIKSN.Finance { public class FixedRateCurrencyConverter : ICurrencyConverter { private CurrencyPair currencyPair; private readonly decimal rate; public FixedRateCurrencyConverter(CurrencyPair pair, decimal rate) { this.CurrencyPair = pair; if (rate > decimal.Zero) { this.rate = rate; } else { throw new ArgumentException("Rate cannot be negative or zero.", "Rate"); } } public CurrencyPair CurrencyPair { get => this.currencyPair; private set { if (ReferenceEquals(value, null)) { throw new ArgumentNullException(); } this.currencyPair = value; } } public Task<Money> ConvertCurrencyAsync(Money baseMoney, CurrencyInfo counterCurrency, DateTimeOffset asOn, CancellationToken cancellationToken) { var requiredPair = new CurrencyPair(baseMoney.Currency, counterCurrency); if (this.CurrencyPair == requiredPair) { return Task.FromResult(new Money(this.CurrencyPair.CounterCurrency, baseMoney.Amount * this.rate)); } throw new ArgumentException("Unsupported currency pair."); } public Task<IEnumerable<CurrencyPair>> GetCurrencyPairsAsync(DateTimeOffset asOn, CancellationToken cancellationToken) { IEnumerable<CurrencyPair> singleItemList = new List<CurrencyPair> {this.currencyPair}; return Task.FromResult(singleItemList); } public Task<decimal> GetExchangeRateAsync(CurrencyPair pair, DateTimeOffset asOn, CancellationToken cancellationToken) { if (this.CurrencyPair == pair) { return Task.FromResult(this.rate); } throw new ArgumentException("Unsupported currency pair."); } } }
mit
C#
f8530c5452af7d58d20267ea623af2f86e88d07c
sort usings
mrward/NuGet.V2,rikoe/nuget,jmezach/NuGet2,rikoe/nuget,GearedToWar/NuGet2,mrward/NuGet.V2,oliver-feng/nuget,chocolatey/nuget-chocolatey,GearedToWar/NuGet2,mrward/NuGet.V2,chocolatey/nuget-chocolatey,mrward/nuget,pratikkagda/nuget,jmezach/NuGet2,alluran/node.net,RichiCoder1/nuget-chocolatey,jholovacs/NuGet,ctaggart/nuget,oliver-feng/nuget,alluran/node.net,chocolatey/nuget-chocolatey,akrisiun/NuGet,alluran/node.net,jholovacs/NuGet,OneGet/nuget,oliver-feng/nuget,indsoft/NuGet2,mrward/nuget,xoofx/NuGet,pratikkagda/nuget,mrward/NuGet.V2,akrisiun/NuGet,rikoe/nuget,oliver-feng/nuget,pratikkagda/nuget,GearedToWar/NuGet2,dolkensp/node.net,jholovacs/NuGet,RichiCoder1/nuget-chocolatey,mrward/nuget,jmezach/NuGet2,mrward/NuGet.V2,chocolatey/nuget-chocolatey,RichiCoder1/nuget-chocolatey,mrward/nuget,ctaggart/nuget,ctaggart/nuget,mono/nuget,OneGet/nuget,dolkensp/node.net,antiufo/NuGet2,RichiCoder1/nuget-chocolatey,chocolatey/nuget-chocolatey,GearedToWar/NuGet2,jmezach/NuGet2,mono/nuget,pratikkagda/nuget,mrward/NuGet.V2,dolkensp/node.net,OneGet/nuget,indsoft/NuGet2,xoofx/NuGet,xoofx/NuGet,xoofx/NuGet,oliver-feng/nuget,jmezach/NuGet2,indsoft/NuGet2,antiufo/NuGet2,dolkensp/node.net,mono/nuget,pratikkagda/nuget,jholovacs/NuGet,ctaggart/nuget,indsoft/NuGet2,mrward/nuget,indsoft/NuGet2,jholovacs/NuGet,xoofx/NuGet,RichiCoder1/nuget-chocolatey,oliver-feng/nuget,indsoft/NuGet2,alluran/node.net,antiufo/NuGet2,OneGet/nuget,xoofx/NuGet,mono/nuget,chocolatey/nuget-chocolatey,antiufo/NuGet2,pratikkagda/nuget,GearedToWar/NuGet2,RichiCoder1/nuget-chocolatey,antiufo/NuGet2,mrward/nuget,jholovacs/NuGet,jmezach/NuGet2,GearedToWar/NuGet2,antiufo/NuGet2,rikoe/nuget
src/Core/FileModifiers/Preprocessor.cs
src/Core/FileModifiers/Preprocessor.cs
using NuGet.Resources; using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; using System.Text.RegularExpressions; namespace NuGet { /// <summary> /// Simple token replacement system for content files. /// </summary> public class Preprocessor : IPackageFileTransformer { private static readonly Regex _tokenRegex = new Regex(@"\$(?<propertyName>\w+)\$"); public void TransformFile(IPackageFile file, string targetPath, IProjectSystem projectSystem) { ProjectSystemExtensions.TryAddFile(projectSystem, targetPath, () => Process(file, projectSystem).AsStream()); } public void RevertFile(IPackageFile file, string targetPath, IEnumerable<IPackageFile> matchingFiles, IProjectSystem projectSystem) { Func<Stream> streamFactory = () => Process(file, projectSystem).AsStream(); FileSystemExtensions.DeleteFileSafe(projectSystem, targetPath, streamFactory); } internal static string Process(IPackageFile file, IPropertyProvider propertyProvider) { using (var stream = file.GetStream()) { return Process(stream, propertyProvider, throwIfNotFound: false); } } public static string Process(Stream stream, IPropertyProvider propertyProvider, bool throwIfNotFound = true) { // Fix for bug https://nuget.codeplex.com/workitem/3174, source code transfomation to support BOM byte[] bytes = stream.ReadAllBytes(); string text = Encoding.UTF8.GetString(bytes); return _tokenRegex.Replace(text, match => ReplaceToken(match, propertyProvider, throwIfNotFound)); } private static string ReplaceToken(Match match, IPropertyProvider propertyProvider, bool throwIfNotFound) { string propertyName = match.Groups["propertyName"].Value; var value = propertyProvider.GetPropertyValue(propertyName); if (value == null && throwIfNotFound) { throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, NuGetResources.TokenHasNoValue, propertyName)); } return value; } } }
using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text.RegularExpressions; using NuGet.Resources; using System.Text; namespace NuGet { /// <summary> /// Simple token replacement system for content files. /// </summary> public class Preprocessor : IPackageFileTransformer { private static readonly Regex _tokenRegex = new Regex(@"\$(?<propertyName>\w+)\$"); public void TransformFile(IPackageFile file, string targetPath, IProjectSystem projectSystem) { ProjectSystemExtensions.TryAddFile(projectSystem, targetPath, () => Process(file, projectSystem).AsStream()); } public void RevertFile(IPackageFile file, string targetPath, IEnumerable<IPackageFile> matchingFiles, IProjectSystem projectSystem) { Func<Stream> streamFactory = () => Process(file, projectSystem).AsStream(); FileSystemExtensions.DeleteFileSafe(projectSystem, targetPath, streamFactory); } internal static string Process(IPackageFile file, IPropertyProvider propertyProvider) { using (var stream = file.GetStream()) { return Process(stream, propertyProvider, throwIfNotFound: false); } } public static string Process(Stream stream, IPropertyProvider propertyProvider, bool throwIfNotFound = true) { // Fix for bug https://nuget.codeplex.com/workitem/3174, source code transfomation to support BOM byte[] bytes = stream.ReadAllBytes(); string text = Encoding.UTF8.GetString(bytes); return _tokenRegex.Replace(text, match => ReplaceToken(match, propertyProvider, throwIfNotFound)); } private static string ReplaceToken(Match match, IPropertyProvider propertyProvider, bool throwIfNotFound) { string propertyName = match.Groups["propertyName"].Value; var value = propertyProvider.GetPropertyValue(propertyName); if (value == null && throwIfNotFound) { throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, NuGetResources.TokenHasNoValue, propertyName)); } return value; } } }
apache-2.0
C#
3e1f4ab128b0dd34acba446017904b162ad1d147
Test działania wersjonowania
fmatuszewski/CubeGenerator
Test/CubeFactoryTest.cs
Test/CubeFactoryTest.cs
using NUnit.Framework; using System; //git test namespace CubeGenerator { [TestFixture()] public class CubeFactoryTest { [Test()] public void TestCase () { } [Test()] public void ConnectDatabaseTestCase () { //given CubeFactory cf = new CubeFactory ("LocalHost", "msolap", "MyOlap"); //when //then Assert.IsTrue (cf.IsConnected (), "AnalysisServices not connected"); } } }
using NUnit.Framework; using System; namespace CubeGenerator { [TestFixture()] public class CubeFactoryTest { [Test()] public void TestCase () { } [Test()] public void ConnectDatabaseTestCase () { //given CubeFactory cf = new CubeFactory ("LocalHost", "msolap", "MyOlap"); //when //then Assert.IsTrue (cf.IsConnected (), "AnalysisServices not connected"); } } }
mit
C#
1a3969902510a084d4d6dac383a23e6e3dc07f99
Update MainService.cs
D4N3-777/Din_Website,D4N3-777/Din_Website,D4N3-777/Din_Website
src/Din.Service/Classes/MainService.cs
src/Din.Service/Classes/MainService.cs
using Din.ExternalModels.Utils; namespace Din.Service.Classes { /// <summary> /// MainService that provides the necessary properties. /// </summary> public static class MainService { //Debug Location //public static readonly PropertyFile PropertyFile = new PropertyFile(@"PropertyFile"); //Release Location public static readonly PropertyFile PropertyFile = new PropertyFile("/propdir/PropertyFile"); } }
using Din.ExternalModels.Utils; namespace Din.Service.Classes { /// <summary> /// MainService that provides the necessary properties. /// </summary> public static class MainService { //Debug Location public static readonly PropertyFile PropertyFile = new PropertyFile(@"PropertyFile"); //Release Location //public static readonly PropertyFile PropertyFile = new PropertyFile("/propdir/PropertyFile"); } }
apache-2.0
C#
d20162c2a95014e3cf82c30b403cf4e56ff7a96e
remove unused usings
rjw57/streamkinect2.net
ExampleServer/Program.cs
ExampleServer/Program.cs
using StreamKinect2; namespace ExampleServer { class Program { static void Main(string[] args) { using (Server server = new Server()) { server.Start(); server.AddDevice(new SimulatedKinectDevice()); System.Console.WriteLine("Press Enter to stop server"); System.Console.ReadLine(); } } } }
using StreamKinect2; using System.Threading.Tasks; namespace ExampleServer { class Program { static void Main(string[] args) { using (Server server = new Server()) { server.Start(); server.AddDevice(new SimulatedKinectDevice()); System.Console.WriteLine("Press Enter to stop server"); System.Console.ReadLine(); } } } }
bsd-2-clause
C#
8d33c94a9b5efd302d539eef6ccf96fb34585e73
バージョン表記を0.2に変更
nanase/sitrine
src/Sitrine/Properties/AssemblyInfo.cs
src/Sitrine/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("Sitrine")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Sitrine")] [assembly: AssemblyCopyright("Copyright © 2013 Tomona Nanase")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です [assembly: Guid("be616fdc-8b0a-4c65-ac69-5f20847b9a45")] // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: // // Major Version // Minor Version // Build Number // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.2")] [assembly: AssemblyFileVersion("0.2")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("Sitrine")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Sitrine")] [assembly: AssemblyCopyright("Copyright © 2013 Tomona Nanase")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です [assembly: Guid("be616fdc-8b0a-4c65-ac69-5f20847b9a45")] // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: // // Major Version // Minor Version // Build Number // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1")] [assembly: AssemblyFileVersion("0.1")]
mit
C#
df98860119d72763929ea61f0df52a6baa56eabd
add type attribute to image response
vevix/DigitalOcean.API
DigitalOcean.API/Models/Responses/Image.cs
DigitalOcean.API/Models/Responses/Image.cs
using System; using System.Collections.Generic; namespace DigitalOcean.API.Models.Responses { public class Image { /// <summary> /// A unique number that can be used to identify and reference a specific image. /// </summary> public int Id { get; set; } /// <summary> /// The display name that has been given to an image. This is what is shown in the control panel and is generally a /// descriptive title for the image in question. /// </summary> public string Name { get; set; } /// <summary> /// The kind of image, describing the duration of how long the image is stored. This is one of "snapshot", "temporary" or "backup". /// </summary> public string Type { get; set; } /// <summary> /// This attribute describes the base distribution used for this image. /// </summary> public string Distribution { get; set; } /// <summary> /// A uniquely identifying string that is associated with each of the DigitalOcean-provided public images. These can be /// used to reference a public image as an alternative to the numeric id. /// </summary> public string Slug { get; set; } /// <summary> /// This is a boolean value that indicates whether the image in question is public or not. An image that is public is /// available to all accounts. A non-public image is only accessible from your account. /// </summary> public bool Public { get; set; } /// <summary> /// This attribute is an array of the regions that the image is available in. The regions are represented by their /// identifying slug values. /// </summary> public List<string> Regions { get; set; } /// <summary> /// A time value given in ISO8601 combined date and time format that represents when the image was created. /// </summary> public DateTime CreatedAt { get; set; } /// <summary> /// Contains the value of the minimum size droplet required for that image. /// </summary> public int MinDiskSize { get; set; } } }
using System; using System.Collections.Generic; namespace DigitalOcean.API.Models.Responses { public class Image { /// <summary> /// A unique number that can be used to identify and reference a specific image. /// </summary> public int Id { get; set; } /// <summary> /// The display name that has been given to an image. This is what is shown in the control panel and is generally a /// descriptive title for the image in question. /// </summary> public string Name { get; set; } /// <summary> /// This attribute describes the base distribution used for this image. /// </summary> public string Distribution { get; set; } /// <summary> /// A uniquely identifying string that is associated with each of the DigitalOcean-provided public images. These can be /// used to reference a public image as an alternative to the numeric id. /// </summary> public string Slug { get; set; } /// <summary> /// This is a boolean value that indicates whether the image in question is public or not. An image that is public is /// available to all accounts. A non-public image is only accessible from your account. /// </summary> public bool Public { get; set; } /// <summary> /// This attribute is an array of the regions that the image is available in. The regions are represented by their /// identifying slug values. /// </summary> public List<string> Regions { get; set; } /// <summary> /// A time value given in ISO8601 combined date and time format that represents when the image was created. /// </summary> public DateTime CreatedAt { get; set; } /// <summary> /// Contains the value of the minimum size droplet required for that image. /// </summary> public int MinDiskSize { get; set; } } }
mit
C#
3ec1baf5937f3c7b23d2c6a47a30f5b64ce09048
Make virtual tracks reeeeeeeaaally long
peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,naoey/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,naoey/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,default0/osu-framework,smoogipooo/osu-framework,default0/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,ZLima12/osu-framework,paparony03/osu-framework,ZLima12/osu-framework,paparony03/osu-framework,DrabWeb/osu-framework
osu.Framework/Audio/Track/TrackVirtual.cs
osu.Framework/Audio/Track/TrackVirtual.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using osu.Framework.Timing; namespace osu.Framework.Audio.Track { public class TrackVirtual : Track { private readonly StopwatchClock clock = new StopwatchClock(); private double seekOffset; public TrackVirtual() { Length = double.MaxValue; } public override bool Seek(double seek) { double current = CurrentTime; seekOffset = seek; lock (clock) clock.Restart(); if (Length > 0 && seekOffset > Length) seekOffset = Length; return current != seekOffset; } public override void Start() { lock (clock) clock.Start(); } public override void Reset() { lock (clock) clock.Reset(); seekOffset = 0; base.Reset(); } public override void Stop() { lock (clock) clock.Stop(); } public override bool IsRunning { get { lock (clock) return clock.IsRunning; } } public override bool HasCompleted { get { lock (clock) return base.HasCompleted || IsLoaded && !IsRunning && CurrentTime >= Length; } } public override double CurrentTime { get { lock (clock) return seekOffset + clock.CurrentTime; } } public override void Update() { lock (clock) { if (CurrentTime >= Length) Stop(); } } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using osu.Framework.Timing; namespace osu.Framework.Audio.Track { public class TrackVirtual : Track { private readonly StopwatchClock clock = new StopwatchClock(); private double seekOffset; public override bool Seek(double seek) { double current = CurrentTime; seekOffset = seek; lock (clock) clock.Restart(); if (Length > 0 && seekOffset > Length) seekOffset = Length; return current != seekOffset; } public override void Start() { lock (clock) clock.Start(); } public override void Reset() { lock (clock) clock.Reset(); seekOffset = 0; base.Reset(); } public override void Stop() { lock (clock) clock.Stop(); } public override bool IsRunning { get { lock (clock) return clock.IsRunning; } } public override bool HasCompleted { get { lock (clock) return base.HasCompleted || IsLoaded && !IsRunning && CurrentTime >= Length; } } public override double CurrentTime { get { lock (clock) return seekOffset + clock.CurrentTime; } } public override void Update() { lock (clock) { if (CurrentTime >= Length) Stop(); } } } }
mit
C#
a8155ce0599581aa2429b5b95cb44cf71e13ec7e
Move overheating check into update
andrewjleavitt/SpaceThing
Assets/Scripts/PlayerSpaceShip.cs
Assets/Scripts/PlayerSpaceShip.cs
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerSpaceShip : MonoBehaviour { public int hp = 0; public int level = 0; public float heatThreshold = 0.0f; public ArmorBehavior armor; public ShieldBehavior shield; public Dictionary <string, GunBehavior> guns = new Dictionary<string, GunBehavior>(); public HeatsinkBehavior heatsink; private float heat = 0.0f; void Start() { GunBehavior peaShooter = new GunBehavior("Pea Shooter", 0.3f, 0.1f); GunBehavior mallowGun = new GunBehavior("Mallow Gun", 1.0f, 1.0f); GunBehavior wristRocket = new GunBehavior("Wrist Rocket", 0.8f, 1.1f); shield = new ShieldBehavior("Mighty Shield", 10.0f, 0.5f); armor = new ArmorBehavior("Cardboard", 100.0f); heatsink = new HeatsinkBehavior(1.0f); guns.Add("first",peaShooter); guns.Add("second",mallowGun); guns.Add("third",wristRocket); } void Update () { if (!IsOverheating()) { GetUserAction(); } SinkHeat(); RegenerateShields(); } private void RegenerateShields() { shield.Recharge(); } private void SinkHeat() { float sink = heatsink.Sink(); if (sink == -1f) { return; } Mathf.Max(0, heat -= sink); } private bool IsOverheating() { return heat > heatThreshold; } private void GetUserAction() { if (Input.GetKeyDown("a")) { FireGunInPosition("first"); } else if (Input.GetKeyDown("s")) { FireGunInPosition("second"); } else if (Input.GetKeyDown("d")) { FireGunInPosition("third"); } else if (Input.GetKeyDown(KeyCode.LeftControl)) { DisplayShieldStatus(); } } private void DisplayShieldStatus() { Debug.unityLogger.Log(shield.Status()); } private void FireGunInPosition(string v) { guns[v].Trigger(); guns[v].HeatTransfer(); } }
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerSpaceShip : MonoBehaviour { public int hp = 0; public int level = 0; public float heatThreshold = 0.0f; public ArmorBehavior armor; public ShieldBehavior shield; public Dictionary <string, GunBehavior> guns = new Dictionary<string, GunBehavior>(); public HeatsinkBehavior heatsink; private float heat = 0.0f; void Start() { GunBehavior peaShooter = new GunBehavior("Pea Shooter", 0.3f, 0.1f); GunBehavior mallowGun = new GunBehavior("Mallow Gun", 1.0f, 1.0f); GunBehavior wristRocket = new GunBehavior("Wrist Rocket", 0.8f, 1.1f); shield = new ShieldBehavior("Mighty Shield", 10.0f, 0.5f); armor = new ArmorBehavior("Cardboard", 100.0f); heatsink = new HeatsinkBehavior(0.4f); guns.Add("first",peaShooter); guns.Add("second",mallowGun); guns.Add("third",wristRocket); } void Update () { GetUserAction(); SinkHeat(); RegenerateShields(); } private void RegenerateShields() { shield.Recharge(); } private void SinkHeat() { float sink = heatsink.Sink(); if (sink == -1f) { return; } Mathf.Max(0, heat -= sink); } private bool IsOverheating() { return heat > heatThreshold; } private void GetUserAction() { if (IsOverheating()) { return; } if (Input.GetKeyDown("a")) { FireGunInPosition("first"); } else if (Input.GetKeyDown("s")) { FireGunInPosition("second"); } else if (Input.GetKeyDown("d")) { FireGunInPosition("third"); } else if (Input.GetKeyDown(KeyCode.LeftControl)) { DisplayShieldStatus(); } } private void DisplayShieldStatus() { Debug.unityLogger.Log(shield.Status()); } private void FireGunInPosition(string v) { guns[v].Trigger(); guns[v].HeatTransfer(); } }
unlicense
C#
e1c0126dd10239ecdb39ee0ff225131748ca54a1
Check argument range.
fuyuno/HSPToolsVS
HSPToolsVS/IntelliSense/HSPDeclarations.cs
HSPToolsVS/IntelliSense/HSPDeclarations.cs
using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.Package; namespace HSPToolsVS.IntelliSense { // ReSharper disable once InconsistentNaming internal class HSPDeclarations : Declarations { private readonly IList<string> _declarations; public HSPDeclarations(IList<string> declarations) { _declarations = declarations; } #region Overrides of Declarations public override int GetCount() => _declarations.Count; public override string GetDisplayText(int index) => 0 <= index && index < GetCount() ? _declarations[index] : null; public override string GetName(int index) => 0 <= index && index < GetCount() ? _declarations[index] : null; public override string GetDescription(int index) { if (0 > index || index > GetCount()) return null; var word = _declarations[index]; return HSPDocs.Documents.SingleOrDefault(w => w.Name == word)?.Summary; } public override int GetGlyph(int index) => 1; #endregion } }
using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.Package; namespace HSPToolsVS.IntelliSense { // ReSharper disable once InconsistentNaming internal class HSPDeclarations : Declarations { private readonly IList<string> _declarations; public HSPDeclarations(IList<string> declarations) { _declarations = declarations; } #region Overrides of Declarations public override int GetCount() => _declarations.Count; public override string GetDisplayText(int index) => _declarations[index]; public override string GetName(int index) => _declarations[index]; public override string GetDescription(int index) { var word = _declarations[index]; return HSPDocs.Documents.SingleOrDefault(w => w.Name == word)?.Summary; } public override int GetGlyph(int index) => 1; #endregion } }
mit
C#
796605883aefcff0d27fbc558bb83af1f9cc6119
Stop commiting binary.
DinkyToyz/wtmcsServiceDispatcher,DinkyToyz/wtmcsServiceDispatcher
wtmcsServiceDispatcher/Build/PreBuildStamps.cs
wtmcsServiceDispatcher/Build/PreBuildStamps.cs
using System; namespace AssemblyInfo { /// <summary> /// Build stamps. /// </summary> public static class PreBuildStamps { /// <summary> /// Build-stamped ticks. /// </summary> private static long ticks = 636359842580240693; /*:TICKS:*/ /// <summary> /// Gets build-stamped date-time. /// </summary> /// <value> /// The date-time. /// </value> public static DateTime DateTime { get { return new DateTime(ticks); } } /// <summary> /// Gets build-stamped year. /// </summary> /// <value> /// The year. /// </value> public static int Year { get { return PreBuildStamps.DateTime.Year; } } } }
using System; namespace AssemblyInfo { /// <summary> /// Build stamps. /// </summary> public static class PreBuildStamps { /// <summary> /// Build-stamped ticks. /// </summary> private static long ticks = 636357522655804518; /*:TICKS:*/ /// <summary> /// Gets build-stamped date-time. /// </summary> /// <value> /// The date-time. /// </value> public static DateTime DateTime { get { return new DateTime(ticks); } } /// <summary> /// Gets build-stamped year. /// </summary> /// <value> /// The year. /// </value> public static int Year { get { return PreBuildStamps.DateTime.Year; } } } }
mit
C#
99b542033078c514f44ef18c6bea863e6db6bd13
Remove access modifier
jkereako/PillBlasta
Assets/Scripts/Weapon.cs
Assets/Scripts/Weapon.cs
using UnityEngine; public enum FireMode { Automatic, Burst, Single} ; [RequireComponent(typeof(MuzzleFlash))] public class Weapon: MonoBehaviour { public FireMode fireMode; public Transform muzzle; public Transform ejector; public Projectile projectile; public Transform shell; public int burstCount = 3; public float fireRate = 100; public float muzzleVelocity = 35; float nextShotTime; int shotsRemaining; void Start() { Initialize(); } public void OnTriggerHold() { if (shotsRemaining == 0 || Time.time < nextShotTime) { return; } Fire(); switch (fireMode) { case FireMode.Single: case FireMode.Burst: shotsRemaining -= 1; break; } } public void OnTriggerRelease() { Initialize(); } void Fire() { Projectile aProjectile; MuzzleFlash muzzleFlash = GetComponent<MuzzleFlash>(); nextShotTime = Time.time + fireRate / 1000; aProjectile = Instantiate(projectile, muzzle.position, muzzle.rotation); aProjectile.SetSpeed(muzzleVelocity); Instantiate(shell, ejector.position, ejector.rotation); muzzleFlash.Animate(); } void Initialize() { switch (fireMode) { case FireMode.Single: shotsRemaining = 1; break; case FireMode.Burst: shotsRemaining = burstCount; break; case FireMode.Automatic: shotsRemaining = -1; break; } } }
using UnityEngine; public enum FireMode { Automatic, Burst, Single} ; [RequireComponent(typeof(MuzzleFlash))] public class Weapon: MonoBehaviour { public FireMode fireMode; public Transform muzzle; public Transform ejector; public Projectile projectile; public Transform shell; public int burstCount = 3; public float fireRate = 100; public float muzzleVelocity = 35; float nextShotTime; int shotsRemaining; public void Start() { Initialize(); } public void OnTriggerHold() { if (shotsRemaining == 0 || Time.time < nextShotTime) { return; } Fire(); switch (fireMode) { case FireMode.Single: case FireMode.Burst: shotsRemaining -= 1; break; } } public void OnTriggerRelease() { Initialize(); } void Fire() { Projectile aProjectile; MuzzleFlash muzzleFlash = GetComponent<MuzzleFlash>(); nextShotTime = Time.time + fireRate / 1000; aProjectile = Instantiate(projectile, muzzle.position, muzzle.rotation); aProjectile.SetSpeed(muzzleVelocity); Instantiate(shell, ejector.position, ejector.rotation); muzzleFlash.Animate(); } void Initialize() { switch (fireMode) { case FireMode.Single: shotsRemaining = 1; break; case FireMode.Burst: shotsRemaining = burstCount; break; case FireMode.Automatic: shotsRemaining = -1; break; } } }
mit
C#
f8d12266e143e85835e5940166fb7d13c67791b6
Use HashSet for SelectedChildren
MatterHackers/agg-sharp,jlewin/agg-sharp,larsbrubaker/agg-sharp
DataConverters3D/Object3D/SelectedChildren.cs
DataConverters3D/Object3D/SelectedChildren.cs
/* Copyright (c) 2017, Lars Brubaker, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using System.Collections.Generic; namespace MatterHackers.DataConverters3D { public class SelectedChildren : HashSet<string> { public override string ToString() { return string.Join(",", this); } } }
/* Copyright (c) 2017, Lars Brubaker, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using System.Collections.Generic; namespace MatterHackers.DataConverters3D { public class SelectedChildren : List<string> { public override string ToString() { return string.Join(",", this); } } }
bsd-2-clause
C#
43ea42f2aa6d1719c18e1650e5335a81dc34e4c5
Fix number format for locales that don't use . as decimal mark
HalidCisse/ReactiveTrader,akrisiun/ReactiveTrader,mrClapham/ReactiveTrader,abbasmhd/ReactiveTrader,mrClapham/ReactiveTrader,akrisiun/ReactiveTrader,mrClapham/ReactiveTrader,rikoe/ReactiveTrader,HalidCisse/ReactiveTrader,LeeCampbell/ReactiveTrader,rikoe/ReactiveTrader,AdaptiveConsulting/ReactiveTrader,LeeCampbell/ReactiveTrader,HalidCisse/ReactiveTrader,mrClapham/ReactiveTrader,LeeCampbell/ReactiveTrader,HalidCisse/ReactiveTrader,abbasmhd/ReactiveTrader,akrisiun/ReactiveTrader,abbasmhd/ReactiveTrader,LeeCampbell/ReactiveTrader,rikoe/ReactiveTrader,abbasmhd/ReactiveTrader,rikoe/ReactiveTrader,akrisiun/ReactiveTrader,AdaptiveConsulting/ReactiveTrader
src/Adaptive.ReactiveTrader.Client/UI/SpotTiles/PriceFormatter.cs
src/Adaptive.ReactiveTrader.Client/UI/SpotTiles/PriceFormatter.cs
using System.Globalization; namespace Adaptive.ReactiveTrader.Client.UI.SpotTiles { public static class PriceFormatter { public static FormattedPrice GetFormattedPrice(decimal rate, int precision, int pipsPosition) { var rateAsString = rate.ToString("0." + new string('0', precision), CultureInfo.InvariantCulture); var dotIndex = rateAsString.IndexOf('.'); var bigFigures = rateAsString.Substring(0, dotIndex + pipsPosition - 1); var pips = rateAsString.Substring(dotIndex + pipsPosition - 1, 2); var tenthOfPips = ""; if (precision > pipsPosition) { tenthOfPips = rateAsString.Substring(dotIndex + pipsPosition + 1, rateAsString.Length - (dotIndex + pipsPosition + 1)); } return new FormattedPrice(bigFigures, pips, tenthOfPips); } public static string GetFormattedSpread(decimal spread, int precision, int pipsPosition) { var delta = precision - pipsPosition; if (delta > 0) { return spread.ToString("0." + new string('0', delta), CultureInfo.InvariantCulture); } return spread.ToString("0"); } } }
namespace Adaptive.ReactiveTrader.Client.UI.SpotTiles { public static class PriceFormatter { public static FormattedPrice GetFormattedPrice(decimal rate, int precision, int pipsPosition) { var rateAsString = rate.ToString("0." + new string('0', precision)); var dotIndex = rateAsString.IndexOf('.'); var bigFigures = rateAsString.Substring(0, dotIndex + pipsPosition - 1); var pips = rateAsString.Substring(dotIndex + pipsPosition - 1, 2); var tenthOfPips = ""; if (precision > pipsPosition) { tenthOfPips = rateAsString.Substring(dotIndex + pipsPosition + 1, rateAsString.Length - (dotIndex + pipsPosition + 1)); } return new FormattedPrice(bigFigures, pips, tenthOfPips); } public static string GetFormattedSpread(decimal spread, int precision, int pipsPosition) { var delta = precision - pipsPosition; if (delta > 0) { return spread.ToString("0." + new string('0', delta)); } return spread.ToString("0"); } } }
apache-2.0
C#
e9c94fb9c7593839e3105b632f9870a860832636
move DeleteProfileScorable to ScorableBase
yakumo/BotBuilder,yakumo/BotBuilder,xiangyan99/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,xiangyan99/BotBuilder,msft-shahins/BotBuilder,stevengum97/BotBuilder,msft-shahins/BotBuilder,xiangyan99/BotBuilder,stevengum97/BotBuilder,stevengum97/BotBuilder,xiangyan99/BotBuilder,msft-shahins/BotBuilder,stevengum97/BotBuilder,yakumo/BotBuilder
CSharp/Library/Dialogs/DeleteProfileScorable.cs
CSharp/Library/Dialogs/DeleteProfileScorable.cs
using Microsoft.Bot.Builder.Dialogs.Internals; using Microsoft.Bot.Builder.Internals.Fibers; using Microsoft.Bot.Builder.Internals.Scorables; using Microsoft.Bot.Builder.Resource; using Microsoft.Bot.Connector; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; namespace Microsoft.Bot.Builder.Dialogs { public sealed class DeleteProfileScorable : ScorableBase<IActivity, string, double> { private readonly IDialogStack stack; private readonly IBotData botData; private readonly IBotToUser botToUser; private readonly Regex regex; public DeleteProfileScorable(IDialogStack stack, IBotData botData, IBotToUser botToUser, Regex regex) { SetField.NotNull(out this.stack, nameof(stack), stack); SetField.NotNull(out this.botData, nameof(botData), botData); SetField.NotNull(out this.botToUser, nameof(botToUser), botToUser); SetField.NotNull(out this.regex, nameof(regex), regex); } public override async Task<string> PrepareAsync(IActivity activity, CancellationToken token) { var message = activity as IMessageActivity; if (message != null && message.Text != null) { var text = message.Text; var match = regex.Match(text); if (match.Success) { return match.Groups[0].Value; } } return null; } public override bool HasScore(IActivity item, string state) { return state != null; } public override double GetScore(IActivity item, string state) { return 1.0; } public override async Task PostAsync(IActivity item, string state, CancellationToken token) { this.stack.Reset(); botData.UserData.Clear(); botData.PrivateConversationData.Clear(); await botData.FlushAsync(token); await botToUser.PostAsync(Resources.UserProfileDeleted); } } }
using Microsoft.Bot.Builder.Dialogs.Internals; using Microsoft.Bot.Builder.Internals.Fibers; using Microsoft.Bot.Builder.Internals.Scorables; using Microsoft.Bot.Builder.Resource; using Microsoft.Bot.Connector; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; namespace Microsoft.Bot.Builder.Dialogs { public sealed class DeleteProfileScorable : IScorable<IActivity, double> { private readonly IDialogStack stack; private readonly IBotData botData; private readonly IBotToUser botToUser; private readonly Regex regex; public DeleteProfileScorable(IDialogStack stack, IBotData botData, IBotToUser botToUser, Regex regex) { SetField.NotNull(out this.stack, nameof(stack), stack); SetField.NotNull(out this.botData, nameof(botData), botData); SetField.NotNull(out this.botToUser, nameof(botToUser), botToUser); SetField.NotNull(out this.regex, nameof(regex), regex); } async Task<object> IScorable<IActivity, double>.PrepareAsync(IActivity activity, CancellationToken token) { var message = activity as IMessageActivity; if (message != null && message.Text != null) { var text = message.Text; var match = regex.Match(text); if (match.Success) { return match.Groups[0].Value; } } return null; } bool IScorable<IActivity, double>.HasScore(IActivity item, object state) { return state != null; } double IScorable<IActivity, double>.GetScore(IActivity item, object state) { return 1.0; } async Task IScorable<IActivity, double>.PostAsync(IActivity message, object state, CancellationToken token) { this.stack.Reset(); botData.UserData.Clear(); botData.PrivateConversationData.Clear(); await botData.FlushAsync(token); await botToUser.PostAsync(Resources.UserProfileDeleted); } } }
mit
C#
4a9e72588c5943aaf290905f855d639837fbc444
remove uneeded field
JackCeparou/JackCeparouCompass
Decorators/SoundAlertDecorator.cs
Decorators/SoundAlertDecorator.cs
namespace Turbo.Plugins.Jack.Decorators { using System; using System.Collections.Generic; using Turbo.Plugins.Default; using Turbo.Plugins.Jack.TextToSpeech; public class SoundAlertDecorator<T> : IWorldDecorator where T : IActor { public bool Enabled { get; set; } public IController Hud { get; private set; } public WorldLayer Layer { get; private set; } public SoundAlert<T> SoundAlert { get; private set; } public SoundAlertDecorator() { Enabled = true; } public SoundAlertDecorator(IController hud) { Hud = hud; Enabled = true; Layer = WorldLayer.Ground; } public SoundAlertDecorator(IController hud, SoundAlert<T> soundAlert = null) : this(hud) { SoundAlert = soundAlert ?? new SoundAlert<T>() { TextFunc = (actor) => actor.SnoActor.NameLocalized }; } public void Paint(IActor actor, IWorldCoordinate coord, string text) { if (!Enabled) return; if (actor == null) return; SoundAlertManagerPlugin.Register<T>(actor, SoundAlert); } public IEnumerable<ITransparent> GetTransparents() { yield break; } } }
namespace Turbo.Plugins.Jack.Decorators { using System; using System.Collections.Generic; using Turbo.Plugins.Default; using Turbo.Plugins.Jack.TextToSpeech; public class SoundAlertDecorator<T> : IWorldDecorator where T : IActor { public bool Enabled { get; set; } public IController Hud { get; private set; } public WorldLayer Layer { get; private set; } public SoundAlert<T> SoundAlert { get; private set; } private static IController _hud; public SoundAlertDecorator() { Enabled = true; } public SoundAlertDecorator(IController hud) { Hud = _hud = hud; Enabled = true; Layer = WorldLayer.Ground; } public SoundAlertDecorator(IController hud, SoundAlert<T> soundAlert = null) : this(hud) { SoundAlert = soundAlert ?? new SoundAlert<T>() { TextFunc = (actor) => actor.SnoActor.NameLocalized }; } public void Paint(IActor actor, IWorldCoordinate coord, string text) { if (!Enabled) return; if (actor == null) return; SoundAlertManagerPlugin.Register<T>(actor, SoundAlert); } public IEnumerable<ITransparent> GetTransparents() { yield break; } } }
mit
C#
02f176e081b38351ef188082f8b01c39cfe07764
Reorder using directives
verdentk/aspnetboilerplate,virtualcca/aspnetboilerplate,ryancyq/aspnetboilerplate,beratcarsi/aspnetboilerplate,zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,ilyhacker/aspnetboilerplate,oceanho/aspnetboilerplate,ilyhacker/aspnetboilerplate,zclmoon/aspnetboilerplate,fengyeju/aspnetboilerplate,fengyeju/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,oceanho/aspnetboilerplate,zclmoon/aspnetboilerplate,verdentk/aspnetboilerplate,ryancyq/aspnetboilerplate,oceanho/aspnetboilerplate,luchaoshuai/aspnetboilerplate,Nongzhsh/aspnetboilerplate,Nongzhsh/aspnetboilerplate,carldai0106/aspnetboilerplate,virtualcca/aspnetboilerplate,ilyhacker/aspnetboilerplate,carldai0106/aspnetboilerplate,beratcarsi/aspnetboilerplate,beratcarsi/aspnetboilerplate,carldai0106/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,andmattia/aspnetboilerplate,AlexGeller/aspnetboilerplate,fengyeju/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,andmattia/aspnetboilerplate,Nongzhsh/aspnetboilerplate,AlexGeller/aspnetboilerplate,andmattia/aspnetboilerplate,verdentk/aspnetboilerplate,AlexGeller/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate
test/Abp.ZeroCore.SampleApp/EntityFramework/SampleAppDbContext.cs
test/Abp.ZeroCore.SampleApp/EntityFramework/SampleAppDbContext.cs
using Abp.IdentityServer4; using Abp.Zero.EntityFrameworkCore; using Abp.ZeroCore.SampleApp.Core; using Abp.ZeroCore.SampleApp.Core.EntityHistory; using Microsoft.EntityFrameworkCore; namespace Abp.ZeroCore.SampleApp.EntityFramework { //TODO: Re-enable when IdentityServer ready public class SampleAppDbContext : AbpZeroDbContext<Tenant, Role, User, SampleAppDbContext>, IAbpPersistedGrantDbContext { public DbSet<PersistedGrantEntity> PersistedGrants { get; set; } public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; } public SampleAppDbContext(DbContextOptions<SampleAppDbContext> options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.ConfigurePersistedGrantEntity(); } } }
using Abp.Zero.EntityFrameworkCore; using Abp.ZeroCore.SampleApp.Core; using Abp.ZeroCore.SampleApp.Core.EntityHistory; using Microsoft.EntityFrameworkCore; using Abp.IdentityServer4; namespace Abp.ZeroCore.SampleApp.EntityFramework { //TODO: Re-enable when IdentityServer ready public class SampleAppDbContext : AbpZeroDbContext<Tenant, Role, User, SampleAppDbContext>, IAbpPersistedGrantDbContext { public DbSet<PersistedGrantEntity> PersistedGrants { get; set; } public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; } public SampleAppDbContext(DbContextOptions<SampleAppDbContext> options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.ConfigurePersistedGrantEntity(); } } }
mit
C#
c61666bfdc70bf4f865e96d72bcd8ea70ad4ac07
fix typo in Orchard.Widgets.RuleEngine.cs
rtpHarry/Orchard,johnnyqian/Orchard,AdvantageCS/Orchard,abhishekluv/Orchard,rtpHarry/Orchard,SouleDesigns/SouleDesigns.Orchard,grapto/Orchard.CloudBust,sfmskywalker/Orchard,hbulzy/Orchard,yersans/Orchard,Dolphinsimon/Orchard,Codinlab/Orchard,sfmskywalker/Orchard,bedegaming-aleksej/Orchard,jagraz/Orchard,xkproject/Orchard,yersans/Orchard,yersans/Orchard,aaronamm/Orchard,Serlead/Orchard,grapto/Orchard.CloudBust,AdvantageCS/Orchard,johnnyqian/Orchard,IDeliverable/Orchard,bedegaming-aleksej/Orchard,OrchardCMS/Orchard,xkproject/Orchard,Lombiq/Orchard,yersans/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,Dolphinsimon/Orchard,jimasp/Orchard,Lombiq/Orchard,AdvantageCS/Orchard,Codinlab/Orchard,Fogolan/OrchardForWork,omidnasri/Orchard,li0803/Orchard,hannan-azam/Orchard,ehe888/Orchard,gcsuk/Orchard,sfmskywalker/Orchard,fassetar/Orchard,brownjordaninternational/OrchardCMS,ehe888/Orchard,SouleDesigns/SouleDesigns.Orchard,jagraz/Orchard,omidnasri/Orchard,armanforghani/Orchard,jchenga/Orchard,aaronamm/Orchard,hbulzy/Orchard,jtkech/Orchard,sfmskywalker/Orchard,jchenga/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,fassetar/Orchard,jtkech/Orchard,hbulzy/Orchard,Praggie/Orchard,abhishekluv/Orchard,jtkech/Orchard,Serlead/Orchard,tobydodds/folklife,rtpHarry/Orchard,tobydodds/folklife,Fogolan/OrchardForWork,aaronamm/Orchard,ehe888/Orchard,li0803/Orchard,Lombiq/Orchard,brownjordaninternational/OrchardCMS,LaserSrl/Orchard,armanforghani/Orchard,SouleDesigns/SouleDesigns.Orchard,Praggie/Orchard,gcsuk/Orchard,bedegaming-aleksej/Orchard,IDeliverable/Orchard,OrchardCMS/Orchard,jtkech/Orchard,gcsuk/Orchard,hannan-azam/Orchard,hannan-azam/Orchard,rtpHarry/Orchard,sfmskywalker/Orchard,mvarblow/Orchard,jtkech/Orchard,armanforghani/Orchard,jimasp/Orchard,tobydodds/folklife,jersiovic/Orchard,jagraz/Orchard,mvarblow/Orchard,Lombiq/Orchard,IDeliverable/Orchard,johnnyqian/Orchard,Dolphinsimon/Orchard,omidnasri/Orchard,IDeliverable/Orchard,Codinlab/Orchard,tobydodds/folklife,li0803/Orchard,jchenga/Orchard,Praggie/Orchard,hbulzy/Orchard,phillipsj/Orchard,phillipsj/Orchard,vairam-svs/Orchard,Fogolan/OrchardForWork,jersiovic/Orchard,SouleDesigns/SouleDesigns.Orchard,johnnyqian/Orchard,omidnasri/Orchard,bedegaming-aleksej/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,jersiovic/Orchard,sfmskywalker/Orchard,AdvantageCS/Orchard,sfmskywalker/Orchard,SouleDesigns/SouleDesigns.Orchard,abhishekluv/Orchard,gcsuk/Orchard,bedegaming-aleksej/Orchard,ehe888/Orchard,sfmskywalker/Orchard,Serlead/Orchard,gcsuk/Orchard,abhishekluv/Orchard,Lombiq/Orchard,mvarblow/Orchard,LaserSrl/Orchard,fassetar/Orchard,aaronamm/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,abhishekluv/Orchard,Fogolan/OrchardForWork,fassetar/Orchard,Serlead/Orchard,omidnasri/Orchard,johnnyqian/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,armanforghani/Orchard,li0803/Orchard,hannan-azam/Orchard,jersiovic/Orchard,abhishekluv/Orchard,grapto/Orchard.CloudBust,grapto/Orchard.CloudBust,yersans/Orchard,phillipsj/Orchard,jchenga/Orchard,vairam-svs/Orchard,Praggie/Orchard,tobydodds/folklife,fassetar/Orchard,OrchardCMS/Orchard,jersiovic/Orchard,hbulzy/Orchard,Dolphinsimon/Orchard,LaserSrl/Orchard,omidnasri/Orchard,mvarblow/Orchard,omidnasri/Orchard,jimasp/Orchard,LaserSrl/Orchard,jagraz/Orchard,Codinlab/Orchard,armanforghani/Orchard,IDeliverable/Orchard,hannan-azam/Orchard,jagraz/Orchard,AdvantageCS/Orchard,grapto/Orchard.CloudBust,grapto/Orchard.CloudBust,jchenga/Orchard,ehe888/Orchard,phillipsj/Orchard,OrchardCMS/Orchard,li0803/Orchard,aaronamm/Orchard,xkproject/Orchard,Fogolan/OrchardForWork,vairam-svs/Orchard,phillipsj/Orchard,brownjordaninternational/OrchardCMS,tobydodds/folklife,omidnasri/Orchard,Praggie/Orchard,jimasp/Orchard,jimasp/Orchard,Dolphinsimon/Orchard,vairam-svs/Orchard,mvarblow/Orchard,vairam-svs/Orchard,Codinlab/Orchard,rtpHarry/Orchard,xkproject/Orchard,brownjordaninternational/OrchardCMS,LaserSrl/Orchard,brownjordaninternational/OrchardCMS,omidnasri/Orchard,Serlead/Orchard,xkproject/Orchard,OrchardCMS/Orchard
src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs
src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs
using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; using Orchard.Localization; using Orchard.Scripting; using Orchard.Widgets.Services; namespace Orchard.Widgets.RuleEngine { public class RuleManager : IRuleManager { private readonly IRuleProvider _ruleProviders; private readonly IEnumerable<IScriptExpressionEvaluator> _evaluators; public RuleManager(IRuleProvider ruleProviders, IEnumerable<IScriptExpressionEvaluator> evaluators) { _ruleProviders = ruleProviders; _evaluators = evaluators; T = NullLocalizer.Instance; } public Localizer T { get; set; } public bool Matches(string expression) { var evaluator = _evaluators.FirstOrDefault(); if (evaluator == null) { throw new OrchardException(T("There are currently no scripting engine's enabled")); } var result = evaluator.Evaluate(expression, new List<IGlobalMethodProvider> { new GlobalMethodProvider(this) }); if (!(result is bool)) { throw new OrchardException(T("Expression is not a boolean value")); } return (bool)result; } private class GlobalMethodProvider : IGlobalMethodProvider { private readonly RuleManager _ruleManager; public GlobalMethodProvider(RuleManager ruleManager) { _ruleManager = ruleManager; } public void Process(GlobalMethodContext context) { var ruleContext = new RuleContext { FunctionName = context.FunctionName, Arguments = context.Arguments.ToArray(), Result = context.Result }; _ruleManager._ruleProviders.Process(ruleContext); context.Result = ruleContext.Result; } } } }
using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; using Orchard.Localization; using Orchard.Scripting; using Orchard.Widgets.Services; namespace Orchard.Widgets.RuleEngine { public class RuleManager : IRuleManager { private readonly IRuleProvider _ruleProviders; private readonly IEnumerable<IScriptExpressionEvaluator> _evaluators; public RuleManager(IRuleProvider ruleProviders, IEnumerable<IScriptExpressionEvaluator> evaluators) { _ruleProviders = ruleProviders; _evaluators = evaluators; T = NullLocalizer.Instance; } public Localizer T { get; set; } public bool Matches(string expression) { var evaluator = _evaluators.FirstOrDefault(); if (evaluator == null) { throw new OrchardException(T("There are currently not scripting engine enabled")); } var result = evaluator.Evaluate(expression, new List<IGlobalMethodProvider> { new GlobalMethodProvider(this) }); if (!(result is bool)) { throw new OrchardException(T("Expression is not a boolean value")); } return (bool)result; } private class GlobalMethodProvider : IGlobalMethodProvider { private readonly RuleManager _ruleManager; public GlobalMethodProvider(RuleManager ruleManager) { _ruleManager = ruleManager; } public void Process(GlobalMethodContext context) { var ruleContext = new RuleContext { FunctionName = context.FunctionName, Arguments = context.Arguments.ToArray(), Result = context.Result }; _ruleManager._ruleProviders.Process(ruleContext); context.Result = ruleContext.Result; } } } }
bsd-3-clause
C#
8aeeed9402e2de7d6de6e477adc69bf914ed6f0c
Fix weird number formatting in test
peppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,peppy/osu,peppy/osu-new,ppy/osu
osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableScoreCounter.cs
osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableScoreCounter.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.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Testing; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Play.HUD; namespace osu.Game.Tests.Visual.Gameplay { public class TestSceneSkinnableScoreCounter : SkinnableTestScene { private IEnumerable<SkinnableScoreCounter> scoreCounters => CreatedDrawables.OfType<SkinnableScoreCounter>(); protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset(); [SetUpSteps] public void SetUpSteps() { AddStep("Create combo counters", () => SetContents(() => { var comboCounter = new SkinnableScoreCounter(); comboCounter.Current.Value = 1; return comboCounter; })); } [Test] public void TestScoreCounterIncrementing() { AddStep(@"Reset all", delegate { foreach (var s in scoreCounters) s.Current.Value = 0; }); AddStep(@"Hit! :D", delegate { foreach (var s in scoreCounters) s.Current.Value += 300; }); } [Test] public void TestVeryLargeScore() { AddStep("set large score", () => scoreCounters.ForEach(counter => counter.Current.Value = 1_000_000_000)); } } }
// 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.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Testing; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Play.HUD; namespace osu.Game.Tests.Visual.Gameplay { public class TestSceneSkinnableScoreCounter : SkinnableTestScene { private IEnumerable<SkinnableScoreCounter> scoreCounters => CreatedDrawables.OfType<SkinnableScoreCounter>(); protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset(); [SetUpSteps] public void SetUpSteps() { AddStep("Create combo counters", () => SetContents(() => { var comboCounter = new SkinnableScoreCounter(); comboCounter.Current.Value = 1; return comboCounter; })); } [Test] public void TestScoreCounterIncrementing() { AddStep(@"Reset all", delegate { foreach (var s in scoreCounters) s.Current.Value = 0; }); AddStep(@"Hit! :D", delegate { foreach (var s in scoreCounters) s.Current.Value += 300; }); } [Test] public void TestVeryLargeScore() { AddStep("set large score", () => scoreCounters.ForEach(counter => counter.Current.Value = 1_00_000_000)); } } }
mit
C#
2d4b7dc361ca061fd74cef1654ab86875c58d518
Remove redundant code
smoogipoo/osu,ppy/osu,peppy/osu-new,smoogipoo/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu,2yangk23/osu,UselessToucan/osu,ppy/osu,ppy/osu,UselessToucan/osu,johnneijzen/osu,EVAST9919/osu,EVAST9919/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,johnneijzen/osu,smoogipooo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu
osu.Game/Screens/Edit/Compose/Components/CircularBeatSnapGrid.cs
osu.Game/Screens/Edit/Compose/Components/CircularBeatSnapGrid.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; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Rulesets.Objects; using osuTK; namespace osu.Game.Screens.Edit.Compose.Components { public abstract class CircularBeatSnapGrid : BeatSnapGrid { protected CircularBeatSnapGrid(HitObject hitObject, Vector2 centrePosition) : base(hitObject, centrePosition) { } protected override void CreateContent(Vector2 centrePosition) { float dx = Math.Max(centrePosition.X, DrawWidth - centrePosition.X); float dy = Math.Max(centrePosition.Y, DrawHeight - centrePosition.Y); float maxDistance = new Vector2(dx, dy).Length; int requiredCircles = (int)(maxDistance / DistanceSpacing); for (int i = 0; i < requiredCircles; i++) { float radius = (i + 1) * DistanceSpacing * 2; AddInternal(new CircularProgress { Origin = Anchor.Centre, Position = centrePosition, Current = { Value = 1 }, Size = new Vector2(radius), InnerRadius = 4 * 1f / radius, Colour = GetColourForBeatIndex(i) }); } } public override Vector2 GetSnapPosition(Vector2 position) { Vector2 direction = position - CentrePosition; float distance = direction.Length; float radius = DistanceSpacing; int radialCount = Math.Max(1, (int)Math.Round(distance / radius)); Vector2 normalisedDirection = direction * new Vector2(1f / distance); return CentrePosition + normalisedDirection * radialCount * radius; } } }
// 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; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Rulesets.Objects; using osuTK; namespace osu.Game.Screens.Edit.Compose.Components { public abstract class CircularBeatSnapGrid : BeatSnapGrid { protected CircularBeatSnapGrid(HitObject hitObject, Vector2 centrePosition) : base(hitObject, centrePosition) { } protected override void CreateContent(Vector2 centrePosition) { float dx = Math.Max(centrePosition.X, DrawWidth - centrePosition.X); float dy = Math.Max(centrePosition.Y, DrawHeight - centrePosition.Y); float maxDistance = new Vector2(dx, dy).Length; int requiredCircles = (int)(maxDistance / DistanceSpacing); for (int i = 0; i < requiredCircles; i++) { float radius = (i + 1) * DistanceSpacing * 2; AddInternal(new CircularProgress { Origin = Anchor.Centre, Position = centrePosition, Current = { Value = 1 }, Size = new Vector2(radius), InnerRadius = 4 * 1f / radius, Colour = GetColourForBeatIndex(i) }); } } public override Vector2 GetSnapPosition(Vector2 position) { Vector2 direction = position - CentrePosition; float distance = direction.Length; float radius = DistanceSpacing; int radialCount = Math.Max(1, (int)Math.Round(distance / radius)); if (radialCount <= 0) return position; Vector2 normalisedDirection = direction * new Vector2(1f / distance); return CentrePosition + normalisedDirection * radialCount * radius; } } }
mit
C#
4564af60e9423e81a15f46f6f2d6659a9f3c791b
Fix typo in DataPager control sample
riganti/dotvvm-docs
Controls/builtin/DataPager/sample1/ViewModel.cs
Controls/builtin/DataPager/sample1/ViewModel.cs
using System; using System.Linq; using System.Threading.Tasks; using DotVVM.Framework.Controls; using DotVVM.Framework.ViewModel; namespace DotvvmWeb.Views.Docs.Controls.builtin.DataPager.sample1 { public class ViewModel : DotvvmViewModelBase { private static IQueryable<Customer> FakeDb() { return new[] { new Customer(0, "Dani Michele"), new Customer(1, "Elissa Malone"), new Customer(2, "Raine Damian"), new Customer(3, "Gerrard Petra"), new Customer(4, "Clement Ernie"), new Customer(5, "Rod Fred"), new Customer(6, "Oliver Carr"), new Customer(7, "Jackson James"), new Customer(8, "Dexter Nicholson"), new Customer(9, "Jamie Rees"), new Customer(10, "Jackson Ross"), new Customer(11, "Alonso Sims"), new Customer(12, "Zander Britt"), new Customer(13, "Isaias Ford"), new Customer(14, "Braden Huffman"), new Customer(15, "Frederick Simpson"), new Customer(16, "Charlie Andrews"), new Customer(17, "Reuben Byrne") }.AsQueryable(); } // NOTE: Method for load data from IQueryable private GridViewDataSetLoadedData<Customer> GetData(IGridViewDataSetLoadOptions gridViewDataSetLoadOptions) { var queryable = FakeDb(); // NOTE: Apply Paging and Sorting options. return queryable.GetDataFromQueryable(gridViewDataSetLoadOptions); } public GridViewDataSet<Customer> Customers { get; set; } public override Task Init() { // NOTE: You can also create the DataSet with factory. // Just call static Create with delegate and pagesize. Customers = GridViewDataSet.Create(gridViewDataSetLoadDelegate: GetData, pageSize: 4); return base.Init(); } } public class Customer { public int Id { get; set; } public string Name { get; set; } public Customer() { // NOTE: This default constructor is required. // Remember that the viewmodel is JSON-serialized // which requires all objects to have a public // parameterless constructor } public Customer(int id, string name) { Id = id; Name = name; } } }
using System; using System.Linq; using System.Threading.Tasks; using DotVVM.Framework.Controls; using DotVVM.Framework.ViewModel; namespace DotvvmWeb.Views.Docs.Controls.builtin.DataPager.sample1 { public class ViewModel : DotvvmViewModelBase { private static IQueryable<Customer> FakeDb() { return new[] { new Customer(0, "Dani Michele"), new Customer(1, "Elissa Malone"), new Customer(2, "Raine Damian"), new Customer(3, "Gerrard Petra"), new Customer(4, "Clement Ernie"), new Customer(5, "Rod Fred"), new Customer(6, "Oliver Carr"), new Customer(7, "Jackson James"), new Customer(8, "Dexter Nicholson"), new Customer(9, "Jamie Rees"), new Customer(10, "Jackson Ross"), new Customer(11, "Alonso Sims"), new Customer(12, "Zander Britt"), new Customer(13, "Isaias Ford"), new Customer(14, "Braden Huffman"), new Customer(15, "Frederick Simpson"), new Customer(16, "Charlie Andrews"), new Customer(17, "Reuben Byrne") }.AsQueryable(); } // NOTE: Method for load data from IQueryable private GridViewDataSetLoadedData<Customer> GetData(IGridViewDataSetLoadOptions gridViewDataSetLoadOptions) { var queryable = FakeDb(); // NOTE: Apply Pagign and Sorting options. return queryable.GetDataFromQueryable(gridViewDataSetLoadOptions); } public GridViewDataSet<Customer> Customers { get; set; } public override Task Init() { // NOTE: You can also create the DataSet with factory. // Just call static Create with delegate and pagesize. Customers = GridViewDataSet.Create(gridViewDataSetLoadDelegate: GetData, pageSize: 4); return base.Init(); } } public class Customer { public int Id { get; set; } public string Name { get; set; } public Customer() { // NOTE: This default constructor is required. // Remember that the viewmodel is JSON-serialized // which requires all objects to have a public // parameterless constructor } public Customer(int id, string name) { Id = id; Name = name; } } }
apache-2.0
C#
cdf73ef95c0cdcc80fe67575723570495e4c27dd
update Info
Ye-Yong-Chi/NewBeanfunLogin4TWMS,Inndy/NewBeanfunLogin4TWMS
NewBeanfunLogin/Properties/AssemblyInfo.cs
NewBeanfunLogin/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 組件的一般資訊是由下列的屬性集控制。 // 變更這些屬性的值即可修改組件的相關 // 資訊。 [assembly: AssemblyTitle("NewBeanfunLogin")] [assembly: AssemblyDescription("MapleStory Launcher")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("KNowlet")] [assembly: AssemblyProduct("NewBeanfunLogin")] [assembly: AssemblyCopyright("Copyright © Inndy 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 將 ComVisible 設定為 false 會使得這個組件中的型別 // 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中 // 的型別,請在該型別上將 ComVisible 屬性設定為 true。 [assembly: ComVisible(false)] // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID [assembly: Guid("12549306-df15-4e26-aef2-efccf03e89f2")] // 組件的版本資訊是由下列四項值構成: // // 主要版本 // 次要版本 // 組建編號 // 修訂編號 // // 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號 // 指定為預設值: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 組件的一般資訊是由下列的屬性集控制。 // 變更這些屬性的值即可修改組件的相關 // 資訊。 [assembly: AssemblyTitle("NewBeanfunLogin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Inndy")] [assembly: AssemblyProduct("NewBeanfunLogin")] [assembly: AssemblyCopyright("Copyright © Inndy 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 將 ComVisible 設定為 false 會使得這個組件中的型別 // 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中 // 的型別,請在該型別上將 ComVisible 屬性設定為 true。 [assembly: ComVisible(false)] // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID [assembly: Guid("12549306-df15-4e26-aef2-efccf03e89f2")] // 組件的版本資訊是由下列四項值構成: // // 主要版本 // 次要版本 // 組建編號 // 修訂編號 // // 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號 // 指定為預設值: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
6662bb7fff6c77e7080505d5dd30471b688a142e
allow only specifying min range
prime31/Nez,prime31/Nez,prime31/Nez,ericmbernier/Nez
Nez.Portable/Debug/Inspector/Attributes.cs
Nez.Portable/Debug/Inspector/Attributes.cs
using System; namespace Nez { /// <summary> /// Attribute that is used to indicate that the field/property should be present in the inspector /// </summary> [AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )] public class InspectableAttribute : Attribute {} /// <summary> /// Attribute that is used to indicate that the field/property should not be present in the inspector /// </summary> [AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )] public class NotInspectableAttribute : Attribute {} /// <summary> /// adding this to a method will expose it to the inspector if it has 0 params or 1 param of a supported type: int, float, string /// and bool are currently supported. /// </summary> [AttributeUsage( AttributeTargets.Method )] public class InspectorCallableAttribute : InspectableAttribute {} /// <summary> /// displays a tooltip when hovering over the label of any inspectable elements /// </summary> [AttributeUsage( AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method )] public class TooltipAttribute : InspectableAttribute { public string tooltip; public TooltipAttribute( string tooltip ) { this.tooltip = tooltip; } } /// <summary> /// Range attribute. Tells the inspector you want a slider to be displayed for a float/int /// </summary> [AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )] public class RangeAttribute : InspectableAttribute { public float minValue; public float maxValue; public float stepSize = 1; public bool useDragVersion; public RangeAttribute( float minValue ) { this.minValue = minValue; // magic number! This is the highest number ImGui functions properly with for some reason. maxValue = int.MaxValue - 100; useDragVersion = true; } public RangeAttribute( float minValue, float maxValue, float stepSize ) { this.minValue = minValue; this.maxValue = maxValue; this.stepSize = stepSize; } public RangeAttribute( float minValue, float maxValue, bool useDragFloat ) { this.minValue = minValue; this.maxValue = maxValue; this.useDragVersion = useDragFloat; } public RangeAttribute( float minValue, float maxValue ) : this( minValue, maxValue, 0.1f ) { } } /// <summary> /// putting this attribute on a class and specifying a subclass of Inspector lets you create custom inspectors for any type. When /// the Inspector finds a field/property of the type with the attribute on it the inspectorType will be instantiated and used. /// Inspectors are only active in DEBUG builds so make sure to wrap your custom inspector subclass in #if DEBUG/#endif. /// </summary> [AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct )] public class CustomInspectorAttribute : Attribute { public Type inspectorType; public CustomInspectorAttribute( Type inspectorType ) { this.inspectorType = inspectorType; } } }
using System; namespace Nez { /// <summary> /// Attribute that is used to indicate that the field/property should be present in the inspector /// </summary> [AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )] public class InspectableAttribute : Attribute {} /// <summary> /// Attribute that is used to indicate that the field/property should not be present in the inspector /// </summary> [AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )] public class NotInspectableAttribute : Attribute {} /// <summary> /// adding this to a method will expose it to the inspector if it has 0 params or 1 param of a supported type: int, float, string /// and bool are currently supported. /// </summary> [AttributeUsage( AttributeTargets.Method )] public class InspectorCallableAttribute : InspectableAttribute {} /// <summary> /// displays a tooltip when hovering over the label of any inspectable elements /// </summary> [AttributeUsage( AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method )] public class TooltipAttribute : InspectableAttribute { public string tooltip; public TooltipAttribute( string tooltip ) { this.tooltip = tooltip; } } /// <summary> /// Range attribute. Tells the inspector you want a slider to be displayed for a float/int /// </summary> [AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )] public class RangeAttribute : InspectableAttribute { public float minValue, maxValue, stepSize; public bool useDragVersion; public RangeAttribute( float minValue, float maxValue, float stepSize ) { this.minValue = minValue; this.maxValue = maxValue; this.stepSize = stepSize; } public RangeAttribute( float minValue, float maxValue, bool useDragFloat ) { this.minValue = minValue; this.maxValue = maxValue; this.useDragVersion = useDragFloat; } public RangeAttribute( float minValue, float maxValue ) : this( minValue, maxValue, 0.1f ) { } } /// <summary> /// putting this attribute on a class and specifying a subclass of Inspector lets you create custom inspectors for any type. When /// the Inspector finds a field/property of the type with the attribute on it the inspectorType will be instantiated and used. /// Inspectors are only active in DEBUG builds so make sure to wrap your custom inspector subclass in #if DEBUG/#endif. /// </summary> [AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct )] public class CustomInspectorAttribute : Attribute { public Type inspectorType; public CustomInspectorAttribute( Type inspectorType ) { this.inspectorType = inspectorType; } } }
mit
C#
bce785e792cbeff3494ce821f8d0d29030e2a626
use IRichArtifact interface for generic metadata collection in Curation.
ecologylab/BigSemanticsWrapperRepository,ecologylab/BigSemanticsWrapperRepository,ecologylab/BigSemanticsWrapperRepository
BigSemantics.GeneratedClassesCSharp/Library/CurationNS/Curation.cs
BigSemantics.GeneratedClassesCSharp/Library/CurationNS/Curation.cs
// // Curation.cs // s.im.pl serialization // // Generated by MetaMetadataDotNetTranslator. // Copyright 2014 Interface Ecology Lab. // using Ecologylab.BigSemantics.Generated.Library.CreativeWorkNS; using Ecologylab.BigSemantics.MetaMetadataNS; using Ecologylab.BigSemantics.MetadataNS; using Ecologylab.BigSemantics.MetadataNS.Builtins; using Ecologylab.BigSemantics.MetadataNS.Scalar; using Ecologylab.Collections; using Simpl.Fundamental.Generic; using Simpl.Serialization; using Simpl.Serialization.Attributes; using System; using System.Collections; using System.Collections.Generic; namespace Ecologylab.BigSemantics.Generated.Library.CurationNS { [SimplInherit] public class Curation : CreativeWork { [SimplCollection] [SimplScope("rich_artifacts_scope")] [MmName("metadata_collection")] private List<IRichArtifact<Metadata>> metadataCollection; [SimplScalar] private MetadataString curationAppVersion; [SimplScalar] private MetadataString curationApp; [SimplScalar] private MetadataString crossPlatformVersion; public Curation() { } public Curation(MetaMetadataCompositeField mmd) : base(mmd) { } public List<IRichArtifact<Metadata>> MetadataCollection { get{return metadataCollection;} set { if (this.metadataCollection != value) { this.metadataCollection = value; // TODO we need to implement our property change notification mechanism. } } } public MetadataString CurationAppVersion { get{return curationAppVersion;} set { if (this.curationAppVersion != value) { this.curationAppVersion = value; // TODO we need to implement our property change notification mechanism. } } } public MetadataString CurationApp { get{return curationApp;} set { if (this.curationApp != value) { this.curationApp = value; // TODO we need to implement our property change notification mechanism. } } } public MetadataString CrossPlatformVersion { get{return crossPlatformVersion;} set { if (this.crossPlatformVersion != value) { this.crossPlatformVersion = value; // TODO we need to implement our property change notification mechanism. } } } } }
// // Curation.cs // s.im.pl serialization // // Generated by MetaMetadataDotNetTranslator. // Copyright 2014 Interface Ecology Lab. // using Ecologylab.BigSemantics.Generated.Library.CreativeWorkNS; using Ecologylab.BigSemantics.MetaMetadataNS; using Ecologylab.BigSemantics.MetadataNS; using Ecologylab.BigSemantics.MetadataNS.Builtins; using Ecologylab.BigSemantics.MetadataNS.Scalar; using Ecologylab.Collections; using Simpl.Fundamental.Generic; using Simpl.Serialization; using Simpl.Serialization.Attributes; using System; using System.Collections; using System.Collections.Generic; namespace Ecologylab.BigSemantics.Generated.Library.CurationNS { [SimplInherit] public class Curation : CreativeWork { [SimplCollection] [SimplScope("rich_artifacts_scope")] [MmName("metadata_collection")] private List<RichArtifact<Metadata>> metadataCollection; [SimplScalar] private MetadataString curationAppVersion; [SimplScalar] private MetadataString curationApp; [SimplScalar] private MetadataString crossPlatformVersion; public Curation() { } public Curation(MetaMetadataCompositeField mmd) : base(mmd) { } public List<RichArtifact<Metadata>> MetadataCollection { get{return metadataCollection;} set { if (this.metadataCollection != value) { this.metadataCollection = value; // TODO we need to implement our property change notification mechanism. } } } public MetadataString CurationAppVersion { get{return curationAppVersion;} set { if (this.curationAppVersion != value) { this.curationAppVersion = value; // TODO we need to implement our property change notification mechanism. } } } public MetadataString CurationApp { get{return curationApp;} set { if (this.curationApp != value) { this.curationApp = value; // TODO we need to implement our property change notification mechanism. } } } public MetadataString CrossPlatformVersion { get{return crossPlatformVersion;} set { if (this.crossPlatformVersion != value) { this.crossPlatformVersion = value; // TODO we need to implement our property change notification mechanism. } } } } }
apache-2.0
C#
7e3c4ab83e4655ae456061def1de40c1692d72f2
fix Unpublished constant to use the BaseUtcOffset
campersau/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer,BreeeZe/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer
Core/Packages/Constants.cs
Core/Packages/Constants.cs
using System; namespace NuGet { public static class Constants { internal const string PackageServiceEntitySetName = "Packages"; internal const string PackageRelationshipNamespace = "http://schemas.microsoft.com/packaging/2010/07/"; public static readonly string PackageExtension = ".nupkg"; public static readonly string ManifestExtension = ".nuspec"; public static readonly string ContentDirectory = "content"; public static readonly string LibDirectory = "lib"; public static readonly string ToolsDirectory = "tools"; public static readonly string BuildDirectory = "build"; // Starting from nuget 2.0, we use a file with the special name '_._' to represent an empty folder. public const string PackageEmptyFileName = "_._"; // This is temporary until we fix the gallery to have proper first class support for this. // The magic unpublished date is 1900-01-01T00:00:00 public static readonly DateTimeOffset Unpublished = new DateTimeOffset(1900, 1, 1, 0, 0, 0, TimeZoneInfo.Local.BaseUtcOffset); } }
using System; namespace NuGet { public static class Constants { internal const string PackageServiceEntitySetName = "Packages"; internal const string PackageRelationshipNamespace = "http://schemas.microsoft.com/packaging/2010/07/"; public static readonly string PackageExtension = ".nupkg"; public static readonly string ManifestExtension = ".nuspec"; public static readonly string ContentDirectory = "content"; public static readonly string LibDirectory = "lib"; public static readonly string ToolsDirectory = "tools"; public static readonly string BuildDirectory = "build"; // Starting from nuget 2.0, we use a file with the special name '_._' to represent an empty folder. public const string PackageEmptyFileName = "_._"; // This is temporary until we fix the gallery to have proper first class support for this. // The magic unpublished date is 1900-01-01T00:00:00 public static readonly DateTimeOffset Unpublished = new DateTimeOffset(1900, 1, 1, 0, 0, 0, TimeSpan.FromHours(-8)); } }
mit
C#
73173a4d859a165420e6f8c3d445bfb9417f97b1
Make taskbar jump list show last part of path (folder name)
michael-reichenauer/GitMind
GitMind/Common/JUmpListService.cs
GitMind/Common/JUmpListService.cs
using System.IO; using System.Windows; using System.Windows.Shell; using GitMind.ApplicationHandling.SettingsHandling; namespace GitMind.Common { public class JumpListService { private static readonly int MaxTitleLength = 25; public void Add(string workingFolder) { JumpList jumpList = JumpList.GetJumpList(Application.Current) ?? new JumpList(); string folderName = Path.GetFileName(workingFolder) ?? workingFolder; string title = folderName.Length < MaxTitleLength ? folderName : folderName.Substring(0, MaxTitleLength) + "..."; JumpTask jumpTask = new JumpTask(); jumpTask.Title = title; jumpTask.ApplicationPath = ProgramPaths.GetInstallFilePath(); jumpTask.Arguments = $"/d:\"{workingFolder}\""; jumpTask.IconResourcePath = ProgramPaths.GetInstallFilePath(); jumpTask.Description = workingFolder; jumpList.ShowRecentCategory = true; JumpList.AddToRecentCategory(jumpTask); JumpList.SetJumpList(Application.Current, jumpList); } } }
using System.Windows; using System.Windows.Shell; using GitMind.ApplicationHandling.SettingsHandling; namespace GitMind.Common { public class JumpListService { private static readonly int MaxTitleLength = 25; public void Add(string workingFolder) { JumpList jumpList = JumpList.GetJumpList(Application.Current) ?? new JumpList(); string title = workingFolder.Length < MaxTitleLength ? workingFolder : "..." + workingFolder.Substring(workingFolder.Length - MaxTitleLength); JumpTask jumpTask = new JumpTask(); jumpTask.Title = title; jumpTask.ApplicationPath = ProgramPaths.GetInstallFilePath(); jumpTask.Arguments = $"/d:\"{workingFolder}\""; jumpTask.IconResourcePath = ProgramPaths.GetInstallFilePath(); jumpTask.Description = workingFolder; jumpList.ShowRecentCategory = true; JumpList.AddToRecentCategory(jumpTask); JumpList.SetJumpList(Application.Current, jumpList); } } }
mit
C#
0f3daf5c889b60a8776b2d9f15bc4c80e453e74d
test cases
jefking/King.B-Trak
King.BTrak.Unit.Test/TableStorageWriterTests.cs
King.BTrak.Unit.Test/TableStorageWriterTests.cs
namespace King.BTrak.Unit.Test { using King.Azure.Data; using NSubstitute; using NUnit.Framework; using System; [TestFixture] public class TableStorageWriterTests { [Test] public void Constructor() { var table = Substitute.For<ITableStorage>(); new TableStorageWriter(table); } [Test] [ExpectedException(typeof(ArgumentNullException))] public void ConstructorTableNull() { new TableStorageWriter(null); } [Test] public void IsITableStorageWriter() { var table = Substitute.For<ITableStorage>(); Assert.IsNotNull(new TableStorageWriter(table) as ITableStorageWriter); } } }
namespace King.BTrak.Unit.Test { using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; [TestFixture] public class TableStorageWriterTests { } }
mit
C#
732889a14528f8f1c0c81b39c2a898fdd9666d00
Validate action expressions
NRules/NRules,prashanthr/NRules,StanleyGoldman/NRules,StanleyGoldman/NRules
src/NRules/NRules.RuleModel/Builders/ActionGroupBuilder.cs
src/NRules/NRules.RuleModel/Builders/ActionGroupBuilder.cs
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace NRules.RuleModel.Builders { /// <summary> /// Builder to compose a group of rule actions. /// </summary> public class ActionGroupBuilder : RuleElementBuilder, IBuilder<ActionGroupElement> { private readonly List<ActionElement> _actions = new List<ActionElement>(); internal ActionGroupBuilder(SymbolTable scope) : base(scope) { } /// <summary> /// Adds a rule action to the group. /// </summary> /// <param name="expression">Rule action expression.</param> public void Action(LambdaExpression expression) { if (expression.Parameters.Count == 0 || expression.Parameters.First().Type != typeof(IContext)) { throw new ArgumentException( string.Format("Action expression must have {0} as its first parameter", typeof(IContext))); } IEnumerable<ParameterExpression> parameters = expression.Parameters.Skip(1); IEnumerable<Declaration> declarations = parameters.Select(p => Scope.Lookup(p.Name, p.Type)); var actionElement = new ActionElement(declarations, expression); _actions.Add(actionElement); } public ActionGroupElement Build() { var actionGroup = new ActionGroupElement(_actions); return actionGroup; } } }
using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace NRules.RuleModel.Builders { /// <summary> /// Builder to compose a group of rule actions. /// </summary> public class ActionGroupBuilder : RuleElementBuilder, IBuilder<ActionGroupElement> { private readonly List<ActionElement> _actions = new List<ActionElement>(); internal ActionGroupBuilder(SymbolTable scope) : base(scope) { } /// <summary> /// Adds a rule action to the group. /// </summary> /// <param name="expression">Rule action expression.</param> public void Action(LambdaExpression expression) { IEnumerable<Declaration> declarations = expression.Parameters.Skip(1).Select(p => Scope.Lookup(p.Name, p.Type)); var actionElement = new ActionElement(declarations, expression); _actions.Add(actionElement); } public ActionGroupElement Build() { var actionGroup = new ActionGroupElement(_actions); return actionGroup; } } }
mit
C#
0c4fbe4e454162d0d77ade22dfc4c7e0cf158142
Rename levenstein to levenshtein.
elastic/elasticsearch-net,elastic/elasticsearch-net
src/Nest/Search/Suggesters/TermSuggester/StringDistance.cs
src/Nest/Search/Suggesters/TermSuggester/StringDistance.cs
using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace Nest { [JsonConverter(typeof(StringEnumConverter))] public enum StringDistance { [EnumMember(Value = "internal")] Internal, [EnumMember(Value = "damerau_levenshtein")] DamerauLevenshtein, [EnumMember(Value = "levenshtein")] Levenshtein, [EnumMember(Value = "jarowinkler")] Jarowinkler, [EnumMember(Value = "ngram")] Ngram } }
using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace Nest { [JsonConverter(typeof(StringEnumConverter))] public enum StringDistance { [EnumMember(Value = "internal")] Internal, [EnumMember(Value = "damerau_levenshtein")] DamerauLevenshtein, [EnumMember(Value = "levenshtein")] Levenstein, [EnumMember(Value = "jarowinkler")] Jarowinkler, [EnumMember(Value = "ngram")] Ngram } }
apache-2.0
C#
1b53b5c93869a88e0b6892e9b7ff7775c7bd28c0
Use the .Data propertry as opposed to GetData in this PartialView
umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,bjarnef/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,madsoulswe/Umbraco-CMS,madsoulswe/Umbraco-CMS,leekelleher/Umbraco-CMS,mattbrailsford/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,NikRimington/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,NikRimington/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,leekelleher/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,madsoulswe/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,mattbrailsford/Umbraco-CMS,NikRimington/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,hfloyd/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,bjarnef/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS
src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml
src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml
@inherits UmbracoViewPage<BlockListModel> @using ContentModels = Umbraco.Web.PublishedModels; @using Umbraco.Core.Models.Blocks @{ if (Model?.Layout == null || !Model.Layout.Any()) { return; } } <div class="umb-block-list"> @foreach (var layout in Model.Layout) { if (layout?.Udi == null) { continue; } var data = layout.Data; @Html.Partial("BlockList/" + data.ContentType.Alias, (data, layout.Settings)) } </div>
@inherits UmbracoViewPage<BlockListModel> @using ContentModels = Umbraco.Web.PublishedModels; @using Umbraco.Core.Models.Blocks @{ if (Model?.Layout == null || !Model.Layout.Any()) { return; } } <div class="umb-block-list"> @foreach (var layout in Model.Layout) { if (layout?.Udi == null) { continue; } var data = Model.GetData(layout.Udi); @Html.Partial("BlockList/" + data.ContentType.Alias, (data, layout.Settings)) } </div>
mit
C#
1424e5f3287b00a8f3f0b8cf07c0785439fc8fda
Use default values in settings constructor
smarkets/IronSmarkets
IronSmarkets/Sessions/Settings.cs
IronSmarkets/Sessions/Settings.cs
// Copyright (c) 2011 Smarkets Limited // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, copy, // modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. namespace IronSmarkets.Sessions { public interface ISessionSettings { string Username { get; } string Password { get; } ulong InSequence { get; } ulong OutSequence { get; } // Can be null to create a new session string SessionId { get; } } public struct SessionSettings : ISessionSettings { private readonly string _username; private readonly string _password; private readonly string _sessionId; private readonly ulong _inSequence; private readonly ulong _outSequence; public string Username { get { return _username; } } public string Password { get { return _password; } } public ulong InSequence { get { return _inSequence; } } public ulong OutSequence { get { return _outSequence; } } public string SessionId { get { return _sessionId; } } public SessionSettings( string username, string password, ulong inSequence = 1, ulong outSequence = 1, string sessionId = null) { _username = username; _password = password; _inSequence = inSequence; _outSequence = outSequence; _sessionId = sessionId; } } }
// Copyright (c) 2011 Smarkets Limited // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, copy, // modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. namespace IronSmarkets.Sessions { public interface ISessionSettings { string Username { get; } string Password { get; } ulong InSequence { get; } ulong OutSequence { get; } // Can be null to create a new session string SessionId { get; } } public struct SessionSettings : ISessionSettings { private readonly string _username; private readonly string _password; private readonly string _sessionId; private readonly ulong _inSequence; private readonly ulong _outSequence; public string Username { get { return _username; } } public string Password { get { return _password; } } public ulong InSequence { get { return _inSequence; } } public ulong OutSequence { get { return _outSequence; } } public string SessionId { get { return _sessionId; } } public SessionSettings(string username, string password) : this( username, password, 1, 1, null) { } public SessionSettings( string username, string password, ulong inSequence, ulong outSequence, string sessionId) { _username = username; _password = password; _inSequence = inSequence; _outSequence = outSequence; _sessionId = sessionId; } } }
mit
C#
6701104726a908f64d3d229165de41055aa4ecc5
Fix date in date pickuper
g-stoyanov/InfinysBreakfastOrders,g-stoyanov/InfinysBreakfastOrders
Source/Web/InfinysBreakfastOrders.Web/Views/Orders/NewOrder.cshtml
Source/Web/InfinysBreakfastOrders.Web/Views/Orders/NewOrder.cshtml
@model InfinysBreakfastOrders.Web.InputModels.Orders.OrderInputModel @{ ViewBag.Title = "Post New Order"; } <h1>@ViewBag.Title</h1> @using (Html.BeginForm("NewOrder", "Orders", FormMethod.Post)) { <div class="row"> @Html.LabelFor(model => model.OrderDate) @Html.TextBoxFor(model => model.OrderDate, new { id = "date-picker", @Value = DateTime.Now.Date }) </div> <hr /> <div class="row"> @Html.LabelFor(model => model.OrderText) @Html.EditorFor(model => model.OrderText) </div> <hr /> <div class="form-group text-center"> <input type="submit" value="Post New Order" class="btn btn-primary btn-lg"/> </div> }
@model InfinysBreakfastOrders.Web.InputModels.Orders.OrderInputModel @{ ViewBag.Title = "Post New Order"; } <h1>@ViewBag.Title</h1> @using (Html.BeginForm("NewOrder", "Orders", FormMethod.Post)) { <div class="row"> @Html.LabelFor(model => model.OrderDate) @Html.TextBoxFor(model => model.OrderDate, new { id = "date-picker" }) </div> <hr /> <div class="row"> @Html.LabelFor(model => model.OrderText) @Html.EditorFor(model => model.OrderText) </div> <hr /> <div class="form-group text-center"> <input type="submit" value="Post New Order" class="btn btn-primary btn-lg"/> </div> }
mit
C#
0177c53a3a24eaafa87cc11fd86489437f75ea37
Bump version.
mskcc/Medidata.RWS.NET,mskcc/Medidata.RWS.NET
Medidata.RWS.NET/Properties/AssemblyInfo.cs
Medidata.RWS.NET/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("Medidata.RWS.NET")] [assembly: AssemblyDescription("Provides classes that can be serialized to and deserialized from CDISC ODM (Operational Data Model) XML, and a fluent interface to Medidata RAVE Web Services.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MSKCC")] [assembly: AssemblyProduct("Medidata.RWS.NET")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5dd385a9-f93e-457f-99bf-c70ef5ccd8c5")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.2.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Medidata.RWS.NET")] [assembly: AssemblyDescription("Provides classes that can be serialized to and deserialized from CDISC ODM (Operational Data Model) XML, and a fluent interface to Medidata RAVE Web Services.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MSKCC")] [assembly: AssemblyProduct("Medidata.RWS.NET")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5dd385a9-f93e-457f-99bf-c70ef5ccd8c5")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
0cfb3309152109eb1d09ddb88e5ef7ec6fa2dddd
Allow filters on composer
Miruken-DotNet/Miruken
Miruken/Callback/Policy/ComposerArgument.cs
Miruken/Callback/Policy/ComposerArgument.cs
namespace Miruken.Callback.Policy { using System.Reflection; public class ComposerArgument<Attrib> : ArgumentRule<Attrib> where Attrib : DefinitionAttribute { public static readonly ComposerArgument<Attrib> Instance = new ComposerArgument<Attrib>(); private ComposerArgument() { } public override bool Matches(ParameterInfo parameter, Attrib attribute) { var paramType = parameter.ParameterType; return typeof(IHandler).IsAssignableFrom(paramType); } public override void Configure( ParameterInfo parameter, MethodDefinition<Attrib> method) { method.AddFilters(GetFilters(parameter)); } public override object Resolve(object callback, IHandler composer) { return composer; } } }
namespace Miruken.Callback.Policy { using System.Reflection; public class ComposerArgument<Attrib> : ArgumentRule<Attrib> where Attrib : DefinitionAttribute { public static readonly ComposerArgument<Attrib> Instance = new ComposerArgument<Attrib>(); private ComposerArgument() { } public override bool Matches(ParameterInfo parameter, Attrib attribute) { var paramType = parameter.ParameterType; return typeof(IHandler).IsAssignableFrom(paramType); } public override object Resolve(object callback, IHandler composer) { return composer; } } }
mit
C#
162094dbcfbf7991026047cc1f81a787a3bc09e7
Allow POST requests
namics/TerrificNet,namics/TerrificNet,namics/TerrificNet,namics/TerrificNet,namics/TerrificNet
TerrificNet/Controllers/TemplateController.cs
TerrificNet/Controllers/TemplateController.cs
using System; using System.Net; using System.Net.Http; using System.Web.Http; using TerrificNet.ViewEngine; using TerrificNet.ViewEngine.TemplateHandler.UI; using Veil.Parser; namespace TerrificNet.Controllers { public class TemplateController : TemplateControllerBase { private readonly IViewEngine _viewEngine; private readonly TerrificViewDefinitionRepository _viewRepository; public TemplateController(IViewEngine viewEngine, TerrificViewDefinitionRepository viewRepository) { _viewEngine = viewEngine; _viewRepository = viewRepository; } [AcceptVerbs("Get", "Post")] public HttpResponseMessage Get(string path) { SourceLocation errorLocation; Exception error; //try //{ return GetInternal(path); //} //catch (VeilParserException ex) //{ // error = ex; // errorLocation = ex.Location; //} //catch (VeilCompilerException ex) //{ // error = ex; // errorLocation = ex.Node.Location; //} //return await GetErrorPage(error, errorLocation); } private HttpResponseMessage GetInternal(string path) { IPageViewDefinition viewDefinition; if (_viewRepository.TryGetFromView(path, out viewDefinition)) return Get(viewDefinition); return new HttpResponseMessage(HttpStatusCode.NotFound); } private HttpResponseMessage Get(IPageViewDefinition data) { return View(_viewEngine, data); } } }
using System; using System.Net; using System.Net.Http; using System.Web.Http; using TerrificNet.ViewEngine; using TerrificNet.ViewEngine.TemplateHandler.UI; using Veil.Parser; namespace TerrificNet.Controllers { public class TemplateController : TemplateControllerBase { private readonly IViewEngine _viewEngine; private readonly TerrificViewDefinitionRepository _viewRepository; public TemplateController(IViewEngine viewEngine, TerrificViewDefinitionRepository viewRepository) { _viewEngine = viewEngine; _viewRepository = viewRepository; } [HttpGet] public HttpResponseMessage Get(string path) { SourceLocation errorLocation; Exception error; //try //{ return GetInternal(path); //} //catch (VeilParserException ex) //{ // error = ex; // errorLocation = ex.Location; //} //catch (VeilCompilerException ex) //{ // error = ex; // errorLocation = ex.Node.Location; //} //return await GetErrorPage(error, errorLocation); } private HttpResponseMessage GetInternal(string path) { IPageViewDefinition viewDefinition; if (_viewRepository.TryGetFromView(path, out viewDefinition)) return Get(viewDefinition); return new HttpResponseMessage(HttpStatusCode.NotFound); } private HttpResponseMessage Get(IPageViewDefinition data) { return View(_viewEngine, data); } } }
mit
C#
bff3a987b7efb2131bc97cb22f88e4976cbe252d
Make AbuseFilter class read-only. Might put all HTML form post hacks into a separate package.
CXuesong/WikiClientLibrary
WikiClientLibrary/AbuseFilters/AbuseFilter.cs
WikiClientLibrary/AbuseFilters/AbuseFilter.cs
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Text; using Newtonsoft.Json; using WikiClientLibrary.Sites; namespace WikiClientLibrary.AbuseFilters { [JsonObject(MemberSerialization.OptIn)] public sealed class AbuseFilter { public static readonly string[] emptyActions = { }; [JsonProperty] public int Id { get; private set; } [JsonProperty] public string Description { get; set; } [JsonProperty] public string Pattern { get; set; } public IReadOnlyCollection<string> Actions { get; private set; } = emptyActions; [JsonProperty("actions")] private string RawActions { set { Actions = string.IsNullOrEmpty(value) ? emptyActions : (IReadOnlyCollection<string>)new ReadOnlyCollection<string>(value.Split(',')); } } [JsonProperty] public int Hits { get; private set; } [JsonProperty] public string Comments { get; set; } [JsonProperty] public string LastEditor { get; private set; } [JsonProperty] public DateTime LastEditTime { get; private set; } [JsonProperty("deleted")] public bool IsDeleted { get; private set; } [JsonProperty("private")] public bool IsPrivate { get; private set; } [JsonProperty("enabled")] public bool IsEnabled { get; private set; } } }
using System; using System.Collections.Generic; using System.Text; using Newtonsoft.Json; namespace WikiClientLibrary.AbuseFilters { [JsonObject(MemberSerialization.OptIn)] public sealed class AbuseFilter { private ICollection<string> _Actions; [JsonProperty] public int Id { get; private set; } [JsonProperty] public string Description { get; set; } [JsonProperty] public string Pattern { get; set; } public ICollection<string> Actions { get { if (_Actions == null) _Actions = new List<string>(); return _Actions; } set { _Actions = value; } } [JsonProperty("actions")] private string RawActions { set { _Actions = string.IsNullOrEmpty(value) ? null : new List<string>(value.Split(',')); } } [JsonProperty] public int Hits { get; private set; } [JsonProperty] public string Comments { get; set; } [JsonProperty] public string LastEditor { get; private set; } [JsonProperty] public DateTime LastEditTime { get; private set; } [JsonProperty("deleted")] public bool IsDeleted { get; set; } [JsonProperty("private")] public bool IsPrivate { get; set; } [JsonProperty("enabled")] public bool IsEnabled { get; set; } } }
apache-2.0
C#
4d3efc520a51b33621994263af0ab8cdd8638086
Fix whitespace in team player stats view.
afuersch/Wuzlstats-2014,saxx/Wuzlstats-2014,afuersch/Wuzlstats-2014,saxx/Wuzlstats-2014
WuzlStats/Views/Player/TeamPlayerStats.cshtml
WuzlStats/Views/Player/TeamPlayerStats.cshtml
@model WuzlStats.ViewModels.Player.TeamPlayerStats <div class="panel panel-default"> <div class="panel-heading">Teams</div> <div class="panel-body"> <div class="row"> <div class="col-sm-4"> <label>Games played:</label> </div> <div class="col-sm-8"><span class="glyphicon glyphicon-thumbs-up"></span> @Model.WinsCount &nbsp;&nbsp; <span class="glyphicon glyphicon-thumbs-down"></span> @Model.LossesCount</div> </div> <div class="row"> <div class="col-sm-4"> <label>Favorite partner:</label> </div> <div class="col-sm-8">@Model.FavoritePartner</div> </div> <div class="row"> <div class="col-sm-4"> <label>Favorite team:</label> </div> <div class="col-sm-8">@Model.FavoriteTeam</div> </div> <div class="row"> <div class="col-sm-4"> <label>Favorite position:</label> </div> <div class="col-sm-8">@Model.FavoritePosition</div> </div> </div> </div>
@model WuzlStats.ViewModels.Player.TeamPlayerStats <div class="panel panel-default"> <div class="panel-heading">Teams</div> <div class="panel-body"> <div class="row"> <div class="col-sm-4"> <label>Games played:</label> </div> <div class="col-sm-8"><span class="glyphicon glyphicon-thumbs-up"></span>@Model.WinsCount &nbsp;&nbsp; <span class="glyphicon glyphicon-thumbs-down"></span>@Model.LossesCount</div> </div> <div class="row"> <div class="col-sm-4"> <label>Favorite partner:</label> </div> <div class="col-sm-8">@Model.FavoritePartner</div> </div> <div class="row"> <div class="col-sm-4"> <label>Favorite team:</label> </div> <div class="col-sm-8">@Model.FavoriteTeam</div> </div> <div class="row"> <div class="col-sm-4"> <label>Favorite position:</label> </div> <div class="col-sm-8">@Model.FavoritePosition</div> </div> </div> </div>
apache-2.0
C#
2ec5a079fb6a9379b89d055dc4b316ac8892b323
test code to test build config on teamcity
dfensgmbh/biz.dfch.CS.Entity.LifeCycleManager,dfensgmbh/biz.dfch.CS.Entity.LifeCycleManager,dfensgmbh/biz.dfch.CS.Entity.LifeCycleManager
src/biz.dfch.CS.Entity.LifeCycleManager.Tests/UnitTest1.cs
src/biz.dfch.CS.Entity.LifeCycleManager.Tests/UnitTest1.cs
/** * Copyright 2015 Marc Rufer, d-fens GmbH * * 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 Microsoft.VisualStudio.TestTools.UnitTesting; namespace biz.dfch.CS.Entity.LifeCycleManager.Tests { [TestClass] public class UnitTest1 { [TestMethod] public void Test() { Assert.AreEqual(2, 3); } } }
/** * Copyright 2015 Marc Rufer, d-fens GmbH * * 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 Microsoft.VisualStudio.TestTools.UnitTesting; namespace biz.dfch.CS.Entity.LifeCycleManager.Tests { [TestClass] public class UnitTest1 { [TestMethod] public void Test() { } } }
apache-2.0
C#
114de07c6e378119f16a66aca4acfbb191f137cb
update for multiple subset associations
GeertBellekens/UML-Tooling-Framework,GeertBellekens/UML-Tooling-Framework
SchemaBuilderFramework/SchemaAssociation.cs
SchemaBuilderFramework/SchemaAssociation.cs
 using System; using UML=TSF.UmlToolingFramework.UML; using System.Collections.Generic; namespace SchemaBuilderFramework { /// <summary> /// Description of SchemaAssociation. /// </summary> public interface SchemaAssociation { UML.Classes.Kernel.Association sourceAssociation {get;set;} List<UML.Classes.Kernel.Association> subsetAssociations {get;set;} List<SchemaElement> relatedElements {get;set;} SchemaElement owner {get;set;} /// <summary> /// the schema element on the other side of the association /// </summary> SchemaElement otherElement {get;set;} void createSubsetAssociation(); /// <summary> /// returns the end of the schema association's source association that is on the owner side /// </summary> UML.Classes.Kernel.Property thisEnd {get;set;} /// <summary> /// returns the end of the schema association's source association that is on the other side /// </summary> UML.Classes.Kernel.Property otherEnd {get;set;} } }
 using System; using UML=TSF.UmlToolingFramework.UML; using System.Collections.Generic; namespace SchemaBuilderFramework { /// <summary> /// Description of SchemaAssociation. /// </summary> public interface SchemaAssociation { UML.Classes.Kernel.Association sourceAssociation {get;set;} UML.Classes.Kernel.Association subsetAssociation {get;set;} List<SchemaElement> relatedElements {get;set;} SchemaElement owner {get;set;} /// <summary> /// the schema element on the other side of the association /// </summary> SchemaElement otherElement {get;set;} UML.Classes.Kernel.Association createSubsetAssociation(); /// <summary> /// returns the end of the schema association's source association that is on the owner side /// </summary> UML.Classes.Kernel.Property thisEnd {get;set;} /// <summary> /// returns the end of the schema association's source association that is on the other side /// </summary> UML.Classes.Kernel.Property otherEnd {get;set;} } }
bsd-2-clause
C#
2b92699e3d337ab098fad8fc857ec82310e597db
Bump version to 0.9.0
whampson/cascara,whampson/bft-spec
Src/WHampson.Cascara/Properties/AssemblyInfo.cs
Src/WHampson.Cascara/Properties/AssemblyInfo.cs
#region License /* Copyright (c) 2017 Wes Hampson * * 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. */ #endregion using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("WHampson.Cascara")] [assembly: AssemblyDescription("Binary File Template parser.")] [assembly: AssemblyProduct("WHampson.Cascara")] [assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")] [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")] [assembly: AssemblyFileVersion("0.9.0")] [assembly: AssemblyVersion("0.9.0")] [assembly: AssemblyInformationalVersion("0.9.0")]
#region License /* Copyright (c) 2017 Wes Hampson * * 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. */ #endregion using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("WHampson.Cascara")] [assembly: AssemblyDescription("Binary File Template parser.")] [assembly: AssemblyProduct("WHampson.Cascara")] [assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")] [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")] [assembly: AssemblyFileVersion("0.8.0")] [assembly: AssemblyVersion("0.8.0")] [assembly: AssemblyInformationalVersion("0.8.0")]
mit
C#
da3d086edde315db03ff9b04c2926ab22940d50c
Increase connect timeout for Functional Tests (#39559)
ericstj/corefx,wtgodbe/corefx,ericstj/corefx,wtgodbe/corefx,shimingsg/corefx,wtgodbe/corefx,ericstj/corefx,ericstj/corefx,ViktorHofer/corefx,shimingsg/corefx,wtgodbe/corefx,shimingsg/corefx,shimingsg/corefx,wtgodbe/corefx,shimingsg/corefx,shimingsg/corefx,ViktorHofer/corefx,ericstj/corefx,shimingsg/corefx,wtgodbe/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ericstj/corefx,wtgodbe/corefx,ViktorHofer/corefx,ericstj/corefx
src/System.Data.SqlClient/tests/FunctionalTests/TestTdsServer.cs
src/System.Data.SqlClient/tests/FunctionalTests/TestTdsServer.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.SqlServer.TDS.EndPoint; using Microsoft.SqlServer.TDS.Servers; using System.Net; using System.Runtime.CompilerServices; namespace System.Data.SqlClient.Tests { internal class TestTdsServer : GenericTDSServer, IDisposable { private TDSServerEndPoint _endpoint = null; private SqlConnectionStringBuilder connectionStringBuilder; public TestTdsServer(TDSServerArguments args) : base(args) { } public TestTdsServer(QueryEngine engine, TDSServerArguments args) : base(args) { this.Engine = engine; } public static TestTdsServer StartServerWithQueryEngine(QueryEngine engine, bool enableFedAuth = false, bool enableLog = false, [CallerMemberName] string methodName = "") { TDSServerArguments args = new TDSServerArguments() { Log = enableLog ? Console.Out : null, }; if (enableFedAuth) { args.FedAuthRequiredPreLoginOption = Microsoft.SqlServer.TDS.PreLogin.TdsPreLoginFedAuthRequiredOption.FedAuthRequired; } TestTdsServer server = engine == null ? new TestTdsServer(args) : new TestTdsServer(engine, args); server._endpoint = new TDSServerEndPoint(server) { ServerEndPoint = new IPEndPoint(IPAddress.Any, 0) }; server._endpoint.EndpointName = methodName; // The server EventLog should be enabled as it logs the exceptions. server._endpoint.EventLog = Console.Out; server._endpoint.Start(); int port = server._endpoint.ServerEndPoint.Port; server.connectionStringBuilder = new SqlConnectionStringBuilder() { DataSource = "localhost," + port, ConnectTimeout = 30, Encrypt = false }; server.ConnectionString = server.connectionStringBuilder.ConnectionString; return server; } public static TestTdsServer StartTestServer(bool enableFedAuth = false, bool enableLog = false, [CallerMemberName] string methodName = "") { return StartServerWithQueryEngine(null, false, false, methodName); } public void Dispose() => _endpoint?.Stop(); public string ConnectionString { get; private set; } } }
// 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.SqlServer.TDS.EndPoint; using Microsoft.SqlServer.TDS.Servers; using System.Net; using System.Runtime.CompilerServices; namespace System.Data.SqlClient.Tests { internal class TestTdsServer : GenericTDSServer, IDisposable { private TDSServerEndPoint _endpoint = null; private SqlConnectionStringBuilder connectionStringBuilder; public TestTdsServer(TDSServerArguments args) : base(args) { } public TestTdsServer(QueryEngine engine, TDSServerArguments args) : base(args) { this.Engine = engine; } public static TestTdsServer StartServerWithQueryEngine(QueryEngine engine, bool enableFedAuth = false, bool enableLog = false, [CallerMemberName] string methodName = "") { TDSServerArguments args = new TDSServerArguments() { Log = enableLog ? Console.Out : null, }; if (enableFedAuth) { args.FedAuthRequiredPreLoginOption = Microsoft.SqlServer.TDS.PreLogin.TdsPreLoginFedAuthRequiredOption.FedAuthRequired; } TestTdsServer server = engine == null ? new TestTdsServer(args) : new TestTdsServer(engine, args); server._endpoint = new TDSServerEndPoint(server) { ServerEndPoint = new IPEndPoint(IPAddress.Any, 0) }; server._endpoint.EndpointName = methodName; // The server EventLog should be enabled as it logs the exceptions. server._endpoint.EventLog = Console.Out; server._endpoint.Start(); int port = server._endpoint.ServerEndPoint.Port; server.connectionStringBuilder = new SqlConnectionStringBuilder() { DataSource = "localhost," + port, ConnectTimeout = 5, Encrypt = false }; server.ConnectionString = server.connectionStringBuilder.ConnectionString; return server; } public static TestTdsServer StartTestServer(bool enableFedAuth = false, bool enableLog = false, [CallerMemberName] string methodName = "") { return StartServerWithQueryEngine(null, false, false, methodName); } public void Dispose() => _endpoint?.Stop(); public string ConnectionString { get; private set; } } }
mit
C#
674682d3eb64d3917f2236c0b48cb2c1668ed4ef
Add non-generic version of IEnumerator.ToList
orbitalgames/collections-extensions
IEnumeratorExtensions.cs
IEnumeratorExtensions.cs
/* The MIT License (MIT) Copyright (c) 2015 Orbital Games, LLC. 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 OrbitalGames.Collections { /// <summary> /// Extension methods for System.IEnumerator /// </summary> public static class IEnumeratorExtensions { /// <summary> /// Enumerates an IEnumerator instance and stores the results in an IList. /// </summary> /// <param name="source">Enumerator instance</param> /// <param name="initialCapacity">Optional initial capacity to which the result is set</param> /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="source" /> is null</exception> /// <returns>IList containing the enumerated values</returns> public static IList<TResult> ToList<TResult>(this IEnumerator<TResult> source, int initialCapacity = 0) { if (source == null) { throw new ArgumentNullException("source"); } var result = new List<TResult>(initialCapacity); while (source.MoveNext()) { result.Add(source.Current); } return result; } /// <summary> /// Enumerates an IEnumerator instance and stores the results in an IList. /// </summary> /// <param name="source">Enumerator instance</param> /// <param name="initialCapacity">Optional initial capacity to which the result is set</param> /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="source" /> is null</exception> /// <returns>IList containing the enumerated values</returns> public static IList ToList(this IEnumerator source, int initialCapacity = 0) { if (source == null) { throw new ArgumentNullException("source"); } var result = new List<object>(initialCapacity); while (source.MoveNext()) { result.Add(source.Current); } return result; } } }
/* The MIT License (MIT) Copyright (c) 2015 Orbital Games, LLC. 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.Collections.Generic; using System; namespace OrbitalGames.Collections { /// <summary> /// Extension methods for System.IEnumerator /// </summary> public static class IEnumeratorExtensions { /// <summary> /// Enumerates an IEnumerator instance and stores the results in an IList. /// </summary> /// <param name="source">Enumerator instance</param> /// <param name="initialCapacity">Optional initial capacity to which the result is set</param> /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="source" /> is null</exception> /// <returns>IList containing the enumerated values</returns> public static IList<TResult> ToList<TResult>(this IEnumerator<TResult> source, int initialCapacity = 0) { if (source == null) { throw new ArgumentNullException("source"); } var result = new List<TResult>(initialCapacity); while (source.MoveNext()) { result.Add(source.Current); } return result; } } }
mit
C#
fa6d797adf9860bbde472efffcca6fa77256fb14
Remove redundant prefix
UselessToucan/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,ppy/osu,peppy/osu,UselessToucan/osu
osu.Game/Screens/Ranking/SoloResultsScreen.cs
osu.Game/Screens/Ranking/SoloResultsScreen.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; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Scoring; namespace osu.Game.Screens.Ranking { public class SoloResultsScreen : ResultsScreen { private GetScoresRequest getScoreRequest; [Resolved] private RulesetStore rulesets { get; set; } public SoloResultsScreen(ScoreInfo score, bool allowRetry) : base(score, allowRetry) { } protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback) { if (Score.Beatmap.OnlineBeatmapID == null || Score.Beatmap.Status <= BeatmapSetOnlineStatus.Pending) return null; getScoreRequest = new GetScoresRequest(Score.Beatmap, Score.Ruleset); getScoreRequest.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineScoreID != Score.OnlineScoreID).Select(s => s.CreateScoreInfo(rulesets))); return getScoreRequest; } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); getScoreRequest?.Cancel(); } } }
// 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; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Scoring; namespace osu.Game.Screens.Ranking { public class SoloResultsScreen : ResultsScreen { private GetScoresRequest getScoreRequest; [Resolved] private RulesetStore rulesets { get; set; } public SoloResultsScreen(ScoreInfo score, bool allowRetry) : base(score, allowRetry) { } protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback) { if (Score.Beatmap.OnlineBeatmapID == null || Score.Beatmap.Status <= BeatmapSetOnlineStatus.Pending) return null; getScoreRequest = new GetScoresRequest(Score.Beatmap, Score.Ruleset); getScoreRequest.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineScoreID != this.Score.OnlineScoreID).Select(s => s.CreateScoreInfo(rulesets))); return getScoreRequest; } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); getScoreRequest?.Cancel(); } } }
mit
C#
a4bc4254465566b275b16e5da3026b60e0f8af1a
fix IdleDetector period
danelkhen/fsync
src/fsync/IdleDetector.cs
src/fsync/IdleDetector.cs
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading; using System.Threading.Tasks; namespace fsync { class IdleDetector { public void Start() { if (Timeout == TimeSpan.Zero) throw new Exception(); Timer = new Timer(Timer_callback); } public TimeSpan Timeout { get; set; } //DateTime LastPing; [MethodImpl(MethodImplOptions.Synchronized)] public void Ping() { //LastPing = DateTime.Now; Timer.Change(Timeout, TimeSpan.FromMilliseconds(-1)); } [MethodImpl(MethodImplOptions.Synchronized)] private void Timer_callback(object state) { if (Idle != null) Idle(); } public Action Idle; private Timer Timer; [MethodImpl(MethodImplOptions.Synchronized)] public void Stop() { Timer.Change(-1, -1); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading; using System.Threading.Tasks; namespace fsync { class IdleDetector { public void Start() { if (Timeout == TimeSpan.Zero) throw new Exception(); Timer = new Timer(Timer_callback); } public TimeSpan Timeout { get; set; } //DateTime LastPing; [MethodImpl(MethodImplOptions.Synchronized)] public void Ping() { //LastPing = DateTime.Now; Timer.Change(Timeout, TimeSpan.FromMilliseconds(100)); } [MethodImpl(MethodImplOptions.Synchronized)] private void Timer_callback(object state) { if (Idle != null) Idle(); } public Action Idle; private Timer Timer; [MethodImpl(MethodImplOptions.Synchronized)] public void Stop() { Timer.Change(-1, -1); } } }
apache-2.0
C#
90093c1d9d3fab7757218cdb021f08c64cdd1fe7
Combine `private` skin variable into exposed one
NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,peppy/osu
osu.Game/Screens/Edit/EditorBeatmapSkin.cs
osu.Game/Screens/Edit/EditorBeatmapSkin.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; using System.Linq; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Textures; using osu.Game.Audio; using osu.Game.Skinning; using osuTK.Graphics; namespace osu.Game.Screens.Edit { /// <summary> /// A beatmap skin which is being edited. /// </summary> public class EditorBeatmapSkin : ISkin { public event Action BeatmapSkinChanged; /// <summary> /// The underlying beatmap skin. /// </summary> protected internal readonly Skin Skin; /// <summary> /// The combo colours of this skin. /// If empty, the default combo colours will be used. /// </summary> public BindableList<Colour4> ComboColours { get; } public EditorBeatmapSkin(Skin skin) { Skin = skin; ComboColours = new BindableList<Colour4>(); if (Skin.Configuration.ComboColours != null) ComboColours.AddRange(Skin.Configuration.ComboColours.Select(c => (Colour4)c)); ComboColours.BindCollectionChanged((_, __) => updateColours()); } private void invokeSkinChanged() => BeatmapSkinChanged?.Invoke(); private void updateColours() { Skin.Configuration.CustomComboColours = ComboColours.Select(c => (Color4)c).ToList(); invokeSkinChanged(); } #region Delegated ISkin implementation public Drawable GetDrawableComponent(ISkinComponent component) => Skin.GetDrawableComponent(component); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => Skin.GetTexture(componentName, wrapModeS, wrapModeT); public ISample GetSample(ISampleInfo sampleInfo) => Skin.GetSample(sampleInfo); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => Skin.GetConfig<TLookup, TValue>(lookup); #endregion } }
// 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; using System.Linq; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Textures; using osu.Game.Audio; using osu.Game.Skinning; using osuTK.Graphics; namespace osu.Game.Screens.Edit { /// <summary> /// A beatmap skin which is being edited. /// </summary> public class EditorBeatmapSkin : ISkin { public event Action BeatmapSkinChanged; /// <summary> /// The underlying beatmap skin. /// </summary> protected internal ISkin Skin => skin; private readonly Skin skin; /// <summary> /// The combo colours of this skin. /// If empty, the default combo colours will be used. /// </summary> public BindableList<Colour4> ComboColours { get; } public EditorBeatmapSkin(Skin skin) { this.skin = skin; ComboColours = new BindableList<Colour4>(); if (skin.Configuration.ComboColours != null) ComboColours.AddRange(skin.Configuration.ComboColours.Select(c => (Colour4)c)); ComboColours.BindCollectionChanged((_, __) => updateColours()); } private void invokeSkinChanged() => BeatmapSkinChanged?.Invoke(); private void updateColours() { skin.Configuration.CustomComboColours = ComboColours.Select(c => (Color4)c).ToList(); invokeSkinChanged(); } #region Delegated ISkin implementation public Drawable GetDrawableComponent(ISkinComponent component) => skin.GetDrawableComponent(component); public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => skin.GetTexture(componentName, wrapModeS, wrapModeT); public ISample GetSample(ISampleInfo sampleInfo) => skin.GetSample(sampleInfo); public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => skin.GetConfig<TLookup, TValue>(lookup); #endregion } }
mit
C#
c465232b20fb70ee7d56b45040020ca39ffdfa19
Make a tag V15.8.0 2017-05-22
tropo/tropo-webapi-csharp,tropo/tropo-webapi-csharp
TropoCSharp/TropoJSON.cs
TropoCSharp/TropoJSON.cs
using System.Web; using Newtonsoft.Json; using System; namespace TropoCSharp.Tropo { /// <summary> /// A utility class to render a Tropo object as JSON. /// </summary> public static class TropoJSONExtensions { public static void RenderJSON(this Tropo tropo, HttpResponse response) { tropo.Language = null; tropo.Voice = null; JsonSerializerSettings settings = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }; response.AddHeader("WebAPI-Lang-Ver", "CSharp V15.8.0 2017-05-22"); response.Write(JsonConvert.SerializeObject(tropo, Formatting.None, settings).Replace("\\", "").Replace("\"{", "{").Replace("}\"", "}")); } } }
using System.Web; using Newtonsoft.Json; using System; namespace TropoCSharp.Tropo { /// <summary> /// A utility class to render a Tropo object as JSON. /// </summary> public static class TropoJSONExtensions { public static void RenderJSON(this Tropo tropo, HttpResponse response) { tropo.Language = null; tropo.Voice = null; JsonSerializerSettings settings = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }; response.AddHeader("WebAPI-Lang-Ver", "CSharp V15.8.0 SNAPSHOT"); response.Write(JsonConvert.SerializeObject(tropo, Formatting.None, settings).Replace("\\", "").Replace("\"{", "{").Replace("}\"", "}")); } } }
mit
C#
17cf66d9a851142a7bdda52f0fd48cfeceeb2abe
store temp files in temp folder
hahoyer/reni.cs,hahoyer/reni.cs,hahoyer/reni.cs
src/reni2/T4Compiler.cs
src/reni2/T4Compiler.cs
#region Copyright (C) 2013 // Project Reni2 // Copyright (C) 2011 - 2013 Harald Hoyer // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // // Comments, bugs and suggestions to hahoyer at yahoo.de #endregion using System.Collections.Generic; using System.Linq; using System; using hw.Helper; namespace Reni { public sealed class T4Compiler { readonly string _text; readonly string _className; public T4Compiler(string text, string className = "Reni") { _text = text; _className = className; } public string Code() { var fileName = Environment.GetEnvironmentVariable("temp") + "\\reni\\T4Compiler.reni"; var f = fileName.FileHandle(); f.AssumeDirectoryOfFileExists(); f.String = _text; var compiler = new Compiler(fileName, className: _className); return compiler.CSharpCode; } } }
#region Copyright (C) 2013 // Project Reni2 // Copyright (C) 2011 - 2013 Harald Hoyer // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // // Comments, bugs and suggestions to hahoyer at yahoo.de #endregion using System.Collections.Generic; using System.Linq; using System; using hw.Helper; namespace Reni { public sealed class T4Compiler { readonly string _text; readonly string _className; public T4Compiler(string text, string className = "Reni") { _text = text; _className = className; } public string Code() { const string fileName = "temptest.reni"; var f = fileName.FileHandle(); f.String = _text; var compiler = new Compiler(fileName, className: _className); return compiler.CSharpCode; } } }
mit
C#
e4b5540e40af5de64f63f30a1e19e22cf7e5ddd6
Remove tabs from bootstraper
XamarinGarage/GiTracker
GiTracker/Bootstraper.cs
GiTracker/Bootstraper.cs
using GiTracker.Helpers; using GiTracker.Services.Api; using GiTracker.Services.Database; using GiTracker.Services.Dialogs; using GiTracker.Services.Issues; using GiTracker.Services.Rest; using GiTracker.ViewModels; using GiTracker.Views; using Microsoft.Practices.Unity; using Prism.Unity; using Xamarin.Forms; using GiTracker.Services.HttpClientProvider; namespace GiTracker { public class Bootstraper : UnityBootstrapper { protected override Page CreateMainPage() { return Container.Resolve<MainPage>(); } protected override void RegisterTypes() { Container.RegisterInstance(Container); Container.RegisterTypeForNavigation<IssueList, IssueListViewModel>(); Container.RegisterTypeForNavigation<IssueDetails, IssueDetailsViewModel>(); Container.RegisterType<Loader>(); Container.RegisterType<IIssueService, IssueService>(); Container.RegisterType<IDatabaseService, DatabaseService>(); Container.RegisterType<IDialogService, DialogService>(); Container.RegisterType<IRestService, RestService>(); Container.RegisterType<IGitApiProvider, GitHubApiProvider>(); Container.RegisterType<IHttpClientProvider, DefaultHttpClientProvider> (); } } }
using GiTracker.Helpers; using GiTracker.Services.Api; using GiTracker.Services.Database; using GiTracker.Services.Dialogs; using GiTracker.Services.Issues; using GiTracker.Services.Rest; using GiTracker.ViewModels; using GiTracker.Views; using Microsoft.Practices.Unity; using Prism.Unity; using Xamarin.Forms; using GiTracker.Services.HttpClientProvider; namespace GiTracker { public class Bootstraper : UnityBootstrapper { protected override Page CreateMainPage() { return Container.Resolve<MainPage>(); } protected override void RegisterTypes() { Container.RegisterInstance(Container); Container.RegisterTypeForNavigation<IssueList, IssueListViewModel>(); Container.RegisterTypeForNavigation<IssueDetails, IssueDetailsViewModel>(); Container.RegisterType<Loader>(); Container.RegisterType<IIssueService, IssueService>(); Container.RegisterType<IDatabaseService, DatabaseService>(); Container.RegisterType<IDialogService, DialogService>(); Container.RegisterType<IRestService, RestService>(); Container.RegisterType<IGitApiProvider, GitHubApiProvider>(); Container.RegisterType<IHttpClientProvider, DefaultHttpClientProvider> (); } } }
apache-2.0
C#
091dda418f68b511bfc402a4d7ea5ed624047b49
Update MvxFormsWindowsPhonePagePresenter.cs
Cheesebaron/Cheesebaron.MvxPlugins,Cheesebaron/Cheesebaron.MvxPlugins,Ideine/Cheesebaron.MvxPlugins,Ideine/Cheesebaron.MvxPlugins
FormsPresenters/WindowsPhone/MvxFormsWindowsPhonePagePresenter.cs
FormsPresenters/WindowsPhone/MvxFormsWindowsPhonePagePresenter.cs
// MvxFormsWindowsPhonePagePresenter.cs // 2015 (c) Copyright Cheesebaron. http://ostebaronen.dk // Cheesebaron.MvxPlugins.FormsPresenters is licensed using Microsoft Public License (Ms-PL) // Contributions and inspirations noted in readme.md and license.txt // // Project Lead - Tomasz Cielecki, @cheesebaron, mvxplugins@ostebaronen.dk  using System.Threading.Tasks; using Cheesebaron.MvxPlugins.FormsPresenters.Core; using Cirrious.CrossCore; using Cirrious.MvvmCross.ViewModels; using Cirrious.MvvmCross.WindowsPhone.Views; using Xamarin.Forms; using Microsoft.Phone.Controls; using System; namespace Cheesebaron.MvxPlugins.FormsPresenters.WindowsPhone { public class MvxFormsWindowsPhonePagePresenter : MvxFormsPagePresenter , IMvxPhoneViewPresenter { private readonly PhoneApplicationFrame _rootFrame; public MvxFormsWindowsPhonePagePresenter(PhoneApplicationFrame rootFrame, Application mvxFormsApp) : base(mvxFormsApp) { _rootFrame = rootFrame; } protected override void CustomPlatformInitialization(NavigationPage mainPage) { _rootFrame.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } } }
using System.Threading.Tasks; using Cheesebaron.MvxPlugins.FormsPresenters.Core; using Cirrious.CrossCore; using Cirrious.MvvmCross.ViewModels; using Cirrious.MvvmCross.WindowsPhone.Views; using Xamarin.Forms; using Microsoft.Phone.Controls; using System; namespace Cheesebaron.MvxPlugins.FormsPresenters.WindowsPhone { public class MvxFormsWindowsPhonePagePresenter : MvxFormsPagePresenter , IMvxPhoneViewPresenter { private readonly PhoneApplicationFrame _rootFrame; public MvxFormsWindowsPhonePagePresenter(PhoneApplicationFrame rootFrame, Application mvxFormsApp) : base(mvxFormsApp) { _rootFrame = rootFrame; } protected override void CustomPlatformInitialization(NavigationPage mainPage) { _rootFrame.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } } }
apache-2.0
C#
cd8217b9d1560db887366229da3d35f153ceccab
Arrange clean results
Kentico/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,Kentico/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,ChristopherJennings/KInspector,ChristopherJennings/KInspector
KenticoInspector.Reports.Tests/WebPartPerformanceAnalysisTests.cs
KenticoInspector.Reports.Tests/WebPartPerformanceAnalysisTests.cs
using System; using System.Collections.Generic; using System.Linq; using KenticoInspector.Core.Constants; using KenticoInspector.Core.Models; using KenticoInspector.Core.Services.Interfaces; using KenticoInspector.Reports.Tests.Helpers; using KenticoInspector.Reports.WebPartPerformanceAnalysis; using KenticoInspector.Reports.WebPartPerformanceAnalysis.Models; using Moq; using NUnit.Framework; namespace KenticoInspector.Reports.Tests { [TestFixture(10)] [TestFixture(11)] public class WebPartPerformanceAnalysisTest : AbstractReportTest { private Report _mockReport; public WebPartPerformanceAnalysisTest(int majorVersion) : base(majorVersion) { _mockReport = new Report(_mockDatabaseService.Object, _mockInstanceService.Object); } [Test] public void Should_ReturnGoodStatus_When_NoWebPartsHaveUnspecifiedColumns() { // Arrange ArrangeAllQueries(); // Act var results = _mockReport.GetResults(_mockInstance.Guid); // Assert Assert.That(results.Status == ReportResultsStatus.Good, $"Expected status when no web parts have unspecified columns is 'Good' not '{results.Status}'."); } private void ArrangeAllQueries(List<PageTemplate> affectedTemplates = null) { affectedTemplates = affectedTemplates ?? new List<PageTemplate>(); _mockDatabaseService.SetupExecuteSqlFromFile(Scripts.GetAffectedTemplates, affectedTemplates); var affectedTemplateIds = affectedTemplates.Select(x => x.PageTemplateID); var affectedDocuments = new List<Document>(); _mockDatabaseService.SetupExecuteSqlFromFileWithListParameter(Scripts.GetDocumentsByPageTemplateIds, "IDs", affectedTemplateIds, affectedDocuments); } } }
using KenticoInspector.Core.Constants; using KenticoInspector.Core.Models; using KenticoInspector.Core.Services.Interfaces; using KenticoInspector.Reports.Tests.Helpers; using KenticoInspector.Reports.WebPartPerformanceAnalysis; using Moq; using NUnit.Framework; namespace KenticoInspector.Reports.Tests { [TestFixture(10)] [TestFixture(11)] public class WebPartPerformanceAnalysisTest : AbstractReportTest { private Report _mockReport; public WebPartPerformanceAnalysisTest(int majorVersion) : base(majorVersion) { _mockReport = new Report(_mockDatabaseService.Object, _mockInstanceService.Object); } [Test] public void Should_ReturnGoodStatus_When_NoWebPartsHaveUnspecifiedColumns() { // Arrange // Act var results = _mockReport.GetResults(_mockInstance.Guid); // Assert Assert.That(results.Status == ReportResultsStatus.Good, $"Expected status when no web parts have unspecified columns is 'Good' not '{results.Status}'."); } } }
mit
C#
9c03d70c40a5496964489249850b24b34d4930c0
Add documentation
thecaptury/unity,Innoactive/Captury-Unity-SDK
Scripts/CapturyOrigin.cs
Scripts/CapturyOrigin.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Captury { /// <summary> /// Acts as origin for all avatars. /// </summary> public class CapturyOrigin : MonoBehaviour { /// <summary> /// Offset between this CapturyOrigin and the world origin (0,0,0) /// </summary> public Vector3 OffsetToWorldOrigin { get { return transform.position; } } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Captury { /// <summary> /// Acts as origin for all avatars. /// </summary> public class CapturyOrigin : MonoBehaviour { public Vector3 OffsetToWorldOrigin { get { return transform.position; } } } }
mit
C#
dfb7d789037aa45fea13513f3a6d30a3cfae8a59
Fix remaining game host regressions
UselessToucan/osu,peppy/osu,EVAST9919/osu,smoogipoo/osu,ppy/osu,ZLima12/osu,smoogipoo/osu,NeoAdonis/osu,johnneijzen/osu,ZLima12/osu,smoogipoo/osu,ppy/osu,peppy/osu,DrabWeb/osu,peppy/osu-new,ppy/osu,DrabWeb/osu,peppy/osu,2yangk23/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipooo/osu,EVAST9919/osu,2yangk23/osu,johnneijzen/osu,DrabWeb/osu,UselessToucan/osu,UselessToucan/osu
osu.Game/Tests/CleanRunHeadlessGameHost.cs
osu.Game/Tests/CleanRunHeadlessGameHost.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.Platform; namespace osu.Game.Tests { /// <summary> /// A headless host which cleans up before running (removing any remnants from a previous execution). /// </summary> public class CleanRunHeadlessGameHost : HeadlessGameHost { public CleanRunHeadlessGameHost(string gameName = @"", bool bindIPC = false, bool realtime = true) : base(gameName, bindIPC, realtime) { } protected override void SetupForRun() { base.SetupForRun(); Storage.DeleteDirectory(string.Empty); } } }
// 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.Platform; namespace osu.Game.Tests { /// <summary> /// A headless host which cleans up before running (removing any remnants from a previous execution). /// </summary> public class CleanRunHeadlessGameHost : HeadlessGameHost { public CleanRunHeadlessGameHost(string gameName = @"", bool bindIPC = false, bool realtime = true) : base(gameName, bindIPC, realtime) { Storage.DeleteDirectory(string.Empty); } } }
mit
C#
de8c70e2e87dbe7cdfb17765b5b7edf37acca88b
Apply and EXIF orientation flags to the image on load.
PintaProject/Pinta,Fenex/Pinta,PintaProject/Pinta,jakeclawson/Pinta,Mailaender/Pinta,Fenex/Pinta,PintaProject/Pinta,jakeclawson/Pinta,Mailaender/Pinta
Pinta.Core/ImageFormats/GdkPixbufFormat.cs
Pinta.Core/ImageFormats/GdkPixbufFormat.cs
// // GdkPixbufFormat.cs // // Author: // Maia Kozheva <sikon@ubuntu.com> // // Copyright (c) 2010 Maia Kozheva <sikon@ubuntu.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 System; using System.IO; using Gdk; namespace Pinta.Core { public class GdkPixbufFormat: IImageImporter, IImageExporter { private string filetype; public GdkPixbufFormat(string filetype) { this.filetype = filetype; } public void Import (string fileName) { Pixbuf bg; // Handle any EXIF orientation flags using (Pixbuf temp = new Pixbuf (fileName)) bg = temp.ApplyEmbeddedOrientation (); Size imagesize = new Size (bg.Width, bg.Height); Document doc = PintaCore.Workspace.CreateAndActivateDocument (fileName, imagesize); doc.HasFile = true; doc.ImageSize = imagesize; doc.Workspace.CanvasSize = imagesize; Layer layer = doc.AddNewLayer (Path.GetFileName (fileName)); using (Cairo.Context g = new Cairo.Context (layer.Surface)) { CairoHelper.SetSourcePixbuf (g, bg, 0, 0); g.Paint (); } bg.Dispose (); } protected virtual void DoSave (Pixbuf pb, string fileName, string fileType) { pb.Save (fileName, fileType); } public void Export (Document document, string fileName) { Cairo.ImageSurface surf = document.GetFlattenedImage (); Pixbuf pb = surf.ToPixbuf (); DoSave(pb, fileName, filetype); (pb as IDisposable).Dispose (); (surf as IDisposable).Dispose (); } } }
// // GdkPixbufFormat.cs // // Author: // Maia Kozheva <sikon@ubuntu.com> // // Copyright (c) 2010 Maia Kozheva <sikon@ubuntu.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 System; using System.IO; using Gdk; namespace Pinta.Core { public class GdkPixbufFormat: IImageImporter, IImageExporter { private string filetype; public GdkPixbufFormat(string filetype) { this.filetype = filetype; } public void Import (string fileName) { Pixbuf bg = new Pixbuf (fileName); Size imagesize = new Size (bg.Width, bg.Height); Document doc = PintaCore.Workspace.CreateAndActivateDocument (fileName, imagesize); doc.HasFile = true; doc.ImageSize = imagesize; doc.Workspace.CanvasSize = imagesize; Layer layer = doc.AddNewLayer (Path.GetFileName (fileName)); using (Cairo.Context g = new Cairo.Context (layer.Surface)) { CairoHelper.SetSourcePixbuf (g, bg, 0, 0); g.Paint (); } bg.Dispose (); } protected virtual void DoSave (Pixbuf pb, string fileName, string fileType) { pb.Save (fileName, fileType); } public void Export (Document document, string fileName) { Cairo.ImageSurface surf = document.GetFlattenedImage (); Pixbuf pb = surf.ToPixbuf (); DoSave(pb, fileName, filetype); (pb as IDisposable).Dispose (); (surf as IDisposable).Dispose (); } } }
mit
C#
4f719b886d09ece15b291337aa09fef10377cc12
Improve chest entity
mk-dev-team/mk-world-of-imagination
src/Hevadea/GameObjects/Entities/Chest.cs
src/Hevadea/GameObjects/Entities/Chest.cs
using Hevadea.Framework.Graphic.SpriteAtlas; using Hevadea.GameObjects.Entities.Components; using Hevadea.GameObjects.Entities.Components.Actions; using Hevadea.GameObjects.Entities.Components.Attributes; using Hevadea.GameObjects.Entities.Components.States; using Hevadea.Scenes.Menus; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; namespace Hevadea.GameObjects.Entities { public class Chest : Entity { private readonly Sprite _sprite; public Chest() { _sprite = new Sprite(Ressources.TileEntities, new Point(0, 1)); AddComponent(new Dropable() { Items = { new Items.Drop(ITEMS.CHEST, 1f, 1, 1) } }); AddComponent(new Move()); AddComponent(new Inventory(128)); AddComponent(new Pickupable(_sprite)); AddComponent(new Colider(new Rectangle(-6, -2, 12, 8))); AddComponent(new Pushable()); AddComponent(new Health(10)); AddComponent(new Interactable()).Interacted += EntityInteracte; AddComponent(new Pickupable(_sprite)); AddComponent(new Burnable(1f)); } private void EntityInteracte(object sender, InteractEventArg args) { if (args.Entity.HasComponent<Inventory>()) GameState.CurrentMenu = new MenuChest(args.Entity, this, GameState); } public override void OnDraw(SpriteBatch spriteBatch, GameTime gameTime) { _sprite.Draw(spriteBatch, new Rectangle((int)X - 8, (int)Y - 8, 16, 16), Color.White); } } }
using Hevadea.Framework.Graphic.SpriteAtlas; using Hevadea.GameObjects.Entities.Components; using Hevadea.GameObjects.Entities.Components.Actions; using Hevadea.GameObjects.Entities.Components.Attributes; using Hevadea.GameObjects.Entities.Components.States; using Hevadea.Scenes.Menus; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; namespace Hevadea.GameObjects.Entities { public class Chest : Entity { private readonly Sprite _sprite; public Chest() { _sprite = new Sprite(Ressources.TileEntities, new Point(0, 1)); AddComponent(new Move()); AddComponent(new Inventory(128)); AddComponent(new Pickupable(_sprite)); AddComponent(new Colider(new Rectangle(-6, -2, 12, 8))); AddComponent(new Pushable()); AddComponent(new Health(10)).Killed += EntityDie; AddComponent(new Interactable()).Interacted += EntityInteracte; AddComponent(new Pickupable(_sprite)); AddComponent(new Burnable(1f)); } private void EntityInteracte(object sender, InteractEventArg args) { if (args.Entity.HasComponent<Inventory>()) GameState.CurrentMenu = new MenuChest(args.Entity, this, GameState); } private void EntityDie(object sender, EventArgs args) { GetComponent<Inventory>().Content.DropOnGround(Level, X, Y); ITEMS.CHEST.Drop(Level, X, Y, 1); } public override void OnDraw(SpriteBatch spriteBatch, GameTime gameTime) { _sprite.Draw(spriteBatch, new Rectangle((int)X - 8, (int)Y - 8, 16, 16), Color.White); } } }
mit
C#
9f146c5874132d820b5de503e7fe99985edc0a07
use RunSynchronously instead of StartAsTask
hmemcpy/Paket.VisualStudio,fsprojects/Paket.VisualStudio,baronfel/Paket.VisualStudio,mrinaldi/Paket.VisualStudio,TheAngryByrd/Paket.VisualStudio
src/Paket.VisualStudio/IntelliSense/NuGetCompletionListProvider.cs
src/Paket.VisualStudio/IntelliSense/NuGetCompletionListProvider.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using Microsoft.FSharp.Control; using Microsoft.FSharp.Core; using Microsoft.VisualStudio.Language.Intellisense; namespace Paket.VisualStudio.IntelliSense { internal class NuGetCompletionListProvider : ICompletionListProvider { private static readonly Regex r = new Regex("nuget (?<query>.*)", RegexOptions.Compiled | RegexOptions.IgnoreCase); public CompletionContextType ContextType { get { return CompletionContextType.NuGet; } } public IEnumerable<Completion> GetCompletionEntries(CompletionContext context) { string text = context.Snapshot.GetText(context.SpanStart, context.SpanLength); string query = r.Match(text).Groups["query"].Value; // todo if (query.Length < 3) return Enumerable.Empty<Completion>(); string[] results = FSharpAsync.RunSynchronously( NuGetV3.FindPackages(FSharpOption<Paket.Utils.Auth>.None, "http://nuget.org/api/v2", query), FSharpOption<int>.None, FSharpOption<CancellationToken>.None); return results.Select(item => new Completion2(item, item, null, null, item)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using Microsoft.FSharp.Control; using Microsoft.FSharp.Core; using Microsoft.VisualStudio.Language.Intellisense; namespace Paket.VisualStudio.IntelliSense { internal class NuGetCompletionListProvider : ICompletionListProvider { private static readonly Regex r = new Regex("nuget (?<query>.*)", RegexOptions.Compiled | RegexOptions.IgnoreCase); public CompletionContextType ContextType { get { return CompletionContextType.NuGet; } } public IEnumerable<Completion> GetCompletionEntries(CompletionContext context) { string text = context.Snapshot.GetText(context.SpanStart, context.SpanLength); string query = r.Match(text).Groups["query"].Value; // todo if (query.Length < 3) return Enumerable.Empty<Completion>(); string[] results = FSharpAsync.StartAsTask( NuGetV3.FindPackages(FSharpOption<Paket.Utils.Auth>.None, "http://nuget.org/api/v2", query), new FSharpOption<TaskCreationOptions>(TaskCreationOptions.None), new FSharpOption<CancellationToken>(CancellationToken.None)).Result; return results.Select(item => new Completion2(item, item, null, null, item)); } } }
mit
C#
2542086981d5326bfffdc36991de077a3d1bd518
Add xml comments to ExecutionErrors (#2098)
joemcbride/graphql-dotnet,graphql-dotnet/graphql-dotnet,graphql-dotnet/graphql-dotnet,graphql-dotnet/graphql-dotnet,joemcbride/graphql-dotnet
src/GraphQL/Execution/ExecutionErrors.cs
src/GraphQL/Execution/ExecutionErrors.cs
using System; using System.Collections; using System.Collections.Generic; namespace GraphQL { /// <summary> /// Contains a list of execution errors. /// </summary> public class ExecutionErrors : IEnumerable<ExecutionError> { private readonly List<ExecutionError> _errors = new List<ExecutionError>(); /// <summary> /// Adds an execution error to the list. /// </summary> public virtual void Add(ExecutionError error) { _errors.Add(error ?? throw new ArgumentNullException(nameof(error))); } /// <summary> /// Adds a list of execution errors to the list. /// </summary> public virtual void AddRange(IEnumerable<ExecutionError> errors) { foreach (var error in errors) Add(error); } /// <summary> /// Returns the number of execution errors in the list. /// </summary> public int Count => _errors.Count; /// <summary> /// Returns the execution error at the specified index. /// </summary> public ExecutionError this[int index] => _errors[index]; /// <inheritdoc/> public IEnumerator<ExecutionError> GetEnumerator() => _errors.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } /// <summary> /// Optimization for validation "green path" - does not allocate memory in managed heap. /// </summary> internal sealed class EmptyExecutionErrors : ExecutionErrors { private EmptyExecutionErrors() { } public static readonly EmptyExecutionErrors Instance = new EmptyExecutionErrors(); public override void Add(ExecutionError error) => throw new NotSupportedException(); public override void AddRange(IEnumerable<ExecutionError> errors) => throw new NotSupportedException(); } }
using System; using System.Collections; using System.Collections.Generic; namespace GraphQL { public class ExecutionErrors : IEnumerable<ExecutionError> { private readonly List<ExecutionError> _errors = new List<ExecutionError>(); public virtual void Add(ExecutionError error) { _errors.Add(error ?? throw new ArgumentNullException(nameof(error))); } public virtual void AddRange(IEnumerable<ExecutionError> errors) { foreach (var error in errors) Add(error); } public int Count => _errors.Count; public ExecutionError this[int index] => _errors[index]; public IEnumerator<ExecutionError> GetEnumerator() => _errors.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } /// <summary> /// Optimization for validation "green path" - does not allocate memory in managed heap. /// </summary> internal sealed class EmptyExecutionErrors : ExecutionErrors { private EmptyExecutionErrors() { } public static readonly EmptyExecutionErrors Instance = new EmptyExecutionErrors(); public override void Add(ExecutionError error) => throw new NotSupportedException(); public override void AddRange(IEnumerable<ExecutionError> errors) => throw new NotSupportedException(); } }
mit
C#
f956459b75c9dfd2773678b23e351bb3db43c274
Bump version to 0.4.1
FatturaElettronicaPA/FatturaElettronicaPA
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; // 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("FatturaElettronica.NET")] [assembly: AssemblyDescription("Fattura Elettronica per le aziende e la Pubblica Amministrazione Italiana")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nicola Iarocci, CIR2000")] [assembly: AssemblyProduct("FatturaElettronica.NET")] [assembly: AssemblyCopyright("Copyright © CIR2000 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.4.1.0")] [assembly: AssemblyFileVersion("0.4.1.0")]
using System.Reflection; using System.Resources; // 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("FatturaElettronica.NET")] [assembly: AssemblyDescription("Fattura Elettronica per le aziende e la Pubblica Amministrazione Italiana")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nicola Iarocci, CIR2000")] [assembly: AssemblyProduct("FatturaElettronica.NET")] [assembly: AssemblyCopyright("Copyright © CIR2000 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.4.0.0")] [assembly: AssemblyFileVersion("0.4.0.0")]
bsd-3-clause
C#
27fca02a033e041651b34cb51982b1cdd48ac727
Set attributes for b0001
pstemari/v-engrave-plugin
VEngrave_Plugin/Properties/AssemblyInfo.cs
VEngrave_Plugin/Properties/AssemblyInfo.cs
/* -*- mode: csharp; c-basic-offset: 2 -*- * Copyright 2013 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using 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("VEngrave_Plugin")] [assembly: AssemblyDescription("Plugin DLL")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("V-Engrave Plugin for CamBam")] [assembly: AssemblyCopyright("Copyright © 2013 Google.com")] [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("d6c1d4f1-3463-4a0d-90ae-7fca5b9897c6")] // 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.0.0.1")] [assembly: AssemblyFileVersion("0.0.0.1")]
/* -*- mode: csharp; c-basic-offset: 2 -*- * Copyright 2013 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using 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("VCarve_Plugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("VCarve_Plugin")] [assembly: AssemblyCopyright("Copyright © 2013")] [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("d6c1d4f1-3463-4a0d-90ae-7fca5b9897c6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
de50d5d971d806047729eda24837ea5a2146b428
Switch to the Build<AppFunc> extension method - nicer syntax
amaitland/CefSharp.Owin,amaitland/CefSharp.Owin
CefSharp.Owin.Example.Wpf/App.xaml.cs
CefSharp.Owin.Example.Wpf/App.xaml.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; using System.Windows; using Microsoft.Owin.Builder; using Owin; namespace CefSharp.Owin.Example.Wpf { //Shorthand for Owin pipeline func using AppFunc = Func<IDictionary<string, object>, Task>; /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var appBuilder = new AppBuilder(); appBuilder.UseNancy(); var appFunc = appBuilder.Build<AppFunc>(); var settings = new CefSettings(); settings.RegisterOwinSchemeHandlerFactory("owin", appFunc); Cef.Initialize(settings); } } }
using System; using System.Collections.Generic; using System.Threading.Tasks; using System.Windows; using Microsoft.Owin.Builder; using Owin; namespace CefSharp.Owin.Example.Wpf { //Shorthand for Owin pipeline func using AppFunc = Func<IDictionary<string, object>, Task>; /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var appBuilder = new AppBuilder(); appBuilder.UseNancy(); var appFunc = (AppFunc)appBuilder.Build(typeof (AppFunc)); var settings = new CefSettings(); settings.RegisterOwinSchemeHandlerFactory("owin", appFunc); Cef.Initialize(settings); } } }
mit
C#