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
395a425a63728a6d6a3cfd00970d8e4b4653709d
Update _Layout.cshtml
pacoferre/polymercrud,pacoferre/polymercrud,pacoferre/polymercrud
src/PolymerCRUD/Views/Shared/_Layout.cshtml
src/PolymerCRUD/Views/Shared/_Layout.cshtml
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="generator" content="Polymer CRUD"> <title>@ViewData["Title"] - Polymer CRUD</title> <!-- Place favicon.ico in the `app/` directory --> <!-- Chrome for Android theme color --> <meta name="theme-color" content="#2E3AA1"> <!-- Web Application Manifest --> <link rel="manifest" href="manifest.json"> <!-- Tile color for Win8 --> <meta name="msapplication-TileColor" content="#3372DF"> <!-- Add to homescreen for Chrome on Android --> <meta name="mobile-web-app-capable" content="yes"> <meta name="application-name" content="PSK"> <link rel="icon" sizes="192x192" href="images/touch/chrome-touch-icon-192x192.png"> <!-- Add to homescreen for Safari on iOS --> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-title" content="Social Wave Deck"> <link rel="apple-touch-icon" href="images/touch/apple-touch-icon.png"> <!-- Tile icon for Win8 (144x144) --> <meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png"> <!-- Because this project uses vulcanize this should be your only html import in this file. All other imports should go in elements.html --> <link rel="import" href="~/elements/elements.html"> @RenderSection("subelements", required: false) <!-- For shared styles, shared-styles.html import in elements.html --> <style is="custom-style" include="shared-styles"></style> <environment names="Development"> <link rel="stylesheet" href="~/css/main.css" /> <script src="~/lib/webcomponentsjs/webcomponents-lite.js" asp-append-version="true"></script> </environment> <environment names="Staging,Production"> <link rel="stylesheet" href="~/css/main.min.css" asp-append-version="true" /> <script src="~/lib/webcomponentsjs/webcomponents-lite.js" asp-append-version="true"></script> </environment> </head> <body unresolved> @RenderBody() @*<environment names="Development"> <script src="~/js/app.js" asp-append-version="true"></script> </environment> <environment names="Staging,Production"> <script src="~/js/app.min.js" asp-append-version="true"></script> </environment>*@ @RenderSection("scripts", required: false) </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="generator" content="Social Wave Deck"> <title>@ViewData["Title"] - Social Wave Deck</title> <!-- Place favicon.ico in the `app/` directory --> <!-- Chrome for Android theme color --> <meta name="theme-color" content="#2E3AA1"> <!-- Web Application Manifest --> <link rel="manifest" href="manifest.json"> <!-- Tile color for Win8 --> <meta name="msapplication-TileColor" content="#3372DF"> <!-- Add to homescreen for Chrome on Android --> <meta name="mobile-web-app-capable" content="yes"> <meta name="application-name" content="PSK"> <link rel="icon" sizes="192x192" href="images/touch/chrome-touch-icon-192x192.png"> <!-- Add to homescreen for Safari on iOS --> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-title" content="Social Wave Deck"> <link rel="apple-touch-icon" href="images/touch/apple-touch-icon.png"> <!-- Tile icon for Win8 (144x144) --> <meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png"> <!-- Because this project uses vulcanize this should be your only html import in this file. All other imports should go in elements.html --> <link rel="import" href="~/elements/elements.html"> @RenderSection("subelements", required: false) <!-- For shared styles, shared-styles.html import in elements.html --> <style is="custom-style" include="shared-styles"></style> <environment names="Development"> <link rel="stylesheet" href="~/css/main.css" /> <script src="~/lib/webcomponentsjs/webcomponents-lite.js" asp-append-version="true"></script> </environment> <environment names="Staging,Production"> <link rel="stylesheet" href="~/css/main.min.css" asp-append-version="true" /> <script src="~/lib/webcomponentsjs/webcomponents-lite.js" asp-append-version="true"></script> </environment> </head> <body unresolved> @RenderBody() @*<environment names="Development"> <script src="~/js/app.js" asp-append-version="true"></script> </environment> <environment names="Staging,Production"> <script src="~/js/app.min.js" asp-append-version="true"></script> </environment>*@ @RenderSection("scripts", required: false) </body> </html>
mit
C#
508bdede0db3ab799521f9aedcded9204805948c
Throw if a VertexProperty is wrapped.
ExRam/ExRam.Gremlinq
ExRam.Gremlinq.Core/Elements/VertexProperty.cs
ExRam.Gremlinq.Core/Elements/VertexProperty.cs
using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; namespace ExRam.Gremlinq.Core.GraphElements { public class VertexProperty<TValue, TMeta> : Property<TValue>, IVertexProperty where TMeta : class { public VertexProperty(TValue value) : base(value) { if (value is IVertexProperty) throw new InvalidOperationException($"Cannot assign a value of type {value.GetType().Name} to a property of type {nameof(VertexProperty<TValue, TMeta>)}."); } public static implicit operator VertexProperty<TValue, TMeta>(TValue value) => new VertexProperty<TValue, TMeta>(value); public static implicit operator VertexProperty<TValue, TMeta>(TValue[] value) => throw new NotSupportedException("This conversion is only intended to be used in expressions. It can't be executed reasonably."); public static implicit operator VertexProperty<TValue, TMeta>(VertexProperty<TValue, TMeta>[] value) => throw new NotSupportedException("This conversion is only intended to be used in expressions. It can't be executed reasonably."); public override string ToString() { return $"vp[{Label}->{GetValue()}]"; } //TODO: Honor Mask. internal override IDictionary<string, object>? GetMetaProperties(IGremlinQueryEnvironment environment) => Properties? .Serialize(environment, SerializationBehaviour.Default) .Where(x => x.key.RawKey is string) .ToDictionary(x => (string)x.key.RawKey, x => x.value) ?? (IDictionary<string, object>)ImmutableDictionary<string, object>.Empty; public object? Id { get; set; } public string? Label { get; set; } public TMeta? Properties { get; set; } object? IElement.Id { get => Id; set => throw new InvalidOperationException($"Can't set the {nameof(Id)}-property of a {nameof(VertexProperty<TValue, TMeta>)}."); } } public class VertexProperty<TValue> : VertexProperty<TValue, IDictionary<string, object>> { public VertexProperty(TValue value) : base(value) { Properties = new Dictionary<string, object>(); } public static implicit operator VertexProperty<TValue>(TValue value) => new VertexProperty<TValue>(value); public static implicit operator VertexProperty<TValue>(TValue[] value) => throw new NotSupportedException("This conversion is only intended to be used in expressions. It can't be executed reasonably."); public static implicit operator VertexProperty<TValue>(VertexProperty<TValue>[] value) => throw new NotSupportedException("This conversion is only intended to be used in expressions. It can't be executed reasonably."); internal override IDictionary<string, object>? GetMetaProperties(IGremlinQueryEnvironment environment) => Properties; public new IDictionary<string, object> Properties { get; set; } } }
using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; namespace ExRam.Gremlinq.Core.GraphElements { public class VertexProperty<TValue, TMeta> : Property<TValue>, IVertexProperty where TMeta : class { public VertexProperty(TValue value) : base(value) { } public static implicit operator VertexProperty<TValue, TMeta>(TValue value) => new VertexProperty<TValue, TMeta>(value); public static implicit operator VertexProperty<TValue, TMeta>(TValue[] value) => throw new NotSupportedException("This conversion is only intended to be used in expressions. It can't be executed reasonably."); public static implicit operator VertexProperty<TValue, TMeta>(VertexProperty<TValue, TMeta>[] value) => throw new NotSupportedException("This conversion is only intended to be used in expressions. It can't be executed reasonably."); public override string ToString() { return $"vp[{Label}->{GetValue()}]"; } //TODO: Honor Mask. internal override IDictionary<string, object>? GetMetaProperties(IGremlinQueryEnvironment environment) => Properties? .Serialize(environment, SerializationBehaviour.Default) .Where(x => x.key.RawKey is string) .ToDictionary(x => (string)x.key.RawKey, x => x.value) ?? (IDictionary<string, object>)ImmutableDictionary<string, object>.Empty; public object? Id { get; set; } public string? Label { get; set; } public TMeta? Properties { get; set; } object? IElement.Id { get => Id; set => throw new InvalidOperationException($"Can't set the {nameof(Id)}-property of a {nameof(VertexProperty<TValue, TMeta>)}."); } } public class VertexProperty<TValue> : VertexProperty<TValue, IDictionary<string, object>> { public VertexProperty(TValue value) : base(value) { Properties = new Dictionary<string, object>(); } public static implicit operator VertexProperty<TValue>(TValue value) => new VertexProperty<TValue>(value); public static implicit operator VertexProperty<TValue>(TValue[] value) => throw new NotSupportedException("This conversion is only intended to be used in expressions. It can't be executed reasonably."); public static implicit operator VertexProperty<TValue>(VertexProperty<TValue>[] value) => throw new NotSupportedException("This conversion is only intended to be used in expressions. It can't be executed reasonably."); internal override IDictionary<string, object>? GetMetaProperties(IGremlinQueryEnvironment environment) => Properties; public new IDictionary<string, object> Properties { get; set; } } }
mit
C#
4ef6e5da1620ba4270e4f2010dcef5d538454ddb
rename a route
BCITer/Jabber,BCITer/Jabber,BCITer/Jabber
JabberBCIT/JabberBCIT/App_Start/RouteConfig.cs
JabberBCIT/JabberBCIT/App_Start/RouteConfig.cs
using System.Web.Mvc; using System.Web.Routing; namespace JabberBCIT { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "SpecificForum", url: "Forum/{tag}", defaults: new { controller = "Forum", action = "Index", tag = UrlParameter.Optional } ); routes.MapRoute( name: "CreateGlobalForumPost", url: "Forum/CreateForumPost", defaults: new { controller = "Forum", action = "CreateForumPost", tag = "Global" } ); routes.MapRoute( name: "Forum", url: "Forum/{tag}/CreateForumPost", defaults: new { controller = "Forum", action = "CreateForumPost", tag = UrlParameter.Optional } ); routes.MapRoute( name: "EditProfile", url: "Profile/Edit/{id}", defaults: new { controller = "Manage", action = "Edit" } ); routes.MapRoute( name: "Profile", url: "Profile/{id}", defaults: new { controller = "Manage", action = "Index"} ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } }
using System.Web.Mvc; using System.Web.Routing; namespace JabberBCIT { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Forum", url: "Forum/{tag}", defaults: new { controller = "Forum", action = "Index", tag = UrlParameter.Optional } ); routes.MapRoute( name: "Forum", url: "Forum/CreateForumPost", defaults: new { controller = "Forum", action = "CreateForumPost", tag = "Global" } ); routes.MapRoute( name: "Forum", url: "Forum/{tag}/CreateForumPost", defaults: new { controller = "Forum", action = "CreateForumPost", tag = UrlParameter.Optional } ); routes.MapRoute( name: "EditProfile", url: "Profile/Edit/{id}", defaults: new { controller = "Manage", action = "Edit" } ); routes.MapRoute( name: "Profile", url: "Profile/{id}", defaults: new { controller = "Manage", action = "Index"} ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } }
mit
C#
0f8f1e9bc24d26ae1b43c517a8e36d23723dd8d2
Bump version number to v2.0.3
Li-Yanzhi/Mvc.CascadeDropDown,Li-Yanzhi/Mvc.CascadeDropDown,alexanderar/Mvc.CascadeDropDown,alexanderar/Mvc.CascadeDropDown,alexanderar/Mvc.CascadeDropDown,Li-Yanzhi/Mvc.CascadeDropDown
Mvc.CascadeDropDown/Properties/AssemblyInfo.cs
Mvc.CascadeDropDown/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Mvc.CascadeDropDown")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mvc.CascadeDropDown")] [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("bfe81283-c105-4b6e-a92f-d3f7f8f0b1e9")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.3")] [assembly: AssemblyFileVersion("2.0.3")]
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("Mvc.CascadeDropDown")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mvc.CascadeDropDown")] [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("bfe81283-c105-4b6e-a92f-d3f7f8f0b1e9")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0")] [assembly: AssemblyFileVersion("2.0.0")]
mit
C#
2eb9befd602add624df0125bdf7b407c3fa361ca
Change datatype for OpeningBalance and OpeningRate
techphernalia/MyPersonalAccounts
MyPersonalAccountsModel/Inventory/StockItem.cs
MyPersonalAccountsModel/Inventory/StockItem.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace com.techphernalia.MyPersonalAccounts.Model.Inventory { public class StockItem { public int StockItemId { get; set; } public string StockItemName { get; set; } public int StockGroupId { get; set; } public int StockUnitId { get; set; } public double OpeningBalance { get; set; } public double OpeningRate { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace com.techphernalia.MyPersonalAccounts.Model.Inventory { public class StockItem { public int StockItemId { get; set; } public string StockItemName { get; set; } public int StockGroupId { get; set; } public int StockUnitId { get; set; } public decimal OpeningBalance { get; set; } public decimal OpeningRate { get; set; } } }
mit
C#
c6f061724ae785ddcff59d2b9595e3a335adaeef
Add token issuspended to view model
exceptionless/Exceptionless,exceptionless/Exceptionless,exceptionless/Exceptionless,exceptionless/Exceptionless
src/Exceptionless.Web/Models/Token/ViewToken.cs
src/Exceptionless.Web/Models/Token/ViewToken.cs
using Foundatio.Repositories.Models; namespace Exceptionless.Web.Models; public class ViewToken : IIdentity, IHaveDates { public string Id { get; set; } public string OrganizationId { get; set; } public string ProjectId { get; set; } public string UserId { get; set; } public string DefaultProjectId { get; set; } public HashSet<string> Scopes { get; set; } public DateTime? ExpiresUtc { get; set; } public string Notes { get; set; } public bool IsDisabled { get; set; } public bool IsSuspended { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } }
using Foundatio.Repositories.Models; namespace Exceptionless.Web.Models; public class ViewToken : IIdentity, IHaveDates { public string Id { get; set; } public string OrganizationId { get; set; } public string ProjectId { get; set; } public string UserId { get; set; } public string DefaultProjectId { get; set; } public HashSet<string> Scopes { get; set; } public DateTime? ExpiresUtc { get; set; } public string Notes { get; set; } public bool IsDisabled { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } }
apache-2.0
C#
948fbb0e430124648b3e3f33d33e0e473e5380f9
Add .NET Timeout property
djlewisxactware/ModernHttpClient
src/ModernHttpClient/Net45/NetNetworkHandler.cs
src/ModernHttpClient/Net45/NetNetworkHandler.cs
using System; using System.Net.Http; using System.Net; using System.Threading.Tasks; using System.Threading; namespace ModernHttpClient { public class NativeMessageHandler : HttpClientHandler { public NativeMessageHandler() : this(false, false) {} public TimeSpan? Timeout { get; set; } public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null) { UseCookies = cookieHandler != null; if (cookieHandler != null) { CookieContainer = cookieHandler.CookieContainer; } } protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { string requestHost = request.RequestUri.Host; var response = await base.SendAsync(request, cancellationToken); string newRequestHost = response.RequestMessage.RequestUri.Host; if (requestHost != newRequestHost) { throw new CaptiveNetworkException(new Uri(requestHost), new Uri(newRequestHost)); } return response; } } }
using System; using System.Net.Http; using System.Net; using System.Threading.Tasks; using System.Threading; namespace ModernHttpClient { public class NativeMessageHandler : HttpClientHandler { public NativeMessageHandler() : this(false, false) {} public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification, NativeCookieHandler cookieHandler = null) { UseCookies = cookieHandler != null; if (cookieHandler != null) { CookieContainer = cookieHandler.CookieContainer; } } protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { string requestHost = request.RequestUri.Host; var response = await base.SendAsync(request, cancellationToken); string newRequestHost = response.RequestMessage.RequestUri.Host; if (requestHost != newRequestHost) { throw new CaptiveNetworkException(new Uri(requestHost), new Uri(newRequestHost)); } return response; } } }
mit
C#
40da395f26c16a9ed4c6998d2f4458fae6b7574d
Fix reward text
DMagic1/KSP_Contract_Window
Source/ContractsWindow/PanelInterfaces/IntervalNodeUI.cs
Source/ContractsWindow/PanelInterfaces/IntervalNodeUI.cs
using System; using System.Collections.Generic; using ContractsWindow.Unity.Interfaces; using ProgressParser; namespace ContractsWindow.PanelInterfaces { public class IntervalNodeUI : IIntervalNode { private progressInterval node; public IntervalNodeUI(progressInterval n) { if (n == null) return; node = n; } public bool IsReached { get { if (node == null) return false; return node.IsReached; } } public int Intervals { get { if (node == null) return 0; return node.TotalIntervals; } } public int NodeInterval { get { if (node == null) return 0; return node.Interval; } } public string NodeTitle { get { if (node == null) return ""; return node.Descriptor; } } public string NodeValue(int i) { if (node == null) return ""; return node.getRecord(i).ToString(); } private string coloredText(string s, char c, string color) { if (string.IsNullOrEmpty(s)) return ""; return string.Format("<color={0}>{1}{2}</color> ", color, c, s); } public string RewardText(int i) { if (node == null) return ""; return string.Format("{0}{1}{2}", coloredText(node.getFundsString(i), '£', "#69D84FFF"), coloredText(node.getScienceString(i), '©', "#02D8E9FF"), coloredText(node.getRepString(i), '¡', "#C9B003FF")); } } }
using System; using System.Collections.Generic; using ContractsWindow.Unity.Interfaces; using ProgressParser; namespace ContractsWindow.PanelInterfaces { public class IntervalNodeUI : IIntervalNode { private progressInterval node; public IntervalNodeUI(progressInterval n) { if (n == null) return; node = n; } public bool IsReached { get { if (node == null) return false; return node.IsReached; } } public int Intervals { get { if (node == null) return 0; return node.TotalIntervals; } } public int NodeInterval { get { if (node == null) return 0; return node.Interval; } } public string NodeTitle { get { if (node == null) return ""; return node.Descriptor; } } public string NodeValue(int i) { if (node == null) return ""; return node.getRecord(i).ToString(); } public string RewardText(int i) { if (node == null) return ""; return string.Format("<color=#69D84FFF>£ {0}</color> <color=#02D8E9FF>© {1}</color> <color=#C9B003FF>¡ {2}</color>", node.getFundsString(i), node.getScienceString(i), node.getRepString(i)); } } }
mit
C#
42e88a0351d0250fc84806adbf3d33e60023eed4
Adjust size of spinner based on available size for control
bbqchickenrobot/Eto-1,l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,PowerOfCode/Eto,l8s/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,l8s/Eto
Source/Eto.Platform.iOS/Forms/Controls/SpinnerHandler.cs
Source/Eto.Platform.iOS/Forms/Controls/SpinnerHandler.cs
using System; using MonoTouch.UIKit; using Eto.Forms; using Eto.Drawing; namespace Eto.Platform.iOS.Forms.Controls { public class SpinnerHandler : IosControl<UIActivityIndicatorView, Spinner>, ISpinner { bool enabled; public SpinnerHandler() { Control = new UIActivityIndicatorView { HidesWhenStopped = false, ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray }; } protected override void Initialize() { base.Initialize(); Widget.SizeChanged += HandleSizeChanged; } void HandleSizeChanged (object sender, EventArgs e) { var size = Math.Min(Size.Width, Size.Height); if (size < 32) Control.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray; else { Control.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge; Control.Color = UIColor.Gray; } } protected override SizeF GetNaturalSize(SizeF availableSize) { return new SizeF(16, 16); } public override void OnLoadComplete(EventArgs e) { base.OnLoadComplete(e); if (enabled) Control.StartAnimating(); } public override void OnUnLoad(EventArgs e) { base.OnUnLoad(e); if (enabled) Control.StopAnimating(); } public override bool Enabled { get { return enabled; } set { if (enabled != value) { enabled = value; if (Widget.Loaded) { if (enabled) Control.StartAnimating(); else Control.StopAnimating(); } } } } } }
using System; using MonoTouch.UIKit; using Eto.Forms; using Eto.Drawing; namespace Eto.Platform.iOS.Forms.Controls { public class SpinnerHandler : IosControl<UIActivityIndicatorView, Spinner>, ISpinner { bool enabled; public SpinnerHandler() { Control = new UIActivityIndicatorView { HidesWhenStopped = false, ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray }; } protected override SizeF GetNaturalSize(SizeF availableSize) { return new SizeF(16, 16); } public override void OnLoadComplete(EventArgs e) { base.OnLoadComplete(e); if (enabled) Control.StartAnimating(); } public override void OnUnLoad(EventArgs e) { base.OnUnLoad(e); if (enabled) Control.StopAnimating(); } public override bool Enabled { get { return enabled; } set { if (enabled != value) { enabled = value; if (Widget.Loaded) { if (enabled) Control.StartAnimating(); else Control.StopAnimating(); } } } } } }
bsd-3-clause
C#
2a2eb9c9f9715fc792c1abb64526835ed2c69893
Fix wrong conversion of byte[] identifiers for MySQL (#1303).
LinqToDB4iSeries/linq2db,ronnyek/linq2db,linq2db/linq2db,LinqToDB4iSeries/linq2db,MaceWindu/linq2db,linq2db/linq2db,MaceWindu/linq2db
Source/LinqToDB/DataProvider/MySql/MySqlMappingSchema.cs
Source/LinqToDB/DataProvider/MySql/MySqlMappingSchema.cs
using System; using System.Text; using System.Data.Linq; namespace LinqToDB.DataProvider.MySql { using Mapping; using SqlQuery; public class MySqlMappingSchema : MappingSchema { public MySqlMappingSchema() : this(ProviderName.MySql) { } protected MySqlMappingSchema(string configuration) : base(configuration) { SetValueToSqlConverter(typeof(String), (sb,dt,v) => ConvertStringToSql(sb, v.ToString())); SetValueToSqlConverter(typeof(Char), (sb,dt,v) => ConvertCharToSql (sb, (char)v)); SetValueToSqlConverter(typeof(byte[]), (sb,dt,v) => ConvertBinaryToSql(sb, (byte[])v)); SetValueToSqlConverter(typeof(Binary), (sb,dt,v) => ConvertBinaryToSql(sb, ((Binary)v).ToArray())); SetDataType(typeof(string), new SqlDataType(DataType.NVarChar, typeof(string), 255)); } static void ConvertStringToSql(StringBuilder stringBuilder, string value) { stringBuilder .Append('\'') .Append(value.Replace("\\", "\\\\").Replace("'", "''")) .Append('\''); } static void ConvertCharToSql(StringBuilder stringBuilder, char value) { if (value == '\\') { stringBuilder.Append("\\\\"); } else { stringBuilder.Append('\''); if (value == '\'') stringBuilder.Append("''"); else stringBuilder.Append(value); stringBuilder.Append('\''); } } static void ConvertBinaryToSql(StringBuilder stringBuilder, byte[] value) { stringBuilder.Append("0x"); foreach (var b in value) stringBuilder.Append(b.ToString("X2")); } } }
using System; using System.Text; namespace LinqToDB.DataProvider.MySql { using Mapping; using SqlQuery; public class MySqlMappingSchema : MappingSchema { public MySqlMappingSchema() : this(ProviderName.MySql) { } protected MySqlMappingSchema(string configuration) : base(configuration) { SetValueToSqlConverter(typeof(String), (sb,dt,v) => ConvertStringToSql(sb, v.ToString())); SetValueToSqlConverter(typeof(Char), (sb,dt,v) => ConvertCharToSql (sb, (char)v)); SetDataType(typeof(string), new SqlDataType(DataType.NVarChar, typeof(string), 255)); } static void ConvertStringToSql(StringBuilder stringBuilder, string value) { stringBuilder .Append('\'') .Append(value.Replace("\\", "\\\\").Replace("'", "''")) .Append('\''); } static void ConvertCharToSql(StringBuilder stringBuilder, char value) { if (value == '\\') { stringBuilder.Append("\\\\"); } else { stringBuilder.Append('\''); if (value == '\'') stringBuilder.Append("''"); else stringBuilder.Append(value); stringBuilder.Append('\''); } } } }
mit
C#
d690a85917d83527a03ec2c34c93585756f00e4e
update assembly info
johndpalm/Citrius.Owin.Security.Foursquare
Citrius.Owin.Security.Foursquare/Properties/AssemblyInfo.cs
Citrius.Owin.Security.Foursquare/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("Citrius.Owin.Security.Foursquare")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Citrius Corporation")] [assembly: AssemblyProduct("Citrius.Owin.Security.Foursquare")] [assembly: AssemblyCopyright("Copyright © 2013 Citrius Corp.")] [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("6ce5a341-70dc-4eae-af64-c901950f5918")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Citrius.Owin.Security.Foursquare")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Citrius.Owin.Security.Foursquare")] [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("6ce5a341-70dc-4eae-af64-c901950f5918")] // 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#
fc526a2ff90e4128f961a8c25f57dcfe4ddf8f0b
Fix failing test on Linux
oocx/acme.net
src/Oocx.ACME.Tests/Serialization/RegistrationTests.cs
src/Oocx.ACME.Tests/Serialization/RegistrationTests.cs
using System; using Newtonsoft.Json; using Oocx.ACME.Jose; using Oocx.ACME.Protocol; using Xunit; namespace Oocx.ACME.Tests { public class RegistrationTests { [Fact] public void Can_serialize() { var request = new NewRegistrationRequest { Contact = new[] { "mailto:cert-admin@example.com", "tel:+12025551212" }, Key = new JsonWebKey { Algorithm = "none" }, Agreement = "https://example.com/acme/terms", Authorizations = "https://example.com/acme/reg/1/authz", Certificates = "https://example.com/acme/reg/1/cert", }; var json = JsonConvert.SerializeObject(request, Formatting.Indented, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }); Assert.Equal(@"{ ""resource"": ""new-reg"", ""jwk"": { ""alg"": ""none"" }, ""contact"": [ ""mailto:cert-admin@example.com"", ""tel:+12025551212"" ], ""agreement"": ""https://example.com/acme/terms"", ""authorizations"": ""https://example.com/acme/reg/1/authz"", ""certificates"": ""https://example.com/acme/reg/1/cert"" }".Replace("\r\n", "\n"), json.Replace("\r\n", "\n")); } } }
using System; using Newtonsoft.Json; using Oocx.ACME.Jose; using Oocx.ACME.Protocol; using Xunit; namespace Oocx.ACME.Tests { public class RegistrationTests { [Fact] public void Can_serialize() { var request = new NewRegistrationRequest { Contact = new[] { "mailto:cert-admin@example.com", "tel:+12025551212" }, Key = new JsonWebKey { Algorithm = "none" }, Agreement = "https://example.com/acme/terms", Authorizations = "https://example.com/acme/reg/1/authz", Certificates = "https://example.com/acme/reg/1/cert", }; var json = JsonConvert.SerializeObject(request, Formatting.Indented, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }); Assert.Equal(@"{ ""resource"": ""new-reg"", ""jwk"": { ""alg"": ""none"" }, ""contact"": [ ""mailto:cert-admin@example.com"", ""tel:+12025551212"" ], ""agreement"": ""https://example.com/acme/terms"", ""authorizations"": ""https://example.com/acme/reg/1/authz"", ""certificates"": ""https://example.com/acme/reg/1/cert"" }", json); } } }
mit
C#
90efc59434bd9143d6be26f86754b0f63123e900
Update WebService1.asmx.cs
aravindbaskaran/DotNetFile-UploadService,aravindbaskaran/DotNetFile-UploadService
WebService1.asmx.cs
WebService1.asmx.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; using System.Web.Services; namespace WebApplication2 { /// <summary> /// Summary description for WebService1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class WebService1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] // Not mobile friendly public void Upload(string filename, byte[] DocBuffer) { var appData = Server.MapPath("~/App_Data"); var file = Path.Combine(appData, Path.GetFileName(filename)); File.WriteAllBytes(file, DocBuffer); } [WebMethod] // Works all around! public string TransferFile() { HttpContext postedContext = HttpContext.Current; // Get other parameters in request using Params.Get String fileName = postedContext.Request.Params.Get("FileName"); String fileIdentifier = postedContext.Request.Params.Get("FileIdentifier"); String user = postedContext.Request.Params.Get("UserId"); HttpFileCollection FilesInRequest = postedContext.Request.Files; for(int i = 0; i < FilesInRequest.AllKeys.Length; i++) { // Loop through to get all files in the request HttpPostedFile item = FilesInRequest.Get(i); string filename = item.FileName; byte[] fileBytes = new byte[item.ContentLength]; item.InputStream.Read(fileBytes, 0, item.ContentLength); var appData = Server.MapPath("~/App_Data"); var file = Path.Combine(appData, Path.GetFileName(filename)); File.WriteAllBytes(file, fileBytes); } return "Superb, saved"; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; using System.Web.Services; namespace WebApplication2 { /// <summary> /// Summary description for WebService1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class WebService1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] // Not mobile friendly public void Upload(string filename, byte[] DocBuffer) { var appData = Server.MapPath("~/App_Data"); var file = Path.Combine(appData, Path.GetFileName(filename)); File.WriteAllBytes(file, DocBuffer); } [WebMethod] // Works all around! public string TransferFile() { HttpContext postedContext = HttpContext.Current; // Get other parameters in request using Params.Get String fileName = postedContext.Request.Params.Get("FileName"); HttpFileCollection FilesInRequest = postedContext.Request.Files; for(int i = 0; i < FilesInRequest.AllKeys.Length; i++) { // Loop through to get all files in the request HttpPostedFile item = FilesInRequest.Get(i); string filename = item.FileName; byte[] fileBytes = new byte[item.ContentLength]; item.InputStream.Read(fileBytes, 0, item.ContentLength); var appData = Server.MapPath("~/App_Data"); var file = Path.Combine(appData, Path.GetFileName(filename)); File.WriteAllBytes(file, fileBytes); } return "Superb, saved"; } } }
mit
C#
5dccbc4532212ec553042f9c80ad1593bb217c21
Remove additional definition of ToolTipText property
nunit/nunit-gui,NUnitSoftware/nunit-gui,nunit/nunit-gui,NUnitSoftware/nunit-gui
src/TestCentric/components/Elements/ICommand.cs
src/TestCentric/components/Elements/ICommand.cs
// *********************************************************************** // Copyright (c) 2015 Charlie Poole // // 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 TestCentric.Gui.Elements { /// <summary> /// CommandHandler is used to request an action /// </summary> public delegate void CommandHandler(); /// <summary> /// CommandHandler<typeparamref name="T"/> is used to request an action /// taking a single argument/> /// </summary> public delegate void CommandHandler<T>(T arg); /// <summary> /// The ICommand interface represents a menu toolStripItem, /// which executes a command. /// </summary> public interface ICommand : IViewElement { /// <summary> /// Execute event is raised to signal the presenter /// to execute the command with which this menu /// toolStripItem is associated. /// </summary> event CommandHandler Execute; } public interface ICommand<T> : IViewElement { event CommandHandler<T> Execute; } }
// *********************************************************************** // Copyright (c) 2015 Charlie Poole // // 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 TestCentric.Gui.Elements { /// <summary> /// CommandHandler is used to request an action /// </summary> public delegate void CommandHandler(); /// <summary> /// CommandHandler<typeparamref name="T"/> is used to request an action /// taking a single argument/> /// </summary> public delegate void CommandHandler<T>(T arg); /// <summary> /// The ICommand interface represents a menu toolStripItem, /// which executes a command. /// </summary> public interface ICommand : IViewElement { /// <summary> /// Execute event is raised to signal the presenter /// to execute the command with which this menu /// toolStripItem is associated. /// </summary> event CommandHandler Execute; } public interface ICommand<T> : IViewElement { event CommandHandler<T> Execute; string ToolTipText { get; set; } } }
mit
C#
f9c71915bcff1ab6b6f10fb560fc37c81a301876
Add ProductId parameter to StripePlanListOptions
stripe/stripe-dotnet,richardlawley/stripe.net
src/Stripe.net/Services/Plans/StripePlanListOptions.cs
src/Stripe.net/Services/Plans/StripePlanListOptions.cs
using Newtonsoft.Json; namespace Stripe { public class StripePlanListOptions : StripeListOptions { [JsonProperty("created")] public StripeDateFilter Created { get; set; } /// <summary> /// Only return plans for the given product. /// </summary> [JsonProperty("product")] public string ProductId { get; set; } } }
using Newtonsoft.Json; namespace Stripe { public class StripePlanListOptions : StripeListOptions { } }
apache-2.0
C#
43e77757f78e527fbb2be7b804d9dc1fbc397640
Update Heal.cs
jappi00/Mittelalter-2D-Game
Assets/Scripts/Player/Heal.cs
Assets/Scripts/Player/Heal.cs
using UnityEngine; using System.Collections; using UnityEngine.UI; public class Heal : MonoBehaviour { private float currentHealth; public Slider healthbar; //Lebens anzeige public float heal; // Update is called once per frame void OnTriggerEnter2D(Collider2D col) { currentHealth = healthbar.value + heal; healthbar.value = currentHealth; if (currentHealth == 0) { Application.LoadLevel(0); } } }
using UnityEngine; using System.Collections; using UnityEngine.UI; public class Heal : MonoBehaviour { private Transform player; private float currentHealth; public Slider healthbar; //Lebens anzeige public float heal; // Update is called once per frame void OnTriggerEnter2D(Collider2D col) { currentHealth = healthbar.value + heal; healthbar.value = currentHealth; if (currentHealth == 0) { Application.LoadLevel(0); } } }
apache-2.0
C#
8bfe450d7c9bc8c3b156d8fda3931a1fe8ae7d94
Test fix?
lucaslorentz/minicover,lucaslorentz/minicover,lucaslorentz/minicover
src/MiniCover/Commands/Options/WorkingDirectoryOption.cs
src/MiniCover/Commands/Options/WorkingDirectoryOption.cs
using System; using System.IO; namespace MiniCover.Commands.Options { internal class WorkingDirectoryOption : MiniCoverOption<DirectoryInfo> { private const string DefaultValue = "./"; private const string OptionTemplate = "--workdir"; private static readonly string Description = $"Change working directory [default: {DefaultValue}]"; internal WorkingDirectoryOption() : base(Description, OptionTemplate) { } protected override DirectoryInfo GetOptionValue() { var workingDirectoryPath = Option.Value() ?? DefaultValue; Directory.CreateDirectory(workingDirectoryPath); var directory = new DirectoryInfo(workingDirectoryPath); Console.WriteLine($"Changing working directory to '{directory.FullName}'"); Directory.SetCurrentDirectory(directory.FullName); return directory; } protected override bool Validation() => true; } }
using System; using System.IO; namespace MiniCover.Commands.Options { internal class WorkingDirectoryOption : MiniCoverOption<DirectoryInfo> { private const string DefaultValue = "./"; private const string OptionTemplate = "--workdir"; private static readonly string Description = $"Change working directory [default: {DefaultValue}]"; public WorkingDirectoryOption() : base(Description, OptionTemplate) { } protected override DirectoryInfo GetOptionValue() { var workingDirectoryPath = Option.Value() ?? DefaultValue; Directory.CreateDirectory(workingDirectoryPath); var directory = new DirectoryInfo(workingDirectoryPath); Console.WriteLine($"Changing working directory to '{directory.FullName}'"); Directory.SetCurrentDirectory(directory.FullName); return new DirectoryInfo(workingDirectoryPath); } protected override bool Validation() => true; } }
mit
C#
f3431313c4f700fb9a06d1dd9bc67d27a4eecdbd
Add Method to Get Device
ZhangGaoxing/windows-iot-demo,ZhangGaoxing/windows-iot-demo,ZhangGaoxing/windows-iot-demo
AM2320/AM2320Demo/AM2320Demo/AM2320.cs
AM2320/AM2320Demo/AM2320Demo/AM2320.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Devices.I2c; namespace AM2320Demo { public struct AM2320Data { public double Temperature; public double Humidity; } public class AM2320 : IDisposable { private I2cDevice sensor; private const byte AM2320_ADDR = 0x5C; /// <summary> /// Initialize /// </summary> public async Task InitializeAsync() { var settings = new I2cConnectionSettings(AM2320_ADDR); settings.BusSpeed = I2cBusSpeed.StandardMode; var controller = await I2cController.GetDefaultAsync(); sensor = controller.GetDevice(settings); } public AM2320Data Read() { byte[] readBuf = new byte[4]; sensor.WriteRead(new byte[] { 0x03, 0x00, 0x04 }, readBuf); double rawH = BitConverter.ToInt16(readBuf, 0); double rawT = BitConverter.ToInt16(readBuf, 2); AM2320Data data = new AM2320Data { Temperature = rawT / 10.0, Humidity = rawH / 10.0 }; return data; } public I2cDevice GetDevice() { return sensor; } public void Dispose() { sensor.Dispose(); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Devices.I2c; namespace AM2320Demo { public struct AM2320Data { public double Temperature; public double Humidity; } public class AM2320 : IDisposable { private I2cDevice sensor; private const byte AM2320_ADDR = 0x5C; /// <summary> /// Initialize /// </summary> public async Task InitializeAsync() { var settings = new I2cConnectionSettings(AM2320_ADDR); settings.BusSpeed = I2cBusSpeed.StandardMode; var controller = await I2cController.GetDefaultAsync(); sensor = controller.GetDevice(settings); } public AM2320Data Read() { byte[] readBuf = new byte[4]; sensor.WriteRead(new byte[] { 0x03, 0x00, 0x04 }, readBuf); double rawH = BitConverter.ToInt16(readBuf, 0); double rawT = BitConverter.ToInt16(readBuf, 2); AM2320Data data = new AM2320Data { Temperature = rawT / 10.0, Humidity = rawH / 10.0 }; return data; } public void Dispose() { sensor.Dispose(); } } }
mit
C#
42ff522cbd5800419056858fb0437e796a25c50d
Update SwaggerExtensionDataAttribute.cs
NSwag/NSwag,RSuter/NSwag,quails4Eva/NSwag,RSuter/NSwag,RSuter/NSwag,NSwag/NSwag,NSwag/NSwag,NSwag/NSwag,quails4Eva/NSwag,quails4Eva/NSwag,RSuter/NSwag,RSuter/NSwag,quails4Eva/NSwag
src/NSwag.Annotations/SwaggerExtensionDataAttribute.cs
src/NSwag.Annotations/SwaggerExtensionDataAttribute.cs
//----------------------------------------------------------------------- // <copyright file="SwaggerTagAttribute.cs" company="NSwag"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System; namespace NSwag.Annotations { /// <summary>Indicates extension data to be added to the Swagger definition.</summary> /// <remarks>Requires the SwaggerExtensionDataOperationProcessor to be used in the Swagger definition generation.</remarks> /// <seealso cref="System.Attribute" /> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true)] public sealed class SwaggerExtensionDataAttribute : Attribute { /// <summary>Initializes a new instance of the <see cref="SwaggerExtensionDataAttribute"/> class.</summary> /// <param name="key">The key.</param> /// <param name="value">The value.</param> public SwaggerExtensionDataAttribute(string key, string value) { Key = key; Value = value; } /// <summary>Gets the key.</summary> public string Key { get; } /// <summary>Gets the value.</summary> public string Value { get; } } }
//----------------------------------------------------------------------- // <copyright file="SwaggerTagAttribute.cs" company="NSwag"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System; namespace NSwag.Annotations { /// <summary> /// Indicates extension data to be added to the Swagger definition. /// </summary> /// <remarks>Requires the SwaggerExtensionDataOperationProcessor to be used in the Swagger definition generation.</remarks> /// <seealso cref="System.Attribute" /> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true)] public sealed class SwaggerExtensionDataAttribute : Attribute { /// <summary> /// Initializes a new instance of the <see cref="SwaggerExtensionDataAttribute"/> class. /// </summary> /// <param name="key">The key.</param> /// <param name="value">The value.</param> public SwaggerExtensionDataAttribute(string key, string value) { this.Key = key; this.Value = value; } /// <summary> /// Gets the key. /// </summary> /// <value>The key.</value> public string Key { get; } /// <summary> /// Gets the value. /// </summary> /// <value>The value.</value> public string Value { get; } } }
mit
C#
23e90dfbe40264e5dd9e64df579504bbcb74bb12
Support for ignore attribute
axodox/AxoTools,axodox/AxoTools
AxoCover/Models/TestAssemblyScanner.cs
AxoCover/Models/TestAssemblyScanner.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace AxoCover.Models { public class TestAssemblyScanner : MarshalByRefObject, ITestAssemblyScanner { public string[] ScanAssemblyForTests(string assemblyPath) { var testItems = new List<string>(); try { var assembly = Assembly.LoadFrom(assemblyPath); var testClasses = FilterByAttribute(assembly.ExportedTypes, nameof(TestClassAttribute), nameof(IgnoreAttribute)); foreach (var testClass in testClasses) { var testMethods = FilterByAttribute(testClass.GetMethods(), nameof(TestMethodAttribute), nameof(IgnoreAttribute)); var testClassName = testClass.FullName; foreach (var testMethod in testMethods) { testItems.Add(testClassName + "." + testMethod.Name); } } } catch { } testItems.Sort(); return testItems.ToArray(); } private static IEnumerable<T> FilterByAttribute<T>(IEnumerable<T> members, string includedAttributeName, string excludedAttributeName) where T : MemberInfo { foreach (var member in members) { var attributes = member.GetCustomAttributesData(); if (attributes.Any(p => p.AttributeType.Name == includedAttributeName) && !attributes.Any(p => p.AttributeType.Name == excludedAttributeName)) { yield return member; } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace AxoCover.Models { public class TestAssemblyScanner : MarshalByRefObject, ITestAssemblyScanner { public string[] ScanAssemblyForTests(string assemblyPath) { var testItems = new List<string>(); try { var assembly = Assembly.LoadFrom(assemblyPath); var testClasses = FilterByAttribute(assembly.ExportedTypes, "TestClassAttribute"); foreach (var testClass in testClasses) { var testMethods = FilterByAttribute(testClass.GetMethods(), "TestMethodAttribute"); var testClassName = testClass.FullName; foreach (var testMethod in testMethods) { testItems.Add(testClassName + "." + testMethod.Name); } } } catch { } testItems.Sort(); return testItems.ToArray(); } private static IEnumerable<T> FilterByAttribute<T>(IEnumerable<T> members, string attributeName) where T : MemberInfo { foreach (var member in members) { if (member.GetCustomAttributesData().Any(p => p.AttributeType.Name == attributeName)) { yield return member; } } } } }
mit
C#
e1448884e4d8c58c5bd7dfd683442249993e473c
Use Allow-List; Regex for Slug Generation (#84)
VenusInterns/BlogTemplate,VenusInterns/BlogTemplate,VenusInterns/BlogTemplate
BlogTemplate/Services/SlugGenerator.cs
BlogTemplate/Services/SlugGenerator.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BlogTemplate._1.Models; namespace BlogTemplate._1.Services { public class SlugGenerator { private BlogDataStore _dataStore; public SlugGenerator(BlogDataStore dataStore) { _dataStore = dataStore; } public string CreateSlug(string title) { string tempTitle = title; tempTitle = tempTitle.Replace(" ", "-"); Regex allowList = new Regex("([^A-Za-z0-9-])"); string slug = allowList.Replace(tempTitle, ""); return slug; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using BlogTemplate._1.Models; namespace BlogTemplate._1.Services { public class SlugGenerator { private BlogDataStore _dataStore; public SlugGenerator(BlogDataStore dataStore) { _dataStore = dataStore; } public string CreateSlug(string title) { string tempTitle = title; char[] invalidChars = Path.GetInvalidFileNameChars(); foreach (char c in invalidChars) { tempTitle = tempTitle.Replace(c.ToString(), ""); } string slug = tempTitle.Replace(" ", "-"); return slug; } } }
mit
C#
0a82adb68c5b1b40a5a074dde143f58e9e7604b5
add another test case for CardRecord, split constructor and setter
NCTUGDC/HearthStone
HearthStone/HearthStone.Library.Test/CardRecordUnitTest.cs
HearthStone/HearthStone.Library.Test/CardRecordUnitTest.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HearthStone.Library.Test { [TestClass] public class CardRecordUnitTest { class TestCardRecord : CardRecord { public TestCardRecord() : base() { } public TestCardRecord(int cardRecordID, int cardID) : base(cardRecordID, cardID) { } public void SetCardRecordID(int ID) { CardRecordID = ID; } } [TestMethod] public void CardRecordIDTestMethod1() { Assert.IsNotNull(CardManager.Instance); Assert.IsNotNull(CardManager.Instance.Cards); try { int anyValidCardID = CardManager.Instance.Cards.First<Card>().CardID; foreach (int id in new int[] { 0, 1, 2, 3, 4 }) { TestCardRecord test = new TestCardRecord(id, anyValidCardID); Assert.IsTrue(test.CardRecordID == id, "Invalid Constructor Setter for CardRecordID: " + id); } } catch (ArgumentNullException) { Assert.Fail("Unable to run the test case, no valid card"); } } [TestMethod] public void CardRecordIDTestMethod2() { TestCardRecord test = new TestCardRecord(); foreach (int id in new int[] { 0, 1, 2, 3, 4 }) { test.SetCardRecordID(id); Assert.IsTrue(test.CardRecordID == id, "Invalid Setter for CardRecordID: " + id); } } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HearthStone.Library.Test { [TestClass] public class CardRecordUnitTest { class TestCardRecord : CardRecord { public TestCardRecord() : base() { } public TestCardRecord(int cardRecordID, int cardID) : base(cardRecordID, cardID) { } public void SetCardRecordID(int ID) { CardRecordID = ID; } } [TestMethod] public void CardRecordIDTestMethod1() { TestCardRecord test1 = new TestCardRecord(); foreach (int id in new int[] { 0, 1, 2, 3, 4 }){ test1.SetCardRecordID(id); Assert.IsTrue(test1.CardRecordID == id, "Invalid Setter for CardRecordID: to set " + id); } } } }
apache-2.0
C#
855db5b0efe6be842b41bf7c816463a77a7f40a4
add comment
bitzhuwei/CSharpGL,bitzhuwei/CSharpGL,bitzhuwei/CSharpGL
CSharpGL/OpenGLObjects/UniformVariables/UniformVariable.cs
CSharpGL/OpenGLObjects/UniformVariables/UniformVariable.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; namespace CSharpGL { /// <summary> /// An uniform variable in shader. /// </summary> public abstract class UniformVariable { /// <summary> /// variable name. /// </summary> public string VarName { get; private set; } /// <summary> /// location retrieved from shader. /// </summary> public int Location { get; internal set; } /// <summary> /// 标识此uniform变量是否已更新(若为true,则需要在render前一刻提交到GPU) /// <para>Set uniform's value to GPU if true; otherwise nothing to do.</para> /// </summary> [Browsable(false)] public bool Updated { get; set; } /// <summary> /// An uniform variable in shader. /// </summary> /// <param name="varName">variable name.</param> public UniformVariable(string varName) { this.VarName = varName; this.Updated = true; } /// <summary> /// Set uniform's value to GPU. /// </summary> /// <param name="program"></param> public abstract void SetUniform(ShaderProgram program); /// <summary> /// 默认重置Updated = false; /// <para>以避免重复设置。</para> /// <para>某些类型的uniform可能需要重复调用SetUniform()(例如纹理类型的uniform sampler2D)</para> /// <para>Simply set <code>this.Updated = false;</code> by default to avoid repeatly setting uniform variable.</para> /// <para>But some types of uniform variables may need to be set repeatly(uniform sampler2D etc.) and that's when you should override this method.</para> /// </summary> /// <param name="program"></param> public virtual void ResetUniform(ShaderProgram program) { this.Updated = false; } public override string ToString() { return string.Format("{0}: {1}", this.GetType(), this.VarName); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; namespace CSharpGL { /// <summary> /// shader中的一个uniform变量。 /// </summary> public abstract class UniformVariable { /// <summary> /// 变量名。 /// </summary> public string VarName { get; private set; } /// <summary> /// location retrieved from shader. /// </summary> public int Location { get; internal set; } /// <summary> /// 标识此uniform变量是否已更新(若为true,则需要在render前一刻提交到GPU) /// </summary> [Browsable(false)] public bool Updated { get; set; } /// <summary> /// shader中的一个uniform变量。 /// </summary> /// <param name="varName"></param> public UniformVariable(string varName) { this.VarName = varName; this.Updated = true; } /// <summary> /// /// </summary> /// <param name="program"></param> public abstract void SetUniform(ShaderProgram program); /// <summary> /// 默认重置Updated = false; /// <para>以避免重复设置。</para> /// <para>某些类型的uniform可能需要重复调用SetUniform()(例如纹理类型的uniform sampler2D)</para> /// </summary> /// <param name="program"></param> public virtual void ResetUniform(ShaderProgram program) { this.Updated = false; } public override string ToString() { return string.Format("{0}: {1}", this.GetType(), this.VarName); } } }
mit
C#
d0fc4ba47ef54818dcf14cbd63a67179bf6c6dea
Update assembly version
nexussays/Xamarin.Mobile,moljac/Xamarin.Mobile,xamarin/Xamarin.Mobile,orand/Xamarin.Mobile,haithemaraissia/Xamarin.Mobile,xamarin/Xamarin.Mobile
MonoDroid/MonoMobile.Extensions/Properties/AssemblyInfo.cs
MonoDroid/MonoMobile.Extensions/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("Xamarin.Mobile")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xamarin Inc")] [assembly: AssemblyProduct("Xamarin.Mobile")] [assembly: AssemblyCopyright("Copyright Xamarin Inc 2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.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("Xamarin.Mobile")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xamarin Inc")] [assembly: AssemblyProduct("Xamarin.Mobile")] [assembly: AssemblyCopyright("Copyright Xamarin Inc 2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
19159df4ebe714b404f73691ee372bd17e03d68a
move over to interface context
WojcikMike/docs.particular.net
Snippets/Snippets_6/UpgradeGuides/5to6/OutgoingBehavior.cs
Snippets/Snippets_6/UpgradeGuides/5to6/OutgoingBehavior.cs
namespace Snippets6.UpgradeGuides._5to6 { using System; using System.Threading.Tasks; using NServiceBus.Pipeline; using NServiceBus.Pipeline.OutgoingPipeline; #region 5to6header-outgoing-behavior public class OutgoingBehavior : Behavior<IOutgoingLogicalMessageContext> { public override async Task Invoke(IOutgoingLogicalMessageContext context, Func<Task> next) { context.Headers["MyCustomHeader"] = "My custom value"; await next(); } } #endregion }
namespace Snippets6.UpgradeGuides._5to6 { using System; using System.Threading.Tasks; using NServiceBus.Pipeline; using NServiceBus.Pipeline.OutgoingPipeline; #region 5to6header-outgoing-behavior public class OutgoingBehavior : Behavior<OutgoingLogicalMessageContext> { public override async Task Invoke(OutgoingLogicalMessageContext context, Func<Task> next) { context.Headers["MyCustomHeader"] = "My custom value"; await next(); } } #endregion }
apache-2.0
C#
8506a494a36761a88dc0dad976b7f0bce4385f04
fix tree
pixel-stuff/ld_dare_32
Unity/ludum-dare-32-PixelStuff/Assets/Scripts/Tree/tree.cs
Unity/ludum-dare-32-PixelStuff/Assets/Scripts/Tree/tree.cs
using UnityEngine; using System.Collections; public class tree : MonoBehaviour { enum TreeState{ UP, CHOPED, FALLEN, PICKED }; public GameObject rightChop; public GameObject leftChop; public GameObject trunk; public GameObject stump; public float SecondeAnimation; // Use this for initialization private TreeState state; private Transform fallenTransform; private float remaningSeconde; private float RotationZIteration; private bool isShake=true; void Start () { state = TreeState.UP; } // Update is called once per frame void Update () { //test if (this.gameObject.transform.position.x < 0) { chopLeft(); chopRight(); } //!test if ( state == TreeState.UP && isChoped()) { state = TreeState.CHOPED; calculFallPosition(); remaningSeconde = SecondeAnimation; } if (state == TreeState.CHOPED && remaningSeconde > 0) { remaningSeconde -= Time.deltaTime; fall (); } if (remaningSeconde < 0) { trunk.GetComponent<BoxCollider2D>().enabled = false; if(isShake){ GameObject.FindGameObjectWithTag ("CameraManager").GetComponent<CameraManager> ().setShaking(true,true,0.2f); isShake = false; } state = TreeState.FALLEN; } } bool isChoped(){ return rightChop.GetComponent<ChopOnTree> ().isCompletlyChop() && leftChop.GetComponent<ChopOnTree> ().isCompletlyChop(); //return true; } void chopLeft(){ leftChop.GetComponent<ChopOnTree> ().triggerChop (); } void chopRight(){ rightChop.GetComponent<ChopOnTree> ().triggerChop (); } void calculFallPosition(){ RotationZIteration = (-90f) / SecondeAnimation; } void fall(){ //trunk.transform.position = new Vector3 (trunk.transform.position.x + PositionXIteration * Time.deltaTime, trunk.transform.position.y + PositionYIteration * Time.deltaTime, 0); trunk.transform.RotateAround (stump.transform.position, new Vector3 (0, 0, 1), RotationZIteration * Time.deltaTime); } public bool isFallen(){ return state == TreeState.FALLEN; } }
using UnityEngine; using System.Collections; public class tree : MonoBehaviour { enum TreeState{ UP, CHOPED, FALLEN, PICKED }; public GameObject rightChop; public GameObject leftChop; public GameObject trunk; public GameObject stump; public float SecondeAnimation; // Use this for initialization private TreeState state; private Transform fallenTransform; private float remaningSeconde; private float RotationZIteration; void Start () { state = TreeState.UP; } // Update is called once per frame void Update () { //test if (this.gameObject.transform.position.x < 0) { chopLeft(); chopRight(); } //!test if ( state == TreeState.UP && isChoped()) { state = TreeState.CHOPED; calculFallPosition(); remaningSeconde = SecondeAnimation; } if (state == TreeState.CHOPED && remaningSeconde > 0) { remaningSeconde -= Time.deltaTime; fall (); } if (remaningSeconde < 0) { trunk.GetComponent<BoxCollider2D>().enabled = false; GameObject.FindGameObjectWithTag ("CameraManager").GetComponent<CameraManager> ().setShaking(true,true,0.2f); state = TreeState.FALLEN; } } bool isChoped(){ return rightChop.GetComponent<ChopOnTree> ().isCompletlyChop() && leftChop.GetComponent<ChopOnTree> ().isCompletlyChop(); //return true; } void chopLeft(){ leftChop.GetComponent<ChopOnTree> ().triggerChop (); } void chopRight(){ rightChop.GetComponent<ChopOnTree> ().triggerChop (); } void calculFallPosition(){ RotationZIteration = (-90f) / SecondeAnimation; } void fall(){ //trunk.transform.position = new Vector3 (trunk.transform.position.x + PositionXIteration * Time.deltaTime, trunk.transform.position.y + PositionYIteration * Time.deltaTime, 0); trunk.transform.RotateAround (stump.transform.position, new Vector3 (0, 0, 1), RotationZIteration * Time.deltaTime); } public bool isFallen(){ return state == TreeState.FALLEN; } }
mit
C#
9b2c9045ebefe8e29a97164ffb79c45d4a0c667e
revise index calcs
ProActiveGames/randraw
source/randraw/RandomDraw.cs
source/randraw/RandomDraw.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace randraw { class RandomDraw { public void Run( string key, string inpath, string outpath, bool noHeader, int numRowsToSelect) { // load into list var rows = new List<string>(); using (var rdr = new StreamReader(File.OpenRead(inpath))) { while (!rdr.EndOfStream) { rows.Add(rdr.ReadLine()); } } Console.WriteLine("Loaded " + rows.Count + " rows."); // determine row limits var rowMin = 1; var rowMax = rows.Count; if (!noHeader) rowMin++; if (numRowsToSelect > rowMax - rowMin + 1) numRowsToSelect = rowMax - rowMin + 1; Console.WriteLine("Retrieving random " + numRowsToSelect + " rows between " + rowMin + " and " + rowMax + "."); // get randoms var rclient = new Demot.RandomOrgApi.RandomOrgApiClient(key); var rs = rclient.GenerateIntegers(numRowsToSelect, rowMin, rowMax, false); var randomRows = rs.Integers.ToList(); // output using (TextWriter writer = File.CreateText(outpath)) { if (!noHeader) writer.WriteLine(rows[0]); foreach (var randomi in randomRows) { var line = rows.ElementAtOrDefault(randomi - 1); if (line != null) writer.WriteLine(line); } } Console.WriteLine("Output to " + outpath + " completed."); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace randraw { class RandomDraw { public void Run( string key, string inpath, string outpath, bool noHeader, int numRowsToSelect) { // load into list var rows = new List<string>(); using (var rdr = new StreamReader(File.OpenRead(inpath))) { while (!rdr.EndOfStream) { rows.Add(rdr.ReadLine()); } } Console.WriteLine("Loaded " + rows.Count + " rows."); // determine row limits var rowMin = 0; var rowMax = rows.Count - 1; if (!noHeader) rowMin++; if (numRowsToSelect > rowMax - rowMin) numRowsToSelect = rowMax - rowMin; Console.WriteLine("Retrieving random " + numRowsToSelect + " rows between " + rowMin + " and " + rowMax + "."); // get randoms var rclient = new Demot.RandomOrgApi.RandomOrgApiClient(key); var rs = rclient.GenerateIntegers(numRowsToSelect, rowMin, rowMax, false); var randomRows = rs.Integers.ToList(); // output using (TextWriter writer = File.CreateText(outpath)) { if (!noHeader && rows.Any()) writer.WriteLine(rows[0]); foreach (var randomi in randomRows) { var line = rows.ElementAtOrDefault(randomi); if (line != null) writer.WriteLine(line); } } Console.WriteLine("Output to " + outpath + " completed."); } } }
mit
C#
35760ad1e08961da909517c7a54b1486955e8b15
Use helper method.
reaction1989/roslyn,OmarTawfik/roslyn,xasx/roslyn,srivatsn/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,TyOverby/roslyn,bkoelman/roslyn,tannergooding/roslyn,tannergooding/roslyn,dotnet/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,AnthonyDGreen/roslyn,abock/roslyn,DustinCampbell/roslyn,tmat/roslyn,davkean/roslyn,gafter/roslyn,orthoxerox/roslyn,genlu/roslyn,orthoxerox/roslyn,kelltrick/roslyn,VSadov/roslyn,AnthonyDGreen/roslyn,orthoxerox/roslyn,ErikSchierboom/roslyn,heejaechang/roslyn,TyOverby/roslyn,MattWindsor91/roslyn,xasx/roslyn,eriawan/roslyn,CaptainHayashi/roslyn,robinsedlaczek/roslyn,lorcanmooney/roslyn,diryboy/roslyn,khyperia/roslyn,panopticoncentral/roslyn,abock/roslyn,OmarTawfik/roslyn,bartdesmet/roslyn,robinsedlaczek/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,davkean/roslyn,weltkante/roslyn,sharwell/roslyn,tvand7093/roslyn,VSadov/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,ErikSchierboom/roslyn,Hosch250/roslyn,tmat/roslyn,AmadeusW/roslyn,aelij/roslyn,genlu/roslyn,physhi/roslyn,robinsedlaczek/roslyn,reaction1989/roslyn,dpoeschl/roslyn,Giftednewt/roslyn,bkoelman/roslyn,mmitche/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,jcouv/roslyn,CyrusNajmabadi/roslyn,swaroop-sridhar/roslyn,jmarolf/roslyn,diryboy/roslyn,lorcanmooney/roslyn,mattscheffer/roslyn,yeaicc/roslyn,eriawan/roslyn,swaroop-sridhar/roslyn,CyrusNajmabadi/roslyn,brettfo/roslyn,jcouv/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,stephentoub/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,yeaicc/roslyn,bkoelman/roslyn,MichalStrehovsky/roslyn,jasonmalinowski/roslyn,tmat/roslyn,cston/roslyn,xasx/roslyn,sharwell/roslyn,cston/roslyn,tmeschter/roslyn,pdelvo/roslyn,eriawan/roslyn,heejaechang/roslyn,AlekseyTs/roslyn,aelij/roslyn,jamesqo/roslyn,tvand7093/roslyn,TyOverby/roslyn,CaptainHayashi/roslyn,agocke/roslyn,jmarolf/roslyn,brettfo/roslyn,paulvanbrenk/roslyn,aelij/roslyn,MattWindsor91/roslyn,cston/roslyn,mmitche/roslyn,dpoeschl/roslyn,paulvanbrenk/roslyn,MattWindsor91/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,KirillOsenkov/roslyn,jkotas/roslyn,physhi/roslyn,nguerrera/roslyn,genlu/roslyn,nguerrera/roslyn,nguerrera/roslyn,yeaicc/roslyn,heejaechang/roslyn,physhi/roslyn,jmarolf/roslyn,KevinRansom/roslyn,lorcanmooney/roslyn,jkotas/roslyn,jamesqo/roslyn,brettfo/roslyn,kelltrick/roslyn,abock/roslyn,agocke/roslyn,mavasani/roslyn,wvdd007/roslyn,pdelvo/roslyn,khyperia/roslyn,tmeschter/roslyn,pdelvo/roslyn,gafter/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,srivatsn/roslyn,Giftednewt/roslyn,MichalStrehovsky/roslyn,ErikSchierboom/roslyn,srivatsn/roslyn,davkean/roslyn,KirillOsenkov/roslyn,sharwell/roslyn,gafter/roslyn,wvdd007/roslyn,DustinCampbell/roslyn,mattscheffer/roslyn,bartdesmet/roslyn,dpoeschl/roslyn,mmitche/roslyn,AmadeusW/roslyn,dotnet/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,mattscheffer/roslyn,jamesqo/roslyn,kelltrick/roslyn,paulvanbrenk/roslyn,jcouv/roslyn,mavasani/roslyn,Hosch250/roslyn,mavasani/roslyn,jkotas/roslyn,weltkante/roslyn,tannergooding/roslyn,KevinRansom/roslyn,khyperia/roslyn,CaptainHayashi/roslyn,swaroop-sridhar/roslyn,shyamnamboodiripad/roslyn,AnthonyDGreen/roslyn,OmarTawfik/roslyn,reaction1989/roslyn,dotnet/roslyn,Giftednewt/roslyn,tmeschter/roslyn,VSadov/roslyn,agocke/roslyn,MichalStrehovsky/roslyn,MattWindsor91/roslyn,Hosch250/roslyn,tvand7093/roslyn,weltkante/roslyn,DustinCampbell/roslyn,AmadeusW/roslyn
src/Features/Core/Portable/AddImport/CodeActions/SymbolReference.SymbolReferenceCodeAction.cs
src/Features/Core/Portable/AddImport/CodeActions/SymbolReference.SymbolReferenceCodeAction.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.AddImport { internal abstract partial class AbstractAddImportCodeFixProvider<TSimpleNameSyntax> { /// <summary> /// Code action we use when just adding a using, possibly with a project or /// metadata reference. We don't use the standard code action types because /// we want to do things like show a glyph if this will do more than just add /// an import. /// </summary> private abstract class SymbolReferenceCodeAction : AddImportCodeAction { protected SymbolReferenceCodeAction( Document originalDocument, ImmutableArray<TextChange> textChanges, string title, ImmutableArray<string> tags, CodeActionPriority priority) : base(originalDocument, textChanges, title, tags, priority) { } protected override async Task<Solution> GetChangedSolutionAsync(CancellationToken cancellationToken) { var updatedDocument = await GetUpdatedDocumentAsync(cancellationToken).ConfigureAwait(false); // Defer to subtype to add any p2p or metadata refs as appropriate. var updatedProject = UpdateProject(updatedDocument.Project); var updatedSolution = updatedProject.Solution; return updatedSolution; } protected abstract Project UpdateProject(Project project); } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.AddImport { internal abstract partial class AbstractAddImportCodeFixProvider<TSimpleNameSyntax> { /// <summary> /// Code action we use when just adding a using, possibly with a project or /// metadata reference. We don't use the standard code action types because /// we want to do things like show a glyph if this will do more than just add /// an import. /// </summary> private abstract class SymbolReferenceCodeAction : AddImportCodeAction { protected SymbolReferenceCodeAction( Document originalDocument, ImmutableArray<TextChange> textChanges, string title, ImmutableArray<string> tags, CodeActionPriority priority) : base(originalDocument, textChanges, title, tags, priority) { } protected override async Task<Solution> GetChangedSolutionAsync(CancellationToken cancellationToken) { var oldText = await OriginalDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); var newText = oldText.WithChanges(TextChanges); var updatedDocument = OriginalDocument.WithText(newText); var updatedProject = UpdateProject(updatedDocument.Project); var updatedSolution = updatedProject.Solution; return updatedSolution; } protected abstract Project UpdateProject(Project project); } } }
mit
C#
79b802ceb64dfe00126866081b4223cac1adc1f0
Work on bullet trails a tad
TrickWaterArts/ProjectMinotaur
ProjectMinotaur/Assets/Script/Entity/Weapon/BulletTrail.cs
ProjectMinotaur/Assets/Script/Entity/Weapon/BulletTrail.cs
using UnityEngine; public class BulletTrail : MonoBehaviour { public float life = 0.5f; private float alpha = -1.0f; private float time = 0.0f; private LineRenderer line; void Update() { time += Time.deltaTime; if (line == null || alpha < 0.0f) { return; } if (time >= life) { Destroy(gameObject); return; } alpha = time / life / 8.0f; Color c = line.endColor; c.a = 1.0f / 8.0f - alpha; line.startColor = new Color(c.r, c.g, c.b, 0.0f); line.endColor = c; } public static void Create(Vector3 start, Vector3 end) { GameObject trailObj = new GameObject("GunTrail"); trailObj.transform.position = Vector3.zero; BulletTrail trail = trailObj.AddComponent<BulletTrail>(); trail.line = trailObj.AddComponent<LineRenderer>(); trail.line.startWidth = 0.015f; trail.line.endWidth = 0.015f; Vector3 dir = (end - start).normalized; dir *= 15.0f; dir += start; if (Vector3.Distance(start, dir) >= Vector3.Distance(start, end)) { end = dir; } trail.line.SetPositions(new Vector3[] { start, dir, end }); trail.line.material = Resources.Load<Material>("BulletTrailMaterial"); trail.line.startColor = new Color(1.0f, 1.0f, 1.0f, 1.0f / 8.0f); trail.line.endColor = new Color(1.0f, 1.0f, 1.0f, 1.0f / 8.0f); trail.alpha = 1.0f; } }
using UnityEngine; public class BulletTrail : MonoBehaviour { public float life = 0.05f; private float alpha = -1.0f; private float time = 0.0f; private Vector3 start; private Vector3 end; private LineRenderer line; void Update() { time += Time.deltaTime; if (line == null || alpha < 0.0f) { return; } if (time >= life) { Destroy(gameObject); return; } alpha = time / life / 8.0f; Color c = line.startColor; c.a = 0.125f - alpha; line.startColor = c; line.endColor = c; } public static void Create(Vector3 start, Vector3 end) { GameObject trailObj = new GameObject("GunTrail"); trailObj.transform.position = Vector3.zero; BulletTrail trail = trailObj.AddComponent<BulletTrail>(); trail.start = start; trail.end = end; trail.line = trailObj.AddComponent<LineRenderer>(); trail.line.startWidth = 0.015f; trail.line.endWidth = 0.015f; trail.line.SetPositions(new Vector3[] { trail.start, trail.end }); trail.line.material = Resources.Load<Material>("BulletTrailMaterial"); trail.alpha = 1.0f; } }
apache-2.0
C#
6514f06e470584fa16bf3b6b3d80091bee3e4732
Update AssemblyInfo
AMDL/amdl2maml
amdl2maml/Converter/Properties/AssemblyInfo.cs
amdl2maml/Converter/Properties/AssemblyInfo.cs
using System; 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("Amdl.Maml.Converter")] [assembly: AssemblyDescription("Converts AMDL to MAML")] #if DEBUG [assembly: AssemblyConfiguration("")] #else [assembly: AssemblyConfiguration("")] #endif [assembly: AssemblyCompany("Dmitry Shechtman")] [assembly: AssemblyProduct("AMDL to MAML Converter")] [assembly: AssemblyCopyright("Copyright © Dmitry Shechtman 2015 ")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] [assembly: CLSCompliant(true)] [assembly: AssemblyVersion("1.0.*")]
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System; // 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("Converter")] [assembly: AssemblyDescription("Converts AMDL to MAML")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Dmitry Shechtman")] [assembly: AssemblyProduct("Converter")] [assembly: AssemblyCopyright("Copyright © Dmitry Shechtman 2015 ")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] [assembly: CLSCompliant(true)] [assembly: AssemblyVersion("1.0.*")]
apache-2.0
C#
1fe7c3dc3a7281da4c8d66b40444dcee8b901acf
fix typo
mattwalden/RestSharp,felipegtx/RestSharp,PKRoma/RestSharp,periface/RestSharp,dmgandini/RestSharp,haithemaraissia/RestSharp,wparad/RestSharp,eamonwoortman/RestSharp.Unity,restsharp/RestSharp,KraigM/RestSharp,fmmendo/RestSharp,SaltyDH/RestSharp,huoxudong125/RestSharp,lydonchandra/RestSharp,rivy/RestSharp,dgreenbean/RestSharp,dyh333/RestSharp,rucila/RestSharp,cnascimento/RestSharp,chengxiaole/RestSharp,mattleibow/RestSharp,amccarter/RestSharp,who/RestSharp,jiangzm/RestSharp,wparad/RestSharp,benfo/RestSharp,kouweizhong/RestSharp,RestSharp-resurrected/RestSharp,mwereda/RestSharp,uQr/RestSharp
RestSharp.MonoTouch/Extensions/ResponseStatusExtensions.cs
RestSharp.MonoTouch/Extensions/ResponseStatusExtensions.cs
using System; using System.Net; namespace RestSharp.Extensions { public static class ResponseStatusExtensions { /// <summary> /// Convert a <see cref="ResponseStatus"/> to a <see cref="WebException"/> instance. /// </summary> /// <param name="responseStatus">The response status.</param> /// <returns></returns> /// <exception cref="System.ArgumentOutOfRangeException">responseStatus</exception> public static WebException ToWebException(this ResponseStatus responseStatus) { switch (responseStatus) { case ResponseStatus.None: return new WebException("The request could not be processed.", WebExceptionStatus.ServerProtocolViolation); case ResponseStatus.Error: return new WebException("An error occurred while processing the request.", WebExceptionStatus.ServerProtocolViolation); case ResponseStatus.TimedOut: return new WebException("The request timed-out.", WebExceptionStatus.Timeout); case ResponseStatus.Aborted: return new WebException("The request was aborted.", WebExceptionStatus.Timeout); default: throw new ArgumentOutOfRangeException("responseStatus"); } } } }
using System; using System.Net; namespace RestSharp.Extensions { public static class ResponseStatusExtensions { /// <summary> /// Convert a <see cref="ResponseStatus"/> to a <see cref="WebException"/> instance. /// </summary> /// <param name="responseStatus">The response status.</param> /// <returns></returns> /// <exception cref="System.ArgumentOutOfRangeException">responseStatus</exception> public static WebException ToWebException(this ResponseStatus responseStatus) { switch (responseStatus) { case ResponseStatus.None: return new WebException("The request could not be processed.", WebExceptionStatus.ServerProtocolViolation); case ResponseStatus.Error: return new WebException("An error occured while processing the request.", WebExceptionStatus.ServerProtocolViolation); case ResponseStatus.TimedOut: return new WebException("The request timed-out.", WebExceptionStatus.Timeout); case ResponseStatus.Aborted: return new WebException("The request was aborted.", WebExceptionStatus.Timeout); default: throw new ArgumentOutOfRangeException("responseStatus"); } } } }
apache-2.0
C#
11f7523134c125b89a5031731bddabdc7af4ed46
return notfound
crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin
SignInCheckIn/SignInCheckIn/Controllers/KioskController.cs
SignInCheckIn/SignInCheckIn/Controllers/KioskController.cs
using System; using System.Collections.Generic; using System.Web.Http; using System.Web.Http.Description; using MinistryPlatform.Translation.Repositories.Interfaces; using SignInCheckIn.Exceptions.Models; using SignInCheckIn.Models.DTO; using SignInCheckIn.Security; using SignInCheckIn.Services.Interfaces; using Crossroads.ApiVersioning; using Crossroads.Web.Common.Security; using log4net.Repository.Hierarchy; namespace SignInCheckIn.Controllers { public class KioskController : MpAuth { private readonly IKioskService _kioskService; public KioskController(IKioskService kioskService, IAuthenticationRepository authenticationRepository) : base(authenticationRepository) { _kioskService = kioskService; } [HttpGet] [ResponseType(typeof(List<KioskConfigDto>))] [VersionedRoute(template: "kiosks/{kioskid}", minimumVersion: "1.0.0")] [Route("kiosks/{kioskid}")] public IHttpActionResult GetEvents( [FromUri(Name = "kioskid")] Guid kioskId) { try { var kioskList = _kioskService.GetKioskConfigByIdentifier(kioskId); if (kioskList == null) { Logger.Error($"Kiosk config error for kiosk guid: {kioskId}"); return NotFound(); } return Ok(kioskList); } catch (Exception e) { Logger.Error($"Kiosk config error for kiosk guid: {kioskId}", e); var apiError = new ApiErrorDto("Get Kiosks", e); throw new HttpResponseException(apiError.HttpResponseMessage); } } } }
using System; using System.Collections.Generic; using System.Web.Http; using System.Web.Http.Description; using MinistryPlatform.Translation.Repositories.Interfaces; using SignInCheckIn.Exceptions.Models; using SignInCheckIn.Models.DTO; using SignInCheckIn.Security; using SignInCheckIn.Services.Interfaces; using Crossroads.ApiVersioning; using Crossroads.Web.Common.Security; using log4net.Repository.Hierarchy; namespace SignInCheckIn.Controllers { public class KioskController : MpAuth { private readonly IKioskService _kioskService; public KioskController(IKioskService kioskService, IAuthenticationRepository authenticationRepository) : base(authenticationRepository) { _kioskService = kioskService; } [HttpGet] [ResponseType(typeof(List<KioskConfigDto>))] [VersionedRoute(template: "kiosks/{kioskid}", minimumVersion: "1.0.0")] [Route("kiosks/{kioskid}")] public IHttpActionResult GetEvents( [FromUri(Name = "kioskid")] Guid kioskId) { try { var kioskList = _kioskService.GetKioskConfigByIdentifier(kioskId); if (kioskList == null) { Logger.Error($"Kiosk config error for kiosk guid: {kioskId}"); } return Ok(kioskList); } catch (Exception e) { Logger.Error($"Kiosk config error for kiosk guid: {kioskId}", e); var apiError = new ApiErrorDto("Get Kiosks", e); throw new HttpResponseException(apiError.HttpResponseMessage); } } } }
bsd-2-clause
C#
f99d0151e6fbb0962b50f8200ab0ee272e76874c
Fix AI/NPC error (#10730)
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs
Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs
using Content.Server.AI.Components; using Content.Server.AI.Utils; using Content.Server.Clothing.Components; using Content.Server.Storage.Components; using JetBrains.Annotations; using Robust.Server.Containers; namespace Content.Server.AI.WorldState.States.Clothing { [UsedImplicitly] public sealed class NearbyClothingState : CachedStateData<List<EntityUid>> { public override string Name => "NearbyClothing"; protected override List<EntityUid> GetTrueValue() { var result = new List<EntityUid>(); var entMan = IoCManager.Resolve<IEntityManager>(); if (!entMan.TryGetComponent(Owner, out NPCComponent? controller)) { return result; } var containerSystem = entMan.EntitySysManager.GetEntitySystem<ContainerSystem>(); foreach (var entity in Visibility.GetNearestEntities(entMan.GetComponent<TransformComponent>(Owner).Coordinates, typeof(ClothingComponent), controller.VisionRadius)) { if (containerSystem.TryGetContainingContainer(entity, out var container)) { if (!entMan.HasComponent<EntityStorageComponent>(container.Owner)) { continue; } } result.Add(entity); } return result; } } }
using Content.Server.AI.Components; using Content.Server.AI.Utils; using Content.Server.Clothing.Components; using Content.Server.Storage.Components; using JetBrains.Annotations; using Robust.Server.Containers; namespace Content.Server.AI.WorldState.States.Clothing { [UsedImplicitly] public sealed class NearbyClothingState : CachedStateData<List<EntityUid>> { public override string Name => "NearbyClothing"; protected override List<EntityUid> GetTrueValue() { var result = new List<EntityUid>(); var entMan = IoCManager.Resolve<IEntityManager>(); if (!entMan.TryGetComponent(Owner, out NPCComponent? controller)) { return result; } var containerSystem = IoCManager.Resolve<ContainerSystem>(); foreach (var entity in Visibility.GetNearestEntities(entMan.GetComponent<TransformComponent>(Owner).Coordinates, typeof(ClothingComponent), controller.VisionRadius)) { if (containerSystem.TryGetContainingContainer(entity, out var container)) { if (!entMan.HasComponent<EntityStorageComponent>(container.Owner)) { continue; } } result.Add(entity); } return result; } } }
mit
C#
6a23cdf2beee87197b36e41a2e10a2f43f05ecce
Remove old action methods
diolive/cache,diolive/cache
DioLive.Cache/src/DioLive.Cache.WebUI/Controllers/HomeController.cs
DioLive.Cache/src/DioLive.Cache.WebUI/Controllers/HomeController.cs
using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; namespace DioLive.Cache.WebUI.Controllers { public class HomeController : Controller { public IActionResult Index() { return View(); } public IActionResult Error() { return View(); } [HttpPost] public IActionResult SetLanguage(string culture, string returnUrl) { Response.Cookies.Append( CookieRequestCultureProvider.DefaultCookieName, CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)), new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) } ); return LocalRedirect(returnUrl); } } }
using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; namespace DioLive.Cache.WebUI.Controllers { public class HomeController : Controller { public IActionResult Index() { return View(); } public IActionResult About() { ViewData["Message"] = "Your application description page."; return View(); } public IActionResult Contact() { ViewData["Message"] = "Your contact page."; return View(); } public IActionResult Error() { return View(); } [HttpPost] public IActionResult SetLanguage(string culture, string returnUrl) { Response.Cookies.Append( CookieRequestCultureProvider.DefaultCookieName, CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)), new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) } ); return LocalRedirect(returnUrl); } } }
mit
C#
f79ed00af5f6ceb60620c99632a09595e5cacc61
Fix for the wrong updateBuildNumber behavior
asbjornu/GitVersion,GitTools/GitVersion,gep13/GitVersion,ermshiperete/GitVersion,ParticularLabs/GitVersion,gep13/GitVersion,ermshiperete/GitVersion,ParticularLabs/GitVersion,GitTools/GitVersion,asbjornu/GitVersion,ermshiperete/GitVersion,ermshiperete/GitVersion
src/GitVersionCore/Core/BuildAgentBase.cs
src/GitVersionCore/Core/BuildAgentBase.cs
using System; using System.Collections.Generic; using GitVersion.Logging; using GitVersion.OutputVariables; namespace GitVersion { public abstract class BuildAgentBase : ICurrentBuildAgent { protected readonly ILog Log; protected IEnvironment Environment { get; } protected BuildAgentBase(IEnvironment environment, ILog log) { Log = log; Environment = environment; } protected abstract string EnvironmentVariable { get; } public abstract string GenerateSetVersionMessage(VersionVariables variables); public abstract string[] GenerateSetParameterMessage(string name, string value); public virtual bool CanApplyToCurrentContext() => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariable)); public virtual string GetCurrentBranch(bool usingDynamicRepos) => null; public virtual bool PreventFetch() => true; public virtual bool ShouldCleanUpRemotes() => false; public virtual void WriteIntegration(Action<string> writer, VersionVariables variables, bool updateBuildNumber = true) { if (writer == null) { return; } if (updateBuildNumber) { writer($"Executing GenerateSetVersionMessage for '{GetType().Name}'."); writer(GenerateSetVersionMessage(variables)); } writer($"Executing GenerateBuildLogOutput for '{GetType().Name}'."); foreach (var buildParameter in GenerateBuildLogOutput(variables)) { writer(buildParameter); } } protected IEnumerable<string> GenerateBuildLogOutput(VersionVariables variables) { var output = new List<string>(); foreach (var variable in variables) { output.AddRange(GenerateSetParameterMessage(variable.Key, variable.Value)); } return output; } } }
using System; using System.Collections.Generic; using GitVersion.Logging; using GitVersion.OutputVariables; namespace GitVersion { public abstract class BuildAgentBase : ICurrentBuildAgent { protected readonly ILog Log; protected IEnvironment Environment { get; } protected BuildAgentBase(IEnvironment environment, ILog log) { Log = log; Environment = environment; } protected abstract string EnvironmentVariable { get; } public abstract string GenerateSetVersionMessage(VersionVariables variables); public abstract string[] GenerateSetParameterMessage(string name, string value); public virtual bool CanApplyToCurrentContext() => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariable)); public virtual string GetCurrentBranch(bool usingDynamicRepos) => null; public virtual bool PreventFetch() => true; public virtual bool ShouldCleanUpRemotes() => false; public virtual void WriteIntegration(Action<string> writer, VersionVariables variables, bool updateBuildNumber = true) { if (writer == null || !updateBuildNumber) { return; } writer($"Executing GenerateSetVersionMessage for '{GetType().Name}'."); writer(GenerateSetVersionMessage(variables)); writer($"Executing GenerateBuildLogOutput for '{GetType().Name}'."); foreach (var buildParameter in GenerateBuildLogOutput(variables)) { writer(buildParameter); } } protected IEnumerable<string> GenerateBuildLogOutput(VersionVariables variables) { var output = new List<string>(); foreach (var variable in variables) { output.AddRange(GenerateSetParameterMessage(variable.Key, variable.Value)); } return output; } } }
mit
C#
b89e872cf72cd0b22f02af270a5a7352a49603d5
Allow word boundary delimiter to be set by user
refactorsaurusrex/FluentConsole
FluentConsole/FluentConsoleSettings.cs
FluentConsole/FluentConsoleSettings.cs
using System; namespace FluentConsole.Library { /// <summary> /// Optionial configuration for FluentConsole /// </summary> public class FluentConsoleSettings { /// <summary> /// Gets or sets a value indicating how long lines of text should be displayed in the console window. /// </summary> public static LineWrapOption LineWrapOption { get; set; } = LineWrapOption.Auto; /// <summary> /// Gets or sets the line width used for wrapping long lines of text. Note: This value is ignored /// unless 'LineWrapOption' is set to 'Manual'. The default width is the value of the /// 'Console.BufferWidth' property. /// </summary> public static int LineWrapWidth { get; set; } = ConsoleWrapper.BufferWidth; /// <summary> /// Gets or sets the delimter used when wrapping long lines of text. The default is a space character. Note: This value is ignored if /// 'LineWrapOption' is set to 'Off'. /// </summary> public static char WordDelimiter { get; set; } = ' '; } }
using System; namespace FluentConsole.Library { /// <summary> /// Optionial configuration for FluentConsole /// </summary> public class FluentConsoleSettings { /// <summary> /// Gets or sets a value indicating how long lines of text should be displayed in the console window. /// </summary> public static LineWrapOption LineWrapOption { get; set; } = LineWrapOption.Auto; /// <summary> /// Gets or sets the line width used for wrapping long lines of text. Note: This value is ignored /// unless 'LineWrapOption' is set to 'Manual'. The default width is the value of the /// 'Console.BufferWidth' property. /// </summary> public static int LineWrapWidth { get; set; } = ConsoleWrapper.BufferWidth; } }
mit
C#
90ed3c4d260753041af8382875ab92b25a8dea8b
Update WorkOrder.cs
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
Test/AdventureWorksFunctionalModel/Production/WorkOrder.cs
Test/AdventureWorksFunctionalModel/Production/WorkOrder.cs
// Copyright Naked Objects Group Ltd, 45 Station Road, Henley on Thames, UK, RG9 1AT // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and limitations under the License. using System; using System.Collections.Generic; using NakedFunctions; namespace AW.Types { public record WorkOrder : IHasModifiedDate { [Hidden] public virtual int WorkOrderID { get; init; } [MemberOrder(22)] public virtual int StockedQty { get; init; } [MemberOrder(24)] public virtual short ScrappedQty { get; init; } [MemberOrder(32)] [Mask("d")] public virtual DateTime? EndDate { get; init; } [Hidden] public virtual short? ScrapReasonID { get; init; } [MemberOrder(26)] public virtual ScrapReason? ScrapReason { get; init; } [MemberOrder(20)] public virtual int OrderQty { get; init; } [MemberOrder(30)] [Mask("d")] public virtual DateTime StartDate { get; init; } [MemberOrder(34)] [Mask("d")] public virtual DateTime DueDate { get; init; } [Hidden] public virtual int ProductID { get; init; } [MemberOrder(10)] #pragma warning disable 8618 public virtual Product Product { get; init; } #pragma warning restore 8618 [RenderEagerly] [TableView(true, "OperationSequence", "ScheduledStartDate", "ScheduledEndDate", "Location", "PlannedCost")] public virtual ICollection<WorkOrderRouting> WorkOrderRoutings { get; init; } = new List<WorkOrderRouting>(); // for testing [Hidden] public virtual string AnAlwaysHiddenReadOnlyProperty => ""; public virtual bool Equals(WorkOrder? other) => ReferenceEquals(this, other); [MemberOrder(99)] [Versioned] public virtual DateTime ModifiedDate { get; init; } public override string ToString() => $"{Product}: {StartDate}"; public override int GetHashCode() => base.GetHashCode(); } }
// Copyright Naked Objects Group Ltd, 45 Station Road, Henley on Thames, UK, RG9 1AT // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and limitations under the License. using System; using System.Collections.Generic; using NakedFunctions; namespace AW.Types { public record WorkOrder : IHasModifiedDate { [Hidden] public virtual int WorkOrderID { get; init; } [MemberOrder(22)] public virtual int StockedQty { get; init; } [MemberOrder(24)] public virtual short ScrappedQty { get; init; } [MemberOrder(32)] [Mask("d")] public virtual DateTime? EndDate { get; init; } [Hidden] public virtual short? ScrapReasonID { get; init; } [MemberOrder(26)] #pragma warning disable 8618 public virtual ScrapReason ScrapReason { get; init; } #pragma warning restore 8618 [MemberOrder(20)] public virtual int OrderQty { get; init; } [MemberOrder(30)] [Mask("d")] public virtual DateTime StartDate { get; init; } [MemberOrder(34)] [Mask("d")] public virtual DateTime DueDate { get; init; } [Hidden] public virtual int ProductID { get; init; } [MemberOrder(10)] #pragma warning disable 8618 public virtual Product Product { get; init; } #pragma warning restore 8618 [RenderEagerly] [TableView(true, "OperationSequence", "ScheduledStartDate", "ScheduledEndDate", "Location", "PlannedCost")] public virtual ICollection<WorkOrderRouting> WorkOrderRoutings { get; init; } = new List<WorkOrderRouting>(); // for testing [Hidden] public virtual string AnAlwaysHiddenReadOnlyProperty => ""; public virtual bool Equals(WorkOrder? other) => ReferenceEquals(this, other); [MemberOrder(99)] [Versioned] public virtual DateTime ModifiedDate { get; init; } public override string ToString() => $"{Product}: {StartDate}"; public override int GetHashCode() => base.GetHashCode(); } }
apache-2.0
C#
b0258112a23c71e3cfac32e05725c5f7d7a9b5d0
test build vsts
arsouza/Aritter,arsouza/Aritter,aritters/Ritter
tests/Application.Seedwork.Tests/Mocks/ProjectionTest.cs
tests/Application.Seedwork.Tests/Mocks/ProjectionTest.cs
namespace Application.Seedwork.Tests.Mocks { internal class ProjectionTest { public int Id { get; set; } public string Name { get; set; } } }
namespace Application.Seedwork.Tests.Mocks { internal class ProjectionTest { public int Id { get; set; } } }
mit
C#
5a58afbab145e528280fc3c1543a94731f5a53aa
Fix NullReferenceException
martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site
tests/LondonTravel.Site.Tests/Pages/PageBase.cs
tests/LondonTravel.Site.Tests/Pages/PageBase.cs
// Copyright (c) Martin Costello, 2017. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.LondonTravel.Site.Pages; public abstract class PageBase { protected PageBase(ApplicationNavigator navigator) { Navigator = navigator; } protected internal ApplicationNavigator Navigator { get; } protected static string UserNameSelector { get; } = "[data-id='user-name']"; protected abstract string RelativeUri { get; } public async Task<bool> IsAuthenticatedAsync() { const string ContentSelector = "[data-id='content']"; var content = await Navigator.Page.QuerySelectorAsync(ContentSelector); content.ShouldNotBeNull($"Could not find selector '{ContentSelector}'."); string? isAuthenticated = await content.GetAttributeAsync("data-authenticated"); return bool.Parse(isAuthenticated ?? bool.FalseString); } public async Task<string> UserNameAsync() { var element = await Navigator.Page.QuerySelectorAsync(UserNameSelector); element.ShouldNotBeNull($"Could not find selector '{UserNameSelector}'."); string userName = await element.InnerTextAsync(); userName.ShouldNotBeNull(); return userName.Trim(); } public async Task<HomePage> SignOutAsync() { await Navigator.Page.ClickAsync("[data-id='sign-out']"); return new HomePage(Navigator); } internal async Task NavigateToSelfAsync() { await Navigator.NavigateToAsync(RelativeUri); } }
// Copyright (c) Martin Costello, 2017. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.LondonTravel.Site.Pages; public abstract class PageBase { protected PageBase(ApplicationNavigator navigator) { Navigator = navigator; } protected internal ApplicationNavigator Navigator { get; } protected static string UserNameSelector { get; } = "[data-id='user-name']"; protected abstract string RelativeUri { get; } public async Task<bool> IsAuthenticatedAsync() => bool.Parse(await (await Navigator.Page.QuerySelectorAsync("[data-id='content']"))!.GetAttributeAsync("data-authenticated") ?? bool.FalseString); public async Task<string> UserNameAsync() => (await (await Navigator.Page.QuerySelectorAsync(UserNameSelector))!.InnerTextAsync()).Trim(); public async Task<HomePage> SignOutAsync() { await Navigator.Page.ClickAsync("[data-id='sign-out']"); return new HomePage(Navigator); } internal async Task NavigateToSelfAsync() { await Navigator.NavigateToAsync(RelativeUri); } }
apache-2.0
C#
ce1e0ec74709dbcc7d5386fad89735d818734ea6
Update assembly version
AdtecSoftware/Adtec.SagePayMvc,cergis-robert/SagePayMvc,AdtecSoftware/SagePayMvc,JeremySkinner/SagePayMvc
src/SagePayMvc/Properties/AssemblyInfo.cs
src/SagePayMvc/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("SagePayMvc")] [assembly: AssemblyDescription("SagePay integration for ASP.NET MVC")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("The Sixth Form College Farnborough")] [assembly: AssemblyProduct("SagePayMvc")] [assembly: AssemblyCopyright("Copyright © The Sixth Form College Farnborough")] [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("e4ae6ce2-795a-4018-a081-44cdf4aba537")] // 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("5.0.0.0")] [assembly: AssemblyFileVersion("5.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("SagePayMvc")] [assembly: AssemblyDescription("SagePay integration for ASP.NET MVC")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("The Sixth Form College Farnborough")] [assembly: AssemblyProduct("SagePayMvc")] [assembly: AssemblyCopyright("Copyright © The Sixth Form College Farnborough")] [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("e4ae6ce2-795a-4018-a081-44cdf4aba537")] // 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("4.0.0.0")] [assembly: AssemblyFileVersion("4.0.0.0")]
apache-2.0
C#
3d8e6812a0ff017b6fb8bc49b093868aeb3ee6fe
use this message/span
jwldnr/VisualLinter
src/VisualLinter/Linting/MessageMarker.cs
src/VisualLinter/Linting/MessageMarker.cs
using Microsoft.VisualStudio.Text; namespace jwldnr.VisualLinter.Linting { internal class MessageMarker { internal EslintMessage Message { get; } internal SnapshotSpan Span { get; } internal MessageMarker(EslintMessage message, SnapshotSpan span) { Message = message; Span = span; } internal MessageMarker Clone() { return new MessageMarker(Message, Span); } internal MessageMarker CloneAndTranslateTo(ITextSnapshot newSnapshot) { var newSpan = Span.TranslateTo(newSnapshot, SpanTrackingMode.EdgeExclusive); return Span.Length == newSpan.Length ? new MessageMarker(Message, newSpan) : null; } } }
using Microsoft.VisualStudio.Text; namespace jwldnr.VisualLinter.Linting { internal class MessageMarker { internal EslintMessage Message { get; } internal SnapshotSpan Span { get; } internal MessageMarker(SnapshotSpan span, EslintMessage message) { Message = message; Span = span; } internal static MessageMarker Clone(MessageMarker marker) { return new MessageMarker(marker.Span, marker.Message); } internal MessageMarker CloneAndTranslateTo(MessageMarker marker, ITextSnapshot newSnapshot) { var newSpan = marker.Span.TranslateTo(newSnapshot, SpanTrackingMode.EdgeExclusive); return newSpan.Length == marker.Span.Length ? new MessageMarker(newSpan, marker.Message) : null; } } }
mit
C#
91b2e8ffff0131e19be0288cd167bcade84a77a3
Remove unused code
messagebird/csharp-rest-api
MessageBird/Json/Converters/RFC3339DateTimeConverter.cs
MessageBird/Json/Converters/RFC3339DateTimeConverter.cs
using System; using MessageBird.Utilities; using Newtonsoft.Json; namespace MessageBird.Json.Converters { class RFC3339DateTimeConverter : JsonConverter { private const string Format = "yyyy-MM-dd'T'HH:mm:ssK"; public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { if (value is DateTime) { var dateTime = (DateTime)value; if (dateTime.Kind == DateTimeKind.Unspecified) { throw new JsonSerializationException("Cannot convert date time with an unspecified kind"); } string convertedDateTime = dateTime.ToString(Format); writer.WriteValue(convertedDateTime); } else { throw new JsonSerializationException("Expected value of type 'DateTime'."); } } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.Null) { return null; } if (reader.TokenType == JsonToken.Date) { var dateTime = (DateTime)reader.Value; if (dateTime.Kind == DateTimeKind.Unspecified) { throw new JsonSerializationException("Parsed date time is not in the expected RFC3339 format"); } return dateTime; } throw new JsonSerializationException(String.Format("Unexpected token '{0}' when parsing date.", reader.TokenType)); } public override bool CanConvert(Type objectType) { Type t = (ReflectionUtils.IsNullable(objectType)) ? Nullable.GetUnderlyingType(objectType) : objectType; return t == typeof(DateTime); } } }
using System; using MessageBird.Utilities; using Newtonsoft.Json; namespace MessageBird.Json.Converters { class RFC3339DateTimeConverter : JsonConverter { private const string Format = "yyyy-MM-dd'T'HH:mm:ssK"; public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { if (value is DateTime) { var dateTime = (DateTime)value; if (dateTime.Kind == DateTimeKind.Unspecified) { throw new JsonSerializationException("Cannot convert date time with an unspecified kind"); } string convertedDateTime = dateTime.ToString(Format); writer.WriteValue(convertedDateTime); } else { throw new JsonSerializationException("Expected value of type 'DateTime'."); } } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { // TODO: resolve "Local variable 't' is never used" Type t = (ReflectionUtils.IsNullable(objectType)) ? Nullable.GetUnderlyingType(objectType) : objectType; if (reader.TokenType == JsonToken.Null) { return null; } if (reader.TokenType == JsonToken.Date) { var dateTime = (DateTime)reader.Value; if (dateTime.Kind == DateTimeKind.Unspecified) { throw new JsonSerializationException("Parsed date time is not in the expected RFC3339 format"); } return dateTime; } throw new JsonSerializationException(String.Format("Unexpected token '{0}' when parsing date.", reader.TokenType)); } public override bool CanConvert(Type objectType) { Type t = (ReflectionUtils.IsNullable(objectType)) ? Nullable.GetUnderlyingType(objectType) : objectType; return t == typeof(DateTime); } } }
isc
C#
bba39c2d2b171418ff33497a1adaa305122534dc
Update UserCreatedHandler.cs
SimonCropp/NServiceBus.Serilog
src/TracingSample/UserCreatedHandler.cs
src/TracingSample/UserCreatedHandler.cs
using System; using System.Threading.Tasks; using NServiceBus; public class UserCreatedHandler : IHandleMessages<UserCreated> { public Task Handle(UserCreated message, IMessageHandlerContext context) { context.Logger().Information("Hello from UserCreatedHandler"); throw new Exception("SDfsd"); // return Task.FromResult(0); } }
using System; using System.Threading.Tasks; using NServiceBus; public class UserCreatedHandler : IHandleMessages<UserCreated> { public Task Handle(UserCreated message, IMessageHandlerContext context) { context.Logger().Information("Hello from UserCreatedHandler"); throw new Exception("SDfsd"); // return Task.FromResult(0); } }
mit
C#
ae11f313a845e9236d15c53adc2fd979ea1e947d
Update Revoke.cs
jbtule/keyczar-dotnet
Keyczar/KeyczarTool/Commands/Revoke.cs
Keyczar/KeyczarTool/Commands/Revoke.cs
// Copyright 2012 James Tuley (jay+code@tuley.name) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Linq; using System.Text; using Keyczar; using ManyConsole; namespace KeyczarTool { public class Revoke : ConsoleCommand { private int _version; private string _location; public Revoke() { this.IsCommand("revoke", Localized.Revoke); this.HasRequiredOption("l|location=", Localized.Location, v => { _location = v; }); this.HasRequiredOption("v|version=", Localized.Version, v => { _version = int.Parse(v); }); this.SkipsCommandSummaryBeforeRunning(); } public override int Run(string[] remainingArguments) { using (var keySet = new MutableKeySet(_location)) { var status = keySet.Revoke(_version); if (!status) { Console.WriteLine("{0} {1}.", Localized.MsgCouldNotRevoke, _version); return -1; } try { if (keySet.Save(new KeySetWriter(_location, overwrite: true))) { Console.WriteLine("{0} {1}.", Localized.MsgRevokedVersion, _version); return 0; } } catch { Console.WriteLine("{0} {1}.", Localized.MsgCouldNotWrite, _location); } return -1; } } } }
// Copyright 2012 James Tuley (jay+code@tuley.name) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Linq; using System.Text; using Keyczar; using ManyConsole; namespace KeyczarTool { public class Revoke : ConsoleCommand { private int _version; private string _location; public Revoke() { this.IsCommand("revoke", Localized.Revoke); this.HasRequiredOption("l|location=", Localized.Location, v => { _location = v; }); this.HasRequiredOption("v|version=", Localized.Version, v => { _version = int.Parse(v); }); this.SkipsCommandSummaryBeforeRunning(); } public override int Run(string[] remainingArguments) { using (var keySet = new MutableKeySet(_location)) { var status = keySet.Revoke(_version); if (!status) { Console.WriteLine("{0} {1}.", Localized.MsgCouldNotRevoke, _version); return -1; } try { if (keySet.Save(new KeySetWriter(_location, overwrite: true))) { Console.WriteLine("{0} {1}.", Localized.MsgRevokedVersion, _version); return 0; } } catch { } Console.WriteLine("{0} {1}.", Localized.MsgCouldNotWrite, _location); return -1; } } } }
apache-2.0
C#
f2df118419344af4ca9eaab28fe967d7288ad100
Add comments to public methods
prescottadam/ConsoleWritePrettyOneDay
ConsoleWritePrettyOneDay/Spinner.cs
ConsoleWritePrettyOneDay/Spinner.cs
using System; using System.Diagnostics; using System.Threading.Tasks; namespace ConsoleWritePrettyOneDay { public static class Spinner { private static char[] _chars = new[] { '|', '/', '-', '\\', '|', '/', '-', '\\' }; /// <summary> /// Displays a spinner while the provided <paramref name="action"/> is performed. /// If provided, <paramref name="message"/> will be displayed along with the elapsed time in milliseconds. /// </summary> public static void Wait(Action action, string message = null) { Wait(Task.Run(action), message); } /// <summary> /// Displays a spinner while the provided <paramref name="task"/> is executed. /// If provided, <paramref name="message"/> will be displayed along with the elapsed time in milliseconds. /// </summary> public static void Wait(Task task, string message = null) { WaitAsync(task, message).Wait(); } /// <summary> /// Displays a spinner while the provided <paramref name="task"/> is executed. /// If provided, <paramref name="message"/> will be displayed along with the elapsed time in milliseconds. /// </summary> /// <returns></returns> public static async Task WaitAsync(Task task, string message = null) { int index = 0; int max = _chars.Length; if (!string.IsNullOrWhiteSpace(message) && !message.EndsWith(" ")) { message += " "; } var timer = new Stopwatch(); timer.Start(); while (!task.IsCompleted) { await Task.Delay(35); index = ++index % max; Console.Write($"\r{message}{_chars[index]}"); } timer.Stop(); Console.WriteLine($"\r{message}[{(timer.ElapsedMilliseconds / 1000m).ToString("0.0##")}s]"); } } }
using System; using System.Diagnostics; using System.Threading.Tasks; namespace ConsoleWritePrettyOneDay { public static class Spinner { private static char[] _chars = new[] { '|', '/', '-', '\\', '|', '/', '-', '\\' }; public static void Wait(Action action, string message = null) { Wait(Task.Run(action), message); } public static void Wait(Task task, string message = null) { WaitAsync(task, message).Wait(); } public static async Task WaitAsync(Task task, string message = null) { int index = 0; int max = _chars.Length; if (!string.IsNullOrWhiteSpace(message) && !message.EndsWith(" ")) { message += " "; } var timer = new Stopwatch(); timer.Start(); while (!task.IsCompleted) { await Task.Delay(35); index = ++index % max; Console.Write($"\r{message}{_chars[index]}"); } timer.Stop(); Console.WriteLine($"\r{message}[{(timer.ElapsedMilliseconds / 1000m).ToString("0.0##")}s]"); } } }
mit
C#
5892632abf1c1ebe23030cfbba4ea9d28f390913
Bump Version.
blackpanther989/ArchiSteamFarm,blackpanther989/ArchiSteamFarm
ArchiSteamFarm/SharedInfo.cs
ArchiSteamFarm/SharedInfo.cs
/* _ _ _ ____ _ _____ / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| Copyright 2015-2016 Łukasz "JustArchi" Domeradzki Contact: JustArchi@JustArchi.net Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.Reflection; namespace ArchiSteamFarm { internal static class SharedInfo { internal enum EUserInputType : byte { Unknown, DeviceID, Login, Password, PhoneNumber, SMS, SteamGuard, SteamParentalPIN, RevocationCode, TwoFactorAuthentication, WCFHostname } internal const string VersionNumber = "2.1.6.3"; internal const string MyVersionNumber = "2.1.5.9"; internal const string Copyright = "Copyright © ArchiSteamFarm 2015-2016"; internal const string GithubRepo = "Blackpanther989/ArchiSteamFarm"; internal const string ServiceName = "ArchiSteamFarm"; internal const string ServiceDescription = "ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously."; internal const string EventLog = ServiceName; internal const string EventLogSource = EventLog + "Logger"; internal const string ASF = "ASF"; internal const string ASFDirectory = "ArchiSteamFarm"; internal const string ConfigDirectory = "config"; internal const string DebugDirectory = "debug"; internal const string LogFile = "log.txt"; internal const ulong ArchiSteamID = 76561198006963719; internal const ulong ASFGroupSteamID = 103582791440160998; internal const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases"; // GitHub API is HTTPS only internal const string GlobalConfigFileName = ASF + ".json"; internal const string GlobalDatabaseFileName = ASF + ".db"; internal static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version; } }
/* _ _ _ ____ _ _____ / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| Copyright 2015-2016 Łukasz "JustArchi" Domeradzki Contact: JustArchi@JustArchi.net Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.Reflection; namespace ArchiSteamFarm { internal static class SharedInfo { internal enum EUserInputType : byte { Unknown, DeviceID, Login, Password, PhoneNumber, SMS, SteamGuard, SteamParentalPIN, RevocationCode, TwoFactorAuthentication, WCFHostname } internal const string VersionNumber = "2.1.6.3"; internal const string MyVersionNumber = "2.1.5.8"; internal const string Copyright = "Copyright © ArchiSteamFarm 2015-2016"; internal const string GithubRepo = "Blackpanther989/ArchiSteamFarm"; internal const string ServiceName = "ArchiSteamFarm"; internal const string ServiceDescription = "ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously."; internal const string EventLog = ServiceName; internal const string EventLogSource = EventLog + "Logger"; internal const string ASF = "ASF"; internal const string ASFDirectory = "ArchiSteamFarm"; internal const string ConfigDirectory = "config"; internal const string DebugDirectory = "debug"; internal const string LogFile = "log.txt"; internal const ulong ArchiSteamID = 76561198006963719; internal const ulong ASFGroupSteamID = 103582791440160998; internal const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases"; // GitHub API is HTTPS only internal const string GlobalConfigFileName = ASF + ".json"; internal const string GlobalDatabaseFileName = ASF + ".db"; internal static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version; } }
apache-2.0
C#
e910f8a498ab08e6fb7e79843001ac829829559a
Update ConvertingWorksheetToSVG.cs
maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET
Examples/CSharp/Files/Utility/ConvertingWorksheetToSVG.cs
Examples/CSharp/Files/Utility/ConvertingWorksheetToSVG.cs
using System.IO; using Aspose.Cells; using Aspose.Cells.Rendering; namespace Aspose.Cells.Examples.Files.Utility { public class ConvertingWorksheetToSVG { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); string filePath = dataDir + "Template.xlsx"; //Create a workbook object from the template file Workbook book = new Workbook(filePath); //Convert each worksheet into svg format in a single page. ImageOrPrintOptions imgOptions = new ImageOrPrintOptions(); imgOptions.SaveFormat = SaveFormat.SVG; imgOptions.OnePagePerSheet = true; //Convert each worksheet into svg format foreach (Worksheet sheet in book.Worksheets) { SheetRender sr = new SheetRender(sheet, imgOptions); for (int i = 0; i < sr.PageCount; i++) { //Output the worksheet into Svg image format sr.ToImage(i, filePath + sheet.Name + i + ".out.svg"); //ExEnd:1 } } } } }
using System.IO; using Aspose.Cells; using Aspose.Cells.Rendering; namespace Aspose.Cells.Examples.Files.Utility { public class ConvertingWorksheetToSVG { public static void Main(string[] args) { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); string filePath = dataDir + "Template.xlsx"; //Create a workbook object from the template file Workbook book = new Workbook(filePath); //Convert each worksheet into svg format in a single page. ImageOrPrintOptions imgOptions = new ImageOrPrintOptions(); imgOptions.SaveFormat = SaveFormat.SVG; imgOptions.OnePagePerSheet = true; //Convert each worksheet into svg format foreach (Worksheet sheet in book.Worksheets) { SheetRender sr = new SheetRender(sheet, imgOptions); for (int i = 0; i < sr.PageCount; i++) { //Output the worksheet into Svg image format sr.ToImage(i, filePath + sheet.Name + i + ".out.svg"); } } } } }
mit
C#
cbb828512d39797905de499aedf6e814fe6997e1
fix version
marhoily/Generaid
Generaid/Properties/AssemblyInfo.cs
Generaid/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Generaid")] [assembly: AssemblyDescription("Utilities to aid C# code generation in VS")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Marhoily inc.")] [assembly: AssemblyProduct("Generaid")] [assembly: AssemblyCopyright("Copyright © Ilya 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("7b227385-b83d-4e16-868e-e307967d0ee4")] [assembly: AssemblyVersion("1.1.*")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: InternalsVisibleTo("Generaid.Tests")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Generaid")] [assembly: AssemblyDescription("Utilities to aid C# code generation in VS")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Marhoily inc.")] [assembly: AssemblyProduct("Generaid")] [assembly: AssemblyCopyright("Copyright © Ilya 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("7b227385-b83d-4e16-868e-e307967d0ee4")] [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("Generaid.Tests")]
mit
C#
484303b291881f7d1fe0d35e124c6a1408b444fd
update version
prodot/ReCommended-Extension
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
using System.Reflection; using ReCommendedExtension; // 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(ZoneMarker.ExtensionName)] [assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("prodot GmbH")] [assembly: AssemblyProduct(ZoneMarker.ExtensionId)] [assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("5.6.2.0")] [assembly: AssemblyFileVersion("5.6.2")]
using System.Reflection; using ReCommendedExtension; // 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(ZoneMarker.ExtensionName)] [assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("prodot GmbH")] [assembly: AssemblyProduct(ZoneMarker.ExtensionId)] [assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("5.6.1.0")] [assembly: AssemblyFileVersion("5.6.1")]
apache-2.0
C#
5e5df2b5db6acb2a6c4ad4a807c91d518306e881
Update IncrementProgram
alinasmirnova/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,redknightlois/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,redknightlois/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,Teknikaali/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,Ky7m/BenchmarkDotNet,Ky7m/BenchmarkDotNet,Teknikaali/BenchmarkDotNet,NN---/BenchmarkDotNet,Ky7m/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,Ky7m/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,Teknikaali/BenchmarkDotNet,redknightlois/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet
Benchmarks/IncrementProgram.cs
Benchmarks/IncrementProgram.cs
using BenchmarkDotNet; namespace Benchmarks { public class IncrementProgram { public void Run() { var competition = new BenchmarkCompetition(); competition.AddTask("i++", () => After()); competition.AddTask("++i", () => Before()); competition.Run(); } private const int IterationCount = 2000000000; public static int After() { int counter = 0; for (int i = 0; i < IterationCount; i++) counter++; return counter; } public static int Before() { int counter = 0; for (int i = 0; i < IterationCount; ++i) ++counter; return counter; } } }
using BenchmarkDotNet; namespace Benchmarks { public class IncrementProgram { public void Run() { var competition = new BenchmarkCompetition(); competition.AddTask("After", () => After()); competition.AddTask("Before", () => Before()); competition.Run(); } private const int IterationCount = 2000000000; public static int After() { int counter = 0; for (int i = 0; i < IterationCount; i++) counter++; return counter; } public static int Before() { int counter = 0; for (int i = 0; i < IterationCount; ++i) ++counter; return counter; } } }
mit
C#
cb8bfd13b0e33ec9c7e86fd53179ceb98984a020
Use Assert instead of null check because this class is internal.
dlemstra/Magick.NET,dlemstra/Magick.NET
Source/Magick.NET/Core/Drawables/PointInfo.cs
Source/Magick.NET/Core/Drawables/PointInfo.cs
//================================================================================================= // Copyright 2013-2016 Dirk Lemstra <https://magick.codeplex.com/> // // Licensed under the ImageMagick License (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.imagemagick.org/script/license.php // // Unless required by applicable law or agreed to in writing, software distributed under the // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either // express or implied. See the License for the specific language governing permissions and // limitations under the License. //================================================================================================= using System.Collections.Generic; using System.Diagnostics; namespace ImageMagick { internal sealed partial class PointInfoCollection { private PointInfoCollection(int count) { _NativeInstance = new NativePointInfoCollection(count); Count = count; } public PointInfoCollection(IList<PointD> coordinates) : this(coordinates.Count) { for (int i = 0; i < coordinates.Count; i++) { PointD point = coordinates[i]; _NativeInstance.Set(i, point.X, point.Y); } } public int Count { get; private set; } public void Dispose() { Debug.Assert(_NativeInstance != null); _NativeInstance.Dispose(); } } }
//================================================================================================= // Copyright 2013-2016 Dirk Lemstra <https://magick.codeplex.com/> // // Licensed under the ImageMagick License (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.imagemagick.org/script/license.php // // Unless required by applicable law or agreed to in writing, software distributed under the // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either // express or implied. See the License for the specific language governing permissions and // limitations under the License. //================================================================================================= using System.Collections.Generic; namespace ImageMagick { internal sealed partial class PointInfoCollection { private PointInfoCollection(int count) { _NativeInstance = new NativePointInfoCollection(count); Count = count; } public PointInfoCollection(IList<PointD> coordinates) : this(coordinates.Count) { for (int i = 0; i < coordinates.Count; i++) { PointD point = coordinates[i]; _NativeInstance.Set(i, point.X, point.Y); } } public int Count { get; private set; } public void Dispose() { if (_NativeInstance != null) _NativeInstance.Dispose(); } } }
apache-2.0
C#
4f8a1d8b4f500174d8720992a4189a37ce264b8f
Update index.cshtml
Aleksandrovskaya/apmathclouddif
site/index.cshtml
site/index.cshtml
@{ double t_0 = 0; double t_end = 150; double step = 0.1; int N = Convert.ToInt32((t_end-t_0)/step) + 1; String data = ""; bool show_chart = false; if (IsPost){ show_chart = true; var number = Request["text1"]; double xd = number.AsInt(); double t = 0; double x1 = 0; double x2 = 0; double x3 = 0; double currentx1 = 0; double currentx2 = 0; double currentx3 = 0; for (int i=0; i < N; ++i){ t = t_0 + step * i; currentx1 = x1 + step* (-0.1252*x1 + -0.004637*(x2-xd)+-0.002198*x3); currentx2 = x2 + step*x1 ; currentx3= x3 + step*(10*x1 + -0.2*x3 +1*(x2-xd)); x1 = currentx1; x2 = currentx2; x3 = currentx3; data += "[" +t+"," + x2+"]"; if( i < N - 1){ data += ","; } } } } <html> <head> <meta charset="utf-8"> <title>MathBox</title> <script type="text/javascript" src="https://www.google.com/jsapi?autoload={ 'modules':[{ 'name':'visualization', 'version':'1', 'packages':['corechart'] }] }"></script> <script type="text/javascript"> google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Time', 'pitch'], @data ]); var options = { title: 'pitch', curveType: 'function', legend: { position: 'bottom' } }; var chart = new google.visualization.LineChart(document.getElementById('curve_chart')); chart.draw(data, options); } </script> </head> <body> <form action="" method="post" align="center"> <p><label for="text1">Input Angle</label><br> <input type="text" name="text1" /></p> <p><input type="submit" value=" Show " /></p> </form> @if (show_chart) { <div id="curve_chart" style="width: 1200px; height: 500px"></div> } else { <p></p> } </body> </html>
@{ double t_0 = 0; double t_end = 150; double step = 0.1; int N = Convert.ToInt32((t_end-t_0)/step) + 1; String data = ""; bool show_chart = false; if (IsPost){ show_chart = true; var number = Request["text1"]; double xd = number.AsInt(); double t = 0; double x1 = 0; double x2 = 0; double x3 = 0; double currentx1 = 0; double currentx2 = 0; double currentx3 = 0; for (int i=0; i < N; ++i){ t = t_0 + step * i; currentx1 = x1 + step* (-0.1252*x1 + -0.004637*(x2-xd)+-0.002198*x3); currentx2 = x2 + step*x1 ; currentx3= x3 + step*(10*x1 + -0.2*x3 +1*(x2-xd)); x1 = currentx1; x2 = currentx2; x3 = currentx3; data += "[" +t+"," + x2+"]"; if( i < N - 1){ data += ","; } } } } <html> <head> <meta charset="utf-8"> <title>MathBox</title> <script type="text/javascript" src="https://www.google.com/jsapi?autoload={ 'modules':[{ 'name':'visualization', 'version':'1', 'packages':['corechart'] }] }"></script> <script type="text/javascript"> google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Time', 'pitch'], @data ]); var options = { title: 'pitch', curveType: 'function', legend: { position: 'bottom' } }; var chart = new google.visualization.LineChart(document.getElementById('curve_chart')); chart.draw(data, options); } </script> </head> <body> <form action="" method="post" align="center"> <p><label for="text1">Input Angle</label><br> <input type="text" name="text1" /></p> <p><input type="submit" value=" Show " /></p> </form> @if (show_chart) { <div id="curve_chart" style="width: 1700px; height: 500px"></div> } else { <p></p> } </body> </html>
mit
C#
db9355fa57b76dcb1e10d6e0a1d12e5fa4112a74
add GetItem
angeldnd/dap.core.csharp
DapCore/registry/Registry.cs
DapCore/registry/Registry.cs
using System; using System.Collections.Generic; namespace angeldnd.dap { public struct RegistryConsts { public const char Separator = '/'; } public class Registry : Context { public override char Separator { get { return RegistryConsts.Separator; } } public static readonly Registry Global = new Registry(); public readonly Factory Factory; public Registry(Factory factory) { Factory = factory; } public Registry() { Factory = Factory.NewBuiltinFactory(); } public Item GetItem(string path) { return Get<Item>(path); } public Item AddItem(string path, string type) { if (!Has(path)) { Aspect aspect = Factory.FactoryAspect(this, path, type); if (aspect != null && aspect is Item) { SetAspect(aspect); return aspect as Item; } } return null; } public override Aspect FactoryAspect(Entity entity, string path, string type) { return Factory.FactoryAspect(entity, path, type); } } }
using System; using System.Collections.Generic; namespace angeldnd.dap { public struct RegistryConsts { public const char Separator = '/'; } public class Registry : Context { public override char Separator { get { return RegistryConsts.Separator; } } public static readonly Registry Global = new Registry(); public readonly Factory Factory; public Registry(Factory factory) { Factory = factory; } public Registry() { Factory = Factory.NewBuiltinFactory(); } public Item AddItem(string path, string type) { if (!Has(path)) { Aspect aspect = Factory.FactoryAspect(this, path, type); if (aspect != null && aspect is Item) { SetAspect(aspect); return aspect as Item; } } return null; } public override Aspect FactoryAspect(Entity entity, string path, string type) { return Factory.FactoryAspect(entity, path, type); } } }
mit
C#
5163bae96db420e62e2fa06ab1ef0ee9c8fa293f
Add implementation for app resizing in basicPage.cs
wangjun/windows-app,wangjun/windows-app
wallabag/wallabag.Shared/Common/basicPage.cs
wallabag/wallabag.Shared/Common/basicPage.cs
using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; using Windows.UI.Core; namespace wallabag.Common { public class basicPage : Page { public NavigationHelper navigationHelper; private const string ViewModelPageKey = "ViewModel"; public basicPage() { this.Loaded += basicPage_Loaded; this.Unloaded += basicPage_Unloaded; this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; this.navigationHelper.SaveState += navigationHelper_SaveState; } void basicPage_Loaded(object sender, RoutedEventArgs e) { Window.Current.SizeChanged += Window_SizeChanged; } void basicPage_Unloaded(object sender, RoutedEventArgs e) { Window.Current.SizeChanged -= Window_SizeChanged; } void Window_SizeChanged(object sender, WindowSizeChangedEventArgs e) { ChangedSize(e); } protected virtual void ChangedSize(WindowSizeChangedEventArgs e) { } void navigationHelper_SaveState(object sender, SaveStateEventArgs e) { e.PageState.Add(ViewModelPageKey, this.DataContext); SaveState(e); } void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { if (e.PageState != null && e.PageState.ContainsKey(ViewModelPageKey)) { this.DataContext = e.PageState[ViewModelPageKey]; } LoadState(e); } protected virtual void LoadState(LoadStateEventArgs e) { } protected virtual void SaveState(SaveStateEventArgs e) { } protected override void OnNavigatedTo(NavigationEventArgs e) { navigationHelper.OnNavigatedTo(e); } protected override void OnNavigatedFrom(NavigationEventArgs e) { navigationHelper.OnNavigatedFrom(e); } } }
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; namespace wallabag.Common { public class basicPage : Page { public NavigationHelper navigationHelper; private const string ViewModelPageKey = "ViewModel"; public basicPage() { this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; this.navigationHelper.SaveState += navigationHelper_SaveState; } void navigationHelper_SaveState(object sender, SaveStateEventArgs e) { e.PageState.Add(ViewModelPageKey, this.DataContext); SaveState(e); } void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { if (e.PageState != null && e.PageState.ContainsKey(ViewModelPageKey)) { this.DataContext = e.PageState[ViewModelPageKey]; } LoadState(e); } protected virtual void LoadState(LoadStateEventArgs e) { } protected virtual void SaveState(SaveStateEventArgs e) { } protected override void OnNavigatedTo(NavigationEventArgs e) { navigationHelper.OnNavigatedTo(e); } protected override void OnNavigatedFrom(NavigationEventArgs e) { navigationHelper.OnNavigatedFrom(e); } } }
mit
C#
fe78be592e86aa689f6e0ccab22006c5ae1506ed
Fix dllimport inconsistency and possibly being broken on windows.
rokups/Urho3D,rokups/Urho3D,rokups/Urho3D,rokups/Urho3D,rokups/Urho3D,rokups/Urho3D
Source/Urho3D/CSharp/Managed/Urho3D.cs
Source/Urho3D/CSharp/Managed/Urho3D.cs
// // Copyright (c) 2017-2019 the rbfx project. // // 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.Generic; using System.Linq; using System.Runtime.InteropServices; namespace Urho3DNet { [System.Security.SuppressUnmanagedCodeSecurity] public partial class Urho3D { [DllImport("Urho3D", EntryPoint="Urho3D_ParseArguments")] public static extern void ParseArguments(int argc, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)]string[] argv); } }
// // Copyright (c) 2017-2019 the rbfx project. // // 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.Generic; using System.Linq; using System.Runtime.InteropServices; namespace Urho3DNet { [System.Security.SuppressUnmanagedCodeSecurity] public partial class Urho3D { [DllImport("libUrho3D", EntryPoint="Urho3D_ParseArguments")] public static extern void ParseArguments(int argc, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)]string[] argv); } }
mit
C#
6c0d006295e394328d618b20746bf4a3a6e6c539
Increment Version
zamanak/Zamanak.WebService
Zamanak.WebService/Properties/AssemblyInfo.cs
Zamanak.WebService/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("Zamanak.WebService")] [assembly: AssemblyDescription("This is a client of Zamanak (www.zamanak.ir) web service")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Zamanak")] [assembly: AssemblyProduct("Zamanak.WebService")] [assembly: AssemblyCopyright("Copyright © Zamanak 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("483458e5-4d71-43a0-88c1-6cabe72154e3")] // 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.4.0")] [assembly: AssemblyFileVersion("1.0.4.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("Zamanak.WebService")] [assembly: AssemblyDescription("This is a client of Zamanak (www.zamanak.ir) web service")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Zamanak")] [assembly: AssemblyProduct("Zamanak.WebService")] [assembly: AssemblyCopyright("Copyright © Zamanak 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("483458e5-4d71-43a0-88c1-6cabe72154e3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.3.0")] [assembly: AssemblyFileVersion("1.0.3.0")]
mit
C#
02a51c00d6f3aec8e3b16ed7c773ae5704bb90e4
Use new constructor under the hood
peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework
osu.Framework.Tests/IO/BackgroundGameHeadlessGameHost.cs
osu.Framework.Tests/IO/BackgroundGameHeadlessGameHost.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.Threading; using System.Threading.Tasks; using osu.Framework.Platform; using osu.Framework.Testing; namespace osu.Framework.Tests.IO { /// <summary> /// A headless host for testing purposes. Contains an arbitrary game that is running after construction. /// </summary> public class BackgroundGameHeadlessGameHost : TestRunHeadlessGameHost { [Obsolete("Use BackgroundGameHeadlessGameHost(HostConfig) instead.")] public BackgroundGameHeadlessGameHost(string gameName = null, bool bindIPC = false, bool realtime = true, bool portableInstallation = false) : this(new HostConfig { Name = gameName, BindIPC = bindIPC, Realtime = realtime, PortableInstallation = portableInstallation, }) { } public BackgroundGameHeadlessGameHost(HostConfig hostConfig) : base(hostConfig) { var testGame = new TestGame(); Task.Factory.StartNew(() => Run(testGame), TaskCreationOptions.LongRunning); testGame.HasProcessed.Wait(); } private class TestGame : Game { internal readonly ManualResetEventSlim HasProcessed = new ManualResetEventSlim(false); protected override void Update() { base.Update(); HasProcessed.Set(); } protected override void Dispose(bool isDisposing) { HasProcessed.Dispose(); base.Dispose(isDisposing); } } protected override void Dispose(bool isDisposing) { if (ExecutionState != ExecutionState.Stopped) Exit(); 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 System; using System.Threading; using System.Threading.Tasks; using osu.Framework.Platform; using osu.Framework.Testing; namespace osu.Framework.Tests.IO { /// <summary> /// A headless host for testing purposes. Contains an arbitrary game that is running after construction. /// </summary> public class BackgroundGameHeadlessGameHost : TestRunHeadlessGameHost { [Obsolete("Use BackgroundGameHeadlessGameHost(HostConfig) instead.")] public BackgroundGameHeadlessGameHost(string gameName = null, bool bindIPC = false, bool realtime = true, bool portableInstallation = false) : base(gameName, bindIPC, realtime, portableInstallation) { var testGame = new TestGame(); Task.Factory.StartNew(() => Run(testGame), TaskCreationOptions.LongRunning); testGame.HasProcessed.Wait(); } public BackgroundGameHeadlessGameHost(HostConfig hostConfig) : base(hostConfig) { var testGame = new TestGame(); Task.Factory.StartNew(() => Run(testGame), TaskCreationOptions.LongRunning); testGame.HasProcessed.Wait(); } private class TestGame : Game { internal readonly ManualResetEventSlim HasProcessed = new ManualResetEventSlim(false); protected override void Update() { base.Update(); HasProcessed.Set(); } protected override void Dispose(bool isDisposing) { HasProcessed.Dispose(); base.Dispose(isDisposing); } } protected override void Dispose(bool isDisposing) { if (ExecutionState != ExecutionState.Stopped) Exit(); base.Dispose(isDisposing); } } }
mit
C#
4c29583360462c380c37dead6ac6346d897ef232
Add some display names for AddClaimViewModel
leotsarev/joinrpg-net,kirillkos/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net
Joinrpg/Models/AddClaimViewModel.cs
Joinrpg/Models/AddClaimViewModel.cs
using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; using JoinRpg.DataModel; using JoinRpg.Web.Helpers; namespace JoinRpg.Web.Models { public class AddClaimViewModel { public int ProjectId { get; set; } public int? CharacterId { get; set; } public int? CharacterGroupId { get; set; } [DisplayName("Заявка")] public string TargetName { get; set; } public HtmlString Description { get; set; } public bool HasApprovedClaim { get; set; } public bool HasAnyClaim { get; set; } public bool IsAvailable { get; set; } [DataType(DataType.MultilineText),DisplayName("Текст заявки")] public string ClaimText { get; set; } public static AddClaimViewModel Create(Character character, User user) { var vm = CreateImpl(character, user); vm.CharacterId = character.CharacterId; return vm; } public static AddClaimViewModel Create(CharacterGroup group, User user) { var vm = CreateImpl(@group, user); vm.CharacterGroupId = group.CharacterGroupId; return vm; } private static AddClaimViewModel CreateImpl(IClaimSource obj, User user) { var addClaimViewModel = new AddClaimViewModel { ProjectId = obj.ProjectId, HasAnyClaim = user.Claims.Any(c => c.ProjectId == obj.ProjectId), HasApprovedClaim = user.Claims.Any(c => c.ProjectId == obj.ProjectId && c.IsApproved), TargetName = obj.Name, Description = obj.Description.ToHtmlString(), IsAvailable = obj.IsAvailable, ClaimApplyRules = obj.Project.Details.ClaimApplyRules.ToHtmlString() }; return addClaimViewModel; } } }
using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; using JoinRpg.DataModel; using JoinRpg.Web.Helpers; namespace JoinRpg.Web.Models { public class AddClaimViewModel { public int ProjectId { get; set; } public int? CharacterId { get; set; } public int? CharacterGroupId { get; set; } public string TargetName { get; set; } public HtmlString Description { get; set; } public bool HasApprovedClaim { get; set; } public bool HasAnyClaim { get; set; } public bool IsAvailable { get; set; } [DataType(DataType.MultilineText)] public string ClaimText { get; set; } public static AddClaimViewModel Create(Character character, User user) { var vm = CreateImpl(character, user); vm.CharacterId = character.CharacterId; return vm; } public static AddClaimViewModel Create(CharacterGroup group, User user) { var vm = CreateImpl(@group, user); vm.CharacterGroupId = group.CharacterGroupId; return vm; } private static AddClaimViewModel CreateImpl(IClaimSource obj, User user) { var addClaimViewModel = new AddClaimViewModel { ProjectId = obj.ProjectId, HasAnyClaim = user.Claims.Any(c => c.ProjectId == obj.ProjectId), HasApprovedClaim = user.Claims.Any(c => c.ProjectId == obj.ProjectId && c.IsApproved), TargetName = obj.Name, Description = obj.Description.ToHtmlString(), IsAvailable = obj.IsAvailable }; return addClaimViewModel; } } }
mit
C#
39683dddf495e7a6d97a7732b09e302895a5f599
Fix method invocation
lou1306/CIV,lou1306/CIV
CIV.Hml/HmlFormula/WeakBoxFormula.cs
CIV.Hml/HmlFormula/WeakBoxFormula.cs
using System; using System.Collections.Generic; using System.Linq; using CIV.Ccs; using CIV.Interfaces; namespace CIV.Hml { public class WeakBoxFormula : HmlLabelFormula { protected override bool CheckStrategy(IEnumerable<IProcess> processes) => processes.All(Inner.Check); protected override IEnumerable<Transition> TransitionStrategy(IProcess process) { if (process is IHasWeakTransitions) { return ((IHasWeakTransitions)process).WeakTransitions(); } throw new ArgumentException(); } } }
using System; using System.Collections.Generic; using System.Linq; using CIV.Ccs; using CIV.Interfaces; namespace CIV.Hml { public class WeakBoxFormula : HmlLabelFormula { protected override bool CheckStrategy(IEnumerable<IProcess> processes) => processes.All(Inner.Check); protected override IEnumerable<Transition> TransitionStrategy(IProcess process) { if (process is IHasWeakTransitions) { return ((IHasWeakTransitions)process).WeakTransitions; } throw new ArgumentException(); } } }
mit
C#
90d76dcf1cb5a7f46401b64f4e299e885e5a03d3
Fix for definitions--on close of a view, don't release the ParserDetails.
kaby76/AntlrVSIX,kaby76/AntlrVSIX,kaby76/AntlrVSIX,kaby76/AntlrVSIX,kaby76/AntlrVSIX
File/ViewCreationListener.cs
File/ViewCreationListener.cs
using System; using Microsoft.VisualStudio.TextManager.Interop; using Microsoft.VisualStudio.Editor; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Utilities; using System.ComponentModel.Composition; using System.Diagnostics; using System.IO; using AntlrVSIX.Extensions; using AntlrVSIX.Grammar; namespace AntlrVSIX.File { [Export(typeof(IVsTextViewCreationListener))] [ContentType("code")] [TextViewRole(PredefinedTextViewRoles.Editable)] public class ViewCreationListener : IVsTextViewCreationListener { private string document_file_path; [Import] public IVsEditorAdaptersFactoryService AdaptersFactory = null; [Import] public ITextDocumentFactoryService TextDocumentFactoryService { get; set; } [Import] public SVsServiceProvider GlobalServiceProvider = null; public void VsTextViewCreated(IVsTextView textViewAdapter) { IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter); if (view == null) { Debug.Fail("Unable to get IWpfTextView from text view adapter"); return; } view.Closed += OnViewClosed; ITextBuffer doc = view.TextBuffer; string ffn = doc.GetFilePath(); if (!ffn.IsAntlrSuffix()) return; document_file_path = ffn; var buffer = view.TextBuffer; var code = buffer.GetBufferText(); ParserDetails pd = ParserDetails.Parse(code, ffn); } private void OnViewClosed(object sender, EventArgs e) { IWpfTextView view = sender as IWpfTextView; if (view == null) return; view.Closed -= OnViewClosed; } } }
using System; using Microsoft.VisualStudio.TextManager.Interop; using Microsoft.VisualStudio.Editor; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Utilities; using System.ComponentModel.Composition; using System.Diagnostics; using System.IO; using AntlrVSIX.Extensions; using AntlrVSIX.Grammar; namespace AntlrVSIX.File { [Export(typeof(IVsTextViewCreationListener))] [ContentType("code")] [TextViewRole(PredefinedTextViewRoles.Editable)] public class ViewCreationListener : IVsTextViewCreationListener { private string document_file_path; [Import] public IVsEditorAdaptersFactoryService AdaptersFactory = null; [Import] public ITextDocumentFactoryService TextDocumentFactoryService { get; set; } [Import] public SVsServiceProvider GlobalServiceProvider = null; public void VsTextViewCreated(IVsTextView textViewAdapter) { IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter); if (view == null) { Debug.Fail("Unable to get IWpfTextView from text view adapter"); return; } view.Closed += OnViewClosed; ITextBuffer doc = view.TextBuffer; string ffn = doc.GetFilePath(); if (!ffn.IsAntlrSuffix()) return; document_file_path = ffn; var buffer = view.TextBuffer; var code = buffer.GetBufferText(); ParserDetails pd = ParserDetails.Parse(code, ffn); } private void OnViewClosed(object sender, EventArgs e) { IWpfTextView view = sender as IWpfTextView; if (view == null) return; view.Closed -= OnViewClosed; ITextBuffer doc = view.TextBuffer; string ffn = document_file_path; if (!ffn.IsAntlrSuffix()) return; if (ParserDetails._per_file_parser_details.ContainsKey(ffn)) ParserDetails._per_file_parser_details.Remove(ffn); } } }
mit
C#
f5fad18891d5be6132bfba13b5aa1d612fd9d743
remove more
darkoverlordofdata/minimart,darkoverlordofdata/minimart,darkoverlordofdata/minimart
Minimart/Views/Catalog/Index.cshtml
Minimart/Views/Catalog/Index.cshtml
<div class="container"> <div class="row"> <div class="col-sm-12"> <ul class="breadcrumb"> <li class="active">@ViewBag.BrandName </li> </ul> <div id="message"></div> </div> </div> </div>
<div class="container"> <div class="row"> <div class="col-sm-12"> <ul class="breadcrumb"> <li class="active">@ViewBag.BrandName </li> </ul> <div id="message"></div> </div> </div> </div> @section scripts { @Scripts.Render("~/js/catalog/index") }
mit
C#
17440784a272981a80244dac0513e24e4b665a96
fix error in InsertUpdateLogBehavior when fields are not type of integer
rolembergfilho/Serenity,dfaruque/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,volkanceylan/Serenity
Serenity.Services/RequestHandlers/IntegratedFeatures/InsertUpdateLog/InsertUpdateLogBehavior.cs
Serenity.Services/RequestHandlers/IntegratedFeatures/InsertUpdateLog/InsertUpdateLogBehavior.cs
using Serenity; using Serenity.Data; using Serenity.Data.Mapping; using Serenity.Reflection; using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; namespace Serenity.Services { public class UpdateInsertLogBehavior : BaseSaveBehavior, IImplicitBehavior { public bool ActivateFor(Row row) { return row is IUpdateLogRow || row is IInsertLogRow; } public override void OnSetInternalFields(ISaveRequestHandler handler) { var row = handler.Row; var updateLogRow = row as IUpdateLogRow; var insertLogRow = row as IInsertLogRow; Field field; if (updateLogRow != null && (handler.IsUpdate || insertLogRow == null)) { updateLogRow.UpdateDateField[row] = DateTimeField.ToDateTimeKind(DateTime.Now, updateLogRow.UpdateDateField.DateTimeKind); if (updateLogRow.UpdateUserIdField.IsIntegerType) updateLogRow.UpdateUserIdField[row] = Authorization.UserId.TryParseID(); else { field = (Field)updateLogRow.UpdateUserIdField; field.AsObject(row, field.ConvertValue(Authorization.UserId, CultureInfo.InvariantCulture)); } } else if (insertLogRow != null && handler.IsCreate) { insertLogRow.InsertDateField[row] = DateTimeField.ToDateTimeKind(DateTime.Now, insertLogRow.InsertDateField.DateTimeKind); if (insertLogRow.InsertUserIdField.IsIntegerType) insertLogRow.InsertUserIdField[row] = Authorization.UserId.TryParseID(); else { field = (Field)insertLogRow.InsertUserIdField; field.AsObject(row, field.ConvertValue(Authorization.UserId, CultureInfo.InvariantCulture)); } insertLogRow.InsertUserIdField[row] = Authorization.UserId.TryParseID(); } } } }
using Serenity; using Serenity.Data; using Serenity.Data.Mapping; using Serenity.Reflection; using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; namespace Serenity.Services { public class UpdateInsertLogBehavior : BaseSaveBehavior, IImplicitBehavior { public bool ActivateFor(Row row) { return row is IUpdateLogRow || row is IInsertLogRow; } public override void OnSetInternalFields(ISaveRequestHandler handler) { var row = handler.Row; var updateLogRow = row as IUpdateLogRow; var insertLogRow = row as IInsertLogRow; if (updateLogRow != null && (handler.IsUpdate || insertLogRow == null)) { updateLogRow.UpdateDateField[row] = DateTimeField.ToDateTimeKind(DateTime.Now, updateLogRow.UpdateDateField.DateTimeKind); if (updateLogRow.UpdateUserIdField.IsIntegerType) updateLogRow.UpdateUserIdField[row] = Authorization.UserId.TryParseID(); else ((Field)updateLogRow.UpdateUserIdField).AsObject(row, ((Field)updateLogRow).ConvertValue(Authorization.UserId, CultureInfo.InvariantCulture)); } else if (insertLogRow != null && handler.IsCreate) { insertLogRow.InsertDateField[row] = DateTimeField.ToDateTimeKind(DateTime.Now, insertLogRow.InsertDateField.DateTimeKind); if (insertLogRow.InsertUserIdField.IsIntegerType) insertLogRow.InsertUserIdField[row] = Authorization.UserId.TryParseID(); else ((Field)insertLogRow.InsertUserIdField).AsObject(row, ((Field)insertLogRow).ConvertValue(Authorization.UserId, CultureInfo.InvariantCulture)); insertLogRow.InsertUserIdField[row] = Authorization.UserId.TryParseID(); } } } }
mit
C#
057f5355cbf588f7ab258f5bb23d340113bbab9a
Add StoryPoint
lbarbisan-ullink/JiraRestClient
TechTalk.JiraRestClient/IssueFields.cs
TechTalk.JiraRestClient/IssueFields.cs
using System; using System.Collections.Generic; namespace TechTalk.JiraRestClient { public class IssueFields { public DateTime started; public IssueFields() { status = new Status(); timetracking = new Timetracking(); labels = new List<String>(); comments = new List<Comment>(); issuelinks = new List<IssueLink>(); attachment = new List<Attachment>(); watchers = new List<JiraUser>(); } public String summary { get; set; } public String description { get; set; } public Timetracking timetracking { get; set; } public Status status { get; set; } public JiraUser reporter { get; set; } public JiraUser assignee { get; set; } public List<JiraUser> watchers { get; set; } public List<String> labels { get; set; } public List<Comment> comments { get; set; } public List<IssueLink> issuelinks { get; set; } public List<Attachment> attachment { get; set; } public Issue<IssueFields> parent { get; set; } public IssueType issuetype { get; set; } public IssuePriority priority { get; set;} //GLOBAL Rank public string customfield_21600 { get; set; } //EPIC LINK public string customfield_14700 { get; set; } //EPIC Name public string customfield_14701 { get; set; } //Story Point public decimal customfield_10790 { get; set; } } }
using System; using System.Collections.Generic; namespace TechTalk.JiraRestClient { public class IssueFields { public IssueFields() { status = new Status(); timetracking = new Timetracking(); labels = new List<String>(); comments = new List<Comment>(); issuelinks = new List<IssueLink>(); attachment = new List<Attachment>(); watchers = new List<JiraUser>(); } public String summary { get; set; } public String description { get; set; } public Timetracking timetracking { get; set; } public Status status { get; set; } public JiraUser reporter { get; set; } public JiraUser assignee { get; set; } public List<JiraUser> watchers { get; set; } public List<String> labels { get; set; } public List<Comment> comments { get; set; } public List<IssueLink> issuelinks { get; set; } public List<Attachment> attachment { get; set; } public Issue<IssueFields> parent { get; set; } public IssueType issuetype { get; set; } public IssuePriority priority { get; set;} //GLOBAL Rank public string customfield_21600 { get; set; } //EPIC LINK public string customfield_14700 { get; set; } //EPIC Name public string customfield_14701 { get; set; } } }
bsd-3-clause
C#
3a76cc09fb71f2c9f66777d6e1e0e5422a13f6b2
Bump Build
tsebring/ArkSavegameToolkitNet
ArkSavegameToolkitNet.Domain/Properties/AssemblyInfo.cs
ArkSavegameToolkitNet.Domain/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ARK Savegame Toolkit .NET: Domain")] [assembly: AssemblyDescription("A domain model wrapper for easily querying data in ARK Survival Evolved savegame files using .NET.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ArkSavegameToolkitNet.Domain")] [assembly: AssemblyCopyright("Copyright © 2020")] [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("dbf15752-cb8a-40d8-8da6-2597538e86d0")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.9.1.0")] [assembly: AssemblyFileVersion("1.9.1.0")] //todo: temp for dev purposes [assembly: InternalsVisibleTo("ArkSavegameToolkitNet.TestConsoleApp")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ARK Savegame Toolkit .NET: Domain")] [assembly: AssemblyDescription("A domain model wrapper for easily querying data in ARK Survival Evolved savegame files using .NET.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ArkSavegameToolkitNet.Domain")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("dbf15752-cb8a-40d8-8da6-2597538e86d0")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.9.1.0")] [assembly: AssemblyFileVersion("1.9.1.0")] //todo: temp for dev purposes [assembly: InternalsVisibleTo("ArkSavegameToolkitNet.TestConsoleApp")]
mit
C#
99060c9a2b91f966a4d7a066b52f29104e10fd90
Update IBattery.cs
predictive-technology-laboratory/Xamarin.Plugins,jamesmontemagno/Xamarin.Plugins,labdogg1003/Xamarin.Plugins,monostefan/Xamarin.Plugins,tim-hoff/Xamarin.Plugins,JC-Chris/Xamarin.Plugins,LostBalloon1/Xamarin.Plugins
Battery/Battery/Battery.Plugin.Abstractions/IBattery.cs
Battery/Battery/Battery.Plugin.Abstractions/IBattery.cs
using System; namespace Battery.Plugin.Abstractions { /// <summary> /// Interface for Battery /// </summary> public interface IBattery : IDisposable { /// <summary> /// Current battery level 0 - 100 /// </summary> int RemainingChargePercent { get; } /// <summary> /// Current status of the battery /// </summary> BatteryStatus Status { get; } /// <summary> /// Currently how the battery is being charged. /// </summary> PowerSource PowerSource { get; } /// <summary> /// Event handler when battery changes /// </summary> event BatteryChangedEventHandler BatteryChanged; } /// <summary> /// Arguments to pass to event handlers /// </summary> public class BatteryChangedEventArgs : EventArgs { /// <summary> /// If the battery level is considered low /// </summary> public bool IsLow { get; set; } /// <summary> /// Gets if there is an active internet connection /// </summary> public int RemainingChargePercent { get; set; } /// <summary> /// Current status of battery /// </summary> public BatteryStatus Status { get; set; } /// <summary> /// Get the source of power. /// </summary> public PowerSource PowerSource { get; set; } } /// <summary> /// Battery Level changed event handlers /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public delegate void BatteryChangedEventHandler(object sender, BatteryChangedEventArgs e); }
using System; namespace Battery.Plugin.Abstractions { /// <summary> /// Interface for Battery /// </summary> public interface IBattery : IDisposable { /// <summary> /// Current battery level 0 - 100 /// </summary> int RemainingChargePercent { get; } /// <summary> /// Current status of the battery /// </summary> BatteryStatus Status { get; } /// <summary> /// Currenlty how the battery is being charged. /// </summary> PowerSource PowerSource { get; } /// <summary> /// Event handler when battery changes /// </summary> event BatteryChangedEventHandler BatteryChanged; } /// <summary> /// Arguments to pass to event handlers /// </summary> public class BatteryChangedEventArgs : EventArgs { /// <summary> /// If the battery level is considered low /// </summary> public bool IsLow { get; set; } /// <summary> /// Gets if there is an active internet connection /// </summary> public int RemainingChargePercent { get; set; } /// <summary> /// Current status of battery /// </summary> public BatteryStatus Status { get; set; } /// <summary> /// Get the source of power. /// </summary> public PowerSource PowerSource { get; set; } } /// <summary> /// Battery Level changed event handlers /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public delegate void BatteryChangedEventHandler(object sender, BatteryChangedEventArgs e); }
mit
C#
5cb26ecdb7790be7543a3e836690c4b3c064c8b5
Update assembly info for release 2.1.0
tunnelvisionlabs/OpenInExternalBrowser
OpenInExternalBrowser/Properties/AssemblyInfo.cs
OpenInExternalBrowser/Properties/AssemblyInfo.cs
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Reflection; using System.Runtime.InteropServices; using Microsoft.VisualStudio.Shell; // 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("Tvl.VisualStudio.OpenInExternalBrowser")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Tunnel Vision Laboratories, LLC")] [assembly: AssemblyProduct("Tvl.VisualStudio.OpenInExternalBrowser")] [assembly: AssemblyCopyright("Copyright © Sam Harwell 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("c8478eb2-9f48-49fe-8ef2-61d198e01bfc")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.1.0.0")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0")] [assembly: ProvideCodeBase( AssemblyName = "Tvl.VisualStudio.Shell.Utility.10", Version = "1.0.0.0", CodeBase = "$PackageFolder$\\Tvl.VisualStudio.Shell.Utility.10.dll")] [assembly: ProvideCodeBase( AssemblyName = "Tvl.VisualStudio.Text.Utility.10", Version = "1.0.0.0", CodeBase = "$PackageFolder$\\Tvl.VisualStudio.Text.Utility.10.dll")]
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Reflection; using System.Runtime.InteropServices; using Microsoft.VisualStudio.Shell; // 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("Tvl.VisualStudio.OpenInExternalBrowser")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Tunnel Vision Laboratories, LLC")] [assembly: AssemblyProduct("Tvl.VisualStudio.OpenInExternalBrowser")] [assembly: AssemblyCopyright("Copyright © Sam Harwell 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("c8478eb2-9f48-49fe-8ef2-61d198e01bfc")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.1.0.0")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0-dev")] [assembly: ProvideCodeBase( AssemblyName = "Tvl.VisualStudio.Shell.Utility.10", Version = "1.0.0.0", CodeBase = "$PackageFolder$\\Tvl.VisualStudio.Shell.Utility.10.dll")] [assembly: ProvideCodeBase( AssemblyName = "Tvl.VisualStudio.Text.Utility.10", Version = "1.0.0.0", CodeBase = "$PackageFolder$\\Tvl.VisualStudio.Text.Utility.10.dll")]
mit
C#
5742e0f4fc8e516b328a4e160619829b026ba263
Remove unused using
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Services/UpdateChecker.cs
WalletWasabi/Services/UpdateChecker.cs
using System; using System.ComponentModel; using System.Threading; using System.Threading.Tasks; using WalletWasabi.Bases; using WalletWasabi.Models; using WalletWasabi.WebClients.Wasabi; namespace WalletWasabi.Services { public class UpdateChecker : PeriodicRunner { public UpdateChecker(TimeSpan period, WasabiSynchronizer synchronizer) : base(period) { Synchronizer = synchronizer; WasabiClient = synchronizer.WasabiClient; UpdateStatus = new UpdateStatus(true, true, new Version(), 0); Synchronizer.PropertyChanged += Synchronizer_PropertyChanged; } public event EventHandler<UpdateStatus>? UpdateStatusChanged; public WasabiClient WasabiClient { get; } public WasabiSynchronizer Synchronizer { get; } public UpdateStatus UpdateStatus { get; private set; } private void Synchronizer_PropertyChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(WasabiSynchronizer.BackendStatus) && Synchronizer.BackendStatus == BackendStatus.Connected) { // Any time when the synchronizer detects the backend, we immediately check the versions. GUI relies on UpdateStatus changes. TriggerRound(); } } protected override async Task ActionAsync(CancellationToken cancel) { var newUpdateStatus = await WasabiClient.CheckUpdatesAsync(cancel).ConfigureAwait(false); if (newUpdateStatus != UpdateStatus) { UpdateStatus = newUpdateStatus; UpdateStatusChanged?.Invoke(this, newUpdateStatus); } } public override void Dispose() { Synchronizer.PropertyChanged -= Synchronizer_PropertyChanged; base.Dispose(); } } }
using System; using System.ComponentModel; using System.Threading; using System.Threading.Tasks; using WalletWasabi.Bases; using WalletWasabi.Helpers; using WalletWasabi.Models; using WalletWasabi.WebClients.Wasabi; namespace WalletWasabi.Services { public class UpdateChecker : PeriodicRunner { public UpdateChecker(TimeSpan period, WasabiSynchronizer synchronizer) : base(period) { Synchronizer = synchronizer; WasabiClient = synchronizer.WasabiClient; UpdateStatus = new UpdateStatus(true, true, new Version(), 0); Synchronizer.PropertyChanged += Synchronizer_PropertyChanged; } public event EventHandler<UpdateStatus>? UpdateStatusChanged; public WasabiClient WasabiClient { get; } public WasabiSynchronizer Synchronizer { get; } public UpdateStatus UpdateStatus { get; private set; } private void Synchronizer_PropertyChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(WasabiSynchronizer.BackendStatus) && Synchronizer.BackendStatus == BackendStatus.Connected) { // Any time when the synchronizer detects the backend, we immediately check the versions. GUI relies on UpdateStatus changes. TriggerRound(); } } protected override async Task ActionAsync(CancellationToken cancel) { var newUpdateStatus = await WasabiClient.CheckUpdatesAsync(cancel).ConfigureAwait(false); if (newUpdateStatus != UpdateStatus) { UpdateStatus = newUpdateStatus; UpdateStatusChanged?.Invoke(this, newUpdateStatus); } } public override void Dispose() { Synchronizer.PropertyChanged -= Synchronizer_PropertyChanged; base.Dispose(); } } }
mit
C#
7410ceaf3111d6784417616b4f6d3ee2da64a6f7
update cors for azure
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
Demo/NakedObjects.Rest.App.Demo/App_Start/CorsConfig.cs
Demo/NakedObjects.Rest.App.Demo/App_Start/CorsConfig.cs
using System.Web.Http; using Thinktecture.IdentityModel.Http.Cors.WebApi; public class CorsConfig { public static void RegisterCors(HttpConfiguration httpConfig) { var corsConfig = new WebApiCorsConfiguration(); // this adds the CorsMessageHandler to the HttpConfiguration’s // MessageHandlers collection corsConfig.RegisterGlobal(httpConfig); // this allow all CORS requests to the Products controller // from the http://foo.com origin. corsConfig.ForResources("RestfulObjects").ForOrigins("http://localhost:49998", "http://localhost:8080", "http://nakedobjectstest.azurewebsites.net").AllowAll().AllowResponseHeaders("Warning"); } }
using System.Web.Http; using Thinktecture.IdentityModel.Http.Cors.WebApi; public class CorsConfig { public static void RegisterCors(HttpConfiguration httpConfig) { var corsConfig = new WebApiCorsConfiguration(); // this adds the CorsMessageHandler to the HttpConfiguration’s // MessageHandlers collection corsConfig.RegisterGlobal(httpConfig); // this allow all CORS requests to the Products controller // from the http://foo.com origin. corsConfig.ForResources("RestfulObjects").ForOrigins("http://localhost:49998", "http://localhost:8080").AllowAll().AllowResponseHeaders("Warning"); } }
apache-2.0
C#
0f088c4d9c1801da1855763f928ad849208d2b00
Add ResolveByName attribute to TargetControl property
wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors
src/Avalonia.Xaml.Interactions/Custom/ShowOnDoubleTappedBehavior.cs
src/Avalonia.Xaml.Interactions/Custom/ShowOnDoubleTappedBehavior.cs
using Avalonia.Controls; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Xaml.Interactivity; namespace Avalonia.Xaml.Interactions.Custom; /// <summary> /// A behavior that allows to show control on double tapped event. /// </summary> public class ShowOnDoubleTappedBehavior : Behavior<Control> { /// <summary> /// Identifies the <seealso cref="TargetControl"/> avalonia property. /// </summary> public static readonly StyledProperty<Control?> TargetControlProperty = AvaloniaProperty.Register<ShowOnDoubleTappedBehavior, Control?>(nameof(TargetControl)); /// <summary> /// Gets or sets the target control. This is a avalonia property. /// </summary> [ResolveByName] public Control? TargetControl { get => GetValue(TargetControlProperty); set => SetValue(TargetControlProperty, value); } /// <inheritdoc /> protected override void OnAttachedToVisualTree() { AssociatedObject?.AddHandler(Gestures.DoubleTappedEvent, AssociatedObject_DoubleTapped, RoutingStrategies.Tunnel | RoutingStrategies.Bubble); } /// <inheritdoc /> protected override void OnDetachedFromVisualTree() { AssociatedObject?.RemoveHandler(Gestures.DoubleTappedEvent, AssociatedObject_DoubleTapped); } private void AssociatedObject_DoubleTapped(object? sender, RoutedEventArgs e) { if (TargetControl is { IsVisible: false }) { TargetControl.IsVisible = true; TargetControl.Focus(); } } }
using Avalonia.Controls; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Xaml.Interactivity; namespace Avalonia.Xaml.Interactions.Custom; /// <summary> /// A behavior that allows to show control on double tapped event. /// </summary> public class ShowOnDoubleTappedBehavior : Behavior<Control> { /// <summary> /// Identifies the <seealso cref="TargetControl"/> avalonia property. /// </summary> public static readonly StyledProperty<Control?> TargetControlProperty = AvaloniaProperty.Register<ShowOnDoubleTappedBehavior, Control?>(nameof(TargetControl)); /// <summary> /// Gets or sets the target control. This is a avalonia property. /// </summary> public Control? TargetControl { get => GetValue(TargetControlProperty); set => SetValue(TargetControlProperty, value); } /// <inheritdoc /> protected override void OnAttachedToVisualTree() { AssociatedObject?.AddHandler(Gestures.DoubleTappedEvent, AssociatedObject_DoubleTapped, RoutingStrategies.Tunnel | RoutingStrategies.Bubble); } /// <inheritdoc /> protected override void OnDetachedFromVisualTree() { AssociatedObject?.RemoveHandler(Gestures.DoubleTappedEvent, AssociatedObject_DoubleTapped); } private void AssociatedObject_DoubleTapped(object? sender, RoutedEventArgs e) { if (TargetControl is { IsVisible: false }) { TargetControl.IsVisible = true; TargetControl.Focus(); } } }
mit
C#
bdfacd80e9829664f432217c9de111b140d526bf
Update PBU-Main-Future.cs
win120a/ACClassRoomUtil,win120a/ACClassRoomUtil
ProcessBlockUtil/PBU-Main-Future.cs
ProcessBlockUtil/PBU-Main-Future.cs
/* THIS IS ONLY TO EASY CHANGE, NOT THE PROJECT CODE AT NOW. (I will use in the future.) Copyright (C) 2011-2014 AC Inc. (Andy Cheung) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.IO; using System.Diagnostics; using System.ServiceProcess; using System.Threading; using System.Collections; using System.Text; namespace ACProcessBlockUtil { class Run:ServiceBase { SteamReader sr; ArrayList<String> al; String[] list; public static void kill() { while (true) { Process[] ieProcArray = Process.GetProcessesByName("iexplore"); //Console.WriteLine(ieProcArray.Length); if (ieProcArray.Length == 0) { continue; } foreach(Process p in ieProcArray){ p.Kill(); } Thread.Sleep(2000); } } public static void Main(String[] a) { String userProfile = Environment.GetEnvironmentVariable("UserProfile"); String systemRoot = Environment.GetEnvironmentVariable("SystemRoot"); if(File.Exists(userProfile + "\\ACRules.txt")){ ar = new ArrayList<String>(); sr = new SteamReader(userProfile + "\\ACRules.txt", new ASCIIEncoding()); while(true){ String tempLine = sr.ReadLine(); if(tempLine == null){ break; } else{ ar.Add(tempLine); } } list = ar.ToArray(); } else{ list = {"iexplore", "360se", "chrome", "firefox", "safari"} } ServiceBase.Run(new Run()); } protected override void OnStart(String[] a){ Thread t = new Thread(new ThreadStart(kill)); t.IsBackground = true; t.Start(); } } }
/* THIS IS ONLY TO EASY CHANGE, NOT THE PROJECT CODE AT NOW. (I will use in the future.) Copyright (C) 2011-2014 AC Inc. (Andy Cheung) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.IO; using System.Diagnostics; using System.ServiceProcess; using System.Threading; using System.Collections; namespace ACProcessBlockUtil { class Run:ServiceBase { SteamReader sr; ArrayList<String> al; String[] list; public static void kill() { while (true) { Process[] ieProcArray = Process.GetProcessesByName("iexplore"); //Console.WriteLine(ieProcArray.Length); if (ieProcArray.Length == 0) { continue; } foreach(Process p in ieProcArray){ p.Kill(); } Thread.Sleep(2000); } } public static void Main(String[] a) { String userProfile = Environment.GetEnvironmentVariable("UserProfile"); String systemRoot = Environment.GetEnvironmentVariable("SystemRoot"); if(File.Exists(userProfile + "\\ACRules.txt")){ ar = new ArrayList<String>(); sr = new SteamReader(userProfile + "\\ACRules.txt"); while(true){ String tempLine = sr.ReadLine(); if(tempLine == null){ break; } else{ ar.Add(tempLine); } } list = ar.ToArray(); } else{ list = {"iexplore", "360se", "chrome", "firefox", "safari"} } ServiceBase.Run(new Run()); } protected override void OnStart(String[] a){ Thread t = new Thread(new ThreadStart(kill)); t.IsBackground = true; t.Start(); } } }
apache-2.0
C#
34fb5af89d45a6caf0aa7105bfa558a106e77f27
Add test 'Can_replace_extension'
azabluda/InfoCarrier.Core
test/InfoCarrier.Core.FunctionalTests/InfoCarrierDbContextOptionsBuilderExtensionsTest.cs
test/InfoCarrier.Core.FunctionalTests/InfoCarrierDbContextOptionsBuilderExtensionsTest.cs
// Copyright (c) on/off it-solutions gmbh. All rights reserved. // Licensed under the MIT license. See license.txt file in the project root for license information. namespace InfoCarrier.Core.FunctionalTests { using System.Linq; using InfoCarrier.Core.Client; using InfoCarrier.Core.Client.Infrastructure.Internal; using InfoCarrier.Core.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Xunit; public class InfoCarrierDbContextOptionsBuilderExtensionsTest { [Fact] public void Can_add_extension_with_server_url_using_generic_options() { var optionsBuilder = new DbContextOptionsBuilder<DbContext>(); optionsBuilder.UseInfoCarrierBackend( InfoCarrierTestHelpers.CreateDummyBackend(optionsBuilder.Options.ContextType)); var extension = optionsBuilder.Options.Extensions.OfType<InfoCarrierOptionsExtension>().Single(); Assert.Equal("DummyDatabase", extension.InfoCarrierBackend.ServerUrl); } [Fact] public void Can_replace_extension() { IInfoCarrierBackend backend = InfoCarrierTestHelpers.CreateDummyBackend(typeof(DbContext)); var optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInfoCarrierBackend(backend); var extension1 = optionsBuilder.Options.Extensions.OfType<InfoCarrierOptionsExtension>().Single(); optionsBuilder.UseInfoCarrierBackend(backend); var extension2 = optionsBuilder.Options.Extensions.OfType<InfoCarrierOptionsExtension>().Single(); Assert.NotSame(extension1, extension2); Assert.Same(extension1.InfoCarrierBackend, extension2.InfoCarrierBackend); } } }
// Copyright (c) on/off it-solutions gmbh. All rights reserved. // Licensed under the MIT license. See license.txt file in the project root for license information. namespace InfoCarrier.Core.FunctionalTests { using System.Linq; using InfoCarrier.Core.Client; using InfoCarrier.Core.Client.Infrastructure.Internal; using InfoCarrier.Core.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Xunit; public class InfoCarrierDbContextOptionsBuilderExtensionsTest { [Fact] public void Can_add_extension_with_server_url_using_generic_options() { var optionsBuilder = new DbContextOptionsBuilder<DbContext>(); optionsBuilder.UseInfoCarrierBackend( InfoCarrierTestHelpers.CreateDummyBackend(optionsBuilder.Options.ContextType)); var extension = optionsBuilder.Options.Extensions.OfType<InfoCarrierOptionsExtension>().Single(); Assert.Equal("DummyDatabase", extension.InfoCarrierBackend.ServerUrl); } } }
mit
C#
4f3511e8e9637fded836e3f0080b5ba28958ecd8
Fix ring glow lookup being incorrect
johnneijzen/osu,smoogipooo/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,ZLima12/osu,peppy/osu,EVAST9919/osu,peppy/osu-new,ppy/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,2yangk23/osu,ppy/osu,johnneijzen/osu,2yangk23/osu,ZLima12/osu,peppy/osu
osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/GlowPiece.cs
osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/GlowPiece.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class GlowPiece : Container { public GlowPiece() { Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.Both; } [BackgroundDependencyLoader] private void load(TextureStore textures) { Child = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, Texture = textures.Get("Gameplay/osu/ring-glow"), Blending = BlendingParameters.Additive, Alpha = 0.5f }; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class GlowPiece : Container { public GlowPiece() { Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.Both; } [BackgroundDependencyLoader] private void load(TextureStore textures) { Child = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, Texture = textures.Get("ring-glow"), Blending = BlendingParameters.Additive, Alpha = 0.5f }; } } }
mit
C#
b940255972575b24dbbdb494f66610e326456586
Fix typo in VersionNavigation class name (#5044)
ZLima12/osu,peppy/osu,ZLima12/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,johnneijzen/osu,UselessToucan/osu,smoogipooo/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,peppy/osu,EVAST9919/osu,EVAST9919/osu,NeoAdonis/osu,johnneijzen/osu,ppy/osu,smoogipoo/osu,2yangk23/osu,ppy/osu,smoogipoo/osu,2yangk23/osu,peppy/osu-new
osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs
osu.Game/Online/API/Requests/Responses/APIChangelogBuild.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 Newtonsoft.Json; using System; using System.Collections.Generic; namespace osu.Game.Online.API.Requests.Responses { public class APIChangelogBuild : IEquatable<APIChangelogBuild> { [JsonProperty("id")] public long Id { get; set; } [JsonProperty("version")] public string Version { get; set; } [JsonProperty("display_version")] public string DisplayVersion { get; set; } [JsonProperty("users")] public long Users { get; set; } [JsonProperty("created_at")] public DateTimeOffset CreatedAt { get; set; } [JsonProperty("update_stream")] public APIUpdateStream UpdateStream { get; set; } [JsonProperty("changelog_entries")] public List<APIChangelogEntry> ChangelogEntries { get; set; } [JsonProperty("versions")] public VersionNavigation Versions { get; set; } public class VersionNavigation { [JsonProperty("next")] public APIChangelogBuild Next { get; set; } [JsonProperty("previous")] public APIChangelogBuild Previous { get; set; } } public bool Equals(APIChangelogBuild other) => Id == other?.Id; public override string ToString() => $"{UpdateStream.DisplayName} {DisplayVersion}"; } }
// 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 Newtonsoft.Json; using System; using System.Collections.Generic; namespace osu.Game.Online.API.Requests.Responses { public class APIChangelogBuild : IEquatable<APIChangelogBuild> { [JsonProperty("id")] public long Id { get; set; } [JsonProperty("version")] public string Version { get; set; } [JsonProperty("display_version")] public string DisplayVersion { get; set; } [JsonProperty("users")] public long Users { get; set; } [JsonProperty("created_at")] public DateTimeOffset CreatedAt { get; set; } [JsonProperty("update_stream")] public APIUpdateStream UpdateStream { get; set; } [JsonProperty("changelog_entries")] public List<APIChangelogEntry> ChangelogEntries { get; set; } [JsonProperty("versions")] public VersionNatigation Versions { get; set; } public class VersionNatigation { [JsonProperty("next")] public APIChangelogBuild Next { get; set; } [JsonProperty("previous")] public APIChangelogBuild Previous { get; set; } } public bool Equals(APIChangelogBuild other) => Id == other?.Id; public override string ToString() => $"{UpdateStream.DisplayName} {DisplayVersion}"; } }
mit
C#
ffa90c1a2373b7d1c774f5d355a43452c9d19667
Remove whitespace
ppy/osu,peppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,UselessToucan/osu,ppy/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu
osu.Game/Screens/OnlinePlay/Components/RoomLocalUserInfo.cs
osu.Game/Screens/OnlinePlay/Components/RoomLocalUserInfo.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.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.OnlinePlay.Components { public class RoomLocalUserInfo : OnlinePlayComposite { private OsuSpriteText attemptDisplay; public RoomLocalUserInfo() { AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader] private void load() { InternalChild = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { attemptDisplay = new OsuSpriteText { Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14) }, } }; } protected override void LoadComplete() { base.LoadComplete(); MaxAttempts.BindValueChanged(_ => updateAttempts()); UserScore.BindValueChanged(_ => updateAttempts(), true); } private void updateAttempts() { if (MaxAttempts.Value != null) { attemptDisplay.Text = $"Maximum attempts: {MaxAttempts.Value:N0}"; if (UserScore.Value != null) { int remaining = MaxAttempts.Value.Value - UserScore.Value.PlaylistItemAttempts.Sum(a => a.Attempts); attemptDisplay.Text += $" ({remaining} remaining)"; } } else { attemptDisplay.Text = 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 System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.OnlinePlay.Components { public class RoomLocalUserInfo : OnlinePlayComposite { private OsuSpriteText attemptDisplay; public RoomLocalUserInfo() { AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader] private void load() { InternalChild = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { attemptDisplay = new OsuSpriteText { Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14) }, } }; } protected override void LoadComplete() { base.LoadComplete(); MaxAttempts.BindValueChanged(_ => updateAttempts()); UserScore.BindValueChanged(_ => updateAttempts(), true); } private void updateAttempts() { if (MaxAttempts.Value != null) { attemptDisplay.Text = $"Maximum attempts: {MaxAttempts.Value:N0}"; if (UserScore.Value != null) { int remaining = MaxAttempts.Value.Value - UserScore.Value.PlaylistItemAttempts.Sum(a => a.Attempts); attemptDisplay.Text += $" ({remaining} remaining)"; } } else { attemptDisplay.Text = string.Empty; } } } }
mit
C#
b99ea122217e8d95fc9fd74e2166e219f9733587
Change number of cells. ( 9 => 7 )
ijufumi/xamarin-lifegame-xaml
XamarinLifeGameXAML/Logic/CellUtils.cs
XamarinLifeGameXAML/Logic/CellUtils.cs
using System; namespace XamarinLifeGameXAML.Logic { public class CellUtils { public static int GetIndex(Tuple<int, int> point) { return GetIndex(point.Item1, point.Item2); } public static int GetIndex(int x, int y) { return (y + x * CellSize); } public static Tuple<int, int> GetPoint(int index) { var y = index % CellSize; var x = (index - y) / CellSize; return Tuple.Create(x, y); } public static int CellSize => 7; public static int ArraySize => CellSize * CellSize; } }
using System; namespace XamarinLifeGameXAML.Logic { public class CellUtils { public static int GetIndex(Tuple<int, int> point) { return GetIndex(point.Item1, point.Item2); } public static int GetIndex(int x, int y) { return (y + x * CellSize); } public static Tuple<int, int> GetPoint(int index) { var y = index % CellSize; var x = (index - y) / CellSize; return Tuple.Create(x, y); } public static int CellSize => 9; public static int ArraySize => CellSize * CellSize; } }
mit
C#
2b30713445e3fee02ca85985d4729b9a5b24f127
simplify use of application convention
domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,oconics/Ahoy,domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Ahoy,c3-ls/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,c3-ls/Ahoy,oconics/Ahoy
src/Swashbuckle.Swagger/Application/SwaggerApplicationConvention.cs
src/Swashbuckle.Swagger/Application/SwaggerApplicationConvention.cs
using Microsoft.AspNet.Mvc.ApplicationModels; namespace Swashbuckle.Application { public class SwaggerApplicationConvention : IApplicationModelConvention { public void Apply(ApplicationModel application) { application.ApiExplorer.IsVisible = true; foreach (var controller in application.Controllers) { controller.ApiExplorer.GroupName = controller.ControllerName; } } } }
using System.Linq; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.ApplicationModels; namespace Swashbuckle.Application { public class SwaggerApplicationConvention : IApplicationModelConvention { public void Apply(ApplicationModel application) { foreach (var controller in application.Controllers) { ApplyControllerConvention(controller); } } private void ApplyControllerConvention(ControllerModel controller) { foreach (var action in controller.Actions) { if (ApiExplorerShouldIgnore(action)) { action.ApiExplorer.IsVisible = false; } else { action.ApiExplorer.IsVisible = true; action.ApiExplorer.GroupName = controller.ControllerName; } } } private bool ApiExplorerShouldIgnore(ActionModel action) { var actionSettings = action.Attributes .OfType<ApiExplorerSettingsAttribute>() .FirstOrDefault(); if (actionSettings != null) return actionSettings.IgnoreApi; var controllerSettings = action.Controller.Attributes .OfType<ApiExplorerSettingsAttribute>() .FirstOrDefault(); if (controllerSettings != null) return controllerSettings.IgnoreApi; return false; } } }
mit
C#
62e1b916ff254c6547d6f0d9010aa2af1ac62593
improve memory
MasakiMuto/LifegameGame
LifegameGame/MinMaxPlayer.cs
LifegameGame/MinMaxPlayer.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace LifegameGame { using PointScoreDictionary = Dictionary<Point, float>; public class MinMaxPlayer : AIPlayerBase { protected readonly int ThinkDepth; public MinMaxPlayer(GameBoard board, CellState side, int thinkDepth) : base(board, side) { ThinkDepth = thinkDepth; } /// <summary> /// 最善手を考える /// </summary> /// <param name="depth">ツリーを展開する最大深さ</param> /// <returns></returns> protected override Point Think() { var currentScore = Board.EvalScore(); var list = new PointScoreDictionary(); foreach (var p in GetPlayablePoints()) { list[p] = EvalPosition(Board.PlayingBoard, p, ThinkDepth, this.Side); Board.SetBoardOrigin(); } var res = (this.Side == CellState.White) ? GetMaxPoint(list) : GetMinPoint(list); return res.Key; } /// <summary> /// そこに打った時の評価値の計算 /// </summary> /// <param name="p"></param> /// <param name="isMin">minを求めるならtrue</param> protected virtual float EvalPosition(BoardInstance board, Point p, int depth, CellState side) { EvalCount++; Board.PlayingBoard = board; Debug.Assert(Board.CanPlay(p)); var next = Board.VirtualPlay(side, p); if (Board.IsExit()) { if (Board.GetWinner() == CellState.White) { return GameBoard.WinnerBonus; } else { return -GameBoard.WinnerBonus; } } if (depth == 1) { return Board.EvalScore(); } else { return GetBestChild(next, depth, side); } } protected virtual float GetBestChild(BoardInstance next, int depth, CellState side) { List<float> scores = new List<float>(); float current = (this.Side == side ? float.MinValue : float.MaxValue); foreach (var item in GetPlayablePoints()) { //var b = Board.VirtualPlay(Side, item); //float score = Board.EvalScore(); float score = (EvalPosition(next, item, depth - 1, side == CellState.White ? CellState.Black : CellState.White)); if ((this.Side == side && score > current) || (this.Side != side && score < current)) { current = score; } } return current; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace LifegameGame { using PointScoreDictionary = Dictionary<Point, float>; public class MinMaxPlayer : AIPlayerBase { protected readonly int ThinkDepth; public MinMaxPlayer(GameBoard board, CellState side, int thinkDepth) : base(board, side) { ThinkDepth = thinkDepth; } /// <summary> /// 最善手を考える /// </summary> /// <param name="depth">ツリーを展開する最大深さ</param> /// <returns></returns> protected override Point Think() { var currentScore = Board.EvalScore(); var list = new PointScoreDictionary(); foreach (var p in GetPlayablePoints()) { list[p] = EvalPosition(Board.PlayingBoard, p, ThinkDepth, this.Side); Board.SetBoardOrigin(); } var res = (this.Side == CellState.White) ? GetMaxPoint(list) : GetMinPoint(list); return res.Key; } /// <summary> /// そこに打った時の評価値の計算 /// </summary> /// <param name="p"></param> /// <param name="isMin">minを求めるならtrue</param> float EvalPosition(BoardInstance board, Point p, int depth, CellState side) { EvalCount++; Board.PlayingBoard = board; Debug.Assert(Board.CanPlay(p)); var next = Board.VirtualPlay(side, p); if (Board.IsExit()) { if (Board.GetWinner() == CellState.White) { return GameBoard.WinnerBonus; } else { return -GameBoard.WinnerBonus; } } if (depth == 1) { return Board.EvalScore(); } else { List<float> scores = new List<float>(); foreach (var item in GetPlayablePoints()) { //var b = Board.VirtualPlay(Side, item); //float score = Board.EvalScore(); scores.Add(EvalPosition(next, item, depth - 1, side == CellState.White ? CellState.Black : CellState.White)); } if (this.Side != side) { return scores.Min(); } else { return scores.Max(); } } } } }
mit
C#
7553266c240c03a7490b1b4f4bc144f29f30e31d
Update BindAttribute.cs
dimmpixeye/Unity3dTools
Runtime/Attributes/BindAttribute.cs
Runtime/Attributes/BindAttribute.cs
using System; namespace Pixeye.Actors { public class BindAttribute : Attribute { public int id; public BindAttribute(int id) { this.id = id; } public BindAttribute() { } } }
using System; namespace Pixeye.Actors { public class BindAttribute : Attribute { public int id; public BindAttribute(int id) { this.id = id; } } }
mit
C#
d6fdca59b034ff0dbd9935ee3ace044ecd1fab28
Fix benchmark for arraylist iterator
henrikfroehling/RangeIt
Source/Tests/Iterator.Performance.Tests/NotConst/ArrayList_Iterator_Vs_Enumerator_Tests.cs
Source/Tests/Iterator.Performance.Tests/NotConst/ArrayList_Iterator_Vs_Enumerator_Tests.cs
namespace Iterator.Performance.Tests.NotConst { using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Attributes.Columns; using RangeIt.Iterators; using System; using System.Collections; [MinColumn, MaxColumn] public class ArrayList_Iterator_Vs_Enumerator_Tests { private readonly ArrayList _arrayListInts = new ArrayList(); private readonly ArrayList _arrayListStrings = new ArrayList(); private readonly Random _random = new Random(); [Setup] public void Setup() { var max = Constants.MAX_ITEMS; for (int i = 0; i < max; i++) _arrayListInts.Add(_random.Next(max)); for (int i = 0; i < max; i++) _arrayListStrings.Add(_random.Next(max).ToString()); } [Benchmark] public void ArrayList_Integer_Iterator() { var it = _arrayListInts.Begin(); while (it++) { } } [Benchmark] public void ArrayList_Integer_Enumerator() { foreach (var i in _arrayListInts) { } } [Benchmark] public void ArrayList_String_Iterator() { var it = _arrayListStrings.Begin(); while (it++) { } } [Benchmark] public void ArrayList_String_Enumerator() { foreach (var s in _arrayListStrings) { } } } }
namespace Iterator.Performance.Tests.NotConst { using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Attributes.Columns; using RangeIt.Iterators; using System; using System.Collections; [MinColumn, MaxColumn] public class ArrayList_Iterator_Vs_Enumerator_Tests { private readonly ArrayList _arrayListInts = new ArrayList(); private readonly ArrayList _arrayListStrings = new ArrayList(); private readonly Random _random = new Random(); [Setup] public void Setup() { var max = Constants.MAX_ITEMS; for (int i = 0; i < max; i++) _arrayListInts.Add(_random.Next(max)); for (int i = 0; i < max; i++) _arrayListStrings.Add(_random.Next(max).ToString()); } [Benchmark] public void ArrayList_Integer_Iterator() { var it = _arrayListInts.ConstBegin(); while (it++) { } } [Benchmark] public void ArrayList_Integer_Enumerator() { foreach (var i in _arrayListInts) { } } [Benchmark] public void ArrayList_String_Iterator() { var it = _arrayListStrings.ConstBegin(); while (it++) { } } [Benchmark] public void ArrayList_String_Enumerator() { foreach (var s in _arrayListStrings) { } } } }
mit
C#
23da2d640dbb9bc846bb85488ef574fdaafdb73e
Return added disposable from `DisposeWith`
Weingartner/SolidworksAddinFramework
SolidworksAddinFramework/DisposableExtensions.cs
SolidworksAddinFramework/DisposableExtensions.cs
using System; using System.Collections.Generic; using System.Reactive.Disposables; using System.Text; namespace SolidworksAddinFramework { public static class DisposableExtensions { public static IDisposable ToCompositeDisposable(this IEnumerable<IDisposable> d) { return new CompositeDisposable(d); } public static T DisposeWith<T>(this T disposable, CompositeDisposable container) where T : IDisposable { container.Add(disposable); return disposable; } } }
using System; using System.Collections.Generic; using System.Reactive.Disposables; using System.Text; namespace SolidworksAddinFramework { public static class DisposableExtensions { public static IDisposable ToCompositeDisposable(this IEnumerable<IDisposable> d) { return new CompositeDisposable(d); } public static void DisposeWith(this IDisposable disposable, CompositeDisposable container) { container.Add(disposable); } } }
mit
C#
0b77cb16114d2cd6594a4c3cea5d2b22fb019a5a
Increment build number
emoacht/SnowyImageCopy
Source/SnowyImageCopy/Properties/AssemblyInfo.cs
Source/SnowyImageCopy/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Snowy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Snowy")] [assembly: AssemblyCopyright("Copyright © 2014-2020 emoacht")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("55df0585-a26e-489e-bd94-4e6a50a83e23")] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US" , UltimateResourceFallbackLocation.MainAssembly)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.2.3.0")] [assembly: AssemblyFileVersion("2.2.3.0")] // For unit test [assembly: InternalsVisibleTo("SnowyImageCopy.Test")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Snowy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Snowy")] [assembly: AssemblyCopyright("Copyright © 2014-2020 emoacht")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("55df0585-a26e-489e-bd94-4e6a50a83e23")] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US" , UltimateResourceFallbackLocation.MainAssembly)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.2.2.0")] [assembly: AssemblyFileVersion("2.2.2.0")] // For unit test [assembly: InternalsVisibleTo("SnowyImageCopy.Test")]
mit
C#
f4afb518ccfd81baab98bc034727e6ee4b7d517d
Remove unused constant.
codemerlin/git-tfs,WolfVR/git-tfs,codemerlin/git-tfs,kgybels/git-tfs,WolfVR/git-tfs,hazzik/git-tfs,bleissem/git-tfs,jeremy-sylvis-tmg/git-tfs,NathanLBCooper/git-tfs,irontoby/git-tfs,andyrooger/git-tfs,jeremy-sylvis-tmg/git-tfs,hazzik/git-tfs,TheoAndersen/git-tfs,jeremy-sylvis-tmg/git-tfs,vzabavnov/git-tfs,NathanLBCooper/git-tfs,pmiossec/git-tfs,guyboltonking/git-tfs,PKRoma/git-tfs,allansson/git-tfs,modulexcite/git-tfs,adbre/git-tfs,modulexcite/git-tfs,git-tfs/git-tfs,modulexcite/git-tfs,guyboltonking/git-tfs,NathanLBCooper/git-tfs,irontoby/git-tfs,kgybels/git-tfs,TheoAndersen/git-tfs,hazzik/git-tfs,adbre/git-tfs,steveandpeggyb/Public,TheoAndersen/git-tfs,hazzik/git-tfs,allansson/git-tfs,bleissem/git-tfs,allansson/git-tfs,codemerlin/git-tfs,TheoAndersen/git-tfs,allansson/git-tfs,kgybels/git-tfs,adbre/git-tfs,WolfVR/git-tfs,bleissem/git-tfs,steveandpeggyb/Public,guyboltonking/git-tfs,steveandpeggyb/Public,irontoby/git-tfs
GitTfs/Commands/InitOptions.cs
GitTfs/Commands/InitOptions.cs
using System; using System.ComponentModel; using NDesk.Options; using Sep.Git.Tfs.Util; namespace Sep.Git.Tfs.Commands { [StructureMapSingleton] public class InitOptions { private const string default_autocrlf = "false"; public InitOptions() { GitInitAutoCrlf = default_autocrlf; } public OptionSet OptionSet { get { return new OptionSet { { "template=", "Passed to git-init", v => GitInitTemplate = v }, { "shared:", "Passed to git-init", v => GitInitShared = v == null ? (object)true : (object)v }, { "autocrlf=", "Normalize line endings (default: " + default_autocrlf + ")", v => GitInitAutoCrlf = ValidateCrlfValue(v) }, { "ignorecase=", "Ignore case in file paths (default: system default)", v => GitInitIgnoreCase = ValidateIgnoreCaseValue(v) }, {"bare", "clone the TFS repository in a bare git repository", v => IsBare = v != null}, }; } } string ValidateCrlfValue(string v) { string[] valid = { "false", "true", "auto" }; if (!Array.Exists(valid, s => v == s)) throw new OptionException("error: autocrlf value must be one of true, false or auto", "autocrlf"); return v; } string ValidateIgnoreCaseValue(string v) { string[] valid = { "false", "true" }; if (!Array.Exists(valid, s => v == s)) throw new OptionException("error: ignorecase value must be true or false", "ignorecase"); return v; } public bool IsBare { get; set; } public string GitInitTemplate { get; set; } public object GitInitShared { get; set; } public string GitInitAutoCrlf { get; set; } public string GitInitIgnoreCase { get; set; } } }
using System; using System.ComponentModel; using NDesk.Options; using Sep.Git.Tfs.Util; namespace Sep.Git.Tfs.Commands { [StructureMapSingleton] public class InitOptions { private const string default_autocrlf = "false"; private const string default_ignorecase = "false"; public InitOptions() { GitInitAutoCrlf = default_autocrlf; } public OptionSet OptionSet { get { return new OptionSet { { "template=", "Passed to git-init", v => GitInitTemplate = v }, { "shared:", "Passed to git-init", v => GitInitShared = v == null ? (object)true : (object)v }, { "autocrlf=", "Normalize line endings (default: " + default_autocrlf + ")", v => GitInitAutoCrlf = ValidateCrlfValue(v) }, { "ignorecase=", "Ignore case in file paths (default: " + default_ignorecase + ")", v => GitInitIgnoreCase = ValidateIgnoreCaseValue(v) }, {"bare", "clone the TFS repository in a bare git repository", v => IsBare = v != null}, }; } } string ValidateCrlfValue(string v) { string[] valid = { "false", "true", "auto" }; if (!Array.Exists(valid, s => v == s)) throw new OptionException("error: autocrlf value must be one of true, false or auto", "autocrlf"); return v; } string ValidateIgnoreCaseValue(string v) { string[] valid = { "false", "true" }; if (!Array.Exists(valid, s => v == s)) throw new OptionException("error: ignorecase value must be true or false", "ignorecase"); return v; } public bool IsBare { get; set; } public string GitInitTemplate { get; set; } public object GitInitShared { get; set; } public string GitInitAutoCrlf { get; set; } public string GitInitIgnoreCase { get; set; } } }
apache-2.0
C#
7ae22322ca4d3212de14d658ad1bc9031fe2b2cb
Introduce variables to avoid multiple type casting
sergeyshushlyapin/AutoFixture,dcastro/AutoFixture,adamchester/AutoFixture,AutoFixture/AutoFixture,zvirja/AutoFixture,Pvlerick/AutoFixture,dcastro/AutoFixture,hackle/AutoFixture,sean-gilliam/AutoFixture,hackle/AutoFixture,sbrockway/AutoFixture,adamchester/AutoFixture,sergeyshushlyapin/AutoFixture,sbrockway/AutoFixture
Src/AutoFixture.xUnit.net/CustomizeAttributeComparer.cs
Src/AutoFixture.xUnit.net/CustomizeAttributeComparer.cs
using System.Collections.Generic; namespace Ploeh.AutoFixture.Xunit { internal class CustomizeAttributeComparer : Comparer<CustomizeAttribute> { public override int Compare(CustomizeAttribute x, CustomizeAttribute y) { var xfrozen = x is FrozenAttribute; var yfrozen = y is FrozenAttribute; if (xfrozen && !yfrozen) { return 1; } if (yfrozen && !xfrozen) { return -1; } return 0; } } }
using System.Collections.Generic; namespace Ploeh.AutoFixture.Xunit { internal class CustomizeAttributeComparer : Comparer<CustomizeAttribute> { public override int Compare(CustomizeAttribute x, CustomizeAttribute y) { if (x is FrozenAttribute && !(y is FrozenAttribute)) { return 1; } if (y is FrozenAttribute && !(x is FrozenAttribute)) { return -1; } return 0; } } }
mit
C#
42e19d64353939493a7ba34e06cf80ec3bff01e5
Fix project name in assembly info
TheOtherTimDuncan/TOTD-Mailer
TOTD.Mailer.Templates/Properties/AssemblyInfo.cs
TOTD.Mailer.Templates/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("TOTD.Mailer.Templates")] [assembly: AssemblyDescription("")] [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)]
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("TOTD.Mailer.Html")] [assembly: AssemblyDescription("")] [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)]
mit
C#
8f5542626505993d51f3ed60557387249aba614d
更新Demo,避免在某些特殊情况下MessageHandler日志记录过程异常
JeffreySu/WxOpen,JeffreySu/WxOpen
src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/MessageHandlers/WxOpenMessageHandler.Message.cs
src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/MessageHandlers/WxOpenMessageHandler.Message.cs
#region Apache License Version 2.0 /*---------------------------------------------------------------- Copyright 2018 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. 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. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md ----------------------------------------------------------------*/ #endregion Apache License Version 2.0 /*---------------------------------------------------------------- Copyright (C) 2018 Senparc 文件名:MessageHandler.Event.cs 文件功能描述:微信请求的集中处理方法:Message相关 创建标识:Senparc - 20170106 ----------------------------------------------------------------*/ using Senparc.CO2NET.Extensions; using Senparc.CO2NET.Trace; using Senparc.NeuChar.Entities; using Senparc.Weixin.WxOpen.Entities; namespace Senparc.Weixin.WxOpen.MessageHandlers { public abstract partial class WxOpenMessageHandler<TC> { #region 接收消息方法 /// <summary> /// 默认返回消息(当任何OnXX消息没有被重写,都将自动返回此默认消息) /// </summary> public abstract IResponseMessageBase DefaultResponseMessage(IRequestMessageBase requestMessage); //{ // 例如可以这样实现: // var responseMessage = this.CreateResponseMessage<ResponseMessageText>(); // responseMessage.Content = "您发送的消息类型暂未被识别。"; // return responseMessage; //} /// <summary> /// 文字类型请求 /// </summary> public virtual IResponseMessageBase OnTextRequest(RequestMessageText requestMessage) { return DefaultResponseMessage(requestMessage); } /// <summary> /// 图片类型请求 /// </summary> public virtual IResponseMessageBase OnImageRequest(RequestMessageImage requestMessage) { return DefaultResponseMessage(requestMessage); } #endregion } }
#region Apache License Version 2.0 /*---------------------------------------------------------------- Copyright 2018 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. 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. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md ----------------------------------------------------------------*/ #endregion Apache License Version 2.0 /*---------------------------------------------------------------- Copyright (C) 2018 Senparc 文件名:MessageHandler.Event.cs 文件功能描述:微信请求的集中处理方法:Message相关 创建标识:Senparc - 20170106 ----------------------------------------------------------------*/ using Senparc.NeuChar.Entities; using Senparc.Weixin.WxOpen.Entities; namespace Senparc.Weixin.WxOpen.MessageHandlers { public abstract partial class WxOpenMessageHandler<TC> { #region 接收消息方法 /// <summary> /// 默认返回消息(当任何OnXX消息没有被重写,都将自动返回此默认消息) /// </summary> public abstract IResponseMessageBase DefaultResponseMessage(IRequestMessageBase requestMessage); //{ // 例如可以这样实现: // var responseMessage = this.CreateResponseMessage<ResponseMessageText>(); // responseMessage.Content = "您发送的消息类型暂未被识别。"; // return responseMessage; //} /// <summary> /// 文字类型请求 /// </summary> public virtual IResponseMessageBase OnTextRequest(RequestMessageText requestMessage) { return DefaultResponseMessage(requestMessage); } /// <summary> /// 图片类型请求 /// </summary> public virtual IResponseMessageBase OnImageRequest(RequestMessageImage requestMessage) { return DefaultResponseMessage(requestMessage); } #endregion } }
apache-2.0
C#
50bd7df33f0ba57d05d40224139db56c1db1b3fb
make key input larger
IdentityModel/AuthorizationServer,s093294/Thinktecture.AuthorizationServer,s093294/Thinktecture.AuthorizationServer,yfann/AuthorizationServer,yfann/AuthorizationServer,IdentityModel/AuthorizationServer
source/WebHost/Areas/Admin/Views/Key/SymmetricKey.cshtml
source/WebHost/Areas/Admin/Views/Key/SymmetricKey.cshtml
@{ ViewBag.Title = "Symmetric Key"; } <h2><span data-bind="text: editDescription"></span> Symmetric Key</h2> <ul class="nav nav-pills"> <li> <a href="@Url.Action("Index")"> <i class="icon-arrow-left"></i> Back to Keys</a> </li> </ul> <fieldset> <legend></legend> <div> <label for="name">Name</label> <input id="name" data-bind="value: name, valueUpdate: 'keyup'" /> <label class="text-error" data-bind="text: nameError"></label> </div> <div> <label for="value">Value (base64)</label> <input id="value" class="input-xxlarge" data-bind="value: value, valueUpdate: 'keyup', enable: isNew" /> <button type="button" class="btn" data-bind="click: createKey, enable: isNew">create</button> <label class="text-error" data-bind="text: valueError"></label> </div> <div><button class="btn btn-primary" data-bind="click: save, disable: anyErrors">Save</button></div> </fieldset> @section scripts{ <script src="~/Areas/Admin/Scripts/SymmetricKey.js"></script> }
@{ ViewBag.Title = "Symmetric Key"; } <h2><span data-bind="text: editDescription"></span> Symmetric Key</h2> <ul class="nav nav-pills"> <li> <a href="@Url.Action("Index")"> <i class="icon-arrow-left"></i> Back to Keys</a> </li> </ul> <fieldset> <legend></legend> <div> <label for="name">Name</label> <input id="name" data-bind="value: name, valueUpdate: 'keyup'" /> <label class="text-error" data-bind="text: nameError"></label> </div> <div> <label for="value">Value (base64)</label> <input id="value" class="input-xlarge" data-bind="value: value, valueUpdate: 'keyup', enable: isNew" /> <button type="button" class="btn" data-bind="click: createKey, enable: isNew">create</button> <label class="text-error" data-bind="text: valueError"></label> </div> <div><button class="btn btn-primary" data-bind="click: save, disable: anyErrors">Save</button></div> </fieldset> @section scripts{ <script src="~/Areas/Admin/Scripts/SymmetricKey.js"></script> }
bsd-3-clause
C#
0b000e56ef546a3e21b3961f2d1fb2b794879781
Fix typo
JKennedy24/Xamarin.Forms.GoogleMaps,JKennedy24/Xamarin.Forms.GoogleMaps,amay077/Xamarin.Forms.GoogleMaps,quesera2/Xamarin.Forms.GoogleMaps
XFGoogleMapSample/XFGoogleMapSample/Variables_sample.cs
XFGoogleMapSample/XFGoogleMapSample/Variables_sample.cs
/// PLEASE RENAME THIS FILE TO Variables.cs using System; namespace XFGoogleMapSample { public static class Variables { // https://developers.google.com/maps/documentation/android-api/signup public const string GOOGLE_MAPS_ANDROID_API_KEY = "your_google_maps_android_api_v2_api_key"; // https://developers.google.com/maps/documentation/ios-sdk/start#step_4_get_an_api_key public const string GOOGLE_MAPS_IOS_API_KEY = "your_google_maps_sdk_for_ios_api_key"; // https://msdn.microsoft.com/windows/uwp/maps-and-location/authentication-key public const string BING_MAPS_UWP_API_KEY = "your_bing_maps_apikey"; } }
/// PLEASE RENAME THIS FILE TO Variables.cs using System; namespace XFGoogleMapSample { public static class Variables { // https://developers.google.com/maps/documentation/android-api/signup public const string GOOGLE_MAPS_ANDROID_API_KEY = "your_google_maps_android_api_v2_api_key"; // https://developers.google.com/maps/documentation/ios-sdk/start#step_4_get_an_api_key public const string GOOGLE_MAPS_IOS_API_KEY = "your_google_maps_sdk_for_ios_api_key"; // https://msdn.microsoft.com/windows/uwp/maps-and-location/authentication-key public const string BING_MAPS_UWP_API_KEY = "your_bing_maps_apikey"); } }
mit
C#
6f482babbbeb42939382d44c6bf36306c4b5019f
revert unintended merge conflict
akamud/code-cracker,f14n/code-cracker,andrecarlucci/code-cracker,code-cracker/code-cracker,GuilhermeSa/code-cracker,thomaslevesque/code-cracker,adraut/code-cracker,AlbertoMonteiro/code-cracker,eriawan/code-cracker,ElemarJR/code-cracker,jwooley/code-cracker,carloscds/code-cracker,dmgandini/code-cracker,thorgeirk11/code-cracker,baks/code-cracker,kindermannhubert/code-cracker,carloscds/code-cracker,modulexcite/code-cracker,gerryaobrien/code-cracker,robsonalves/code-cracker,caioadz/code-cracker,eirielson/code-cracker,jhancock93/code-cracker,dlsteuer/code-cracker,giggio/code-cracker,code-cracker/code-cracker
src/CSharp/CodeCracker/Usage/RethrowExceptionAnalyzer.cs
src/CSharp/CodeCracker/Usage/RethrowExceptionAnalyzer.cs
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using System.Collections.Immutable; using System.Linq; namespace CodeCracker.Usage { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class RethrowExceptionAnalyzer : DiagnosticAnalyzer { private static readonly string diagnosticId = DiagnosticId.RethrowException.ToDiagnosticId(); internal const string Title = "Your throw does nothing"; internal const string MessageFormat = "{0}"; internal const string Category = SupportedCategories.Naming; const string Description = "Throwing the same exception as passed to the 'catch' block lose the original " + "stack trace and will make debugging this exception a lot more difficult.\r\n" + "The correct way to rethrow an exception without changing it is by using 'throw' without any parameter."; internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor( diagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description, helpLink: HelpLink.ForDiagnostic(diagnosticId)); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule); public override void Initialize(AnalysisContext context) => context.RegisterSyntaxNodeAction(Analyzer, SyntaxKind.ThrowStatement); private void Analyzer(SyntaxNodeAnalysisContext context) { var throwStatement = (ThrowStatementSyntax)context.Node; var ident = throwStatement.Expression as IdentifierNameSyntax; if (ident == null) return; var exSymbol = context.SemanticModel.GetSymbolInfo(ident).Symbol as ILocalSymbol; if (exSymbol == null) return; var catchClause = context.Node.Parent.AncestorsAndSelf().OfType<CatchClauseSyntax>().FirstOrDefault(); if (catchClause == null) return; var catchExSymbol = context.SemanticModel.GetDeclaredSymbol(catchClause.Declaration); if (!catchExSymbol.Equals(exSymbol)) return; var diagnostic = Diagnostic.Create(Rule, throwStatement.GetLocation(), "Don't throw the same exception you caught, you lose the original stack trace."); context.ReportDiagnostic(diagnostic); } } }
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using System.Collections.Immutable; using System.Linq; namespace CodeCracker.Usage { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class RethrowExceptionAnalyzer : DiagnosticAnalyzer { private static readonly string diagnosticId = DiagnosticId.RethrowException.ToDiagnosticId(); internal const string Title = "Your throw does nothing"; internal const string MessageFormat = "{0}"; internal const string Category = SupportedCategories.Naming; const string Description = "Throwing the same exception as passed to the 'catch' block lose the original " + "stack trace and will make debugging this exception a lot more difficult.\r\n" + "The correct way to rethrow an exception without changing it is by using 'throw' without any parameter."; internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor( diagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: false, description: Description, helpLink: HelpLink.ForDiagnostic(diagnosticId)); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule); public override void Initialize(AnalysisContext context) => context.RegisterSyntaxNodeAction(Analyzer, SyntaxKind.ThrowStatement); private void Analyzer(SyntaxNodeAnalysisContext context) { var throwStatement = (ThrowStatementSyntax)context.Node; var ident = throwStatement.Expression as IdentifierNameSyntax; if (ident == null) return; var exSymbol = context.SemanticModel.GetSymbolInfo(ident).Symbol as ILocalSymbol; if (exSymbol == null) return; var catchClause = context.Node.Parent.AncestorsAndSelf().OfType<CatchClauseSyntax>().FirstOrDefault(); if (catchClause == null) return; var catchExSymbol = context.SemanticModel.GetDeclaredSymbol(catchClause.Declaration); if (!catchExSymbol.Equals(exSymbol)) return; var diagnostic = Diagnostic.Create(Rule, throwStatement.GetLocation(), "Don't throw the same exception you caught, you lose the original stack trace."); context.ReportDiagnostic(diagnostic); } } }
apache-2.0
C#
c3595d126846be79e97577702f84d5359f1b5588
Add incident fields used for querying
AshleyPoole/Noobot.Modules
src/Noobot.Modules.IncidentManagement/Models/Incident.cs
src/Noobot.Modules.IncidentManagement/Models/Incident.cs
using System; using Microsoft.WindowsAzure.Storage.Table; namespace Noobot.Modules.IncidentManagement.Models { public class Incident : TableEntity { public Incident(string incidentTitle, string declaredInChannelName, string declaredBy) { this.Id = Guid.NewGuid(); this.PartitionKey = DateTime.UtcNow.ToString("yyyy-MM-dd"); this.ChannelName = declaredInChannelName; this.Title = incidentTitle; this.DeclaredBy = declaredBy; this.DeclaredDateTimeUtc = DateTime.UtcNow; this.Resolved = false; this.Closed = false; } public Incident() { } public Guid Id { get; set; } public string ChannelName { get; set; } public string Title { get; set; } public string DeclaredBy { get; set; } public DateTime DeclaredDateTimeUtc { get; set; } public bool Resolved { get; set; } public string ResolvedBy { get; set; } public DateTime? ResolvedDateTimeUtc { get; set; } public bool Closed { get; set; } public string ClosedBy { get; set; } public DateTime? ClosedDateTimeUtc { get; set; } public string FriendlyId => $"{this.PartitionKey}-{this.RowKey}"; public void MarkAsResolved(string resolvedBy) { this.ResolvedDateTimeUtc = DateTime.UtcNow; this.ResolvedBy = resolvedBy; this.Resolved = true; } public void MarkAsClosed(string closedBy) { this.ClosedDateTimeUtc = DateTime.UtcNow; this.ClosedBy = closedBy; this.Closed = true; } public void SetRowKey(int rowKey) { this.RowKey = rowKey.ToString(); } } }
using System; using Microsoft.WindowsAzure.Storage.Table; namespace Noobot.Modules.IncidentManagement.Models { public class Incident : TableEntity { public Incident(string incidentTitle, string declaredInChannelName, string declaredBy) { this.Id = Guid.NewGuid(); this.PartitionKey = DateTime.UtcNow.ToString("yyyy-MM-dd"); this.ChannelName = declaredInChannelName; this.Title = incidentTitle; this.DeclaredBy = declaredBy; this.DeclaredDateTimeUtc = DateTime.UtcNow; } public Incident() { } public Guid Id { get; set; } public string ChannelName { get; set; } public string Title { get; set; } public string DeclaredBy { get; set; } public DateTime DeclaredDateTimeUtc { get; set; } public string ResolvedBy { get; set; } public DateTime? ResolvedDateTimeUtc { get; set; } public string ClosedBy { get; set; } public DateTime? ClosedDateTimeUtc { get; set; } public string FriendlyId => $"{this.PartitionKey}-{this.RowKey}"; public void MarkAsResolved(string resolvedBy) { this.ResolvedDateTimeUtc = DateTime.UtcNow; this.ResolvedBy = resolvedBy; } public void MarkAsClosed(string closedBy) { this.ClosedDateTimeUtc = DateTime.UtcNow; this.ClosedBy = closedBy; } public void SetRowKey(int rowKey) { this.RowKey = rowKey.ToString(); } } }
mit
C#
f251f8420784bc0bf4ea617a8610d8b77da52e03
add mobile application type
CiBuildOrg/WebApi-Boilerplate,CiBuildOrg/WebApi-Boilerplate,CiBuildOrg/WebApi-Boilerplate
App/App.Entities/Security/ApplicationType.cs
App/App.Entities/Security/ApplicationType.cs
namespace App.Entities.Security { public enum ApplicationType { JavaScript = 0, NativeConfidential = 1, ExternalInterface = 2, Mobile = 3, } }
namespace App.Entities.Security { public enum ApplicationType { JavaScript = 0, NativeConfidential = 1, ExternalInterface = 2, } }
mit
C#
55a18181efffa6a493a0ba8a2bab6ce6014c76c5
Fix ToString
kangaroo/monomac,dlech/monomac,PlayScriptRedux/monomac
src/QTKit/Defs.cs
src/QTKit/Defs.cs
// // Copyright 2010, Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Runtime.InteropServices; namespace MonoMac.QTKit { [StructLayout (LayoutKind.Sequential)] public partial struct QTTime { public static QTTime Zero = new QTTime (0, 1, 0); public static QTTime IndefiniteTime = new QTTime (0, 1, TimeFlags.TimeIsIndefinite); public long TimeValue; public int TimeScale; public TimeFlags Flags; public QTTime (long timeValue, int timeScale, TimeFlags flags) { TimeValue = timeValue; TimeScale = timeScale; Flags = flags; } public QTTime (long timeValue, int timeScale) { TimeValue = timeValue; TimeScale = timeScale; Flags = 0; } public override string ToString () { if (Flags == 0) return String.Format ("[TimeValue={0} scale={1}]", TimeValue, TimeScale); else return String.Format ("[TimeValue={0} scale={1} Flags={2}]", TimeValue, TimeScale, Flags); } } public struct QTTimeRange { public QTTime Time; public QTTime Duration; public QTTimeRange (QTTime time, QTTime duration) { Time = time; Duration = duration; } public override string ToString () { return String.Format ("[Time={0} Duration={2}]", Time, Duration); } } }
// // Copyright 2010, Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Runtime.InteropServices; namespace MonoMac.QTKit { [StructLayout (LayoutKind.Sequential)] public partial struct QTTime { public static QTTime Zero = new QTTime (0, 1, 0); public static QTTime IndefiniteTime = new QTTime (0, 1, TimeFlags.TimeIsIndefinite); public long TimeValue; public int TimeScale; public TimeFlags Flags; public QTTime (long timeValue, int timeScale, TimeFlags flags) { TimeValue = timeValue; TimeScale = timeScale; Flags = flags; } public QTTime (long timeValue, int timeScale) { TimeValue = timeValue; TimeScale = timeScale; Flags = 0; } public override string ToString () { return String.Format ("[TimeValue={0} scale={2} Flags={3}]", TimeValue, TimeScale, Flags); } } public struct QTTimeRange { public QTTime Time; public QTTime Duration; public QTTimeRange (QTTime time, QTTime duration) { Time = time; Duration = duration; } public override string ToString () { return String.Format ("[Time={0} Duration={2}]", Time, Duration); } } }
apache-2.0
C#
eadcab758e7eba3ec122068769026fed61bc1eba
Add test skipping for 0.5.2
PlayFab/consuldotnet
Consul.Test/CoordinateTest.cs
Consul.Test/CoordinateTest.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Consul.Test { [TestClass] public class CoordinateTest { [TestMethod] public void TestCoordinate_Datacenters() { var client = new Client(); var info = client.Agent.Self(); if (!info.Response.ContainsKey("Coord")) { Assert.Inconclusive("This version of Consul does not support the coordinate API"); } var datacenters = client.Coordinate.Datacenters(); Assert.IsNotNull(datacenters.Response); Assert.IsTrue(datacenters.Response.Length > 0); } [TestMethod] public void TestCoordinate_Nodes() { var client = new Client(); var info = client.Agent.Self(); if (!info.Response.ContainsKey("Coord")) { Assert.Inconclusive("This version of Consul does not support the coordinate API"); } var nodes = client.Coordinate.Nodes(); Assert.IsNotNull(nodes.Response); Assert.IsTrue(nodes.Response.Length > 0); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Consul.Test { [TestClass] public class CoordinateTest { [TestMethod] public void TestCoordinate_Datacenters() { var client = new Client(); var datacenters = client.Coordinate.Datacenters(); Assert.IsNotNull(datacenters.Response); Assert.IsTrue(datacenters.Response.Length > 0); } [TestMethod] public void TestCoordinate_Nodes() { var client = new Client(); var nodes = client.Coordinate.Nodes(); Assert.IsNotNull(nodes.Response); Assert.IsTrue(nodes.Response.Length > 0); } } }
apache-2.0
C#
f04cdb6a136b41e8c65c034e0cf6e0eb9da7922d
Fix PropertyBridge not updating properly
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
Core/Bridge/PropertyBridge.cs
Core/Bridge/PropertyBridge.cs
using System.Text; namespace TweetDuck.Core.Bridge{ static class PropertyBridge{ public enum Environment{ Browser, Notification } public static string GenerateScript(Environment environment){ string Bool(bool value){ return value ? "true;" : "false;"; } StringBuilder build = new StringBuilder().Append("(function(x){"); build.Append("x.expandLinksOnHover=").Append(Bool(Program.UserConfig.ExpandLinksOnHover)); if (environment == Environment.Browser){ build.Append("x.switchAccountSelectors=").Append(Bool(Program.UserConfig.SwitchAccountSelectors)); build.Append("x.muteNotifications=").Append(Bool(Program.UserConfig.MuteNotifications)); build.Append("x.hasCustomNotificationSound=").Append(Bool(Program.UserConfig.NotificationSoundPath.Length > 0)); build.Append("x.notificationMediaPreviews=").Append(Bool(Program.UserConfig.NotificationMediaPreviews)); } if (environment == Environment.Notification){ build.Append("x.skipOnLinkClick=").Append(Bool(Program.UserConfig.NotificationSkipOnLinkClick)); } return build.Append("})(window.$TDX=window.$TDX||{})").ToString(); } } }
using System.Text; namespace TweetDuck.Core.Bridge{ static class PropertyBridge{ public enum Environment{ Browser, Notification } public static string GenerateScript(Environment environment){ string Bool(bool value){ return value ? "true," : "false,"; } StringBuilder build = new StringBuilder().Append("window.$TDX={"); build.Append("expandLinksOnHover:").Append(Bool(Program.UserConfig.ExpandLinksOnHover)); if (environment == Environment.Browser){ build.Append("switchAccountSelectors:").Append(Bool(Program.UserConfig.SwitchAccountSelectors)); build.Append("muteNotifications:").Append(Bool(Program.UserConfig.MuteNotifications)); build.Append("hasCustomNotificationSound:").Append(Bool(Program.UserConfig.NotificationSoundPath.Length > 0)); build.Append("notificationMediaPreviews:").Append(Bool(Program.UserConfig.NotificationMediaPreviews)); } if (environment == Environment.Notification){ build.Append("skipOnLinkClick:").Append(Bool(Program.UserConfig.NotificationSkipOnLinkClick)); } return build.Append("}").ToString(); } } }
mit
C#
36a6782fb36734a2f147c8e1dd977685d1c64597
update tests
ruleechen/DQuery
DQuery.UnitTests/UnitTest1.cs
DQuery.UnitTests/UnitTest1.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Linq; using System.Collections.Generic; using DQuery.CustomQuery; namespace DQuery.UnitTests { [TestClass] public class UnitTest1 { private List<QueryClause> GetClauses() { return QueryClauseParser.Parse("[{\"operator\": \"<>\",\"condition\": \"\",\"value\": \"001\",\"valueType\": \"string\",\"fieldname\": \"cuscd\"}, {\"Operator\":\"<>\",\"Condition\":\"and\",\"Value\":\"101\",\"ValueType\":\"string\",\"FieldName\":\"cuscd\",\"items\":[{\"operator\": \"<>\",\"condition\": \"\",\"value\": \"001\",\"valueType\": \"string\",\"fieldname\": \"cuscd\"},{\"operator\": \"<>\",\"condition\": \"and\",\"value\": \"001\",\"valueType\": \"string\",\"fieldname\": \"cuscd\"}]}]"); } [TestMethod] public void TestParser() { var clauses = GetClauses(); Assert.AreEqual(clauses.Count, 2); Assert.AreEqual(clauses[0].Items.Count, 0); Assert.AreEqual(clauses[1].Items.Count, 2); Assert.AreEqual(clauses[0].Operator, OperatorType.NotEqual); } [TestMethod] public void TestBuilder() { var clauses = GetClauses(); var lambda = ExpressionBuilder.Build<SampleEntity>(clauses, new SampleFunctions()); } } public class SampleEntity { public string cuscd { get; set; } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Linq; using System.Collections.Generic; using DQuery.CustomQuery; namespace DQuery.UnitTests { [TestClass] public class UnitTest1 { private List<QueryClause> GetClauses() { return QueryClauseParser.Parse("[{\"operator\": \"<>\",\"condition\": \"\",\"value\": \"001\",\"valueType\": \"string\",\"fieldname\": \"cuscd\"}, {\"Operator\":\"<>\",\"Condition\":\"and\",\"Value\":\"101\",\"ValueType\":\"string\",\"FieldName\":\"cuscd\",\"items\":[{\"operator\": \"<>\",\"condition\": \"\",\"value\": \"001\",\"valueType\": \"string\",\"fieldname\": \"cuscd\"},{\"operator\": \"<>\",\"condition\": \"\",\"value\": \"001\",\"valueType\": \"string\",\"fieldname\": \"cuscd\"}]}]"); } [TestMethod] public void TestParser() { var clauses = GetClauses(); Assert.AreEqual(clauses.Count, 2); Assert.AreEqual(clauses[0].Items.Count, 0); Assert.AreEqual(clauses[1].Items.Count, 2); Assert.AreEqual(clauses[0].Operator, OperatorType.NotEqual); } [TestMethod] public void TestBuilder() { var clauses = GetClauses(); var lambda = ExpressionBuilder.Build<SampleEntity>(clauses, new SampleFunctions()); } } public class SampleEntity { public string cuscd { get; set; } } }
mit
C#
b8a27bb6f50a1e527bbd414516105afbee8373d7
Disable Hidden mod for osu!taiko (until it is implemented) (#5201)
ppy/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,ZLima12/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,2yangk23/osu,ZLima12/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,johnneijzen/osu,johnneijzen/osu,EVAST9919/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,EVAST9919/osu
osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs
osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.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.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Mods { public class TaikoModHidden : ModHidden { public override string Description => @"Beats fade out before you hit them!"; public override double ScoreMultiplier => 1.06; public override bool HasImplementation => false; } }
// 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.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Mods { public class TaikoModHidden : ModHidden { public override string Description => @"Beats fade out before you hit them!"; public override double ScoreMultiplier => 1.06; } }
mit
C#
8944d0f705c6a1e4ac3b1a8b0fb9269f2f3e00b2
make it only look for files instead of directories
peppy/osu-new,Drezi126/osu,2yangk23/osu,2yangk23/osu,ZLima12/osu,peppy/osu,smoogipoo/osu,Frontear/osuKyzer,EVAST9919/osu,UselessToucan/osu,naoey/osu,peppy/osu,NeoAdonis/osu,smoogipooo/osu,johnneijzen/osu,DrabWeb/osu,ppy/osu,naoey/osu,DrabWeb/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,DrabWeb/osu,UselessToucan/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu,Nabile-Rahmani/osu,NeoAdonis/osu,naoey/osu,ZLima12/osu,ppy/osu,UselessToucan/osu,EVAST9919/osu
osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs
osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using System.IO; using System.Linq; namespace osu.Game.Beatmaps.IO { /// <summary> /// Reads an extracted legacy beatmap from disk. /// </summary> public class LegacyFilesystemReader : ArchiveReader { private readonly string path; public LegacyFilesystemReader(string path) { this.path = path; } public override Stream GetStream(string name) => File.OpenRead(Path.Combine(path, name)); public override void Dispose() { // no-op } public override IEnumerable<string> Filenames => Directory.GetFiles(path, "*", SearchOption.AllDirectories).Select(Path.GetFileName).ToArray(); public override Stream GetUnderlyingStream() => null; } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using System.IO; using System.Linq; namespace osu.Game.Beatmaps.IO { /// <summary> /// Reads an extracted legacy beatmap from disk. /// </summary> public class LegacyFilesystemReader : ArchiveReader { private readonly string path; public LegacyFilesystemReader(string path) { this.path = path; } public override Stream GetStream(string name) => File.OpenRead(Path.Combine(path, name)); public override void Dispose() { // no-op } public override IEnumerable<string> Filenames => Directory.GetDirectories(path).Select(Path.GetFileName).ToArray(); public override Stream GetUnderlyingStream() => null; } }
mit
C#
9787788081d15fa49071f474db45fca99e01f045
Revert unintended change
ZLima12/osu,ZLima12/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,johnneijzen/osu,DrabWeb/osu,EVAST9919/osu,smoogipoo/osu,naoey/osu,UselessToucan/osu,ppy/osu,2yangk23/osu,peppy/osu,peppy/osu,naoey/osu,peppy/osu-new,Nabile-Rahmani/osu,johnneijzen/osu,DrabWeb/osu,smoogipooo/osu,NeoAdonis/osu,NeoAdonis/osu,EVAST9919/osu,Frontear/osuKyzer,peppy/osu,smoogipoo/osu,ppy/osu,DrabWeb/osu,2yangk23/osu,naoey/osu,UselessToucan/osu,ppy/osu
osu.Game/IO/Serialization/IJsonSerializable.cs
osu.Game/IO/Serialization/IJsonSerializable.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; using osu.Game.IO.Serialization.Converters; namespace osu.Game.IO.Serialization { public interface IJsonSerializable { } public static class JsonSerializableExtensions { public static string Serialize(this IJsonSerializable obj) => JsonConvert.SerializeObject(obj, CreateGlobalSettings()); public static T Deserialize<T>(this string objString) => JsonConvert.DeserializeObject<T>(objString, CreateGlobalSettings()); public static void DeserializeInto<T>(this string objString, T target) => JsonConvert.PopulateObject(objString, target, CreateGlobalSettings()); public static T DeepClone<T>(this T obj) where T : IJsonSerializable => Deserialize<T>(Serialize(obj)); public static JsonSerializerSettings CreateGlobalSettings() => new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, Formatting = Formatting.Indented, ObjectCreationHandling = ObjectCreationHandling.Replace, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, Converters = new JsonConverter[] { new Vector2Converter() } }; } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; using osu.Game.IO.Serialization.Converters; namespace osu.Game.IO.Serialization { public interface IJsonSerializable { } public static class JsonSerializableExtensions { public static string Serialize(this IJsonSerializable obj) => JsonConvert.SerializeObject(obj, CreateGlobalSettings()); public static T Deserialize<T>(this string objString) => JsonConvert.DeserializeObject<T>(objString, CreateGlobalSettings()); public static void DeserializeInto<T>(this string objString, T target) => JsonConvert.DeserializeAnonymousType(objString, target, CreateGlobalSettings()); public static T DeepClone<T>(this T obj) where T : IJsonSerializable => Deserialize<T>(Serialize(obj)); public static JsonSerializerSettings CreateGlobalSettings() => new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, Formatting = Formatting.Indented, ObjectCreationHandling = ObjectCreationHandling.Replace, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, Converters = new JsonConverter[] { new Vector2Converter() } }; } }
mit
C#
2480a0adfe0f55eea72d70bd2d584f8781cd7663
Bump v1.0.12.4803
karronoli/tiny-sato
TinySato/Properties/AssemblyInfo.cs
TinySato/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("TinySato")] [assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TinySato")] [assembly: AssemblyCopyright("Copyright 2016 karronoli")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: [assembly: AssemblyVersion("1.0.12.4803")] [assembly: AssemblyFileVersion("1.0.12")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("TinySato")] [assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TinySato")] [assembly: AssemblyCopyright("Copyright 2016 karronoli")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: [assembly: AssemblyVersion("1.0.12.*")] [assembly: AssemblyFileVersion("1.0.12")]
apache-2.0
C#
68159d9afe85e4d0e4dc6c3f04fb72efd7573c15
Implement the read/write xml data
wrightg42/todo-list,It423/todo-list
Todo-List/Todo-List/XMLDataSaver.cs
Todo-List/Todo-List/XMLDataSaver.cs
// XMLDataSaver.cs // <copyright file="XMLDataSaver.cs"> This code is protected under the MIT License. </copyright> using System.Collections.Generic; using System.IO; using System.Xml.Serialization; namespace Todo_List { /// <summary> /// A static class for reading and writing to XML files. /// </summary> public static class XMLDataSaver { /// <summary> /// Reads the xml file of information from the save location. /// </summary> public static void ReadXMLFile() { try { using (TextReader tr = new StreamReader("TodoListData.xml")) { XmlSerializer xs = new XmlSerializer(typeof(List<Note>)); NoteSorter.Notes = (List<Note>)xs.Deserialize(tr); } } catch (FileNotFoundException) { // File not found so don't read anything } } /// <summary> /// Saves the xml file of information to the save location. /// </summary> public static void SaveXMLFile() { using (TextWriter tw = new StreamWriter("TodoListData.xml")) { XmlSerializer xs = new XmlSerializer(typeof(List<Note>)); xs.Serialize(tw, NoteSorter.Notes); } } } }
// XMLDataSaver.cs // <copyright file="XMLDataSaver.cs"> This code is protected under the MIT License. </copyright> using System.Collections.Generic; using System.IO; using System.Xml.Serialization; namespace Todo_List { /// <summary> /// A static class for reading and writing to XML files. /// </summary> public static class XMLDataSaver { /// <summary> /// Reads the xml file of information from the save location. /// </summary> public static void ReadXMLFile() { } /// <summary> /// Saves the xml file of information to the save location. /// </summary> public static void SaveXMLFile() { } } }
mit
C#
494fd31a9f4c391885c5ecc2530bca2ec7205a15
Fix a logic error causing an invalid validation
evicertia/HermaFx,evicertia/HermaFx,evicertia/HermaFx
HermaFx.DataAnnotations/ExtendedValidator.cs
HermaFx.DataAnnotations/ExtendedValidator.cs
using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace HermaFx.DataAnnotations { public static class ExtendedValidator { /// <summary> /// Determines whether the specified object is valid and return an list of ValidationResults. /// </summary> /// <param name="obj">The object.</param> /// <returns></returns> public static IEnumerable<ValidationResult> Validate(object obj) { var context = new ValidationContext(obj, serviceProvider: null, items: null); var results = new List<ValidationResult>(); Validator.TryValidateObject(obj, context, results, true); return AggregateValidationResult.Flatten(results); } /// <summary> /// Determines whether the specified object has exception. /// </summary> /// <param name="obj">The object.</param> /// <returns></returns> public static bool IsValid(object obj) { return !Validate(obj).Any(); } /// <summary> /// Ensures the object is valid. /// </summary> /// <param name="obj">The object.</param> /// <exception cref="AggregateValidationException">Validation failed</exception> public static void EnsureIsValid(object obj) { var results = Validate(obj); if (results.Any() && results.First() != ValidationResult.Success) { var type = (obj ?? new object()).GetType(); throw AggregateValidationException.CreateFor(type, results); } } } }
using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace HermaFx.DataAnnotations { public static class ExtendedValidator { /// <summary> /// Determines whether the specified object is valid and return an list of ValidationResults. /// </summary> /// <param name="obj">The object.</param> /// <returns></returns> public static IEnumerable<ValidationResult> Validate(object obj) { var context = new ValidationContext(obj, serviceProvider: null, items: null); var results = new List<ValidationResult>(); Validator.TryValidateObject(obj, context, results, true); return AggregateValidationResult.Flatten(results); } /// <summary> /// Determines whether the specified object has exception. /// </summary> /// <param name="obj">The object.</param> /// <returns></returns> public static bool IsValid(object obj) { return !Validate(obj).Any(); } /// <summary> /// Ensures the object is valid. /// </summary> /// <param name="obj">The object.</param> /// <exception cref="AggregateValidationException">Validation failed</exception> public static void EnsureIsValid(object obj) { var results = Validate(obj); if (results.Any() || results.First() != ValidationResult.Success) { var type = (obj ?? new object()).GetType(); throw AggregateValidationException.CreateFor(type, results); } } } }
mit
C#