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
cd1c8eac71b4dda908c0ab1e3b17043825f7f0ae
Update Knight.cs (#41)
BosslandGmbH/BuddyWing.DefaultCombat
trunk/DefaultCombat/Routines/Basic/Knight.cs
trunk/DefaultCombat/Routines/Basic/Knight.cs
// Copyright (C) 2011-2016 Bossland GmbH // See the file LICENSE for the source code's detailed license using Buddy.BehaviorTree; using DefaultCombat.Core; using DefaultCombat.Helpers; namespace DefaultCombat.Routines { public class Knight : RotationBase { public override string Name { get { return "Basic Knight"; } } public override Composite Buffs { get { return new PrioritySelector( ); } } public override Composite Cooldowns { get { return new PrioritySelector( Spell.Cast("Saber Ward", ret => Me.HealthPercent <= 70) ); } } public override Composite SingleTarget { get { return new PrioritySelector( Spell.Cast("Force Leap", ret => !DefaultCombat.MovementDisabled && Me.CurrentTarget.Distance > 1f && Me.CurrentTarget.Distance <= 3f), CombatMovement.CloseDistance(Distance.Melee), Spell.Cast("Master Strike"), Spell.Cast("Blade Storm"), Spell.Cast("Riposte"), Spell.Cast("Slash", ret => Me.ActionPoints >= 7), Spell.Cast("Strike") ); } } public override Composite AreaOfEffect { get { return new Decorator(ret => Targeting.ShouldAoe, new PrioritySelector( Spell.Cast("Force Sweep", ret => Me.CurrentTarget.Distance <= Distance.MeleeAoE)) ); } } } }
// Copyright (C) 2011-2016 Bossland GmbH // See the file LICENSE for the source code's detailed license using Buddy.BehaviorTree; using DefaultCombat.Core; using DefaultCombat.Helpers; namespace DefaultCombat.Routines { public class Knight : RotationBase { public override string Name { get { return "Basic Knight"; } } public override Composite Buffs { get { return new PrioritySelector( Spell.Buff("Shii-Cho Form") ); } } public override Composite Cooldowns { get { return new PrioritySelector( Spell.Cast("Saber Ward", ret => Me.HealthPercent <= 70) ); } } public override Composite SingleTarget { get { return new PrioritySelector( Spell.Cast("Force Leap", ret => !DefaultCombat.MovementDisabled && Me.CurrentTarget.Distance > 1f && Me.CurrentTarget.Distance <= 3f), CombatMovement.CloseDistance(Distance.Melee), Spell.Cast("Master Strike"), Spell.Cast("Blade Storm"), Spell.Cast("Riposte"), Spell.Cast("Slash", ret => Me.ActionPoints >= 7), Spell.Cast("Strike") ); } } public override Composite AreaOfEffect { get { return new Decorator(ret => Targeting.ShouldAoe, new PrioritySelector( Spell.Cast("Force Sweep", ret => Me.CurrentTarget.Distance <= Distance.MeleeAoE)) ); } } } }
apache-2.0
C#
698e9f410e3def19fecbd2900e0144c7e1ba016e
Add HttpGet attribute
CogniStreamer/owin-security-cognistreamer
examples/Sample/IndexController.cs
examples/Sample/IndexController.cs
using System.Security.Claims; using System.Web.Http; namespace Sample { [Authorize] [RoutePrefix("")] public class IndexController : ApiController { [HttpGet] [Route("")] public string Get() { var identity = this.User.Identity as ClaimsIdentity; return $"Authenticated as {identity.FindFirst(ClaimTypes.GivenName).Value} {identity.FindFirst(ClaimTypes.Surname).Value}!"; } } }
using System.Security.Claims; using System.Web.Http; namespace Sample { [Authorize] [RoutePrefix("")] public class IndexController : ApiController { [Route("")] public string Get() { var identity = this.User.Identity as ClaimsIdentity; return $"Authenticated as {identity.FindFirst(ClaimTypes.GivenName).Value} {identity.FindFirst(ClaimTypes.Surname).Value}!"; } } }
apache-2.0
C#
00aa2270afb15405af112df867b704604fbc8b6a
Update assembly info
jarshwah/BringChromeToFront
BringChromeToFront/Properties/AssemblyInfo.cs
BringChromeToFront/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("BringChromeToFront")] [assembly: AssemblyDescription("Brings the Chrome browser to the foreground, and tries to activate the requested Tab")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Engage")] [assembly: AssemblyProduct("BringChromeToFront")] [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("97b04fc5-110e-49af-8aea-b75b4c45e879")] // 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("BringChromeToFront")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BringChromeToFront")] [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("97b04fc5-110e-49af-8aea-b75b4c45e879")] // 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#
d35a9ace71b5b7a08c78af054f94e6e291d51149
Fix test
mattolenik/winston,mattolenik/winston,mattolenik/winston
Winston.Test/Fetchers/HttpPackageFixture.cs
Winston.Test/Fetchers/HttpPackageFixture.cs
using System; using System.IO; using System.Net; using System.Reflection; using HttpMock; namespace Winston.Test.Fetchers { public class HttpPackageFixture : IDisposable { readonly IHttpServer server; public readonly string Prefix = "http://localhost:9501"; public HttpPackageFixture() { server = HttpMockRepository.At(new Uri(Prefix)); var path = Path.Combine(Assembly.GetExecutingAssembly().Directory(), "testdata", "test-0.5.zip"); server.Stub(x => x.Get("/realpkg")).AddHeader("Content-Disposition", "attachment; filename=test-0.5.zip").ReturnFile(path).OK(); server.Stub(x => x.Head("/realpkg")).Return("").OK(); server.Stub(x => x.Get("/redirectedpkg")) .Return("") .AddHeader("Location", $"{Prefix}/realpkg") .WithStatus(HttpStatusCode.Moved); server.Stub(x => x.Head("/redirectedpkg")) .Return("") .AddHeader("Location", $"{Prefix}/realpkg") .WithStatus(HttpStatusCode.Moved); server.Start(); } public void Dispose() { server.Dispose(); } } }
using System; using System.IO; using System.Net; using System.Reflection; using HttpMock; namespace Winston.Test.Fetchers { public class HttpPackageFixture : IDisposable { readonly IHttpServer server; public readonly string Prefix = "http://localhost:9501"; public HttpPackageFixture() { server = HttpMockRepository.At(new Uri(Prefix)); var path = Path.Combine(Assembly.GetExecutingAssembly().Directory(), "testdata", "test-0.5.zip"); server.Stub(x => x.Get("/realpkg")).ReturnFile(path).OK(); server.Stub(x => x.Head("/realpkg")).Return("").OK(); server.Stub(x => x.Head("/redirectedpkg")) .Return("") .AddHeader("Location", $"{Prefix}/realpkg") .WithStatus(HttpStatusCode.Moved); server.Start(); } public void Dispose() { server.Dispose(); } } }
mit
C#
27848326f04aaaa0c49c667ef887583465f55899
make the CA nag happy
michaKFromParis/octokit.net,dampir/octokit.net,darrelmiller/octokit.net,octokit/octokit.net,devkhan/octokit.net,SLdragon1989/octokit.net,M-Zuber/octokit.net,yonglehou/octokit.net,gabrielweyer/octokit.net,octokit/octokit.net,Red-Folder/octokit.net,devkhan/octokit.net,octokit-net-test-org/octokit.net,shana/octokit.net,octokit-net-test/octokit.net,TattsGroup/octokit.net,shiftkey-tester/octokit.net,daukantas/octokit.net,ChrisMissal/octokit.net,editor-tools/octokit.net,TattsGroup/octokit.net,geek0r/octokit.net,kolbasov/octokit.net,takumikub/octokit.net,Sarmad93/octokit.net,ivandrofly/octokit.net,SamTheDev/octokit.net,eriawan/octokit.net,fffej/octokit.net,nsnnnnrn/octokit.net,chunkychode/octokit.net,mminns/octokit.net,forki/octokit.net,fake-organization/octokit.net,octokit-net-test-org/octokit.net,alfhenrik/octokit.net,yonglehou/octokit.net,rlugojr/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,Sarmad93/octokit.net,editor-tools/octokit.net,SmithAndr/octokit.net,shana/octokit.net,chunkychode/octokit.net,shiftkey-tester/octokit.net,gdziadkiewicz/octokit.net,SamTheDev/octokit.net,brramos/octokit.net,thedillonb/octokit.net,hitesh97/octokit.net,rlugojr/octokit.net,naveensrinivasan/octokit.net,thedillonb/octokit.net,mminns/octokit.net,shiftkey/octokit.net,dlsteuer/octokit.net,eriawan/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,M-Zuber/octokit.net,alfhenrik/octokit.net,ivandrofly/octokit.net,magoswiat/octokit.net,kdolan/octokit.net,gabrielweyer/octokit.net,hahmed/octokit.net,khellang/octokit.net,SmithAndr/octokit.net,dampir/octokit.net,khellang/octokit.net,nsrnnnnn/octokit.net,gdziadkiewicz/octokit.net,hahmed/octokit.net,cH40z-Lord/octokit.net,bslliw/octokit.net,shiftkey/octokit.net,adamralph/octokit.net
Octokit/Http/ICredentialStore.cs
Octokit/Http/ICredentialStore.cs
using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; namespace Octokit.Internal { public interface ICredentialStore { [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification="Nope")] Task<Credentials> GetCredentials(); } }
using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; namespace Octokit.Internal { public interface ICredentialStore { Task<Credentials> GetCredentials(); } }
mit
C#
334842b59d27381da2c9b2250c3c6c0a37925049
Disable parsing NUM_OPTIONS on player's own turn
theAprel/OptionsDisplay
OptionsDisplay/OptionsDisplay.cs
OptionsDisplay/OptionsDisplay.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Hearthstone_Deck_Tracker.Enums; using Hearthstone_Deck_Tracker.Hearthstone; namespace OptionsDisplay { public class TagPrinter { private static LogWindow window; private static bool disableLogParsing = false; public static void Load() { window = new LogWindow(); window.Show(); Hearthstone_Deck_Tracker.API.LogEvents.OnPowerLogLine.Add(ProcessPowerLogLine); Hearthstone_Deck_Tracker.API.GameEvents.OnTurnStart.Add(PrepareForStartOfTurn); Hearthstone_Deck_Tracker.API.GameEvents.OnGameStart.Add(window.ClearAll); } public static void PrepareForStartOfTurn(ActivePlayer ap) { window.MoveToHistory(); if (ap == ActivePlayer.Player) { disableLogParsing = true; } else { disableLogParsing = false; } } public static void ProcessPowerLogLine(String line) { if (disableLogParsing) return; if(line.Contains("tag=NUM_OPTIONS ")) { String entity = GetValueInLogEntry(line, "Entity"); String value = GetValueInLogEntry(line, "value"); window.AppendWindowText(entity + " has " + value + " options."); } } private static String GetValueInLogEntry(String entry, String key) { int keyIndex = entry.IndexOf(key); String afterEqualsSign = entry.Substring(keyIndex + key.Length + 1); // +1 is the equals sign if(!afterEqualsSign.Contains("=")) { return afterEqualsSign; // no more key-value pairs on log line; return this last value } int nextEquals = afterEqualsSign.IndexOf("="); String valueAndNextKey = afterEqualsSign.Substring(0, nextEquals); int lastSpaceIndex = valueAndNextKey.LastIndexOf(" "); return valueAndNextKey.Substring(0, lastSpaceIndex); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Hearthstone_Deck_Tracker.Enums; namespace OptionsDisplay { public class TagPrinter { private static LogWindow window; public static void Load() { window = new LogWindow(); window.Show(); Hearthstone_Deck_Tracker.API.LogEvents.OnPowerLogLine.Add(ProcessPowerLogLine); Hearthstone_Deck_Tracker.API.GameEvents.OnTurnStart.Add(PrepareForStartOfTurn); Hearthstone_Deck_Tracker.API.GameEvents.OnGameStart.Add(window.ClearAll); } public static void PrepareForStartOfTurn(ActivePlayer ap) { window.MoveToHistory(); } public static void ProcessPowerLogLine(String line) { if(line.Contains("tag=NUM_OPTIONS ")) { String entity = GetValueInLogEntry(line, "Entity"); String value = GetValueInLogEntry(line, "value"); window.AppendWindowText(entity + " has " + value + " options."); } } private static String GetValueInLogEntry(String entry, String key) { int keyIndex = entry.IndexOf(key); String afterEqualsSign = entry.Substring(keyIndex + key.Length + 1); // +1 is the equals sign if(!afterEqualsSign.Contains("=")) { return afterEqualsSign; // no more key-value pairs on log line; return this last value } int nextEquals = afterEqualsSign.IndexOf("="); String valueAndNextKey = afterEqualsSign.Substring(0, nextEquals); int lastSpaceIndex = valueAndNextKey.LastIndexOf(" "); return valueAndNextKey.Substring(0, lastSpaceIndex); } } }
agpl-3.0
C#
884dd0c170d536099bba4c43076a443ba4748721
Support for IP address URLs
nwoolls/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner
MultiMiner.Win/Extensions/StringExtensions.cs
MultiMiner.Win/Extensions/StringExtensions.cs
using System; using System.Collections.Generic; using System.IO; namespace MultiMiner.Win.Extensions { static class StringExtensions { private readonly static Dictionary<string, string> hostDomainNames = new Dictionary<string, string>(); public static string DomainFromHost(this string host) { if (String.IsNullOrEmpty(host)) return String.Empty; if (hostDomainNames.ContainsKey(host)) return hostDomainNames[host]; string domainName; if (!host.Contains(":")) host = "http://" + host; Uri uri = new Uri(host); domainName = uri.Host; if (uri.HostNameType == UriHostNameType.Dns) { //remove subdomain if there is one if (domainName.Split('.').Length > 2) { int index = domainName.IndexOf(".") + 1; domainName = domainName.Substring(index, domainName.Length - index); } //remove TLD domainName = Path.GetFileNameWithoutExtension(domainName); } hostDomainNames[host] = domainName; return domainName; } } }
using System; using System.Collections.Generic; using System.IO; namespace MultiMiner.Win.Extensions { static class StringExtensions { private readonly static Dictionary<string, string> hostDomainNames = new Dictionary<string, string>(); public static string DomainFromHost(this string host) { if (String.IsNullOrEmpty(host)) return String.Empty; if (hostDomainNames.ContainsKey(host)) return hostDomainNames[host]; string domainName; if (!host.Contains(":")) host = "http://" + host; Uri uri = new Uri(host); domainName = uri.Host; //remove subdomain if there is one if (domainName.Split('.').Length > 2) { int index = domainName.IndexOf(".") + 1; domainName = domainName.Substring(index, domainName.Length - index); } //remove TLD domainName = Path.GetFileNameWithoutExtension(domainName); hostDomainNames[host] = domainName; return domainName; } } }
mit
C#
d73418df65436b3658e39e5de37b09d2620e6cff
Update version to 1.0.1
damianh/OwinEmbeddedHost
src/SharedAssemblyInfo.cs
src/SharedAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Damian Hickey")] [assembly: AssemblyProduct("Owin.EmbeddedHost")] [assembly: AssemblyCopyright("Copyright © Damian Hickey, MS Open Tech 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.1.0")] [assembly: AssemblyFileVersion("1.0.1.0")]
using System.Reflection; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Damian Hickey")] [assembly: AssemblyProduct("Owin.EmbeddedHost")] [assembly: AssemblyCopyright("Copyright © Damian Hickey, MS Open Tech 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
c83d2be352c16c1b0f1f3a651b40370695363103
Change garden flowers link to return combined search results.
dsteinweg/TeacherPouch,dsteinweg/TeacherPouch,dsteinweg/TeacherPouch,dsteinweg/TeacherPouch
TeacherPouch.Web/Views/Category/Garden.cshtml
TeacherPouch.Web/Views/Category/Garden.cshtml
@{ ViewBag.Title = "Garden - Category"; } <div id="category"> <div class="hero-unit"> <header> <img src="@Url.VersionedContent("~/img/GardenS.jpg")"> </header> <header> <h3>Grow garden! Grow! </h3> </header> </div> <div class="row-fluid featured-tags-preview"> <div class="span4"> <a href="@Url.CombinedSearch("garden vegetable")"><img src="@Url.VersionedContent("~/img/gardenvegetablesS.jpg")"></a> </div> <div class="span4"> <a href="@Url.Category("flowers")"><img src="@Url.VersionedContent("~/img/FlowersS.jpg")"></a> </div> <div class="span4"> <a href="@Url.CombinedSearch("garden fruit")"><img src="@Url.VersionedContent("~/img/gardenfruitS.jpg")"></a> </div> </div> <div class="row-fluid featured-tags-preview"> <div class="span4"> <a href="@Url.Search("plant")"><img src="@Url.VersionedContent("~/img/plantsS.jpg")"></a> </div> <div class="span4"> <a href="@Url.Search("apple orchard")"><img src="@Url.VersionedContent("~/img/appleorchardS.jpg")"></a> </div> <div class="span4"> <a href="@Url.Search("tree")"><img src="@Url.VersionedContent("~/img/treesS.jpg")"></a> </div> </div> <div class="row-fluid featured-tags-preview"> <div class="span4"></div> <div class="span4"> <a href="@Url.Search("garden")"><img src="@Url.VersionedContent("~/img/allgardenS.jpg")"></a> </div> <div class="span4"></div> </div> </div>
@{ ViewBag.Title = "Garden - Category"; } <div id="category"> <div class="hero-unit"> <header> <img src="@Url.VersionedContent("~/img/GardenS.jpg")"> </header> <header> <h3>Grow garden! Grow! </h3> </header> </div> <div class="row-fluid featured-tags-preview"> <div class="span4"> <a href="@Url.CombinedSearch("garden vegetable")"><img src="@Url.VersionedContent("~/img/gardenvegetablesS.jpg")"></a> </div> <div class="span4"> <a href="@Url.CombinedSearch("garden flowers")"><img src="@Url.VersionedContent("~/img/FlowersS.jpg")"></a> </div> <div class="span4"> <a href="@Url.CombinedSearch("garden fruit")"><img src="@Url.VersionedContent("~/img/gardenfruitS.jpg")"></a> </div> </div> <div class="row-fluid featured-tags-preview"> <div class="span4"> <a href="@Url.Search("plant")"><img src="@Url.VersionedContent("~/img/plantsS.jpg")"></a> </div> <div class="span4"> <a href="@Url.Search("apple orchard")"><img src="@Url.VersionedContent("~/img/appleorchardS.jpg")"></a> </div> <div class="span4"> <a href="@Url.Search("tree")"><img src="@Url.VersionedContent("~/img/treesS.jpg")"></a> </div> </div> <div class="row-fluid featured-tags-preview"> <div class="span4"> </div> <div class="span4"> <a href="@Url.Search("garden")"><img src="@Url.VersionedContent("~/img/allgardenS.jpg")"></a> </div> <div class="span4"> </div> </div> </div>
mit
C#
59c2116adebfd23fc709b1df99e25650ce4afb08
fix unittest
Tynamix/ObjectFiller.NET
Tynamix.ObjectFiller.Test/ObjectFillerTest.cs
Tynamix.ObjectFiller.Test/ObjectFillerTest.cs
using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using Tynamix.ObjectFiller.Test.TestPoco.Person; namespace Tynamix.ObjectFiller.Test { [TestClass] public class ObjectFillerTest { [TestMethod] public void TestFillPerson() { Person p = new Person(); Filler<Person> filler = new Filler<Person>(); filler.Setup() .OnType<IAddress>().CreateInstanceOf<Address>() .OnType<string>().Use(new MnemonicString(10)) .OnProperty(person => person.FirstName).Use<MnemonicString>() .OnProperty(person => person.LastName).Use(new RandomListItem<string>("Maik", "Tom", "Anton")) .OnProperty(person => person.Age).Use(() => Tynamix.ObjectFiller.Random.Next(12, 83)) .SetupFor<Address>() .OnProperty(x => x.City, x => x.Country).IgnoreIt(); Person pFilled = filler.Fill(p); Assert.IsTrue(new List<string>() { "Maik", "Tom", "Anton" }.Contains(pFilled.LastName)); } [TestMethod] public void CreateMultipleInstances() { Filler<LibraryFillingTest.Person> filler = new Filler<LibraryFillingTest.Person>(); IEnumerable<LibraryFillingTest.Person> pList = filler.Create(10); Assert.IsNotNull(pList); Assert.AreEqual(10, pList.Count()); } [TestMethod] public void SetRandomSeedShallGenerateSameData() { var filler = new Filler<Address>(); var address1 = filler.SetRandomSeed(1234).Create(); var filler2 = new Filler<Address>(); var address2 = filler2.SetRandomSeed(1234).Create(); Assert.AreEqual(address1.City, address2.City); Assert.AreEqual(address1.Country, address2.Country); Assert.AreEqual(address1.HouseNumber, address2.HouseNumber); Assert.AreEqual(address1.PostalCode, address2.PostalCode); Assert.AreEqual(address1.Street, address2.Street); } } }
using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using Tynamix.ObjectFiller.Test.TestPoco.Person; namespace Tynamix.ObjectFiller.Test { [TestClass] public class ObjectFillerTest { [TestMethod] public void TestFillPerson() { Person p = new Person(); Filler<Person> filler = new Filler<Person>(); filler.Setup() .OnType<IAddress>().CreateInstanceOf<Address>() .OnType<string>().Use(new MnemonicString(10)) .OnProperty(person => person.FirstName).Use<MnemonicString>() .OnProperty(person => person.LastName).Use(new RandomListItem<string>("Maik", "Tom", "Anton")) .OnProperty(person => person.Age).Use(() => Tynamix.ObjectFiller.Random.Next(12, 83)) .SetupFor<Address>() .OnProperty(x => x.City, x => x.Country).IgnoreIt(); Person pFilled = filler.Fill(p); Assert.IsTrue(new List<string>() { "Maik", "Tom", "Anton" }.Contains(pFilled.LastName)); } [TestMethod] public void CreateMultipleInstances() { Filler<LibraryFillingTest.Person> filler = new Filler<LibraryFillingTest.Person>(); IEnumerable<LibraryFillingTest.Person> pList = filler.Create(10); Assert.IsNotNull(pList); Assert.AreEqual(10, pList.Count()); } [TestMethod] public void SetRandomSeedShallGenerateSameData() { var filler = new Filler<Address>(); var address1 = filler.SetRandomSeed(1234).Create(); var filler2 = new Filler<Address>(); var address2 = filler.SetRandomSeed(1234).Create(); Assert.AreEqual(address1.City, address2.City); Assert.AreEqual(address1.Country, address2.Country); Assert.AreEqual(address1.HouseNumber, address2.HouseNumber); Assert.AreEqual(address1.PostalCode, address2.PostalCode); Assert.AreEqual(address1.Street, address2.Street); } } }
mit
C#
cb6d5c4b8e01b5234db4506b55ae89f9d6ad9f19
Update ReturnScript.cs
textadventures/quest,textadventures/quest,textadventures/quest,textadventures/quest
WorldModel/WorldModel/Scripts/ReturnScript.cs
WorldModel/WorldModel/Scripts/ReturnScript.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using TextAdventures.Quest.Functions; namespace TextAdventures.Quest.Scripts { public class ReturnScriptConstructor : ScriptConstructorBase { public override string Keyword { get { return "return"; } } protected override IScript CreateInt(List<string> parameters, ScriptContext scriptContext) { return new ReturnScript(scriptContext, new ExpressionGeneric(parameters[0], scriptContext)); } protected override int[] ExpectedParameters { get { return new int[] { 1 }; } } } public class ReturnScript : ScriptBase { private ScriptContext m_scriptContext; private WorldModel m_worldModel; private IFunctionGeneric m_returnValue; public ReturnScript(ScriptContext scriptContext, IFunctionGeneric returnValue) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_returnValue = returnValue; } protected override ScriptBase CloneScript() { return new ReturnScript(m_scriptContext, m_returnValue.Clone()); } public override void Execute(Context c) { c.ReturnValue = m_returnValue.Execute(c); if (m_worldModel.Version >= WorldModelVersion.v550) c.IsReturned = true; } public override string Save() { return SaveScript("return", m_returnValue.Save()); } public override string Keyword { get { return "return"; } } public override object GetParameter(int index) { return m_returnValue.Save(); } public override void SetParameterInternal(int index, object value) { m_returnValue = new ExpressionGeneric((string)value, m_scriptContext); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using TextAdventures.Quest.Functions; namespace TextAdventures.Quest.Scripts { public class ReturnScriptConstructor : ScriptConstructorBase { public override string Keyword { get { return "return"; } } protected override IScript CreateInt(List<string> parameters, ScriptContext scriptContext) { return new ReturnScript(scriptContext, new ExpressionGeneric(parameters[0], scriptContext)); } protected override int[] ExpectedParameters { get { return new int[] { 1 }; } } } public class ReturnScript : ScriptBase { private ScriptContext m_scriptContext; private WorldModel m_worldModel; private IFunctionGeneric m_returnValue; public ReturnScript(ScriptContext scriptContext, IFunctionGeneric returnValue) { m_scriptContext = scriptContext; m_worldModel = scriptContext.WorldModel; m_returnValue = returnValue; } protected override ScriptBase CloneScript() { return new ReturnScript(m_scriptContext, m_returnValue.Clone()); } public override void Execute(Context c) { c.ReturnValue = m_returnValue.Execute(c); if (m_worldModel.Version >= WorldModelVersion.v580) c.IsReturned = true; } public override string Save() { return SaveScript("return", m_returnValue.Save()); } public override string Keyword { get { return "return"; } } public override object GetParameter(int index) { return m_returnValue.Save(); } public override void SetParameterInternal(int index, object value) { m_returnValue = new ExpressionGeneric((string)value, m_scriptContext); } } }
mit
C#
f86496c06dd20d6fe88d15539d269fc786567e48
Fix serialization of property Report in DefaultXml
Seddryck/NBi,Seddryck/NBi
NBi.Xml/Settings/DefaultXml.cs
NBi.Xml/Settings/DefaultXml.cs
using System.Collections.Generic; using System.Xml.Serialization; using NBi.Xml.Items; namespace NBi.Xml.Settings { public class DefaultXml { [XmlAttribute("apply-to")] public SettingsXml.DefaultScope ApplyTo { get; set; } [XmlElement ("connectionString")] public string ConnectionString { get; set; } [XmlElement("parameter")] public List<QueryParameterXml> Parameters { get; set; } [XmlElement("variable")] public List<QueryTemplateVariableXml> Variables { get; set; } [XmlElement("report")] public ReportBaseXml Report { get; set; } [XmlIgnore] public bool ReportSpecified { get { return !string.IsNullOrEmpty(Report.Path) || !string.IsNullOrEmpty(Report.Source); } set { return; } } public DefaultXml(SettingsXml.DefaultScope applyTo) : this() { ApplyTo = applyTo; } public DefaultXml() { Parameters = new List<QueryParameterXml>(); Variables = new List<QueryTemplateVariableXml>(); Report = new ReportBaseXml(); } } }
using System.Collections.Generic; using System.Xml.Serialization; using NBi.Xml.Items; namespace NBi.Xml.Settings { public class DefaultXml { [XmlAttribute("apply-to")] public SettingsXml.DefaultScope ApplyTo { get; set; } [XmlElement ("connectionString")] public string ConnectionString { get; set; } [XmlElement("parameter")] public List<QueryParameterXml> Parameters { get; set; } [XmlElement("variable")] public List<QueryTemplateVariableXml> Variables { get; set; } [XmlElement("report")] public ReportBaseXml Report { get; set; } public DefaultXml(SettingsXml.DefaultScope applyTo) : this() { ApplyTo = applyTo; } public DefaultXml() { Parameters = new List<QueryParameterXml>(); Variables = new List<QueryTemplateVariableXml>(); Report = new ReportBaseXml(); } } }
apache-2.0
C#
cf9dd7fe957fc082f29bd6c88f7829a5eba36db3
Indent Justification for readability
dampir/octokit.net,khellang/octokit.net,michaKFromParis/octokit.net,brramos/octokit.net,darrelmiller/octokit.net,mminns/octokit.net,geek0r/octokit.net,forki/octokit.net,eriawan/octokit.net,TattsGroup/octokit.net,alfhenrik/octokit.net,hahmed/octokit.net,mminns/octokit.net,cH40z-Lord/octokit.net,octokit-net-test/octokit.net,thedillonb/octokit.net,naveensrinivasan/octokit.net,devkhan/octokit.net,shiftkey-tester/octokit.net,yonglehou/octokit.net,dlsteuer/octokit.net,M-Zuber/octokit.net,Red-Folder/octokit.net,octokit-net-test-org/octokit.net,alfhenrik/octokit.net,khellang/octokit.net,fake-organization/octokit.net,TattsGroup/octokit.net,nsrnnnnn/octokit.net,ChrisMissal/octokit.net,M-Zuber/octokit.net,kolbasov/octokit.net,eriawan/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,rlugojr/octokit.net,kdolan/octokit.net,chunkychode/octokit.net,thedillonb/octokit.net,chunkychode/octokit.net,SLdragon1989/octokit.net,Sarmad93/octokit.net,shiftkey-tester/octokit.net,gdziadkiewicz/octokit.net,shiftkey/octokit.net,ivandrofly/octokit.net,takumikub/octokit.net,octokit/octokit.net,daukantas/octokit.net,hitesh97/octokit.net,gdziadkiewicz/octokit.net,devkhan/octokit.net,SamTheDev/octokit.net,fffej/octokit.net,shiftkey/octokit.net,gabrielweyer/octokit.net,magoswiat/octokit.net,dampir/octokit.net,ivandrofly/octokit.net,rlugojr/octokit.net,editor-tools/octokit.net,hahmed/octokit.net,shana/octokit.net,Sarmad93/octokit.net,shana/octokit.net,editor-tools/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,octokit-net-test-org/octokit.net,octokit/octokit.net,SmithAndr/octokit.net,gabrielweyer/octokit.net,SamTheDev/octokit.net,SmithAndr/octokit.net,yonglehou/octokit.net,bslliw/octokit.net,nsnnnnrn/octokit.net,adamralph/octokit.net
Octokit/Clients/ITagsClient.cs
Octokit/Clients/ITagsClient.cs
using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; namespace Octokit { public interface ITagsClient { /// <summary> /// Gets a tag for a given repository by sha reference /// </summary> /// <remarks> /// http://developer.github.com/v3/git/tags/#get-a-tag /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="reference">Tha sha reference of the tag</param> /// <returns></returns> [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "Method makes a network request")] Task<GitTag> Get(string owner, string name, string reference); /// <summary> /// Create a tag for a given repository /// </summary> /// <remarks> /// http://developer.github.com/v3/git/tags/#create-a-tag-object /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="tag">The tag to create</param> /// <returns></returns> Task<GitTag> Create(string owner, string name, NewTag tag); } }
using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; namespace Octokit { public interface ITagsClient { /// <summary> /// Gets a tag for a given repository by sha reference /// </summary> /// <remarks> /// http://developer.github.com/v3/git/tags/#get-a-tag /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="reference">Tha sha reference of the tag</param> /// <returns></returns> [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "Method makes a network request")] Task<GitTag> Get(string owner, string name, string reference); /// <summary> /// Create a tag for a given repository /// </summary> /// <remarks> /// http://developer.github.com/v3/git/tags/#create-a-tag-object /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="tag">The tag to create</param> /// <returns></returns> Task<GitTag> Create(string owner, string name, NewTag tag); } }
mit
C#
3cb599f8e6016c93d88ee0966dfafe21f74ca4c8
Fix for #107 - allows embedded resource routes to be registered when Umbraco is being upgraded
uComponents/nuPickers,LottePitcher/nuPickers,uComponents/nuPickers,uComponents/nuPickers,LottePitcher/nuPickers,LottePitcher/nuPickers
source/nuPickers/EmbeddedResourceStartup.cs
source/nuPickers/EmbeddedResourceStartup.cs
namespace nuPickers { using ClientDependency.Core; using System.Web.Routing; using Umbraco.Core; public class EmbeddedResourceStartup : ApplicationEventHandler { protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { base.ApplicationStarted(umbracoApplication, applicationContext); RouteBuilder.BuildRoutes(RouteTable.Routes); FileWriters.AddWriterForExtension(".nu", new EmbeddedResourceWriter()); } protected override bool ExecuteWhenApplicationNotConfigured { get { if (RouteTable.Routes["nuPickersShared"] == null) { RouteBuilder.BuildRoutes(RouteTable.Routes); FileWriters.AddWriterForExtension(".nu", new EmbeddedResourceWriter()); } return base.ExecuteWhenApplicationNotConfigured; } } } }
namespace nuPickers { using ClientDependency.Core; using System.Web.Routing; using Umbraco.Core; public class EmbeddedResourceStartup : ApplicationEventHandler { protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { base.ApplicationStarted(umbracoApplication, applicationContext); RouteBuilder.BuildRoutes(RouteTable.Routes); FileWriters.AddWriterForExtension(".nu", new EmbeddedResourceWriter()); } } }
mit
C#
12806622dc04693642831ff5de044a87b07afc34
make constructor of abstract class protected
alhardy/Metrics.NET,Liwoj/Metrics.NET,cvent/Metrics.NET,ntent-ad/Metrics.NET,cvent/Metrics.NET,alhardy/Metrics.NET,mnadel/Metrics.NET,DeonHeyns/Metrics.NET,Liwoj/Metrics.NET,MetaG8/Metrics.NET,MetaG8/Metrics.NET,ntent-ad/Metrics.NET,mnadel/Metrics.NET,DeonHeyns/Metrics.NET,etishor/Metrics.NET,Recognos/Metrics.NET,huoxudong125/Metrics.NET,etishor/Metrics.NET,MetaG8/Metrics.NET,huoxudong125/Metrics.NET,Recognos/Metrics.NET
Src/Metrics/Meta/MetricMeta.cs
Src/Metrics/Meta/MetricMeta.cs
 namespace Metrics.Meta { public abstract class MetricMeta<T, V> where T : Metric<V> where V : struct { private readonly T metric; protected MetricMeta(string name, T metric, Unit unit) { this.metric = metric; this.Name = name; this.Unit = unit; } public string Name { get; private set; } public V Value { get { return this.metric.Value; } } public Unit Unit { get; private set; } internal T Metric() { return this.metric; } } }
 namespace Metrics.Meta { public abstract class MetricMeta<T, V> where T : Metric<V> where V : struct { private readonly T metric; public MetricMeta(string name, T metric, Unit unit) { this.metric = metric; this.Name = name; this.Unit = unit; } public string Name { get; private set; } public V Value { get { return this.metric.Value; } } public Unit Unit { get; private set; } internal T Metric() { return this.metric; } } }
apache-2.0
C#
778659b7b1162e371c2906726cb055532e87289d
Update IRepository.cs
tiksn/TIKSN-Framework
TIKSN.Core/Data/IRepository.cs
TIKSN.Core/Data/IRepository.cs
using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace TIKSN.Data { public interface IRepository<T> { Task AddAsync(T entity, CancellationToken cancellationToken); Task AddRangeAsync(IEnumerable<T> entities, CancellationToken cancellationToken); Task RemoveAsync(T entity, CancellationToken cancellationToken); Task RemoveRangeAsync(IEnumerable<T> entities, CancellationToken cancellationToken); Task UpdateAsync(T entity, CancellationToken cancellationToken); Task UpdateRangeAsync(IEnumerable<T> entities, CancellationToken cancellationToken); } }
using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace TIKSN.Data { public interface IRepository<T> { Task AddAsync(T entity, CancellationToken cancellationToken); Task AddRangeAsync(IEnumerable<T> entities, CancellationToken cancellationToken); Task RemoveAsync(T entity, CancellationToken cancellationToken); Task RemoveRangeAsync(IEnumerable<T> entities, CancellationToken cancellationToken); Task UpdateAsync(T entity, CancellationToken cancellationToken); Task UpdateRangeAsync(IEnumerable<T> entities, CancellationToken cancellationToken); } }
mit
C#
883797ac3878402904f467a28176c1b754affd83
Fix file loader
andrewdavey/cassette,honestegg/cassette,andrewdavey/cassette,andrewdavey/cassette,damiensawyer/cassette,damiensawyer/cassette,damiensawyer/cassette,honestegg/cassette,honestegg/cassette
src/Cassette.Spriting.UnitTests/ImageFileLoader.cs
src/Cassette.Spriting.UnitTests/ImageFileLoader.cs
using System.IO; using Should; using Xunit; namespace Cassette.Spriting { public class ImageFileLoader_GetImageBytesTests { [Fact] public void ReadsBytesFromFile() { var directory = new FakeFileSystem { { "~/test.png", new byte[] { 1, 2, 3 } } }; var loader = new ImageFileLoader(directory); var output = loader.GetImageBytes("/cassette.axd/file/test.png"); output.ShouldEqual(new byte[] { 1, 2, 3 }); } [Fact] public void ThrowsExceptionIfFileDoesntExist() { var directory = new FakeFileSystem(); var loader = new ImageFileLoader(directory); var exception = Record.Exception(() => loader.GetImageBytes("/cassette.axd/file/test.png")); exception.ShouldBeType<FileNotFoundException>(); } } }
using System.IO; using Should; using Xunit; namespace Cassette.Spriting { public class ImageFileLoader_GetImageBytesTests { [Fact] public void ReadsBytesFromFile() { var directory = new FakeFileSystem { { "~/test.png", new byte[] { 1, 2, 3 } } }; var loader = new ImageFileLoader(directory); var output = loader.GetImageBytes("/cassette.axd/file/test-hash.png"); output.ShouldEqual(new byte[] { 1, 2, 3 }); } [Fact] public void ThrowsExceptionIfFileDoesntExist() { var directory = new FakeFileSystem(); var loader = new ImageFileLoader(directory); var exception = Record.Exception(() => loader.GetImageBytes("/cassette.axd/file/test-hash.png")); exception.ShouldBeType<FileNotFoundException>(); } } }
mit
C#
eb5d6d47bd5a16e7d8f747a2f420524981aa1e15
Fix GetConsoleWindow test
JeremyKuhne/WInterop,JeremyKuhne/WInterop,JeremyKuhne/WInterop,JeremyKuhne/WInterop
src/Tests/WInterop.Tests/Console/GeneralConsole.cs
src/Tests/WInterop.Tests/Console/GeneralConsole.cs
// Copyright (c) Jeremy W. Kuhne. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using FluentAssertions; using WInterop.Windows; using Xunit; namespace ConsoleTests; public class GeneralConsole { [Fact] public void GetConsoleWindow() { WindowHandle window = WInterop.Console.Console.GetConsoleWindow(); window.IsInvalid.Should().BeFalse(); _ = Windows.GetActiveWindow(); } }
// Copyright (c) Jeremy W. Kuhne. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using FluentAssertions; using WInterop.Windows; using Xunit; namespace ConsoleTests; public class GeneralConsole { [Fact] public void GetConsoleWindow() { // Xunit tests in core don't have an attached console window WindowHandle window = WInterop.Console.Console.GetConsoleWindow(); window.IsInvalid.Should().BeTrue(); _ = Windows.GetActiveWindow(); } }
mit
C#
dcc502334924810e2388bcabf81e52c25b979398
Update interfaces.cs
saikovuri/OOLanguageComparision,saikovuri/OOLanguageComparision
interfaces/interfaces.cs
interfaces/interfaces.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Implementing_Interface { interface IStorable { void Read( ); void Write( object obj ); int Status { get; set; } } public class Document : IStorable { public Document( string s ) { Console.WriteLine( "Creating document with: {0}", s ); } #region IStorable public void Read( ) { Console.WriteLine( "Executing Document's Read Method for IStorable" ); } public void Write( object o ) { Console.WriteLine( "Executing Document's Write Method for IStorable" ); } // property required by IStorable public int Status { get; set;} #endregion } class Tester { public void Run( ) { Document doc = new Document( "Test Document" ); doc.Status = -1; doc.Read( ); Console.WriteLine( "Document Status: {0}", doc.Status ); } static void Main( ) { Tester t = new Tester( ); t.Run( ); } } } // The output looks like below: // // // Creating document with: Test Document // Executing Document's Read Method for IStorable // Document Status: -1
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Example_13_1_ _ _ _Implementing_Interface { interface IStorable { void Read( ); void Write( object obj ); int Status { get; set; } } public class Document : IStorable { public Document( string s ) { Console.WriteLine( "Creating document with: {0}", s ); } #region IStorable public void Read( ) { Console.WriteLine( "Executing Document's Read Method for IStorable" ); } public void Write( object o ) { Console.WriteLine( "Executing Document's Write Method for IStorable" ); } // property required by IStorable public int Status { get; set;} #endregion } class Tester { public void Run( ) { Document doc = new Document( "Test Document" ); doc.Status = -1; doc.Read( ); Console.WriteLine( "Document Status: {0}", doc.Status ); } static void Main( ) { Tester t = new Tester( ); t.Run( ); } } } // The output looks like below: // // // Creating document with: Test Document // Executing Document's Read Method for IStorable // Document Status: -1
apache-2.0
C#
5a6778f24c93db297000284c6720c1951224898c
upgrade version to 1.7.0
Aaron-Liu/enode,tangxuehua/enode
src/ENode.EQueue/Properties/AssemblyInfo.cs
src/ENode.EQueue/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("ENode.EQueue")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ENode.EQueue")] [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("e534ee24-4ea0-410e-847a-227e53faed7c")] // 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.7.0")] [assembly: AssemblyFileVersion("1.7.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("ENode.EQueue")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ENode.EQueue")] [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("e534ee24-4ea0-410e-847a-227e53faed7c")] // 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.6.9")] [assembly: AssemblyFileVersion("1.6.9")]
mit
C#
10cad44459241a808b85a521cd31c47b18d0b6be
Update to be async
michaeldtaylor/Ghostbot
src/Ghostbot.Azure.WorkerRole/WorkerRole.cs
src/Ghostbot.Azure.WorkerRole/WorkerRole.cs
using System.Diagnostics; using System.Net; using System.Threading; using System.Threading.Tasks; using Microsoft.WindowsAzure.ServiceRuntime; namespace Ghostbot.Azure.WorkerRole { public class WorkerRole : RoleEntryPoint { readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); readonly ManualResetEvent _runCompleteEvent = new ManualResetEvent(false); public override void Run() { Trace.TraceInformation("Ghostbot WorkerRole is running"); try { RunAsync(_cancellationTokenSource.Token).Wait(); } finally { _runCompleteEvent.Set(); } } public override bool OnStart() { // Set the maximum number of concurrent connections ServicePointManager.DefaultConnectionLimit = 12; // For information on handling configuration changes // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357. var result = base.OnStart(); Trace.TraceInformation("Ghostbot WorkerRole has been started"); return result; } public override void OnStop() { Trace.TraceInformation("Ghostbot WorkerRole is stopping"); _cancellationTokenSource.Cancel(); _runCompleteEvent.WaitOne(); base.OnStop(); Trace.TraceInformation("Ghostbot WorkerRoles has stopped"); } static async Task RunAsync(CancellationToken token) { while (!token.IsCancellationRequested) { Trace.TraceInformation("Working"); await Task.Run(() => { var ghostbotClient = new GhostbotClient(); ghostbotClient.Start(); }, token); } } } }
using System.Diagnostics; using System.Net; using System.Threading; using Microsoft.WindowsAzure.ServiceRuntime; namespace Ghostbot.Azure.WorkerRole { public class WorkerRole : RoleEntryPoint { readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); readonly ManualResetEvent _runCompleteEvent = new ManualResetEvent(false); public override void Run() { Trace.TraceInformation("Ghostbot WorkerRoles is running"); try { while (!_cancellationTokenSource.Token.IsCancellationRequested) { Trace.TraceInformation("Working"); var ghostbotClient = new GhostbotClient(); ghostbotClient.Start(); } } finally { _runCompleteEvent.Set(); } } public override bool OnStart() { // Set the maximum number of concurrent connections ServicePointManager.DefaultConnectionLimit = 12; // For information on handling configuration changes // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357. var result = base.OnStart(); Trace.TraceInformation("Ghostbot WorkerRoles has been started"); return result; } public override void OnStop() { Trace.TraceInformation("Ghostbot WorkerRoles is stopping"); _cancellationTokenSource.Cancel(); _runCompleteEvent.WaitOne(); base.OnStop(); Trace.TraceInformation("Ghostbot WorkerRoles has stopped"); } } }
mit
C#
2ad7e56718f6a223702c521901ff614a434fc001
Clean commented code and a tiny optimization to return false if the value is null.
NServiceKit/NServiceKit.OrmLite,NServiceKit/NServiceKit.OrmLite
src/ServiceStack.OrmLite/Expressions/Sql.cs
src/ServiceStack.OrmLite/Expressions/Sql.cs
using System; using System.Linq; using System.Linq.Expressions; using System.Collections.Generic; namespace ServiceStack.OrmLite { public static class Sql { public static bool In<T>(T value, params object[] list) { if(value == null) return false; foreach (var obj in list) { if (obj == null) continue; if (obj.ToString() == value.ToString()) return true; } return false; } public static string Desc<T>(T value) { return value==null? "": value.ToString() + " DESC"; } public static string As<T>( T value, object asValue) { return value==null? "": string.Format("{0} AS {1}", value.ToString(), asValue); } public static T Sum<T>( T value) { return value; } public static T Count<T>( T value) { return value; } public static T Min<T>( T value) { return value; } public static T Max<T>( T value) { return value; } public static T Avg<T>( T value) { return value; } } }
using System; using System.Linq; using System.Linq.Expressions; using System.Collections.Generic; namespace ServiceStack.OrmLite { public static class Sql { //public static bool In<T>(T value, IList<Object> list) //{ // foreach (Object obj in list) // { // if (obj == null || value == null) continue; // if (obj.ToString() == value.ToString()) return true; // } // return false; //} public static bool In<T>(T value, params object[] list) { foreach (var obj in list) { if (obj == null || value == null) continue; if (obj.ToString() == value.ToString()) return true; } return false; } public static string Desc<T>(T value) { return value==null? "": value.ToString() + " DESC"; } public static string As<T>( T value, object asValue) { return value==null? "": string.Format("{0} AS {1}", value.ToString(), asValue); } public static T Sum<T>( T value) { return value; } public static T Count<T>( T value) { return value; } public static T Min<T>( T value) { return value; } public static T Max<T>( T value) { return value; } public static T Avg<T>( T value) { return value; } } }
bsd-3-clause
C#
e26493179f1ca231f5eb1581591a37ce83e40f65
exclude non-published posts from the series data
fekberg/Sandra.Snow,tareq-s/Sandra.Snow,gsferreira/Sandra.Snow,Pxtl/Sandra.Snow,darrelmiller/Sandra.Snow,darrelmiller/Sandra.Snow,darrelmiller/Sandra.Snow,tareq-s/Sandra.Snow,gsferreira/Sandra.Snow,gsferreira/Sandra.Snow,MattHarrington/sample-sandra-snow-blog,amitapl/blogamitapple,Sandra/Sandra.Snow,Sandra/Sandra.Snow,MattHarrington/sample-sandra-snow-blog,amitapl/blogamitapple,tareq-s/Sandra.Snow,amitapl/blogamitapple,Pxtl/Sandra.Snow,MattHarrington/sample-sandra-snow-blog,fekberg/Sandra.Snow,Pxtl/Sandra.Snow,Sandra/Sandra.Snow,fekberg/Sandra.Snow
src/Snow/Extensions/PostHeaderExtensions.cs
src/Snow/Extensions/PostHeaderExtensions.cs
namespace Snow.Extensions { using System.Collections.Generic; using System.Linq; using Models; public static class PostHeaderExtensions { public static void UpdatePartsToLatestInSeries(this IEnumerable<Post> postHeaders) { var groupBySeriesId = (from x in postHeaders where x.Series != null where x.Published == Enums.Published.True group x by x.Series.Name into g select g).ToList(); foreach (var f in groupBySeriesId) { var latestSeries = f.OrderByDescending(x => x.Date) .Select(x => x.Series) .First(); //Fix up all the Parts to have the latest URLs if they exist foreach (var part in latestSeries.Parts) { var post = f.FirstOrDefault(x => x.Series.Current == part.Key); if (post != null) { part.Value.Url = post.Url; } } //Assign the latest parts to all posts foreach (var ff in f) { ff.Series.Parts = latestSeries.Parts; } } } } }
namespace Snow.Extensions { using System.Collections.Generic; using System.Linq; using Models; public static class PostHeaderExtensions { public static void UpdatePartsToLatestInSeries(this IEnumerable<Post> postHeaders) { var groupBySeriesId = (from x in postHeaders where x.Series != null group x by x.Series.Name into g select g).ToList(); foreach (var f in groupBySeriesId) { var latestSeries = f.OrderByDescending(x => x.Date) .Select(x => x.Series) .First(); //Fix up all the Parts to have the latest URLs if they exist foreach (var part in latestSeries.Parts) { var post = f.FirstOrDefault(x => x.Series.Current == part.Key); if (post != null) { part.Value.Url = post.Url; } } //Assign the latest parts to all posts foreach (var ff in f) { ff.Series.Parts = latestSeries.Parts; } } } } }
mit
C#
7f76308100a748a10bc2cb1f6130949df6d04d72
Clean up from review
platrant/platrant
Assets/Scripts/AbyssCollider.cs
Assets/Scripts/AbyssCollider.cs
using UnityEngine; using System.Collections; public class AbyssCollider : MonoBehaviour { private const string PLAYER_TAG = "Player"; void OnTriggerExit2D(Collider2D coll) { if (coll.gameObject.tag == PLAYER_TAG) coll.gameObject.SendMessage("LoseLife"); } }
using UnityEngine; using System.Collections; public class AbyssCollider : MonoBehaviour { private const string PLAYER_TAG = "Player"; [SerializeField] private LevelManager levelManager; [SerializeField] private PlayerMovement player; void OnTriggerExit2D(Collider2D coll) { if (coll.gameObject.tag == PLAYER_TAG) coll.gameObject.SendMessage("LoseLife"); } void Start () { } }
mit
C#
a3e3e83a3df2f450106c41909cf92eb1300c5104
Bump version to 8.13.0
arknu/Umbraco-CMS,abjerner/Umbraco-CMS,bjarnef/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,leekelleher/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,abjerner/Umbraco-CMS,mattbrailsford/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,abryukhov/Umbraco-CMS,abryukhov/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS
src/SolutionInfo.cs
src/SolutionInfo.cs
using System.Reflection; using System.Resources; [assembly: AssemblyCompany("Umbraco")] [assembly: AssemblyCopyright("Copyright © Umbraco 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // versions // read https://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin // note: do NOT change anything here manually, use the build scripts // this is the ONLY ONE the CLR cares about for compatibility // should change ONLY when "hard" breaking compatibility (manual change) [assembly: AssemblyVersion("8.0.0")] // these are FYI and changed automatically [assembly: AssemblyFileVersion("8.13.0")] [assembly: AssemblyInformationalVersion("8.13.0")]
using System.Reflection; using System.Resources; [assembly: AssemblyCompany("Umbraco")] [assembly: AssemblyCopyright("Copyright © Umbraco 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // versions // read https://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin // note: do NOT change anything here manually, use the build scripts // this is the ONLY ONE the CLR cares about for compatibility // should change ONLY when "hard" breaking compatibility (manual change) [assembly: AssemblyVersion("8.0.0")] // these are FYI and changed automatically [assembly: AssemblyFileVersion("8.13.0")] [assembly: AssemblyInformationalVersion("8.13.0-rc")]
mit
C#
7d1772aae7d9a27f8d030c03f8bcec486fc2869f
make the list 'of newable' and preinitialize the grid
mysterycommand/Bearshirt
Assets/Scripts/BearshirtList2D.cs
Assets/Scripts/BearshirtList2D.cs
using System; using System.Collections.Generic; namespace Bearshirt { public class BearshirtList2D<T> where T : new() { public int width { get; private set; } public int height { get; private set; } private List<T> list; public BearshirtList2D(int _width, int _height) { width = _width; height = _height; list = new List<T>(width * height); ForEach((int x, int y) => { list.Add(new T()); }); } public T this[int x, int y] { get { return list[y * width + x]; } set { list[y * width + x] = value; } } public void ForRange( int fromX = 0, int toX = 0, int fromY = 0, int toY = 0, Action<int, int> action = null) { if (action == null) { action = (int x, int y) => {}; } for (int x = fromX; x < toX; ++x) { for (int y = fromY; y < toY; ++y) { action(x, y); } } } public void ForEach(Action<int, int> action = null) { ForRange(0, width, 0, height, action); } } }
using System; using System.Collections.Generic; namespace Bearshirt { public class BearshirtList2D<T> { public int width { get; private set; } public int height { get; private set; } private List<T> list; public BearshirtList2D(int _width, int _height) { width = _width; height = _height; list = new List<T>(width * height); } public T this[int x, int y] { get { return list[y * width + x]; } } public void ForRange( int fromX = 0, int toX = 0, int fromY = 0, int toY = 0, Action<int, int> action = null) { if (action == null) { action = (int x, int y) => {}; } for (int x = fromX; x < toX; ++x) { for (int y = fromY; y < toY; ++y) { action(x, y); } } } public void ForEach(Action<int, int> action = null) { ForRange(0, width, 0, height, action); } } }
mit
C#
4744764d78d642e90d7df7e3075eec170db0621a
Resolve CommandDispatcher
appharbor/appharbor-cli
src/AppHarbor/Program.cs
src/AppHarbor/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Castle.Windsor; namespace AppHarbor { class Program { static void Main(string[] args) { var container = new WindsorContainer() .Install(new AppHarborInstaller()); var commandDispatcher = container.Resolve<CommandDispatcher>(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Castle.Windsor; namespace AppHarbor { class Program { static void Main(string[] args) { var container = new WindsorContainer() .Install(new AppHarborInstaller()); } } }
mit
C#
aee030877495014c6f81903ab727d2bf5a0e638d
Fix for modmsgdata. Closes #64
gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer
Common/Message/Data/ModMsgData.cs
Common/Message/Data/ModMsgData.cs
using Lidgren.Network; using LunaCommon.Message.Base; namespace LunaCommon.Message.Data { public class ModMsgData : MessageData { /// <inheritdoc /> internal ModMsgData() { } /// <summary> /// Name of the mod that creates this msg /// </summary> public string ModName; /// <summary> /// Relay the msg to all players once it arrives to the serer /// </summary> public bool Relay; /// <summary> /// Send it in reliable mode or in UDP-unreliable mode /// </summary> public bool Reliable; /// <summary> /// Number of bytes that are being sent /// </summary> public int NumBytes; /// <summary> /// Data to send /// </summary> public byte[] Data = new byte[0]; public override string ClassName { get; } = nameof(ModMsgData); internal override void InternalSerialize(NetOutgoingMessage lidgrenMsg, bool compressData) { lidgrenMsg.Write(ModName); lidgrenMsg.Write(Relay); lidgrenMsg.Write(Reliable); lidgrenMsg.Write(NumBytes); lidgrenMsg.Write(Data, 0, NumBytes); } internal override void InternalDeserialize(NetIncomingMessage lidgrenMsg, bool dataCompressed) { ModName = lidgrenMsg.ReadString(); Relay = lidgrenMsg.ReadBoolean(); Reliable = lidgrenMsg.ReadBoolean(); NumBytes = lidgrenMsg.ReadInt32(); if (Data.Length < NumBytes) Data = new byte[NumBytes]; lidgrenMsg.ReadBytes(Data, 0, NumBytes); } internal override int InternalGetMessageSize(bool dataCompressed) { return ModName.GetByteCount() + sizeof(bool) + sizeof(bool) + sizeof(int) + sizeof(byte) * NumBytes; } } }
using Lidgren.Network; using LunaCommon.Message.Base; namespace LunaCommon.Message.Data { public class ModMsgData : MessageData { /// <inheritdoc /> internal ModMsgData() { } /// <summary> /// Name of the mod that creates this msg /// </summary> public string ModName; /// <summary> /// Relay the msg to all players once it arrives to the serer /// </summary> public bool Relay; /// <summary> /// Send it in reliable mode or in UDP-unreliable mode /// </summary> public bool Reliable; /// <summary> /// Number of bytes that are being sent /// </summary> public int NumBytes; /// <summary> /// Data to send /// </summary> public byte[] Data; public override string ClassName { get; } = nameof(ModMsgData); internal override void InternalSerialize(NetOutgoingMessage lidgrenMsg, bool compressData) { lidgrenMsg.Write(ModName); lidgrenMsg.Write(Relay); lidgrenMsg.Write(Reliable); lidgrenMsg.Write(NumBytes); lidgrenMsg.Write(Data, 0, NumBytes); } internal override void InternalDeserialize(NetIncomingMessage lidgrenMsg, bool dataCompressed) { ModName = lidgrenMsg.ReadString(); Relay = lidgrenMsg.ReadBoolean(); Reliable = lidgrenMsg.ReadBoolean(); NumBytes = lidgrenMsg.ReadInt32(); if (Data.Length < NumBytes) Data = new byte[NumBytes]; lidgrenMsg.ReadBytes(Data, 0, NumBytes); } internal override int InternalGetMessageSize(bool dataCompressed) { return ModName.GetByteCount() + sizeof(bool) + sizeof(bool) + sizeof(int) + sizeof(byte) * NumBytes; } } }
mit
C#
20f525acf0bfd31397a7f746bda63f40662881ab
fix throwing exception
Eskat0n/Frameplate.Security
sources/Frameplate.Security/Account.cs
sources/Frameplate.Security/Account.cs
namespace Frameplate.Security { using System; public class Account<TId> : IAccount<TId> { public Account(TId id, string login) { if (id.Equals(default(TId))) throw new ArgumentNullException("id"); if (login == null) throw new ArgumentNullException("login"); Id = id; Login = login; } public TId Id { get; private set; } public string Login { get; private set; } } }
namespace Frameplate.Security { using System; public class Account<TId> : IAccount<TId> { public Account(TId id, string login) { if (id.Equals(default(TId))) throw new ArgumentException("credential"); if (login == null) throw new ArgumentNullException("login"); Id = id; Login = login; } public TId Id { get; private set; } public string Login { get; private set; } } }
mit
C#
6d05ab8211572d94cc909b6743b25af44a5b41ad
Fix BL-3534 License Dialog messedup spacing
gmartin7/myBloomFork,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,JohnThomson/BloomDesktop,StephenMcConnel/BloomDesktop,JohnThomson/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,andrew-polk/BloomDesktop,andrew-polk/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,andrew-polk/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop
src/BloomExe/Registration/LicenseDialog.cs
src/BloomExe/Registration/LicenseDialog.cs
using System.Drawing; using System.Globalization; using System.IO; using System.Reflection; using System.Text; using System.Windows.Forms; using MarkdownSharp; namespace Bloom.Registration { public partial class LicenseDialog : Form { private Browser _licenseBrowser; public LicenseDialog() { InitializeComponent(); Text = string.Format(Text, Assembly.GetExecutingAssembly().GetName().Version); _licenseBrowser = new Browser(); _licenseBrowser.Isolator = new NavigationIsolator(); // never used while other browsers are around _licenseBrowser.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; _licenseBrowser.Location = new Point(12, 12); _licenseBrowser.Name = "licenseBrowser"; _licenseBrowser.Size = new Size(_acceptButton.Right - 12, _acceptButton.Top - 24); Controls.Add(_licenseBrowser); var options = new MarkdownOptions() { LinkEmails = true, AutoHyperlink = true }; var m = new Markdown(options); var locale = CultureInfo.CurrentUICulture.Name; string licenseFilePath = BloomFileLocator.GetFileDistributedWithApplication("license.md"); var localizedLicenseFilePath = licenseFilePath.Substring(0, licenseFilePath.Length - 3) + "-" + locale + ".md"; if (File.Exists(localizedLicenseFilePath)) licenseFilePath = localizedLicenseFilePath; else { var index = locale.IndexOf('-'); if (index > 0) { locale = locale.Substring(0, index); localizedLicenseFilePath = licenseFilePath.Substring(0, licenseFilePath.Length - 3) + "-" + locale + ".md"; if (File.Exists(localizedLicenseFilePath)) licenseFilePath = localizedLicenseFilePath; } } var contents = m.Transform(File.ReadAllText(licenseFilePath, Encoding.UTF8)); var html = string.Format("<html><head><head/><body>{0}</body></html>", contents); _licenseBrowser.NavigateRawHtml(html); _licenseBrowser.Visible = true; } } }
using System.Drawing; using System.Globalization; using System.IO; using System.Reflection; using System.Text; using System.Windows.Forms; using MarkdownSharp; namespace Bloom.Registration { public partial class LicenseDialog : Form { private Browser _licenseBrowser; public LicenseDialog() { InitializeComponent(); Text = string.Format(Text, Assembly.GetExecutingAssembly().GetName().Version); _licenseBrowser = new Browser(); _licenseBrowser.Isolator = new NavigationIsolator(); // never used while other browsers are around _licenseBrowser.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; _licenseBrowser.Location = new Point(176, 12); _licenseBrowser.Name = "licenseBrowser"; _licenseBrowser.Size = new Size(_acceptButton.Right - 176, _acceptButton.Top - 24); Controls.Add(_licenseBrowser); var options = new MarkdownOptions() { LinkEmails = true, AutoHyperlink = true }; var m = new Markdown(options); var locale = CultureInfo.CurrentUICulture.Name; string licenseFilePath = BloomFileLocator.GetFileDistributedWithApplication("license.md"); var localizedLicenseFilePath = licenseFilePath.Substring(0, licenseFilePath.Length - 3) + "-" + locale + ".md"; if (File.Exists(localizedLicenseFilePath)) licenseFilePath = localizedLicenseFilePath; else { var index = locale.IndexOf('-'); if (index > 0) { locale = locale.Substring(0, index); localizedLicenseFilePath = licenseFilePath.Substring(0, licenseFilePath.Length - 3) + "-" + locale + ".md"; if (File.Exists(localizedLicenseFilePath)) licenseFilePath = localizedLicenseFilePath; } } var contents = m.Transform(File.ReadAllText(licenseFilePath, Encoding.UTF8)); var html = string.Format("<html><head><head/><body>{0}</body></html>", contents); _licenseBrowser.NavigateRawHtml(html); _licenseBrowser.Visible = true; } } }
mit
C#
c6c51b9edd5b4de10281e08a85b6122e4c15e374
Add refresh mechanism...but it's ugly.
Narochno/Narochno.Primitives
src/Narochno.Primitives/Parsing/Convert.cs
src/Narochno.Primitives/Parsing/Convert.cs
using System; namespace Narochno.Primitives.Parsing { public static class Convert<TType> where TType : struct { private static IParser<TType> parser; static Convert() { Refresh(); } /// <summary> /// Refreshes the parser from the DefaultParserLibrary if it is changed. /// </summary> /// <exception cref="ArgumentNullException"></exception> public static void Refresh() { parser = DefaultParserLibrary.Instance.GetParser(typeof(TType)) as IParser<TType>; } /// <summary> /// Convert given string to Nullable <typeparamref name="TType"/> /// </summary> /// <typeparam name="TType">The type to convert to</typeparam> /// <param name="input">The input string</param> /// <returns>The Nullable <typeparamref name="TType"/> parsed from the string <paramref name="input"/></returns> public static TType? TryParse(string input) { return parser.TryParse(input); } /// <summary> /// Convert given string to type <typeparamref name="TType"/> /// </summary> /// <typeparam name="TType">The type to convert to</typeparam> /// <param name="input">The input string</param> /// <returns>The type <typeparamref name="TType"/> parsed from the string <paramref name="input"/></returns> public static TType Parse(string input) { return parser.Parse(input); } /// <summary> /// Convert given string to object /// </summary> /// <param name="input">The input string</param> /// <param name="type">The type to convert to</param> /// <returns>The type parsed from the string <paramref name="input"/></returns> public static string ToString(TType type) { return parser.ToString(type); } } }
using System; namespace Narochno.Primitives.Parsing { public static class Convert<TType> where TType : struct { private static IParser<TType> parser = (IParser<TType>)DefaultParserLibrary.Instance.GetParser(typeof(TType)); /// <summary> /// Convert given string to Nullable <typeparamref name="TType"/> /// </summary> /// <typeparam name="TType">The type to convert to</typeparam> /// <param name="input">The input string</param> /// <returns>The Nullable <typeparamref name="TType"/> parsed from the string <paramref name="input"/></returns> public static TType? TryParse(string input) { return parser.TryParse(input); } /// <summary> /// Convert given string to type <typeparamref name="TType"/> /// </summary> /// <typeparam name="TType">The type to convert to</typeparam> /// <param name="input">The input string</param> /// <returns>The type <typeparamref name="TType"/> parsed from the string <paramref name="input"/></returns> public static TType Parse(string input) { return parser.Parse(input); } /// <summary> /// Convert given string to object /// </summary> /// <param name="input">The input string</param> /// <param name="type">The type to convert to</param> /// <returns>The type parsed from the string <paramref name="input"/></returns> public static string ToString(TType type) { return parser.ToString(type); } } }
mit
C#
d3fa718dc2a7fd33fbaae76d258752dbc18635d8
Fix method in IEmailService
hermanho/postal
src/Postal.AspNetCore/IEmailService.cs
src/Postal.AspNetCore/IEmailService.cs
using System.Net.Mail; using System.Threading.Tasks; namespace Postal { /// <summary> /// Creates and send email. /// </summary> public interface IEmailService { /// <summary> /// Send an email asynchronously, using an <see cref="SmtpClient"/>. /// </summary> /// <param name="email">The email to send.</param> /// <returns>A <see cref="Task"/> that completes once the email has been sent.</returns> Task SendAsync(MailMessage email); /// <summary> /// Send an email asynchronously, using an <see cref="SmtpClient"/>. /// </summary> /// <param name="email">The email to send.</param> /// <returns>A <see cref="Task"/> that completes once the email has been sent.</returns> Task SendAsync(Email email); /// <summary> /// Creates a new <see cref="MailMessage"/> for the given email. You can /// modify the message, for example adding attachments, and then send this yourself. /// </summary> /// <param name="email">The email to generate.</param> /// <returns>A new <see cref="MailMessage"/>.</returns> Task<MailMessage> CreateMailMessageAsync(Email email); } }
using System.Net.Mail; using System.Threading.Tasks; namespace Postal { /// <summary> /// Creates and send email. /// </summary> public interface IEmailService { /// <summary> /// Creates and sends a <see cref="MailMessage"/> asynchronously using <see cref="SmtpClient"/>. /// This uses the default configuration for mail defined in web.config. /// </summary> /// <param name="email">The email to send.</param> /// <returns>A <see cref="Task"/> that can be used to await completion of sending the email.</returns> Task SendAsync(Email email); /// <summary> /// Creates a new <see cref="MailMessage"/> for the given email. You can /// modify the message, for example adding attachments, and then send this yourself. /// </summary> /// <param name="email">The email to generate.</param> /// <returns>A new <see cref="MailMessage"/>.</returns> Task<MailMessage> CreateMailMessageAsync(Email email); } }
mit
C#
42cb6109343fe770d96b10e0fdf2817cd1320919
Improve comment in DpiHelper
solarwinds/OrionSDK
Src/SwqlStudio/Utils/DpiHelper.cs
Src/SwqlStudio/Utils/DpiHelper.cs
using System.Drawing; using System.Windows.Forms; namespace SwqlStudio.Utils { internal static class DpiHelper { /// <summary> /// Sets the currently used system UI font as the default font for the <paramref name="control"/> /// </summary> /// <param name="control">Usually a <see cref="Form"/></param> /// <remarks>This is needed because dimensions of the default font are used to calculate a proper DPI scaling ratio of the <paramref name="control"/>'s child elements. /// <para>.Net Framework tries to use "MS Sans Serif" from Windows 3.1, which isn't available anymore. So the system automatically replaces it with "Microsoft Sans Serif", /// or sometimes with "Tahoma". But those are also too old. And if there are elements using also other fonts, like "Segoe UI", it messes up the calculation. /// So, instead of hard-coding a specific font, let's use whatever the OS prefers to use for its own dialogs.</para> /// <para>This has been reportedly fixed in .Net Core and .Net 5.</para></remarks> public static void FixFont(Control control) { control.Font = SystemFonts.MessageBoxFont; } /// <summary> /// Adjusts the default row height in a <see cref="DataGridView"/> /// </summary> /// <remarks>The default row height is defined as the height of the default font + 9 pixels. /// However, because the default font in .Net Framework is "MS Sans Serif 8.25F", it's too small for fonts like "Segoe UI, 9F", /// especially when DPI scaling is involved. /// <para>This method, when called after <see cref="FixFont"/>, forces the recalculation of the height.</para> /// <para>This has been reportedly fixed in .Net Core and .Net 5.</para></remarks> public static void FixRowHeight(DataGridView dataGridView) { // Instead of "dataGridView.DefaultCellStyle.Font.Height" we could just hard-code "SystemFonts.MessageBoxFont". That way, this method would not depend // on a previous call to "FixFont". But this is a bit more universal solution. dataGridView.RowTemplate.Height = dataGridView.DefaultCellStyle.Font.Height + 9; } } }
using System.Drawing; using System.Windows.Forms; namespace SwqlStudio.Utils { internal static class DpiHelper { /// <summary> /// Sets the currently used system UI font as the default font for the <paramref name="control"/> /// </summary> /// <param name="control">Usually a <see cref="Form"/></param> /// <remarks>This is needed because dimensions of the default font are used to calculate a proper DPI scaling ratio of child elements of the <paramref name="control"/>. /// And the .Net Framework uses "Microsoft Sans Serif", 8.25F" from Windows 2.0, regardless of what the OS actually uses. This messes up the calculation. /// <para>This has been reportedly fixed in .Net Core and .Net 5.</para></remarks> public static void FixFont(Control control) { control.Font = SystemFonts.MessageBoxFont; } /// <summary> /// Adjusts the default row height in a <see cref="DataGridView"/> /// </summary> /// <remarks>The default row height is defined as the height of the default font + 9 pixels. /// However, because the default font in .Net Framework is "Microsoft Sans Serif", 8.25F", it's too small for fonts like "Segoe UI, 9F", /// especially when DPI scaling is involved. /// <para>This method, when called after <see cref="FixFont"/>, forces the recalculation of the height.</para> /// <para>This has been reportedly fixed in .Net Core and .Net 5.</para></remarks> public static void FixRowHeight(DataGridView dataGridView) { // Instead of "dataGridView.DefaultCellStyle.Font.Height" we could just hardcode "SystemFonts.MessageBoxFont". That way, this method would not depend // on a previous call to "FixFont". But this is a bit more universal solution. dataGridView.RowTemplate.Height = dataGridView.DefaultCellStyle.Font.Height + 9; } } }
apache-2.0
C#
7d6544b94931a01950ff5178417bb3c7e2c04a4f
Load Xsd Schemas With Base Uri Set. (#23)
tudway/Qart,avao/Qart
Src/src/Qart.Core/Xsd/XsdUtils.cs
Src/src/Qart.Core/Xsd/XsdUtils.cs
using System.IO; using System.Xml; using System.Xml.Schema; namespace Qart.Core.Xsd { public static class SchemaLoader { public static XmlSchema Load(Stream stream) { return XmlSchema.Read(stream, null); } public static XmlSchema Load(string path) { using var stream = new FileStream(path, FileMode.Open, FileAccess.Read); using var reader = XmlReader.Create(stream, null, path); return XmlSchema.Read(reader, null); } } }
using Qart.Core.Io; using System.IO; using System.Xml.Schema; namespace Qart.Core.Xsd { public static class SchemaLoader { public static XmlSchema Load(Stream stream) { return XmlSchema.Read(stream, null); } public static XmlSchema Load(string path) { using (var stream = FileUtils.OpenFileStreamForReading(path)) { return Load(stream); } } } }
apache-2.0
C#
cc21d2154da76809efde17d6cb6cf099b53e083b
fix QuickStart.cs and add licence
NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity
ncmb_unity/Assets/Scenes/QuickStartScene/QuickStart.cs
ncmb_unity/Assets/Scenes/QuickStartScene/QuickStart.cs
/******* Copyright 2017-2020 FUJITSU CLOUD TECHNOLOGIES LIMITED All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. **********/ using System.Collections; using System.Collections.Generic; using UnityEngine; using NCMB; public class QuickStart : MonoBehaviour { // Use this for initialization void Start () { // クラスのNCMBObjectを作成 NCMBObject testClass = new NCMBObject("TestClass"); // オブジェクトに値を設定 testClass["message"] = "Hello, NCMB!"; // データストアへの登録 testClass.SaveAsync(); } // Update is called once per frame void Update () { } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using NCMB; public class QuickStart : MonoBehaviour { // Use this for initialization void Start () { // クラスのNCMBObjectを作成 NCMBObject testClass = new NCMBObject("TestClass"); // オブジェクトに値を設定 testClass["message"] = "Hello, NCMB!"; // データストアへの登録 testClass.SaveAsync(); } // Update is called once per frame void Update () { } }
apache-2.0
C#
969040f490961f02578ef37c440deefcdedd6551
Bump version to 30, to reflect what's currently in development.
DeathCradle/Terraria-s-Dedicated-Server-Mod,DeathCradle/Terraria-s-Dedicated-Server-Mod,DeathCradle/Terraria-s-Dedicated-Server-Mod,DeathCradle/Terraria-s-Dedicated-Server-Mod
Terraria_Server/Server/Statics.cs
Terraria_Server/Server/Statics.cs
using System; using System.IO; namespace Terraria_Server { public static class Statics { public const int BUILD = 30; public const int CURRENT_TERRARIA_RELEASE = 12; public static string CURRENT_TERRARIA_RELEASE_STR = CURRENT_TERRARIA_RELEASE.ToString(); private const String WORLDS = "Worlds"; //private const String PLAYERS = "Players"; private const String PLUGINS = "Plugins"; private const String DATA = "Data"; public static bool cmdMessages = true; public static bool keepRunning = false; public static volatile bool IsActive = false; public static volatile bool serverStarted = false; public static String SavePath = Environment.CurrentDirectory; public static String WorldPath { get { return SavePath + Path.DirectorySeparatorChar + WORLDS; } } public static String PluginPath { get { return SavePath + Path.DirectorySeparatorChar + PLUGINS; } } public static String DataPath { get { return SavePath + Path.DirectorySeparatorChar + DATA; } } } }
using System; using System.IO; namespace Terraria_Server { public static class Statics { public const int BUILD = 29; public const int CURRENT_TERRARIA_RELEASE = 12; public static string CURRENT_TERRARIA_RELEASE_STR = CURRENT_TERRARIA_RELEASE.ToString(); private const String WORLDS = "Worlds"; //private const String PLAYERS = "Players"; private const String PLUGINS = "Plugins"; private const String DATA = "Data"; public static bool cmdMessages = true; public static bool keepRunning = false; public static volatile bool IsActive = false; public static volatile bool serverStarted = false; public static String SavePath = Environment.CurrentDirectory; public static String WorldPath { get { return SavePath + Path.DirectorySeparatorChar + WORLDS; } } public static String PluginPath { get { return SavePath + Path.DirectorySeparatorChar + PLUGINS; } } public static String DataPath { get { return SavePath + Path.DirectorySeparatorChar + DATA; } } } }
mit
C#
a4ecd6dd77c409488b5d4b3e23aaf165e256cebb
Update AssemblyWithExcludesTest.cs
Fody/Virtuosity
Tests/AssemblyWithExcludesTest.cs
Tests/AssemblyWithExcludesTest.cs
using System.Collections.Generic; using System.Reflection; using Fody; using Xunit; public class AssemblyWithExcludesTest { static Assembly assembly; static AssemblyWithExcludesTest() { var weavingTask = new ModuleWeaver { ExcludeNamespaces = new List<string> { "ExcludeNamespace" } }; assembly = weavingTask.ExecuteTestRun("AssemblyWithExcludes.dll").Assembly; } [Fact] public void Simple() { assembly.EnsureMembersAreNotVirtual("ExcludeNamespace.ExcludeClass", "Method"); assembly.EnsureMembersAreVirtual("IncludeNamespace.IncludeClass", "Method"); assembly.EnsureMembersAreNotVirtual("IncludeNamespace.InNamespaceButWithAttributeClass", "Method"); assembly.EnsureMembersAreNotVirtual("ExcludeNamespace.NotInNamespaceButWithAttributeClass", "Method"); } }
using System.Collections.Generic; using Fody; using Xunit; public class AssemblyWithExcludesTest { [Fact] public void Simple() { var weavingTask = new ModuleWeaver { ExcludeNamespaces = new List<string> { "ExcludeNamespace" } }; var assembly = weavingTask.ExecuteTestRun("AssemblyWithExcludes.dll").Assembly; var excludeType = assembly.GetType("ExcludeNamespace.ExcludeClass"); Assert.False(excludeType.GetMethod("Method").IsVirtual); var includeType = assembly.GetType("IncludeNamespace.IncludeClass"); Assert.True(includeType.GetMethod("Method").IsVirtual); var inNamespaceButWithAttributeType = assembly.GetType("IncludeNamespace.InNamespaceButWithAttributeClass"); Assert.False(inNamespaceButWithAttributeType.GetMethod("Method").IsVirtual); var notInNamespaceButWithAttributeType = assembly.GetType("ExcludeNamespace.NotInNamespaceButWithAttributeClass"); Assert.False(notInNamespaceButWithAttributeType.GetMethod("Method").IsVirtual); } }
mit
C#
58baf95716df0bc2eda72927fabcc3ae6fd9aaa2
bump version number
articulate/raygun4net,nelsonsar/raygun4net,MindscapeHQ/raygun4net,tdiehl/raygun4net,tdiehl/raygun4net,ddunkin/raygun4net,MindscapeHQ/raygun4net,articulate/raygun4net,MindscapeHQ/raygun4net,nelsonsar/raygun4net,ddunkin/raygun4net
AssemblyVersionInfo.cs
AssemblyVersionInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 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.9.0")] [assembly: AssemblyFileVersion("1.0.9.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 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.8.0")] [assembly: AssemblyFileVersion("1.0.8.0")]
mit
C#
88d4d40520767d8185910314b9a3ffbb1ff937b0
Fix typo
sfc-sdp/GameCanvas-Unity
Assets/Scripts/Game.cs
Assets/Scripts/Game.cs
using System; using GameCanvas; public class Game : GameBase { override public void Start() { // } override public void Calc() { // } override public void Draw() { // 画面を白で塗りつぶします gc.ClearScreen(); // 2番の画像を描画します gc.DrawImage(2, 0, 0); // 赤い長方形(塗り)を描画します gc.SetColor(255, 0, 0); gc.FillRect(100, 100, 120, 120); // 黒い長方形(線)を描画します gc.SetColor(0, 0, 0); gc.DrawRect(40, 40, 440, 280); // 青い直線を描画します gc.SetColor(0, 0, 255); gc.DrawLine(60, 380, 220, 10); // 緑の円を描画します gc.SetColor(0, 64, 0); gc.DrawCircle(320, 240, 200); } override public void Pause() { // } override public void Final() { // } }
using System; using GameCanvas; public class Game : GameBase { override public void Start() { // } override public void Calc() { // } override public void Draw() { // 画面を白で塗りつぶします gc.ClearScreen(); // 画像0を描画します gc.DrawImage(2, 0, 0); // 赤い長方形(塗り)を描画します gc.SetColor(255, 0, 0); gc.FillRect(100, 100, 120, 120); // 黒い長方形(線)を描画します gc.SetColor(0, 0, 0); gc.DrawRect(40, 40, 440, 280); // 青い直線を描画します gc.SetColor(0, 0, 255); gc.DrawLine(60, 380, 220, 10); // 緑の円を描画します gc.SetColor(0, 64, 0); gc.DrawCircle(320, 240, 200); } public override void Pause() { // } override public void Final() { // } }
mit
C#
cc9dea4c7ce2a4423252fc13184c807db250f1ab
Update tools/LuminoBuild/Tasks/BuildEngine_MSVC.cs
lriki/Lumino,lriki/Lumino,lriki/Lumino,lriki/Lumino,lriki/Lumino,lriki/Lumino,lriki/Lumino
tools/LuminoBuild/Tasks/BuildEngine_MSVC.cs
tools/LuminoBuild/Tasks/BuildEngine_MSVC.cs
using System; using System.IO; using System.Linq; using LuminoBuild; namespace LuminoBuild.Tasks { class BuildEngine_MSVC : BuildTask { public override string CommandName { get { return "BuildEngine_MSVC"; } } public override string Description { get { return "Build engine for C++."; } } public override void Build(Builder builder) { string oldCD = Directory.GetCurrentDirectory(); if (Utils.IsWin32) { var list = MakeVSProjects.Targets; foreach (var t in list) { Directory.SetCurrentDirectory(Path.Combine(builder.LuminoBuildDir, t.DirName)); Utils.CallProcess("cmake", "--build . --config Debug --target INSTALL"); Utils.CallProcess("ctest", "-C Debug --output-on-failure"); Utils.CallProcess("cmake", "--build . --config Release --target INSTALL"); Utils.CallProcess("ctest", "-C Release --output-on-failure"); } } else { throw new NotImplementedException(); } Directory.SetCurrentDirectory(oldCD); } } }
using System; using System.IO; using System.Linq; using LuminoBuild; namespace LuminoBuild.Tasks { class BuildEngine_MSVC : BuildTask { public override string CommandName { get { return "BuildEngine_MSVC"; } } public override string Description { get { return "Build engine for C++."; } } public override void Build(Builder builder) { string oldCD = Directory.GetCurrentDirectory(); if (Utils.IsWin32) { var list = MakeVSProjects.Targets; foreach (var t in list) { Directory.SetCurrentDirectory(Path.Combine(builder.LuminoBuildDir, t.DirName)); Utils.CallProcess("cmake", "--build . --config Debug --target INSTALL"); Utils.CallProcess("ctest", "-C Debug"); Utils.CallProcess("cmake", "--build . --config Release --target INSTALL"); Utils.CallProcess("ctest", "-C Release"); } } else { throw new NotImplementedException(); } Directory.SetCurrentDirectory(oldCD); } } }
mit
C#
2038898f4cdf9063b4857497757f811ec35ddb29
Bump version to 8.18.0-rc2
mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS
src/SolutionInfo.cs
src/SolutionInfo.cs
using System.Reflection; using System.Resources; [assembly: AssemblyCompany("Umbraco")] [assembly: AssemblyCopyright("Copyright © Umbraco 2022")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // versions // read https://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin // note: do NOT change anything here manually, use the build scripts // this is the ONLY ONE the CLR cares about for compatibility // should change ONLY when "hard" breaking compatibility (manual change) [assembly: AssemblyVersion("8.0.0")] // these are FYI and changed automatically [assembly: AssemblyFileVersion("8.18.0")] [assembly: AssemblyInformationalVersion("8.18.0-rc2")]
using System.Reflection; using System.Resources; [assembly: AssemblyCompany("Umbraco")] [assembly: AssemblyCopyright("Copyright © Umbraco 2022")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // versions // read https://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin // note: do NOT change anything here manually, use the build scripts // this is the ONLY ONE the CLR cares about for compatibility // should change ONLY when "hard" breaking compatibility (manual change) [assembly: AssemblyVersion("8.0.0")] // these are FYI and changed automatically [assembly: AssemblyFileVersion("8.18.0")] [assembly: AssemblyInformationalVersion("8.18.0-rc")]
mit
C#
73a208227cad6811079ff1c327eabd863f0b40c1
Add heardbeat file to server
GeorgeHahn/SOVND
SOVND.Server/Program.cs
SOVND.Server/Program.cs
using Anotar.NLog; using Ninject; using Ninject.Extensions.Factory; using SOVND.Lib; using System; using System.Text; using SOVND.Lib.Handlers; using SOVND.Lib.Models; using SOVND.Server.Settings; using System.Threading; using System.Linq; using SOVND.Server.Handlers; using System.IO; using SOVND.Lib.Utils; namespace SOVND.Server { class Program { static void Main(string[] args) { try { LogTo.Debug("==========================================================="); IKernel kernel = new StandardKernel(); // Factories kernel.Bind<IChannelHandlerFactory>().ToFactory(); kernel.Bind<IChatProviderFactory>().ToFactory(); // Singletons kernel.Bind<RedisProvider>().ToSelf().InSingletonScope(); // Standard lifetime kernel.Bind<IPlaylistProvider>().To<SortedPlaylistProvider>(); kernel.Bind<IMQTTSettings>().To<ServerMqttSettings>(); var server = kernel.Get<Server>(); server.Run(); var heartbeat = TimeSpan.FromMinutes(3); while (true) { File.WriteAllText("sovndserver.heartbeat", Time.Timestamp().ToString()); Thread.Sleep(heartbeat); } } catch (Exception e) { LogTo.FatalException("Unhandled exception", e); throw; } } } }
using Anotar.NLog; using Ninject; using Ninject.Extensions.Factory; using SOVND.Lib; using System; using System.Text; using SOVND.Lib.Handlers; using SOVND.Lib.Models; using SOVND.Server.Settings; using System.Threading; using System.Linq; using SOVND.Server.Handlers; namespace SOVND.Server { class Program { static void Main(string[] args) { try { IKernel kernel = new StandardKernel(); // Factories kernel.Bind<IChannelHandlerFactory>().ToFactory(); kernel.Bind<IChatProviderFactory>().ToFactory(); // Singletons kernel.Bind<RedisProvider>().ToSelf().InSingletonScope(); // Standard lifetime kernel.Bind<IPlaylistProvider>().To<SortedPlaylistProvider>(); kernel.Bind<IMQTTSettings>().To<ServerMqttSettings>(); var server = kernel.Get<Server>(); server.Run(); if (args.Any(s => s.Equals("-d", StringComparison.CurrentCultureIgnoreCase))) { Thread.Sleep(Timeout.Infinite); } } catch (Exception e) { LogTo.FatalException("Unhandled exception", e); throw; } } } }
epl-1.0
C#
ea52d2d527ff669a8acdc246e706d4ec36e6504a
Make Mod IJsonSerializable
NeoAdonis/osu,ppy/osu,naoey/osu,johnneijzen/osu,peppy/osu,peppy/osu,ZLima12/osu,peppy/osu-new,NeoAdonis/osu,DrabWeb/osu,ppy/osu,smoogipoo/osu,johnneijzen/osu,2yangk23/osu,peppy/osu,smoogipooo/osu,naoey/osu,EVAST9919/osu,NeoAdonis/osu,smoogipoo/osu,DrabWeb/osu,UselessToucan/osu,2yangk23/osu,naoey/osu,DrabWeb/osu,smoogipoo/osu,EVAST9919/osu,UselessToucan/osu,UselessToucan/osu,ZLima12/osu,ppy/osu
osu.Game/Rulesets/Mods/Mod.cs
osu.Game/Rulesets/Mods/Mod.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Graphics; using System; using Newtonsoft.Json; using osu.Game.IO.Serialization; namespace osu.Game.Rulesets.Mods { /// <summary> /// The base class for gameplay modifiers. /// </summary> public abstract class Mod : IJsonSerializable { /// <summary> /// The name of this mod. /// </summary> [JsonIgnore] public abstract string Name { get; } /// <summary> /// The shortened name of this mod. /// </summary> public abstract string ShortenedName { get; } /// <summary> /// The icon of this mod. /// </summary> [JsonIgnore] public virtual FontAwesome Icon => FontAwesome.fa_question; /// <summary> /// The type of this mod. /// </summary> [JsonIgnore] public virtual ModType Type => ModType.Fun; /// <summary> /// The user readable description of this mod. /// </summary> [JsonIgnore] public virtual string Description => string.Empty; /// <summary> /// The score multiplier of this mod. /// </summary> [JsonIgnore] public abstract double ScoreMultiplier { get; } /// <summary> /// Returns true if this mod is implemented (and playable). /// </summary> [JsonIgnore] public virtual bool HasImplementation => this is IApplicableMod; /// <summary> /// Returns if this mod is ranked. /// </summary> [JsonIgnore] public virtual bool Ranked => false; /// <summary> /// The mods this mod cannot be enabled with. /// </summary> [JsonIgnore] public virtual Type[] IncompatibleMods => new Type[] { }; } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Graphics; using System; namespace osu.Game.Rulesets.Mods { /// <summary> /// The base class for gameplay modifiers. /// </summary> public abstract class Mod { /// <summary> /// The name of this mod. /// </summary> public abstract string Name { get; } /// <summary> /// The shortened name of this mod. /// </summary> public abstract string ShortenedName { get; } /// <summary> /// The icon of this mod. /// </summary> public virtual FontAwesome Icon => FontAwesome.fa_question; /// <summary> /// The type of this mod. /// </summary> public virtual ModType Type => ModType.Fun; /// <summary> /// The user readable description of this mod. /// </summary> public virtual string Description => string.Empty; /// <summary> /// The score multiplier of this mod. /// </summary> public abstract double ScoreMultiplier { get; } /// <summary> /// Returns true if this mod is implemented (and playable). /// </summary> public virtual bool HasImplementation => this is IApplicableMod; /// <summary> /// Returns if this mod is ranked. /// </summary> public virtual bool Ranked => false; /// <summary> /// The mods this mod cannot be enabled with. /// </summary> public virtual Type[] IncompatibleMods => new Type[] { }; } }
mit
C#
f277b0c99f2a53f7b7bd92e0f748e1e206fe452c
Use better formatting for skin display (matching BeatmapMetadata)
peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu
osu.Game/Skinning/SkinInfo.cs
osu.Game/Skinning/SkinInfo.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using osu.Game.Configuration; using osu.Game.Database; namespace osu.Game.Skinning { public class SkinInfo : IHasFiles<SkinFileInfo>, IEquatable<SkinInfo>, IHasPrimaryKey, ISoftDelete { public int ID { get; set; } public string Name { get; set; } public string Hash { get; set; } public string Creator { get; set; } public List<SkinFileInfo> Files { get; set; } public List<DatabasedSetting> Settings { get; set; } public bool DeletePending { get; set; } public static SkinInfo Default { get; } = new SkinInfo { Name = "osu!lazer", Creator = "team osu!" }; public bool Equals(SkinInfo other) => other != null && ID == other.ID; public override string ToString() { string author = Creator == null ? string.Empty : $"({Creator})"; return $"{Name} {author}".Trim(); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using osu.Game.Configuration; using osu.Game.Database; namespace osu.Game.Skinning { public class SkinInfo : IHasFiles<SkinFileInfo>, IEquatable<SkinInfo>, IHasPrimaryKey, ISoftDelete { public int ID { get; set; } public string Name { get; set; } public string Hash { get; set; } public string Creator { get; set; } public List<SkinFileInfo> Files { get; set; } public List<DatabasedSetting> Settings { get; set; } public bool DeletePending { get; set; } public string FullName => $"\"{Name}\" by {Creator}"; public static SkinInfo Default { get; } = new SkinInfo { Name = "osu!lazer", Creator = "team osu!" }; public bool Equals(SkinInfo other) => other != null && ID == other.ID; public override string ToString() => FullName; } }
mit
C#
4df262b2187e51bc33731a5c35639b813098a360
Update Viktor.cs
FireBuddy/adevade
AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs
AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs
using System; using EloBuddy; using EloBuddy.SDK; namespace AdEvade.Data.Spells.SpecialSpells { class Viktor : IChampionPlugin { static Viktor() { } public const string ChampionName = "Viktor"; public string GetChampionName() { return ChampionName; } public void LoadSpecialSpell(SpellData spellData) { if (spellData.SpellName == "ViktorDeathRay") { Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast3; } } private static void Obj_AI_Base_OnProcessSpellCast3(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender != null && sender.Team != ObjectManager.Player.Team && args.SData.Name != null && args.SData.Name == "ViktorDeathRay") { var endpoint = sender.Path.Last(); // var missileDist = End.To2D().Distance(args.Start.To2D()); // var delay = missileDist / 1.5f + 600; // spellData.SpellDelay = delay; // SpellDetector.CreateSpellData(sender, args.Start, End, spellData); } } } }
using System; using EloBuddy; using EloBuddy.SDK; namespace AdEvade.Data.Spells.SpecialSpells { class Viktor : IChampionPlugin { static Viktor() { } public const string ChampionName = "Viktor"; public string GetChampionName() { return ChampionName; } public void LoadSpecialSpell(SpellData spellData) { if (spellData.SpellName == "ViktorDeathRay") { Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast3; } } private static void Obj_AI_Base_OnProcessSpellCast3(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender != null && sender.Team != ObjectManager.Player.Team && args.SData.Name != null && args.SData.Name == "ViktorDeathRay") { var endpoint = sender.Path; // var missileDist = End.To2D().Distance(args.Start.To2D()); // var delay = missileDist / 1.5f + 600; // spellData.SpellDelay = delay; // SpellDetector.CreateSpellData(sender, args.Start, End, spellData); } } } }
mit
C#
485baba5355b6f98976a96db91ca03b6752c65ff
Edit it
sta/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp
websocket-sharp/Server/IWebSocketSession.cs
websocket-sharp/Server/IWebSocketSession.cs
#region License /* * IWebSocketSession.cs * * The MIT License * * Copyright (c) 2013-2014 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; using WebSocketSharp.Net.WebSockets; namespace WebSocketSharp.Server { /// <summary> /// Exposes the access to the information in a WebSocket session. /// </summary> public interface IWebSocketSession { #region Properties /// <summary> /// Gets the information in the WebSocket handshake request. /// </summary> /// <value> /// A <see cref="WebSocketContext"/> instance that provides the access to /// the information in the handshake request. /// </value> WebSocketContext Context { get; } /// <summary> /// Gets the unique ID of the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the unique ID of the session. /// </value> string ID { get; } /// <summary> /// Gets the name of the WebSocket subprotocol used in the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the name of the subprotocol /// if present. /// </value> string Protocol { get; } /// <summary> /// Gets the time that the session has started. /// </summary> /// <value> /// A <see cref="DateTime"/> that represents the time that the session /// has started. /// </value> DateTime StartTime { get; } /// <summary> /// Gets the current state of the WebSocket connection for the session. /// </summary> /// <value> /// <para> /// One of the <see cref="WebSocketState"/> enum values. /// </para> /// <para> /// It indicates the current state of the connection. /// </para> /// </value> WebSocketState State { get; } #endregion } }
#region License /* * IWebSocketSession.cs * * The MIT License * * Copyright (c) 2013-2014 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; using WebSocketSharp.Net.WebSockets; namespace WebSocketSharp.Server { /// <summary> /// Exposes the access to the information in a WebSocket session. /// </summary> public interface IWebSocketSession { #region Properties /// <summary> /// Gets the information in the WebSocket handshake request. /// </summary> /// <value> /// A <see cref="WebSocketContext"/> instance that provides the access to /// the information in the handshake request. /// </value> WebSocketContext Context { get; } /// <summary> /// Gets the unique ID of the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the unique ID of the session. /// </value> string ID { get; } /// <summary> /// Gets the name of the WebSocket subprotocol used in the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the name of the subprotocol /// if present. /// </value> string Protocol { get; } /// <summary> /// Gets the time that the session has started. /// </summary> /// <value> /// A <see cref="DateTime"/> that represents the time that the session /// has started. /// </value> DateTime StartTime { get; } /// <summary> /// Gets the state of the <see cref="WebSocket"/> used in the session. /// </summary> /// <value> /// One of the <see cref="WebSocketState"/> enum values, indicates the state of /// the <see cref="WebSocket"/> used in the session. /// </value> WebSocketState State { get; } #endregion } }
mit
C#
4d2556c94f4d6447dda33d056d9ea2a1795494be
remove unnecessary using
wilcommerce/Wilcommerce.Core.Data.EFCore
src/Wilcommerce.Core.Data.EFCore/CommonContext.cs
src/Wilcommerce.Core.Data.EFCore/CommonContext.cs
using Microsoft.EntityFrameworkCore; using Wilcommerce.Core.Common.Domain.Models; using Wilcommerce.Core.Data.EFCore.Mapping; namespace Wilcommerce.Core.Data.EFCore { public class CommonContext : DbContext { public virtual DbSet<User> Users { get; set; } public virtual DbSet<GeneralSettings> Settings { get; set; } public CommonContext(DbContextOptions<CommonContext> options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder .MapUser() .MapSettings() .MapEvents(); base.OnModelCreating(modelBuilder); } } }
using Microsoft.EntityFrameworkCore; using Wilcommerce.Core.Common.Domain.Events; using Wilcommerce.Core.Common.Domain.Models; using Wilcommerce.Core.Data.EFCore.Mapping; namespace Wilcommerce.Core.Data.EFCore { public class CommonContext : DbContext { public virtual DbSet<User> Users { get; set; } public virtual DbSet<GeneralSettings> Settings { get; set; } public CommonContext(DbContextOptions<CommonContext> options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder .MapUser() .MapSettings() .MapEvents(); base.OnModelCreating(modelBuilder); } } }
mit
C#
8506e091ed737f5897bbf7ee0ee0c8d552ef082d
Make SUTA edit supervisor searchable
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/SUTA/Edit.cshtml
Battery-Commander.Web/Views/SUTA/Edit.cshtml
@model BatteryCommander.Web.Commands.UpdateSUTARequest @using (Html.BeginForm("Edit", "SUTA", new { Model.Id }, FormMethod.Post, true, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken() @Html.ValidationSummary() <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.Supervisor) @Html.DropDownListFor(model => model.Body.Supervisor, (IEnumerable<SelectListItem>)ViewBag.Supervisors, "-- Select the Supervisor --", new { @class = "select2 form-control" }) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.StartDate) @Html.EditorFor(model => model.Body.StartDate) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.EndDate) @Html.EditorFor(model => model.Body.EndDate) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.Reasoning) @Html.TextAreaFor(model => model.Body.Reasoning, new { cols="40", rows="5" }) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.MitigationPlan) @Html.TextAreaFor(model => model.Body.MitigationPlan, new { cols="40", rows="5" }) </div> <button type="submit">Save</button> }
@model BatteryCommander.Web.Commands.UpdateSUTARequest @using (Html.BeginForm("Edit", "SUTA", new { Model.Id }, FormMethod.Post, true, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken() @Html.ValidationSummary() <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.Supervisor) @Html.DropDownListFor(model => model.Body.Supervisor, (IEnumerable<SelectListItem>)ViewBag.Supervisors) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.StartDate) @Html.EditorFor(model => model.Body.StartDate) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.EndDate) @Html.EditorFor(model => model.Body.EndDate) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.Reasoning) @Html.TextAreaFor(model => model.Body.Reasoning, new { cols="40", rows="5" }) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Body.MitigationPlan) @Html.TextAreaFor(model => model.Body.MitigationPlan, new { cols="40", rows="5" }) </div> <button type="submit">Save</button> }
mit
C#
fc14e62c1a97f9381ed2121528451d5a82412a5e
remove redundant interface
ArsenShnurkov/BitSharp
BitSharp.Storage.Esent/BlockHeaderStorage.cs
BitSharp.Storage.Esent/BlockHeaderStorage.cs
using BitSharp.Common; using BitSharp.Common.ExtensionMethods; using BitSharp.Storage; using BitSharp.Network; using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using BitSharp.Data; using System.Data.SqlClient; namespace BitSharp.Storage.Esent { public class BlockHeaderStorage : EsentDataStorage<BlockHeader> { public BlockHeaderStorage(EsentStorageContext storageContext) : base(storageContext, "blockHeaders", blockHeader => StorageEncoder.EncodeBlockHeader(blockHeader), (blockHash, bytes) => StorageEncoder.DecodeBlockHeader(bytes.ToMemoryStream(), blockHash)) { } } }
using BitSharp.Common; using BitSharp.Common.ExtensionMethods; using BitSharp.Storage; using BitSharp.Network; using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using BitSharp.Data; using System.Data.SqlClient; namespace BitSharp.Storage.Esent { public class BlockHeaderStorage : EsentDataStorage<BlockHeader>, IUnboundedStorage<UInt256, BlockHeader> { public BlockHeaderStorage(EsentStorageContext storageContext) : base(storageContext, "blockHeaders", blockHeader => StorageEncoder.EncodeBlockHeader(blockHeader), (blockHash, bytes) => StorageEncoder.DecodeBlockHeader(bytes.ToMemoryStream(), blockHash)) { } } }
unlicense
C#
a84db02f737426abbd59d7f0a8d2cf55591225e8
Make F.Range a function instead of a field
farity/farity
Farity/Range.cs
Farity/Range.cs
using System; using System.Collections.Generic; using System.Linq; namespace Farity { public static partial class F { public static IEnumerable<int> Range(int start, int end) => start > end ? Enumerable.Empty<int>() : Enumerable.Range(start, end - start + 1); } }
using System; using System.Collections.Generic; using System.Linq; namespace Farity { public static partial class F { public static readonly Func<int, int, IEnumerable<int>> Range = (start, end) => start > end ? Enumerable.Empty<int>() : Enumerable.Range(start, end - start + 1); } }
mit
C#
a29beca8aab85f8012b274bfe61d9f13669121d5
Add widgetCanvas.Arrange to fix zoom buttons not showing for #774
pauldendulk/Mapsui,charlenni/Mapsui,charlenni/Mapsui
Mapsui.Rendering.Xaml/XamlWidgets/WidgetRenderer.cs
Mapsui.Rendering.Xaml/XamlWidgets/WidgetRenderer.cs
using System; using System.Collections.Generic; using System.Windows.Controls; using Mapsui.Widgets; namespace Mapsui.Rendering.Xaml.XamlWidgets { public static class WidgetRenderer { public static void Render(object target, IReadOnlyViewport viewport, IEnumerable<IWidget> widgets, IDictionary<Type, IWidgetRenderer> renderers) { var canvas = (Canvas)target; var widgetCanvas = new Canvas { Width = canvas.ActualWidth, Height = canvas.ActualHeight, Background = null }; widgetCanvas.Arrange(new System.Windows.Rect(canvas.RenderSize)); canvas.Children.Add(widgetCanvas); foreach (var widget in widgets) { ((IXamlWidgetRenderer)renderers[widget.GetType()]).Draw(widgetCanvas, viewport, widget); } } } }
using System; using System.Collections.Generic; using System.Windows.Controls; using Mapsui.Widgets; namespace Mapsui.Rendering.Xaml.XamlWidgets { public static class WidgetRenderer { public static void Render(object target, IReadOnlyViewport viewport, IEnumerable<IWidget> widgets, IDictionary<Type, IWidgetRenderer> renderers) { var canvas = (Canvas)target; var widgetCanvas = new Canvas { Width = canvas.ActualWidth, Height = canvas.ActualHeight, Background = null }; canvas.Children.Add(widgetCanvas); foreach (var widget in widgets) { ((IXamlWidgetRenderer)renderers[widget.GetType()]).Draw(widgetCanvas, viewport, widget); } } } }
mit
C#
e8eba7d62b323ced15511b3dd28ab2bfb6f2a7b6
Fix name
Branimir123/FMI-IoT-Teamwork,Branimir123/FMI-IoT-Teamwork
SmartHive/SmartHive.Web/Views/Shared/_Layout.cshtml
SmartHive/SmartHive.Web/Views/Shared/_Layout.cshtml
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@ViewBag.Title - SmartHive</title> @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> @Html.ActionLink("SmartHive", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Home", "Index", "Home")</li> <li>@Html.ActionLink("About", "About", "Home")</li> <li>@Html.ActionLink("Contact", "Contact", "Home")</li> @if (HttpContext.Current.GetOwinContext().Authentication.User.Identity.IsAuthenticated) { <li>@Html.ActionLink("My hives", "Index", "Hive")</li> } </ul> @Html.Partial("_LoginPartial") </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @RenderSection("scripts", required: false) </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@ViewBag.Title - My ASP.NET Application</title> @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Home", "Index", "Home")</li> <li>@Html.ActionLink("About", "About", "Home")</li> <li>@Html.ActionLink("Contact", "Contact", "Home")</li> @if (HttpContext.Current.GetOwinContext().Authentication.User.Identity.IsAuthenticated) { <li>@Html.ActionLink("My hives", "Index", "Hive")</li> } </ul> @Html.Partial("_LoginPartial") </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @RenderSection("scripts", required: false) </body> </html>
mit
C#
2ea716559f4ace4c52b0f8a9a055daa3640df09a
Update MilestoneTests.cs
tiksn/TIKSN-Framework
TIKSN.UnitTests.Shared/Versioning/MilestoneTests.cs
TIKSN.UnitTests.Shared/Versioning/MilestoneTests.cs
using Xunit; namespace TIKSN.Versioning.Tests { public class MilestoneTests { [Fact] public void Test2() => Assert.True(Milestone.Alpha < Milestone.Beta); [Fact] public void Test3() => Assert.True(Milestone.Beta < Milestone.ReleaseCandidate); [Fact] public void Test4() => Assert.True(Milestone.ReleaseCandidate < Milestone.Release); } }
using Xunit; namespace TIKSN.Versioning.Tests { public class MilestoneTests { [Fact] public void Test2() { Assert.True(Milestone.Alpha < Milestone.Beta); } [Fact] public void Test3() { Assert.True(Milestone.Beta < Milestone.ReleaseCandidate); } [Fact] public void Test4() { Assert.True(Milestone.ReleaseCandidate < Milestone.Release); } } }
mit
C#
9d182a713cf4d11520fdd32351cedbe15f0a8d94
Add TSQLStatement.AsMerge property
bruce-dunwiddie/tsql-parser
TSQL_Parser/TSQL_Parser/Statements/TSQLStatement.cs
TSQL_Parser/TSQL_Parser/Statements/TSQLStatement.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using TSQL.Expressions; using TSQL.Tokens; namespace TSQL.Statements { public abstract class TSQLStatement : TSQLExpression { public abstract TSQLStatementType Type { get; } public TSQLSelectStatement AsSelect { get { return this as TSQLSelectStatement; } } public TSQLMergeStatement AsMerge { get { return this as TSQLMergeStatement; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using TSQL.Expressions; using TSQL.Tokens; namespace TSQL.Statements { public abstract class TSQLStatement : TSQLExpression { public abstract TSQLStatementType Type { get; } public TSQLSelectStatement AsSelect { get { return this as TSQLSelectStatement; } } } }
apache-2.0
C#
f6f5de7ad16fd416bdbb7ad11fa205be085f66c6
Allow LineBufferedReader to keep underlying stream open
EVAST9919/osu,peppy/osu-new,peppy/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,smoogipooo/osu,NeoAdonis/osu,NeoAdonis/osu,EVAST9919/osu,ppy/osu,UselessToucan/osu
osu.Game/IO/LineBufferedReader.cs
osu.Game/IO/LineBufferedReader.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.IO; using System.Text; namespace osu.Game.IO { /// <summary> /// A <see cref="StreamReader"/>-like decorator (with more limited API) for <see cref="Stream"/>s /// that allows lines to be peeked without consuming. /// </summary> public class LineBufferedReader : IDisposable { private readonly StreamReader streamReader; private readonly Queue<string> lineBuffer; public LineBufferedReader(Stream stream, bool leaveOpen = false) { streamReader = new StreamReader(stream, Encoding.UTF8, true, 1024, leaveOpen); lineBuffer = new Queue<string>(); } /// <summary> /// Reads the next line from the stream without consuming it. /// Subsequent calls to <see cref="PeekLine"/> without a <see cref="ReadLine"/> will return the same string. /// </summary> public string PeekLine() { if (lineBuffer.Count > 0) return lineBuffer.Peek(); var line = streamReader.ReadLine(); if (line != null) lineBuffer.Enqueue(line); return line; } /// <summary> /// Reads the next line from the stream and consumes it. /// If a line was peeked, that same line will then be consumed and returned. /// </summary> public string ReadLine() => lineBuffer.Count > 0 ? lineBuffer.Dequeue() : streamReader.ReadLine(); /// <summary> /// Reads the stream to its end and returns the text read. /// This includes any peeked but unconsumed lines. /// </summary> public string ReadToEnd() { var remainingText = streamReader.ReadToEnd(); if (lineBuffer.Count == 0) return remainingText; var builder = new StringBuilder(); // this might not be completely correct due to varying platform line endings while (lineBuffer.Count > 0) builder.AppendLine(lineBuffer.Dequeue()); builder.Append(remainingText); return builder.ToString(); } public void Dispose() { streamReader?.Dispose(); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.IO; using System.Text; namespace osu.Game.IO { /// <summary> /// A <see cref="StreamReader"/>-like decorator (with more limited API) for <see cref="Stream"/>s /// that allows lines to be peeked without consuming. /// </summary> public class LineBufferedReader : IDisposable { private readonly StreamReader streamReader; private readonly Queue<string> lineBuffer; public LineBufferedReader(Stream stream) { streamReader = new StreamReader(stream); lineBuffer = new Queue<string>(); } /// <summary> /// Reads the next line from the stream without consuming it. /// Subsequent calls to <see cref="PeekLine"/> without a <see cref="ReadLine"/> will return the same string. /// </summary> public string PeekLine() { if (lineBuffer.Count > 0) return lineBuffer.Peek(); var line = streamReader.ReadLine(); if (line != null) lineBuffer.Enqueue(line); return line; } /// <summary> /// Reads the next line from the stream and consumes it. /// If a line was peeked, that same line will then be consumed and returned. /// </summary> public string ReadLine() => lineBuffer.Count > 0 ? lineBuffer.Dequeue() : streamReader.ReadLine(); /// <summary> /// Reads the stream to its end and returns the text read. /// This includes any peeked but unconsumed lines. /// </summary> public string ReadToEnd() { var remainingText = streamReader.ReadToEnd(); if (lineBuffer.Count == 0) return remainingText; var builder = new StringBuilder(); // this might not be completely correct due to varying platform line endings while (lineBuffer.Count > 0) builder.AppendLine(lineBuffer.Dequeue()); builder.Append(remainingText); return builder.ToString(); } public void Dispose() { streamReader?.Dispose(); } } }
mit
C#
74e2d1cab6a717606b0b3bbce1b51a04bc278ce1
Add to see when it's free to use.
dimixar/audio-controller-unity
AudioController/Assets/Source/AudioObject.cs
AudioController/Assets/Source/AudioObject.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(AudioSource))] public class AudioObject : MonoBehaviour { public System.Action<AudioObject> OnFinishedPlaying; #region private fields private string _id; private AudioClip _clip; private AudioSource _source; private Coroutine _playingRoutine; private bool _isFree = true; #endregion #region Public methods and properties public string clipName { get { return _clip != null ? _clip.name : "NONE"; } } public bool isFree { get { return _isFree; } } public void Setup(string id, AudioClip clip) { _id = id; _clip = clip; } public void Play() { if (_source == null) _source = GetComponent<AudioSource>(); _source.clip = _clip; _source.Play(); _isFree = false; _playingRoutine = StartCoroutine(PlayingRoutine()); } public void Stop() { if (_playingRoutine == null) return; _source.Stop(); } [ContextMenu("Test Play")] private void TestPlay() { Play(); } #endregion private IEnumerator PlayingRoutine() { Debug.Log("Playing Started"); while(true) { Debug.Log("Checking if it's playing."); yield return new WaitForSeconds(0.05f); if (!_source.isPlaying) { Debug.Log("AudioSource Finished Playing"); break; } } Debug.Log("Not playing anymore"); if (OnFinishedPlaying != null) { OnFinishedPlaying(this); } _source.clip = null; _playingRoutine = null; _isFree = true; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(AudioSource))] public class AudioObject : MonoBehaviour { public System.Action<AudioObject> OnFinishedPlaying; #region private fields private string _id; private AudioClip _clip; private AudioSource _source; private Coroutine _playingRoutine; #endregion #region Public methods and properties public string clipName { get { return _clip != null ? _clip.name : "NONE"; } } public void Setup(string id, AudioClip clip) { _id = id; _clip = clip; } public void Play() { if (_source == null) _source = GetComponent<AudioSource>(); _source.clip = _clip; _source.Play(); _playingRoutine = StartCoroutine(PlayingRoutine()); } public void Stop() { if (_playingRoutine == null) return; _source.Stop(); } [ContextMenu("Test Play")] private void TestPlay() { Play(); } #endregion private IEnumerator PlayingRoutine() { Debug.Log("Playing Started"); while(true) { Debug.Log("Checking if it's playing."); yield return new WaitForSeconds(0.05f); if (!_source.isPlaying) { Debug.Log("AudioSource Finished Playing"); break; } } Debug.Log("Not playing anymore"); if (OnFinishedPlaying != null) { OnFinishedPlaying(this); } _source.clip = null; _playingRoutine = null; } }
mit
C#
f18052ceba5f9a6d26a3d37677401b8882daaebd
return AsyncTask when you invoke Async.Run
kerryjiang/SuperSocket,ZixiangBoy/SuperSocket,chucklu/SuperSocket,fryderykhuang/SuperSocket,kerryjiang/SuperSocket,memleaks/SuperSocket,ZixiangBoy/SuperSocket,mdavid/SuperSocket,mdavid/SuperSocket,ZixiangBoy/SuperSocket,fryderykhuang/SuperSocket,jmptrader/SuperSocket,jmptrader/SuperSocket,jmptrader/SuperSocket,chucklu/SuperSocket,fryderykhuang/SuperSocket,mdavid/SuperSocket,chucklu/SuperSocket
mainline/Common/Async.cs
mainline/Common/Async.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SuperSocket.Common { public static class Async { public static Task Run(Action task) { return Run(task, TaskCreationOptions.None); } public static Task Run(Action task, TaskCreationOptions taskOption) { return Run(task, taskOption, null); } public static Task Run(Action task, Action<Exception> exceptionHandler) { return Run(task, TaskCreationOptions.None, exceptionHandler); } public static Task Run(Action task, TaskCreationOptions taskOption, Action<Exception> exceptionHandler) { return Task.Factory.StartNew(task, taskOption).ContinueWith(t => { if (exceptionHandler != null) exceptionHandler(t.Exception); else LogUtil.LogError(t.Exception); }, TaskContinuationOptions.OnlyOnFaulted); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SuperSocket.Common { public static class Async { public static void Run(Action task) { Run(task, TaskCreationOptions.None); } public static void Run(Action task, TaskCreationOptions taskOption) { Run(task, taskOption, null); } public static void Run(Action task, Action<Exception> exceptionHandler) { Run(task, TaskCreationOptions.None, exceptionHandler); } public static void Run(Action task, TaskCreationOptions taskOption, Action<Exception> exceptionHandler) { Task.Factory.StartNew(task, taskOption).ContinueWith(t => { if (exceptionHandler != null) exceptionHandler(t.Exception); else LogUtil.LogError(t.Exception); }, TaskContinuationOptions.OnlyOnFaulted); } } }
apache-2.0
C#
4be806a3bae2a58f51743ee4dc4a42854d38d203
Update XssFilterMiddlewareTests.cs
ziyasal/helmet.net
Helmet.Net.Tests/XssFilterMiddlewareTests.cs
Helmet.Net.Tests/XssFilterMiddlewareTests.cs
using NUnit.Framework; namespace Helmet.Net.Tests { public class XssFilterMiddlewareTests : TestBase { [Test] public async void HelloTest() { Assert.IsTrue(true); } } }
using NUnit.Framework; namespace Helmet.Net.Tests { public class XssFilterMiddlewareTests : TestBase { [Test] public async Task HelloTest() { Assert.IsTrue(true); } } }
mit
C#
26e82d2d7fee3443a739435a32d76bdc629c0955
Remove unused methods.
cube-soft/Cube.Core,cube-soft/Cube.Forms,cube-soft/Cube.Core,cube-soft/Cube.Forms
Libraries/NativeMethods/UrlMon.cs
Libraries/NativeMethods/UrlMon.cs
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /* ------------------------------------------------------------------------- */ using System.Runtime.InteropServices; using System.Text; namespace Cube.Forms.UrlMon { /* --------------------------------------------------------------------- */ /// /// UrlMon.NativeMethods /// /// <summary> /// urlmon.dll に定義された関数を宣言するためのクラスです。 /// </summary> /// /* --------------------------------------------------------------------- */ internal static class NativeMethods { /* ----------------------------------------------------------------- */ /// /// UrlMkSetSessionOption /// /// <summary> /// https://msdn.microsoft.com/ja-jp/library/ms775125.aspx /// </summary> /// /* ----------------------------------------------------------------- */ [DllImport(LibName, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)] public static extern int UrlMkSetSessionOption(int dwOption, string pBuffer, int dwBufferLength, int dwReserved); /* ----------------------------------------------------------------- */ /// /// UrlMkGetSessionOption /// /// <summary> /// https://msdn.microsoft.com/ja-jp/library/ms775124.aspx /// </summary> /// /* ----------------------------------------------------------------- */ [DllImport(LibName, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)] public static extern int UrlMkGetSessionOption(int dwOption, StringBuilder pBuffer, int dwBufferLength, ref int pdwBufferLength, int dwReserved); #region Fields const string LibName = "urlmon.dll"; #endregion } }
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /* ------------------------------------------------------------------------- */ using System.Runtime.InteropServices; using System.Text; namespace Cube.Forms.UrlMon { /* --------------------------------------------------------------------- */ /// /// UrlMon.NativeMethods /// /// <summary> /// urlmon.dll に定義された関数を宣言するためのクラスです。 /// </summary> /// /* --------------------------------------------------------------------- */ internal static class NativeMethods { /* ----------------------------------------------------------------- */ /// /// CoInternetIsFeatureEnabled /// /// <summary> /// https://msdn.microsoft.com/ja-jp/library/ms537164.aspx /// </summary> /// /* ----------------------------------------------------------------- */ [DllImport(LibName)] public static extern int CoInternetIsFeatureEnabled(int featureEntry, int dwFlags); /* ----------------------------------------------------------------- */ /// /// CoInternetSetFeatureEnabled /// /// <summary> /// https://msdn.microsoft.com/ja-jp/library/ms537168.aspx /// </summary> /// /* ----------------------------------------------------------------- */ [DllImport(LibName)] public static extern int CoInternetSetFeatureEnabled(int FeatureEntry, int dwFlags, bool fEnable); /* ----------------------------------------------------------------- */ /// /// UrlMkSetSessionOption /// /// <summary> /// https://msdn.microsoft.com/ja-jp/library/ms775125.aspx /// </summary> /// /* ----------------------------------------------------------------- */ [DllImport(LibName, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)] public static extern int UrlMkSetSessionOption(int dwOption, string pBuffer, int dwBufferLength, int dwReserved); /* ----------------------------------------------------------------- */ /// /// UrlMkGetSessionOption /// /// <summary> /// https://msdn.microsoft.com/ja-jp/library/ms775124.aspx /// </summary> /// /* ----------------------------------------------------------------- */ [DllImport(LibName, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)] public static extern int UrlMkGetSessionOption(int dwOption, StringBuilder pBuffer, int dwBufferLength, ref int pdwBufferLength, int dwReserved); #region Fields const string LibName = "urlmon.dll"; #endregion } }
apache-2.0
C#
55e1f394e15e5d693d3e6c80046792e7877d03f1
Bump version.
FacilityApi/Facility
SolutionInfo.cs
SolutionInfo.cs
using System.Reflection; [assembly: AssemblyVersion("0.6.0.0")] [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright 2016-2017 Ed Ball")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
using System.Reflection; [assembly: AssemblyVersion("0.5.3.0")] [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright 2016-2017 Ed Ball")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
mit
C#
a6357ddb207c3191f6a17c0915f0d805b3e6440f
Use autofixture for unit tests of the command bus.
uncas/BuildPipeline
test/Uncas.BuildPipeline.Tests.Unit/CommandBusTests.cs
test/Uncas.BuildPipeline.Tests.Unit/CommandBusTests.cs
using Microsoft.Practices.ServiceLocation; using Microsoft.Practices.Unity; using Moq; using NUnit.Framework; using Ploeh.AutoFixture; using Uncas.BuildPipeline.Commands; namespace Uncas.BuildPipeline.Tests.Unit { [TestFixture] public class CommandBusTests : WithFixture<CommandBus> { [Test] public void Publish_HandlerNotRegisterd_ThrowsInvalidOperationException() { Fixture.Register<IServiceLocator>(() => new UnityServiceLocator(new UnityContainer())); Assert.Throws<ActivationException>(() => Sut.Publish(Fixture.Create<UpdateGitMirrors>())); } [Test] public void Publish_HandlerRegistered_GetsResolvedOnce() { var mock = new Mock<IServiceLocator>(); mock.Setup(x => x.GetInstance(typeof (UpdateGitMirrorsHandler))).Returns( Fixture.Create<UpdateGitMirrorsHandler>()); Fixture.Register(() => mock.Object); Sut.Publish(Fixture.Create<UpdateGitMirrors>()); mock.Verify(x => x.GetInstance(typeof (UpdateGitMirrorsHandler)), Times.Once()); } } }
using System; using Microsoft.Practices.ServiceLocation; using Moq; using NUnit.Framework; using Uncas.BuildPipeline.Commands; using Uncas.BuildPipeline.Repositories; using Uncas.BuildPipeline.Utilities; namespace Uncas.BuildPipeline.Tests.Unit { [TestFixture] public class CommandBusTests { [Test] public void Publish_HandlerNotRegisterd_ThrowsInvalidOperationException() { var mock = new Mock<IServiceLocator>(); var bus = new CommandBus(mock.Object); Assert.Throws<InvalidOperationException>(() => bus.Publish(new UpdateGitMirrors())); } [Test] public void Publish_HandlerRegistered_GetsResolvedOnce() { var mock = new Mock<IServiceLocator>(); mock.Setup(x => x.GetInstance(typeof (UpdateGitMirrorsHandler))).Returns( new UpdateGitMirrorsHandler(new GitUtility(), new ProjectReadStore())); var bus = new CommandBus(mock.Object); bus.Publish(new UpdateGitMirrors()); mock.Verify(x => x.GetInstance(typeof (UpdateGitMirrorsHandler)), Times.Once()); } } }
mit
C#
e8e7d72cf817ed021b569da1c455d5a8a6db3d12
apply visual studio formatter
RyotaMurohoshi/unity_snippets
unity/Assets/Scripts/Point.cs
unity/Assets/Scripts/Point.cs
using System; namespace MrStarBase { public class Point : IEquatable<Point> { readonly int x; readonly int y; public int X { get { return x; } } public int Y { get { return y; } } public Point(int x, int y) { this.x = x; this.y = y; } public int Distance(Point other) { return Math.Abs(this.X - other.X) + Math.Abs(this.Y - other.Y); } public bool IsNext(Point other) { return this.Distance(other) == 1; } public bool Equals(Point other) { if (other == null) return false; if (this.X == other.X && this.Y == other.y) return true; else return false; } public override bool Equals(Object obj) { if (obj == null) return false; Point other = obj as Point; if (other == null) return false; else return Equals(other); } public override int GetHashCode() { return X ^ Y; } public static bool operator ==(Point lhs, Point rhs) { if ((object)lhs == null || ((object)rhs) == null) return Object.Equals(lhs, rhs); return lhs.Equals(rhs); } public static bool operator !=(Point lhs, Point rhs) { if (lhs == null || rhs == null) return !Object.Equals(lhs, rhs); return !(lhs.Equals(rhs)); } } }
using System; namespace MrStarBase { public class Point : IEquatable<Point> { readonly int x; readonly int y; public int X { get { return x; } } public int Y { get { return y; } } public Point (int x, int y) { this.x = x; this.y = y; } public int Distance (Point other) { return Math.Abs (this.X - other.X) + Math.Abs (this.Y - other.Y); } public bool IsNext (Point other) { return this.Distance (other) == 1; } public bool Equals (Point other) { if (other == null) return false; if (this.X == other.X && this.Y == other.y) return true; else return false; } public override bool Equals (Object obj) { if (obj == null) return false; Point other = obj as Point; if (other == null) return false; else return Equals (other); } public override int GetHashCode () { return X ^ Y; } public static bool operator == (Point lhs, Point rhs) { if ((object)lhs == null || ((object)rhs) == null) return Object.Equals (lhs, rhs); return lhs.Equals (rhs); } public static bool operator != (Point lhs, Point rhs) { if (lhs == null || rhs == null) return !Object.Equals (lhs, rhs); return !(lhs.Equals (rhs)); } } }
mit
C#
73b38d8dc078325f9a1925803b1d403cb92e80df
Add [Serializable] attribute
dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute
Source/NSubstitute/Exceptions/ReceivedCallsException.cs
Source/NSubstitute/Exceptions/ReceivedCallsException.cs
using System; using System.Runtime.Serialization; namespace NSubstitute.Exceptions { [Serializable] public class ReceivedCallsException : SubstituteException { public ReceivedCallsException() { } public ReceivedCallsException(string message) : base(message) { } public ReceivedCallsException(string message, Exception innerException) : base(message, innerException) { } protected ReceivedCallsException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
using System; using System.Runtime.Serialization; namespace NSubstitute.Exceptions { public class ReceivedCallsException : SubstituteException { public ReceivedCallsException() { } public ReceivedCallsException(string message) : base(message) { } public ReceivedCallsException(string message, Exception innerException) : base(message, innerException) { } protected ReceivedCallsException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
bsd-3-clause
C#
d0adf6ab179996943a32f503b27b2487f9f28b03
update version
prodot/ReCommended-Extension
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
using System.Reflection; using ReCommendedExtension; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(ZoneMarker.ExtensionName)] [assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("prodot GmbH")] [assembly: AssemblyProduct(ZoneMarker.ExtensionId)] [assembly: AssemblyCopyright("© 2012-2019 prodot GmbH")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("3.4.3.0")] [assembly: AssemblyFileVersion("3.4.3")]
using System.Reflection; using ReCommendedExtension; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(ZoneMarker.ExtensionName)] [assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("prodot GmbH")] [assembly: AssemblyProduct(ZoneMarker.ExtensionId)] [assembly: AssemblyCopyright("© 2012-2019 prodot GmbH")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("3.4.2.0")] [assembly: AssemblyFileVersion("3.4.2")]
apache-2.0
C#
857d91fa7da24f3f76e5ac45cbe052ec6614181c
Delete revoked api key
JKennedy24/Xamarin.Forms.GoogleMaps,amay077/Xamarin.Forms.GoogleMaps,JKennedy24/Xamarin.Forms.GoogleMaps
XFGoogleMapSample/XFGoogleMapSample/Variables_sample.cs
XFGoogleMapSample/XFGoogleMapSample/Variables_sample.cs
/// PLEASE RENAME THIS FILE TO Variables.cs using System; namespace XFGoogleMapSample { public static class Variables { // https://developers.google.com/maps/documentation/android-api/signup public const string GOOGLE_MAPS_ANDROID_API_KEY = "your_google_maps_android_api_v2_api_key"; // https://developers.google.com/maps/documentation/ios-sdk/start#step_4_get_an_api_key public const string GOOGLE_MAPS_IOS_API_KEY = "your_google_maps_sdk_for_ios_api_key"; // https://msdn.microsoft.com/windows/uwp/maps-and-location/authentication-key public const string BING_MAPS_UWP_API_KEY = "your_bing_maps_apikey"; } }
/// PLEASE RENAME THIS FILE TO Variables.cs using System; namespace XFGoogleMapSample { public static class Variables { // https://developers.google.com/maps/documentation/android-api/signup public const string GOOGLE_MAPS_ANDROID_API_KEY = "your_google_maps_android_api_v2_api_key"; // https://developers.google.com/maps/documentation/ios-sdk/start#step_4_get_an_api_key public const string GOOGLE_MAPS_IOS_API_KEY = "AIzaSyC3qhk6XyYNIyS98xOHQXqDnmZ4Do6eemg"; // https://msdn.microsoft.com/windows/uwp/maps-and-location/authentication-key public const string BING_MAPS_UWP_API_KEY = "your_bing_maps_apikey"; } }
mit
C#
ec5fd7ac1dc0bf84328a64a3b963bf1157ee6685
Remove possible 'System.NullReferenceException'
ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu
osu.Game/Online/Chat/ExternalLinkOpener.cs
osu.Game/Online/Chat/ExternalLinkOpener.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. #nullable disable using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Game.Configuration; using osu.Game.Overlays; using osu.Game.Overlays.Chat; namespace osu.Game.Online.Chat { public class ExternalLinkOpener : Component { [Resolved] private GameHost host { get; set; } [Resolved(CanBeNull = true)] private IDialogOverlay dialogOverlay { get; set; } private Bindable<bool> externalLinkWarning; [BackgroundDependencyLoader(true)] private void load(OsuConfigManager config) { externalLinkWarning = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning); } public void OpenUrlExternally(string url, bool bypassWarning = false) { if (!bypassWarning && externalLinkWarning.Value) dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url), () => host.GetClipboard()?.SetText(url))); else host.OpenUrlExternally(url); } } }
// 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. #nullable disable using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Game.Configuration; using osu.Game.Overlays; using osu.Game.Overlays.Chat; namespace osu.Game.Online.Chat { public class ExternalLinkOpener : Component { [Resolved] private GameHost host { get; set; } [Resolved(CanBeNull = true)] private IDialogOverlay dialogOverlay { get; set; } private Bindable<bool> externalLinkWarning; [BackgroundDependencyLoader(true)] private void load(OsuConfigManager config) { externalLinkWarning = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning); } public void OpenUrlExternally(string url, bool bypassWarning = false) { if (!bypassWarning && externalLinkWarning.Value) dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url), () => host.GetClipboard().SetText(url))); else host.OpenUrlExternally(url); } } }
mit
C#
8d18c7e9299cc9c8e4a8b55563c3a9a22d1a99bd
Fix `BreakTracker.IsBreakTime` not updated properly on breaks set
ppy/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu-new,NeoAdonis/osu,UselessToucan/osu,ppy/osu
osu.Game/Screens/Play/BreakTracker.cs
osu.Game/Screens/Play/BreakTracker.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Scoring; using osu.Game.Utils; namespace osu.Game.Screens.Play { public class BreakTracker : Component { private readonly ScoreProcessor scoreProcessor; private readonly double gameplayStartTime; private PeriodTracker breaks; /// <summary> /// Whether the gameplay is currently in a break. /// </summary> public IBindable<bool> IsBreakTime => isBreakTime; private readonly BindableBool isBreakTime = new BindableBool(true); public IReadOnlyList<BreakPeriod> Breaks { set { breaks = new PeriodTracker(value.Where(b => b.HasEffect) .Select(b => new Period(b.StartTime, b.EndTime - BreakOverlay.BREAK_FADE_DURATION))); updateBreakTime(); } } public BreakTracker(double gameplayStartTime = 0, ScoreProcessor scoreProcessor = null) { this.gameplayStartTime = gameplayStartTime; this.scoreProcessor = scoreProcessor; } protected override void Update() { base.Update(); updateBreakTime(); } private void updateBreakTime() { var time = Clock?.CurrentTime ?? 0; isBreakTime.Value = breaks?.IsInAny(time) == true || time < gameplayStartTime || scoreProcessor?.HasCompleted.Value == 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 System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Scoring; using osu.Game.Utils; namespace osu.Game.Screens.Play { public class BreakTracker : Component { private readonly ScoreProcessor scoreProcessor; private readonly double gameplayStartTime; private PeriodTracker breaks; /// <summary> /// Whether the gameplay is currently in a break. /// </summary> public IBindable<bool> IsBreakTime => isBreakTime; private readonly BindableBool isBreakTime = new BindableBool(); public IReadOnlyList<BreakPeriod> Breaks { set { isBreakTime.Value = false; breaks = new PeriodTracker(value.Where(b => b.HasEffect) .Select(b => new Period(b.StartTime, b.EndTime - BreakOverlay.BREAK_FADE_DURATION))); } } public BreakTracker(double gameplayStartTime = 0, ScoreProcessor scoreProcessor = null) { this.gameplayStartTime = gameplayStartTime; this.scoreProcessor = scoreProcessor; } protected override void Update() { base.Update(); var time = Clock.CurrentTime; isBreakTime.Value = breaks?.IsInAny(time) == true || time < gameplayStartTime || scoreProcessor?.HasCompleted.Value == true; } } }
mit
C#
cc183f169b768b221b9dd2cac8408ff328668f0a
Set version to 1.2.3
simplicbe/Simplic.Dlr,simplicbe/Simplic.Dlr
src/Simplic.Dlr/Properties/AssemblyInfo.cs
src/Simplic.Dlr/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("Simplic.Dlr")] [assembly: AssemblyDescription("Provides functions to work very easily with the microsoft dlr / IronPython")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Simplic Systems")] [assembly: AssemblyProduct("Simplic.Dlr")] [assembly: AssemblyCopyright("Copyright © Simplic Systems 2016 / Benedikt Eggers")] [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("265e557a-ebef-410a-976c-cb561716cfa9")] // 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.2.3.0")] [assembly: AssemblyFileVersion("1.2.3.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("Simplic.Dlr")] [assembly: AssemblyDescription("Provides functions to work very easily with the microsoft dlr / IronPython")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Simplic Systems")] [assembly: AssemblyProduct("Simplic.Dlr")] [assembly: AssemblyCopyright("Copyright © Simplic Systems 2016 / Benedikt Eggers")] [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("265e557a-ebef-410a-976c-cb561716cfa9")] // 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.2.2.0")] [assembly: AssemblyFileVersion("1.2.2.0")]
mit
C#
4be473bacf7b02e0bf41e113d6ea1db0b25902f7
replace hyphens with underscores
peppy/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,ZLima12/osu-framework,default0/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,Tom94/osu-framework,Tom94/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,default0/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework
osu.Framework/IO/Stores/DllResourceStore.cs
osu.Framework/IO/Stores/DllResourceStore.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.IO; using System.Reflection; namespace osu.Framework.IO.Stores { public class DllResourceStore : IResourceStore<byte[]> { private readonly Assembly assembly; private readonly string space; public DllResourceStore(string dllName) { assembly = Assembly.LoadFrom(dllName); space = Path.GetFileNameWithoutExtension(dllName); } public byte[] Get(string name) { using (Stream input = GetStream(name)) { if (input == null) return null; byte[] buffer = new byte[input.Length]; input.Read(buffer, 0, buffer.Length); return buffer; } } public Stream GetStream(string name) { var split = name.Split('/'); for (int i = 0; i < split.Length - 1; i++) split[i] = split[i].Replace('-', '_'); return assembly?.GetManifestResourceStream($@"{space}.{string.Join(".", split)}"); } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.IO; using System.Reflection; namespace osu.Framework.IO.Stores { public class DllResourceStore : IResourceStore<byte[]> { private readonly Assembly assembly; private readonly string space; public DllResourceStore(string dllName) { assembly = Assembly.LoadFrom(dllName); space = Path.GetFileNameWithoutExtension(dllName); } public byte[] Get(string name) { using (Stream input = GetStream(name)) { if (input == null) return null; byte[] buffer = new byte[input.Length]; input.Read(buffer, 0, buffer.Length); return buffer; } } public Stream GetStream(string name) { return assembly?.GetManifestResourceStream($@"{space}.{name.Replace('/', '.')}"); } } }
mit
C#
3578160d88bfd39f232a3bd3e9b215f7fcaebf48
Add the parser source for the Python dynamic library
markfinal/bam-python,markfinal/bam-python,markfinal/bam-python
packages/Python-3.5.1/bam/Scripts/Python.cs
packages/Python-3.5.1/bam/Scripts/Python.cs
using Bam.Core; namespace Python { sealed class PythonInterpreter : C.ConsoleApplication { protected override void Init( Bam.Core.Module parent) { base.Init(parent); this.Macros["OutputName"] = Bam.Core.TokenizedString.CreateVerbatim("python"); var source = this.CreateCSourceContainer("$(packagedir)/Programs/python.c"); source.PrivatePatch(settings => { var compiler = settings as C.ICommonCompilerSettings; compiler.PreprocessorDefines.Add("Py_BUILD_CORE"); compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/Include")); if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows)) { compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/PC")); } }); if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows)) { this.CompilePubliclyAndLinkAgainst<WindowsSDK.WindowsSDK>(source); } this.LinkAgainst<PythonLibrary>(); } } sealed class PythonLibrary : C.DynamicLibrary { protected override void Init( Bam.Core.Module parent) { base.Init(parent); this.Macros["OutputName"] = Bam.Core.TokenizedString.CreateVerbatim("python"); this.Macros["MajorVersion"] = Bam.Core.TokenizedString.CreateVerbatim("3"); this.Macros["MinorVersion"] = Bam.Core.TokenizedString.CreateVerbatim("5"); this.Macros["PatchVersion"] = Bam.Core.TokenizedString.CreateVerbatim("1"); var parserSource = this.CreateCSourceContainer("$(packagedir)/Parser/*.c", filter: new System.Text.RegularExpressions.Regex(@"^((?!.*pgen).*)$")); parserSource.PrivatePatch(settings => { var compiler = settings as C.ICommonCompilerSettings; compiler.PreprocessorDefines.Add("Py_BUILD_CORE"); compiler.PreprocessorDefines.Add("Py_ENABLE_SHARED"); compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/Include")); if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows)) { compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/PC")); } }); if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows)) { this.CompilePubliclyAndLinkAgainst<WindowsSDK.WindowsSDK>(parserSource); } } } }
using Bam.Core; namespace Python { sealed class PythonInterpreter : C.ConsoleApplication { protected override void Init( Bam.Core.Module parent) { base.Init(parent); this.Macros["OutputName"] = Bam.Core.TokenizedString.CreateVerbatim("python"); var source = this.CreateCSourceContainer("$(packagedir)/Programs/python.c"); source.PrivatePatch(settings => { var compiler = settings as C.ICommonCompilerSettings; compiler.PreprocessorDefines.Add("Py_BUILD_CORE"); compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/Include")); if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows)) { compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/PC")); } }); if (this.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows)) { this.CompilePubliclyAndLinkAgainst<WindowsSDK.WindowsSDK>(source); } } } }
bsd-3-clause
C#
f8402f0c29128e2347d382193b84a21ab7a2fe84
Add read only props to access RVA and size
jorik041/dnlib,Arthur2e5/dnlib,0xd4d/dnlib,modulexcite/dnlib,ilkerhalil/dnlib,kiootic/dnlib,ZixiangBoy/dnlib,yck1509/dnlib,picrap/dnlib
dot10/PE/ImageDataDirectory.cs
dot10/PE/ImageDataDirectory.cs
using System; using System.IO; namespace dot10.PE { /// <summary> /// Represents the IMAGE_DATA_DIRECTORY PE section /// </summary> public class ImageDataDirectory : FileSection { RVA virtualAddress; uint dataSize; /// <summary> /// Returns the IMAGE_DATA_DIRECTORY.VirtualAddress field /// </summary> public RVA VirtualAddress { get { return virtualAddress; } } /// <summary> /// Returns the IMAGE_DATA_DIRECTORY.Size field /// </summary> public uint Size { get { return dataSize; } } /// <summary> /// Default constructor /// </summary> public ImageDataDirectory() { } /// <summary> /// Constructor /// </summary> /// <param name="reader">PE file reader pointing to the start of this section</param> /// <param name="verify">Verify section</param> /// <exception cref="BadImageFormatException">Thrown if verification fails</exception> public ImageDataDirectory(BinaryReader reader, bool verify) { SetStartOffset(reader); this.virtualAddress = new RVA(reader.ReadUInt32()); this.dataSize = reader.ReadUInt32(); SetEndoffset(reader); } } }
using System; using System.IO; namespace dot10.PE { /// <summary> /// Represents the IMAGE_DATA_DIRECTORY PE section /// </summary> public class ImageDataDirectory : FileSection { RVA virtualAddress; uint dataSize; /// <summary> /// Default constructor /// </summary> public ImageDataDirectory() { } /// <summary> /// Constructor /// </summary> /// <param name="reader">PE file reader pointing to the start of this section</param> /// <param name="verify">Verify section</param> /// <exception cref="BadImageFormatException">Thrown if verification fails</exception> public ImageDataDirectory(BinaryReader reader, bool verify) { SetStartOffset(reader); this.virtualAddress = new RVA(reader.ReadUInt32()); this.dataSize = reader.ReadUInt32(); SetEndoffset(reader); } } }
mit
C#
e168d1315f84d6bcb2da7c5ff96ae3cd3cf84278
rewrite _cache.Add(key,value) to _cache[key] = value;
rudygt/dot-kafka
DotKafka.Prototype/Common/Cache/LRUCache.cs
DotKafka.Prototype/Common/Cache/LRUCache.cs
using System.Collections.Generic; namespace DotKafka.Prototype.Common.Cache { public class LRUCache<K, V> : ICache<K, V> { private readonly Dictionary<K, V> _cache; private readonly LinkedList<K> _lruList; private readonly int _capacity; public int Size => _cache.Count; public LRUCache(int maxSize) { _capacity = maxSize; _cache = new Dictionary<K, V>(_capacity); _lruList = new LinkedList<K>(); } public V Get(K key) { V value; if (!_cache.TryGetValue(key, out value)) return default(V); var node = _lruList.Find(key); _lruList.Remove(node); _lruList.AddFirst(node); return value; } public void Put(K key, V value) { LinkedListNode<K> node; if (_cache.ContainsKey(key)) { node = _lruList.Find(key); _lruList.Remove(node); _lruList.AddFirst(node); } else { if (_cache.Count >= _capacity) { node = _lruList.Last; _cache.Remove(node.Value); _lruList.RemoveLast(); } _lruList.AddFirst(key); } _cache[key] = value; } public bool Remove(K key) { return _cache.Remove(key) && _lruList.Remove(key); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DotKafka.Prototype.Common.Cache { public class LRUCache<K, V> : ICache<K, V> { private readonly Dictionary<K, V> _cache; private readonly LinkedList<K> _lruList; private readonly int _capacity; public int Size => _cache.Count; public LRUCache(int maxSize) { _capacity = maxSize; _cache = new Dictionary<K, V>(_capacity); _lruList = new LinkedList<K>(); } public V Get(K key) { V value; if (!_cache.TryGetValue(key, out value)) return default(V); var node = _lruList.Find(key); _lruList.Remove(node); _lruList.AddFirst(node); return value; } public void Put(K key, V value) { LinkedListNode<K> node; if (_cache.ContainsKey(key)) { node = _lruList.Find(key); _lruList.Remove(node); _lruList.AddFirst(node); _cache[key] = value; } else { if (_cache.Count >= _capacity) { node = _lruList.Last; _cache.Remove(node.Value); _lruList.RemoveLast(); } _lruList.AddFirst(key); _cache.Add(key, value); } } public bool Remove(K key) { return _cache.Remove(key) && _lruList.Remove(key); } } }
apache-2.0
C#
92d473d93c390c5087f55a59ca1354a1a097afb3
Remove debug code
FICTURE7/CoCSharp,FICTURE7/CoCSharp,FICTURE7/CoCSharp
CoCSharp.Server/Program.cs
CoCSharp.Server/Program.cs
using CoCSharp.Data; using CoCSharp.Data.Models; using CoCSharp.Network; using CoCSharp.Network.Messages; using CoCSharp.Server.Core; using System; using System.Diagnostics; using System.IO; using System.Threading; namespace CoCSharp.Server { public class Program { public static CoCServer Server { get; set; } public static AvatarManager AvatarManager { get { if (Server == null) return null; return Server.AvatarManager; } } public static AllianceManager AllianceManager { get { if (Server == null) return null; return Server.AllianceManager; } } public static void Main(string[] args) { Console.Title = "CoC# - Server"; var stopwatch = new Stopwatch(); stopwatch.Start(); Console.WriteLine("Starting server..."); Server = new CoCServer(); Server.Start(); stopwatch.Stop(); Console.WriteLine("Done({0}ms)! Listening on *:9339", stopwatch.Elapsed.TotalMilliseconds); while (true) { AvatarManager.Flush(); AllianceManager.Flush(); Thread.Sleep(100); } } } }
using CoCSharp.Data; using CoCSharp.Data.Models; using CoCSharp.Network; using CoCSharp.Network.Messages; using CoCSharp.Server.Core; using System; using System.Diagnostics; using System.IO; using System.Threading; namespace CoCSharp.Server { public class Program { public static CoCServer Server { get; set; } public static AvatarManager AvatarManager { get { if (Server == null) return null; return Server.AvatarManager; } } public static AllianceManager AllianceManager { get { if (Server == null) return null; return Server.AllianceManager; } } public static void Main(string[] args) { Console.Title = "CoC# - Server"; var stopwatch = new Stopwatch(); stopwatch.Start(); Console.WriteLine("Starting server..."); Server = new CoCServer(); Server.Start(); stopwatch.Stop(); Console.WriteLine("Done({0}ms)! Listening on *:9339", stopwatch.Elapsed.TotalMilliseconds); while (true) { AvatarManager.Flush(); AllianceManager.Flush(); Thread.Sleep(100); } } public static void m() { Console.WriteLine("-> Setting up AssetManager..."); var AssetManager = new AssetManager(DirectoryPaths.Content); Console.WriteLine(" > Loading buildings.csv..."); AssetManager.LoadCsv<BuildingData>("buildings.csv"); Console.WriteLine(" > Loading traps.csv..."); AssetManager.LoadCsv<TrapData>("traps.csv"); Console.WriteLine(" > Loading obstacles.csv..."); AssetManager.LoadCsv<ObstacleData>("obstacles.csv"); Console.WriteLine(" > Loading decos.csv..."); AssetManager.LoadCsv<DecorationData>("decos.csv"); Console.WriteLine(" > Loading resources.csv..."); AssetManager.LoadCsv<ResourceData>("resources.csv"); AssetManager.DefaultInstance = AssetManager; var mem = new MemoryStream(File.ReadAllBytes("dumpleet")); var kek = new MessageReader(mem); var visit = new VisitHomeDataMessage(); visit.ReadMessage(kek); } } }
mit
C#
a9909ea159267efd8fd55af8c30bb0ccec46e015
Bump minor version
inputfalken/Sharpy
src/Sharpy/Properties/AssemblyInfo.cs
src/Sharpy/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("Sharpy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Sharpy")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //Makes my internal items visibile to the test project [assembly: InternalsVisibleTo("Tests")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e4c60589-e7ce-471c-82e3-28c356cd1191")] // 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("3.6.0.0")] [assembly: AssemblyInformationalVersion("3.6.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("Sharpy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Sharpy")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //Makes my internal items visibile to the test project [assembly: InternalsVisibleTo("Tests")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e4c60589-e7ce-471c-82e3-28c356cd1191")] // 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("3.5.6.0")] [assembly: AssemblyInformationalVersion("3.5.6")]
mit
C#
3be63a2631b540228df1b6adeab733f11960cdcb
update Program.cs
xianrendzw/CodeBuilder
CodeBuilder.WinForm/Program.cs
CodeBuilder.WinForm/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace CodeBuilder.WinForm { using Configuration; using Properties; using UI; using Util; static class Program { static Logger logger = InternalTrace.GetLogger(typeof(Program)); [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { InitializeTraceLevel(); AppContainer container = new AppContainer(); MainForm form = new MainForm(); container.Add(form); logger.Info(Resources.StartingCodeBuilder); Application.Run(form); logger.Info(Resources.CodeBuilderExit); } catch (Exception ex) { logger.Error(Resources.Startup, ex); MessageBoxHelper.DisplayFailure(ex.Message); } InternalTrace.Close(); } static void InitializeTraceLevel() { string traceLevel = ConfigManager.OptionSection.Options["Options.InternalTraceLevel"].Value; InternalTraceLevel level = (InternalTraceLevel)Enum.Parse(InternalTraceLevel.Default.GetType(), traceLevel, true); InternalTrace.Initialize("CodeBuilder_%p.log", level); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace CodeBuilder.WinForm { using Configuration; using Properties; using UI; using Util; static class Program { static Logger logger = InternalTrace.GetLogger(typeof(Program)); [STAThread] static void Main() { System.Globalization.CultureInfo newCulture = new System.Globalization.CultureInfo("zh-CN"); System.Threading.Thread.CurrentThread.CurrentCulture = newCulture; System.Threading.Thread.CurrentThread.CurrentUICulture = newCulture; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { InitializeTraceLevel(); AppContainer container = new AppContainer(); MainForm form = new MainForm(); container.Add(form); logger.Info(Resources.StartingCodeBuilder); Application.Run(form); logger.Info(Resources.CodeBuilderExit); } catch (Exception ex) { logger.Error(Resources.Startup, ex); MessageBoxHelper.DisplayFailure(ex.Message); } InternalTrace.Close(); } static void InitializeTraceLevel() { string traceLevel = ConfigManager.OptionSection.Options["Options.InternalTraceLevel"].Value; InternalTraceLevel level = (InternalTraceLevel)Enum.Parse(InternalTraceLevel.Default.GetType(), traceLevel, true); InternalTrace.Initialize("CodeBuilder_%p.log", level); } } }
mit
C#
5761cc673f09c2826f909164e9bf7767664bab50
implement CatchModRelax
UselessToucan/osu,peppy/osu,ppy/osu,smoogipoo/osu,EVAST9919/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,peppy/osu,peppy/osu,johnneijzen/osu,johnneijzen/osu,peppy/osu-new,smoogipooo/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,2yangk23/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu
osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs
osu.Game.Rulesets.Catch/Mods/CatchModRelax.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.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using osuTK; using System; namespace osu.Game.Rulesets.Catch.Mods { public class CatchModRelax : ModRelax, IApplicableToDrawableRuleset<CatchHitObject> { public override string Description => @"Use the mouse to control the catcher."; public void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset) => (drawableRuleset.Playfield.Parent as Container).Add(new CatchModRelaxHelper(drawableRuleset.Playfield as CatchPlayfield)); private class CatchModRelaxHelper : Drawable, IKeyBindingHandler<CatchAction>, IRequireHighFrequencyMousePosition { private CatcherArea.Catcher catcher; public CatchModRelaxHelper(CatchPlayfield catchPlayfield) { catcher = catchPlayfield.CatcherArea.MovableCatcher; RelativeSizeAxes = Axes.Both; } //disable keyboard controls public bool OnPressed(CatchAction action) => true; public bool OnReleased(CatchAction action) => true; protected override bool OnMouseMove(MouseMoveEvent e) { //lock catcher to mouse position horizontally catcher.X = e.MousePosition.X / DrawSize.X; //make Yuzu face the direction he's moving var direction = Math.Sign(e.Delta.X); if (direction != 0) catcher.Scale = new Vector2(Math.Abs(catcher.Scale.X) * direction, catcher.Scale.Y); return base.OnMouseMove(e); } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Mods { public class CatchModRelax : ModRelax { public override string Description => @"Use the mouse to control the catcher."; } }
mit
C#
19d483c52195e85a0a1974382167a86511f858f7
update version to 1.3.0.0
DevExpress/BigQueryProvider
BigQueryProvider/Properties/AssemblyInfo.cs
BigQueryProvider/Properties/AssemblyInfo.cs
/* Copyright 2015-2018 Developer Express Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("DevExpress.DataAccess.BigQuery")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DevExpress.DataAccess.BigQuery")] [assembly: AssemblyCopyright("Copyright © 2015-2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.3.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]
/* Copyright 2015-2018 Developer Express Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("DevExpress.DataAccess.BigQuery")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DevExpress.DataAccess.BigQuery")] [assembly: AssemblyCopyright("Copyright © 2015-2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.2.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")]
apache-2.0
C#
941e6a9086fdb3da18d3adcba917c219518355de
Update Achievement.cs
overtools/OWLib
DataTool/DataModels/Achievement.cs
DataTool/DataModels/Achievement.cs
using System.Runtime.Serialization; using TankLib.STU.Types; using TankLib.STU.Types.Enums; using static DataTool.Helper.IO; namespace DataTool.DataModels { [DataContract] public class Achievement { [DataMember] public string Name; [DataMember] public string AchievementName; [DataMember] public string Description; [DataMember] public Unlock Reward; [DataMember] public Enum_8E40F295 Trophy; [DataMember] public Enum_116F9601 Category; [DataMember] public int GamerScore; public Achievement(STUAchievement achievement) { Name = GetString(achievement.m_name); AchievementName = achievement.m_4E291DCC.Value; Description = GetString(achievement.m_description); Trophy = achievement.m_trophy; Category = achievement.m_category; GamerScore = achievement.m_gamerScore; if (achievement.m_unlock != 0) { Reward = new Unlock(achievement.m_unlock); } } } }
using System.Runtime.Serialization; using TankLib.STU.Types; using TankLib.STU.Types.Enums; using static DataTool.Helper.IO; namespace DataTool.DataModels { [DataContract] public class Achievement { [DataMember] public string Name; [DataMember] public string Description; [DataMember] public Unlock Reward; [DataMember] public Enum_8E40F295 Trophy; [DataMember] public Enum_116F9601 Category; [DataMember] public int GamerScore; public Achievement(STUAchievement achievement) { Name = GetString(achievement.m_name); Description = GetString(achievement.m_description); Trophy = achievement.m_trophy; Category = achievement.m_category; GamerScore = achievement.m_gamerScore; if (achievement.m_unlock != 0) { Reward = new Unlock(achievement.m_unlock); } } } }
mit
C#
0b7c1f5205487e10d11672fe424081e29c20cf3b
Improve the way Booleans are shown if they are not within the maximum allowable limit
ddashwood/NeuralNet
NeuralNetTypes/NeuralNetBooleanFormatter.cs
NeuralNetTypes/NeuralNetBooleanFormatter.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NeuralNet.Configuration; namespace NeuralNetTypes { class NeuralNetBooleanFormatter : NetInputOutputFormatter { private const double high = 0.9, low = 0.1, maxError = 0.1; public sealed override string InputToString(double input) { return HighOrLow(input); } public override bool TryParse(string s, out double result) { if (s.Trim().ToUpper() == "H") { result = high; return true; } if (s.Trim().ToUpper() == "L") { result = low; return true; } return base.TryParse(s, out result); } public sealed override string OutputToString(double output) { return $"{base.OutputToString(output)} [{HighOrLow(output)}]"; } private string HighOrLow(double number) { // Check if the number is within the maximum error // If it is, return a capital H or L if (Math.Abs(number - high) <= maxError) return "H"; if (Math.Abs(number - low) <= maxError) return "L"; // Otherwise, return a lower case letter return (number >= 0.5 ? "h" : "l"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NeuralNet.Configuration; namespace NeuralNetTypes { class NeuralNetBooleanFormatter : NetInputOutputFormatter { private const double high = 0.9, low = 0.1, maxError = 0.1; public sealed override string InputToString(double input) { return HighOrLow(input); } public override bool TryParse(string s, out double result) { if (s.Trim().ToUpper() == "H") { result = high; return true; } if (s.Trim().ToUpper() == "L") { result = low; return true; } return base.TryParse(s, out result); } public sealed override string OutputToString(double output) { return $"{base.OutputToString(output)} [{HighOrLow(output)}]"; } private string HighOrLow(double number) { if (Math.Abs(number - high) <= maxError) return "H"; if (Math.Abs(number - low) <= maxError) return "L"; return "?"; } } }
mit
C#
9b3c908b5acb945756006d913b650ddc858338fd
Fix null ref error if bfgminer returns no Status w / the devs API
nwoolls/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner
MultiMiner.Xgminer.Api/DeviceInformation.cs
MultiMiner.Xgminer.Api/DeviceInformation.cs
using System; namespace MultiMiner.Xgminer.Api { public class DeviceInformation { public DeviceInformation() { Status = String.Empty; } public string Kind { get; set; } public int Index { get; set; } public bool Enabled { get; set; } public string Status { get; set; } public double Temperature { get; set; } public int FanSpeed { get; set; } public int FanPercent { get; set; } public int GpuClock { get; set; } public int MemoryClock { get; set; } public double GpuVoltage { get; set; } public int GpuActivity { get; set; } public int PowerTune { get; set; } public double AverageHashrate { get; set; } public double CurrentHashrate { get; set; } public int AcceptedShares { get; set; } public int RejectedShares { get; set; } public int HardwareErrors { get; set; } public double Utility { get; set; } public string Intensity { get; set; } //string, might be D public int PoolIndex { get; set; } } }
namespace MultiMiner.Xgminer.Api { public class DeviceInformation { public string Kind { get; set; } public int Index { get; set; } public bool Enabled { get; set; } public string Status { get; set; } public double Temperature { get; set; } public int FanSpeed { get; set; } public int FanPercent { get; set; } public int GpuClock { get; set; } public int MemoryClock { get; set; } public double GpuVoltage { get; set; } public int GpuActivity { get; set; } public int PowerTune { get; set; } public double AverageHashrate { get; set; } public double CurrentHashrate { get; set; } public int AcceptedShares { get; set; } public int RejectedShares { get; set; } public int HardwareErrors { get; set; } public double Utility { get; set; } public string Intensity { get; set; } //string, might be D public int PoolIndex { get; set; } } }
mit
C#
ff56e07be0903a0c8de3cd845d600b587a48225c
Support non-seekable stream for embeddedresources
SiliconStudio/Mono.Cecil,furesoft/cecil,saynomoo/cecil,gluck/cecil,jbevain/cecil,fnajera-rac-de/cecil,sailro/cecil,kzu/cecil,xen2/cecil,cgourlay/cecil,ttRevan/cecil,joj/cecil,mono/cecil
Mono.Cecil/EmbeddedResource.cs
Mono.Cecil/EmbeddedResource.cs
// // EmbeddedResource.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; namespace Mono.Cecil { public sealed class EmbeddedResource : Resource { readonly MetadataReader reader; uint? offset; byte [] data; Stream stream; public override ResourceType ResourceType { get { return ResourceType.Embedded; } } public EmbeddedResource (string name, ManifestResourceAttributes attributes, byte [] data) : base (name, attributes) { this.data = data; } public EmbeddedResource (string name, ManifestResourceAttributes attributes, Stream stream) : base (name, attributes) { this.stream = stream; } internal EmbeddedResource (string name, ManifestResourceAttributes attributes, uint offset, MetadataReader reader) : base (name, attributes) { this.offset = offset; this.reader = reader; } public Stream GetResourceStream () { if (stream != null) return stream; if (data != null) return new MemoryStream (data); if (offset.HasValue) return reader.GetManagedResourceStream (offset.Value); throw new InvalidOperationException (); } public byte [] GetResourceData () { if (stream != null) return ReadStream (stream); if (data != null) return data; if (offset.HasValue) return reader.GetManagedResourceStream (offset.Value).ToArray (); throw new InvalidOperationException (); } static byte [] ReadStream (Stream stream) { int read; if (stream.CanSeek) { var length = (int) stream.Length; var data = new byte [length]; int offset = 0; while ((read = stream.Read (data, offset, length - offset)) > 0) offset += read; return data; } var buffer = new byte [1024 * 8]; var memory = new MemoryStream (); while ((read = stream.Read (buffer, 0, buffer.Length)) > 0) memory.Write (buffer, 0, read); return memory.ToArray (); } } }
// // EmbeddedResource.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; namespace Mono.Cecil { public sealed class EmbeddedResource : Resource { readonly MetadataReader reader; uint? offset; byte [] data; Stream stream; public override ResourceType ResourceType { get { return ResourceType.Embedded; } } public EmbeddedResource (string name, ManifestResourceAttributes attributes, byte [] data) : base (name, attributes) { this.data = data; } public EmbeddedResource (string name, ManifestResourceAttributes attributes, Stream stream) : base (name, attributes) { this.stream = stream; } internal EmbeddedResource (string name, ManifestResourceAttributes attributes, uint offset, MetadataReader reader) : base (name, attributes) { this.offset = offset; this.reader = reader; } public Stream GetResourceStream () { if (stream != null) return stream; if (data != null) return new MemoryStream (data); if (offset.HasValue) return reader.GetManagedResourceStream (offset.Value); throw new InvalidOperationException (); } public byte [] GetResourceData () { if (stream != null) return ReadStream (stream); if (data != null) return data; if (offset.HasValue) return reader.GetManagedResourceStream (offset.Value).ToArray (); throw new InvalidOperationException (); } static byte [] ReadStream (Stream stream) { var length = (int) stream.Length; var data = new byte [length]; int offset = 0, read; while ((read = stream.Read (data, offset, length - offset)) > 0) offset += read; return data; } } }
mit
C#
9febec9a332f878833ea1757a4a55e1feb878be9
Use thread safe way of creating the inner parameter of a method return type.
jbevain/cecil,gluck/cecil,saynomoo/cecil,cgourlay/cecil,joj/cecil,mono/cecil,ttRevan/cecil,kzu/cecil,SiliconStudio/Mono.Cecil,sailro/cecil,furesoft/cecil,fnajera-rac-de/cecil,xen2/cecil
Mono.Cecil/MethodReturnType.cs
Mono.Cecil/MethodReturnType.cs
// // MethodReturnType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System.Threading; using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class MethodReturnType : IConstantProvider, ICustomAttributeProvider, IMarshalInfoProvider { internal IMethodSignature method; internal ParameterDefinition parameter; TypeReference return_type; public IMethodSignature Method { get { return method; } } public TypeReference ReturnType { get { return return_type; } set { return_type = value; } } internal ParameterDefinition Parameter { get { if (parameter == null) Interlocked.CompareExchange (ref parameter, new ParameterDefinition (return_type, method), null); return parameter; } } public MetadataToken MetadataToken { get { return Parameter.MetadataToken; } set { Parameter.MetadataToken = value; } } public ParameterAttributes Attributes { get { return Parameter.Attributes; } set { Parameter.Attributes = value; } } public bool HasCustomAttributes { get { return parameter != null && parameter.HasCustomAttributes; } } public Collection<CustomAttribute> CustomAttributes { get { return Parameter.CustomAttributes; } } public bool HasDefault { get { return parameter != null && parameter.HasDefault; } set { Parameter.HasDefault = value; } } public bool HasConstant { get { return parameter != null && parameter.HasConstant; } set { Parameter.HasConstant = value; } } public object Constant { get { return Parameter.Constant; } set { Parameter.Constant = value; } } public bool HasFieldMarshal { get { return parameter != null && parameter.HasFieldMarshal; } set { Parameter.HasFieldMarshal = value; } } public bool HasMarshalInfo { get { return parameter != null && parameter.HasMarshalInfo; } } public MarshalInfo MarshalInfo { get { return Parameter.MarshalInfo; } set { Parameter.MarshalInfo = value; } } public MethodReturnType (IMethodSignature method) { this.method = method; } } }
// // MethodReturnType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class MethodReturnType : IConstantProvider, ICustomAttributeProvider, IMarshalInfoProvider { internal IMethodSignature method; internal ParameterDefinition parameter; TypeReference return_type; public IMethodSignature Method { get { return method; } } public TypeReference ReturnType { get { return return_type; } set { return_type = value; } } internal ParameterDefinition Parameter { get { return parameter ?? (parameter = new ParameterDefinition (return_type, method)); } } public MetadataToken MetadataToken { get { return Parameter.MetadataToken; } set { Parameter.MetadataToken = value; } } public ParameterAttributes Attributes { get { return Parameter.Attributes; } set { Parameter.Attributes = value; } } public bool HasCustomAttributes { get { return parameter != null && parameter.HasCustomAttributes; } } public Collection<CustomAttribute> CustomAttributes { get { return Parameter.CustomAttributes; } } public bool HasDefault { get { return parameter != null && parameter.HasDefault; } set { Parameter.HasDefault = value; } } public bool HasConstant { get { return parameter != null && parameter.HasConstant; } set { Parameter.HasConstant = value; } } public object Constant { get { return Parameter.Constant; } set { Parameter.Constant = value; } } public bool HasFieldMarshal { get { return parameter != null && parameter.HasFieldMarshal; } set { Parameter.HasFieldMarshal = value; } } public bool HasMarshalInfo { get { return parameter != null && parameter.HasMarshalInfo; } } public MarshalInfo MarshalInfo { get { return Parameter.MarshalInfo; } set { Parameter.MarshalInfo = value; } } public MethodReturnType (IMethodSignature method) { this.method = method; } } }
mit
C#
ec2b801bbbd72cd801e8a09cb376355aa5734699
Simplify sums
martincostello/project-euler
src/ProjectEuler/Puzzles/Puzzle006.cs
src/ProjectEuler/Puzzles/Puzzle006.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; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=6</c>. This class cannot be inherited. /// </summary> public sealed class Puzzle006 : Puzzle { /// <inheritdoc /> public override string Question => "What is the difference between the sum of the squares of the specified number of natural numbers and the square of their sum?"; /// <inheritdoc /> protected override int MinimumArguments => 1; /// <inheritdoc /> protected override int SolveCore(string[] args) { if (!TryParseInt32(args[0], out int numbers) || numbers < 1) { Console.WriteLine("The specified number is invalid."); return -1; } double sumOfRange = 0; double sumOfSquares = 0; for (int i = 0; i < numbers; i++) { int value = i + 1; sumOfRange += value; sumOfSquares += Math.Pow(value, 2); } double squareOfSum = Math.Pow(sumOfRange, 2); Answer = (int)(squareOfSum - sumOfSquares); 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=6</c>. This class cannot be inherited. /// </summary> public sealed class Puzzle006 : Puzzle { /// <inheritdoc /> public override string Question => "What is the difference between the sum of the squares of the specified number of natural numbers and the square of their sum?"; /// <inheritdoc /> protected override int MinimumArguments => 1; /// <inheritdoc /> protected override int SolveCore(string[] args) { if (!TryParseInt32(args[0], out int numbers) || numbers < 1) { Console.WriteLine("The specified number is invalid."); return -1; } var range = Enumerable.Range(1, numbers); double sumOfSquares = range .Select((p) => Math.Pow(p, 2)) .Sum(); double squareOfSum = Math.Pow(range.Sum(), 2); Answer = (int)(squareOfSum - sumOfSquares); return 0; } } }
apache-2.0
C#
84454b01cd8d310599a03f7ea0b40f9d58ed669e
Test cases with different delimiters
StormPooper/CSharpKatas
StringCalcKata.Tests/StringCalcKataTests.cs
StringCalcKata.Tests/StringCalcKataTests.cs
using NUnit.Framework; namespace StringCalcKata.Tests { [TestFixture] public class StringCalcKataTests { public StringCalculator Calculator; [TestFixtureSetUp] public void CreateCalculator() { Calculator = new StringCalculator(); } [TestCase("", 0)] [TestCase("1,1", 2)] [TestCase("2,2", 4)] [TestCase("4,8", 12)] [TestCase("172,28", 200)] public void CalculateTwoNumberSum(string sum, int expected) { var result = Calculator.Add(sum); Assert.AreEqual(expected, result); } [TestCase("2,2,2", 6)] [TestCase("8,16,32", 56)] [TestCase("8,16,32,64,128", 248)] public void CalculateAnyNumberSum(string sum, int expected) { var result = Calculator.Add(sum); Assert.AreEqual(expected, result); } [TestCase("2\n2,2", 6)] [TestCase("8,16\n32", 56)] [TestCase("8,16\n32,64\n128", 248)] public void CalculateAnyNumberSumWithNewLine(string sum, int expected) { var result = Calculator.Add(sum); Assert.AreEqual(expected, result); } [TestCase("//;\n2;2;2", 6)] [TestCase("// \n8 16 32", 56)] [TestCase("//+\n8+16+32+64+128", 248)] public void CalculateAnyNumberSumWithDelimiterDefined(string sum, int expected) { var result = Calculator.Add(sum); Assert.AreEqual(expected, result); } } }
using NUnit.Framework; namespace StringCalcKata.Tests { [TestFixture] public class StringCalcKataTests { public StringCalculator Calculator; [TestFixtureSetUp] public void CreateCalculator() { Calculator = new StringCalculator(); } [TestCase("", 0)] [TestCase("1,1", 2)] [TestCase("2,2", 4)] [TestCase("4,8", 12)] [TestCase("172,28", 200)] public void CalculateTwoNumberSum(string sum, int expected) { var result = Calculator.Add(sum); Assert.AreEqual(expected, result); } [TestCase("2,2,2", 6)] [TestCase("8,16,32", 56)] [TestCase("8,16,32,64,128", 248)] public void CalculateAnyNumberSum(string sum, int expected) { var result = Calculator.Add(sum); Assert.AreEqual(expected, result); } [TestCase("2\n2,2", 6)] [TestCase("8,16\n32", 56)] [TestCase("8,16\n32,64\n128", 248)] public void CalculateAnyNumberSumWithNewLine(string sum, int expected) { var result = Calculator.Add(sum); Assert.AreEqual(expected, result); } [Test] public void CalculateAnyNumberSumWithDelimiterDefined() { var result = Calculator.Add("//;\n1;2"); Assert.AreEqual(3, result); } } }
unlicense
C#
26d35eaa44ead123790b8cd42ee3d9bae56509a9
Update AssemblyInfo.cs
robbihun/NStatsD.Client
NStatsD/Properties/AssemblyInfo.cs
NStatsD/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("NStatsD.Client")] [assembly: AssemblyDescription("A .NET 4.0 client for Etsy's StatsD server.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rob Bihun")] [assembly: AssemblyProduct("NStatsD.Client")] [assembly: AssemblyCopyright("Copyright © Rob Bihun 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("d89b14ce-141c-4d50-9886-a422e52d117c")] // 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.3.0.0")] [assembly: AssemblyFileVersion("1.3.0.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("NStatsD.Client")] [assembly: AssemblyDescription("A .NET 4.0 client for Etsy's StatsD server.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rob Bihun")] [assembly: AssemblyProduct("NStatsD.Client")] [assembly: AssemblyCopyright("Copyright © Rob Bihun 2012")] [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("d89b14ce-141c-4d50-9886-a422e52d117c")] // 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.2.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")]
mit
C#
aeb5cab84dcd1666f6df34a3d3fb752dffb51613
Update the copyright year.
PintaProject/Pinta,PintaProject/Pinta,PintaProject/Pinta
Pinta/Dialogs/AboutPintaTabPage.cs
Pinta/Dialogs/AboutPintaTabPage.cs
// AboutPintaTabPage.cs // // Author: // Viktoria Dudka (viktoriad@remobjects.com) // // Copyright (c) 2009 RemObjects Software // // 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 Gtk; using Pinta.Core; namespace Pinta { internal class AboutPintaTabPage : VBox { public AboutPintaTabPage () { Label label = new Label (); label.Markup = String.Format ( "<b>{0}</b>\n {1}", Translations.GetString ("Version"), PintaCore.ApplicationVersion); HBox hBoxVersion = new HBox (); hBoxVersion.PackStart (label, false, false, 5); this.PackStart (hBoxVersion, false, true, 5); label = new Label (); label.Markup = string.Format ("<b>{0}</b>\n {1}", Translations.GetString ("License"), Translations.GetString ("Released under the MIT X11 License.")); HBox hBoxLicense = new HBox (); hBoxLicense.PackStart (label, false, false, 5); this.PackStart (hBoxLicense, false, true, 5); label = new Label (); label.Markup = string.Format ("<b>{0}</b>\n (c) 2010-2021 {1}", Translations.GetString ("Copyright"), Translations.GetString ("by Pinta contributors")); HBox hBoxCopyright = new HBox (); hBoxCopyright.PackStart (label, false, false, 5); this.PackStart (hBoxCopyright, false, true, 5); this.ShowAll (); } } }
// AboutPintaTabPage.cs // // Author: // Viktoria Dudka (viktoriad@remobjects.com) // // Copyright (c) 2009 RemObjects Software // // 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 Gtk; using Pinta.Core; namespace Pinta { internal class AboutPintaTabPage : VBox { public AboutPintaTabPage () { Label label = new Label (); label.Markup = String.Format ( "<b>{0}</b>\n {1}", Translations.GetString ("Version"), PintaCore.ApplicationVersion); HBox hBoxVersion = new HBox (); hBoxVersion.PackStart (label, false, false, 5); this.PackStart (hBoxVersion, false, true, 5); label = new Label (); label.Markup = string.Format ("<b>{0}</b>\n {1}", Translations.GetString ("License"), Translations.GetString ("Released under the MIT X11 License.")); HBox hBoxLicense = new HBox (); hBoxLicense.PackStart (label, false, false, 5); this.PackStart (hBoxLicense, false, true, 5); label = new Label (); label.Markup = string.Format ("<b>{0}</b>\n (c) 2010-2020 {1}", Translations.GetString ("Copyright"), Translations.GetString ("by Pinta contributors")); HBox hBoxCopyright = new HBox (); hBoxCopyright.PackStart (label, false, false, 5); this.PackStart (hBoxCopyright, false, true, 5); this.ShowAll (); } } }
mit
C#
cca10abf5fb02ab3e556ef6a5ad5ac0924a6325f
Fix broken test case
m-ender/retina,mbuettner/retina,m-ender/retina
Retina/RetinaTest/SortStageTest.cs
Retina/RetinaTest/SortStageTest.cs
using System; using System.Text.RegularExpressions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Retina; using Retina.Stages; namespace RetinaTest { [TestClass] public class SortStageTest { [TestMethod] public void TestBasicSorting() { AssertSort(".+", "$&", "", "ABC\nAB\nab\nabc\nxyz\nXYZ", "AB\nABC\nXYZ\nab\nabc\nxyz"); AssertSort(".", "$&", "", "pHSyRi|.A7", ".7AHRSipy|"); } [TestMethod] public void TestReverseSorting() { AssertSort(".+", "$&", "^", "ABC\nAB\nab\nabc\nxyz\nXYZ", "xyz\nabc\nab\nXYZ\nABC\nAB"); AssertSort(".", "$&", "^", "gHVs5#p.U#", "spgVUH5.##"); } [TestMethod] public void TestNumericalSorting() { AssertSort(".+", "$&", "#", "15ABC\nA1B16\nab0\n-a2bc\n-1xyz\nX-24YZ", "X-24YZ\n-1xyz\nab0\nA1B16\n-a2bc\n15ABC"); AssertSort(".", "$&", "#", "06*/50,(3-", "0*/0,(-356"); } [TestMethod] public void TestSubstitution() { AssertSort(".+", "$.&", "$#", "ABC\nAB\nab\nabc\nxyz\nXYZ", "AB\nab\nABC\nabc\nxyz\nXYZ"); AssertSort(".(.)", "$1", "$", "J(EM-+Fq_wW,CVDF|%9Q", "|%J(-+W,DFEM9QCVFq_w"); } private void AssertSort(string regex, string replacement, string optionsString, string input, string expectedOutput) { // optionsString should only contain a subset of "#^ceimnrsx" var options = new Options(optionsString, Modes.Sort); options.Silent = true; var stage = new SortStage(options, regex, replacement); Assert.AreEqual(expectedOutput, stage.Execute(input).ToString()); } } }
using System; using System.Text.RegularExpressions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Retina; using Retina.Stages; namespace RetinaTest { [TestClass] public class SortStageTest { [TestMethod] public void TestBasicSorting() { AssertSort(".+", "$&", "", "ABC\nAB\nab\nabc\nxyz\nXYZ", "AB\nABC\nXYZ\nab\nabc\nxyz"); AssertSort(".", "$&", "", "pHSyRi|.A7", ".7AHRSipy|"); } [TestMethod] public void TestReverseSorting() { AssertSort(".+", "$&", "^", "ABC\nAB\nab\nabc\nxyz\nXYZ", "xyz\nabc\nab\nXYZ\nABC\nAB"); AssertSort(".", "$&", "^", "gHVs5#p.U#", "spgVUH5.##"); } [TestMethod] public void TestNumericalSorting() { AssertSort(".+", "$&", "#", "15ABC\nA1B16\nab0\n-a2bc\n-1xyz\nX-24YZ", "X-24YZ\n-1xyz\nab0\nA1B16\n-a2bc\n15ABC"); AssertSort(".", "$&", "#", "06*/50,(3-", "0*/0,(-356"); } [TestMethod] public void TestSubstitution() { AssertSort(".+", "$.&", "#", "ABC\nAB\nab\nabc\nxyz\nXYZ", "AB\nab\nABC\nabc\nxyz\nXYZ"); AssertSort(".(.)", "$1", "#", "J(EM-+Fq_wW,CVDF|%9Q", "|%J(-+W,DFEM9QCVFq_w"); } private void AssertSort(string regex, string replacement, string optionsString, string input, string expectedOutput) { // optionsString should only contain a subset of "#^ceimnrsx" var options = new Options(optionsString, Modes.Sort); options.Silent = true; var stage = new SortStage(options, regex, replacement); Assert.AreEqual(expectedOutput, stage.Execute(input).ToString()); } } }
mit
C#
311945545d9f7e4ebc7c093048f4598dfc3b3514
remove missing references from AetherPhasor
tainicom/Aether
Source/Core/Gluons/AetherPhasor.cs
Source/Core/Gluons/AetherPhasor.cs
#region License // Copyright 2015 Kastellanos Nikolaos // // 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 tainicom.Aether.Elementary.Gluon; using Microsoft.Xna.Framework; namespace tainicom.Aether.Core.Gluons { public class AetherPhasor : AetherTimer { public float A; public float Frequency; public float Period; public float Phase; // φ public float AngularFrequency; // ω (Angular frequency) public float Value { get {return A * (float)Math.Sin((double)(elapsedTime.TotalSeconds * AngularFrequency + Phase));} } public AetherPhasor(): base() { Reset(); } public static AetherPhasor CreateFromFreq(float frequency) { return CreateFromFreq(frequency, 1f, 0f); } public static AetherPhasor CreateFromFreq(float frequency, float A) { return CreateFromFreq(frequency, A, 0f); } public static AetherPhasor CreateFromFreq(float frequency, float A, float phase) { AetherPhasor _this = new AetherPhasor(); _this.A = A; _this.Frequency = frequency; _this.Phase = phase; _this.Period = 1 / frequency; _this.AngularFrequency = Aether.Maths.Tau.FULL * frequency; return _this; } public virtual void Reset() { elapsedTime = TimeSpan.Zero; } public override void Tick(GameTime gameTime) { base.Tick(gameTime); } } }
#region License // Copyright 2015 Kastellanos Nikolaos // // 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 tainicom.Aether.Elementary.Gluon; using Microsoft.Xna.Framework; using tainicom.Aether.Elementary.Radiums; namespace tainicom.Aether.Core.Gluons { public class AetherPhasor : AetherTimer { public float A; public float Frequency; public float Period; public float Phase; // φ public float AngularFrequency; // ω (Angular frequency) public float Value { get {return A * (float)Math.Sin((double)(elapsedTime.TotalSeconds * AngularFrequency + Phase));} } public IRadium<float> Output = EmptyRadium<float>.GetEmpty(); public AetherPhasor(): base() { Reset(); } public static AetherPhasor CreateFromFreq(float frequency) { return CreateFromFreq(frequency, 1f, 0f); } public static AetherPhasor CreateFromFreq(float frequency, float A) { return CreateFromFreq(frequency, A, 0f); } public static AetherPhasor CreateFromFreq(float frequency, float A, float phase) { AetherPhasor _this = new AetherPhasor(); _this.A = A; _this.Frequency = frequency; _this.Phase = phase; _this.Period = 1 / frequency; _this.AngularFrequency = Aether.Maths.Tau.FULL * frequency; return _this; } public virtual void Reset() { elapsedTime = TimeSpan.Zero; } public override void Tick(GameTime gameTime) { base.Tick(gameTime); Output.Value = this.Value; } } }
apache-2.0
C#
60687cc5dce057941bfdbc73c9b09adf5ea300bc
Add stealth sprite-swap logic
cooperra/ld34-beanstalkers-extreme
Assets/Scripts/Stealth/StealthPlayer.cs
Assets/Scripts/Stealth/StealthPlayer.cs
using UnityEngine; using System.Collections; public class StealthPlayer : MainBehaviour{ public float MovementSpeed = 1.0f; public bool Stealthed = false; private float _input = 0.0f; public Sprite StealthSprite; private Sprite _nonStealthedSprite; protected override void GameUpdate(){ _input = PlayerInput.Instance.UserInput; if(_input == 1){ transform.position = new Vector2(transform.position.x + (MovementSpeed * Time.deltaTime), transform.position.y); NoStealth(); } else if(_input == -1) YesStealth(); else NoStealth(); } private void NoStealth() { if (Stealthed) { Stealthed = false; // Unset stealth sprite if (StealthSprite != null) { GetComponent<SpriteRenderer>().sprite = _nonStealthedSprite; } } } private void YesStealth() { if (!Stealthed) { Stealthed = true; // Set stealth sprite if (StealthSprite != null) { _nonStealthedSprite = GetComponent<SpriteRenderer>().sprite; GetComponent<SpriteRenderer>().sprite = StealthSprite; } } } }
using UnityEngine; using System.Collections; public class StealthPlayer : MainBehaviour{ public float MovementSpeed = 1.0f; public bool Stealthed = false; private float _input = 0.0f; protected override void GameUpdate(){ _input = PlayerInput.Instance.UserInput; if(_input == 1){ transform.position = new Vector2(transform.position.x + (MovementSpeed * Time.deltaTime), transform.position.y); Stealthed = false; } else if(_input == -1) Stealthed = true; else Stealthed = false; } }
mit
C#
e19cbd78c5fcd503dc8c81eb09df2b11eeb4bbca
Remove overload by using default value
mmanela/diffplex,mmanela/diffplex,mmanela/diffplex,mmanela/diffplex
DiffPlex/DiffBuilder/Model/DiffPiece.cs
DiffPlex/DiffBuilder/Model/DiffPiece.cs
using System.Collections.Generic; namespace DiffPlex.DiffBuilder.Model { public enum ChangeType { Unchanged, Deleted, Inserted, Imaginary, Modified } public class DiffPiece { public ChangeType Type { get; set; } public int? Position { get; set; } public string Text { get; set; } public List<DiffPiece> SubPieces { get; set; } public DiffPiece(string text, ChangeType type, int? position = null) { Text = text; Position = position; Type = type; SubPieces = new List<DiffPiece>(); } public DiffPiece() : this(null, ChangeType.Imaginary) { } } }
using System.Collections.Generic; namespace DiffPlex.DiffBuilder.Model { public enum ChangeType { Unchanged, Deleted, Inserted, Imaginary, Modified } public class DiffPiece { public ChangeType Type { get; set; } public int? Position { get; set; } public string Text { get; set; } public List<DiffPiece> SubPieces { get; set; } public DiffPiece(string text, ChangeType type, int? position) { Text = text; Position = position; Type = type; SubPieces = new List<DiffPiece>(); } public DiffPiece(string text, ChangeType type) : this(text, type, null) { } public DiffPiece() : this(null, ChangeType.Imaginary) { } } }
apache-2.0
C#
bf102c5e40bebadc44fad1882c7ba248eed43fa8
Add new fields to the Creative model
alecgorge/adzerk-dot-net
StackExchange.Adzerk/Models/Creative.cs
StackExchange.Adzerk/Models/Creative.cs
namespace StackExchange.Adzerk.Models { public class Creative { public long Id { get; set; } public long AdvertiserId { get; set; } public long AdTypeId { get; set; } public string Title { get; set; } public string ImageName { get; set; } public string Url { get; set; } public string Body { get; set; } public string ScriptBody { get; set; } public string ImageLink { get; set; } public string Alt { get; set; } public bool IsSync { get; set; } public bool IsDeleted { get; set; } public bool IsHTMLJS { get; set; } public bool IsActive { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace StackExchange.Adzerk.Models { public class Creative { public long Id { get; set; } public long AdvertiserId { get; set; } public long AdTypeId { get; set; } public string Body { get; set; } public string Url { get; set; } public string Title { get; set; } public string Alt { get; set; } public bool IsSync { get; set; } public bool IsDeleted { get; set; } public bool IsActive { get; set; } public bool IsHTMLJS { get; set; } public string ScriptBody { get; set; } } }
mit
C#
b7107be2c62e39961e1018a256eb9fad9343385e
Allow OpenFileDialog to set filters.
TheBrainTech/xwt
Xwt.XamMac/Xwt.Mac/FileDialogBackend.cs
Xwt.XamMac/Xwt.Mac/FileDialogBackend.cs
// // FileDialogBackend.cs // // Author: // James Clancey <clancey@xamarin.com> // // Copyright (c) 2012 Xamarin Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; using System.Linq; #if MONOMAC using nint = System.Int32; using nfloat = System.Single; using MonoMac.Foundation; using MonoMac.AppKit; #else using Foundation; using AppKit; #endif namespace Xwt.Mac { public abstract class FileDialogBackend : NSOpenPanel, IFileDialogBackend { public FileDialogBackend () { } #region IFileDialogBackend implementation public void Initialize (System.Collections.Generic.IEnumerable<FileDialogFilter> filters, bool multiselect, string initialFileName) { this.AllowsMultipleSelection = multiselect; this.CanChooseFiles = true; this.CanChooseDirectories = false; if (!string.IsNullOrEmpty (initialFileName)) this.DirectoryUrl = new NSUrl (initialFileName,true); this.Prompt = "Select File" + (multiselect ? "s" : ""); } public bool Run (IWindowFrameBackend parent) { var returnValue = this.RunModal (); return returnValue == 1; } public void Cleanup () { } public string FileName { get { return this.Url == null ? string.Empty : Url.Path; } } public string[] FileNames { get { return this.Urls.Length == 0 ? new string[0] : this.Urls.Select (x=> x.Path).ToArray (); } } public string CurrentFolder { get { return DirectoryUrl.AbsoluteString; } set { this.DirectoryUrl = new NSUrl (value,true); } } public FileDialogFilter ActiveFilter { get { return null; } set { this.AllowedFileTypes = value.Patterns.ToArray(); } } #endregion #region IBackend implementation public void InitializeBackend (object frontend, ApplicationContext context) { } public void EnableEvent (object eventId) { } public void DisableEvent (object eventId) { } #endregion } }
// // FileDialogBackend.cs // // Author: // James Clancey <clancey@xamarin.com> // // Copyright (c) 2012 Xamarin Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; using System.Linq; #if MONOMAC using nint = System.Int32; using nfloat = System.Single; using MonoMac.Foundation; using MonoMac.AppKit; #else using Foundation; using AppKit; #endif namespace Xwt.Mac { public abstract class FileDialogBackend : NSOpenPanel, IFileDialogBackend { public FileDialogBackend () { } #region IFileDialogBackend implementation public void Initialize (System.Collections.Generic.IEnumerable<FileDialogFilter> filters, bool multiselect, string initialFileName) { this.AllowsMultipleSelection = multiselect; this.CanChooseFiles = true; this.CanChooseDirectories = false; if (!string.IsNullOrEmpty (initialFileName)) this.DirectoryUrl = new NSUrl (initialFileName,true); this.Prompt = "Select File" + (multiselect ? "s" : ""); } public bool Run (IWindowFrameBackend parent) { var returnValue = this.RunModal (); return returnValue == 1; } public void Cleanup () { } public string FileName { get { return this.Url == null ? string.Empty : Url.Path; } } public string[] FileNames { get { return this.Urls.Length == 0 ? new string[0] : this.Urls.Select (x=> x.Path).ToArray (); } } public string CurrentFolder { get { return DirectoryUrl.AbsoluteString; } set { this.DirectoryUrl = new NSUrl (value,true); } } public FileDialogFilter ActiveFilter { get { return null; } set { } } #endregion #region IBackend implementation public void InitializeBackend (object frontend, ApplicationContext context) { } public void EnableEvent (object eventId) { } public void DisableEvent (object eventId) { } #endregion } }
mit
C#
362a153c2a913be2d142a193d24b01f139c487ba
Update MyDataRepository.cs
CarmelSoftware/Data-Repository-with-Data-Caching-in-ASP.NET-MVC-4,kelong/Data-Repository-with-Data-Caching-in-ASP.NET-MVC-4
Models/MyDataRepository.cs
Models/MyDataRepository.cs
// TODO: fix this class : class name : "RepositoryCaching" using system; ////public class MyDataRepository { // TODO: check what happens when different users use Cache simultaneously public ObjectCache Cache { get { return MemoryCache.Default; } } public bool IsInMemory(string Key) { return Cache.Contains(Key); } public void Add(string Key, object Value, int Expiration) { Cache.Add(Key, Value, new CacheItemPolicy().AbsoluteExpiration = DateTime.Now + TimeSpan.FromMinutes(Expiration)); } public IQueryable<T> FetchData<T>(string Key) where T : class { return Cache[Key] as IQueryable<T>; } public void Remove(string Key) { Cache.Remove(Key); } } }
// TODO: fix this class : class name : "RepositoryCaching" using system; public class MyDataRepository { // TODO: check what happens when different users use Cache simultaneously public ObjectCache Cache { get { return MemoryCache.Default; } } public bool IsInMemory(string Key) { return Cache.Contains(Key); } public void Add(string Key, object Value, int Expiration) { Cache.Add(Key, Value, new CacheItemPolicy().AbsoluteExpiration = DateTime.Now + TimeSpan.FromMinutes(Expiration)); } public IQueryable<T> FetchData<T>(string Key) where T : class { return Cache[Key] as IQueryable<T>; } public void Remove(string Key) { Cache.Remove(Key); } } }
mit
C#
409dc425c038b992bd1d439bdacb08369a6a7fba
Scale bitmap from screen
sakapon/Samples-2017
DrawingSample/BitmapScaleConsole/Program.cs
DrawingSample/BitmapScaleConsole/Program.cs
using System; using System.Collections.Generic; using System.Drawing.Imaging; using System.Linq; namespace BitmapScaleConsole { class Program { static void Main(string[] args) { Console.WriteLine("Press [Enter] key to start."); Console.ReadLine(); var now = $"{DateTime.Now:yyyyMMdd-HHmmss}"; var fileName = $"{now}.png"; var fileName_scaled = $"{now}-Scaled.jpg"; using (var bitmap = BitmapHelper.GetScreenBitmap(200, 100, 1200, 800)) using (var scaled = BitmapHelper.ScaleImage(bitmap, 600, 400)) { bitmap.Save(fileName, ImageFormat.Png); scaled.Save(fileName_scaled, ImageFormat.Jpeg); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BitmapScaleConsole { class Program { static void Main(string[] args) { } } }
mit
C#
cb3c610dd6e2a7fddaf9b35e31e3d88c54cb071b
introduce path parameter from Get method
zhangyuan/UFO-API,zhangyuan/UFO-API,zhangyuan/UFO-API
test/ProductFacts.cs
test/ProductFacts.cs
using System.Linq; using System.Net; using System.Net.Http; using Newtonsoft.Json; using Xunit; namespace test { public class ProductFacts : TestBase { [Fact] public void ShouldReturnOk() { var httpResponseMessage = Server.CreateRequest("api/products").GetAsync().Result; Assert.Equal(HttpStatusCode.OK, httpResponseMessage.StatusCode); } [Fact] public void ShouldReturnAllProducts() { var httpResponseMessage = Get("api/products"); var products = Body(httpResponseMessage, new [] { new { Name = default(string) } }); Assert.Equal(1, products.Count()); Assert.Equal("Subway", products[0].Name); } private HttpResponseMessage Get(string path) { var httpResponseMessage = Server.CreateRequest(path).GetAsync().Result; return httpResponseMessage; } public T Body<T>(HttpResponseMessage httpResponseMessage, T anonymousTypeObject) { return JsonConvert.DeserializeAnonymousType(httpResponseMessage.Content.ReadAsStringAsync().Result, anonymousTypeObject); } } }
using System.Linq; using System.Net; using System.Net.Http; using Newtonsoft.Json; using Xunit; namespace test { public class ProductFacts : TestBase { [Fact] public void ShouldReturnOk() { var httpResponseMessage = Server.CreateRequest("api/products").GetAsync().Result; Assert.Equal(HttpStatusCode.OK, httpResponseMessage.StatusCode); } [Fact] public void ShouldReturnAllProducts() { var httpResponseMessage = Get(); var products = Body(httpResponseMessage, new [] { new { Name = default(string) } }); Assert.Equal(1, products.Count()); Assert.Equal("Subway", products[0].Name); } private HttpResponseMessage Get() { var httpResponseMessage = Server.CreateRequest("api/products").GetAsync().Result; return httpResponseMessage; } public T Body<T>(HttpResponseMessage httpResponseMessage, T anonymousTypeObject) { return JsonConvert.DeserializeAnonymousType(httpResponseMessage.Content.ReadAsStringAsync().Result, anonymousTypeObject); } } }
mit
C#
47d215668dc5786d6dad5a2c9576b3649ba50d2d
Bump version to 1.7.
V10lator/Ultimate-Cam
Properties/AssemblyInfo.cs
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("Ultimate Cam")] [assembly: AssemblyDescription("Enjoy your own park!")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Ultimate Cam")] [assembly: AssemblyCopyright("Copyright © 2015-2016 LuukHolleman & V10lator")] [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("b5631f1e-deaa-4194-b442-64dcf50d5724")] // 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.7.0.0")] [assembly: AssemblyFileVersion("1.7.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("Ultimate Cam")] [assembly: AssemblyDescription("Enjoy your own park!")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Ultimate Cam")] [assembly: AssemblyCopyright("Copyright © 2015-2016 LuukHolleman & V10lator")] [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("b5631f1e-deaa-4194-b442-64dcf50d5724")] // 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.6.0.0")] [assembly: AssemblyFileVersion("1.6.0.0")]
mit
C#
685cfca5646d8fb6dc3be2918f56e678d8135faf
Remove extra version attributes
matwilko/ILGenerator.Extensions
Properties/AssemblyInfo.cs
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("ILGenerator.Extensions")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ILGenerator.Extensions")] [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("b60c30d0-afa1-4759-bf67-7dc636b586ad")]
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("ILGenerator.Extensions")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ILGenerator.Extensions")] [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("b60c30d0-afa1-4759-bf67-7dc636b586ad")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
f6cc6634ec76298bf7d17036fe81a5c4da0f58df
Bump version
transistor1/SQLFormatterPlugin
Properties/AssemblyInfo.cs
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("SQLFormatterPlugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SQLFormatterPlugin")] [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("22247641-9910-4c24-9a9d-dd295a749d41")] // 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.9996.0")] [assembly: AssemblyFileVersion("1.0.9996.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("SQLFormatterPlugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SQLFormatterPlugin")] [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("22247641-9910-4c24-9a9d-dd295a749d41")] // 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.9995.0")] [assembly: AssemblyFileVersion("1.0.9995.0")]
bsd-3-clause
C#
371876947a83749d0feacb86eb1b809c277e3ce2
Bump version
transistor1/SQLFormatterPlugin
Properties/AssemblyInfo.cs
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("SQLFormatterPlugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SQLFormatterPlugin")] [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("22247641-9910-4c24-9a9d-dd295a749d41")] // 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.9995.0")] [assembly: AssemblyFileVersion("1.0.9995.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("SQLFormatterPlugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SQLFormatterPlugin")] [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("22247641-9910-4c24-9a9d-dd295a749d41")] // 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.9994.0")] [assembly: AssemblyFileVersion("1.0.9994.0")]
bsd-3-clause
C#
37dbfe9cad4bac269c8581a4b723ce6c13aa1ba1
Add MetadataDirective to CopyObjectRequest
carbon/Amazon
src/Amazon.S3/Actions/CopyObjectRequest.cs
src/Amazon.S3/Actions/CopyObjectRequest.cs
using System.Linq; using System.Net.Http; namespace Amazon.S3 { public sealed class CopyObjectRequest : S3Request { public CopyObjectRequest(string host, S3ObjectLocation source, S3ObjectLocation target) : base(HttpMethod.Put, host, target.BucketName, target.Key) { Headers.Add("x-amz-copy-source", $"/{source.BucketName}/{source.Key}"); CompletionOption = HttpCompletionOption.ResponseContentRead; } // If undefined, the default is COPY public MetadataDirectiveValue? MetadataDirective { get { if (this.Headers.TryGetValues("x-amz-metadata-directive", out var values)) { switch (values.FirstOrDefault()) { case "COPY": return MetadataDirectiveValue.Copy; case "REPLACE": return MetadataDirectiveValue.Replace; } } return null; } set { string val = null; switch (value) { case MetadataDirectiveValue.Copy: val = "COPY"; break; case MetadataDirectiveValue.Replace: val = "REPLACE"; break; } Set("x-amz-metadata-directive", val); } } private void Set(string name, string value) { if (value is null) { this.Headers.Remove(name); } this.Headers.TryAddWithoutValidation(name, value); } /* x-amz-metadata-directive: metadata_directive x-amz-copy-source-if-match: etag x-amz-copy-source-if-none-match: etag x-amz-copy-source-if-unmodified-since: time_stamp x-amz-copy-source-if-modified-since: time_stamp */ } public enum MetadataDirectiveValue { Copy = 1, Replace = 2 } }
using System.Net.Http; namespace Amazon.S3 { public sealed class CopyObjectRequest : S3Request { public CopyObjectRequest(string host, S3ObjectLocation source, S3ObjectLocation target) : base(HttpMethod.Put, host, target.BucketName, target.Key) { Headers.Add("x-amz-copy-source", $"/{source.BucketName}/{source.Key}"); CompletionOption = HttpCompletionOption.ResponseContentRead; } } }
mit
C#