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
2d0b38c32d292b139c2bf71101c650320cfdb8d7
Reformat Bootstrapper to remove tabs
lmno/cupster,lmno/cupster,lmno/cupster
webstats/Modules/Bootstrapper.cs
webstats/Modules/Bootstrapper.cs
/* * Created by SharpDevelop. * User: Lars Magnus * Date: 14.06.2014 * Time: 23:23 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.Configuration; using System.IO; using Nancy; using Nancy.TinyIoc; using SubmittedData; namespace Modules { /// <summary> /// Description of Bootstrapper. /// </summary> public class Bootstrapper : DefaultNancyBootstrapper { protected override void ConfigureApplicationContainer(TinyIoCContainer container) { string dataPath = ConfigurationManager.AppSettings["DataPath"].ToString(); string tournamentFile = ConfigurationManager.AppSettings["TournamentFile"].ToString(); string resultsFile = ConfigurationManager.AppSettings["ResultsFile"].ToString(); // Register our app dependency as a normal singletons var tournament = new Tournament(); tournament.Load(Path.Combine(dataPath, tournamentFile)); container.Register<ITournament, Tournament>(tournament); var bets = new SubmittedBets(); bets.TournamentFile = tournamentFile; bets.ActualResultsFile = resultsFile; bets.LoadAll(dataPath); container.Register<ISubmittedBets, SubmittedBets>(bets); var results = new Results(); results.Load(Path.Combine(dataPath, resultsFile)); container.Register<IResults, Results>(results); } } }
/* * Created by SharpDevelop. * User: Lars Magnus * Date: 14.06.2014 * Time: 23:23 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.Configuration; using System.IO; using Nancy; using Nancy.TinyIoc; using SubmittedData; namespace Modules { /// <summary> /// Description of Bootstrapper. /// </summary> public class Bootstrapper : DefaultNancyBootstrapper { protected override void ConfigureApplicationContainer(TinyIoCContainer container) { string dataPath = ConfigurationManager.AppSettings["DataPath"].ToString(); string tournamentFile = ConfigurationManager.AppSettings["TournamentFile"].ToString(); string resultsFile = ConfigurationManager.AppSettings["ResultsFile"].ToString(); // Register our app dependency as a normal singletons var tournament = new Tournament(); tournament.Load(Path.Combine(dataPath, tournamentFile)); container.Register<ITournament, Tournament>(tournament); var bets = new SubmittedBets(); bets.TournamentFile = tournamentFile; bets.ActualResultsFile = resultsFile; bets.LoadAll(dataPath); container.Register<ISubmittedBets, SubmittedBets>(bets); var results = new Results(); results.Load(Path.Combine(dataPath, resultsFile)); container.Register<IResults, Results>(results); } } }
mit
C#
f2e0e21971c5f952e2843d3c3207b42fccbd8d04
Check if lists exist before loading properties
OfficeDev/PnP-PowerShell,kilasuit/PnP-PowerShell
Commands/Lists/GetList.cs
Commands/Lists/GetList.cs
using System.Management.Automation; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System.Linq.Expressions; using System; using System.Linq; using System.Collections.Generic; using SharePointPnP.PowerShell.Commands.Base; namespace SharePointPnP.PowerShell.Commands.Lists { [Cmdlet(VerbsCommon.Get, "PnPList")] [CmdletAlias("Get-SPOList")] [CmdletHelp("Returns a List object", Category = CmdletHelpCategory.Lists, OutputType = typeof(List), OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.list.aspx")] [CmdletExample( Code = "PS:> Get-PnPList", Remarks = "Returns all lists in the current web", SortOrder = 1)] [CmdletExample( Code = "PS:> Get-PnPList -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe", Remarks = "Returns a list with the given id.", SortOrder = 2)] [CmdletExample( Code = "PS:> Get-PnPList -Identity Lists/Announcements", Remarks = "Returns a list with the given url.", SortOrder = 3)] public class GetList : PnPWebRetrievalsCmdlet<List> { [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID, name or Url (Lists/MyList) of the list.")] public ListPipeBind Identity; protected override void ExecuteCmdlet() { DefaultRetrievalExpressions = new Expression<Func<List, object>>[] { l => l.Id, l => l.BaseTemplate, l => l.OnQuickLaunch, l => l.DefaultViewUrl, l => l.Title, l => l.Hidden, l => l.RootFolder.ServerRelativeUrl }; var expressions = RetrievalExpressions.ToList(); if (Identity != null) { var list = Identity.GetList(SelectedWeb); list?.EnsureProperties(expressions.ToArray()); WriteObject(list); } else { var query = (SelectedWeb.Lists.IncludeWithDefaultProperties(expressions.ToArray())); var lists = ClientContext.LoadQuery(query); ClientContext.ExecuteQueryRetry(); WriteObject(lists, true); } } } }
using System.Management.Automation; using Microsoft.SharePoint.Client; using SharePointPnP.PowerShell.CmdletHelpAttributes; using SharePointPnP.PowerShell.Commands.Base.PipeBinds; using System.Linq.Expressions; using System; using System.Linq; using System.Collections.Generic; using SharePointPnP.PowerShell.Commands.Base; namespace SharePointPnP.PowerShell.Commands.Lists { [Cmdlet(VerbsCommon.Get, "PnPList")] [CmdletAlias("Get-SPOList")] [CmdletHelp("Returns a List object", Category = CmdletHelpCategory.Lists, OutputType = typeof(List), OutputTypeLink = "https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.list.aspx")] [CmdletExample( Code = "PS:> Get-PnPList", Remarks = "Returns all lists in the current web", SortOrder = 1)] [CmdletExample( Code = "PS:> Get-PnPList -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe", Remarks = "Returns a list with the given id.", SortOrder = 2)] [CmdletExample( Code = "PS:> Get-PnPList -Identity Lists/Announcements", Remarks = "Returns a list with the given url.", SortOrder = 3)] public class GetList : PnPWebRetrievalsCmdlet<List> { [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID, name or Url (Lists/MyList) of the list.")] public ListPipeBind Identity; protected override void ExecuteCmdlet() { DefaultRetrievalExpressions = new Expression<Func<List, object>>[] { l => l.Id, l => l.BaseTemplate, l => l.OnQuickLaunch, l => l.DefaultViewUrl, l => l.Title, l => l.Hidden, l => l.RootFolder.ServerRelativeUrl }; var expressions = RetrievalExpressions.ToList(); if (Identity != null) { var list = Identity.GetList(SelectedWeb); list.EnsureProperties(expressions.ToArray()); WriteObject(list); } else { var query = (SelectedWeb.Lists.IncludeWithDefaultProperties(expressions.ToArray())); var lists = ClientContext.LoadQuery(query); ClientContext.ExecuteQueryRetry(); WriteObject(lists, true); } } } }
mit
C#
29c039e7db5f11736af7afc8840cdf5d299ef4d8
Remove bin obj
fredatgithub/WebScreenshot
ConsoleAppDemo/Program.cs
ConsoleAppDemo/Program.cs
using System; using System.Drawing.Imaging; using Alx.Web; namespace ConsoleAppDemo { class Program { static void Main() { Console.WriteLine("Application started"); string url = "http://www.bbc.co.uk/news"; var device = Devices.Desktop; var path = string.Format(@"C:\Temp\website-{0}.png", device); //Screenshot.Save(url, path, ImageFormat.Png, device); Console.WriteLine("Saved " + path); url = "http://www.codeproject.com/Articles/1030283/Neat-Tricks-for-Effortlessly-Formatting-Currency-i"; path = string.Format(@"C:\Temp\codeProjectArticle1-{0}.png", device); Screenshot.Save(url, path, ImageFormat.Png, device); Console.WriteLine("Saved " + path); device = Devices.TabletLandscape; path = string.Format(@"C:\Temp\website-{0}.png", device); Screenshot.Save(url, path, ImageFormat.Png, device); Console.WriteLine("Saved " + path); device = Devices.PhonePortrait; path = string.Format(@"C:\Temp\website-{0}.png", device); Screenshot.Save(url, path, ImageFormat.Png, device); Console.WriteLine("Saved " + path); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } } }
using System; using System.Drawing.Imaging; using Alx.Web; namespace ConsoleAppDemo { class Program { static void Main() { Console.WriteLine("Application started"); string url = "http://www.bbc.co.uk/news"; var device = Devices.Desktop; var path = string.Format(@"C:\Temp\website-{0}.png", device); //Screenshot.Save(url, path, ImageFormat.Png, device); Console.WriteLine("Saved " + path); url = "http://www.codeproject.com/Articles/1030283/Neat-Tricks-for-Effortlessly-Formatting-Currency-i"; path = string.Format(@"C:\Temp\codeProjectArticle1-{0}.png", device); Screenshot.Save(url, path, ImageFormat.Png, device); Console.WriteLine("Saved " + path); device = Devices.TabletLandscape; path = string.Format(@"C:\Temp\website-{0}.png", device); Screenshot.Save(url, path, ImageFormat.Png, device); Console.WriteLine("Saved " + path); device = Devices.PhonePortrait; path = string.Format(@"C:\Temp\website-{0}.png", device); Screenshot.Save(url, path, ImageFormat.Png, device); Console.WriteLine("Saved " + path); Console.WriteLine("Press [Enter] to exit..."); Console.ReadLine(); } } }
mit
C#
f70a2bcd908d460be3bb2a099569d68b872b0270
set version to 1.0.0.11
deniszykov/commandline
ConsoleApp.CommandLine/Properties/AssemblyInfo.cs
ConsoleApp.CommandLine/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("Command-line Utilities")] [assembly: AssemblyDescription("Tools for building console application.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Denis Zykov")] [assembly: AssemblyProduct("ConsoleApp.CommandLine")] [assembly: AssemblyCopyright("Copyright © Denis Zykov 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("0cdae464-077f-4efc-81b0-6d19006e4043")] // 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.11")] [assembly: AssemblyFileVersion("1.0.0.11")]
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("Command-line Utilities")] [assembly: AssemblyDescription("Tools for building console application.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Denis Zykov")] [assembly: AssemblyProduct("ConsoleApp.CommandLine")] [assembly: AssemblyCopyright("Copyright © Denis Zykov 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("0cdae464-077f-4efc-81b0-6d19006e4043")] // 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.10")] [assembly: AssemblyFileVersion("1.0.0.10")]
mit
C#
a6c90a774a372bd27b25df0777570324ee5f3450
Add host.name constant
criteo/zipkin4net,criteo/zipkin4net
Criteo.Profiling.Tracing/Annotation/CommonTags.cs
Criteo.Profiling.Tracing/Annotation/CommonTags.cs
using Criteo.Profiling.Tracing.Tracers.Zipkin.Thrift; namespace Criteo.Profiling.Tracing.Annotation { public static class CommonTags { public static readonly string HttpStatusCode = zipkinCoreConstants.HTTP_STATUS_CODE; public static readonly string HttpMethod = zipkinCoreConstants.HTTP_METHOD; public const string HostName = "host.name"; } }
using Criteo.Profiling.Tracing.Tracers.Zipkin.Thrift; namespace Criteo.Profiling.Tracing.Annotation { public static class CommonTags { public static readonly string HttpStatusCode = zipkinCoreConstants.HTTP_STATUS_CODE; public static readonly string HttpMethod = zipkinCoreConstants.HTTP_METHOD; } }
apache-2.0
C#
c97927e13030e9ccc6d0bb1f0c2e481c8df1c6e5
Update AssemblyInfo.cs
ogaudefroy/Microsoft.AnalysisServices.AdomdClient.Abstractions
Microsoft.AnalysisServices.AdomdClient.Abstractions/Properties/AssemblyInfo.cs
Microsoft.AnalysisServices.AdomdClient.Abstractions/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft.AnalysisServices.AdomdClient.Abstractions")] [assembly: AssemblyDescription("Set of abstraction classes for AdomdClient")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Olivier GAUDEFROY, Arnaud DUFRANNE")] [assembly: AssemblyProduct("Microsoft.AnalysisServices.AdomdClient.Abstractions")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: Guid("de4917a5-a3f4-4514-bacf-f5ddc96a1918")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft.AnalysisServices.AdomdClient.Abstractions")] [assembly: AssemblyDescription("Set of abstraction classes for AdomdClient")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Olivier GAUDEFROY, Arnaud DUFRANNE")] [assembly: AssemblyProduct("Microsoft.AnalysisServices.AdomdClient.Abstractions")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: Guid("de4917a5-a3f4-4514-bacf-f5ddc96a1918")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
0cb9f26939b799e2ac38002061601415199d894b
Make Notice Bold
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Views/Home/Index.cshtml
Anlab.Mvc/Views/Home/Index.cshtml
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <h2 style="color: blue">PLEASE NOTE: The Analytical Lab will be closed on July 4th and 5th.</h2> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <p class="lead">PLEASE NOTE: The Analytical Lab will be closed on July 4th and 5th.</p> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
mit
C#
b22afc7aa8a6cf996e64709af99dc31f709d54d4
Bump version to 3.1.0
Coding-Enthusiast/Watch-Only-Bitcoin-Wallet
WatchOnlyBitcoinWallet/Properties/AssemblyInfo.cs
WatchOnlyBitcoinWallet/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("WatchOnlyBitcoinWallet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Coding Enthusiast Coders")] [assembly: AssemblyProduct("WatchOnlyBitcoinWallet")] [assembly: AssemblyCopyright("Copyright © C.E. 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)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("3.1.0.*")] [assembly: AssemblyFileVersion("3.1.0.0")]
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("WatchOnlyBitcoinWallet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Coding Enthusiast Coders")] [assembly: AssemblyProduct("WatchOnlyBitcoinWallet")] [assembly: AssemblyCopyright("Copyright © C.E. 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)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("3.0.0.*")] [assembly: AssemblyFileVersion("3.0.0.0")]
mit
C#
1c0d76561dffcce5ec2b60ec4aaa753e097673a9
Remove duplicate addresses before converting to dictionary
et1975/Nowin,pysco68/Nowin,et1975/Nowin,modulexcite/Nowin,modulexcite/Nowin,Bobris/Nowin,lstefano71/Nowin,Bobris/Nowin,pysco68/Nowin,pysco68/Nowin,lstefano71/Nowin,et1975/Nowin,lstefano71/Nowin,modulexcite/Nowin,Bobris/Nowin
Nowin/IpIsLocalChecker.cs
Nowin/IpIsLocalChecker.cs
using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Sockets; namespace Nowin { public class IpIsLocalChecker : IIpIsLocalChecker { readonly Dictionary<IPAddress, bool> _dict; public IpIsLocalChecker() { var host = Dns.GetHostEntry(Dns.GetHostName()); _dict = host.AddressList.Where( a => a.AddressFamily == AddressFamily.InterNetwork || a.AddressFamily == AddressFamily.InterNetworkV6) .Distinct() .ToDictionary(p => p, p => true); _dict[IPAddress.Loopback] = true; _dict[IPAddress.IPv6Loopback] = true; } public bool IsLocal(IPAddress address) { return _dict.ContainsKey(address); } } }
using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Sockets; namespace Nowin { public class IpIsLocalChecker : IIpIsLocalChecker { readonly Dictionary<IPAddress, bool> _dict; public IpIsLocalChecker() { var host = Dns.GetHostEntry(Dns.GetHostName()); _dict = host.AddressList.Where( a => a.AddressFamily == AddressFamily.InterNetwork || a.AddressFamily == AddressFamily.InterNetworkV6). ToDictionary(p => p, p => true); _dict[IPAddress.Loopback] = true; _dict[IPAddress.IPv6Loopback] = true; } public bool IsLocal(IPAddress address) { return _dict.ContainsKey(address); } } }
mit
C#
9c30c797a53843b43664903de2d2141d080cc845
Remove RemoveExcessiveDelimiters
PawelStroinski/LambdastylePrototype,PawelStroinski/LambdastylePrototype,PawelStroinski/LambdastylePrototype,PawelStroinski/LambdastylePrototype
Interpreter/Predicates/OuterId.cs
Interpreter/Predicates/OuterId.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace LambdastylePrototype.Interpreter.Predicates { class OuterId : PredicateElement { public override bool AppliesAt(PredicateContext context) { var position = context.Position; var tokenType = position.Last().TokenType; if (tokenType == JsonToken.EndObject) return false; if (position.HasPenultimate()) { tokenType = position.Penultimate().TokenType; return tokenType == JsonToken.PropertyName; } return false; } public override ToStringResult ToString(PredicateContext context) { var propertyName = context.Position.Penultimate(); var delimitersBefore = context.DelimitersBefore ? propertyName.DelimitersBefore : string.Empty; if (context.GlobalState.ForceSyntax.Value && !context.GlobalState.WrittenOuter) delimitersBefore = string.Empty; if (!context.GlobalState.WrittenInThisObject && delimitersBefore.Contains(",")) delimitersBefore = delimitersBefore.Replace(",", string.Empty); if (context.GlobalState.WrittenInThisObject && context.DelimitersBefore) delimitersBefore = delimitersBefore.EnforceComma(); context.GlobalState.WrittenOuter = true; context.GlobalState.WrittenInThisObject = true; return Result(string.Format("{0}\"{1}\"{2}", delimitersBefore, propertyName.Value, propertyName.DelimitersAfter), hasDelimitersBefore: delimitersBefore != string.Empty); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace LambdastylePrototype.Interpreter.Predicates { class OuterId : PredicateElement { public override bool AppliesAt(PredicateContext context) { var position = context.Position; var tokenType = position.Last().TokenType; if (tokenType == JsonToken.EndObject) return false; if (position.HasPenultimate()) { tokenType = position.Penultimate().TokenType; return tokenType == JsonToken.PropertyName; } return false; } public override ToStringResult ToString(PredicateContext context) { var propertyName = context.Position.Penultimate(); var delimitersBefore = context.DelimitersBefore ? propertyName.DelimitersBefore : string.Empty; if (context.GlobalState.ForceSyntax.Value && !context.GlobalState.WrittenOuter) delimitersBefore = string.Empty; if (!context.GlobalState.WrittenInThisObject && delimitersBefore.Contains(",")) delimitersBefore = RemoveExcessiveDelimiters(delimitersBefore); if (context.GlobalState.WrittenInThisObject && context.DelimitersBefore) delimitersBefore = delimitersBefore.EnforceComma(); context.GlobalState.WrittenOuter = true; context.GlobalState.WrittenInThisObject = true; return Result(string.Format("{0}\"{1}\"{2}", delimitersBefore, propertyName.Value, propertyName.DelimitersAfter), hasDelimitersBefore: delimitersBefore != string.Empty); } string RemoveExcessiveDelimiters(string delimiters) { delimiters = delimiters.Replace(",", string.Empty); var lastLineBreak = Math.Max(delimiters.LastIndexOf('\r'), delimiters.LastIndexOf('\n')); if (lastLineBreak == -1) return delimiters; delimiters = delimiters.Substring(lastLineBreak + 1); return delimiters.Length > 1 ? delimiters.Substring(1) : delimiters; } } }
mit
C#
508c53aad97c08ac51dde776e8e63f2bb0040f4e
Update AssemblyInfo.cs
Oceanswave/NiL.JS,nilproject/NiL.JS,Oceanswave/NiL.JS,Oceanswave/NiL.JS,nilproject/NiL.JS,nilproject/NiL.JS
NiL.JS/Properties/AssemblyInfo.cs
NiL.JS/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Resources; using System.Runtime.InteropServices; #if DEV [assembly: AssemblyTitleAttribute("NiL.JS for Developers")] [assembly: AssemblyProductAttribute("NiL.JS Dev")] #else [assembly: AssemblyTitleAttribute("NiL.JS")] [assembly: AssemblyProductAttribute("NiL.JS")] #endif [assembly: AssemblyDescriptionAttribute("JavaScript engine for .NET")] [assembly: AssemblyCompanyAttribute("NiLProject")] [assembly: AssemblyCopyrightAttribute("Copyright © NiLProject 2015")] [assembly: AssemblyTrademarkAttribute("NiL.JS")] [assembly: AssemblyVersionAttribute("1.4.720")] [assembly: AssemblyFileVersionAttribute("1.4.720")] [assembly: NeutralResourcesLanguageAttribute("en-US")] [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliant(true)] #if !PORTABLE [assembly: GuidAttribute("a70afe5a-2b29-49fd-afbf-28794042ea21")] #endif
using System; using System.Reflection; using System.Resources; using System.Runtime.InteropServices; #if DEV [assembly: AssemblyTitleAttribute("NiL.JS for Developers")] [assembly: AssemblyProductAttribute("NiL.JS Dev")] #else [assembly: AssemblyTitleAttribute("NiL.JS")] [assembly: AssemblyProductAttribute("NiL.JS")] #endif [assembly: AssemblyDescriptionAttribute("JavaScript engine for .NET")] [assembly: AssemblyCompanyAttribute("NiLProject")] [assembly: AssemblyCopyrightAttribute("Copyright © NiLProject 2015")] [assembly: AssemblyTrademarkAttribute("NiL.JS")] [assembly: AssemblyVersionAttribute("1.4.714")] [assembly: AssemblyFileVersionAttribute("1.4.714")] [assembly: NeutralResourcesLanguageAttribute("en-US")] [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliant(true)] #if !PORTABLE [assembly: GuidAttribute("a70afe5a-2b29-49fd-afbf-28794042ea21")] #endif
bsd-3-clause
C#
10886030b0e90574272a157b3375961a87a029c5
test exception
mauris/GitHub.NET-Updater
UnitTester/VersionTest.cs
UnitTester/VersionTest.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using UpdaterVersion = Github.Updater.Version; namespace UnitTester { [TestClass] public class VersionTest { [TestMethod] public void TestVersion1() { UpdaterVersion version = new UpdaterVersion("1.0.5-beta"); Assert.AreEqual(version.Major, 1); Assert.AreEqual(version.Minor, 0); Assert.AreEqual(version.Patch, 5); Assert.AreEqual(version.Tag, "beta"); } [TestMethod] public void TestVersion2() { UpdaterVersion version = new UpdaterVersion("5.2.14665-alpha2-abc123f0"); Assert.AreEqual(version.Major, 5); Assert.AreEqual(version.Minor, 2); Assert.AreEqual(version.Patch, 14665); Assert.AreEqual(version.Tag, "alpha2-abc123f0"); } [TestMethod] [ExpectedException(typeof(System.InvalidOperationException))] public void TestVersion3() { UpdaterVersion version = new UpdaterVersion("fail"); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using UpdaterVersion = Github.Updater.Version; namespace UnitTester { [TestClass] public class VersionTest { [TestMethod] public void TestVersion1() { UpdaterVersion version = new UpdaterVersion("1.0.5-beta"); Assert.AreEqual(version.Major, 1); Assert.AreEqual(version.Minor, 0); Assert.AreEqual(version.Patch, 5); Assert.AreEqual(version.Tag, "beta"); } [TestMethod] public void TestVersion2() { UpdaterVersion version = new UpdaterVersion("5.2.14665-alpha2-abc123f0"); Assert.AreEqual(version.Major, 5); Assert.AreEqual(version.Minor, 2); Assert.AreEqual(version.Patch, 14665); Assert.AreEqual(version.Tag, "alpha2-abc123f0"); } } }
bsd-3-clause
C#
ec03c4f928d5644fc242fc8bad04bc2c1b6aa657
Rollback transaction on exception.
SilkStack/Silk.Data.SQL.ORM
Silk.Data.SQL.ORM/Queries/TransactionQueryExecutor.cs
Silk.Data.SQL.ORM/Queries/TransactionQueryExecutor.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; using Silk.Data.SQL.Providers; namespace Silk.Data.SQL.ORM.Queries { public class TransactionQueryExecutor : IORMQueryExecutor { public List<object> ExecuteQueries(IEnumerable<ORMQuery> queries, IDataProvider dataProvider) { using (var transaction = dataProvider.CreateTransaction()) { List<object> ret = null; foreach (var query in queries) { if (query.MapToType == null) { transaction.ExecuteNonQuery(query.Query); } else { using (var queryResult = transaction.ExecuteReader(query.Query)) { var mapResult = query.MapResult(queryResult); if (query.IsQueryResult) { if (ret == null) ret = new List<object>(); ret.Add(mapResult); } } } } transaction.Commit(); return ret; } } public async Task<List<object>> ExecuteQueriesAsync(IEnumerable<ORMQuery> queries, IDataProvider dataProvider) { using (var transaction = await dataProvider.CreateTransactionAsync() .ConfigureAwait(false)) { List<object> ret = null; foreach (var query in queries) { try { if (query.MapToType == null) { await transaction.ExecuteNonQueryAsync(query.Query) .ConfigureAwait(false); } else { using (var queryResult = await transaction.ExecuteReaderAsync(query.Query) .ConfigureAwait(false)) { var mapResult = await query.MapResultAsync(queryResult) .ConfigureAwait(false); if (query.IsQueryResult) { if (ret == null) ret = new List<object>(); ret.Add(mapResult); } } } } catch (Exception) { transaction.Rollback(); throw; } } transaction.Commit(); return ret; } } } }
using System.Collections.Generic; using System.Threading.Tasks; using Silk.Data.SQL.Providers; namespace Silk.Data.SQL.ORM.Queries { public class TransactionQueryExecutor : IORMQueryExecutor { public List<object> ExecuteQueries(IEnumerable<ORMQuery> queries, IDataProvider dataProvider) { using (var transaction = dataProvider.CreateTransaction()) { List<object> ret = null; foreach (var query in queries) { if (query.MapToType == null) { transaction.ExecuteNonQuery(query.Query); } else { using (var queryResult = transaction.ExecuteReader(query.Query)) { var mapResult = query.MapResult(queryResult); if (query.IsQueryResult) { if (ret == null) ret = new List<object>(); ret.Add(mapResult); } } } } transaction.Commit(); return ret; } } public async Task<List<object>> ExecuteQueriesAsync(IEnumerable<ORMQuery> queries, IDataProvider dataProvider) { using (var transaction = await dataProvider.CreateTransactionAsync() .ConfigureAwait(false)) { List<object> ret = null; foreach (var query in queries) { if (query.MapToType == null) { await transaction.ExecuteNonQueryAsync(query.Query) .ConfigureAwait(false); } else { using (var queryResult = await transaction.ExecuteReaderAsync(query.Query) .ConfigureAwait(false)) { var mapResult = await query.MapResultAsync(queryResult) .ConfigureAwait(false); if (query.IsQueryResult) { if (ret == null) ret = new List<object>(); ret.Add(mapResult); } } } } transaction.Commit(); return ret; } } } }
mit
C#
1d310ad42a676b2cb6383684a9a303bfa7c84cda
Change default attributeStyle to lower for search
agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov
WebAPI.API/ModelBindings/SearchOptionsModelBinding.cs
WebAPI.API/ModelBindings/SearchOptionsModelBinding.cs
using System; using System.Net.Http; using System.Web.Http.Controllers; using System.Web.Http.ModelBinding; using WebAPI.Domain.InputOptions; namespace WebAPI.API.ModelBindings { public class SearchOptionsModelBinding : IModelBinder { public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) { var keyValueModel = actionContext.Request.RequestUri.ParseQueryString(); string pointJson = keyValueModel["geometry"], spatialReference = keyValueModel["spatialReference"], predicate = keyValueModel["predicate"], attribute = keyValueModel["attributeStyle"], bufferAmount = keyValueModel["buffer"]; int wkid; var attributeType = AttributeStyle.Camel; int.TryParse(string.IsNullOrEmpty(spatialReference) ? "26912" : spatialReference, out wkid); try { attributeType = (AttributeStyle) Enum.Parse(typeof(AttributeStyle), string.IsNullOrEmpty(attribute) ? "Lower" : attribute, true); } catch (Exception) { /*ie sometimes sends display value in text box.*/ } double buffer; double.TryParse(string.IsNullOrEmpty(bufferAmount) ? "0" : bufferAmount, out buffer); bindingContext.Model = new SearchOptions { Geometry = pointJson, Predicate = predicate, WkId = wkid, Buffer = buffer, AttributeStyle = attributeType }; return true; } } }
using System; using System.Net.Http; using System.Web.Http.Controllers; using System.Web.Http.ModelBinding; using WebAPI.Domain.InputOptions; namespace WebAPI.API.ModelBindings { public class SearchOptionsModelBinding : IModelBinder { public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) { var keyValueModel = actionContext.Request.RequestUri.ParseQueryString(); string pointJson = keyValueModel["geometry"], spatialReference = keyValueModel["spatialReference"], predicate = keyValueModel["predicate"], attribute = keyValueModel["attributeStyle"], bufferAmount = keyValueModel["buffer"]; int wkid; var attributeType = AttributeStyle.Camel; int.TryParse(string.IsNullOrEmpty(spatialReference) ? "26912" : spatialReference, out wkid); try { attributeType = (AttributeStyle) Enum.Parse(typeof(AttributeStyle), string.IsNullOrEmpty(attribute) ? "Camel" : attribute, true); } catch (Exception) { /*ie sometimes sends display value in text box.*/ } double buffer; double.TryParse(string.IsNullOrEmpty(bufferAmount) ? "0" : bufferAmount, out buffer); bindingContext.Model = new SearchOptions { Geometry = pointJson, Predicate = predicate, WkId = wkid, Buffer = buffer, AttributeStyle = attributeType }; return true; } } }
mit
C#
dcd385e0450d17b02a6d0970ba1c914559027546
Mark Convention.Lifecycle(...) overloads as [Obsolete]. Usages should be limited as a step towards merging Lifecycle into Convention.
fixie/fixie
src/Fixie/Convention.cs
src/Fixie/Convention.cs
namespace Fixie { using System; using Conventions; /// <summary> /// Base class for all Fixie conventions. Subclass Convention to customize test discovery and execution. /// </summary> public class Convention { public Convention() { Config = new Configuration(); Classes = new ClassExpression(Config); Methods = new MethodExpression(Config); Parameters = new ParameterSourceExpression(Config); } /// <summary> /// The current state describing the convention. This state can be manipulated through /// the other properties on Convention. /// </summary> internal Configuration Config { get; } /// <summary> /// Defines the set of conditions that describe which classes are test classes. /// </summary> public ClassExpression Classes { get; } /// <summary> /// Defines the set of conditions that describe which test class methods are test methods, /// and what order to run them in. /// </summary> public MethodExpression Methods { get; } /// <summary> /// Defines the set of parameter sources, which provide inputs to parameterized test methods. /// </summary> public ParameterSourceExpression Parameters { get; } /// <summary> /// Overrides the default test class lifecycle. /// </summary> [Obsolete] public void Lifecycle<TLifecycle>() where TLifecycle : Lifecycle, new() => Config.Lifecycle = new TLifecycle(); /// <summary> /// Overrides the default test class lifecycle. /// </summary> [Obsolete] public void Lifecycle(Lifecycle lifecycle) => Config.Lifecycle = lifecycle; } }
namespace Fixie { using System; using Conventions; /// <summary> /// Base class for all Fixie conventions. Subclass Convention to customize test discovery and execution. /// </summary> public class Convention { public Convention() { Config = new Configuration(); Classes = new ClassExpression(Config); Methods = new MethodExpression(Config); Parameters = new ParameterSourceExpression(Config); } /// <summary> /// The current state describing the convention. This state can be manipulated through /// the other properties on Convention. /// </summary> internal Configuration Config { get; } /// <summary> /// Defines the set of conditions that describe which classes are test classes. /// </summary> public ClassExpression Classes { get; } /// <summary> /// Defines the set of conditions that describe which test class methods are test methods, /// and what order to run them in. /// </summary> public MethodExpression Methods { get; } /// <summary> /// Defines the set of parameter sources, which provide inputs to parameterized test methods. /// </summary> public ParameterSourceExpression Parameters { get; } /// <summary> /// Overrides the default test class lifecycle. /// </summary> public void Lifecycle<TLifecycle>() where TLifecycle : Lifecycle, new() => Config.Lifecycle = new TLifecycle(); /// <summary> /// Overrides the default test class lifecycle. /// </summary> public void Lifecycle(Lifecycle lifecycle) => Config.Lifecycle = lifecycle; } }
mit
C#
1f18248be5995770ec2fe2cc62188cfaa6231f74
update dependency nuget.commandline to v6.2.1
FantasticFiasco/mvvm-dialogs
build/build.cake
build/build.cake
#tool nuget:?package=NuGet.CommandLine&version=6.2.1 #load utils.cake ////////////////////////////////////////////////////////////////////// // ARGUMENTS ////////////////////////////////////////////////////////////////////// var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); ////////////////////////////////////////////////////////////////////// // VARIABLES ////////////////////////////////////////////////////////////////////// var solution = new FilePath("./../MvvmDialogs.sln"); ////////////////////////////////////////////////////////////////////// // TASKS ////////////////////////////////////////////////////////////////////// Task("Clean") .Description("Clean all files") .Does(() => { DeleteFiles("./../**/*.nupkg"); CleanDirectories("./../**/bin"); CleanDirectories("./../**/obj"); }); Task("Restore") .Description("Restore NuGet packages") .IsDependentOn("Clean") .Does(() => { NuGetRestore(solution); }); Task("Build") .Description("Build the solution") .IsDependentOn("Restore") .Does(() => { MSBuild( solution, new MSBuildSettings { ToolVersion = MSBuildToolVersion.VS2022, Configuration = configuration, MaxCpuCount = 0, // Enable parallel build }); }); Task("Pack") .Description("Create NuGet package") .IsDependentOn("Build") .Does(() => { var versionPrefix = GetVersionPrefix("./../Directory.Build.props"); var versionSuffix = GetVersionSuffix("./../Directory.Build.props"); var isTag = EnvironmentVariable("APPVEYOR_REPO_TAG"); // Unless this is a tag, this is a pre-release if (isTag != "true") { var sha = EnvironmentVariable("APPVEYOR_REPO_COMMIT"); versionSuffix = $"sha-{sha}"; } NuGetPack( "./../MvvmDialogs.nuspec", new NuGetPackSettings { Version = versionPrefix, Suffix = versionSuffix, Symbols = true, ArgumentCustomization = args => args.Append("-SymbolPackageFormat snupkg") }); }); ////////////////////////////////////////////////////////////////////// // TASK TARGETS ////////////////////////////////////////////////////////////////////// Task("Default") .IsDependentOn("Pack"); ////////////////////////////////////////////////////////////////////// // EXECUTION ////////////////////////////////////////////////////////////////////// RunTarget(target);
#tool nuget:?package=NuGet.CommandLine&version=6.2.0 #load utils.cake ////////////////////////////////////////////////////////////////////// // ARGUMENTS ////////////////////////////////////////////////////////////////////// var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); ////////////////////////////////////////////////////////////////////// // VARIABLES ////////////////////////////////////////////////////////////////////// var solution = new FilePath("./../MvvmDialogs.sln"); ////////////////////////////////////////////////////////////////////// // TASKS ////////////////////////////////////////////////////////////////////// Task("Clean") .Description("Clean all files") .Does(() => { DeleteFiles("./../**/*.nupkg"); CleanDirectories("./../**/bin"); CleanDirectories("./../**/obj"); }); Task("Restore") .Description("Restore NuGet packages") .IsDependentOn("Clean") .Does(() => { NuGetRestore(solution); }); Task("Build") .Description("Build the solution") .IsDependentOn("Restore") .Does(() => { MSBuild( solution, new MSBuildSettings { ToolVersion = MSBuildToolVersion.VS2022, Configuration = configuration, MaxCpuCount = 0, // Enable parallel build }); }); Task("Pack") .Description("Create NuGet package") .IsDependentOn("Build") .Does(() => { var versionPrefix = GetVersionPrefix("./../Directory.Build.props"); var versionSuffix = GetVersionSuffix("./../Directory.Build.props"); var isTag = EnvironmentVariable("APPVEYOR_REPO_TAG"); // Unless this is a tag, this is a pre-release if (isTag != "true") { var sha = EnvironmentVariable("APPVEYOR_REPO_COMMIT"); versionSuffix = $"sha-{sha}"; } NuGetPack( "./../MvvmDialogs.nuspec", new NuGetPackSettings { Version = versionPrefix, Suffix = versionSuffix, Symbols = true, ArgumentCustomization = args => args.Append("-SymbolPackageFormat snupkg") }); }); ////////////////////////////////////////////////////////////////////// // TASK TARGETS ////////////////////////////////////////////////////////////////////// Task("Default") .IsDependentOn("Pack"); ////////////////////////////////////////////////////////////////////// // EXECUTION ////////////////////////////////////////////////////////////////////// RunTarget(target);
apache-2.0
C#
0dc212cd1ead3e4ae962fac5af30860884435dd7
Update sentry dsn
Piotrekol/StreamCompanion,Piotrekol/StreamCompanion
osu!StreamCompanion/Code/Core/Loggers/SentryLogger.cs
osu!StreamCompanion/Code/Core/Loggers/SentryLogger.cs
using System; using System.Collections.Generic; using osu_StreamCompanion.Code.Helpers; using Sentry; using StreamCompanionTypes.Enums; using StreamCompanionTypes.Interfaces.Services; namespace osu_StreamCompanion.Code.Core.Loggers { public class SentryLogger : IContextAwareLogger { public static string SentryDsn = "https://61b0ba522c24450a87fba347918f6364@glitchtip.pioo.space/1"; public static SentryClient SentryClient { get; } = new SentryClient(new SentryOptions { Dsn = SentryDsn, Release = Program.ScVersion, SendDefaultPii = true, BeforeSend = BeforeSend }); private static SentryEvent BeforeSend(SentryEvent arg) { arg.User.IpAddress = null; return arg; } public static Dictionary<string, string> ContextData { get; } = new Dictionary<string, string>(); private object _lockingObject = new object(); public void Log(object logMessage, LogLevel logLevel, params string[] vals) { if (logLevel == LogLevel.Critical && logMessage is Exception exception && !(exception is NonLoggableException)) { var sentryEvent = new SentryEvent(exception); lock (_lockingObject) { foreach (var contextKeyValue in ContextData) { sentryEvent.SetExtra(contextKeyValue.Key, contextKeyValue.Value); } SentryClient.CaptureEvent(sentryEvent); } } } public void SetContextData(string key, string value) { lock (_lockingObject) ContextData[key] = value; } } }
using System; using System.Collections.Generic; using osu_StreamCompanion.Code.Helpers; using Sentry; using StreamCompanionTypes.Enums; using StreamCompanionTypes.Interfaces.Services; namespace osu_StreamCompanion.Code.Core.Loggers { public class SentryLogger : IContextAwareLogger { public static string SentryDsn = "https://3187b2a91f23411ab7ec5f85ad7d80b8@sentry.pioo.space/2"; public static SentryClient SentryClient { get; } = new SentryClient(new SentryOptions { Dsn = SentryDsn, Release = Program.ScVersion, SendDefaultPii = true, BeforeSend = BeforeSend }); private static SentryEvent BeforeSend(SentryEvent arg) { arg.User.IpAddress = null; return arg; } public static Dictionary<string, string> ContextData { get; } = new Dictionary<string, string>(); private object _lockingObject = new object(); public void Log(object logMessage, LogLevel logLevel, params string[] vals) { if (logLevel == LogLevel.Critical && logMessage is Exception exception && !(exception is NonLoggableException)) { var sentryEvent = new SentryEvent(exception); lock (_lockingObject) { foreach (var contextKeyValue in ContextData) { sentryEvent.SetExtra(contextKeyValue.Key, contextKeyValue.Value); } SentryClient.CaptureEvent(sentryEvent); } } } public void SetContextData(string key, string value) { lock (_lockingObject) ContextData[key] = value; } } }
mit
C#
26ec3a76a72f58f1f682780fd18c565ad48b9d41
enable JSONP
melvinlee/nancy-api,melvinlee/nancy-api
src/nancy-api/Bootstrapper.cs
src/nancy-api/Bootstrapper.cs
using Nancy; using NancyApi.Repository; namespace NancyApi { public class Bootstrapper : DefaultNancyBootstrapper { // The bootstrapper enables you to reconfigure the composition of the framework, // by overriding the various methods and properties. // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { base.ApplicationStartup(container, pipelines); // JsonP support Jsonp.Enable(pipelines); // Register repository as singleton for persistant data source container.Register<TunnelRepository>().AsSingleton(); } protected override byte[] FavIcon { get { return null; } } } }
using Nancy; using NancyApi.Repository; namespace NancyApi { public class Bootstrapper : DefaultNancyBootstrapper { // The bootstrapper enables you to reconfigure the composition of the framework, // by overriding the various methods and properties. // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { base.ApplicationStartup(container, pipelines); // Register repository as singleton for persistant data source container.Register<TunnelRepository>().AsSingleton(); } protected override byte[] FavIcon { get { return null; } } } }
mit
C#
3769a70101793714455571d5991ea7b8917dfc4d
prepare for release
bjartebore/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,yamamoWorks/azure-activedirectory-library-for-dotnet
src/ADAL.Common/CommonAssemblyInfo.cs
src/ADAL.Common/CommonAssemblyInfo.cs
//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------ using System; using System.Reflection; [assembly: AssemblyProduct("Active Directory Authentication Library")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyMetadata("Serviceable", "True")] [assembly: AssemblyFileVersion("3.13.7.0")] // On official build, attribute AssemblyInformationalVersionAttribute is added as well // with its value equal to the hash of the last commit to the git branch. // e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")] [assembly: CLSCompliant(false)]
//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------ using System; using System.Reflection; [assembly: AssemblyProduct("Active Directory Authentication Library")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyMetadata("Serviceable", "True")] [assembly: AssemblyFileVersion("3.13.6.0")] // On official build, attribute AssemblyInformationalVersionAttribute is added as well // with its value equal to the hash of the last commit to the git branch. // e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")] [assembly: CLSCompliant(false)]
mit
C#
e48c8ad0c07f14bd96cb755be61a29c9e301f3b3
Fix incorrect file path in benchmarks
nickbabcock/Pfim,nickbabcock/Pfim
src/Pfim.Benchmarks/TargaBenchmark.cs
src/Pfim.Benchmarks/TargaBenchmark.cs
using System.IO; using BenchmarkDotNet.Attributes; using FreeImageAPI; using ImageMagick; using DS = DevILSharp; namespace Pfim.Benchmarks { public class TargaBenchmark { [Params("true-32-rle-large.tga", "true-24-large.tga", "true-24.tga", "true-32-rle.tga", "rgb24_top_left.tga")] public string Payload { get; set; } private byte[] data; [GlobalSetup] public void SetupData() { data = File.ReadAllBytes(Payload); DS.Bootstrap.Init(); } [Benchmark] public IImage Pfim() => Targa.Create(new MemoryStream(data)); [Benchmark] public FreeImageBitmap FreeImage() => FreeImageAPI.FreeImageBitmap.FromStream(new MemoryStream(data)); [Benchmark] public int ImageMagick() { var settings = new MagickReadSettings {Format = MagickFormat.Tga}; using (var image = new MagickImage(new MemoryStream(data), settings)) { return image.Width; } } [Benchmark] public int DevILSharp() { using (var image = DS.Image.Load(data, DS.ImageType.Tga)) { return image.Width; } } [Benchmark] public int TargaImage() { using (var image = new Paloma.TargaImage(new MemoryStream(data))) { return image.Stride; } } } }
using System.IO; using BenchmarkDotNet.Attributes; using FreeImageAPI; using ImageMagick; using DS = DevILSharp; namespace Pfim.Benchmarks { public class TargaBenchmark { [Params("true-32-rle-large.tga", "true-24-large.tga", "true-24.tga", "true-32-rle.tga", "rgb24_top_left")] public string Payload { get; set; } private byte[] data; [GlobalSetup] public void SetupData() { data = File.ReadAllBytes(Payload); DS.Bootstrap.Init(); } [Benchmark] public IImage Pfim() => Targa.Create(new MemoryStream(data)); [Benchmark] public FreeImageBitmap FreeImage() => FreeImageAPI.FreeImageBitmap.FromStream(new MemoryStream(data)); [Benchmark] public int ImageMagick() { var settings = new MagickReadSettings {Format = MagickFormat.Tga}; using (var image = new MagickImage(new MemoryStream(data), settings)) { return image.Width; } } [Benchmark] public int DevILSharp() { using (var image = DS.Image.Load(data, DS.ImageType.Tga)) { return image.Width; } } [Benchmark] public int TargaImage() { using (var image = new Paloma.TargaImage(new MemoryStream(data))) { return image.Stride; } } } }
mit
C#
0731762a7b2e7ec5b6bfabe5ba162aca873fcc4c
Update the generics test
jonathanvdc/ecsc
tests/cs/generics/Generics.cs
tests/cs/generics/Generics.cs
using System; public struct Vector2<T> { public Vector2(T X, T Y) { this.X = X; this.Y = Y; } public T X, Y; public override bool Equals(object obj) { return obj is Vector2<T> && object.Equals(X, ((Vector2<T>)obj).X) && object.Equals(Y, ((Vector2<T>)obj).Y); } } public static class Program { public static void Main() { var vec = default(Vector2<int>); vec.X = 3; vec.Y = 4; Console.WriteLine(vec.X); Console.WriteLine(vec.Y); vec = new Vector2<int>(4, 3); Console.WriteLine(vec.X); Console.WriteLine(vec.Y); } }
using System; public struct Vector2<T> { public Vector2(T X, T Y) { this.X = X; this.Y = Y; } public T X, Y; } public static class Program { public static void Main() { var vec = default(Vector2<int>); vec.X = 3; vec.Y = 4; Console.WriteLine(vec.X); Console.WriteLine(vec.Y); vec = new Vector2<int>(4, 3); Console.WriteLine(vec.X); Console.WriteLine(vec.Y); } }
mit
C#
4071dd3e9d2fa97c94ebbf56be9dd0618e0b6193
Use <Title in about page.
maraf/Money,maraf/Money,maraf/Money
src/Money.UI.Blazor/Pages/About.cshtml
src/Money.UI.Blazor/Pages/About.cshtml
@page "/about" @inject Navigator Navigator <Title Main="Money" Sub="Nepuo" /> <p class="gray"> v@(typeof(About).Assembly.GetName().Version.ToString(3)) </p> <p> <a target="_blank" href="@Navigator.UrlMoneyProject()">Documentation</a> </p> <p> <a target="_blank" href="@Navigator.UrlMoneyProjectIssueNew()">Report an issue</a> </p>
@page "/about" @inject Navigator Navigator <h1>Money</h1> <h4>Neptuo</h4> <p class="gray"> v@(typeof(About).Assembly.GetName().Version.ToString(3)) </p> <p> <a target="_blank" href="@Navigator.UrlMoneyProject()">Documentation</a> </p> <p> <a target="_blank" href="@Navigator.UrlMoneyProjectIssueNew()">Report an issue</a> </p>
apache-2.0
C#
5b8b4d49ab0da5a3fdb3959087af593d75d820aa
Rename method as it doesn't follow the try-pattern
SonarSource-VisualStudio/sonar-msbuild-runner,SonarSource-VisualStudio/sonar-scanner-msbuild,duncanpMS/sonar-msbuild-runner,duncanpMS/sonar-msbuild-runner,SonarSource/sonar-msbuild-runner,duncanpMS/sonar-msbuild-runner,SonarSource-DotNet/sonar-msbuild-runner,SonarSource-VisualStudio/sonar-scanner-msbuild,SonarSource-VisualStudio/sonar-scanner-msbuild,SonarSource-VisualStudio/sonar-msbuild-runner
src/SonarScanner.Shim/ProjectLoader.cs
src/SonarScanner.Shim/ProjectLoader.cs
/* * SonarQube Scanner for MSBuild * Copyright (C) 2016-2018 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ using System.Collections.Generic; using System.IO; using System.Linq; using SonarQube.Common; namespace SonarScanner.Shim { public static class ProjectLoader { public static IList<ProjectInfo> LoadFrom(string dumpFolderPath) { return Directory.GetDirectories(dumpFolderPath) .Select(GetProjectInfo) .Where(p => p != null) .ToList(); } private static ProjectInfo GetProjectInfo(string projectFolderPath) { var projectInfoPath = Path.Combine(projectFolderPath, FileConstants.ProjectInfoFileName); return File.Exists(projectInfoPath) ? ProjectInfo.Load(projectInfoPath) : null; } } }
/* * SonarQube Scanner for MSBuild * Copyright (C) 2016-2018 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ using System.Collections.Generic; using System.IO; using System.Linq; using SonarQube.Common; namespace SonarScanner.Shim { public static class ProjectLoader { public static IList<ProjectInfo> LoadFrom(string dumpFolderPath) { return Directory.GetDirectories(dumpFolderPath) .Select(TryGetProjectInfo) .Where(p => p != null) .ToList(); } private static ProjectInfo TryGetProjectInfo(string projectFolderPath) { var projectInfoPath = Path.Combine(projectFolderPath, FileConstants.ProjectInfoFileName); return File.Exists(projectInfoPath) ? ProjectInfo.Load(projectInfoPath) : null; } } }
mit
C#
8778973894df902be847de08292ec300538d276d
change assembly info
FreyYa/KCVAutoUpdater
AutoUpdater/Properties/AssemblyInfo.cs
AutoUpdater/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다. // 어셈블리와 관련된 정보를 수정하려면 // 이 특성 값을 변경하십시오. [assembly: AssemblyTitle("제독업무도 바빠! 자동 업데이트 프로그램")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("KCVkr.Tistory.com")] [assembly: AssemblyProduct("KCV Auto Updater")] [assembly: AssemblyCopyright("Copyright © 2015 FreyYa")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 // 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오. [assembly: ComVisible(false)] // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. // // 주 버전 // 부 버전 // 빌드 번호 // 수정 버전 // // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로 // 지정되도록 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.10.0")]
using System.Reflection; using System.Runtime.InteropServices; // 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다. // 어셈블리와 관련된 정보를 수정하려면 // 이 특성 값을 변경하십시오. [assembly: AssemblyTitle("제독업무도 바빠! 자동 업데이트 프로그램")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Kancolleviewerkr.tk")] [assembly: AssemblyProduct("KanColleViewer")] [assembly: AssemblyCopyright("Copyright © 2015 FreyYa")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 // 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오. [assembly: ComVisible(false)] // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. // // 주 버전 // 부 버전 // 빌드 번호 // 수정 버전 // // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로 // 지정되도록 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.10.0")]
mit
C#
94e03013aa8396dcb3642f85a969341272b0c75d
Remove unused event (CS0067 warning)
Intel-Media-SDK/MediaSDK,Intel-Media-SDK/MediaSDK,Intel-Media-SDK/MediaSDK,Intel-Media-SDK/MediaSDK,Intel-Media-SDK/MediaSDK
tools/tracer/gui/EtlToTextConverter.cs
tools/tracer/gui/EtlToTextConverter.cs
/* ****************************************************************************** *\ INTEL CORPORATION PROPRIETARY INFORMATION This software is supplied under the terms of a license agreement or nondisclosure agreement with Intel Corporation and may not be copied or disclosed except in accordance with the terms of that agreement Copyright(c) 2020 Intel Corporation. All Rights Reserved. File Name: \* ****************************************************************************** */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Runtime.InteropServices; namespace msdk_analyzer { enum ConversionStatus { CONVERSION_STARTED, CONVERSION_PROGRESS, CONVERSION_ABORTED, CONVERSION_COMPLETED } delegate void ConversionStatusUpdated(ConversionStatus sts, int percentage); class EtlToTextConverter { uint m_percentage; ConversionStatus m_status; string m_etlfilename; string m_textfilename; public EtlToTextConverter() { } /// <summary> /// Does Conversion from etl file to user readable text form /// </summary> /// <param name="etlfilename"></param> /// <param name="textfilename"></param> public void StartConvert(string etlfilename, string textfilename) { m_etlfilename = etlfilename; m_textfilename = textfilename; ThreadPool.QueueUserWorkItem(RunConversion); } private void RunConversion(object state) { m_status = ConversionStatus.CONVERSION_STARTED; m_percentage = 50; MsdkAnalyzerCpp.convert_etl_to_text(0, 0, m_etlfilename + " " + m_textfilename, 1); m_percentage = 100; m_status = ConversionStatus.CONVERSION_COMPLETED; } public void GetConversionStatus(ref ConversionStatus sts, ref uint percentage) { sts = m_status; percentage = m_percentage; } } }
/* ****************************************************************************** *\ INTEL CORPORATION PROPRIETARY INFORMATION This software is supplied under the terms of a license agreement or nondisclosure agreement with Intel Corporation and may not be copied or disclosed except in accordance with the terms of that agreement Copyright(c) 2020 Intel Corporation. All Rights Reserved. File Name: \* ****************************************************************************** */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Runtime.InteropServices; namespace msdk_analyzer { enum ConversionStatus { CONVERSION_STARTED, CONVERSION_PROGRESS, CONVERSION_ABORTED, CONVERSION_COMPLETED } delegate void ConversionStatusUpdated(ConversionStatus sts, int percentage); class EtlToTextConverter { uint m_percentage; public event ConversionStatusUpdated ConversionUpdated; ConversionStatus m_status; string m_etlfilename; string m_textfilename; public EtlToTextConverter() { } /// <summary> /// Does Conversion from etl file to user readable text form /// </summary> /// <param name="etlfilename"></param> /// <param name="textfilename"></param> public void StartConvert(string etlfilename, string textfilename) { m_etlfilename = etlfilename; m_textfilename = textfilename; ThreadPool.QueueUserWorkItem(RunConversion); } private void RunConversion(object state) { m_status = ConversionStatus.CONVERSION_STARTED; m_percentage = 50; MsdkAnalyzerCpp.convert_etl_to_text(0, 0, m_etlfilename + " " + m_textfilename, 1); m_percentage = 100; m_status = ConversionStatus.CONVERSION_COMPLETED; } public void GetConversionStatus(ref ConversionStatus sts, ref uint percentage) { sts = m_status; percentage = m_percentage; } } }
mit
C#
2221797273d704a2d562467790ba4b251397a1a6
Add transform sequence support to IHasAccentColour.
Damnae/osu,peppy/osu,2yangk23/osu,peppy/osu,smoogipoo/osu,Nabile-Rahmani/osu,UselessToucan/osu,ZLima12/osu,naoey/osu,ZLima12/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,peppy/osu,naoey/osu,DrabWeb/osu,smoogipoo/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu-new,2yangk23/osu,naoey/osu,ppy/osu,smoogipoo/osu,DrabWeb/osu,Drezi126/osu,Frontear/osuKyzer,NeoAdonis/osu,EVAST9919/osu,NeoAdonis/osu,johnneijzen/osu,EVAST9919/osu,DrabWeb/osu,ppy/osu,smoogipooo/osu
osu.Game/Graphics/IHasAccentColour.cs
osu.Game/Graphics/IHasAccentColour.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 OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; namespace osu.Game.Graphics { /// <summary> /// A type of drawable that has an accent colour. /// The accent colour is used to colorize various objects inside a drawable /// without colorizing the drawable itself. /// </summary> public interface IHasAccentColour : IDrawable { Color4 AccentColour { get; set; } } public static class AccentedColourExtensions { /// <summary> /// Tweens the accent colour of a drawable to another colour. /// </summary> /// <param name="accentedDrawable">The drawable to apply the accent colour to.</param> /// <param name="newColour">The new accent colour.</param> /// <param name="duration">The tween duration.</param> /// <param name="easing">The tween easing.</param> public static TransformSequence<T> FadeAccent<T>(this T accentedDrawable, Color4 newColour, double duration = 0, Easing easing = Easing.None) where T : IHasAccentColour => accentedDrawable.TransformTo(nameof(accentedDrawable.AccentColour), newColour, duration, easing); /// <summary> /// Tweens the accent colour of a drawable to another colour. /// </summary> /// <param name="accentedDrawable">The drawable to apply the accent colour to.</param> /// <param name="newColour">The new accent colour.</param> /// <param name="duration">The tween duration.</param> /// <param name="easing">The tween easing.</param> public static TransformSequence<T> FadeAccent<T>(this TransformSequence<T> t, Color4 newColour, double duration = 0, Easing easing = Easing.None) where T : Drawable, IHasAccentColour => t.Append(o => o.FadeAccent(newColour, duration, easing)); } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; namespace osu.Game.Graphics { /// <summary> /// A type of drawable that has an accent colour. /// The accent colour is used to colorize various objects inside a drawable /// without colorizing the drawable itself. /// </summary> public interface IHasAccentColour : IDrawable { Color4 AccentColour { get; set; } } public static class AccentedColourExtensions { /// <summary> /// Tweens the accent colour of a drawable to another colour. /// </summary> /// <param name="accentedDrawable">The drawable to apply the accent colour to.</param> /// <param name="newColour">The new accent colour.</param> /// <param name="duration">The tween duration.</param> /// <param name="easing">The tween easing.</param> public static TransformSequence<T> FadeAccent<T>(this T accentedDrawable, Color4 newColour, double duration = 0, Easing easing = Easing.None) where T : IHasAccentColour => accentedDrawable.TransformTo(nameof(accentedDrawable.AccentColour), newColour, duration, easing); } }
mit
C#
21934c312ce7ed1584e4c74a7ec7be30834e03c0
Remove ResultConsistencyLong test - duplicate of ResultConsistencyAsHashAlgorithm
force-net/Crc32.NET
Crc32.NET.Tests/ImplementationTest.cs
Crc32.NET.Tests/ImplementationTest.cs
using System; using System.Linq; using System.Text; using NUnit.Framework; using E = Crc32.Crc32Algorithm; namespace Force.Crc32.Tests { [TestFixture] public class ImplementationTest { [TestCase("Hello", 3)] [TestCase("Nazdar", 0)] [TestCase("Ahoj", 1)] [TestCase("Very long text.Very long text.Very long text.Very long text.Very long text.Very long text.Very long text", 0)] [TestCase("Very long text.Very long text.Very long text.Very long text.Very long text.Very long text.Very long text", 3)] public void ResultConsistency(string text, int offset) { var bytes = Encoding.ASCII.GetBytes(text); var crc1 = E.Compute(bytes.Skip(offset).ToArray()); var crc2 = Crc32Algorithm.Append(0, bytes, offset, bytes.Length - offset); Assert.That(crc2, Is.EqualTo(crc1)); } [Test] public void ResultConsistency2() { Assert.That(Crc32Algorithm.Compute(new byte[] { 1 }), Is.EqualTo(2768625435)); Assert.That(Crc32Algorithm.Compute(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }), Is.EqualTo(622876539)); } [Test] public void ResultConsistencyAsHashAlgorithm() { var bytes = new byte[30000]; new Random().NextBytes(bytes); var e = new E(); var c = new Crc32Algorithm(); var crc1 = BitConverter.ToInt32(e.ComputeHash(bytes), 0); var crc2 = BitConverter.ToInt32(c.ComputeHash(bytes), 0); Console.WriteLine(crc1.ToString("X8")); Console.WriteLine(crc2.ToString("X8")); Assert.That(crc1, Is.EqualTo(crc2)); } [Test] public void PartIsWhole() { var bytes = new byte[30000]; new Random().NextBytes(bytes); var r1 = Crc32Algorithm.Append(0, bytes, 0, 15000); var r2 = Crc32Algorithm.Append(r1, bytes, 15000, 15000); var r3 = Crc32Algorithm.Append(0, bytes, 0, 30000); Assert.That(r2, Is.EqualTo(r3)); } } }
using System; using System.Linq; using System.Text; using NUnit.Framework; using E = Crc32.Crc32Algorithm; namespace Force.Crc32.Tests { [TestFixture] public class ImplementationTest { [TestCase("Hello", 3)] [TestCase("Nazdar", 0)] [TestCase("Ahoj", 1)] [TestCase("Very long text.Very long text.Very long text.Very long text.Very long text.Very long text.Very long text", 0)] [TestCase("Very long text.Very long text.Very long text.Very long text.Very long text.Very long text.Very long text", 3)] public void ResultConsistency(string text, int offset) { var bytes = Encoding.ASCII.GetBytes(text); var crc1 = E.Compute(bytes.Skip(offset).ToArray()); var crc2 = Crc32Algorithm.Append(0, bytes, offset, bytes.Length - offset); Assert.That(crc2, Is.EqualTo(crc1)); } [Test] public void ResultConsistencyLong() { var bytes = new byte[30000]; new Random().NextBytes(bytes); var crc1 = (uint)BitConverter.ToInt32(new E().ComputeHash(bytes, 0, bytes.Length), 0); var crc2 = Crc32Algorithm.Append(0, bytes, 0, bytes.Length); Assert.That(crc2, Is.EqualTo(crc1)); } [Test] public void ResultConsistency2() { Assert.That(Crc32Algorithm.Compute(new byte[] { 1 }), Is.EqualTo(2768625435)); Assert.That(Crc32Algorithm.Compute(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }), Is.EqualTo(622876539)); } [Test] public void ResultConsistencyAsHashAlgorithm() { var bytes = new byte[30000]; new Random().NextBytes(bytes); var e = new E(); var c = new Crc32Algorithm(); var crc1 = BitConverter.ToInt32(e.ComputeHash(bytes), 0); var crc2 = BitConverter.ToInt32(c.ComputeHash(bytes), 0); Console.WriteLine(crc1.ToString("X8")); Console.WriteLine(crc2.ToString("X8")); Assert.That(crc1, Is.EqualTo(crc2)); } [Test] public void PartIsWhole() { var bytes = new byte[30000]; new Random().NextBytes(bytes); var c = new Crc32Algorithm(); var r1 = Crc32Algorithm.Append(0, bytes, 0, 15000); var r2 = Crc32Algorithm.Append(r1, bytes, 15000, 15000); var r3 = Crc32Algorithm.Append(0, bytes, 0, 30000); Assert.That(r2, Is.EqualTo(r3)); } } }
mit
C#
853b9a476c17c9f0b7f30f2907245cd78a5d6fe7
Update FibonacciNumbers.cs
DuckBoss/Programming-Challenges,DuckBoss/Programming-Challenges,DuckBoss/Programming-Challenges,DuckBoss/Programming-Challenges
Fibonacci_Numbers/FibonacciNumbers.cs
Fibonacci_Numbers/FibonacciNumbers.cs
using System; namespace FibonacciNumbers { class MainClass { public static void Main(string[] args) { if (args.Length != 3) { Console.WriteLine("This program requires 2 starting integers, and the max terms to count!\n"); Environment.Exit(0); } int start1 = Convert.ToInt32(args[0]); int start2 = Convert.ToInt32(args[1]); int maxCount = Convert.ToInt32(args[2]); if (maxCount < 2) maxCount = 2; int[] fullList = new int[maxCount]; fullList[0] = start1; fullList[1] = start2; for (int i = 2; i < maxCount; i++) fullList[i] = fullList[i - 1] + fullList[i-2]; Console.Write("Result - {"); foreach (int fib in fullList) { Console.Write($" {fib}"); } Console.Write(" }"); Console.WriteLine(); Console.ReadKey(); } } }
using System; namespace EvenFibonacciNumbers { class MainClass { public static void Main(string[] args) { if (args.Length != 3) { Console.WriteLine("This program requires 2 starting integers, and the max terms to count!\n"); Environment.Exit(0); } int start1 = Convert.ToInt32(args[0]); int start2 = Convert.ToInt32(args[1]); int maxCount = Convert.ToInt32(args[2]); if (maxCount < 2) maxCount = 2; int[] fullList = new int[maxCount]; fullList[0] = start1; fullList[1] = start2; for (int i = 2; i < maxCount; i++) fullList[i] = fullList[i - 1] + fullList[i-2]; Console.Write("Result - {"); foreach (int fib in fullList) { Console.Write($" {fib}"); } Console.Write(" }"); Console.WriteLine(); Console.ReadKey(); } } }
unlicense
C#
fd8bd8e837fd0ffa793b9e04e28748e4e2794097
Update version
scottlerch/StorageUsageReporter,scottlerch/StorageUsageReporter
StorageUsageReporter/Properties/AssemblyInfo.cs
StorageUsageReporter/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("StorageUsageReporter")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("StorageUsageReporter")] [assembly: AssemblyCopyright("Copyright Scott Lerch 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("14269916-cb29-432d-a988-6f94f1490db6")] // 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.9.2.0")] [assembly: AssemblyFileVersion("0.9.2.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("StorageUsageReporter")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("StorageUsageReporter")] [assembly: AssemblyCopyright("Copyright Scott Lerch 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("14269916-cb29-432d-a988-6f94f1490db6")] // 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.9.1.0")] [assembly: AssemblyFileVersion("0.9.1.0")]
apache-2.0
C#
712bc12c4590aabfd584f3e76c47dbfa644459d9
Update AssemblyInfo.cs
ahmadnazir/sdk-net,Penneo/sdk-net,ahmadnazir/sdk-net,Penneo/sdk-net
Src/Penneo/Properties/AssemblyInfo.cs
Src/Penneo/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("Penneo")] [assembly: AssemblyDescription("SDK for Penneo Web API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Penneo")] [assembly: AssemblyProduct("Penneo")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a0495e6a-8ca7-468f-b1de-4f3ef1a1271e")] // 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.22.0")] [assembly: AssemblyFileVersion("1.0.22.0")] [assembly: InternalsVisibleTo("PenneoTests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
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("Penneo")] [assembly: AssemblyDescription("SDK for Penneo Web API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Penneo")] [assembly: AssemblyProduct("Penneo")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a0495e6a-8ca7-468f-b1de-4f3ef1a1271e")] // 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.21.0")] [assembly: AssemblyFileVersion("1.0.21.0")] [assembly: InternalsVisibleTo("PenneoTests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
apache-2.0
C#
db6cab31cc6e7801f7534e1ab3723cec014b56a2
修正发牌器计算概率的 Bug
Ivony/TableGames
Ivony.TableGame.Core/UnlimitedCardDealer.cs
Ivony.TableGame.Core/UnlimitedCardDealer.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ivony.TableGame { /// <summary> /// 定义一个无限卡牌发牌器 /// </summary> public class UnlimitedCardDealer : CardDealer { private List<RegisteredCard> list = new List<RegisteredCard>(); private class RegisteredCard { public RegisteredCard( Func<Card> cardCreator, int probability ) { CardCreator = cardCreator; Probability = probability; } public Func<Card> CardCreator { get; private set; } public int Probability { get; private set; } } /// <summary> /// 注册一种卡牌 /// </summary> /// <typeparam name="T">要注册的卡牌类型</typeparam> /// <param name="probability">出现概率</param> public UnlimitedCardDealer Register<T>( Func<T> creator, int probability ) where T : Card { list.Add( new RegisteredCard( creator, probability ) ); return this; } public override Card DealCard() { var n = Random.Next( list.Sum( item => item.Probability ) ); foreach ( var item in list ) { n -= item.Probability; if ( n < 0 ) return item.CardCreator(); } throw new InvalidOperationException(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ivony.TableGame { /// <summary> /// 定义一个无限卡牌发牌器 /// </summary> public class UnlimitedCardDealer : CardDealer { private List<RegisteredCard> list = new List<RegisteredCard>(); private class RegisteredCard { public RegisteredCard( Func<Card> cardCreator, int probability ) { CardCreator = cardCreator; Probability = probability; } public Func<Card> CardCreator { get; private set; } public int Probability { get; private set; } } /// <summary> /// 注册一种卡牌 /// </summary> /// <typeparam name="T">要注册的卡牌类型</typeparam> /// <param name="probability">出现概率</param> public UnlimitedCardDealer Register<T>( Func<T> creator, int probability ) where T : Card { list.Add( new RegisteredCard( creator, probability ) ); return this; } public override Card DealCard() { var n = Random.Next( list.Sum( item => item.Probability ) ); foreach ( var item in list ) { n -= item.Probability; if ( n <= 0 ) return item.CardCreator(); } throw new InvalidOperationException(); } } }
apache-2.0
C#
ea4f0b252892bfb5391d3e11051d51da2e984c06
Revert changing the app data directory for the portable version, we'd have to deal with relative paths which gets weird quickly
flagbug/Espera,punker76/Espera
Espera.Core/AppInfo.cs
Espera.Core/AppInfo.cs
using System; using System.IO; using System.Reflection; namespace Espera.Core { public static class AppInfo { /// <summary> /// Returns a value whether this application is portable or not. The application is portable /// if a file with the name "PORTABLE" is present in the <see cref="AppRootPath" /> directory. /// </summary> public static readonly bool IsPortable; public static readonly string AppName; public static readonly string BlobCachePath; public static readonly string ApplicationDataPath; public static readonly string LibraryFilePath; public static readonly string LogFilePath; public static readonly string OverridenApplicationDataPath; public static readonly Version Version; public static readonly string AppRootPath; public static readonly string UpdatePath; static AppInfo() { AppName = "Espera"; #if DEBUG // Set and uncomment this if you want to change the app data folder for debugging // OverridenApplicationDataPath = "D://AppData"; AppName = "EsperaDebug"; #endif var baseDirectory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); IsPortable = File.Exists(Path.Combine(baseDirectory.Parent.FullName, "PORTABLE")); ApplicationDataPath = Path.Combine(OverridenApplicationDataPath ?? Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppName); BlobCachePath = Path.Combine(ApplicationDataPath, "BlobCache"); LibraryFilePath = Path.Combine(ApplicationDataPath, "Library.json"); LogFilePath = Path.Combine(ApplicationDataPath, "Log.txt"); UpdatePath = "http://getespera.com/releases/squirrel/"; Version = Assembly.GetExecutingAssembly().GetName().Version; // Directory.GetParent doesn't work here, it has problems when // AppDomain.CurrentDomain.BaseDirectory returns a path with a backslash and returns the // same directory instead of the parent AppRootPath = baseDirectory.Parent.Parent.FullName; if (!IsPortable) { // If we're a portable app, let Squirrel figure out the path for us AppRootPath = null; } } } }
using System; using System.IO; using System.Reflection; namespace Espera.Core { public static class AppInfo { /// <summary> /// Returns a value whether this application is portable or not. The application is portable /// if a file with the name "PORTABLE" is present in the <see cref="AppRootPath" /> directory. /// </summary> public static readonly bool IsPortable; public static readonly string AppName; public static readonly string BlobCachePath; public static readonly string ApplicationDataPath; public static readonly string LibraryFilePath; public static readonly string LogFilePath; public static readonly string OverridenApplicationDataPath; public static readonly Version Version; public static readonly string AppRootPath; public static readonly string UpdatePath; static AppInfo() { AppName = "Espera"; #if DEBUG // Set and uncomment this if you want to change the app data folder for debugging // OverridenApplicationDataPath = "D://AppData"; AppName = "EsperaDebug"; #endif var baseDirectory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); IsPortable = File.Exists(Path.Combine(baseDirectory.Parent.FullName, "PORTABLE")); ApplicationDataPath = IsPortable ? baseDirectory.Parent.FullName : Path.Combine(OverridenApplicationDataPath ?? Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppName); BlobCachePath = Path.Combine(ApplicationDataPath, "BlobCache"); LibraryFilePath = Path.Combine(ApplicationDataPath, "Library.json"); LogFilePath = Path.Combine(ApplicationDataPath, "Log.txt"); UpdatePath = "http://getespera.com/releases/squirrel/"; Version = Assembly.GetExecutingAssembly().GetName().Version; // Directory.GetParent doesn't work here, it has problems when // AppDomain.CurrentDomain.BaseDirectory returns a path with a backslash and returns the // same directory instead of the parent AppRootPath = baseDirectory.Parent.Parent.FullName; if (!IsPortable) { // If we're a portable app, let Squirrel figure out the path for us AppRootPath = null; } } } }
mit
C#
d7e2048b9bcfb51d3de2e4d97840577cc8c75396
Set port to -1 if port is 80
timgranstrom/JabbR,JabbR/JabbR,timgranstrom/JabbR,LookLikeAPro/JabbR,CrankyTRex/JabbRMirror,e10/JabbR,M-Zuber/JabbR,yadyn/JabbR,lukehoban/JabbR,SonOfSam/JabbR,fuzeman/vox,lukehoban/JabbR,AAPT/jean0226case1322,18098924759/JabbR,LookLikeAPro/JabbR,meebey/JabbR,mzdv/JabbR,CrankyTRex/JabbRMirror,e10/JabbR,borisyankov/JabbR,18098924759/JabbR,CrankyTRex/JabbRMirror,huanglitest/JabbRTest2,LookLikeAPro/JabbR,fuzeman/vox,JabbR/JabbR,borisyankov/JabbR,ajayanandgit/JabbR,ajayanandgit/JabbR,lukehoban/JabbR,yadyn/JabbR,M-Zuber/JabbR,huanglitest/JabbRTest2,meebey/JabbR,meebey/JabbR,mzdv/JabbR,AAPT/jean0226case1322,borisyankov/JabbR,huanglitest/JabbRTest2,SonOfSam/JabbR,yadyn/JabbR,fuzeman/vox
JabbR/Middleware/RequireHttpsHandler.cs
JabbR/Middleware/RequireHttpsHandler.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNet.SignalR.Owin; namespace JabbR.Middleware { using AppFunc = Func<IDictionary<string, object>, Task>; public class RequireHttpsHandler { private readonly AppFunc _next; public RequireHttpsHandler(AppFunc next) { _next = next; } public Task Invoke(IDictionary<string, object> env) { var request = new ServerRequest(env); var response = new Gate.Response(env); if (!request.Url.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase)) { var builder = new UriBuilder(request.Url); builder.Scheme = "https"; if (builder.Port == 80) { builder.Port = -1; } response.SetHeader("Location", builder.ToString()); response.StatusCode = 302; return TaskAsyncHelper.Empty; } else { return _next(env); } } } }
using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNet.SignalR.Owin; namespace JabbR.Middleware { using AppFunc = Func<IDictionary<string, object>, Task>; public class RequireHttpsHandler { private readonly AppFunc _next; public RequireHttpsHandler(AppFunc next) { _next = next; } public Task Invoke(IDictionary<string, object> env) { var request = new ServerRequest(env); var response = new Gate.Response(env); if (!request.Url.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase)) { var builder = new UriBuilder(request.Url); builder.Scheme = "https"; response.SetHeader("Location", builder.ToString()); response.StatusCode = 302; return TaskAsyncHelper.Empty; } else { return _next(env); } } } }
mit
C#
9a98d60e0568bc483c6663a60d75de468fad630f
Fix comment
KriBetko/KryBot
src/KryBot.Core/Helpers/FileHelper.cs
src/KryBot.Core/Helpers/FileHelper.cs
using System; using System.IO; using System.Windows.Forms; using System.Xml.Serialization; namespace KryBot.Core.Helpers { public static class FileHelper { /// <summary> /// Trying to write (serialize) object to file. /// </summary> /// <returns> /// If writing is successful, returns true, otherwise false. /// </returns> public static bool Save<T>(T instance, string path) { try { using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write)) { var serializer = new XmlSerializer(typeof (T)); serializer.Serialize(fileStream, instance); } return true; } catch (Exception ex) { MessageBox.Show(ex.Message, @"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } /// <summary> /// Trying to read (deserialize) the file into an object. /// </summary> /// <returns> /// If reading is successful, returns true, otherwise false. /// </returns> public static bool Load<T>(ref T instance, string path) { try { using (var reader = new StreamReader(path)) { var serializer = new XmlSerializer(typeof (T)); instance = (T) serializer.Deserialize(reader); } return true; } catch (Exception ex) { MessageBox.Show(ex.Message, @"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } /// <summary> /// Trying to read (deserialize) the file into an object. /// </summary> /// <returns> /// If reading is successful, returns the completed object, otherwise create a new one. /// </returns> public static T SafelyLoad<T>(string path) where T : new() { try { using (var reader = new StreamReader(path)) { var serializer = new XmlSerializer(typeof(T)); return (T)serializer.Deserialize(reader); } } catch (Exception) { return new T(); } } } }
using System; using System.IO; using System.Windows.Forms; using System.Xml.Serialization; namespace KryBot.Core.Helpers { public static class FileHelper { /// <summary> /// Trying to write (serialize) object to file. /// </summary> /// <returns> /// If write is successful, returns true, otherwise false. /// </returns> public static bool Save<T>(T instance, string path) { try { using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write)) { var serializer = new XmlSerializer(typeof (T)); serializer.Serialize(fileStream, instance); } return true; } catch (Exception ex) { MessageBox.Show(ex.Message, @"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } /// <summary> /// Trying to read (deserialize) the file into an object. /// </summary> /// <returns> /// If reading is successful, returns true, otherwise false. /// </returns> public static bool Load<T>(ref T instance, string path) { try { using (var reader = new StreamReader(path)) { var serializer = new XmlSerializer(typeof (T)); instance = (T) serializer.Deserialize(reader); } return true; } catch (Exception ex) { MessageBox.Show(ex.Message, @"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } /// <summary> /// Trying to read (deserialize) the file into an object. /// </summary> /// <returns> /// If reading is successful, returns the completed object, otherwise create a new one. /// </returns> public static T SafelyLoad<T>(string path) where T : new() { try { using (var reader = new StreamReader(path)) { var serializer = new XmlSerializer(typeof(T)); return (T)serializer.Deserialize(reader); } } catch (Exception) { return new T(); } } } }
apache-2.0
C#
36abe386a1d6d9d36fc62d9e5d938fe96cd824e5
Add GetExtent to viewport extensions
charlenni/Mapsui,charlenni/Mapsui
Mapsui/Extensions/ViewportExtensions.cs
Mapsui/Extensions/ViewportExtensions.cs
using Mapsui.Utilities; using System; using System.Collections.Generic; using System.Text; namespace Mapsui.Extensions { public static class ViewportExtensions { /// <summary> /// True if Width and Height are not zero /// </summary> public static bool HasSize(this IReadOnlyViewport viewport) => !viewport.Width.IsNanOrInfOrZero() && !viewport.Height.IsNanOrInfOrZero(); /// <summary> /// IsRotated is true, when viewport displays map rotated /// </summary> public static bool IsRotated(this IReadOnlyViewport viewport) => !double.IsNaN(viewport.Rotation) && viewport.Rotation > Constants.Epsilon && viewport.Rotation < 360 - Constants.Epsilon; /// <summary> /// Calculates extent from the viewport /// </summary> /// <remarks> /// This MRect is horizontally and vertically aligned, even if the viewport /// is rotated. So this MRect perhaps contain parts, that are not visible. /// </remarks> public static MRect GetExtent(this IReadOnlyViewport viewport) { // calculate the window extent var halfSpanX = viewport.Width * viewport.Resolution * 0.5; var halfSpanY = viewport.Height * viewport.Resolution * 0.5; var minX = viewport.CenterX - halfSpanX; var minY = viewport.CenterY - halfSpanY; var maxX = viewport.CenterX + halfSpanX; var maxY = viewport.CenterY + halfSpanY; if (!viewport.IsRotated()) { return new MRect(minX, minY, maxX, maxY); } else { var windowExtent = new MQuad { BottomLeft = new MPoint(minX, minY), TopLeft = new MPoint(minX, maxY), TopRight = new MPoint(maxX, maxY), BottomRight = new MPoint(maxX, minY) }; // Calculate the extent that will encompass a rotated viewport (slightly larger - used for tiles). // Perform rotations on corner offsets and then add them to the Center point. return windowExtent.Rotate(-viewport.Rotation, viewport.CenterX, viewport.CenterY).ToBoundingBox(); } } } }
using Mapsui.Utilities; using System; using System.Collections.Generic; using System.Text; namespace Mapsui.Extensions { public static class ViewportExtensions { /// <summary> /// True if Width and Height are not zero /// </summary> public static bool HasSize(this IReadOnlyViewport viewport) => !viewport.Width.IsNanOrInfOrZero() && !viewport.Height.IsNanOrInfOrZero(); /// <summary> /// IsRotated is true, when viewport displays map rotated /// </summary> public static bool IsRotated(this IReadOnlyViewport viewport) => !double.IsNaN(viewport.Rotation) && viewport.Rotation > Constants.Epsilon && viewport.Rotation < 360 - Constants.Epsilon; } }
mit
C#
9f8fb6c0110c6aa3b26bb6067bbc7e1de6b51ee3
Fix release build failure on Xamarin.
modulexcite/msgpack-cli,msgpack/msgpack-cli,modulexcite/msgpack-cli,undeadlabs/msgpack-cli,undeadlabs/msgpack-cli,msgpack/msgpack-cli
src/MsgPack.Xamarin.iOS/MPContract.cs
src/MsgPack.Xamarin.iOS/MPContract.cs
#region -- License Terms -- // MessagePack for CLI // // Copyright (C) 2015 FUJIWARA, Yusuke // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System; using System.Diagnostics; namespace MsgPack { /// <summary> /// System.Contract alternative working on Xamarin. /// </summary> internal static class MPContract { [Conditional( "DEBUG" )] public static void Assert( bool condition, string userMessage ) { if ( !condition ) { throw new Exception( "Assertion error: " + userMessage ); } } [Conditional("__NEVER")] public static void EndContractBlock() { // nop } [Conditional( "__NEVER" )] public static void Requires( bool expression ) { // nop } [Conditional( "__NEVER" )] public static void Ensures( bool expression ) { // nop } public static T Result<T>() { return default( T ); } } }
#region -- License Terms -- // MessagePack for CLI // // Copyright (C) 2015 FUJIWARA, Yusuke // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System; using System.Diagnostics; namespace MsgPack { #if DEBUG // Use compiler directive to ensure compiler removal of related expressions of assertion. /// <summary> /// System.Contract alternative working on Xamarin. /// </summary> internal static class MPContract { public static void Assert( bool condition, string userMessage ) { if ( !condition ) { throw new Exception( "Assertion error: " + userMessage ); } } [Conditional("__NEVER")] public static void EndContractBlock() { // nop } [Conditional( "__NEVER" )] public static void Requires( bool expression ) { // nop } [Conditional( "__NEVER" )] public static void Ensures( bool expression ) { // nop } public static T Result<T>() { return default( T ); } } #endif // DEBUG }
apache-2.0
C#
e66a15e653b7cfa8214ec77d222cb2d82de89e94
Change guild permissions to have ReadGuildConfig when ViewAuditLog is true.
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
MitternachtWeb/Models/PagePermission.cs
MitternachtWeb/Models/PagePermission.cs
using Discord; using System; namespace MitternachtWeb.Models { [Flags] public enum BotLevelPermission { None = 0b_0000, ReadBotConfig = 0b_0001, WriteBotConfig = 0b_0011, ReadAllGuildConfigs = 0b_0100, WriteAllGuildConfigs = 0b_1100, All = 0b_1111, } [Flags] public enum GuildLevelPermission { None = 0b_0000_0000, ReadGuildConfig = 0b_0000_0001, WriteGuildConfig = 0b_0000_0011, } public static class PagePermissionExtensions { public static GuildLevelPermission GetGuildPagePermissions(this GuildPermissions guildPerms) { var perms = GuildLevelPermission.None; if(guildPerms.ViewAuditLog) { perms |= GuildLevelPermission.ReadGuildConfig; } if(guildPerms.Administrator) { perms |= GuildLevelPermission.WriteGuildConfig; } return perms; } } }
using Discord; using System; namespace MitternachtWeb.Models { [Flags] public enum BotLevelPermission { None = 0b_0000, ReadBotConfig = 0b_0001, WriteBotConfig = 0b_0011, ReadAllGuildConfigs = 0b_0100, WriteAllGuildConfigs = 0b_1100, All = 0b_1111, } [Flags] public enum GuildLevelPermission { None = 0b_0000_0000, ReadGuildConfig = 0b_0000_0001, WriteGuildConfig = 0b_0000_0011, } public static class PagePermissionExtensions { public static GuildLevelPermission GetGuildPagePermissions(this GuildPermissions guildPerms) { var perms = GuildLevelPermission.None; if(guildPerms.KickMembers) { perms |= GuildLevelPermission.ReadGuildConfig; } if(guildPerms.Administrator) { perms |= GuildLevelPermission.WriteGuildConfig; } return perms; } } }
mit
C#
ec9a25234316acfc98bafef12d42880e8c48f4af
Use ParallelEnumerable in puzzle 10
martincostello/project-euler
src/ProjectEuler/Puzzles/Puzzle010.cs
src/ProjectEuler/Puzzles/Puzzle010.cs
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { using System; using System.Linq; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=10</c>. This class cannot be inherited. /// </summary> internal sealed class Puzzle010 : Puzzle { /// <inheritdoc /> public override string Question => "Find the sum of all the primes below the specified value."; /// <inheritdoc /> protected override int MinimumArguments => 1; /// <inheritdoc /> protected override int SolveCore(string[] args) { int max; if (!TryParseInt32(args[0], out max) || max < 2) { Console.Error.WriteLine("The specified number is invalid."); return -1; } Answer = ParallelEnumerable.Range(2, max - 2) .Where((p) => Maths.IsPrime(p)) .Select((p) => (long)p) .Sum(); return 0; } } }
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { using System; using System.Linq; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=10</c>. This class cannot be inherited. /// </summary> internal sealed class Puzzle010 : Puzzle { /// <inheritdoc /> public override string Question => "Find the sum of all the primes below the specified value."; /// <inheritdoc /> protected override int MinimumArguments => 1; /// <inheritdoc /> protected override int SolveCore(string[] args) { int max; if (!TryParseInt32(args[0], out max) || max < 2) { Console.Error.WriteLine("The specified number is invalid."); return -1; } Answer = Enumerable.Range(2, max - 2) .AsParallel() .Where((p) => Maths.IsPrime(p)) .Select((p) => (long)p) .Sum(); return 0; } } }
apache-2.0
C#
5f744dccfbbadf24b9c253b76146a0648add0d29
Remove .NET 3.5 conditionals from framework code
nunit/nunit-console,nunit/nunit-console,nunit/nunit-console
src/CommonAssemblyInfo.cs
src/CommonAssemblyInfo.cs
// *********************************************************************** // Copyright (c) 2014 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. // *********************************************************************** using System.Reflection; // // Common Information for the NUnit assemblies // [assembly: AssemblyCompany("NUnit Software")] [assembly: AssemblyProduct("NUnit 3.0")] [assembly: AssemblyCopyright("Copyright (C) 2014 Charlie Poole")] [assembly: AssemblyTrademark("NUnit is a trademark of NUnit Software")] #if DEBUG #if NET_4_5 [assembly: AssemblyConfiguration(".NET 4.5 Debug")] #elif NET_4_0 [assembly: AssemblyConfiguration(".NET 4.0 Debug")] #elif NET_2_0 [assembly: AssemblyConfiguration(".NET 2.0 Debug")] #elif SL_5_0 [assembly: AssemblyConfiguration("Silverlight 5.0 Debug")] #elif SL_4_0 [assembly: AssemblyConfiguration("Silverlight 4.0 Debug")] #elif SL_3_0 [assembly: AssemblyConfiguration("Silverlight 3.0 Debug")] #elif NETCF_3_5 [assembly: AssemblyConfiguration("Compact Framework 3.5 Debug")] #elif PORTABLE [assembly: AssemblyConfiguration("Portable Debug")] #else [assembly: AssemblyConfiguration("Debug")] #endif #else #if NET_4_5 [assembly: AssemblyConfiguration(".NET 4.5")] #elif NET_4_0 [assembly: AssemblyConfiguration(".NET 4.0")] #elif NET_2_0 [assembly: AssemblyConfiguration(".NET 2.0")] #elif SL_5_0 [assembly: AssemblyConfiguration("Silverlight 5.0")] #elif SL_4_0 [assembly: AssemblyConfiguration("Silverlight 4.0")] #elif SL_3_0 [assembly: AssemblyConfiguration("Silverlight 3.0")] #elif NETCF_3_5 [assembly: AssemblyConfiguration("Compact Framework 3.5")] #elif PORTABLE [assembly: AssemblyConfiguration("Portable")] #else [assembly: AssemblyConfiguration("")] #endif #endif
// *********************************************************************** // Copyright (c) 2014 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. // *********************************************************************** using System.Reflection; // // Common Information for the NUnit assemblies // [assembly: AssemblyCompany("NUnit Software")] [assembly: AssemblyProduct("NUnit 3.0")] [assembly: AssemblyCopyright("Copyright (C) 2014 Charlie Poole")] [assembly: AssemblyTrademark("NUnit is a trademark of NUnit Software")] #if DEBUG #if NET_4_5 [assembly: AssemblyConfiguration(".NET 4.5 Debug")] #elif NET_4_0 [assembly: AssemblyConfiguration(".NET 4.0 Debug")] #elif NET_3_5 [assembly: AssemblyConfiguration(".NET 3.5 Debug")] #elif NET_2_0 [assembly: AssemblyConfiguration(".NET 2.0 Debug")] #elif SL_5_0 [assembly: AssemblyConfiguration("Silverlight 5.0 Debug")] #elif SL_4_0 [assembly: AssemblyConfiguration("Silverlight 4.0 Debug")] #elif SL_3_0 [assembly: AssemblyConfiguration("Silverlight 3.0 Debug")] #elif NETCF_3_5 [assembly: AssemblyConfiguration("Compact Framework 3.5 Debug")] #elif PORTABLE [assembly: AssemblyConfiguration("Portable Debug")] #else [assembly: AssemblyConfiguration("Debug")] #endif #else #if NET_4_5 [assembly: AssemblyConfiguration(".NET 4.5")] #elif NET_4_0 [assembly: AssemblyConfiguration(".NET 4.0")] #elif NET_3_5 [assembly: AssemblyConfiguration(".NET 3.5")] #elif NET_2_0 [assembly: AssemblyConfiguration(".NET 2.0")] #elif SL_5_0 [assembly: AssemblyConfiguration("Silverlight 5.0")] #elif SL_4_0 [assembly: AssemblyConfiguration("Silverlight 4.0")] #elif SL_3_0 [assembly: AssemblyConfiguration("Silverlight 3.0")] #elif NETCF_3_5 [assembly: AssemblyConfiguration("Compact Framework 3.5")] #elif PORTABLE [assembly: AssemblyConfiguration("Portable")] #else [assembly: AssemblyConfiguration("")] #endif #endif
mit
C#
403f5c21520e7696d17c65d0d3eff22a9c73dffe
Increment version
kamranayub/cassette-sri,kamranayub/cassette-sri
src/SharedAssemblyInfo.cs
src/SharedAssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Cassette.SubresourceIntegrity")] [assembly: AssemblyDescription("Extension for Cassette that adds Subresource Integrity (SRI) hashing to script and stylesheet assets")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("kayub")] [assembly: AssemblyProduct("Cassette.SubresourceIntegrity")] [assembly: AssemblyCopyright("Copyright © kayub 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.0.2")] [assembly: AssemblyFileVersion("1.0.2")] [assembly: AssemblyInformationalVersion("1.0.2")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Cassette.SubresourceIntegrity")] [assembly: AssemblyDescription("Extension for Cassette that adds Subresource Integrity (SRI) hashing to script and stylesheet assets")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("kayub")] [assembly: AssemblyProduct("Cassette.SubresourceIntegrity")] [assembly: AssemblyCopyright("Copyright © kayub 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.0.1")] [assembly: AssemblyFileVersion("1.0.1")] [assembly: AssemblyInformationalVersion("1.0.1")]
mit
C#
12400b6d65e7b227bd654539a526ee4fda9c6cb1
Increase version number
HenriqueCaires/ZabbixApi,HenriqueCaires/ZabbixApi,dominicx/ZabbixApi
src/ZabbixApi/Properties/AssemblyInfo.cs
src/ZabbixApi/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("Zabbix")] [assembly: AssemblyDescription("C# Zabbix Api to retrieve and modify the configuration of Zabbix")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Zabbix")] [assembly: AssemblyCopyright("MIT")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("b243e0ac-089f-4a9c-b63d-5bb24f8f5608")] // 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.11.*")] [assembly: AssemblyFileVersion("1.0.11")]
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("Zabbix")] [assembly: AssemblyDescription("C# Zabbix Api to retrieve and modify the configuration of Zabbix")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Zabbix")] [assembly: AssemblyCopyright("MIT")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("b243e0ac-089f-4a9c-b63d-5bb24f8f5608")] // 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.10.*")] [assembly: AssemblyFileVersion("1.0.10")]
mit
C#
8f30013bcd97067b24edb600206035574c164f98
Comment RPGStatType
jkpenner/RPGSystemTutorial
Assets/Scripts/RPGSystems/RPGStatType.cs
Assets/Scripts/RPGSystems/RPGStatType.cs
using UnityEngine; using System.Collections; /// <summary> /// Used to list off all stats that can be used /// within the RPGStatCollection class /// </summary> public enum RPGStatType { None = 0, Health = 1, Mana = 2, Stamina = 10, Wisdom = 11, }
using UnityEngine; using System.Collections; public enum RPGStatType { None = 0, Health = 1, Mana = 2, Stamina = 10, Wisdom = 11, }
mit
C#
a8177e2fc32045ebedc4995a22f09296d0a3662f
Fix misspelling
Wyamio/Wyam.Web,Wyamio/Wyam.Web
input/recipes/booksite/pipelines.cshtml
input/recipes/booksite/pipelines.cshtml
Order: 4 Description: The pipelines involved in the recipe and what they do. --- <p>The following pipelines are defined for this recipe and are executed in the order below. You can extend or adjust the recipe by <a href="/docs/concepts/recipes#pipelines">modifying these pipelines and/or by creating new pipelines</a>.</p> @Html.Partial("_RecipePipelines", "Wyam.BookSite.BookSite")
Order: 4 Description: The pipelines involved in the recipe and what they do. --- <p>The following pipelines are defined for this recipe and are executed in the order below. You can extend or adjust the recipe by <a href="/docs/concepts/recipes#pipelines">modiying these pipelines and/or by creating new pipelines</a>.</p> @Html.Partial("_RecipePipelines", "Wyam.BookSite.BookSite")
mit
C#
8c6289f51959845b93fdf0911d270afc3a77e0ea
Update AssemblyInfo.cs
MasterDevs/Clippy
Clippy/Clippy/Properties/AssemblyInfo.cs
Clippy/Clippy/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("MasterDevs.Clippy")] [assembly: AssemblyDescription("Treat the clipboard like a TextReader and TextWriter")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MasterDevs")] [assembly: AssemblyProduct("MasterDevs.Clippy")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a3e914ee-6255-4b13-87ff-c17f2600d9af")] // 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("MasterDevs.Clippy")] [assembly: AssemblyDescription("Treat the clipboard like a Stream")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MasterDevs")] [assembly: AssemblyProduct("MasterDevs.Clippy")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a3e914ee-6255-4b13-87ff-c17f2600d9af")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
ae89b81ba21e41fa7ff22788f5e8b72d2e095410
Remove unused variable compiler warning when building release build.
blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon
Compiler/Common/SourceDirectoryFinder.cs
Compiler/Common/SourceDirectoryFinder.cs
using CommonUtil.Disk; namespace Common { public static class SourceDirectoryFinder { private static string crayonSourceDirectoryCached = null; public static string CrayonSourceDirectory { // Presumably running from source. Walk up to the root directory and find the Libraries directory. // From there use the list of folders. // TODO: mark this as DEBUG only get { #if DEBUG if (crayonSourceDirectoryCached == null) { string currentDirectory = Path.GetCurrentDirectory(); while (!string.IsNullOrEmpty(currentDirectory)) { string librariesPath = FileUtil.JoinPath(currentDirectory, "Libraries"); if (FileUtil.DirectoryExists(librariesPath) && FileUtil.FileExists(FileUtil.JoinPath(currentDirectory, "Compiler", "CrayonWindows.sln"))) // quick sanity check { crayonSourceDirectoryCached = currentDirectory; break; } currentDirectory = FileUtil.GetParentDirectory(currentDirectory); } } #endif return crayonSourceDirectoryCached; } } } }
using CommonUtil.Disk; namespace Common { public static class SourceDirectoryFinder { private static string crayonSourceDirectoryCached = null; public static string CrayonSourceDirectory { // Presumably running from source. Walk up to the root directory and find the Libraries directory. // From there use the list of folders. // TODO: mark this as DEBUG only get { #if DEBUG if (crayonSourceDirectoryCached == null) { string currentDirectory = Path.GetCurrentDirectory(); while (!string.IsNullOrEmpty(currentDirectory)) { string librariesPath = FileUtil.JoinPath(currentDirectory, "Libraries"); if (FileUtil.DirectoryExists(librariesPath) && FileUtil.FileExists(FileUtil.JoinPath(currentDirectory, "Compiler", "CrayonWindows.sln"))) // quick sanity check { crayonSourceDirectoryCached = currentDirectory; break; } currentDirectory = FileUtil.GetParentDirectory(currentDirectory); } } return crayonSourceDirectoryCached; #else return null; #endif } } } }
mit
C#
228625ce3affb90ec4d23aa9959baadca11fa0e3
Add DictionaryUtility.GetOrAddValue
SaberSnail/GoldenAnvil.Utility
GoldenAnvil.Utility/DictionaryUtility.cs
GoldenAnvil.Utility/DictionaryUtility.cs
using System; using System.Collections.Generic; namespace GoldenAnvil.Utility { public static class DictionaryUtility { public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) { dictionary.TryGetValue(key, out TValue value); return value; } public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue) { return dictionary.TryGetValue(key, out TValue value) ? value : defaultValue; } public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TValue> defaultCreator) { return dictionary.TryGetValue(key, out TValue value) ? value : defaultCreator(); } public static TValue GetOrAddValue<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value) { if (!dictionary.ContainsKey(key)) { dictionary[key] = value; return value; } return dictionary[key]; } public static TValue GetOrAddValue<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TValue> valueCreator) { if (!dictionary.ContainsKey(key)) { var value = valueCreator(); dictionary[key] = value; return value; } return dictionary[key]; } } }
using System; using System.Collections.Generic; namespace GoldenAnvil.Utility { public static class DictionaryUtility { public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) { TValue value; dictionary.TryGetValue(key, out value); return value; } public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue) { TValue value; return dictionary.TryGetValue(key, out value) ? value : defaultValue; } public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TValue> defaultCreator) { TValue value; return dictionary.TryGetValue(key, out value) ? value : defaultCreator(); } } }
mit
C#
2b78c64d587378509080baa8e01392b084e4008a
Sort numbers before display.
TimCollins/Reddit.DailyProgrammer
src/12-Int-Factors/Program.cs
src/12-Int-Factors/Program.cs
using System; using System.Text; using Util; namespace _12_Int_Factors { class Program { static void Main(string[] args) { Console.Write("Please enter a number to display factors for.\n> "); var input = Convert.ToInt32(Console.ReadLine()); var factors = new FactorCalculator().GetFactors(input); factors.Sort(); var output = new StringBuilder(string.Format("The factors of {0} are: ", input)); output.Append(string.Join(", ", factors)); Console.WriteLine(output.ToString()); // See here for a third-party calculator: // http://www.mathwarehouse.com/arithmetic/factorization-calculator.php ConsoleUtils.WaitForEscape(); } } }
using System; using System.Text; using Util; namespace _12_Int_Factors { class Program { static void Main(string[] args) { Console.Write("Please enter a number to display factors for.\n> "); var input = Convert.ToInt32(Console.ReadLine()); var factors = new FactorCalculator().GetFactors(input); var output = new StringBuilder(string.Format("The factors of {0} are: ", input)); output.Append(string.Join(", ", factors)); Console.WriteLine(output.ToString()); // See here for a third-party calculator: // http://www.mathwarehouse.com/arithmetic/factorization-calculator.php ConsoleUtils.WaitForEscape(); } } }
mit
C#
7c43f1719ef5afc084637bff65031ba883f29c5c
Remove manual DI configuration for node in RPC
Aprogiena/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode
Stratis.Bitcoin/RPC/WebHostExtensions.cs
Stratis.Bitcoin/RPC/WebHostExtensions.cs
using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Stratis.Bitcoin.Miner; using Stratis.Bitcoin.RPC.ModelBinders; using Stratis.Bitcoin.Wallet; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Stratis.Bitcoin.RPC { public static class WebHostExtensions { public static IWebHostBuilder ForFullNode(this IWebHostBuilder hostBuilder, FullNode fullNode) { hostBuilder.ConfigureServices(s => { s.AddMvcCore(o => { o.ModelBinderProviders.Insert(0, new DestinationModelBinder()); o.ModelBinderProviders.Insert(0, new MoneyModelBinder()); }); }); return hostBuilder; } } }
using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Stratis.Bitcoin.Miner; using Stratis.Bitcoin.RPC.ModelBinders; using Stratis.Bitcoin.Wallet; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Stratis.Bitcoin.RPC { public static class WebHostExtensions { public static IWebHostBuilder ForFullNode(this IWebHostBuilder hostBuilder, FullNode fullNode) { hostBuilder.ConfigureServices(s => { s.AddMvcCore(o => { o.ModelBinderProviders.Insert(0, new DestinationModelBinder()); o.ModelBinderProviders.Insert(0, new MoneyModelBinder()); }); s.AddSingleton(fullNode); s.AddSingleton(fullNode as Builder.IFullNode); s.AddSingleton(fullNode.Network); s.AddSingleton(fullNode.Settings); s.AddSingleton(fullNode.ConsensusLoop); s.AddSingleton(fullNode.ConsensusLoop?.Validator); s.AddSingleton(fullNode.Chain); s.AddSingleton(fullNode.ChainBehaviorState); s.AddSingleton(fullNode.BlockStoreManager); s.AddSingleton(fullNode.MempoolManager); s.AddSingleton(fullNode.ConnectionManager); s.AddSingleton(fullNode.Services.ServiceProvider.GetService<IWalletManager>()); var pow = fullNode.Services.ServiceProvider.GetService<PowMining>(); if(pow != null) s.AddSingleton(pow); }); return hostBuilder; } } }
mit
C#
96a764105e9d073ffe95b902a7f9a6629ab1c53c
Update Manifest.cs (#1536)
xkproject/Orchard2,petedavis/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,petedavis/Orchard2,petedavis/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2
src/OrchardCore.Modules/OrchardCore.Media.Azure/Manifest.cs
src/OrchardCore.Modules/OrchardCore.Media.Azure/Manifest.cs
using OrchardCore.Modules.Manifest; [assembly: Module( Name = "Microsoft Azure Media", Author = "The Orchard Team", Website = "http://orchardproject.net", Version = "2.0.0" )] [assembly: Feature( Id = "OrchardCore.Media.Azure.Storage", Name = "Azure Media Storage", Description = "Enables support for storing media files in, and serving them to clients directly from, Microsoft Azure Blob Storage.", Category = "Hosting" )]
using OrchardCore.Modules.Manifest; [assembly: Module( Name = "Microsoft Azure Media", Author = "The Orchard Team", Website = "http://orchardproject.net", Version = "2.0.0" )] [assembly: Feature( Id = "OrchardCore.Media.Azure", Name = "Azure Media Storage", Description = "Enables support for storing media files in, and serving them to clients directly from, Microsoft Azure Blob Storage.", Category = "Hosting" )]
bsd-3-clause
C#
e72a82658c4bb96b0f3886e7436a839d5d651d6c
use HttpClient instead of WebClient
negator92/dnget
Program.cs
Program.cs
using System; using System.IO; using System.Net.Http; using System.Threading.Tasks; namespace dnget { internal static class Program { private const int BufferSize = 256; private static void Main() { Console.WriteLine("Enter source url: "); string remoteUri = Console.ReadLine(); Console.WriteLine("Enter file.name: "); string fileName = Console.ReadLine(); Download(remoteUri, fileName).Wait(); } private static async Task Download(string url, string fileName) { using (var client = new HttpClient()) { Console.WriteLine($"\nDownloading File \"{fileName}\" to {Environment.CurrentDirectory}\nfrom \"{url}\"\n"); using (var fileStream = new FileStream(fileName, FileMode.Create)) using (var stream = await client.GetStreamAsync(url)) { var buffer = new byte[BufferSize]; var read = 0; while ((read = await stream.ReadAsync(buffer, 0, buffer.Length)) != 0) { await fileStream.WriteAsync(buffer, 0, read); Console.Write($"\r{fileStream.Position} bytes read"); if () } } Console.WriteLine($"\nDownload completed"); } } private static String BytesToString(long byteCount) { string[] suf = { "B", "KB", "MB", "GB", "TB", "PB", "EB" }; if (byteCount == 0) return "0" + suf[0]; long bytes = Math.Abs(byteCount); int place = Convert.ToInt32(Math.Floor(Math.Log(bytes, 1024))); double num = Math.Round(bytes / Math.Pow(1024, place), 1); return (Math.Sign(byteCount) * num) + suf[place]; } } }
using System; using System.ComponentModel; using System.Net; namespace dnget { internal static class Program { private static void Main() { Console.WriteLine("Enter source url: "); string remoteUri = Console.ReadLine(); Console.WriteLine("Enter file.name: "); string fileName = Console.ReadLine(); WebClient myWebClient = new WebClient(); Console.WriteLine($"\nDownloading File \"{fileName}\" to {Environment.CurrentDirectory}\nfrom \"{remoteUri}\"\n"); myWebClient.DownloadFileCompleted += Completed; myWebClient.DownloadProgressChanged += ProgressChanged; myWebClient.DownloadFileAsync(new Uri(remoteUri), fileName); Console.ReadKey(); } private static void ProgressChanged(object sender, DownloadProgressChangedEventArgs e) { Console.SetCursorPosition(0, Console.CursorTop); Console.Write($"\rDownloaded {BytesToString(e.BytesReceived)} "); System.Threading.Thread.Sleep(1000); } private static void Completed(object sender, AsyncCompletedEventArgs e) { if (!e.Cancelled) { Console.WriteLine($"\nDownload task completed."); } } private static String BytesToString(long byteCount) { string[] suf = { "B", "KB", "MB", "GB", "TB", "PB", "EB" }; if (byteCount == 0) return "0" + suf[0]; long bytes = Math.Abs(byteCount); int place = Convert.ToInt32(Math.Floor(Math.Log(bytes, 1024))); double num = Math.Round(bytes / Math.Pow(1024, place), 1); return (Math.Sign(byteCount) * num) + suf[place]; } } }
mit
C#
548291b06e8263d12173cdaa2bcdbbfaa05100d0
Use a well-known ReSharper simplification which I think ought to be OK in this case.
ruisebastiao/CefSharp,ITGlobal/CefSharp,VioletLife/CefSharp,AJDev77/CefSharp,ruisebastiao/CefSharp,rlmcneary2/CefSharp,VioletLife/CefSharp,rover886/CefSharp,rover886/CefSharp,Haraguroicha/CefSharp,jamespearce2006/CefSharp,NumbersInternational/CefSharp,illfang/CefSharp,Octopus-ITSM/CefSharp,yoder/CefSharp,ITGlobal/CefSharp,Livit/CefSharp,zhangjingpu/CefSharp,NumbersInternational/CefSharp,dga711/CefSharp,jamespearce2006/CefSharp,gregmartinhtc/CefSharp,jamespearce2006/CefSharp,windygu/CefSharp,dga711/CefSharp,rlmcneary2/CefSharp,joshvera/CefSharp,ITGlobal/CefSharp,windygu/CefSharp,rover886/CefSharp,rlmcneary2/CefSharp,rover886/CefSharp,Haraguroicha/CefSharp,joshvera/CefSharp,joshvera/CefSharp,AJDev77/CefSharp,wangzheng888520/CefSharp,yoder/CefSharp,Haraguroicha/CefSharp,haozhouxu/CefSharp,twxstar/CefSharp,rover886/CefSharp,wangzheng888520/CefSharp,twxstar/CefSharp,haozhouxu/CefSharp,NumbersInternational/CefSharp,twxstar/CefSharp,windygu/CefSharp,ruisebastiao/CefSharp,battewr/CefSharp,dga711/CefSharp,gregmartinhtc/CefSharp,joshvera/CefSharp,ITGlobal/CefSharp,AJDev77/CefSharp,battewr/CefSharp,Livit/CefSharp,Livit/CefSharp,windygu/CefSharp,gregmartinhtc/CefSharp,wangzheng888520/CefSharp,jamespearce2006/CefSharp,VioletLife/CefSharp,illfang/CefSharp,battewr/CefSharp,rlmcneary2/CefSharp,haozhouxu/CefSharp,illfang/CefSharp,Haraguroicha/CefSharp,Octopus-ITSM/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,haozhouxu/CefSharp,yoder/CefSharp,Octopus-ITSM/CefSharp,AJDev77/CefSharp,battewr/CefSharp,wangzheng888520/CefSharp,Octopus-ITSM/CefSharp,illfang/CefSharp,zhangjingpu/CefSharp,ruisebastiao/CefSharp,zhangjingpu/CefSharp,NumbersInternational/CefSharp,dga711/CefSharp,twxstar/CefSharp,Haraguroicha/CefSharp,VioletLife/CefSharp,zhangjingpu/CefSharp,yoder/CefSharp,gregmartinhtc/CefSharp
CefSharp/Internals/JavascriptMember.cs
CefSharp/Internals/JavascriptMember.cs
using System.Runtime.Serialization; namespace CefSharp.Internals { [KnownType(typeof(JavascriptMethod))] [KnownType(typeof(JavascriptProperty))] [DataContract] public class JavascriptMember { [DataMember] public JavascriptMemberDescription Description { get; set; } [DataMember] public long DescriptionId { get; set; } public virtual void Bind( JavascriptObject owner ) { } public override string ToString() { return Description != null ? Description.ToString() : base.ToString(); } } }
using System.Runtime.Serialization; namespace CefSharp.Internals { [KnownType(typeof(JavascriptMethod))] [KnownType(typeof(JavascriptProperty))] [DataContract] public class JavascriptMember { [DataMember] public JavascriptMemberDescription Description { get; set; } [DataMember] public long DescriptionId { get; set; } public virtual void Bind( JavascriptObject owner ) { } public override string ToString() { if (Description != null) { return Description.ToString(); } return base.ToString(); } } }
bsd-3-clause
C#
ce7ec6f1689e0df4edbc0825c4cf11b25e476222
Update version
AppiePau/devshed,AppiePau/devshed-tools
Devshed.Web/Properties/AssemblyInfo.cs
Devshed.Web/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("Devshed.Web")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Devshed.Web")] [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("e3efccd6-1982-44ee-934b-f5c857fe47ea")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.2.0")] [assembly: AssemblyFileVersion("1.5.2.0")] [assembly: InternalsVisibleTo("Devshed.Web.Tests")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Devshed.Web")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Devshed.Web")] [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("e3efccd6-1982-44ee-934b-f5c857fe47ea")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.1.0")] [assembly: AssemblyFileVersion("1.5.1.0")] [assembly: InternalsVisibleTo("Devshed.Web.Tests")]
mit
C#
601dc46ea34dc851e02428d6fb17b74d6c86d3e9
Bump version
kerzyte/OWLib,overtools/OWLib
PackageTool/Properties/AssemblyInfo.cs
PackageTool/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("PackageTool")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PackageTool")] [assembly: AssemblyCopyright("Copyright © 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("71291db4-629c-4d3d-b0d1-14fc9f9fc543")] // 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.1")] [assembly: AssemblyFileVersion("1.0.0.1")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PackageTool")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PackageTool")] [assembly: AssemblyCopyright("Copyright © 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("71291db4-629c-4d3d-b0d1-14fc9f9fc543")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
f8f5162005ff6837e6504f6f5ac847e224f0dea1
Remove unhelpful line of code.
crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin
SignInCheckIn/SignInCheckIn/Startup.cs
SignInCheckIn/SignInCheckIn/Startup.cs
using System; using Microsoft.AspNet.SignalR; using Microsoft.Owin; using Microsoft.Owin.Cors; using Owin; [assembly: OwinStartup(typeof(SignInCheckIn.Startup))] [assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)] namespace SignInCheckIn { public class Startup { public void Configuration(IAppBuilder app) { // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888 // Branch the pipeline here for requests that start with /signalr app.Map("/signalr", map => { // Setup the CORS middleware to run before SignalR. // By default this will allow all origins. You can // configure the set of origins and/or http verbs by // providing a cors options with a different policy. map.UseCors(CorsOptions.AllowAll); // Run the SignalR pipeline. We're not using MapSignalR // since this branch already runs under the /signalr // path. map.RunSignalR(); }); } } }
using System; using Microsoft.AspNet.SignalR; using Microsoft.Owin; using Microsoft.Owin.Cors; using Owin; [assembly: OwinStartup(typeof(SignInCheckIn.Startup))] [assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)] namespace SignInCheckIn { public class Startup { public void Configuration(IAppBuilder app) { GlobalHost.Configuration.TransportConnectTimeout = TimeSpan.FromSeconds(15); // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888 // Branch the pipeline here for requests that start with /signalr app.Map("/signalr", map => { // Setup the CORS middleware to run before SignalR. // By default this will allow all origins. You can // configure the set of origins and/or http verbs by // providing a cors options with a different policy. map.UseCors(CorsOptions.AllowAll); // Run the SignalR pipeline. We're not using MapSignalR // since this branch already runs under the /signalr // path. map.RunSignalR(); }); } } }
bsd-2-clause
C#
40c6574694bdad551e1de47259581ca1eeb66d44
bump logging version
agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov
WebAPI.Common/Logging/LoggingConfig.cs
WebAPI.Common/Logging/LoggingConfig.cs
using System.IO; using System.Web; using Serilog; using Serilog.Core; using Serilog.Events; using Serilog.Sinks.Email; using Serilog.Sinks.GoogleCloudLogging; namespace WebAPI.Common.Logging { public static class LoggingConfig { public static void Register(string name) { var config = new GoogleCloudLoggingSinkOptions { UseJsonOutput = true, LogName = "api.mapserv.utah.gov", UseSourceContextAsLogName = false, ResourceType = "global", ServiceName = "api.mapserv.utah.gov", ServiceVersion = "1.12.5.5" }; #if DEBUG var projectId = "ut-dts-agrc-web-api-dv"; var fileName = "ut-dts-agrc-web-api-dv-log-writer.json"; var serviceAccount = File.ReadAllText(Path.Combine(HttpRuntime.AppDomainAppPath, fileName)); config.GoogleCredentialJson = serviceAccount; #else var projectId = "ut-dts-agrc-web-api-prod"; #endif config.ProjectId = projectId; var email = new EmailConnectionInfo { EmailSubject = "Geocoding Log Email", FromEmail = "noreply@utah.gov", ToEmail = "SGourley@utah.gov" }; var levelSwitch = new LoggingLevelSwitch(); Log.Logger = new LoggerConfiguration() .MinimumLevel.ControlledBy(levelSwitch) .WriteTo.Email(email, restrictedToMinimumLevel: LogEventLevel.Error) .WriteTo.GoogleCloudLogging(config) .CreateLogger(); #if DEBUG levelSwitch.MinimumLevel = LogEventLevel.Verbose; #else levelSwitch.MinimumLevel = LogEventLevel.Information; #endif Log.Debug("Logging initialized"); } } }
using System.IO; using System.Web; using Serilog; using Serilog.Core; using Serilog.Events; using Serilog.Sinks.Email; using Serilog.Sinks.GoogleCloudLogging; namespace WebAPI.Common.Logging { public static class LoggingConfig { public static void Register(string name) { var config = new GoogleCloudLoggingSinkOptions { UseJsonOutput = true, LogName = "api.mapserv.utah.gov", UseSourceContextAsLogName = false, ResourceType = "global", ServiceName = "api.mapserv.utah.gov", ServiceVersion = "1.12.5.4" }; #if DEBUG var projectId = "ut-dts-agrc-web-api-dv"; var fileName = "ut-dts-agrc-web-api-dv-log-writer.json"; var serviceAccount = File.ReadAllText(Path.Combine(HttpRuntime.AppDomainAppPath, fileName)); config.GoogleCredentialJson = serviceAccount; #else var projectId = "ut-dts-agrc-web-api-prod"; #endif config.ProjectId = projectId; var email = new EmailConnectionInfo { EmailSubject = "Geocoding Log Email", FromEmail = "noreply@utah.gov", ToEmail = "SGourley@utah.gov" }; var levelSwitch = new LoggingLevelSwitch(); Log.Logger = new LoggerConfiguration() .MinimumLevel.ControlledBy(levelSwitch) .WriteTo.Email(email, restrictedToMinimumLevel: LogEventLevel.Error) .WriteTo.GoogleCloudLogging(config) .CreateLogger(); #if DEBUG levelSwitch.MinimumLevel = LogEventLevel.Verbose; #else levelSwitch.MinimumLevel = LogEventLevel.Information; #endif Log.Debug("Logging initialized"); } } }
mit
C#
fc79eac727986a61b7545a0dc255e2caf03b312f
Fix compiler error in latest Xamarin.Android
jonathanpeppers/XamChat
XamChat.Droid/Utilities/PushService.cs
XamChat.Droid/Utilities/PushService.cs
using System; using Android.App; using Android.Content; using PushSharp.Client; using XamChat.Core; namespace XamChat.Droid { [Service] public class PushHandlerService : PushHandlerServiceBase { public PushHandlerService() : base (PushConstants.ProjectNumber) { } protected async override void OnRegistered(Context context, string registrationId) { Console.WriteLine("Push successfully registered!"); var loginViewModel = ServiceContainer.Resolve<LoginViewModel>(); try { await loginViewModel.RegisterPush(registrationId); } catch (Exception exc) { Console.WriteLine("Error registering push: " + exc); } } protected override void OnMessage(Context context, Intent intent) { //Pull out the notification details string title = intent.Extras.GetString("title"); string message = intent.Extras.GetString("message"); //Create a new intent intent = new Intent(this, typeof(ConversationsActivity)); //Create the notification var notification = new Notification( Android.Resource.Drawable.SymActionEmail, title); notification.Flags = NotificationFlags.AutoCancel; notification.SetLatestEventInfo(this, new Java.Lang.String(title), new Java.Lang.String(message), PendingIntent.GetActivity(this, 0, intent, 0)); //Send the notification through the NotificationManager var notificationManager = GetSystemService( Context.NotificationService) as NotificationManager; notificationManager.Notify(1, notification); } protected override void OnUnRegistered(Context context, string registrationId) { Console.WriteLine("Push unregistered!"); } protected override void OnError(Context context, string errorId) { Console.WriteLine("Push error: " + errorId); } } }
using System; using Android.App; using Android.Content; using PushSharp.Client; using XamChat.Core; namespace XamChat.Droid { [Service] public class PushHandlerService : PushHandlerServiceBase { public PushHandlerService() : base (PushConstants.ProjectNumber) { } protected async override void OnRegistered(Context context, string registrationId) { Console.WriteLine("Push successfully registered!"); var loginViewModel = ServiceContainer.Resolve<LoginViewModel>(); try { await loginViewModel.RegisterPush(registrationId); } catch (Exception exc) { Console.WriteLine("Error registering push: " + exc); } } protected override void OnMessage(Context context, Intent intent) { //Pull out the notification details string title = intent.Extras.GetString("title"); string message = intent.Extras.GetString("message"); //Create a new intent intent = new Intent(this, typeof(ConversationsActivity)); //Create the notification var notification = new Notification( Android.Resource.Drawable.SymActionEmail, title); notification.Flags = NotificationFlags.AutoCancel; notification.SetLatestEventInfo(this, title, message, PendingIntent.GetActivity(this, 0, intent, 0)); //Send the notification through the NotificationManager var notificationManager = GetSystemService( Context.NotificationService) as NotificationManager; notificationManager.Notify(1, notification); } protected override void OnUnRegistered(Context context, string registrationId) { Console.WriteLine("Push unregistered!"); } protected override void OnError(Context context, string errorId) { Console.WriteLine("Push error: " + errorId); } } }
apache-2.0
C#
7ed9fbb9ed12313636be6e86c4dde61a1e92b72b
Add main
HelloKitty/Booma.Proxy
tests/Booma.Proxy.TestClient/Program.cs
tests/Booma.Proxy.TestClient/Program.cs
namespace Booma.Proxy.TestClient { class Program { public static void Main(string[] args) { } } }

agpl-3.0
C#
d8d8d3c0f158d9619b32c5240e67651f8d48e7a3
Fix configuration registration
Vtek/FacesToSmileys
FacesToSmileys/App.cs
FacesToSmileys/App.cs
using Autofac; using FacesToSmileys.Views; using FacesToSmileys.ViewModels; using Xamarin.Forms; using FacesToSmileys.Services.Implementations; using FacesToSmileys.Services; namespace FacesToSmileys { public class App : Application { public App() { var builder = new ContainerBuilder(); builder.RegisterType<DetectionService>().As<IDetectionService>(); builder.RegisterType<FileService>().As<IFileService>(); builder.RegisterType<ImageProcessingService>().As<IImageProcessingService>(); builder.RegisterType<PhotoService>().As<IPhotoService>(); builder.RegisterType<AnalyticSercice>().As<IAnalyticService>(); builder.RegisterType<ConfigurationService>().As<IConfigurationService>(); builder.RegisterType<TakePhotoViewModel>().OnActivated(e => e.Context.InjectUnsetProperties(e.Instance)); var container = builder.Build(); MainPage = new TakePhotoView { BindingContext = container.Resolve<TakePhotoViewModel>() }; } } }
using Autofac; using FacesToSmileys.Views; using FacesToSmileys.ViewModels; using Xamarin.Forms; using FacesToSmileys.Services.Implementations; using FacesToSmileys.Services; namespace FacesToSmileys { public class App : Application { public App() { var builder = new ContainerBuilder(); builder.RegisterType<DetectionService>().As<IDetectionService>(); builder.RegisterType<FileService>().As<IFileService>(); builder.RegisterType<ImageProcessingService>().As<IImageProcessingService>(); builder.RegisterType<PhotoService>().As<IPhotoService>(); builder.RegisterType<AnalyticSercice>().As<IAnalyticService>(); builder.RegisterType<TakePhotoViewModel>().OnActivated(e => e.Context.InjectUnsetProperties(e.Instance)); var container = builder.Build(); MainPage = new TakePhotoView { BindingContext = container.Resolve<TakePhotoViewModel>() }; } } }
mit
C#
6a587e18a17f2e9aa0091180698c8b525e49e6c1
Read dependencies from XML parser
SceneGate/Yarhl
FileInfoCollection.cs
FileInfoCollection.cs
// // FileInfoCollection.cs // // Author: // Benito Palacios Sánchez <benito356@gmail.com> // // Copyright (c) 2014 Benito Palacios Sánchez // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System.Collections.Generic; using System.Linq; using System.Xml.Linq; namespace Libgame { public class FileInfoCollection { readonly Dictionary<string, FileInfo> treasureMap; public FileInfoCollection() { treasureMap = new Dictionary<string, FileInfo>(); } public static FileInfoCollection FromXml(XDocument xmlGame) { var collection = new FileInfoCollection(); XElement files = xmlGame.Root.Element("Files"); foreach (XElement fileInfo in files.Elements("FileInfo")) { var info = new FileInfo(); info.Path = fileInfo.Element("Path").Value; info.Type = fileInfo.Element("Type").Value; info.Parameters = fileInfo.Element("Parameters"); fileInfo.Elements("DependsOn") .InDocumentOrder() .All(d => { info.AddDependency(d.Value); return true; }); collection.AddFileInfo(info); } return collection; } public bool Contains(string path) { return treasureMap.ContainsKey(path); } public void AddFileInfo(FileInfo info) { treasureMap.Add(info.Path, info); } public FileInfo GetFileInfo(string path) { return treasureMap[path]; } public FileInfo this[string path] { get { return treasureMap[path]; } set { treasureMap.Add(path, value); } } } }
// // FileInfoCollection.cs // // Author: // Benito Palacios Sánchez <benito356@gmail.com> // // Copyright (c) 2014 Benito Palacios Sánchez // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.Collections.Generic; using System.Xml.Linq; namespace Libgame { public class FileInfoCollection { private Dictionary<string, FileInfo> treasureMap; public FileInfoCollection() { this.treasureMap = new Dictionary<string, FileInfo>(); } public static FileInfoCollection FromXml(XDocument xmlGame) { FileInfoCollection collection = new FileInfoCollection(); XElement files = xmlGame.Root.Element("Files"); foreach (XElement fileInfo in files.Elements("FileInfo")) { FileInfo info = new FileInfo(); info.Path = fileInfo.Element("Path").Value; info.Type = fileInfo.Element("Type").Value; info.Parameters = fileInfo.Element("Parameters"); collection.AddFileInfo(info); } return collection; } public bool Contains(string path) { return this.treasureMap.ContainsKey(path); } public void AddFileInfo(FileInfo info) { this.treasureMap.Add(info.Path, info); } public FileInfo GetFileInfo(string path) { return this.treasureMap[path]; } public FileInfo this[string path] { get { return this.treasureMap[path]; } set { this.treasureMap.Add(path, value); } } } }
mit
C#
555996b133cf1ebce62a70c771df5059957a0512
Remove test fire schedule for eval due
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Jobs/JobHandler.cs
Battery-Commander.Web/Jobs/JobHandler.cs
using FluentScheduler; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Logging; using System; namespace BatteryCommander.Web.Jobs { internal static class JobHandler { public static void UseJobScheduler(this IApplicationBuilder app, ILoggerFactory loggerFactory) { var logger = loggerFactory.CreateLogger(typeof(JobHandler)); JobManager.JobStart += (job) => logger.LogInformation("{job} started", job.Name); JobManager.JobEnd += (job) => logger.LogInformation("{job} completed in {time}", job.Name, job.Duration); JobManager.JobException += (context) => logger.LogError(context.Exception, "{job} failed", context.Name); JobManager.UseUtcTime(); JobManager.JobFactory = new JobFactory(app.ApplicationServices); var registry = new Registry(); registry.Schedule<SqliteBackupJob>().ToRunEvery(1).Days().At(hours: 11, minutes: 0); registry.Schedule<EvaluationDueReminderJob>().ToRunEvery(1).Weeks().On(DayOfWeek.Friday).At(hours: 12, minutes: 0); JobManager.Initialize(registry); } private class JobFactory : IJobFactory { private readonly IServiceProvider serviceProvider; public JobFactory(IServiceProvider serviceProvider) { this.serviceProvider = serviceProvider; } public IJob GetJobInstance<T>() where T : IJob { return serviceProvider.GetService(typeof(T)) as IJob; } } } }
using FluentScheduler; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Logging; using System; namespace BatteryCommander.Web.Jobs { internal static class JobHandler { public static void UseJobScheduler(this IApplicationBuilder app, ILoggerFactory loggerFactory) { var logger = loggerFactory.CreateLogger(typeof(JobHandler)); JobManager.JobStart += (job) => logger.LogInformation("{job} started", job.Name); JobManager.JobEnd += (job) => logger.LogInformation("{job} completed in {time}", job.Name, job.Duration); JobManager.JobException += (context) => logger.LogError(context.Exception, "{job} failed", context.Name); JobManager.UseUtcTime(); JobManager.JobFactory = new JobFactory(app.ApplicationServices); var registry = new Registry(); registry.Schedule<SqliteBackupJob>().ToRunEvery(1).Days().At(hours: 11, minutes: 0); registry.Schedule<EvaluationDueReminderJob>().ToRunNow(); // registry.Schedule<EvaluationDueReminderJob>().ToRunEvery(1).Weeks().On(DayOfWeek.Friday).At(hours: 12, minutes: 0); JobManager.Initialize(registry); } private class JobFactory : IJobFactory { private readonly IServiceProvider serviceProvider; public JobFactory(IServiceProvider serviceProvider) { this.serviceProvider = serviceProvider; } public IJob GetJobInstance<T>() where T : IJob { return serviceProvider.GetService(typeof(T)) as IJob; } } } }
mit
C#
fa20a8e40c24f03a5eae4ab9a4f67d25dd0b551b
Add test for #1. Cleanup tests.
slahn/nonin
Nonin.Tests/Parsing.cs
Nonin.Tests/Parsing.cs
using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Nonin.Tests { [TestFixture] public class Parsing { [Test] public void EdgeCases() { // Issue #1 var tc1854 = new TestData.TestCase() { Number = "03125463265", NumberKind = NinKind.BirthNumber, DateOfBirth = new DateTime(1854, 12, 3), Gender = Gender.Female }; RunTests(tc1854); } [Test] public void AllGeneratedParsingTests() { foreach (var testcase in TestData.AllTestCases()) { RunTests(testcase); } } private void RunTests(TestData.TestCase testcase) { var nin = new Nin(testcase.Number); TestDateOfBirth(testcase, nin); TestNumberType(testcase, nin); TestGender(testcase, nin); TestLongConversion(testcase, nin); TestStringConversion(testcase, nin); } private void TestStringConversion(TestData.TestCase n, Nin f) { Assert.AreEqual(n.Number, f.ToString(), "ToString in " + n.Number); } private void TestLongConversion(TestData.TestCase n, Nin f) { var l = Convert.ToInt64(n.Number); Assert.AreEqual(l, f.ToNumber(), "ToNumber in " + n.Number); } private void TestGender(TestData.TestCase n, Nin f) { Assert.AreEqual(n.Gender, f.Gender, "Gender in " + n.Number); } private void TestNumberType(TestData.TestCase n, Nin f) { Assert.AreEqual(n.NumberKind, f.Kind, "Type in " + n.Number); } private void TestDateOfBirth(TestData.TestCase n, Nin f) { Assert.AreEqual(n.DateOfBirth, f.DateOfBirth, "DoB in " + n.Number); } } }
using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Nonin.Tests { [TestFixture] public class Parsing { [Test] public void AllParsingTests() { foreach (var n in TestData.AllTestCases()) { var f = new Nin(n.Number); TestDateOfBirth(n, f); TestNumberType(n, f); TestGender(n, f); TestLongConversion(n, f); TestStringConversion(n, f); } } private void TestStringConversion(TestData.TestCase n, Nin f) { Assert.AreEqual(n.Number, f.ToString(), "ToString in " + n.Number); } private void TestLongConversion(TestData.TestCase n, Nin f) { var l = Convert.ToInt64(n.Number); Assert.AreEqual(l, f.ToNumber(), "ToNumber in " + n.Number); } private void TestGender(TestData.TestCase n, Nin f) { Assert.AreEqual(n.Gender, f.Gender, "Gender in " + n.Number); } private void TestNumberType(TestData.TestCase n, Nin f) { Assert.AreEqual(n.NumberKind, f.Kind, "Type in " + n.Number); } private void TestDateOfBirth(TestData.TestCase n, Nin f) { Assert.AreEqual(n.DateOfBirth, f.DateOfBirth, "DoB in " + n.Number); } } }
mit
C#
e15467d4e95f92c0f105c99a19c870aa877cf7a9
Fix build
Fody/LoadAssembliesOnStartup
build.cake
build.cake
//======================================================= // DEFINE PARAMETERS //======================================================= // Define the required parameters var Parameters = new Dictionary<string, object>(); Parameters["SolutionName"] = "LoadAssembliesOnStartup.Fody"; Parameters["Company"] = "Fody"; Parameters["RepositoryUrl"] = string.Format("https://github.com/{0}/{1}", GetBuildServerVariable("SolutionName"), GetBuildServerVariable("SolutionName")); Parameters["StartYear"] = "2015"; Parameters["UseVisualStudioPrerelease"] = "true"; // Note: the rest of the variables should be coming from the build server, // see `/deployment/cake/*-variables.cake` for customization options // // If required, more variables can be overridden by specifying them via the // Parameters dictionary, but the build server variables will always override // them if defined by the build server. For example, to override the code // sign wild card, add this to build.cake // // Parameters["CodeSignWildcard"] = "Orc.EntityFramework"; //======================================================= // DEFINE COMPONENTS TO BUILD / PACKAGE //======================================================= Components.Add("LoadAssembliesOnStartup.Fody"); TestProjects.Add(string.Format("{0}.Tests", GetBuildServerVariable("SolutionName"))); //======================================================= // REQUIRED INITIALIZATION, DO NOT CHANGE //======================================================= // Now all variables are defined, include the tasks, that // script will take care of the rest of the magic #l "./deployment/cake/tasks.cake"
//======================================================= // DEFINE PARAMETERS //======================================================= // Define the required parameters var Parameters = new Dictionary<string, object>(); Parameters["SolutionName"] = "LoadAssembliesOnStartup.Fody"; Parameters["Company"] = "Fody"; Parameters["RepositoryUrl"] = string.Format("https://github.com/{0}/{1}", GetBuildServerVariable("SolutionName"), GetBuildServerVariable("SolutionName")); Parameters["StartYear"] = "2015"; Parameters["TestTargetFramework"] = "net462"; Parameters["UseVisualStudioPrerelease"] = "true"; // Note: the rest of the variables should be coming from the build server, // see `/deployment/cake/*-variables.cake` for customization options // // If required, more variables can be overridden by specifying them via the // Parameters dictionary, but the build server variables will always override // them if defined by the build server. For example, to override the code // sign wild card, add this to build.cake // // Parameters["CodeSignWildcard"] = "Orc.EntityFramework"; //======================================================= // DEFINE COMPONENTS TO BUILD / PACKAGE //======================================================= Components.Add("LoadAssembliesOnStartup.Fody"); TestProjects.Add(string.Format("{0}.Tests", GetBuildServerVariable("SolutionName"))); //======================================================= // REQUIRED INITIALIZATION, DO NOT CHANGE //======================================================= // Now all variables are defined, include the tasks, that // script will take care of the rest of the magic #l "./deployment/cake/tasks.cake"
mit
C#
1f13b94c729302707b59e60cbd84073708e16a28
Fix build error
smoogipooo/osu,peppy/osu,EVAST9919/osu,2yangk23/osu,peppy/osu,NeoAdonis/osu,ppy/osu,EVAST9919/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,NeoAdonis/osu,NeoAdonis/osu,2yangk23/osu,ZLima12/osu,UselessToucan/osu,smoogipoo/osu,ZLima12/osu,peppy/osu-new,smoogipoo/osu,peppy/osu
osu.Game/Rulesets/Mods/ModBlockFail.cs
osu.Game/Rulesets/Mods/ModBlockFail.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.Bindables; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Mods { public abstract class ModBlockFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig { private Bindable<bool> hideHealthBar; /// <summary> /// We never fail, 'yo. /// </summary> public bool AllowFail => false; public void ReadFromConfig(OsuConfigManager config) { hideHealthBar = config.GetBindable<bool>(OsuSetting.HideHealthBarWhenCantFail); } public void ApplyToHUD(HUDOverlay overlay) { hideHealthBar.BindValueChanged(v => overlay.HealthDisplay.FadeTo(v.NewValue ? 0 : 1, 250, Easing.OutQuint), true); } } }
// 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.Bindables; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Mods { public abstract class ModBlockFail : Mod, IApplicableFailOverride, IApplicableToHUD, IReadFromConfig { private Bindable<bool> hideHealthBar; /// <summary> /// We never fail, 'yo. /// </summary> public bool AllowFail => false; public void ReadFromConfig(OsuConfigManager config) { hideHealthBar = config.GetBindable<bool>(OsuSetting.HideHealthBarWhenCantFail); } public void ApplyToHUD(HUDOverlay overlay) { hideHealthBar.BindValueChanged(v => healthDisplay.FadeTo(v.NewValue ? 0 : 1, 250, Easing.OutQuint), true); } } }
mit
C#
7e009f616845718cc124c68b900ad4c57382a7fe
Add full xmldoc
NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu
osu.Game/Screens/Play/GameplayState.cs
osu.Game/Screens/Play/GameplayState.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mods; #nullable enable namespace osu.Game.Screens.Play { /// <summary> /// The state of an active gameplay session, generally constructed and exposed by <see cref="Player"/>. /// </summary> public class GameplayState { /// <summary> /// The final post-convert post-mod-application beatmap. /// </summary> public readonly IBeatmap Beatmap; /// <summary> /// The ruleset used in gameplay. /// </summary> public readonly Ruleset Ruleset; /// <summary> /// The mods applied to the gameplay. /// </summary> public IReadOnlyList<Mod> Mods; /// <summary> /// A bindable tracking the last judgement result applied to any hit object. /// </summary> public IBindable<JudgementResult> LastJudgementResult => lastJudgementResult; private readonly Bindable<JudgementResult> lastJudgementResult = new Bindable<JudgementResult>(); public GameplayState(IBeatmap beatmap, Ruleset ruleset, IReadOnlyList<Mod> mods) { Beatmap = beatmap; Ruleset = ruleset; Mods = mods; } /// <summary> /// Applies the score change of a <see cref="JudgementResult"/> to this <see cref="GameplayState"/>. /// </summary> /// <param name="result">The <see cref="JudgementResult"/> to apply.</param> public void ApplyResult(JudgementResult result) => lastJudgementResult.Value = result; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mods; #nullable enable namespace osu.Game.Screens.Play { public class GameplayState { /// <summary> /// The final post-convert post-mod-application beatmap. /// </summary> public readonly IBeatmap Beatmap; public readonly Ruleset Ruleset; public IReadOnlyList<Mod> Mods; public GameplayState(IBeatmap beatmap, Ruleset ruleset, IReadOnlyList<Mod> mods) { Beatmap = beatmap; Ruleset = ruleset; Mods = mods; } private readonly Bindable<JudgementResult> lastJudgementResult = new Bindable<JudgementResult>(); public IBindable<JudgementResult> LastJudgementResult => lastJudgementResult; public void ApplyResult(JudgementResult result) => lastJudgementResult.Value = result; } }
mit
C#
67b58f88331085602cb74c007f20dcd0c4d73e60
Update assembly info - copyright date
JeremyAnsel/helix-toolkit,holance/helix-toolkit,helix-toolkit/helix-toolkit,chrkon/helix-toolkit
Source/AssemblyInfo.cs
Source/AssemblyInfo.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="GlobalAssemblyInfo.cs" company="Helix Toolkit"> // Copyright (c) 2014 Helix Toolkit contributors // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System.Reflection; [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Helix Toolkit")] [assembly: AssemblyCompany("Helix Toolkit")] [assembly: AssemblyCopyright("Copyright (C) Helix Toolkit 2019.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The version numbers are patched by GitVersion, see the `before_build` step in appveyor.yml [assembly: AssemblyVersion("0.0.0.1")] [assembly: AssemblyFileVersion("0.0.0.1")]
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="GlobalAssemblyInfo.cs" company="Helix Toolkit"> // Copyright (c) 2014 Helix Toolkit contributors // </copyright> // -------------------------------------------------------------------------------------------------------------------- using System.Reflection; [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Helix Toolkit")] [assembly: AssemblyCompany("Helix Toolkit")] [assembly: AssemblyCopyright("Copyright (C) Helix Toolkit 2018.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The version numbers are patched by GitVersion, see the `before_build` step in appveyor.yml [assembly: AssemblyVersion("0.0.0.1")] [assembly: AssemblyFileVersion("0.0.0.1")]
mit
C#
a0475081406b0d283af3f6cf7ab9320bdcb5816a
use ConditionalWeakTable in a thread-safe manner
AngleSharp/AngleSharp.Scripting,AngleSharp/AngleSharp.Scripting
src/AngleSharp.Scripting.JavaScript/ReferenceCache.cs
src/AngleSharp.Scripting.JavaScript/ReferenceCache.cs
namespace AngleSharp.Scripting.JavaScript { using System; using System.Runtime.CompilerServices; sealed class ReferenceCache { private readonly ConditionalWeakTable<Object, DomNodeInstance> _references; public ReferenceCache() { _references = new ConditionalWeakTable<Object, DomNodeInstance>(); } public DomNodeInstance GetOrCreate(Object obj, Func<Object, DomNodeInstance> creator) { return _references.GetValue(obj, creator.Invoke); } } }
namespace AngleSharp.Scripting.JavaScript { using System; using System.Runtime.CompilerServices; sealed class ReferenceCache { private readonly ConditionalWeakTable<Object, DomNodeInstance> _references; public ReferenceCache() { _references = new ConditionalWeakTable<Object, DomNodeInstance>(); } public DomNodeInstance GetOrCreate(Object obj, Func<Object, DomNodeInstance> creator) { var instance = default(DomNodeInstance); if (!_references.TryGetValue(obj, out instance)) { instance = creator.Invoke(obj); _references.Add(obj, instance); } return instance; } } }
mit
C#
398fcdd47047570b8d4a0dc1c2aad1e0a8374061
Support for interval schedule
CSGOpenSource/elasticsearch-watcher-net,CSGOpenSource/elasticsearch-watcher-net,aochsner/elasticsearch-watcher-net,aochsner/elasticsearch-watcher-net
src/Nest.Watcher/Domain/Schedule/ScheduleContainer.cs
src/Nest.Watcher/Domain/Schedule/ScheduleContainer.cs
using Nest.Resolvers.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Nest { [JsonObject] [JsonConverter(typeof(ReadAsTypeConverter<ScheduleContainer>))] public interface IScheduleContainer : INestSerializable { [JsonProperty("daily")] IDailySchedule Daily { get; set; } [JsonProperty("monthly")] IMonthlySchedule Monthly { get; set; } [JsonProperty("hourly")] IHourlySchedule Hourly { get; set; } [JsonProperty("weekly")] IWeeklySchedule Weekly { get; set; } [JsonProperty("yearly")] IYearlySchedule Yearly { get; set; } [JsonProperty("cron")] string Cron { get; set; } [JsonProperty("interval")] string Interval { get; set; } } public class ScheduleContainer : TriggerBase, IScheduleContainer { public ScheduleContainer() { } public ScheduleContainer(ScheduleBase schedule) { schedule.ContainIn(this); } public IDailySchedule Daily { get; set; } public IMonthlySchedule Monthly { get; set; } public IHourlySchedule Hourly { get; set; } public IWeeklySchedule Weekly { get; set; } public IYearlySchedule Yearly { get; set; } public string Cron { get; set; } public string Interval { get; set; } internal override void ContainIn(ITriggerContainer container) { container.Schedule = this; } } public class ScheduleDescriptor : ScheduleContainer { private IScheduleContainer Self { get { return this; } } public ScheduleDescriptor Daily(Func<DailyScheduleDescriptor, IDailySchedule> selector) { this.Self.Daily = selector(new DailyScheduleDescriptor()); return this; } public ScheduleDescriptor Hourly(Func<HourlyScheduleDescriptor, IHourlySchedule> selector) { this.Self.Hourly = selector(new HourlyScheduleDescriptor()); return this; } public ScheduleDescriptor Monthly(Func<MonthlyScheduleDescriptor, IMonthlySchedule> selector) { this.Self.Monthly = selector(new MonthlyScheduleDescriptor()); return this; } public ScheduleDescriptor Weekly(Func<WeeklyScheduleDescriptor, IWeeklySchedule> selector) { this.Self.Weekly = selector(new WeeklyScheduleDescriptor()); return this; } public ScheduleDescriptor Yearly(Func<YearlyScheduleDescriptor, IYearlySchedule> selector) { this.Self.Yearly = selector(new YearlyScheduleDescriptor()); return this; } public ScheduleDescriptor Cron(string cron) { this.Self.Cron = cron; return this; } public ScheduleDescriptor Interval(string interval) { this.Self.Interval = interval; return this; } } }
using Nest.Resolvers.Converters; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Nest { [JsonObject] [JsonConverter(typeof(ReadAsTypeConverter<ScheduleContainer>))] public interface IScheduleContainer : INestSerializable { [JsonProperty("daily")] IDailySchedule Daily { get; set; } [JsonProperty("monthly")] IMonthlySchedule Monthly { get; set; } [JsonProperty("hourly")] IHourlySchedule Hourly { get; set; } [JsonProperty("weekly")] IWeeklySchedule Weekly { get; set; } [JsonProperty("yearly")] IYearlySchedule Yearly { get; set; } [JsonProperty("cron")] string Cron { get; set; } } public class ScheduleContainer : TriggerBase, IScheduleContainer { public ScheduleContainer() { } public ScheduleContainer(ScheduleBase schedule) { schedule.ContainIn(this); } public IDailySchedule Daily { get; set; } public IMonthlySchedule Monthly { get; set; } public IHourlySchedule Hourly { get; set; } public IWeeklySchedule Weekly { get; set; } public IYearlySchedule Yearly { get; set; } public string Cron { get; set; } internal override void ContainIn(ITriggerContainer container) { container.Schedule = this; } } public class ScheduleDescriptor : ScheduleContainer { private IScheduleContainer Self { get { return this; } } public ScheduleDescriptor Daily(Func<DailyScheduleDescriptor, IDailySchedule> selector) { this.Self.Daily = selector(new DailyScheduleDescriptor()); return this; } public ScheduleDescriptor Hourly(Func<HourlyScheduleDescriptor, IHourlySchedule> selector) { this.Self.Hourly = selector(new HourlyScheduleDescriptor()); return this; } public ScheduleDescriptor Monthly(Func<MonthlyScheduleDescriptor, IMonthlySchedule> selector) { this.Self.Monthly = selector(new MonthlyScheduleDescriptor()); return this; } public ScheduleDescriptor Weekly(Func<WeeklyScheduleDescriptor, IWeeklySchedule> selector) { this.Self.Weekly = selector(new WeeklyScheduleDescriptor()); return this; } public ScheduleDescriptor Yearly(Func<YearlyScheduleDescriptor, IYearlySchedule> selector) { this.Self.Yearly = selector(new YearlyScheduleDescriptor()); return this; } public ScheduleDescriptor Cron(string cron) { this.Self.Cron = cron; return this; } } }
apache-2.0
C#
cfe6112fbf3f3aa838df2b9151f0c62fdfe9d856
Update NewTask.cs
rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials
dotnet/NewTask/NewTask.cs
dotnet/NewTask/NewTask.cs
using System; using RabbitMQ.Client; using System.Text; class NewTask { public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; using(var connection = factory.CreateConnection()) using(var channel = connection.CreateModel()) { channel.QueueDeclare(queue: "task_queue", durable: true, exclusive: false, autoDelete: false, arguments: null); var message = GetMessage(args); var body = Encoding.UTF8.GetBytes(message); var properties = channel.CreateBasicProperties(); properties.Persistent = true; channel.BasicPublish(exchange: "", routingKey: "task_queue", basicProperties: properties, body: body); Console.WriteLine(" [x] Sent {0}", message); } Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } private static string GetMessage(string[] args) { return ((args.Length > 0) ? string.Join(" ", args) : "Hello World!"); } }
using System; using RabbitMQ.Client; using System.Text; class NewTask { public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; using(var connection = factory.CreateConnection()) using(var channel = connection.CreateModel()) { channel.QueueDeclare(queue: "task_queue", durable: true, exclusive: false, autoDelete: false, arguments: null); var message = GetMessage(args); var body = Encoding.UTF8.GetBytes(message); var properties = channel.CreateBasicProperties(); properties.SetPersistent(true); channel.BasicPublish(exchange: "", routingKey: "task_queue", basicProperties: properties, body: body); Console.WriteLine(" [x] Sent {0}", message); } Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } private static string GetMessage(string[] args) { return ((args.Length > 0) ? string.Join(" ", args) : "Hello World!"); } }
apache-2.0
C#
eb93d800c24e5a542fe6b256079002d2a1f831f1
Update PointerProfileTests.cs
DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
Assets/MRTK/Tests/PlayModeTests/PointerProfileTests.cs
Assets/MRTK/Tests/PlayModeTests/PointerProfileTests.cs
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Input; using NUnit.Framework; using System.Collections; using UnityEditor; using UnityEngine.TestTools; namespace Microsoft.MixedReality.Toolkit.Tests { class PointerProfileTests { // Assets/MRTK/Examples/Demos/EyeTracking/General/Profiles/EyeTrackingDemoConfigurationProfile.asset private const string eyeTrackingConfigurationProfileGuid = "6615cacb3eaaa044f99b917186093aeb"; private static readonly string eyeTrackingConfigurationProfilePath = AssetDatabase.GUIDToAssetPath(eyeTrackingConfigurationProfileGuid); [UnitySetUp] public IEnumerator Setup() { PlayModeTestUtilities.Setup(); TestUtilities.PlayspaceToOriginLookingForward(); yield return null; } [UnityTearDown] public IEnumerator TearDown() { PlayModeTestUtilities.TearDown(); yield return null; } // <summary> /// Verifies if eye tracking configuration is correctly applied at gaze provider initialization. /// </summary> [UnityTest] public IEnumerator TestGazeProviderEyeTrackingConfiguration() { // Default configuration profile should set head based gaze var eyeGazeProvider = CoreServices.InputSystem.GazeProvider as IMixedRealityEyeGazeProvider; Assert.IsFalse(eyeGazeProvider.IsEyeTrackingEnabled, "Use eye tracking should be set to false"); // Eye tracking configuration profile should set eye based gaze var profile = AssetDatabase.LoadAssetAtPath(eyeTrackingConfigurationProfilePath, typeof(MixedRealityToolkitConfigurationProfile)) as MixedRealityToolkitConfigurationProfile; MixedRealityToolkit.Instance.ActiveProfile = profile; yield return null; yield return null; eyeGazeProvider = CoreServices.InputSystem.GazeProvider as IMixedRealityEyeGazeProvider; Assert.IsTrue(eyeGazeProvider.IsEyeTrackingEnabled, "Use eye tracking should be set to true"); } } }
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Input; using NUnit.Framework; using System.Collections; using UnityEditor; using UnityEngine.TestTools; namespace Microsoft.MixedReality.Toolkit.Tests { class PointerProfileTests { // Assets/MRTK/Examples/Demos/EyeTracking/General/Profiles/EyeTrackingDemoConfigurationProfile.asset private const string eyeTrackingConfigurationProfileGuid = "6615cacb3eaaa044f99b917186093aeb"; private static readonly string eyeTrackingConfigurationProfilePath = AssetDatabase.GUIDToAssetPath(eyeTrackingConfigurationProfileGuid); [UnitySetUp] public IEnumerator Setup() { PlayModeTestUtilities.Setup(); TestUtilities.PlayspaceToOriginLookingForward(); yield return null; } [UnityTearDown] public IEnumerator TearDown() { PlayModeTestUtilities.TearDown(); yield return null; } // <summary> /// Verifies if eye tracking configuration is correctly applied at gaze provider initialization. /// </summary> [Test] public void TestGazeProviderEyeTrackingConfiguration() { // Default configuration profile should set head based gaze var eyeGazeProvider = CoreServices.InputSystem.GazeProvider as IMixedRealityEyeGazeProvider; Assert.IsFalse(eyeGazeProvider.IsEyeTrackingEnabled, "Use eye tracking should be set to false"); // Eye tracking configuration profile should set eye based gaze var profile = AssetDatabase.LoadAssetAtPath(eyeTrackingConfigurationProfilePath, typeof(MixedRealityToolkitConfigurationProfile)) as MixedRealityToolkitConfigurationProfile; MixedRealityToolkit.Instance.ResetConfiguration(profile); Assert.IsTrue(eyeGazeProvider.IsEyeTrackingEnabled, "Use eye tracking should be set to true"); } } }
mit
C#
d50fb51d8847f6c01630c0a5e26e4a7574db21ba
remove unused ns
Research-Institute/json-api-dotnet-core,Research-Institute/json-api-dotnet-core,json-api-dotnet/JsonApiDotNetCore
test/JsonApiDotNetCoreExampleTests/Acceptance/Extensibility/CustomErrorTests.cs
test/JsonApiDotNetCoreExampleTests/Acceptance/Extensibility/CustomErrorTests.cs
using Newtonsoft.Json; using JsonApiDotNetCore.Internal; using JsonApiDotNetCore.Serialization; using Xunit; namespace JsonApiDotNetCoreExampleTests.Acceptance.Extensibility { public class CustomErrorTests { [Fact] public void Can_Return_Custom_Error_Types() { // arrange var error = new CustomError("507", "title", "detail", "custom"); var errorCollection = new ErrorCollection(); errorCollection.Add(error); var expectedJson = JsonConvert.SerializeObject(new { errors = new dynamic[] { new { myCustomProperty = "custom", title = "title", detail = "detail", status = "507" } } }); // act var result = new JsonApiSerializer(null, null, null) .Serialize(errorCollection); // assert Assert.Equal(expectedJson, result); } class CustomError : Error { public CustomError(string status, string title, string detail, string myProp) : base(status, title, detail) { MyCustomProperty = myProp; } public string MyCustomProperty { get; set; } } } }
using DotNetCoreDocs; using JsonApiDotNetCoreExample; using DotNetCoreDocs.Writers; using Newtonsoft.Json; using JsonApiDotNetCore.Internal; using JsonApiDotNetCore.Serialization; using Xunit; using System.Diagnostics; namespace JsonApiDotNetCoreExampleTests.Acceptance.Extensibility { public class CustomErrorTests { [Fact] public void Can_Return_Custom_Error_Types() { // while(!Debugger.IsAttached) { bool stop = false; } // arrange var error = new CustomError("507", "title", "detail", "custom"); var errorCollection = new ErrorCollection(); errorCollection.Add(error); var expectedJson = JsonConvert.SerializeObject(new { errors = new dynamic[] { new { myCustomProperty = "custom", title = "title", detail = "detail", status = "507" } } }); // act var result = new JsonApiSerializer(null, null, null) .Serialize(errorCollection); // assert Assert.Equal(expectedJson, result); } class CustomError : Error { public CustomError(string status, string title, string detail, string myProp) : base(status, title, detail) { MyCustomProperty = myProp; } public string MyCustomProperty { get; set; } } } }
mit
C#
0b1b1433f057aeacf032c7010ef290f9a8e631df
Clean up UserController.cs
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
src/AtomicChessPuzzles/Controllers/UserController.cs
src/AtomicChessPuzzles/Controllers/UserController.cs
using AtomicChessPuzzles.DbRepositories; using Microsoft.AspNet.Mvc; using System; namespace AtomicChessPuzzles.Controllers { public class UserController : Controller { IUserRepository userRepository; public UserController(IUserRepository _userRepository) { userRepository = _userRepository; } [HttpGet] [Route("/User/Register")] public IActionResult Register() { return View(); } [HttpPost] [Route("/User/New", Name = "NewUser")] public IActionResult New(string username, string email, string password) { Tuple<string, string> hashAndSalt = PasswordUtilities.HashPassword(password); string hash = hashAndSalt.Item1; string salt = hashAndSalt.Item2; Models.User user = new Models.User(); user.Username = username; user.Email = email; user.PasswordHash = hash; user.Salt = salt; bool added = userRepository.Add(user); return RedirectToAction("Profile", new { name = username }); } [Route("/User/Profile/{name}", Name = "Profile")] public IActionResult Profile(string name) { Models.User user = userRepository.FindByUsername(name); if (user == null) { return View(new ViewModels.User("Not found")); } ViewModels.User userViewModel = new ViewModels.User(user); return View(userViewModel); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Http.Internal; using AtomicChessPuzzles.DbRepositories; namespace AtomicChessPuzzles.Controllers { public class UserController : Controller { IUserRepository userRepository; public UserController(IUserRepository _userRepository) { userRepository = _userRepository; } [HttpGet] [Route("/User/Register")] public IActionResult Register() { return View(); } [HttpPost] [Route("/User/New", Name = "NewUser")] public IActionResult New(string username, string email, string password) { /*string username = Request["username"]; string email = Request["email"]; string password = Request["password"];*/ Tuple<string, string> hashAndSalt = PasswordUtilities.HashPassword(password); string hash = hashAndSalt.Item1; string salt = hashAndSalt.Item2; Models.User user = new Models.User(); user.Username = username; user.Email = email; user.PasswordHash = hash; user.Salt = salt; bool added = userRepository.Add(user); return RedirectToAction("Profile", new { name = username }); } [Route("/User/Profile/{name}", Name = "Profile")] public IActionResult Profile(string name) { Models.User user = userRepository.FindByUsername(name); if (user == null) { return View(new ViewModels.User("Not found")); } ViewModels.User userViewModel = new ViewModels.User(user); return View(userViewModel); } } }
agpl-3.0
C#
66b50dcefa3ec254912c0ade132fcaa7ddd25396
Add missing GuardianFactor names
auth0/auth0.net,auth0/auth0.net
src/Auth0.ManagementApi/Models/GuardianFactorName.cs
src/Auth0.ManagementApi/Models/GuardianFactorName.cs
using System.Runtime.Serialization; namespace Auth0.ManagementApi.Models { public enum GuardianFactorName { [EnumMember(Value = "sms")] Sms, [EnumMember(Value = "push-notification")] PushNotifications, [EnumMember(Value = "email")] Email, [EnumMember(Value = "otp")] Otp, [EnumMember(Value = "duo")] Duo } }
using System.Runtime.Serialization; namespace Auth0.ManagementApi.Models { public enum GuardianFactorName { [EnumMember(Value = "sms")] Sms, [EnumMember(Value = "push-notification")] PushNotifications } }
mit
C#
ad668af283ac619c0076766ba0db0df83aaf06f7
Fix a build break (#51963)
mavasani/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,sharwell/roslyn,physhi/roslyn,physhi/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,wvdd007/roslyn,wvdd007/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,eriawan/roslyn,dotnet/roslyn,eriawan/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,KevinRansom/roslyn,diryboy/roslyn,eriawan/roslyn,AmadeusW/roslyn,diryboy/roslyn,bartdesmet/roslyn,weltkante/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,mavasani/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,physhi/roslyn
src/Compilers/Core/RebuildTest/CSharpRebuildTests.cs
src/Compilers/Core/RebuildTest/CSharpRebuildTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Linq; using System.Reflection.PortableExecutable; using BuildValidator; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.Extensions.Logging; using Xunit; namespace Microsoft.CodeAnalysis.Rebuild.UnitTests { public class CSharpRebuildTests : CSharpTestBase { [Fact] public void TopLevelStatements() { const string path = "test"; var original = CreateCompilation( @"System.Console.WriteLine(""I'm using top-level statements!"");", options: TestOptions.DebugExe); original.VerifyDiagnostics(); var originalBytes = original.EmitToArray(new EmitOptions(debugInformationFormat: DebugInformationFormat.Embedded)); var peReader = new PEReader(originalBytes); Assert.True(peReader.TryOpenAssociatedPortablePdb(path, path => null, out var provider, out _)); var pdbReader = provider!.GetMetadataReader(); var factory = LoggerFactory.Create(configure => { }); var logger = factory.CreateLogger(path); var bc = new BuildConstructor(logger); var optionsReader = new CompilationOptionsReader(logger, pdbReader, peReader); var sources = original.SyntaxTrees.Select(st => { var text = st.GetText(); return new SyntaxTreeInfo(path, text); }).ToImmutableArray(); var references = original.References.ToImmutableArray(); var compilation = bc.CreateCompilation("test.exe", optionsReader, sources, references); compilation.VerifyEmitDiagnostics(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Linq; using System.Reflection.PortableExecutable; using BuildValidator; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.Extensions.Logging; using Xunit; namespace Microsoft.CodeAnalysis.Rebuild.UnitTests { public class CSharpRebuildTests : CSharpTestBase { [Fact] public void TopLevelStatements() { const string path = "test"; var original = CreateCompilation( @"System.Console.WriteLine(""I'm using top-level statements!"");", options: TestOptions.DebugExe); original.VerifyDiagnostics(); var originalBytes = original.EmitToArray(new EmitOptions(debugInformationFormat: DebugInformationFormat.Embedded)); var peReader = new PEReader(originalBytes); Assert.True(peReader.TryOpenAssociatedPortablePdb(path, path => null, out var provider, out _)); var pdbReader = provider!.GetMetadataReader(); var factory = LoggerFactory.Create(configure => { }); var logger = factory.CreateLogger(path); var bc = new BuildConstructor(logger); var optionsReader = new CompilationOptionsReader(logger, pdbReader, peReader); var sources = original.SyntaxTrees.Select(st => { var text = st.GetText(); return new ResolvedSource(OnDiskPath: null, text, new SourceFileInfo(path, text.ChecksumAlgorithm, text.GetChecksum().ToArray(), text, embeddedCompressedHash: null)); }).ToImmutableArray(); var references = original.References.ToImmutableArray(); var compilation = bc.CreateCompilation(optionsReader, path, sources, references); compilation.VerifyEmitDiagnostics(); } } }
mit
C#
ed49827cf329ae76ac5341772ae093ea5d00c6c2
Fix Razor tag helpers and usings
GeorgDangl/WebDocu,GeorgDangl/WebDocu,GeorgDangl/WebDocu
src/Dangl.WebDocumentation/Views/_ViewImports.cshtml
src/Dangl.WebDocumentation/Views/_ViewImports.cshtml
@using Dangl.WebDocumentation @using Dangl.WebDocumentation.Models @using Dangl.WebDocumentation.ViewModels.Account @using Dangl.WebDocumentation.ViewModels.Manage @using Microsoft.AspNetCore.Identity @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@using Dangl.WebDocumentation @using Dangl.WebDocumentation.Models @using Dangl.WebDocumentation.ViewModels.Account @using Dangl.WebDocumentation.ViewModels.Manage @using Microsoft.AspNet.Identity @addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers" @inject Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration TelemetryConfiguration
mit
C#
24c42a7dd812429428c4ced79c4a90771ac90f16
Add test for Era.ToString()
jskeet/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,nodatime/nodatime,jskeet/nodatime,malcolmr/nodatime,malcolmr/nodatime,malcolmr/nodatime,nodatime/nodatime,BenJenkinson/nodatime
src/NodaTime.Test/Calendars/EraTest.cs
src/NodaTime.Test/Calendars/EraTest.cs
// Copyright 2013 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using NodaTime.Calendars; using NodaTime.Globalization; using NUnit.Framework; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Reflection; namespace NodaTime.Test.Calendars { public class EraTest { private static readonly IEnumerable<NamedWrapper<Era>> Eras = typeof(Era).GetTypeInfo() .DeclaredProperties // TODO: Only static and public ones... .Where(property => property.PropertyType == typeof(Era)) .Select(property => new NamedWrapper<Era>((Era) property.GetValue(null, null), property.Name)); [Test] [TestCaseSource(nameof(Eras))] public void ResourcePresence(NamedWrapper<Era> eraWrapper) { var era = eraWrapper.Value; var valueByName = PatternResources.ResourceManager.GetString(era.ResourceIdentifier, CultureInfo.InvariantCulture); Assert.NotNull(valueByName, "Missing resource for " + era.ResourceIdentifier); } [Test] [TestCaseSource(nameof(Eras))] public void ToStringReturnsName(NamedWrapper<Era> eraWrapper) { var era = eraWrapper.Value; Assert.AreEqual(era.Name, era.ToString()); } } }
// Copyright 2013 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using NodaTime.Calendars; using NodaTime.Globalization; using NUnit.Framework; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Reflection; namespace NodaTime.Test.Calendars { public class EraTest { private static readonly IEnumerable<NamedWrapper<Era>> Eras = typeof(Era).GetTypeInfo() .DeclaredProperties // TODO: Only static and public ones... .Where(property => property.PropertyType == typeof(Era)) .Select(property => new NamedWrapper<Era>((Era) property.GetValue(null, null), property.Name)); [TestCaseSource(nameof(Eras))] [Test] public void ResourcePresence(NamedWrapper<Era> eraWrapper) { var era = eraWrapper.Value; var valueByName = PatternResources.ResourceManager.GetString(era.ResourceIdentifier, CultureInfo.InvariantCulture); Assert.NotNull(valueByName, "Missing resource for " + era.ResourceIdentifier); } } }
apache-2.0
C#
da1bc65955b7118d4b38e04cae8a15f41da403d7
tidy up
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Portal.Client.TestHarness/Program.cs
src/SFA.DAS.EAS.Portal.Client.TestHarness/Program.cs
using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SFA.DAS.EAS.Portal.Client.TestHarness.DependencyResolution; using SFA.DAS.EAS.Portal.Client.TestHarness.Scenarios; using SFA.DAS.EAS.Portal.Client.TestHarness.Startup; using SFA.DAS.EAS.Portal.Startup; using StructureMap; namespace SFA.DAS.EAS.Portal.Client.TestHarness { public static class Program { public static async Task Main(string[] args) { using (var host = CreateHostBuilder(args).Build()) { await host.StartAsync(); var getAccount = host.Services.GetService<GetAccountScenario>(); await getAccount.Run(); await host.WaitForShutdownAsync(); } } private static IHostBuilder CreateHostBuilder(string[] args) => new HostBuilder() .ConfigureDasAppConfiguration(args) .UseDasEnvironment() .UseStructureMap() .ConfigureServices(s => s.AddTransient<GetAccountScenario, GetAccountScenario>()) .ConfigureContainer<Registry>(IoC.Initialize); } }
using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SFA.DAS.EAS.Portal.Client.TestHarness.DependencyResolution; using SFA.DAS.EAS.Portal.Client.TestHarness.Scenarios; using SFA.DAS.EAS.Portal.Client.TestHarness.Startup; using SFA.DAS.EAS.Portal.Startup; using StructureMap; namespace SFA.DAS.EAS.Portal.Client.TestHarness { //todo: logging? //todo: should probably have framework test client to match eas, rather than core with structuremap public static class Program { public static async Task Main(string[] args) { using (var host = CreateHostBuilder(args).Build()) { await host.StartAsync(); var getAccount = host.Services.GetService<GetAccountScenario>(); await getAccount.Run(); await host.WaitForShutdownAsync(); } } private static IHostBuilder CreateHostBuilder(string[] args) => new HostBuilder() .ConfigureDasAppConfiguration(args) .ConfigureDasLogging() .UseDasEnvironment() .UseStructureMap() .ConfigureServices(s => s.AddTransient<GetAccountScenario, GetAccountScenario>()) .ConfigureContainer<Registry>(IoC.Initialize); } }
mit
C#
0bc034f6206b6f4049dae95bdb0b87f53c431c5d
fix ctor for stripe payment service test
bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core
test/Core.Test/Services/StripePaymentServiceTests.cs
test/Core.Test/Services/StripePaymentServiceTests.cs
using System; using Bit.Core.Repositories; using Bit.Core.Services; using Microsoft.Extensions.Logging; using NSubstitute; using Xunit; namespace Bit.Core.Test.Services { public class StripePaymentServiceTests { private readonly StripePaymentService _sut; private readonly ITransactionRepository _transactionRepository; private readonly IUserRepository _userRepository; private readonly IAppleIapService _appleIapService; private readonly GlobalSettings _globalSettings; private readonly ILogger<StripePaymentService> _logger; public StripePaymentServiceTests() { _transactionRepository = Substitute.For<ITransactionRepository>(); _userRepository = Substitute.For<IUserRepository>(); _appleIapService = Substitute.For<IAppleIapService>(); _globalSettings = new GlobalSettings(); _logger = Substitute.For<ILogger<StripePaymentService>>(); _sut = new StripePaymentService( _transactionRepository, _userRepository, _globalSettings, _appleIapService, _logger ); } // Remove this test when we add actual tests. It only proves that // we've properly constructed the system under test. [Fact] public void ServiceExists() { Assert.NotNull(_sut); } } }
using System; using Bit.Core.Repositories; using Bit.Core.Services; using Microsoft.Extensions.Logging; using NSubstitute; using Xunit; namespace Bit.Core.Test.Services { public class StripePaymentServiceTests { private readonly StripePaymentService _sut; private readonly ITransactionRepository _transactionRepository; private readonly GlobalSettings _globalSettings; private readonly ILogger<StripePaymentService> _logger; public StripePaymentServiceTests() { _transactionRepository = Substitute.For<ITransactionRepository>(); _globalSettings = new GlobalSettings(); _logger = Substitute.For<ILogger<StripePaymentService>>(); _sut = new StripePaymentService( _transactionRepository, _globalSettings, _logger ); } // Remove this test when we add actual tests. It only proves that // we've properly constructed the system under test. [Fact] public void ServiceExists() { Assert.NotNull(_sut); } } }
agpl-3.0
C#
ad414a0169b8fc5c9847e0cf66753024fc4bf3d9
Update comment
elastic/elasticsearch-net,elastic/elasticsearch-net
src/Nest/Document/Single/Index/ElasticClient-Index.cs
src/Nest/Document/Single/Index/ElasticClient-Index.cs
using System.Threading; using System.Threading.Tasks; namespace Nest { public partial interface IElasticClient { /// <summary> /// Adds or updates a typed JSON document in a specific index, making it searchable. /// <para> </para> /// <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html"> /// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html</a> /// </summary> /// <typeparam name="TDocument">The document type used to infer the default index and id</typeparam> /// <param name="document"> /// The document to be indexed. Id will be inferred from (in order): /// <para>1. Id property set up on <see cref="ConnectionSettings" /> for <typeparamref name="TDocument" /></para> /// <para> /// 2. <see cref="ElasticsearchTypeAttribute.IdProperty" /> property on <see cref="ElasticsearchTypeAttribute" /> applied to /// <typeparamref name="TDocument" /> /// </para> /// <para>3. A property named Id on <typeparamref name="TDocument" /></para> /// </param> IndexResponse IndexDocument<TDocument>(TDocument document) where TDocument : class; /// <inheritdoc cref="IElasticClient.IndexDocument{TDocument}" /> Task<IndexResponse> IndexDocumentAsync<TDocument>(TDocument document, CancellationToken ct = default) where TDocument : class; } public partial class ElasticClient { /// <inheritdoc cref="IElasticClient.IndexDocument{TDocument}" /> public IndexResponse IndexDocument<TDocument>(TDocument document) where TDocument : class => Index(document, s => s); /// <inheritdoc cref="IElasticClient.IndexDocument{TDocument}" /> public Task<IndexResponse> IndexDocumentAsync<TDocument>(TDocument document, CancellationToken ct = default) where TDocument : class => IndexAsync(document, s => s, ct); } }
using System.Threading; using System.Threading.Tasks; namespace Nest { public partial interface IElasticClient { /// <summary> /// Adds or updates a typed JSON document in a specific index, making it searchable. /// <para> </para> /// <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html"> /// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html</a> /// </summary> /// <typeparam name="TDocument">The document type used to infer the default index, type and id</typeparam> /// <param name="document"> /// The document to be indexed. Id will be inferred from (in order): /// <para>1. Id property set up on <see cref="ConnectionSettings" /> for <typeparamref name="TDocument" /></para> /// <para> /// 2. <see cref="ElasticsearchTypeAttribute.IdProperty" /> property on <see cref="ElasticsearchTypeAttribute" /> applied to /// <typeparamref name="TDocument" /> /// </para> /// <para>3. A property named Id on <typeparamref name="TDocument" /></para> /// </param> /// <param name="selector">Optionally further describe the index operation i.e override type, index, id</param> IndexResponse IndexDocument<TDocument>(TDocument document) where TDocument : class; /// <inheritdoc cref="IElasticClient.IndexDocument{TDocument}" /> Task<IndexResponse> IndexDocumentAsync<T>(T document, CancellationToken ct = default) where T : class; } public partial class ElasticClient { /// <inheritdoc cref="IElasticClient.IndexDocument{TDocument}" /> public IndexResponse IndexDocument<TDocument>(TDocument document) where TDocument : class => Index(document, s => s); /// <inheritdoc cref="IElasticClient.IndexDocument{TDocument}" /> public Task<IndexResponse> IndexDocumentAsync<TDocument>(TDocument document, CancellationToken ct = default) where TDocument : class => IndexAsync(document, s => s, ct); } }
apache-2.0
C#
657ca1de1c005a9d3d729c928cb912e2ac074c3f
Teste para validação do servidor
nelson1987/MultiCredCard,nelson1987/MultiCredCard
MultiCredCard/MultiCredCard.Domain.Tests/UnitTest1.cs
MultiCredCard/MultiCredCard.Domain.Tests/UnitTest1.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace MultiCredCard.Domain.Tests { [TestClass] public class UnitTest1 { [TestMethod] public void TesteValidador() { var um = 1; Assert.AreEqual(um, 1); } [TestMethod] public void TesteValidadorErro() { var um = 1; Assert.AreEqual(um, 2); } [TestMethod] [ExpectedException(typeof(Exception))] public void TesteValidadorException() { throw new Exception("ERRO"); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace MultiCredCard.Domain.Tests { [TestClass] public class UnitTest1 { [TestMethod] public void TesteValidador() { var um = 1; Assert.AreEqual(um, 1); } } }
mit
C#
0173c15944ebf9115770ab6b064f8edc8e31bbc6
Correct addin/extension id
Xavalon/XamlStyler,tmatz/XamlStyler,tmatz/XamlStyler,Xavalon/XamlStyler,Xavalon/XamlStyler
XamlStyler.VisualStudioForMac/Properties/AddinInfo.cs
XamlStyler.VisualStudioForMac/Properties/AddinInfo.cs
using Mono.Addins; using Mono.Addins.Description; [assembly: Addin("XamlStyler", Namespace = "Xavalon", Version = "1.1.2")] [assembly: AddinName("XAML Styler")] [assembly: AddinCategory("IDE extensions")] [assembly: AddinDescription("XAML Styler is a visual studio extension that formats XAML source code based on a set of styling rules. This tool can help you/your team maintain a better XAML coding style as well as a much better XAML readability.")] [assembly: AddinAuthor("Xavalon; Ben Lacey; Taras Shevchuk")] [assembly: AddinUrl("https://github.com/Xavalon/XamlStyler/")] [assembly: AddinDependency("::MonoDevelop.Core", MonoDevelop.BuildInfo.Version)] [assembly: AddinDependency("::MonoDevelop.Ide", MonoDevelop.BuildInfo.Version)] [assembly: AddinDependency("::MonoDevelop.SourceEditor2", MonoDevelop.BuildInfo.Version)]
using Mono.Addins; using Mono.Addins.Description; [assembly: Addin("XAML Styler", Namespace = "Xavalon", Version = "1.1.2")] [assembly: AddinName("XAML Styler")] [assembly: AddinCategory("IDE extensions")] [assembly: AddinDescription("XAML Styler is a visual studio extension that formats XAML source code based on a set of styling rules. This tool can help you/your team maintain a better XAML coding style as well as a much better XAML readability.")] [assembly: AddinAuthor("Xavalon; Ben Lacey; Taras Shevchuk")] [assembly: AddinUrl("https://github.com/Xavalon/XamlStyler/")] [assembly: AddinDependency("::MonoDevelop.Core", MonoDevelop.BuildInfo.Version)] [assembly: AddinDependency("::MonoDevelop.Ide", MonoDevelop.BuildInfo.Version)] [assembly: AddinDependency("::MonoDevelop.SourceEditor2", MonoDevelop.BuildInfo.Version)]
apache-2.0
C#
0c112203f796d17515293feb2b9bb2e2bd27f824
remove usings
dlmelendez/identityazuretable,dlmelendez/identityazuretable,dlmelendez/identityazuretable
src/ElCamino.AspNetCore.Identity.AzureTable/Helpers/IAsyncEnumerableExtensions.cs
src/ElCamino.AspNetCore.Identity.AzureTable/Helpers/IAsyncEnumerableExtensions.cs
// MIT License Copyright 2020 (c) David Melendez. All rights reserved. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace ElCamino.AspNetCore.Identity.AzureTable { public static class IAsyncEnumerableExtensions { public static async Task<T> FirstOrDefaultAsync<T>( this IAsyncEnumerable<T> asyncEnumerable, CancellationToken cancellationToken = default) { await using var enumerator = asyncEnumerable.GetAsyncEnumerator(cancellationToken); if (await enumerator.MoveNextAsync().ConfigureAwait(false)) { return enumerator.Current; } return default; } public static async Task<List<T>> ToListAsync<T>( this IAsyncEnumerable<T> asyncEnumerable, CancellationToken cancellationToken = default) { await using var enumerator = asyncEnumerable.GetAsyncEnumerator(cancellationToken); List<T> list = new List<T>(); while (await enumerator.MoveNextAsync().ConfigureAwait(false)) { list.Add(enumerator.Current); } return list; } public static async Task ForEachAsync<T>( this IAsyncEnumerable<T> asyncEnumerable, Action<T> action, CancellationToken cancellationToken = default) { await using var enumerator = asyncEnumerable.GetAsyncEnumerator(cancellationToken); while (await enumerator.MoveNextAsync().ConfigureAwait(false)) { action(enumerator.Current); } } public static async Task<bool> AnyAsync<T>( this IAsyncEnumerable<T> asyncEnumerable, CancellationToken cancellationToken = default) { await using var enumerator = asyncEnumerable.GetAsyncEnumerator(cancellationToken); return await enumerator.MoveNextAsync().ConfigureAwait(false); } } }
// MIT License Copyright 2020 (c) David Melendez. All rights reserved. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace ElCamino.AspNetCore.Identity.AzureTable { public static class IAsyncEnumerableExtensions { public static async Task<T> FirstOrDefaultAsync<T>( this IAsyncEnumerable<T> asyncEnumerable, CancellationToken cancellationToken = default) { await using var enumerator = asyncEnumerable.GetAsyncEnumerator(cancellationToken); if (await enumerator.MoveNextAsync().ConfigureAwait(false)) { return enumerator.Current; } return default; } public static async Task<List<T>> ToListAsync<T>( this IAsyncEnumerable<T> asyncEnumerable, CancellationToken cancellationToken = default) { await using var enumerator = asyncEnumerable.GetAsyncEnumerator(cancellationToken); List<T> list = new List<T>(); while (await enumerator.MoveNextAsync().ConfigureAwait(false)) { list.Add(enumerator.Current); } return list; } public static async Task ForEachAsync<T>( this IAsyncEnumerable<T> asyncEnumerable, Action<T> action, CancellationToken cancellationToken = default) { await using var enumerator = asyncEnumerable.GetAsyncEnumerator(cancellationToken); while (await enumerator.MoveNextAsync().ConfigureAwait(false)) { action(enumerator.Current); } } public static async Task<bool> AnyAsync<T>( this IAsyncEnumerable<T> asyncEnumerable, CancellationToken cancellationToken = default) { await using var enumerator = asyncEnumerable.GetAsyncEnumerator(cancellationToken); return await enumerator.MoveNextAsync().ConfigureAwait(false); } } }
mit
C#
43e6ef021473596143883501c47c94cfff77e688
Update ViewComponentContext to respond to changed type
zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype
src/Glimpse.Agent.AspNet/Internal/Inspectors/Mvc/Proxies/IViewComponentContext.cs
src/Glimpse.Agent.AspNet/Internal/Inspectors/Mvc/Proxies/IViewComponentContext.cs
 using System.Collections.Generic; namespace Glimpse.Agent.Internal.Inspectors.Mvc.Proxies { public interface IViewComponentContext { IViewComponentDescriptor ViewComponentDescriptor { get; } IDictionary<string, object> Arguments { get; } } }
 namespace Glimpse.Agent.Internal.Inspectors.Mvc.Proxies { public interface IViewComponentContext { IViewComponentDescriptor ViewComponentDescriptor { get; } object[] Arguments { get; } } }
mit
C#
418838a7fb0e90df9ca50b07bd79f8d14b7a8c53
Convert to minutes in the duration display
jaredpar/jenkins,jaredpar/jenkins,jaredpar/jenkins
Dashboard/Views/Jenkins/JobData.cshtml
Dashboard/Views/Jenkins/JobData.cshtml
@model Dashboard.Models.JobSummary @{ ViewBag.Title = $"{Model.Name} Summary"; var jobs = Model.JobDaySummaryList.OrderBy(x => x.Date); var summaryValues = string.Join( ";", jobs.Select(x => $"{x.Date.ToLocalTime().ToString("yyyy-MM-dd")},{x.Succeeded},{x.Failed},{x.Aborted}")); var durationDates = string.Join( ";", jobs.Select(x => x.Date.ToLocalTime().ToString("yyyy-MM-dd")).ToArray()); var durationTimes = string.Join( ";", jobs.Select(x => x.AverageDuration.TotalMinutes).ToArray()); } <h2>@Model.Name</h2> <div>Average Duration: @Model.AverageDuration</div> <div id="daily_summary_chart" style="width: 900px; height: 500px" data-values="@summaryValues"></div> <div id="daily_duration_chart" style="width: 900px; height: 500px" data-dates="@durationDates" data-times="@durationTimes"></div> @section scripts { <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript" src="@Url.Content("/Scripts/job-build-data.js")" ></script> }
@model Dashboard.Models.JobSummary @{ ViewBag.Title = $"{Model.Name} Summary"; var summaryValues = string.Join( ";", Model.JobDaySummaryList.Select(x => $"{x.Date.ToLocalTime().ToString("yyyy-MM-dd")},{x.Succeeded},{x.Failed},{x.Aborted}")); var durationDates = string.Join( ";", Model.JobDaySummaryList.Select(x => x.Date.ToLocalTime().ToString("yyyy-MM-dd")).ToArray()); var durationTimes = string.Join( ";", Model.JobDaySummaryList.Select(x => x.AverageDuration.TotalSeconds).ToArray()); } <h2>@Model.Name</h2> <div>Average Duration: @Model.AverageDuration</div> <div id="daily_summary_chart" style="width: 900px; height: 500px" data-values="@summaryValues"></div> <div id="daily_duration_chart" style="width: 900px; height: 500px" data-dates="@durationDates" data-times="@durationTimes"></div> @section scripts { <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript" src="@Url.Content("/Scripts/job-build-data.js")" ></script> }
apache-2.0
C#
229259f7adf2436e36d42baf00232cbcd31c8dec
Add async where extension
inputfalken/Sharpy
GeneratorAPI/TaskExtensions.cs
GeneratorAPI/TaskExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GeneratorAPI { internal static class TaskExtensions { public static IGenerator<Task<TSource>> Where<TSource>(this IGenerator<Task<TSource>> taskGenerator, Func<TSource, bool> predicate, int threshold = 100000) { if (predicate == null) throw new ArgumentNullException(nameof(predicate)); if (taskGenerator == null) throw new ArgumentNullException(nameof(taskGenerator)); // Duplicated from Generator.Where but with async. return Generator.Function(async () => { for (var i = 0; i < threshold; i++) { var generation = await taskGenerator.Generate(); if (predicate(generation)) return generation; } throw new ArgumentException($"Could not match the predicate with {threshold} attempts. "); }); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GeneratorAPI { internal static class TaskExtensions { } }
mit
C#
893e3cce8c5c29174d9dfd52805229dbc8322d1a
print a message if a unexpected escaped quote is found in arguments
SiskSjet/IngameScriptBuilder
IngameScriptBuilder/Program.cs
IngameScriptBuilder/Program.cs
using System; using System.Linq; namespace IngameScriptBuilder { class Program { static int Main(string[] args) { if (args.Any(x => x.Count(c => c == '\"') % 2 > 0)) { Console.WriteLine("Unexpected excaped quote."); return 1; } try { return new App().Execute(args); } catch (Exception ex) { Console.Write(ex); return 1; } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.CommandLineUtils; namespace IngameScriptBuilder { class Program { static int Main(string[] args) { try { return new App().Execute(args); } catch (Exception ex) { Console.Write(ex); return 1; } } } }
mit
C#
90f5727561ac602002ee581f739980e32bbbc0be
Change test to use new button click event
jaquadro/MonoGdx
MonoGdxTests/Tests/TreeTest.cs
MonoGdxTests/Tests/TreeTest.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using MonoGdx.Scene2D; using MonoGdx.Scene2D.UI; using MonoGdx.Scene2D.Utils; using NUnit.Framework; namespace MonoGdxTests.Tests { [TestFixture] class TreeTest : GdxTest { [Test] public void Run () { using (GdxTestContext context = new GdxTestContext(this)) { context.Run(); } } private Stage _stage; protected override void InitializeCore () { ShowDebug = true; _stage = new Stage(Context.GraphicsDevice); Context.Input.Processor = _stage; Skin skin = new Skin(Context.GraphicsDevice, "Data/uiskin.json"); Table table = new Table(); table.SetFillParent(true); _stage.AddActor(table); Tree tree = new Tree(skin); TreeNode node1 = new TreeNode(new TextButton("moo1", skin)); TreeNode node2 = new TreeNode(new TextButton("moo2", skin)); TreeNode node3 = new TreeNode(new TextButton("moo3", skin)); TreeNode node4 = new TreeNode(new TextButton("moo4", skin)); TreeNode node5 = new TreeNode(new TextButton("moo5", skin)); tree.Add(node1); tree.Add(node2); node2.Add(node3); node3.Add(node4); tree.Add(node5); (node5.Actor as Button).Clicked += (sender, e) => { tree.Remove(node4); }; //node5.Actor.AddListener(new DispatchClickListener() { // OnClicked = (ev, x, y) => { tree.Remove(node4); } //}); table.Add(tree).Configure.Fill().Expand(); //Debugger.Launch(); } protected override void UpdateCore (GameTime gameTime) { _stage.Act((float)gameTime.ElapsedGameTime.TotalSeconds); } protected override void DrawCore (GameTime gameTime) { Context.GraphicsDevice.Clear(Color.Black); _stage.Draw(); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using MonoGdx.Scene2D; using MonoGdx.Scene2D.UI; using MonoGdx.Scene2D.Utils; using NUnit.Framework; namespace MonoGdxTests.Tests { [TestFixture] class TreeTest : GdxTest { [Test] public void Run () { using (GdxTestContext context = new GdxTestContext(this)) { context.Run(); } } private Stage _stage; protected override void InitializeCore () { ShowDebug = true; _stage = new Stage(Context.GraphicsDevice); Context.Input.Processor = _stage; Skin skin = new Skin(Context.GraphicsDevice, "Data/uiskin.json"); Table table = new Table(); table.SetFillParent(true); _stage.AddActor(table); Tree tree = new Tree(skin); TreeNode node1 = new TreeNode(new TextButton("moo1", skin)); TreeNode node2 = new TreeNode(new TextButton("moo2", skin)); TreeNode node3 = new TreeNode(new TextButton("moo3", skin)); TreeNode node4 = new TreeNode(new TextButton("moo4", skin)); TreeNode node5 = new TreeNode(new TextButton("moo5", skin)); tree.Add(node1); tree.Add(node2); node2.Add(node3); node3.Add(node4); tree.Add(node5); node5.Actor.AddListener(new DispatchClickListener() { OnClicked = (ev, x, y) => { tree.Remove(node4); } }); table.Add(tree).Configure.Fill().Expand(); //Debugger.Launch(); } protected override void UpdateCore (GameTime gameTime) { _stage.Act((float)gameTime.ElapsedGameTime.TotalSeconds); } protected override void DrawCore (GameTime gameTime) { Context.GraphicsDevice.Clear(Color.Black); _stage.Draw(); } } }
apache-2.0
C#
ff5a44df421b467f11264362cd0a81145f348178
Add cache asserts.
Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver
test/AsmResolver.DotNet.Tests/AssemblyResolverTest.cs
test/AsmResolver.DotNet.Tests/AssemblyResolverTest.cs
using System.IO; using AsmResolver.DotNet.Signatures; using AsmResolver.DotNet.TestCases.NestedClasses; using Xunit; namespace AsmResolver.DotNet.Tests { public class AssemblyResolverTest { private readonly SignatureComparer _comparer = new SignatureComparer(); [Fact] public void ResolveCorLib() { var assemblyName = typeof(object).Assembly.GetName(); var assemblyRef = new AssemblyReference( assemblyName.Name, assemblyName.Version, false, assemblyName.GetPublicKeyToken()); var resolver = new NetCoreAssemblyResolver(); var assemblyDef = resolver.Resolve(assemblyRef); Assert.NotNull(assemblyDef); Assert.Equal(assemblyName.Name, assemblyDef.Name); } [Fact] public void ResolveLocalLibrary() { var resolver = new NetCoreAssemblyResolver(); resolver.SearchDirectories.Add(Path.GetDirectoryName(typeof(AssemblyResolverTest).Assembly.Location)); var assemblyDef = AssemblyDefinition.FromFile(typeof(TopLevelClass1).Assembly.Location); var assemblyRef = new AssemblyReference(assemblyDef); Assert.Equal(assemblyDef, resolver.Resolve(assemblyRef), _comparer); resolver.ClearCache(); Assert.False(resolver.HasCached(assemblyRef)); resolver.AddToCache(assemblyRef, assemblyDef); Assert.True(resolver.HasCached(assemblyRef)); Assert.Equal(assemblyDef, resolver.Resolve(assemblyRef)); resolver.RemoveFromCache(assemblyRef); Assert.NotEqual(assemblyDef, resolver.Resolve(assemblyRef)); } } }
using System.IO; using AsmResolver.DotNet.Signatures; using AsmResolver.DotNet.TestCases.NestedClasses; using Xunit; namespace AsmResolver.DotNet.Tests { public class AssemblyResolverTest { private readonly SignatureComparer _comparer = new SignatureComparer(); [Fact] public void ResolveCorLib() { var assemblyName = typeof(object).Assembly.GetName(); var assemblyRef = new AssemblyReference( assemblyName.Name, assemblyName.Version, false, assemblyName.GetPublicKeyToken()); var resolver = new NetCoreAssemblyResolver(); var assemblyDef = resolver.Resolve(assemblyRef); Assert.NotNull(assemblyDef); Assert.Equal(assemblyName.Name, assemblyDef.Name); } [Fact] public void ResolveLocalLibrary() { var resolver = new NetCoreAssemblyResolver(); resolver.SearchDirectories.Add(Path.GetDirectoryName(typeof(AssemblyResolverTest).Assembly.Location)); var assemblyDef = AssemblyDefinition.FromFile(typeof(TopLevelClass1).Assembly.Location); var assemblyRef = new AssemblyReference(assemblyDef); Assert.Equal(assemblyDef, resolver.Resolve(assemblyRef), _comparer); resolver.ClearCache(); resolver.AddToCache(assemblyRef, assemblyDef); Assert.Equal(assemblyDef, resolver.Resolve(assemblyRef)); resolver.RemoveFromCache(assemblyRef); Assert.NotEqual(assemblyDef, resolver.Resolve(assemblyRef)); } } }
mit
C#
b7aec20555092f6f116675d223f8c8c2443bf5be
Remove DirectBufferTests from CI, something strange is happening only from cli.
Spreads/Spreads
tests/Spreads.Core.Tests/Buffers/DirectBufferTests.cs
tests/Spreads.Core.Tests/Buffers/DirectBufferTests.cs
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. using NUnit.Framework; using Spreads.Buffers; using System; using System.Threading; namespace Spreads.Core.Tests.Buffers { // [Category("CI")] [TestFixture] public class DirectBufferTests { [Test] public void CouldCompareDbs() { var rm0 = BufferPool.Retain(100, true); var rm1 = BufferPool.Retain(100, true); var db0 = rm0.ToDirectBuffer(); var db1 = rm1.ToDirectBuffer(); Assert.IsTrue(db0.Equals(db0)); Assert.IsTrue(db0.Equals(db1)); rm0.Dispose(); rm1.Dispose(); GC.Collect(2, GCCollectionMode.Forced, true, true); GC.WaitForPendingFinalizers(); Thread.Sleep(100); GC.Collect(2, GCCollectionMode.Forced, true, true); GC.WaitForPendingFinalizers(); Thread.Sleep(100); GC.Collect(2, GCCollectionMode.Forced, true, true); GC.WaitForPendingFinalizers(); } [Test] public void CouldFillDbs() { var rm0 = BufferPool.Retain(100, true); var rm1 = BufferPool.Retain(100, true); var db0 = rm0.ToDirectBuffer(); var db1 = rm1.ToDirectBuffer(); Assert.IsTrue(db0.IsFilledWithValue(0)); Assert.IsTrue(db1.IsFilledWithValue(0)); Assert.IsTrue(db0.Equals(db0)); Assert.IsTrue(db0.Equals(db1)); db0.Fill(0, db1.Length, 1); Assert.IsFalse(db0.Equals(db1)); Assert.IsTrue(db0.IsFilledWithValue(1)); db1.Fill(0, db1.Length, 1); Assert.IsTrue(db0.Equals(db0)); rm0.Dispose(); rm1.Dispose(); } } }
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. using NUnit.Framework; using Spreads.Buffers; namespace Spreads.Core.Tests.Buffers { [Category("CI")] [TestFixture] public class DirectBufferTests { [Test] public void CouldCompareDbs() { var rm0 = BufferPool.Retain(100, true); var rm1 = BufferPool.Retain(100, true); var db0 = rm0.ToDirectBuffer(); var db1 = rm1.ToDirectBuffer(); Assert.IsTrue(db0.Equals(db0)); Assert.IsTrue(db0.Equals(db1)); rm0.Dispose(); rm1.Dispose(); } [Test] public void CouldFillDbs() { var rm0 = BufferPool.Retain(100, true); var rm1 = BufferPool.Retain(100, true); var db0 = rm0.ToDirectBuffer(); var db1 = rm1.ToDirectBuffer(); Assert.IsTrue(db0.IsFilledWithValue(0)); Assert.IsTrue(db1.IsFilledWithValue(0)); Assert.IsTrue(db0.Equals(db0)); Assert.IsTrue(db0.Equals(db1)); db0.Fill(0, db1.Length, 1); Assert.IsFalse(db0.Equals(db1)); Assert.IsTrue(db0.IsFilledWithValue(1)); db1.Fill(0, db1.Length, 1); Assert.IsTrue(db0.Equals(db0)); rm0.Dispose(); rm1.Dispose(); } } }
mpl-2.0
C#
28d79e31efb394968f4afc0a7a92c29a1336fcf1
Add NextAndRemove method to PicMatcher
zaynetro/PicMatcher
PicMatcher/Pages/PicMatcher.cs
PicMatcher/Pages/PicMatcher.cs
using System; using Xamarin.Forms; using System.Threading.Tasks; namespace PicMatcher { public delegate void EventHandler(object sender, EventArgs e); public class PicMatcher : CarouselPage { private Game game; public PicMatcher () { this.Title = "PicMatcher"; // this.Children.Add(new HomePage()); game = new Game (); this.Children.Add (game.Next()); game.Added += (object sender, EventArgs e) => { this.Children.Add (game.Next()); }; game.NextPage += (object sender, EventArgs e) => { NextPage(); }; game.Error += async (object sender, EventArgs e) => { var answer = await DisplayAlert("What a shame", "Something went wrong", "Try again", "Not now"); if(answer) game.LoadAndAdd(); }; } public void NextPage() { var i = Children.IndexOf(CurrentPage); if(i < Children.Count - 1) CurrentPage = Children [i + 1]; NextQuestion (); } public void NextQuestion () { game.LoadAndAdd(); } public void NextAndRemove (ContentPage page) { Action NextAndRemoveTask = async () => { NextPage (); await Task.Delay (500); Children.Remove (page); }; Device.BeginInvokeOnMainThread(NextAndRemoveTask); } } }
using System; using Xamarin.Forms; namespace PicMatcher { public delegate void EventHandler(object sender, EventArgs e); public class PicMatcher : CarouselPage { private Game game; public PicMatcher () { this.Title = "PicMatcher"; // this.Children.Add(new HomePage()); game = new Game (); this.Children.Add (game.Next()); game.Added += (object sender, EventArgs e) => { this.Children.Add (game.Next()); }; game.NextPage += (object sender, EventArgs e) => { NextPage(); }; game.Error += async (object sender, EventArgs e) => { var answer = await DisplayAlert("What a shame", "Something went wrong", "Try again", "Not now"); if(answer) game.LoadAndAdd(); }; } public void NextPage() { var i = Children.IndexOf(CurrentPage); if(i < Children.Count - 1) CurrentPage = Children [i + 1]; NextQuestion (); } public void NextQuestion () { game.LoadAndAdd(); } } }
mit
C#
23306dccca270ec5671a87115c38c7036bb92570
Set Dataset to the Public scope
quandl/quandl-excel-windows
QuandlShared/models/Dataset.cs
QuandlShared/models/Dataset.cs
using System.Collections.Generic; namespace Quandl.Shared.Models { public class Dataset : IDataDefinition, IDataStructure { public string Name { get; set; } public string Code { get { return $"{DatabaseCode}/{DatasetCode}"; } } public List<DataColumn> Column { get; set; } public int Id { get; set; } public string DatasetCode { get; set; } public string DatabaseCode { get; set; } public string Description { get; set; } public bool Premium { get; set; } } }
using System.Collections.Generic; namespace Quandl.Shared.Models { class Dataset : IDataDefinition, IDataStructure { public string Name { get; set; } public string Code { get { return $"{DatabaseCode}/{DatasetCode}"; } } public List<DataColumn> Column { get; set; } public int Id { get; set; } public string DatasetCode { get; set; } public string DatabaseCode { get; set; } public string Description { get; set; } public bool Premium { get; set; } } }
mit
C#
e5131400e77d7ba9c213259ad883fc715206b9f7
Remove now unnecessary position manipulation
ppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu-new
osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs
osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Linq; using osu.Framework.Allocation; using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Screens.Edit.Compose.Components; namespace osu.Game.Rulesets.Mania.Edit { public class ManiaSelectionHandler : SelectionHandler { [Resolved] private IScrollingInfo scrollingInfo { get; set; } [Resolved] private IManiaHitObjectComposer composer { get; set; } public override bool HandleMovement(MoveSelectionEvent moveEvent) { var maniaBlueprint = (ManiaSelectionBlueprint)moveEvent.Blueprint; int lastColumn = maniaBlueprint.DrawableObject.HitObject.Column; performColumnMovement(lastColumn, moveEvent); return true; } private void performColumnMovement(int lastColumn, MoveSelectionEvent moveEvent) { var currentColumn = composer.ColumnAt(moveEvent.ScreenSpacePosition); if (currentColumn == null) return; int columnDelta = currentColumn.Index - lastColumn; if (columnDelta == 0) return; int minColumn = int.MaxValue; int maxColumn = int.MinValue; foreach (var obj in SelectedHitObjects.OfType<ManiaHitObject>()) { if (obj.Column < minColumn) minColumn = obj.Column; if (obj.Column > maxColumn) maxColumn = obj.Column; } columnDelta = Math.Clamp(columnDelta, -minColumn, composer.TotalColumns - 1 - maxColumn); foreach (var obj in SelectedHitObjects.OfType<ManiaHitObject>()) obj.Column += columnDelta; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Linq; using osu.Framework.Allocation; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Screens.Edit.Compose.Components; namespace osu.Game.Rulesets.Mania.Edit { public class ManiaSelectionHandler : SelectionHandler { [Resolved] private IScrollingInfo scrollingInfo { get; set; } [Resolved] private IManiaHitObjectComposer composer { get; set; } public override bool HandleMovement(MoveSelectionEvent moveEvent) { var maniaBlueprint = (ManiaSelectionBlueprint)moveEvent.Blueprint; int lastColumn = maniaBlueprint.DrawableObject.HitObject.Column; performDragMovement(moveEvent); performColumnMovement(lastColumn, moveEvent); return true; } private void performDragMovement(MoveSelectionEvent moveEvent) { float delta = moveEvent.InstantDelta.Y; foreach (var selectionBlueprint in SelectedBlueprints) { var b = (OverlaySelectionBlueprint)selectionBlueprint; var hitObject = b.DrawableObject; // We receive multiple movement events per frame such that we can't rely on updating the start time // since the scrolling hitobject container requires at least one update frame to update the position. // However the position needs to be valid for future movement events to calculate the correct deltas. hitObject.Y += delta; } } private void performColumnMovement(int lastColumn, MoveSelectionEvent moveEvent) { var currentColumn = composer.ColumnAt(moveEvent.ScreenSpacePosition); if (currentColumn == null) return; int columnDelta = currentColumn.Index - lastColumn; if (columnDelta == 0) return; int minColumn = int.MaxValue; int maxColumn = int.MinValue; foreach (var obj in SelectedHitObjects.OfType<ManiaHitObject>()) { if (obj.Column < minColumn) minColumn = obj.Column; if (obj.Column > maxColumn) maxColumn = obj.Column; } columnDelta = Math.Clamp(columnDelta, -minColumn, composer.TotalColumns - 1 - maxColumn); foreach (var obj in SelectedHitObjects.OfType<ManiaHitObject>()) obj.Column += columnDelta; } } }
mit
C#
dc208ad399707b7c7ee9810f81f6e730eb9db853
Fix app not fully closing on exit
danielchalmers/SteamAccountSwitcher
SteamAccountSwitcher/MainWindow.xaml.cs
SteamAccountSwitcher/MainWindow.xaml.cs
#region using System.ComponentModel; using System.Linq; using System.Windows; using System.Windows.Controls; using SteamAccountswitcher; using SteamAccountSwitcher.Properties; #endregion namespace SteamAccountSwitcher { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private readonly AccountHandler _accountHandler; public readonly ContextMenu Menu; public MainWindow() { InitializeComponent(); // Setup account handler. _accountHandler = new AccountHandler(spAccounts, Hide, Show); // Assign context menus. Menu = new MenuHelper(_accountHandler).MainMenu(); notifyIcon.ContextMenu = new MenuHelper(_accountHandler).NotifyMenu(); if (Settings.Default.AlwaysOn) Hide(); if (Settings.Default.OnStartLoginName != "" && Settings.Default.AlwaysOn) { foreach ( var account in App.Accounts.Where(x => x.Username == Settings.Default.OnStartLoginName) ) { _accountHandler.SwitchAccount(App.Accounts.IndexOf(account)); break; } } if (spAccounts.Children.Count > 0) spAccounts.Children[0].Focus(); } private void Window_Closing(object sender, CancelEventArgs e) { if (Settings.Default.AlwaysOn) { e.Cancel = true; Hide(); return; } App.HelperWindow.Close(); } private void btnOptions_Click(object sender, RoutedEventArgs e) { Menu.IsOpen = true; } private void btnAddAccount_Click(object sender, RoutedEventArgs e) { _accountHandler.New(); } private void notifyIcon_TrayMouseDoubleClick(object sender, RoutedEventArgs e) { Show(); } } }
#region using System.ComponentModel; using System.Linq; using System.Windows; using System.Windows.Controls; using SteamAccountswitcher; using SteamAccountSwitcher.Properties; #endregion namespace SteamAccountSwitcher { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private readonly AccountHandler _accountHandler; public readonly ContextMenu Menu; public MainWindow() { InitializeComponent(); // Setup account handler. _accountHandler = new AccountHandler(spAccounts, Hide, Show); // Assign context menus. Menu = new MenuHelper(_accountHandler).MainMenu(); notifyIcon.ContextMenu = new MenuHelper(_accountHandler).NotifyMenu(); if (Settings.Default.AlwaysOn) Hide(); if (Settings.Default.OnStartLoginName != "" && Settings.Default.AlwaysOn) { foreach ( var account in App.Accounts.Where(x => x.Username == Settings.Default.OnStartLoginName) ) { _accountHandler.SwitchAccount(App.Accounts.IndexOf(account)); break; } } if (spAccounts.Children.Count > 0) spAccounts.Children[0].Focus(); } private void Window_Closing(object sender, CancelEventArgs e) { if (Settings.Default.AlwaysOn) { e.Cancel = true; Hide(); } } private void btnOptions_Click(object sender, RoutedEventArgs e) { Menu.IsOpen = true; } private void btnAddAccount_Click(object sender, RoutedEventArgs e) { _accountHandler.New(); } private void notifyIcon_TrayMouseDoubleClick(object sender, RoutedEventArgs e) { Show(); } } }
mit
C#
00d3f5a8e583cd49f7f1a8478e6573aa96661548
Add GuildMemberJoin MessageType(#1263)
RogueException/Discord.Net,AntiTcb/Discord.Net
src/Discord.Net.Core/Entities/Messages/MessageType.cs
src/Discord.Net.Core/Entities/Messages/MessageType.cs
namespace Discord { /// <summary> /// Specifies the type of message. /// </summary> public enum MessageType { /// <summary> /// The default message type. /// </summary> Default = 0, /// <summary> /// The message when a recipient is added. /// </summary> RecipientAdd = 1, /// <summary> /// The message when a recipient is removed. /// </summary> RecipientRemove = 2, /// <summary> /// The message when a user is called. /// </summary> Call = 3, /// <summary> /// The message when a channel name is changed. /// </summary> ChannelNameChange = 4, /// <summary> /// The message when a channel icon is changed. /// </summary> ChannelIconChange = 5, /// <summary> /// The message when another message is pinned. /// </summary> ChannelPinnedMessage = 6, /// <summary> /// The message when a new member joined. /// </summary> GuildMemberJoin = 7 } }
namespace Discord { /// <summary> /// Specifies the type of message. /// </summary> public enum MessageType { /// <summary> /// The default message type. /// </summary> Default = 0, /// <summary> /// The message when a recipient is added. /// </summary> RecipientAdd = 1, /// <summary> /// The message when a recipient is removed. /// </summary> RecipientRemove = 2, /// <summary> /// The message when a user is called. /// </summary> Call = 3, /// <summary> /// The message when a channel name is changed. /// </summary> ChannelNameChange = 4, /// <summary> /// The message when a channel icon is changed. /// </summary> ChannelIconChange = 5, /// <summary> /// The message when another message is pinned. /// </summary> ChannelPinnedMessage = 6 } }
mit
C#
a8e3839e422428276a5c97e9196f80475af364ab
Add some additional options
huysentruitw/owin-session-middleware
src/OwinSessionMiddleware/SessionMiddlewareOptions.cs
src/OwinSessionMiddleware/SessionMiddlewareOptions.cs
using System; using System.Security.Cryptography; namespace OwinSessionMiddleware { public class SessionMiddlewareOptions { public static class Defaults { public const string CookieName = "osm.sid"; public const string SessionContextOwinEnvironmentKey = "OSM.SessionContext"; public static string UniqueSessionIdGenerator() { var random = new byte[8]; using (var rng = new RNGCryptoServiceProvider()) rng.GetBytes(random); return $"{Guid.NewGuid():N}.{Convert.ToBase64String(random)}"; } } public string CookieName { get; set; } = Defaults.CookieName; public string CookieDomain { get; set; } = null; public TimeSpan? CookieLifetime { get; set; } = null; public bool UseSecureCookie { get; set; } = true; public string SessionContextOwinEnvironmentKey { get; set; } = Defaults.SessionContextOwinEnvironmentKey; public ISessionStore Store { get; set; } = new InMemorySessionStore(); public Func<string> UniqueSessionIdGenerator { get; set; } = Defaults.UniqueSessionIdGenerator; } }
using System; using System.Security.Cryptography; namespace OwinSessionMiddleware { public class SessionMiddlewareOptions { public static class Defaults { public const string CookieName = "osm.sid"; public const string SessionContextOwinEnvironmentKey = "OSM.SessionContext"; public static string UniqueSessionIdGenerator() { var random = new byte[8]; using (var rng = new RNGCryptoServiceProvider()) rng.GetBytes(random); return $"{Guid.NewGuid():N}.{Convert.ToBase64String(random)}"; } } public string CookieName { get; set; } = Defaults.CookieName; public string SessionContextOwinEnvironmentKey { get; set; } = Defaults.SessionContextOwinEnvironmentKey; public ISessionStore Store { get; set; } = new InMemorySessionStore(); public Func<string> UniqueSessionIdGenerator { get; set; } = Defaults.UniqueSessionIdGenerator; } }
apache-2.0
C#
94ac29e63d15aeefc1ce4d1d9ddd8686e78bf156
bump version
Fody/PropertyChanged
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyCompany("Simon Cropp and Contributors")] [assembly: AssemblyDescription("Fody add-in for injecting INotifyPropertyChanged code into properties.")] [assembly: AssemblyVersion("2.1.3")] [assembly: AssemblyFileVersion("2.1.3")]
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyCompany("Simon Cropp and Contributors")] [assembly: AssemblyDescription("Fody add-in for injecting INotifyPropertyChanged code into properties.")] [assembly: AssemblyVersion("2.1.2")] [assembly: AssemblyFileVersion("2.1.2")]
mit
C#
f8a93a733e9a0c54fc57b30b4dab4298d2d302d9
bump version
Fody/PropertyChanged,0x53A/PropertyChanged,user1568891/PropertyChanged
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyVersion("1.48.1")] [assembly: AssemblyFileVersion("1.48.1")]
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyVersion("1.48.0")] [assembly: AssemblyFileVersion("1.48.0")]
mit
C#
427666aaa7fb9cc3339dca1fe89b73d374de95a3
Allow progress dialog ready API call to proceed without sync (BL-11484)
BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop
src/BloomExe/web/controllers/ProgressDialogApi.cs
src/BloomExe/web/controllers/ProgressDialogApi.cs
using System; using System.IO; using System.Net; using System.Windows.Forms; using Bloom.Api; using Bloom.Book; using Bloom.MiscUI; using Bloom.Publish; using Bloom.Utils; using SIL.IO; namespace Bloom.web.controllers { public class ProgressDialogApi { private static Action _cancelHandler; public static void SetCancelHandler(Action cancelHandler) { _cancelHandler = cancelHandler; } public void RegisterWithApiHandler(BloomApiHandler apiHandler) { apiHandler.RegisterEndpointLegacy("progress/cancel", Cancel, false, false); apiHandler.RegisterEndpointHandler("progress/closed", BrowserProgressDialog.HandleProgressDialogClosed, false); // Doesn't need sync because all it does is set a flag, which nothing else modifies. // Mustn't need sync because we may be processing another request (e.g., creating a TC) when we launch the dialog // that we want to know is ready to receive messages. apiHandler.RegisterEndpointHandler("progress/ready", BrowserProgressDialog.HandleProgressReady, false, false); } private void Cancel(ApiRequest request) { // if it's null, and that causes a throw, well... that *is* an error situation _cancelHandler(); request.PostSucceeded(); } } }
using System; using System.IO; using System.Net; using System.Windows.Forms; using Bloom.Api; using Bloom.Book; using Bloom.MiscUI; using Bloom.Publish; using Bloom.Utils; using SIL.IO; namespace Bloom.web.controllers { public class ProgressDialogApi { private static Action _cancelHandler; public static void SetCancelHandler(Action cancelHandler) { _cancelHandler = cancelHandler; } public void RegisterWithApiHandler(BloomApiHandler apiHandler) { apiHandler.RegisterEndpointLegacy("progress/cancel", Cancel, false, false); apiHandler.RegisterEndpointHandler("progress/closed", BrowserProgressDialog.HandleProgressDialogClosed, false); apiHandler.RegisterEndpointHandler("progress/ready", BrowserProgressDialog.HandleProgressReady, false); } private void Cancel(ApiRequest request) { // if it's null, and that causes a throw, well... that *is* an error situation _cancelHandler(); request.PostSucceeded(); } } }
mit
C#
0d1a72df13ab7addb1346c91f147ec0a97a1c22e
Update class selection
Klackon/MMM
Assets/Scripts/CharCreateScreen.cs
Assets/Scripts/CharCreateScreen.cs
using UnityEngine; using System.Collections; public class CharCreateScreen : MonoBehaviour { public string name = "name"; public string race = "race"; public string wizard = "Select wizard"; public string portrait = "Select Portrait"; public string spellPick = "spellPick"; public string specialAbility = "speicalAbility"; public string banner = "banner"; public string homeCityName = "homeCityName"; string[] stringToEdit; // Use this for initialization void Start () { } void OnGUI() { /*addOnGUI (name, 20); addOnGUI (race, 40); addOnGUI (wizard, 60); addOnGUI (portrait, 80); addOnGUI (spellPick, 120); addOnGUI (specialAbility, 140); addOnGUI (banner, 160); addOnGUI (homeCityName, 180);*/ for (int i = 0; i < stringToEdit.Length; ++i) stringToEdit[i] = GUI.TextField(new Rect(60, i*20, 100, 20),stringToEdit[i] , 25); //stringToEdit[i] = GUILayout.TextField(stringToEdit[i], 5, GUILayout.Width(100)); } void addOnGUI(string name, int yaxis){ name = GUI.TextField(new Rect(60, yaxis, 100, 20), name, 25); } // Update is called once per frame void Update () { // switch to game if(Input.GetKeyDown(KeyCode.G)){ Application.LoadLevel(1); name = stringToEdit[0].ToString(); race = stringToEdit[1].ToString(); wizard = stringToEdit[2].ToString(); portrait = stringToEdit[3].ToString(); spellPick = stringToEdit[4].ToString(); specialAbility = stringToEdit[5].ToString(); banner = stringToEdit[6].ToString(); homeCityName = stringToEdit[7].ToString(); print (homeCityName); Player player1 = new Player(name,race,wizard,portrait,spellPick,specialAbility,banner,homeCityName); } // switch to menu if(Input.GetKeyDown(KeyCode.M)){ Application.LoadLevel(0); } } void Awake(){ Input.eatKeyPressOnTextFieldFocus = false; stringToEdit = new string[8]; for (int i = 0; i < stringToEdit.Length; ++i) stringToEdit[i] = string.Empty; } }
using UnityEngine; using System.Collections; public class CharCreateScreen : MonoBehaviour { public string name = "name"; public string race = "race"; public string wizard = "Select wizard"; public string portrait = "Select Portrait"; public string spellPick = "spellPick"; public string specialAbility = "speicalAbility"; public string banner = "banner"; public string homeCityName = "homeCityName"; string[] stringToEdit; // Use this for initialization void Start () { } void OnGUI() { /*addOnGUI (name, 20); addOnGUI (race, 40); addOnGUI (wizard, 60); addOnGUI (portrait, 80); addOnGUI (spellPick, 120); addOnGUI (specialAbility, 140); addOnGUI (banner, 160); addOnGUI (homeCityName, 180);*/ for (int i = 0; i < stringToEdit.Length; ++i) stringToEdit[i] = GUI.TextField(new Rect(60, i*20, 100, 20),stringToEdit[i] , 25); //stringToEdit[i] = GUILayout.TextField(stringToEdit[i], 5, GUILayout.Width(100)); } void addOnGUI(string name, int yaxis){ name = GUI.TextField(new Rect(60, yaxis, 100, 20), name, 25); } // Update is called once per frame void Update () { // switch to game if(Input.GetKeyDown(KeyCode.G)){ Application.LoadLevel(1); name = stringToEdit[0].ToString(); race = stringToEdit[1].ToString(); wizard = stringToEdit[2].ToString(); portrait = stringToEdit[3].ToString(); spellPick = stringToEdit[4].ToString(); specialAbility = stringToEdit[5].ToString(); banner = stringToEdit[6].ToString(); homeCityName = stringToEdit[7].ToString(); print (homeCityName); } // switch to menu if(Input.GetKeyDown(KeyCode.M)){ Application.LoadLevel(0); } } void Awake(){ Input.eatKeyPressOnTextFieldFocus = false; stringToEdit = new string[8]; for (int i = 0; i < stringToEdit.Length; ++i) stringToEdit[i] = string.Empty; } }
mpl-2.0
C#
c9efac819cca81390575cc8c614934e7b9fbf020
Update Program.cs
iamnotageek/GitTest1
ConsoleApp1/ConsoleApp1/Program.cs
ConsoleApp1/ConsoleApp1/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { //Code was edited in Github //Code was added in VS //Code to call Feature 1 //Code to call Feature 3 } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { //Code was edited in Github //Code was added in VS //Code to call Feature 1 } } }
mit
C#
65156d9bc3cc8c27a12db024eca84973fb99d09a
Add constructor ReservedPropertyNames in TypeScriptPropertyNameGenerator, closes https://github.com/RSuter/NSwag/issues/1997
RSuter/NJsonSchema,NJsonSchema/NJsonSchema
src/NJsonSchema.CodeGeneration.TypeScript/TypeScriptPropertyNameGenerator.cs
src/NJsonSchema.CodeGeneration.TypeScript/TypeScriptPropertyNameGenerator.cs
//----------------------------------------------------------------------- // <copyright file="TypeScriptPropertyNameGenerator.cs" company="NJsonSchema"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System.Collections.Generic; using System.Linq; namespace NJsonSchema.CodeGeneration.TypeScript { /// <summary>Generates the property name for a given TypeScript <see cref="JsonProperty"/>.</summary> public class TypeScriptPropertyNameGenerator : IPropertyNameGenerator { /// <summary>Gets or sets the reserved names.</summary> public IEnumerable<string> ReservedPropertyNames { get; set; } = new List<string> { "constructor" }; /// <summary>Generates the property name.</summary> /// <param name="property">The property.</param> /// <returns>The new name.</returns> public virtual string Generate(JsonProperty property) { var name = ConversionUtilities.ConvertToLowerCamelCase(property.Name .Replace("\"", string.Empty) .Replace("@", string.Empty) .Replace(".", "-") .Replace("=", "-") .Replace("+", "plus"), true) .Replace("*", "Star") .Replace(":", "_") .Replace("-", "_"); if (ReservedPropertyNames.Contains(name)) { return name + "_"; } return name; } } }
//----------------------------------------------------------------------- // <copyright file="TypeScriptPropertyNameGenerator.cs" company="NJsonSchema"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- namespace NJsonSchema.CodeGeneration.TypeScript { /// <summary>Generates the property name for a given TypeScript <see cref="JsonProperty"/>.</summary> public class TypeScriptPropertyNameGenerator : IPropertyNameGenerator { /// <summary>Generates the property name.</summary> /// <param name="property">The property.</param> /// <returns>The new name.</returns> public virtual string Generate(JsonProperty property) { return ConversionUtilities.ConvertToLowerCamelCase(property.Name .Replace("\"", string.Empty) .Replace("@", string.Empty) .Replace(".", "-") .Replace("=", "-") .Replace("+", "plus"), true) .Replace("*", "Star") .Replace(":", "_") .Replace("-", "_"); } } }
mit
C#