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 |
---|---|---|---|---|---|---|---|---|
45fc6b37e4145ea3cec6767cd650d1d31156c2ba | Fix taking off mouse from the screen. Ignore exception. | cezarypiatek/MaintainableSelenium,cezarypiatek/MaintainableSelenium,cezarypiatek/MaintainableSelenium,cezarypiatek/Tellurium,cezarypiatek/Tellurium,cezarypiatek/Tellurium | Src/MaintainableSelenium/MaintainableSelenium.MvcPages/BrowserCamera/BrowserCamera.cs | Src/MaintainableSelenium/MaintainableSelenium.MvcPages/BrowserCamera/BrowserCamera.cs | using System;
using MaintainableSelenium.MvcPages.BrowserCamera.Lens;
using MaintainableSelenium.MvcPages.SeleniumUtils;
using MaintainableSelenium.MvcPages.Utils;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Remote;
namespace MaintainableSelenium.MvcPages.BrowserCamera
{
/// <summary>
/// Responsible for taking screenshots of the page
/// </summary>
public class BrowserCamera : IBrowserCamera
{
private readonly RemoteWebDriver driver;
private readonly IBrowserCameraLens lens;
public BrowserCamera(RemoteWebDriver driver, IBrowserCameraLens lens)
{
this.driver = driver;
this.lens = lens;
}
public byte[] TakeScreenshot()
{
try
{
driver.Blur();
var currentActiveElement = driver.GetActiveElement();
MoveMouseOffTheScreen();
var screenshot = this.lens.TakeScreenshot();
if (currentActiveElement.TagName != "body")
{
driver.HoverOn(currentActiveElement);
}
return screenshot;
}
catch (Exception ex)
{
Console.WriteLine(ex.GetFullExceptionMessage());
throw;
}
}
private void MoveMouseOffTheScreen()
{
try
{
var body = driver.FindElementByTagName("body");
var scrollY = driver.GetScrollY();
new Actions(driver).MoveToElement(body, 0, scrollY + 1).Perform();
}
catch {}
}
public static IBrowserCamera CreateNew(RemoteWebDriver driver, BrowserCameraConfig cameraConfig)
{
var lens = BrowserCameraLensFactory.Create(driver, cameraConfig.LensType);
return new BrowserCamera(driver, lens);
}
}
} | using System;
using MaintainableSelenium.MvcPages.BrowserCamera.Lens;
using MaintainableSelenium.MvcPages.SeleniumUtils;
using MaintainableSelenium.MvcPages.Utils;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Remote;
namespace MaintainableSelenium.MvcPages.BrowserCamera
{
/// <summary>
/// Responsible for taking screenshots of the page
/// </summary>
public class BrowserCamera : IBrowserCamera
{
private readonly RemoteWebDriver driver;
private readonly IBrowserCameraLens lens;
public BrowserCamera(RemoteWebDriver driver, IBrowserCameraLens lens)
{
this.driver = driver;
this.lens = lens;
}
public byte[] TakeScreenshot()
{
try
{
driver.Blur();
var currentActiveElement = driver.GetActiveElement();
MoveMouseOffTheScreen();
var screenshot = this.lens.TakeScreenshot();
if (currentActiveElement.TagName != "body")
{
driver.HoverOn(currentActiveElement);
}
return screenshot;
}
catch (Exception ex)
{
Console.WriteLine(ex.GetFullExceptionMessage());
throw;
}
}
private void MoveMouseOffTheScreen()
{
var body = driver.FindElementByTagName("body");
var scrollY = driver.GetScrollY();
new Actions(driver).MoveToElement(body, 0, scrollY).Perform();
}
public static IBrowserCamera CreateNew(RemoteWebDriver driver, BrowserCameraConfig cameraConfig)
{
var lens = BrowserCameraLensFactory.Create(driver, cameraConfig.LensType);
return new BrowserCamera(driver, lens);
}
}
} | mit | C# |
39435198250fddaee910d36bce187332a570cec9 | Update #283 - Provide better checks for ADO support methods | Glimpse/Glimpse,flcdrg/Glimpse,flcdrg/Glimpse,Glimpse/Glimpse,sorenhl/Glimpse,SusanaL/Glimpse,rho24/Glimpse,gabrielweyer/Glimpse,rho24/Glimpse,flcdrg/Glimpse,codevlabs/Glimpse,SusanaL/Glimpse,sorenhl/Glimpse,rho24/Glimpse,Glimpse/Glimpse,SusanaL/Glimpse,dudzon/Glimpse,elkingtonmcb/Glimpse,gabrielweyer/Glimpse,sorenhl/Glimpse,elkingtonmcb/Glimpse,gabrielweyer/Glimpse,paynecrl97/Glimpse,codevlabs/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,codevlabs/Glimpse,dudzon/Glimpse,paynecrl97/Glimpse,dudzon/Glimpse,paynecrl97/Glimpse,elkingtonmcb/Glimpse | source/Glimpse.Ado/AlternateType/Support.cs | source/Glimpse.Ado/AlternateType/Support.cs | using System;
using System.Data;
using System.Data.Common;
using System.Reflection;
namespace Glimpse.Ado.AlternateType
{
public static class Support
{
public static DbProviderFactory TryGetProviderFactory(this DbConnection connection)
{
// If we can pull it out quickly and easily
var profiledConnection = connection as GlimpseDbConnection;
if (profiledConnection != null)
{
return profiledConnection.InnerProviderFactory;
}
#if (NET45)
return DbProviderFactories.GetFactory(connection);
#else
return connection.GetType().GetProperty("ProviderFactory", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(connection, null) as DbProviderFactory;
#endif
}
public static DbProviderFactory TryGetProfiledProviderFactory(this DbConnection connection)
{
var factory = connection.TryGetProviderFactory();
if (factory != null)
{
if (!(factory is GlimpseDbProviderFactory))
{
factory = factory.WrapProviderFactory();
}
}
else
{
throw new NotSupportedException(string.Format(Resources.DbFactoryNotFoundInDbConnection, connection.GetType().FullName));
}
return factory;
}
public static DbProviderFactory WrapProviderFactory(this DbProviderFactory factory)
{
if (!(factory is GlimpseDbProviderFactory))
{
var factoryType = typeof(GlimpseDbProviderFactory<>).MakeGenericType(factory.GetType());
return (DbProviderFactory)factoryType.GetField("Instance").GetValue(null);
}
return factory;
}
public static DataTable FindDbProviderFactoryTable()
{
var dbProviderFactories = typeof(DbProviderFactories);
var providerField = dbProviderFactories.GetField("_configTable", BindingFlags.NonPublic | BindingFlags.Static) ?? dbProviderFactories.GetField("_providerTable", BindingFlags.NonPublic | BindingFlags.Static);
var registrations = providerField.GetValue(null);
return registrations is DataSet ? ((DataSet)registrations).Tables["DbProviderFactories"] : (DataTable)registrations;
}
}
}
| using System.Data.Common;
using System.Reflection;
namespace Glimpse.Ado.AlternateType
{
public static class Support
{
public static DbProviderFactory TryGetProviderFactory(this DbConnection connection)
{
// If we can pull it out quickly and easily
var profiledConnection = connection as GlimpseDbConnection;
if (profiledConnection != null)
{
return profiledConnection.InnerProviderFactory;
}
#if (NET45)
return DbProviderFactories.GetFactory(connection);
#else
return connection.GetType().GetProperty("ProviderFactory", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(connection, null) as DbProviderFactory;
#endif
}
public static DbProviderFactory TryGetProfiledProviderFactory(this DbConnection connection)
{
var factory = connection.TryGetProviderFactory();
if (factory != null && !(factory is GlimpseDbProviderFactory))
{
var factoryType = typeof(GlimpseDbProviderFactory<>).MakeGenericType(factory.GetType());
factory = (DbProviderFactory)factoryType.GetField("Instance").GetValue(null);
}
return factory;
}
}
}
| apache-2.0 | C# |
64c46e8699d848db3c9192e2afe0b5df6332e2c0 | Fix typo: disabled features | xkproject/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,xkproject/Orchard2,petedavis/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2 | src/OrchardCore.Modules/OrchardCore.Features/Views/Items/AllFeaturesDeploymentStep.Fields.Edit.cshtml | src/OrchardCore.Modules/OrchardCore.Features/Views/Items/AllFeaturesDeploymentStep.Fields.Edit.cshtml | @model AllFeaturesDeploymentStepViewModel
<h5>@T["All Features"]</h5>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" asp-for="IgnoreDisabledFeatures" />
<label class="custom-control-label" asp-for="IgnoreDisabledFeatures">@T["Ignore disabled features"]</label>
<span class="hint">@T["Check if the disabled features have to be ignored."]</span>
</div>
</div>
| @model AllFeaturesDeploymentStepViewModel
<h5>@T["All Features"]</h5>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" asp-for="IgnoreDisabledFeatures" />
<label class="custom-control-label" asp-for="IgnoreDisabledFeatures">@T["Ignore disabled features"]</label>
<span class="hint">@T["Check if the disable features have to be ignored."]</span>
</div>
</div>
| bsd-3-clause | C# |
2fe6f28206b946caead0b6586d1a4bc6efb87e84 | Bump to version 0.1.3 | Kryptos-FR/markdig.wpf,Kryptos-FR/markdig-wpf | src/Markdig.Xaml/Properties/AssemblyInfo.cs | src/Markdig.Xaml/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Markdig.Xaml")]
[assembly: AssemblyDescription("a XAML port to CommonMark compliant Markdig.")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Markdig.Xaml")]
[assembly: AssemblyCopyright("Copyright © Nicolas Musset 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion(Markdig.Xaml.Markdown.Version)]
[assembly: AssemblyFileVersion(Markdig.Xaml.Markdown.Version)]
namespace Markdig.Xaml
{
public static partial class Markdown
{
public const string Version = "0.1.3";
}
}
| using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Markdig.Xaml")]
[assembly: AssemblyDescription("a XAML port to CommonMark compliant Markdig.")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Markdig.Xaml")]
[assembly: AssemblyCopyright("Copyright © Nicolas Musset 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion(Markdig.Xaml.Markdown.Version)]
[assembly: AssemblyFileVersion(Markdig.Xaml.Markdown.Version)]
namespace Markdig.Xaml
{
public static partial class Markdown
{
public const string Version = "0.1.2";
}
}
| mit | C# |
72e6672fef16c22ec298ec34386e0ada4dab55a3 | Fix de compilación | TheXDS/MCART | src/Platform/WPF/Component/WpfWindowWrap.cs | src/Platform/WPF/Component/WpfWindowWrap.cs | /*
WpfWindowWrap.cs
This file is part of Morgan's CLR Advanced Runtime (MCART)
Author(s):
César Andrés Morgan <[email protected]>
Copyright © 2011 - 2021 César Andrés Morgan
Morgan's CLR Advanced Runtime (MCART) is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
Morgan's CLR Advanced Runtime (MCART) is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Windows;
namespace TheXDS.MCART.Wpf.Component
{
internal class WpfWindowWrap : IWpfWindow
{
private readonly Window _window;
public WpfWindowWrap(Window window)
{
_window = window;
}
public WindowState WindowState => _window.WindowState;
Window IWpfWindow.Itself => _window;
}
} | /*
WpfWindowWrap.cs
This file is part of Morgan's CLR Advanced Runtime (MCART)
Author(s):
César Andrés Morgan <[email protected]>
Copyright © 2011 - 2021 César Andrés Morgan
Morgan's CLR Advanced Runtime (MCART) is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
Morgan's CLR Advanced Runtime (MCART) is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Windows;
namespace TheXDS.MCART.Wpf.Component
{
internal class WpfWindowWrap : IWpfWindow
{
private readonly Window _window;
public WpfWindowWrap(Window window)
{
_window = window;
}
Window IWpfWindow.Itself => _window;
}
} | mit | C# |
a9ab9f614751fd822e0c32814802117d400fe905 | Fix MySql do not support Milliseconds | spaccabit/fluentmigrator,spaccabit/fluentmigrator | src/FluentMigrator.Runner/Generators/MySql/MySqlQuoter.cs | src/FluentMigrator.Runner/Generators/MySql/MySqlQuoter.cs | using FluentMigrator.Runner.Generators.Generic;
namespace FluentMigrator.Runner.Generators.MySql
{
public class MySqlQuoter : GenericQuoter
{
public override string OpenQuote { get { return "`"; } }
public override string CloseQuote { get { return "`"; } }
public override string QuoteValue(object value)
{
return base.QuoteValue(value).Replace(@"\", @"\\");
}
public override string FromTimeSpan(System.TimeSpan value)
{
return System.String.Format("{0}{1:00}:{2:00}:{3:00}{0}"
, ValueQuote
, value.Hours + (value.Days * 24)
, value.Minutes
, value.Seconds);
}
}
}
| using FluentMigrator.Runner.Generators.Generic;
namespace FluentMigrator.Runner.Generators.MySql
{
public class MySqlQuoter : GenericQuoter
{
public override string OpenQuote { get { return "`"; } }
public override string CloseQuote { get { return "`"; } }
public override string QuoteValue(object value)
{
return base.QuoteValue(value).Replace(@"\", @"\\");
}
public override string FromTimeSpan(System.TimeSpan value)
{
return System.String.Format("{0}{1}:{2}:{3}.{4}{0}"
, ValueQuote
, value.Hours + (value.Days * 24)
, value.Minutes
, value.Seconds
, value.Milliseconds);
}
}
}
| apache-2.0 | C# |
510c197724d7a2792f6f0c523dae1f1dd7eea5f6 | Refactor tag summary creation | bradygaster/downr,bradygaster/downr,spboyer/downr,bradygaster/downr,spboyer/downr | src/ViewComponents/TagCloudViewComponent.cs | src/ViewComponents/TagCloudViewComponent.cs | using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using downr.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using downr.Models.TagCloud;
namespace downr.ViewComponents
{
public class TagCloudViewComponent : ViewComponent
{
protected IYamlIndexer _indexer;
public TagCloudViewComponent(IYamlIndexer indexer)
{
_indexer = indexer;
}
public async Task<IViewComponentResult> InvokeAsync()
{
var tags = _indexer.Metadata
.SelectMany(p => p.Categories) // flatten post categories
.GroupBy(c => c)
.Select(g => new Tag { Name = g.Key, Count = g.Count() })
.OrderBy(t=>t.Name)
.ToArray();
var model = new TagCloudModel
{
Tags = tags
};
return View(model);
}
}
} | using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using downr.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using downr.Models.TagCloud;
namespace downr.ViewComponents
{
public class TagCloudViewComponent : ViewComponent
{
protected IYamlIndexer _indexer;
public TagCloudViewComponent(IYamlIndexer indexer)
{
_indexer = indexer;
}
public async Task<IViewComponentResult> InvokeAsync()
{
// get all the categories
var tagCloud = new Dictionary<string, int>();
_indexer.Metadata.Select(x => x.Categories).ToList().ForEach(categories =>
{
categories?.ToList().ForEach(category =>
{
if (!tagCloud.ContainsKey(category))
tagCloud.Add(category, 0);
tagCloud[category] += 1;
});
});
var model = new TagCloudModel{
Tags = tagCloud.OrderBy(x => x.Key)
.Select(x=> new Tag{ Name = x.Key, Count = x.Value })
.ToArray()
};
return View(model);
}
}
} | apache-2.0 | C# |
ec9e5d518909ee60ce39462cc2808eabc2a15341 | Add SetLastError=true to Interop.inotiry DllImports so we can capture native method errors | shmao/corefx,jhendrixMSFT/corefx,stormleoxia/corefx,nelsonsar/corefx,alphonsekurian/corefx,shmao/corefx,SGuyGe/corefx,rjxby/corefx,kyulee1/corefx,uhaciogullari/corefx,ViktorHofer/corefx,huanjie/corefx,pallavit/corefx,dtrebbien/corefx,mazong1123/corefx,rjxby/corefx,JosephTremoulet/corefx,chaitrakeshav/corefx,lggomez/corefx,kkurni/corefx,cnbin/corefx,alexperovich/corefx,josguil/corefx,dotnet-bot/corefx,Priya91/corefx-1,ravimeda/corefx,stephenmichaelf/corefx,twsouthwick/corefx,vs-team/corefx,shimingsg/corefx,uhaciogullari/corefx,YoupHulsebos/corefx,scott156/corefx,claudelee/corefx,krk/corefx,seanshpark/corefx,seanshpark/corefx,chaitrakeshav/corefx,iamjasonp/corefx,Petermarcu/corefx,Winsto/corefx,alexperovich/corefx,twsouthwick/corefx,shrutigarg/corefx,gkhanna79/corefx,tijoytom/corefx,spoiledsport/corefx,dsplaisted/corefx,billwert/corefx,seanshpark/corefx,nchikanov/corefx,alexandrnikitin/corefx,gabrielPeart/corefx,marksmeltzer/corefx,CherryCxldn/corefx,zmaruo/corefx,larsbj1988/corefx,jlin177/corefx,krk/corefx,oceanho/corefx,alexperovich/corefx,yizhang82/corefx,Chrisboh/corefx,JosephTremoulet/corefx,Jiayili1/corefx,ptoonen/corefx,MaggieTsang/corefx,stormleoxia/corefx,claudelee/corefx,tstringer/corefx,alphonsekurian/corefx,axelheer/corefx,krk/corefx,krytarowski/corefx,DnlHarvey/corefx,vidhya-bv/corefx-sorting,alphonsekurian/corefx,dkorolev/corefx,akivafr123/corefx,ericstj/corefx,DnlHarvey/corefx,benpye/corefx,Jiayili1/corefx,tijoytom/corefx,bpschoch/corefx,nelsonsar/corefx,Yanjing123/corefx,ellismg/corefx,Alcaro/corefx,vrassouli/corefx,xuweixuwei/corefx,elijah6/corefx,the-dwyer/corefx,iamjasonp/corefx,JosephTremoulet/corefx,dhoehna/corefx,janhenke/corefx,billwert/corefx,MaggieTsang/corefx,zhangwenquan/corefx,iamjasonp/corefx,marksmeltzer/corefx,tijoytom/corefx,weltkante/corefx,cnbin/corefx,YoupHulsebos/corefx,brett25/corefx,dtrebbien/corefx,shimingsg/corefx,alphonsekurian/corefx,PatrickMcDonald/corefx,gkhanna79/corefx,jlin177/corefx,rjxby/corefx,vijaykota/corefx,bitcrazed/corefx,mafiya69/corefx,n1ghtmare/corefx,destinyclown/corefx,mazong1123/corefx,weltkante/corefx,kyulee1/corefx,Petermarcu/corefx,CherryCxldn/corefx,richlander/corefx,tstringer/corefx,shmao/corefx,ravimeda/corefx,KrisLee/corefx,destinyclown/corefx,the-dwyer/corefx,yizhang82/corefx,stone-li/corefx,ravimeda/corefx,VPashkov/corefx,mmitche/corefx,richlander/corefx,elijah6/corefx,axelheer/corefx,xuweixuwei/corefx,spoiledsport/corefx,gregg-miskelly/corefx,larsbj1988/corefx,jlin177/corefx,zmaruo/corefx,fernando-rodriguez/corefx,manu-silicon/corefx,oceanho/corefx,dhoehna/corefx,stone-li/corefx,kyulee1/corefx,stephenmichaelf/corefx,dhoehna/corefx,khdang/corefx,DnlHarvey/corefx,mmitche/corefx,tstringer/corefx,stone-li/corefx,ViktorHofer/corefx,bitcrazed/corefx,dtrebbien/corefx,krk/corefx,rjxby/corefx,chenkennt/corefx,krytarowski/corefx,dsplaisted/corefx,rajansingh10/corefx,Jiayili1/corefx,cydhaselton/corefx,Yanjing123/corefx,cartermp/corefx,vs-team/corefx,690486439/corefx,CloudLens/corefx,MaggieTsang/corefx,PatrickMcDonald/corefx,jcme/corefx,lydonchandra/corefx,janhenke/corefx,Alcaro/corefx,ptoonen/corefx,BrennanConroy/corefx,jcme/corefx,zmaruo/corefx,akivafr123/corefx,mokchhya/corefx,popolan1986/corefx,jcme/corefx,fgreinacher/corefx,axelheer/corefx,shmao/corefx,rahku/corefx,khdang/corefx,pgavlin/corefx,shrutigarg/corefx,Winsto/corefx,marksmeltzer/corefx,rahku/corefx,YoupHulsebos/corefx,shimingsg/corefx,huanjie/corefx,jhendrixMSFT/corefx,fffej/corefx,manu-silicon/corefx,weltkante/corefx,viniciustaveira/corefx,ericstj/corefx,ravimeda/corefx,gregg-miskelly/corefx,akivafr123/corefx,rjxby/corefx,wtgodbe/corefx,jhendrixMSFT/corefx,EverlessDrop41/corefx,shana/corefx,wtgodbe/corefx,Chrisboh/corefx,fgreinacher/corefx,jlin177/corefx,krytarowski/corefx,jhendrixMSFT/corefx,nbarbettini/corefx,erpframework/corefx,claudelee/corefx,chenxizhang/corefx,benpye/corefx,shana/corefx,shmao/corefx,lggomez/corefx,oceanho/corefx,jmhardison/corefx,stone-li/corefx,marksmeltzer/corefx,benpye/corefx,jmhardison/corefx,the-dwyer/corefx,viniciustaveira/corefx,rajansingh10/corefx,690486439/corefx,vidhya-bv/corefx-sorting,chenxizhang/corefx,stone-li/corefx,YoupHulsebos/corefx,xuweixuwei/corefx,vrassouli/corefx,rahku/corefx,ericstj/corefx,jhendrixMSFT/corefx,comdiv/corefx,jlin177/corefx,huanjie/corefx,jlin177/corefx,marksmeltzer/corefx,twsouthwick/corefx,dsplaisted/corefx,Petermarcu/corefx,tstringer/corefx,Chrisboh/corefx,nbarbettini/corefx,jeremymeng/corefx,misterzik/corefx,zhangwenquan/corefx,lggomez/corefx,zhenlan/corefx,parjong/corefx,Jiayili1/corefx,mellinoe/corefx,benjamin-bader/corefx,ellismg/corefx,vidhya-bv/corefx-sorting,zhenlan/corefx,DnlHarvey/corefx,Priya91/corefx-1,SGuyGe/corefx,EverlessDrop41/corefx,benpye/corefx,ericstj/corefx,mellinoe/corefx,viniciustaveira/corefx,comdiv/corefx,ericstj/corefx,shahid-pk/corefx,arronei/corefx,tijoytom/corefx,weltkante/corefx,n1ghtmare/corefx,erpframework/corefx,mokchhya/corefx,mafiya69/corefx,EverlessDrop41/corefx,ViktorHofer/corefx,DnlHarvey/corefx,zmaruo/corefx,ellismg/corefx,gabrielPeart/corefx,shiftkey-tester/corefx,PatrickMcDonald/corefx,pallavit/corefx,alexandrnikitin/corefx,bpschoch/corefx,Ermiar/corefx,fffej/corefx,rahku/corefx,tijoytom/corefx,the-dwyer/corefx,pgavlin/corefx,mazong1123/corefx,heXelium/corefx,mmitche/corefx,shahid-pk/corefx,alexandrnikitin/corefx,ellismg/corefx,Winsto/corefx,vidhya-bv/corefx-sorting,shmao/corefx,Ermiar/corefx,nelsonsar/corefx,MaggieTsang/corefx,jhendrixMSFT/corefx,zhenlan/corefx,dtrebbien/corefx,matthubin/corefx,rjxby/corefx,Yanjing123/corefx,benjamin-bader/corefx,anjumrizwi/corefx,gkhanna79/corefx,ptoonen/corefx,nchikanov/corefx,manu-silicon/corefx,twsouthwick/corefx,jhendrixMSFT/corefx,tijoytom/corefx,Frank125/corefx,axelheer/corefx,stephenmichaelf/corefx,Petermarcu/corefx,Ermiar/corefx,zhangwenquan/corefx,n1ghtmare/corefx,alexperovich/corefx,BrennanConroy/corefx,stephenmichaelf/corefx,alexperovich/corefx,nchikanov/corefx,mazong1123/corefx,janhenke/corefx,popolan1986/corefx,brett25/corefx,fernando-rodriguez/corefx,dhoehna/corefx,JosephTremoulet/corefx,pallavit/corefx,jeremymeng/corefx,josguil/corefx,nbarbettini/corefx,akivafr123/corefx,nchikanov/corefx,gabrielPeart/corefx,bitcrazed/corefx,fernando-rodriguez/corefx,YoupHulsebos/corefx,erpframework/corefx,jcme/corefx,krk/corefx,ViktorHofer/corefx,shiftkey-tester/corefx,YoupHulsebos/corefx,stephenmichaelf/corefx,mazong1123/corefx,PatrickMcDonald/corefx,shana/corefx,jeremymeng/corefx,weltkante/corefx,shahid-pk/corefx,SGuyGe/corefx,lggomez/corefx,chaitrakeshav/corefx,uhaciogullari/corefx,shmao/corefx,adamralph/corefx,mmitche/corefx,destinyclown/corefx,larsbj1988/corefx,seanshpark/corefx,n1ghtmare/corefx,dotnet-bot/corefx,elijah6/corefx,benpye/corefx,ptoonen/corefx,mokchhya/corefx,scott156/corefx,Chrisboh/corefx,MaggieTsang/corefx,fffej/corefx,seanshpark/corefx,dhoehna/corefx,vijaykota/corefx,wtgodbe/corefx,parjong/corefx,KrisLee/corefx,yizhang82/corefx,heXelium/corefx,shahid-pk/corefx,stephenmichaelf/corefx,n1ghtmare/corefx,richlander/corefx,YoupHulsebos/corefx,DnlHarvey/corefx,ravimeda/corefx,billwert/corefx,josguil/corefx,seanshpark/corefx,kkurni/corefx,nchikanov/corefx,popolan1986/corefx,PatrickMcDonald/corefx,BrennanConroy/corefx,mafiya69/corefx,stormleoxia/corefx,alexandrnikitin/corefx,ptoonen/corefx,dotnet-bot/corefx,KrisLee/corefx,manu-silicon/corefx,krytarowski/corefx,billwert/corefx,cydhaselton/corefx,stone-li/corefx,CloudLens/corefx,yizhang82/corefx,andyhebear/corefx,ericstj/corefx,bpschoch/corefx,Petermarcu/corefx,khdang/corefx,Yanjing123/corefx,vrassouli/corefx,Ermiar/corefx,yizhang82/corefx,janhenke/corefx,CloudLens/corefx,Petermarcu/corefx,shahid-pk/corefx,mmitche/corefx,stephenmichaelf/corefx,iamjasonp/corefx,cartermp/corefx,janhenke/corefx,CherryCxldn/corefx,viniciustaveira/corefx,kkurni/corefx,Petermarcu/corefx,s0ne0me/corefx,shimingsg/corefx,cartermp/corefx,scott156/corefx,dotnet-bot/corefx,richlander/corefx,MaggieTsang/corefx,benjamin-bader/corefx,kkurni/corefx,mellinoe/corefx,elijah6/corefx,iamjasonp/corefx,matthubin/corefx,parjong/corefx,jmhardison/corefx,axelheer/corefx,richlander/corefx,khdang/corefx,misterzik/corefx,mmitche/corefx,lydonchandra/corefx,ptoonen/corefx,SGuyGe/corefx,shana/corefx,pallavit/corefx,cydhaselton/corefx,the-dwyer/corefx,adamralph/corefx,mazong1123/corefx,krytarowski/corefx,elijah6/corefx,fffej/corefx,thiagodin/corefx,Yanjing123/corefx,s0ne0me/corefx,thiagodin/corefx,jeremymeng/corefx,richlander/corefx,iamjasonp/corefx,s0ne0me/corefx,jeremymeng/corefx,cydhaselton/corefx,kkurni/corefx,jcme/corefx,benpye/corefx,mellinoe/corefx,Priya91/corefx-1,mmitche/corefx,twsouthwick/corefx,heXelium/corefx,Jiayili1/corefx,chenkennt/corefx,Frank125/corefx,rajansingh10/corefx,spoiledsport/corefx,Alcaro/corefx,Frank125/corefx,VPashkov/corefx,josguil/corefx,billwert/corefx,jcme/corefx,richlander/corefx,mellinoe/corefx,matthubin/corefx,wtgodbe/corefx,rubo/corefx,brett25/corefx,janhenke/corefx,marksmeltzer/corefx,mafiya69/corefx,twsouthwick/corefx,chenxizhang/corefx,mafiya69/corefx,oceanho/corefx,krytarowski/corefx,dotnet-bot/corefx,lggomez/corefx,parjong/corefx,Jiayili1/corefx,vijaykota/corefx,mokchhya/corefx,bitcrazed/corefx,kyulee1/corefx,alphonsekurian/corefx,parjong/corefx,adamralph/corefx,zhenlan/corefx,fgreinacher/corefx,benjamin-bader/corefx,cnbin/corefx,lydonchandra/corefx,vidhya-bv/corefx-sorting,Ermiar/corefx,alexperovich/corefx,gkhanna79/corefx,ravimeda/corefx,erpframework/corefx,anjumrizwi/corefx,mafiya69/corefx,the-dwyer/corefx,Priya91/corefx-1,dhoehna/corefx,dotnet-bot/corefx,Chrisboh/corefx,DnlHarvey/corefx,seanshpark/corefx,bpschoch/corefx,anjumrizwi/corefx,JosephTremoulet/corefx,CherryCxldn/corefx,690486439/corefx,lggomez/corefx,uhaciogullari/corefx,rahku/corefx,cydhaselton/corefx,shahid-pk/corefx,claudelee/corefx,jlin177/corefx,comdiv/corefx,pallavit/corefx,nbarbettini/corefx,andyhebear/corefx,khdang/corefx,fgreinacher/corefx,marksmeltzer/corefx,iamjasonp/corefx,rajansingh10/corefx,VPashkov/corefx,690486439/corefx,rubo/corefx,nbarbettini/corefx,tijoytom/corefx,the-dwyer/corefx,JosephTremoulet/corefx,benjamin-bader/corefx,SGuyGe/corefx,nbarbettini/corefx,ellismg/corefx,alexperovich/corefx,alphonsekurian/corefx,dkorolev/corefx,zhenlan/corefx,dkorolev/corefx,manu-silicon/corefx,shimingsg/corefx,pgavlin/corefx,shimingsg/corefx,shimingsg/corefx,MaggieTsang/corefx,alexandrnikitin/corefx,zhenlan/corefx,tstringer/corefx,cydhaselton/corefx,rjxby/corefx,s0ne0me/corefx,billwert/corefx,Ermiar/corefx,thiagodin/corefx,ericstj/corefx,manu-silicon/corefx,axelheer/corefx,andyhebear/corefx,Frank125/corefx,vs-team/corefx,thiagodin/corefx,gkhanna79/corefx,larsbj1988/corefx,dotnet-bot/corefx,brett25/corefx,Priya91/corefx-1,rubo/corefx,krk/corefx,shiftkey-tester/corefx,elijah6/corefx,kkurni/corefx,gabrielPeart/corefx,parjong/corefx,matthubin/corefx,misterzik/corefx,cartermp/corefx,CloudLens/corefx,krytarowski/corefx,wtgodbe/corefx,zhangwenquan/corefx,nbarbettini/corefx,ptoonen/corefx,ellismg/corefx,elijah6/corefx,chaitrakeshav/corefx,cydhaselton/corefx,heXelium/corefx,alphonsekurian/corefx,wtgodbe/corefx,ravimeda/corefx,stormleoxia/corefx,rahku/corefx,benjamin-bader/corefx,SGuyGe/corefx,khdang/corefx,ViktorHofer/corefx,dhoehna/corefx,wtgodbe/corefx,rahku/corefx,cnbin/corefx,gregg-miskelly/corefx,zhenlan/corefx,cartermp/corefx,pgavlin/corefx,shrutigarg/corefx,yizhang82/corefx,twsouthwick/corefx,mazong1123/corefx,rubo/corefx,cartermp/corefx,mokchhya/corefx,Chrisboh/corefx,nchikanov/corefx,lggomez/corefx,690486439/corefx,Jiayili1/corefx,arronei/corefx,gregg-miskelly/corefx,mokchhya/corefx,ViktorHofer/corefx,Ermiar/corefx,yizhang82/corefx,bitcrazed/corefx,dkorolev/corefx,scott156/corefx,billwert/corefx,gkhanna79/corefx,pallavit/corefx,JosephTremoulet/corefx,tstringer/corefx,huanjie/corefx,mellinoe/corefx,rubo/corefx,nelsonsar/corefx,chenkennt/corefx,shiftkey-tester/corefx,KrisLee/corefx,Priya91/corefx-1,comdiv/corefx,akivafr123/corefx,ViktorHofer/corefx,vs-team/corefx,gkhanna79/corefx,stone-li/corefx,lydonchandra/corefx,anjumrizwi/corefx,weltkante/corefx,manu-silicon/corefx,arronei/corefx,nchikanov/corefx,krk/corefx,VPashkov/corefx,josguil/corefx,Alcaro/corefx,andyhebear/corefx,weltkante/corefx,jmhardison/corefx,josguil/corefx,parjong/corefx,vrassouli/corefx,shrutigarg/corefx | src/Common/src/Interop/Linux/libc/Interop.inotify.cs | src/Common/src/Interop/Linux/libc/Interop.inotify.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
internal static partial class Interop
{
internal static partial class libc
{
[DllImport(Libraries.Libc, SetLastError = true)]
internal static extern int inotify_init();
[DllImport(Libraries.Libc, SetLastError = true)]
internal static extern int inotify_add_watch(int fd, string pathname, uint mask);
[DllImport(Libraries.Libc, SetLastError = true)]
internal static extern int inotify_rm_watch(int fd, int wd);
[Flags]
internal enum NotifyEvents
{
IN_ACCESS = 0x00000001,
IN_MODIFY = 0x00000002,
IN_ATTRIB = 0x00000004,
IN_MOVED_FROM = 0x00000040,
IN_MOVED_TO = 0x00000080,
IN_CREATE = 0x00000100,
IN_DELETE = 0x00000200,
IN_UNMOUNT = 0x00002000,
IN_Q_OVERFLOW = 0x00004000,
IN_IGNORED = 0x00008000,
IN_ONLYDIR = 0x01000000,
IN_EXCL_UNLINK = 0x04000000,
IN_ISDIR = 0x40000000,
}
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
internal static partial class Interop
{
internal static partial class libc
{
[DllImport(Libraries.Libc)]
internal static extern int inotify_init();
[DllImport(Libraries.Libc)]
internal static extern int inotify_add_watch(int fd, string pathname, uint mask);
[DllImport(Libraries.Libc)]
internal static extern int inotify_rm_watch(int fd, int wd);
[Flags]
internal enum NotifyEvents
{
IN_ACCESS = 0x00000001,
IN_MODIFY = 0x00000002,
IN_ATTRIB = 0x00000004,
IN_MOVED_FROM = 0x00000040,
IN_MOVED_TO = 0x00000080,
IN_CREATE = 0x00000100,
IN_DELETE = 0x00000200,
IN_UNMOUNT = 0x00002000,
IN_Q_OVERFLOW = 0x00004000,
IN_IGNORED = 0x00008000,
IN_ONLYDIR = 0x01000000,
IN_EXCL_UNLINK = 0x04000000,
IN_ISDIR = 0x40000000,
}
}
}
| mit | C# |
04ac4b7ebb0ab2881a1b8f21bfdab45137465ea6 | add Enum Error codes for chat in dll | 23S163PR/network-programming | Novak.Andriy/network_progekts/ServerJsonObject/ChatObject.cs | Novak.Andriy/network_progekts/ServerJsonObject/ChatObject.cs | using System;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
namespace ChatJsonObject
{
[DataContract]
public class ChatObject
{
[DataMember]
public string Login { get; set; }
[DataMember]
public string Avatar { get; set; }
[DataMember]
public ChatCodes Code { get; set; }
[DataMember]
public string Message { get; set; }
public ChatObject()
{
}
public ChatObject(string login, string avatar, ChatCodes code, string message)
{
Login = login;
Avatar = Avatar;
Code = code;
Message = message;
}
}
public enum ChatCodes
{
Conected = 1
,CloseConection = 404
,StopServer = 405
}
public static class JsonSerializer
{
//two object for minimalize conflicts
private static readonly JavaScriptSerializer _serializer = new JavaScriptSerializer();
private static readonly JavaScriptSerializer _deserializer = new JavaScriptSerializer();
public static string ObjectToJson(this ChatObject obj)
{
return _serializer.Serialize(obj);
}
public static ChatObject JsonToObject(this string json)
{
try
{
return _deserializer.Deserialize<ChatObject>(json);
}
catch (ArgumentNullException e)
{
return null;
}
}
}
}
| using System.Runtime.Serialization;
using System.Web.Script.Serialization;
namespace ServerJsonObject
{
[DataContract]
public class ChatObject
{
[DataMember]
public string Login { get; set; }
[DataMember]
public string Avatar { get; set; }
[DataMember]
public int Code { get; set; }
[DataMember]
public string Message { get; set; }
public ChatObject()
{
}
public ChatObject(string login, string avatar, int code, string message)
{
Login = login;
Avatar = Avatar;
Code = code;
Message = message;
}
}
public static class JsonSerializer
{
//two object for minimalize conflicts
private static readonly JavaScriptSerializer _serializer = new JavaScriptSerializer();
private static readonly JavaScriptSerializer _deserializer = new JavaScriptSerializer();
public static string ObjectToJson(this ChatObject obj)
{
return _serializer.Serialize(obj);
}
public static ChatObject JsonToObject(this string json)
{
return _deserializer.Deserialize<ChatObject>(json);
}
}
}
| cc0-1.0 | C# |
b07c477aad08a9c284c6e5a3a01e561fd4506021 | Add test case on TestSceneNowPlayingOverlay | peppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,johnneijzen/osu,NeoAdonis/osu,smoogipoo/osu,2yangk23/osu,2yangk23/osu,EVAST9919/osu,ppy/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu,EVAST9919/osu,ppy/osu,NeoAdonis/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu-new | osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs | osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public class TestSceneNowPlayingOverlay : OsuTestScene
{
[Cached]
private MusicController musicController = new MusicController();
private WorkingBeatmap currentTrack;
public TestSceneNowPlayingOverlay()
{
Clock = new FramedClock();
var np = new NowPlayingOverlay
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre
};
Add(musicController);
Add(np);
AddStep(@"show", () => np.Show());
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
AddStep(@"hide", () => np.Hide());
}
[Test]
public void TestPrevTrackBehavior()
{
AddStep(@"Play track", () =>
{
musicController.NextTrack();
currentTrack = Beatmap.Value;
});
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack());
AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value);
AddStep(@"Seek track to 1 second", () => musicController.SeekTo(1000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack());
AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value);
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public class TestSceneNowPlayingOverlay : OsuTestScene
{
[Cached]
private MusicController musicController = new MusicController();
public TestSceneNowPlayingOverlay()
{
Clock = new FramedClock();
var np = new NowPlayingOverlay
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre
};
Add(musicController);
Add(np);
AddStep(@"show", () => np.Show());
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
AddStep(@"show", () => np.Hide());
}
}
}
| mit | C# |
e031c9c0ac4c3b8be615cc8f32313af562340f62 | Revert MandrillSerializer as only formatting changes were made | feinoujc/Mandrill.net | src/Mandrill.net/Serialization/MandrillSerializer.cs | src/Mandrill.net/Serialization/MandrillSerializer.cs | using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
namespace Mandrill.Serialization
{
public static class MandrillSerializer
{
private static readonly Lazy<JsonSerializer> LazyJsonSerializer = new Lazy<JsonSerializer>(CreateSerializer);
public static JsonSerializer Instance => LazyJsonSerializer.Value;
private static JsonSerializer CreateSerializer()
{
var settings = new JsonSerializerSettings { ContractResolver = new MandrillJsonContractResolver() };
settings.Converters.Add(new UnixDateTimeConverter());
settings.Converters.Add(new StringEnumConverter { NamingStrategy = new SnakeCaseNamingStrategy(), AllowIntegerValues = false });
settings.NullValueHandling = NullValueHandling.Ignore;
settings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
return JsonSerializer.Create(settings);
}
}
public static class MandrillSerializer<T>
{
public static T Deserialize(JsonReader reader)
{
return MandrillSerializer.Instance.Deserialize<T>(reader);
}
public static void Serialize(JsonWriter writer, T value)
{
MandrillSerializer.Instance.Serialize(writer, value);
}
}
}
| using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
namespace Mandrill.Serialization
{
public static class MandrillSerializer
{
private static readonly Lazy<JsonSerializer> LazyJsonSerializer = new Lazy<JsonSerializer>(CreateSerializer);
public static JsonSerializer Instance => LazyJsonSerializer.Value;
private static JsonSerializer CreateSerializer()
{
var settings = new JsonSerializerSettings
{
ContractResolver = new MandrillJsonContractResolver()
};
settings.Converters.Add(new UnixDateTimeConverter());
settings.Converters.Add(new StringEnumConverter { NamingStrategy = new SnakeCaseNamingStrategy(), AllowIntegerValues = false });
settings.NullValueHandling = NullValueHandling.Ignore;
settings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
return JsonSerializer.Create(settings);
}
}
public static class MandrillSerializer<T>
{
public static T Deserialize(JsonReader reader)
{
return MandrillSerializer.Instance.Deserialize<T>(reader);
}
public static void Serialize(JsonWriter writer, T value)
{
MandrillSerializer.Instance.Serialize(writer, value);
}
}
}
| mit | C# |
d94e39c558517c715b1eaa21f58ab45138e7f1de | Test available (NH-1812 was fixed) | RogerKratz/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,nhibernate/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,hazzik/nhibernate-core,ngbrown/nhibernate-core,gliljas/nhibernate-core,ngbrown/nhibernate-core,alobakov/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,livioc/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,fredericDelaporte/nhibernate-core,nkreipke/nhibernate-core,fredericDelaporte/nhibernate-core,livioc/nhibernate-core,alobakov/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,RogerKratz/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nkreipke/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core | src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs | src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs | using System;
using System.Collections.Generic;
using NUnit.Framework;
namespace NHibernate.Test.NHSpecificTest.NH1812
{
public class AstBugBase : BugTestCase
{
[Test]
public void Test()
{
var p = new Person();
const string query =
@"select p from Person p
left outer join p.PeriodCollection p1
where p1.Start > coalesce((select max(p2.Start) from Period p2), :nullStart)";
using (ISession s = OpenSession())
{
using (ITransaction tx = s.BeginTransaction())
{
s.Save(p);
tx.Commit();
}
s.CreateQuery(query)
.SetDateTime("nullStart", new DateTime(2001, 1, 1))
.List<Person>();
}
}
protected override void OnTearDown()
{
using (ISession s = OpenSession())
{
using (ITransaction tx = s.BeginTransaction())
{
s.Delete("from Person");
tx.Commit();
}
}
}
}
[TestFixture]
public class AstBug : AstBugBase
{
/* to the nh guy...
* sorry for not coming up with a more realistic use case
* We have a query that works fine with the old parser but not with the new AST parser
* I've broke our complex query down to this...
* I believe the problem is when mixing aggregate methods with isnull()
*/
}
[TestFixture]
public class ItWorksWithClassicParser : AstBugBase
{
protected override void Configure(Cfg.Configuration configuration)
{
configuration.AddProperties(new Dictionary<string, string>
{
{
Cfg.Environment.QueryTranslator,
typeof (NHibernate.Hql.Classic.ClassicQueryTranslatorFactory).FullName
}
}
);
}
}
} | using System;
using System.Collections.Generic;
using NUnit.Framework;
namespace NHibernate.Test.NHSpecificTest.NH1812
{
public class AstBugBase : BugTestCase
{
[Test]
public void Test()
{
var p = new Person();
const string query =
@"select p from Person p
left outer join p.PeriodCollection p1
where p1.Start > coalesce((select max(p2.Start) from Period p2), :nullStart)";
using (ISession s = OpenSession())
{
using (ITransaction tx = s.BeginTransaction())
{
s.Save(p);
tx.Commit();
}
s.CreateQuery(query)
.SetDateTime("nullStart", new DateTime(2001, 1, 1))
.List<Person>();
}
}
protected override void OnTearDown()
{
using (ISession s = OpenSession())
{
using (ITransaction tx = s.BeginTransaction())
{
s.Delete("from Person");
tx.Commit();
}
}
}
}
[TestFixture, Ignore("To fix for AST parser; there are problems with subquery in various places.")]
public class AstBug : AstBugBase
{
/* to the nh guy...
* sorry for not coming up with a more realistic use case
* We have a query that works fine with the old parser but not with the new AST parser
* I've broke our complex query down to this...
* I believe the problem is when mixing aggregate methods with isnull()
*/
}
[TestFixture]
public class ItWorksWithClassicParser : AstBugBase
{
protected override void Configure(Cfg.Configuration configuration)
{
configuration.AddProperties(new Dictionary<string, string>
{
{
Cfg.Environment.QueryTranslator,
typeof (NHibernate.Hql.Classic.ClassicQueryTranslatorFactory).FullName
}
}
);
}
}
} | lgpl-2.1 | C# |
c734c1f38bd0527de2d0d4cf02d2c231a74a8e19 | Create factory method for the Property object | AlexGhiondea/SmugMug.NET | src/SmugMugShared/Descriptors/Properties/Property.cs | src/SmugMugShared/Descriptors/Properties/Property.cs | // Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Newtonsoft.Json.Linq;
using SmugMug.Shared.Extensions;
using System.IO;
namespace SmugMug.Shared.Descriptors
{
public class Property
{
public string Name { get; set; }
public string Description { get; set; }
public string Deprecated { get; set; }
public Property(JObject obj)
{
Name = obj.GetValueAsString("Name");
Description = obj.GetValueAsString("Description");
Deprecated = obj.GetValueAsString("Deprecated");
}
public static Property FromJObject(JObject item)
{
string type = item.GetValueAsString("Type");
if (string.IsNullOrEmpty(type))
{
type = "varchar";
}
switch (type.ToLower())
{
case "select":
{
return new SelectProperty(item);
}
case "varchar":
case "text":
{
return new StringProperty(item);
}
case "uri":
{
return new UriProperty(item);
}
case "array":
{
return new ArrayProperty(item);
}
case "decimal":
{
return new DecimalProperty(item);
}
case "time":
case "date":
case "datetime":
{
return new DateTimeProperty(item);
}
case "unixtimestamp":
case "timestamp":
{
return new TimeStampProperty(item);
}
case "boolean":
{
return new BooleanProperty(item);
}
case "integer":
{
return new IntegerProperty(item);
}
case "hash":
{
return new HashProperty(item);
}
default:
throw new InvalidDataException("I cannot do it -- type unknown ->>> " + type);
}
}
public override string ToString()
{
return Name;
}
}
}
| // Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Newtonsoft.Json.Linq;
using SmugMug.Shared.Extensions;
namespace SmugMug.Shared.Descriptors
{
public class Property
{
public string Name { get; set; }
public string Description { get; set; }
public string Deprecated { get; set; }
public Property(JObject obj)
{
Name = obj.GetValueAsString("Name");
Description = obj.GetValueAsString("Description");
Deprecated = obj.GetValueAsString("Deprecated");
}
public override string ToString()
{
return Name;
}
}
}
| mit | C# |
d84f7e1329b41dbc7a870293c80796b8a7c6136f | Update ShapeStateTypeConverter.cs | Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Serializer.Xaml/Converters/ShapeStateTypeConverter.cs | src/Serializer.Xaml/Converters/ShapeStateTypeConverter.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Core2D.Shape;
using Portable.Xaml.ComponentModel;
using System;
using System.ComponentModel;
using System.Globalization;
namespace Serializer.Xaml.Converters
{
/// <summary>
/// Defines <see cref="ShapeState"/> type converter.
/// </summary>
internal class ShapeStateTypeConverter : TypeConverter
{
/// <inheritdoc/>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string);
}
/// <inheritdoc/>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(string);
}
/// <inheritdoc/>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
return ShapeState.Parse((string)value);
}
/// <inheritdoc/>
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
var state = value as ShapeState;
if (state != null)
{
return state.ToString();
}
throw new NotSupportedException();
}
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Core2D.Shape;
using Portable.Xaml.ComponentModel;
using System;
using System.Globalization;
namespace Serializer.Xaml.Converters
{
/// <summary>
/// Defines <see cref="ShapeState"/> type converter.
/// </summary>
internal class ShapeStateTypeConverter : TypeConverter
{
/// <inheritdoc/>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string);
}
/// <inheritdoc/>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(string);
}
/// <inheritdoc/>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
return ShapeState.Parse((string)value);
}
/// <inheritdoc/>
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
var state = value as ShapeState;
if (state != null)
{
return state.ToString();
}
throw new NotSupportedException();
}
}
}
| mit | C# |
f73933d619581666ca7309f285e0efcb6c98d637 | Fix for treating enum types as primitives due non-enumeration facets | avao/Codge | Src/Codge.Generator/Presentations/Xsd/XmlSchemaExtensions.cs | Src/Codge.Generator/Presentations/Xsd/XmlSchemaExtensions.cs | using System.Collections.Generic;
using System.Linq;
using System.Xml.Schema;
namespace Codge.Generator.Presentations.Xsd
{
public static class XmlSchemaExtensions
{
public static bool IsEmptyType(this XmlSchemaComplexType type)
{
return type.ContentModel == null && type.Attributes.Count == 0 && type.ContentType.ToString() == "Empty";
}
public static IEnumerable<XmlSchemaEnumerationFacet> GetEnumerationFacets(this XmlSchemaSimpleType simpleType)
{
if (simpleType.Content != null)
{
var restriction = simpleType.Content as XmlSchemaSimpleTypeRestriction;
if (restriction != null && restriction.Facets != null && restriction.Facets.Count > 0)
{
foreach (var facet in restriction.Facets)
{
var item = facet as XmlSchemaEnumerationFacet;
if (item != null)
yield return item;
}
}
}
yield break;
}
public static bool IsEnumeration(this XmlSchemaSimpleType simpleType)
{
return GetEnumerationFacets(simpleType).Any();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;
namespace Codge.Generator.Presentations.Xsd
{
public static class XmlSchemaExtensions
{
public static bool IsEmptyType(this XmlSchemaComplexType type)
{
return type.ContentModel == null && type.Attributes.Count == 0 && type.ContentType.ToString() == "Empty";
}
public static IEnumerable<XmlSchemaEnumerationFacet> GetEnumerationFacets(this XmlSchemaSimpleType simpleType)
{
if (simpleType.Content != null)
{
var restriction = simpleType.Content as XmlSchemaSimpleTypeRestriction;
if (restriction != null && restriction.Facets != null && restriction.Facets.Count > 0)
{
foreach (var facet in restriction.Facets)
{
var item = facet as XmlSchemaEnumerationFacet;
if (item == null)
yield break;
yield return item;
}
}
}
yield break;
}
public static bool IsEnumeration(this XmlSchemaSimpleType simpleType)
{
return GetEnumerationFacets(simpleType).Any();
}
}
}
| apache-2.0 | C# |
299aa6c0079b4ef4b5c7bbcc4dc27995aff6877d | Fix checkbox cell view issue | hamekoz/xwt,residuum/xwt,cra0zy/xwt,mminns/xwt,directhex/xwt,TheBrainTech/xwt,lytico/xwt,hwthomas/xwt,mono/xwt,iainx/xwt,steffenWi/xwt,sevoku/xwt,akrisiun/xwt,antmicro/xwt,mminns/xwt | Xwt.Gtk/Xwt.GtkBackend.CellViews/CustomCellRendererToggle.cs | Xwt.Gtk/Xwt.GtkBackend.CellViews/CustomCellRendererToggle.cs | //
// CustomCellRendererToggle.cs
//
// Author:
// Lluis Sanchez <[email protected]>
//
// Copyright (c) 2013 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Linq;
using Gtk;
using Xwt.Backends;
namespace Xwt.GtkBackend
{
public class CustomCellRendererToggle: CellViewBackend
{
Gtk.CellRendererToggle renderer;
public CustomCellRendererToggle ()
{
CellRenderer = renderer = new Gtk.CellRendererToggle ();
renderer.Toggled += HandleToggled;
}
protected override void OnLoadData ()
{
var view = (ICheckBoxCellViewFrontend) Frontend;
renderer.Inconsistent = view.State == CheckBoxState.Mixed;
renderer.Active = view.State == CheckBoxState.On;
renderer.Activatable = view.Editable;
renderer.Visible = view.Visible;
}
void HandleToggled (object o, ToggledArgs args)
{
SetCurrentEventRow ();
var view = (ICheckBoxCellViewFrontend) Frontend;
IDataField field = (IDataField) view.StateField ?? view.ActiveField;
if (!view.RaiseToggled () && (field != null)) {
Type type = field.FieldType;
Gtk.TreeIter iter;
if (TreeModel.GetIterFromString (out iter, args.Path)) {
CheckBoxState newState;
if (view.AllowMixed && type == typeof(CheckBoxState)) {
if (renderer.Inconsistent)
newState = CheckBoxState.Off;
else if (renderer.Active)
newState = CheckBoxState.Mixed;
else
newState = CheckBoxState.On;
} else {
if (renderer.Active)
newState = CheckBoxState.Off;
else
newState = CheckBoxState.On;
}
object newValue = type == typeof(CheckBoxState) ?
(object) newState : (object) (newState == CheckBoxState.On);
CellUtil.SetModelValue (TreeModel, iter, field.Index, type, newValue);
}
}
}
}
}
| //
// CustomCellRendererToggle.cs
//
// Author:
// Lluis Sanchez <[email protected]>
//
// Copyright (c) 2013 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Linq;
using Gtk;
using Xwt.Backends;
namespace Xwt.GtkBackend
{
public class CustomCellRendererToggle: CellViewBackend
{
Gtk.CellRendererToggle renderer;
public CustomCellRendererToggle ()
{
CellRenderer = renderer = new Gtk.CellRendererToggle ();
renderer.Toggled += HandleToggled;
}
protected virtual void OnLoad ()
{
var view = (ICheckBoxCellViewFrontend) Frontend;
renderer.Inconsistent = view.State == CheckBoxState.Mixed;
renderer.Active = view.State == CheckBoxState.On;
renderer.Activatable = view.Editable;
renderer.Visible = view.Visible;
}
void HandleToggled (object o, ToggledArgs args)
{
SetCurrentEventRow ();
var view = (ICheckBoxCellViewFrontend) Frontend;
IDataField field = (IDataField) view.StateField ?? view.ActiveField;
if (!view.RaiseToggled () && (field != null)) {
Type type = field.FieldType;
Gtk.TreeIter iter;
if (TreeModel.GetIterFromString (out iter, args.Path)) {
CheckBoxState newState;
if (view.AllowMixed && type == typeof(CheckBoxState)) {
if (renderer.Inconsistent)
newState = CheckBoxState.Off;
else if (renderer.Active)
newState = CheckBoxState.Mixed;
else
newState = CheckBoxState.On;
} else {
if (renderer.Active)
newState = CheckBoxState.Off;
else
newState = CheckBoxState.On;
}
object newValue = type == typeof(CheckBoxState) ?
(object) newState : (object) (newState == CheckBoxState.On);
CellUtil.SetModelValue (TreeModel, iter, field.Index, type, newValue);
}
}
}
}
}
| mit | C# |
a7f1af310810b29eec85357c9681e59b76197720 | Update docstring of Heatmap class | mg6/spectre,mg6/spectre,spectre-team/spectre,spectre-team/spectre,mg6/spectre,spectre-team/spectre | src/Spectre/Models/Msi/Heatmap.cs | src/Spectre/Models/Msi/Heatmap.cs | /*
* Heatmap.cs
* Class representing single heatmap in MALDI MSI sample.
*
Copyright 2017 Michał Gallus
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.Generic;
using System.Runtime.Serialization;
namespace Spectre.Models.Msi
{
/// <summary>
/// Provides details about a single heatmap in the dataset.
/// </summary>
[DataContract]
public class Heatmap
{
/// <summary>
/// Gets or sets the mz identifier of the spectrum.
/// </summary>
/// <value>
/// The identifier.
/// </value>
[DataMember]
public double Mz { get; set; }
/// <summary>
/// Gets or sets the intensities for all coordinates.
/// </summary>
/// <value>
/// The intensities.
/// </value>
[DataMember]
public IEnumerable<double> Intensities { get; set; }
/// <summary>
/// Gets or sets the x coordinates.
/// </summary>
/// <value>
/// The x.
/// </value>
[DataMember]
public IEnumerable<int> X { get; set; }
/// <summary>
/// Gets or sets the y coordinates.
/// </summary>
/// <value>
/// The y.
/// </value>
[DataMember]
public IEnumerable<int> Y { get; set; }
}
} | /*
* Heatmap.cs
* Class representing single heatmap in MALDI MSI sample.
*
Copyright 2017 Michał Gallus
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.Generic;
using System.Runtime.Serialization;
namespace Spectre.Models.Msi
{
[DataContract]
public class Heatmap
{
/// <summary>
/// Gets or sets the mz identifier of the spectrum.
/// </summary>
/// <value>
/// The identifier.
/// </value>
[DataMember]
public double Mz { get; set; }
/// <summary>
/// Gets or sets the intensities for all coordinates.
/// </summary>
/// <value>
/// The intensities.
/// </value>
[DataMember]
public IEnumerable<double> Intensities { get; set; }
/// <summary>
/// Gets or sets the x coordinates.
/// </summary>
/// <value>
/// The x.
/// </value>
[DataMember]
public IEnumerable<int> X { get; set; }
/// <summary>
/// Gets or sets the y coordinates.
/// </summary>
/// <value>
/// The y.
/// </value>
[DataMember]
public IEnumerable<int> Y { get; set; }
}
} | apache-2.0 | C# |
df4e38b5ed6c23aa99f9675809700b2e88823dbe | clean up usings | NickPolyder/FreeParkingSystem | src/Account/FreeParkingSystem.Accounts.Data/Mappers/UserMapper.cs | src/Account/FreeParkingSystem.Accounts.Data/Mappers/UserMapper.cs | using System.Collections.Generic;
using System.Linq;
using FreeParkingSystem.Accounts.Contract;
using FreeParkingSystem.Accounts.Data.Models;
using FreeParkingSystem.Common;
using FreeParkingSystem.Common.ExtensionMethods;
namespace FreeParkingSystem.Accounts.Data.Mappers
{
public class UserMapper : IMap<DbUser, User>
{
private readonly IMap<DbClaims, UserClaim> _claimsMapper;
public UserMapper(IMap<DbClaims, UserClaim> claimsMapper)
{
_claimsMapper = claimsMapper;
}
public User Map(DbUser input, IDictionary<object, object> context)
{
if (input == null)
return null;
return new User
{
Id = input.Id,
UserName = input.UserName,
Password = new Password(input.Password, input.SaltAsString(), true, true),
Claims = _claimsMapper.Map(input.Claims).ToList()
};
}
public DbUser Map(User input, IDictionary<object, object> context)
{
if (input == null)
return null;
return new DbUser
{
Id = input.Id,
UserName = input.UserName,
Password = input.Password.ToString(),
Salt = input.Password.SaltAsBytes(),
Claims = _claimsMapper.Map(input.Claims).ToList()
};
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using FreeParkingSystem.Accounts.Contract;
using FreeParkingSystem.Accounts.Data.Models;
using FreeParkingSystem.Common;
using FreeParkingSystem.Common.ExtensionMethods;
namespace FreeParkingSystem.Accounts.Data.Mappers
{
public class UserMapper : IMap<DbUser, User>
{
private readonly IMap<DbClaims, UserClaim> _claimsMapper;
public UserMapper(IMap<DbClaims, UserClaim> claimsMapper)
{
_claimsMapper = claimsMapper;
}
public User Map(DbUser input, IDictionary<object, object> context)
{
if (input == null)
return null;
return new User
{
Id = input.Id,
UserName = input.UserName,
Password = new Password(input.Password, input.SaltAsString(), true, true),
Claims = _claimsMapper.Map(input.Claims).ToList()
};
}
public DbUser Map(User input, IDictionary<object, object> context)
{
if (input == null)
return null;
return new DbUser
{
Id = input.Id,
UserName = input.UserName,
Password = input.Password.ToString(),
Salt = input.Password.SaltAsBytes(),
Claims = _claimsMapper.Map(input.Claims).ToList()
};
}
}
} | mit | C# |
0bf36e3e8bbc9998ccedcd547b4a1bb28592cdc0 | Fix SearchWithQueryExpansionTest | GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples | retail/interactive-tutorial/RetailSearch.Samples.Tests/SearchWithQueryExpansionTest.cs | retail/interactive-tutorial/RetailSearch.Samples.Tests/SearchWithQueryExpansionTest.cs | // Copyright 2021 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Linq;
using Xunit;
namespace RetailSearch.Samples.Tests
{
public class SearchWithQueryExpansionTest
{
[Fact]
public void TestSearchWithQueryExpansion()
{
const string ExpectedProductTitle = "Google Youth Hero Tee Grey";
var firstPage = SearchWithQueryExpansionTutorial.Search().First();
Assert.Contains(firstPage, result => result.Product.Title.Contains(ExpectedProductTitle));
Assert.Contains(firstPage, result => !result.Product.Title.Contains(ExpectedProductTitle));
}
}
}
| // Copyright 2021 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Linq;
using Xunit;
namespace RetailSearch.Samples.Tests
{
public class SearchWithQueryExpansionTest
{
[Fact]
public void TestSearchWithQueryExpansion()
{
const string ExpectedProductTitle = "Google Youth Hero Tee Grey";
var searchResultPages = SearchWithQueryExpansionTutorial.Search();
var topPages = searchResultPages.Take(2).ToList();
var firstPage = topPages[0];
var secondPage = topPages[1];
Assert.Contains(firstPage, result => result.Product.Title.Contains(ExpectedProductTitle));
Assert.Contains(secondPage, result => !result.Product.Title.Contains(ExpectedProductTitle));
}
}
} | apache-2.0 | C# |
ef7a53f792619be004da2498bc013c7d59f205d3 | Fix external logins partial for running in mono 3.2.x | cwensley/Pablo.Gallery,sixteencolors/Pablo.Gallery,sixteencolors/Pablo.Gallery,sixteencolors/Pablo.Gallery,sixteencolors/Pablo.Gallery,cwensley/Pablo.Gallery,cwensley/Pablo.Gallery | src/Pablo.Gallery/Views/Account/_ExternalLoginsListPartial.cshtml | src/Pablo.Gallery/Views/Account/_ExternalLoginsListPartial.cshtml | @model ICollection<Microsoft.Web.WebPages.OAuth.AuthenticationClientData>
@if (Model.Count > 0)
{
using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = ViewBag.ReturnUrl }))
{
@Html.AntiForgeryToken()
<h4>Use another service to log in.</h4>
<hr />
<div id="socialLoginList">
@foreach (var p in Model)
{
<button type="submit" class="btn" id="@p.AuthenticationClient.ProviderName" name="provider" value="@p.AuthenticationClient.ProviderName" title="Log in using your @p.DisplayName account">@p.DisplayName</button>
}
</div>
}
}
| @model ICollection<AuthenticationClientData>
@if (Model.Count > 0)
{
using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = ViewBag.ReturnUrl }))
{
@Html.AntiForgeryToken()
<h4>Use another service to log in.</h4>
<hr />
<div id="socialLoginList">
@foreach (AuthenticationClientData p in Model)
{
<button type="submit" class="btn" id="@p.AuthenticationClient.ProviderName" name="provider" value="@p.AuthenticationClient.ProviderName" title="Log in using your @p.DisplayName account">@p.DisplayName</button>
}
</div>
}
}
| mit | C# |
a067e3cbc23df15c4f4e96d43f929b8f899360c9 | Update ExtendedTableService.cs | tamasflamich/effort | Main/Source/Effort.Shared/Internal/DbManagement/Engine/Services/ExtendedTableService.cs | Main/Source/Effort.Shared/Internal/DbManagement/Engine/Services/ExtendedTableService.cs | // --------------------------------------------------------------------------------------------
// <copyright file="ExtendedTableService.cs" company="Effort Team">
// Copyright (C) Effort Team
//
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------
namespace Effort.Internal.DbManagement.Engine
{
using NMemory.Indexes;
using NMemory.Modularity;
using NMemory.Services.Contracts;
using NMemory.Tables;
internal class ExtendedTableService : ITableService
{
public Table<TEntity, TPrimaryKey> CreateTable<TEntity, TPrimaryKey>(
IKeyInfo<TEntity, TPrimaryKey> primaryKey,
IdentitySpecification<TEntity> identitySpecification,
IDatabase database, object tableInfo = null)
where TEntity : class
{
return new ExtendedTable<TEntity, TPrimaryKey>(
database,
primaryKey,
identitySpecification, tableInfo);
}
}
}
| // --------------------------------------------------------------------------------------------
// <copyright file="ExtendedTableService.cs" company="Effort Team">
// Copyright (C) Effort Team
//
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------
namespace Effort.Internal.DbManagement.Engine
{
using NMemory.Indexes;
using NMemory.Modularity;
using NMemory.Services.Contracts;
using NMemory.Tables;
internal class ExtendedTableService : ITableService
{
public Table<TEntity, TPrimaryKey> CreateTable<TEntity, TPrimaryKey>(
IKeyInfo<TEntity, TPrimaryKey> primaryKey,
IdentitySpecification<TEntity> identitySpecification,
IDatabase database)
where TEntity : class
{
return new ExtendedTable<TEntity, TPrimaryKey>(
database,
primaryKey,
identitySpecification);
}
}
}
| mit | C# |
b3872486799af70acd4627557dccd71784935357 | fix arter rebase | BigBabay/AsyncConverter,BigBabay/AsyncConverter | AsyncConverter/Helpers/AwaitEliderChecker.cs | AsyncConverter/Helpers/AwaitEliderChecker.cs | using System.Linq;
using AsyncConverter.AsyncHelpers.Checker;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
namespace AsyncConverter.Helpers
{
[SolutionComponent]
public class AwaitEliderChecker : IAwaitEliderChecker
{
private readonly ILastNodeChecker lastNodeChecker;
public AwaitEliderChecker(ILastNodeChecker lastNodeChecker)
{
this.lastNodeChecker = lastNodeChecker;
}
public bool CanElide(IParametersOwnerDeclaration element)
{
var returnStatements = element.DescendantsInScope<IReturnStatement>().ToArray();
var returnType = element.DeclaredParametersOwner?.ReturnType;
if (returnType == null)
return false;
if (returnType.IsTask() && returnStatements.Any()
|| returnType.IsGenericTask() && returnStatements.Length > 1)
return false;
var awaitExpressions = element.DescendantsInScope<IAwaitExpression>().ToArray();
//TODO: think about this, different settings
if (awaitExpressions.Length != 1)
return false;
var awaitExpression = awaitExpressions.First();
if (returnStatements.Any() && returnStatements.First() != awaitExpression.GetContainingStatement())
return false;
if (!lastNodeChecker.IsLastNode(awaitExpression))
return false;
return true;
}
}
} | using System.Linq;
using AsyncConverter.AsyncHelpers.Checker;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
namespace AsyncConverter.Helpers
{
[SolutionComponent]
public class AwaitEliderChecker : IAwaitEliderChecker
{
private readonly ILastNodeChecker lastNodeChecker;
public AwaitEliderChecker(ILastNodeChecker lastNodeChecker)
{
this.lastNodeChecker = lastNodeChecker;
}
public bool CanElide(IParametersOwnerDeclaration element)
{
var awaitExpressions = element.DescendantsInScope<IAwaitExpression>().ToArray();
//TODO: think about this, different settings
if (awaitExpressions.Length != 1)
return false;
var awaitExpression = awaitExpressions.First();
if (!lastNodeChecker.IsLastNode(awaitExpression))
return false;
return true;
}
}
} | mit | C# |
8f4f0db2a669a776b43c760f9928db84ff5018f7 | Bump version to v0.1-alpha3 | Prof9/TextPet | TextPet/Program.cs | TextPet/Program.cs | using System;
[assembly: CLSCompliant(true)]
namespace TextPet {
class Program {
public static string Version => "v1.0-alpha3";
static int Main(string[] args) {
string originalConsoleTitle = Console.Title;
int errorLevel = 0;
#if !DEBUG
try {
#endif
Console.Title = "TextPet CLI";
Console.WriteLine("TextPet " + Version + " by Prof. 9");
Console.WriteLine();
TextPetCore core = new TextPetCore();
errorLevel = new CommandLineInterface(core).Run(args);
#if !DEBUG
} catch (Exception ex) {
Console.WriteLine("FATAL: " + ex.Message);
errorLevel = 2;
}
#else
Console.ReadKey();
#endif
Console.Title = originalConsoleTitle;
return errorLevel;
}
}
}
| using System;
[assembly: CLSCompliant(true)]
namespace TextPet {
class Program {
public static string Version => "v1.0-alpha2";
static int Main(string[] args) {
string originalConsoleTitle = Console.Title;
int errorLevel = 0;
#if !DEBUG
try {
#endif
Console.Title = "TextPet CLI";
Console.WriteLine("TextPet " + Version + " by Prof. 9");
Console.WriteLine();
TextPetCore core = new TextPetCore();
errorLevel = new CommandLineInterface(core).Run(args);
#if !DEBUG
} catch (Exception ex) {
Console.WriteLine("FATAL: " + ex.Message);
errorLevel = 2;
}
#else
Console.ReadKey();
#endif
Console.Title = originalConsoleTitle;
return errorLevel;
}
}
}
| mit | C# |
d54e66cabc82946e63b38e65752fe1a829024355 | add title for pie chart demo form | jingwood/d2dlib,jingwood/d2dlib,jingwood/d2dlib | src/Examples/Demos/PieChart.cs | src/Examples/Demos/PieChart.cs | /*
* MIT License
*
* Copyright (c) 2009-2018 Jingwood, unvell.com. All right reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using unvell.D2DLib.WinForm;
namespace unvell.D2DLib.Examples.Demos
{
public partial class PieChart : DemoForm
{
List<PieInfo> pies = new List<PieInfo>();
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Text = "PieChart Demo";
CreateChart();
}
void CreateChart()
{
pies.Clear();
// define the figure origin and size
var figureOrigin = new D2DPoint(300, 300);
var figureSize = new D2DSize(300, 300);
var records = new float[] { .6f, .3f, .1f };
float currentAngle = 0;
// create pie geometries from records
foreach (var record in records)
{
var angleSpan = record * 360;
var path = Device.CreatePieGeometry(figureOrigin, figureSize, currentAngle, currentAngle + angleSpan);
pies.Add(new PieInfo { path = path, color = D2DColor.Randomly() });
currentAngle += angleSpan;
}
Invalidate();
}
protected override void OnRender(D2DGraphics g)
{
base.OnRender(g);
// draw background
g.FillRectangle(100, 100, 400, 400, D2DColor.LightYellow);
// draw pie geometries
foreach (var pie in pies)
{
g.FillPath(pie.path, pie.color);
g.DrawPath(pie.path, D2DColor.LightYellow, 2);
}
g.DrawText("Click to change color", D2DColor.Black, 250, 550);
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
CreateChart();
}
}
class PieInfo
{
public D2DGeometry path;
public D2DColor color;
}
}
| /*
* MIT License
*
* Copyright (c) 2009-2018 Jingwood, unvell.com. All right reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using unvell.D2DLib.WinForm;
namespace unvell.D2DLib.Examples.Demos
{
public partial class PieChart : DemoForm
{
List<PieInfo> pies = new List<PieInfo>();
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
CreateChart();
}
void CreateChart()
{
pies.Clear();
// define the figure origin and size
var figureOrigin = new D2DPoint(300, 300);
var figureSize = new D2DSize(300, 300);
var records = new float[] { .6f, .3f, .1f };
float currentAngle = 0;
// create pie geometries from records
foreach (var record in records)
{
var angleSpan = record * 360;
var path = Device.CreatePieGeometry(figureOrigin, figureSize, currentAngle, currentAngle + angleSpan);
pies.Add(new PieInfo { path = path, color = D2DColor.Randomly() });
currentAngle += angleSpan;
}
Invalidate();
}
protected override void OnRender(D2DGraphics g)
{
base.OnRender(g);
// draw background
g.FillRectangle(100, 100, 400, 400, D2DColor.LightYellow);
// draw pie geometries
foreach (var pie in pies)
{
g.FillPath(pie.path, pie.color);
g.DrawPath(pie.path, D2DColor.LightYellow, 2);
}
g.DrawText("Click to change color", D2DColor.Black, 250, 550);
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
CreateChart();
}
}
class PieInfo
{
public D2DGeometry path;
public D2DColor color;
}
}
| mit | C# |
83c0bda8c5bc3dcb7c25cb95d75428336f078be8 | Save assets after changing scripting defines | DarrenTsung/DTCommandPalette | DefaultCommands/Editor/ScriptingDefines/ScriptingDefinesManager.cs | DefaultCommands/Editor/ScriptingDefines/ScriptingDefinesManager.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace DTCommandPalette.ScriptingDefines {
public static class ScriptingDefinesManager {
public static BuildTargetGroup CurrentTargetGroup {
get { return EditorUserBuildSettings.selectedBuildTargetGroup; }
}
public static string[] GetCurrentDefines() {
return GetDefinesFor(CurrentTargetGroup);
}
public static string[] GetDefinesFor(BuildTargetGroup targetGroup) {
string scriptingDefinesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup);
return scriptingDefinesString.Split(';');
}
public static bool RemoveDefine(string symbol) {
return RemoveDefine(CurrentTargetGroup, symbol);
}
public static bool RemoveDefine(BuildTargetGroup targetGroup, string symbol) {
string[] scriptingDefines = GetDefinesFor(targetGroup);
if (!scriptingDefines.Contains(symbol)) {
return false;
}
scriptingDefines = scriptingDefines.Where(s => s != symbol).ToArray();
SetScriptingDefines(targetGroup, scriptingDefines);
return true;
}
public static bool AddDefineIfNotFound(string symbol) {
return AddDefineIfNotFound(CurrentTargetGroup, symbol);
}
public static bool AddDefineIfNotFound(BuildTargetGroup targetGroup, string symbol) {
string[] scriptingDefines = GetDefinesFor(targetGroup);
if (scriptingDefines.Contains(symbol)) {
return false;
}
scriptingDefines = scriptingDefines.ConcatSingle(symbol).ToArray();
SetScriptingDefines(targetGroup, scriptingDefines);
return true;
}
// PRAGMA MARK - Internal
private static void SetScriptingDefines(BuildTargetGroup targetGroup, string[] scriptingDefines) {
string newScriptingDefines = string.Join(";", scriptingDefines);
PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, newScriptingDefines);
AssetDatabase.SaveAssets();
}
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace DTCommandPalette.ScriptingDefines {
public static class ScriptingDefinesManager {
public static BuildTargetGroup CurrentTargetGroup {
get { return EditorUserBuildSettings.selectedBuildTargetGroup; }
}
public static string[] GetCurrentDefines() {
return GetDefinesFor(CurrentTargetGroup);
}
public static string[] GetDefinesFor(BuildTargetGroup targetGroup) {
string scriptingDefinesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup);
return scriptingDefinesString.Split(';');
}
public static bool RemoveDefine(string symbol) {
return RemoveDefine(CurrentTargetGroup, symbol);
}
public static bool RemoveDefine(BuildTargetGroup targetGroup, string symbol) {
string[] scriptingDefines = GetDefinesFor(targetGroup);
if (!scriptingDefines.Contains(symbol)) {
return false;
}
scriptingDefines = scriptingDefines.Where(s => s != symbol).ToArray();
PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, string.Join(";", scriptingDefines));
return true;
}
public static bool AddDefineIfNotFound(string symbol) {
return AddDefineIfNotFound(CurrentTargetGroup, symbol);
}
public static bool AddDefineIfNotFound(BuildTargetGroup targetGroup, string symbol) {
string[] scriptingDefines = GetDefinesFor(targetGroup);
if (scriptingDefines.Contains(symbol)) {
return false;
}
scriptingDefines = scriptingDefines.ConcatSingle(symbol).ToArray();
PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, string.Join(";", scriptingDefines));
return true;
}
}
}
| mit | C# |
ce946bd7b4fa2ad6ca72f4d47ff689fb850ee25e | add personId to familyMember response | dhawalharsora/connectedcare-sdk,SnapMD/connectedcare-sdk | SnapMD.VirtualCare.ApiModels/FamilyMember.cs | SnapMD.VirtualCare.ApiModels/FamilyMember.cs | #region Copyright
// Copyright 2016 SnapMD, 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.
#endregion
using System;
namespace SnapMD.VirtualCare.ApiModels
{
public class FamilyMember
{
public int PatientId { get; set; }
public string PatientName { get; set; }
public string ProfileImagePath { get; set; }
public int RelationCode { get; set; }
public bool IsAuthorized { get; set; }
public DateTime? Birthdate { get; set; }
public string[] Addresses { get; set; }
public string PatientFirstName { get; set; }
public string PatientLastName { get; set; }
public string GuardianFirstName { get; set; }
public string GuardianLastName { get; set; }
public string GuardianName { get; set; }
public Guid? PersonId { get; set; }
}
}
| #region Copyright
// Copyright 2016 SnapMD, 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.
#endregion
using System;
namespace SnapMD.VirtualCare.ApiModels
{
public class FamilyMember
{
public int PatientId { get; set; }
public string PatientName { get; set; }
public string ProfileImagePath { get; set; }
public int RelationCode { get; set; }
public bool IsAuthorized { get; set; }
public DateTime? Birthdate { get; set; }
public string[] Addresses { get; set; }
public string PatientFirstName { get; set; }
public string PatientLastName { get; set; }
public string GuardianFirstName { get; set; }
public string GuardianLastName { get; set; }
public string GuardianName { get; set; }
}
}
| apache-2.0 | C# |
3af1e6500d660bd36c0d6e7793b90a7dda360c0a | Call Form.OnShown after window is shown (to be consistent with dialog) | l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,bbqchickenrobot/Eto-1,l8s/Eto | Source/Eto.Platform.Mac/Forms/FormHandler.cs | Source/Eto.Platform.Mac/Forms/FormHandler.cs | using System;
using Eto.Forms;
using MonoMac.AppKit;
using SD = System.Drawing;
namespace Eto.Platform.Mac.Forms
{
public class FormHandler : MacWindow<MyWindow, Form>, IForm
{
protected override bool DisposeControl { get { return false; } }
public FormHandler()
{
Control = new MyWindow(new SD.Rectangle(0, 0, 200, 200),
NSWindowStyle.Resizable | NSWindowStyle.Closable | NSWindowStyle.Miniaturizable | NSWindowStyle.Titled,
NSBackingStore.Buffered, false);
ConfigureWindow();
}
public void Show()
{
if (WindowState == WindowState.Minimized)
Control.MakeKeyWindow();
else
Control.MakeKeyAndOrderFront(ApplicationHandler.Instance.AppDelegate);
if (!Control.IsVisible)
Widget.OnShown(EventArgs.Empty);
}
}
}
| using System;
using Eto.Drawing;
using Eto.Forms;
using MonoMac.AppKit;
using SD = System.Drawing;
namespace Eto.Platform.Mac.Forms
{
public class FormHandler : MacWindow<MyWindow, Form>, IDisposable, IForm
{
protected override bool DisposeControl { get { return false; } }
public FormHandler()
{
Control = new MyWindow(new SD.Rectangle(0,0,200,200),
NSWindowStyle.Resizable | NSWindowStyle.Closable | NSWindowStyle.Miniaturizable | NSWindowStyle.Titled,
NSBackingStore.Buffered, false);
ConfigureWindow ();
}
public void Show ()
{
if (!Control.IsVisible)
Widget.OnShown (EventArgs.Empty);
if (this.WindowState == WindowState.Minimized)
Control.MakeKeyWindow ();
else
Control.MakeKeyAndOrderFront (ApplicationHandler.Instance.AppDelegate);
}
}
}
| bsd-3-clause | C# |
19d96431e9c7fe0119fc160f9f97e1d42cd487a0 | Build and publish nuget package | RockFramework/Rock.EmbeddedNativeLibrary | src/Properties/AssemblyInfo.cs | src/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("Rock.EmbeddedNativeLibrary")]
[assembly: AssemblyDescription("Consume native libraries from .NET by adding as embedded resources.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.EmbeddedNativeLibrary")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2015-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bbf12b49-1839-4a25-b841-1af4f2eeb4b0")]
// 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.1.0.*")]
[assembly: AssemblyFileVersion("1.2.1")]
[assembly: AssemblyInformationalVersion("1.2.1")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.EmbeddedNativeLibrary")]
[assembly: AssemblyDescription("Consume native libraries from .NET by adding as embedded resources.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.EmbeddedNativeLibrary")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 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("bbf12b49-1839-4a25-b841-1af4f2eeb4b0")]
// 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.1.0.*")]
[assembly: AssemblyFileVersion("1.2.0")]
[assembly: AssemblyInformationalVersion("1.2.0")]
| mit | C# |
8b3534f496dcbfb968e31bd05bc08649634fac6b | Update MonoSingleton's Awake to "protected virtual" to allow override | xtralifecloud/unity-gametemplate | UnityProject/Assets/CotcSdkTemplate/Scripts/Tools/MonoSingleton.cs | UnityProject/Assets/CotcSdkTemplate/Scripts/Tools/MonoSingleton.cs | using UnityEngine;
namespace CotcSdkTemplate
{
/// <summary>
/// A class derivated from MonoBehaviour and following the singleton design pattern.
/// </summary>
public class MonoSingleton<T> : MonoBehaviour where T : MonoBehaviour
{
#region Instance Handling
// The singleton instance
private static MonoSingleton<T> instance = null;
/// <summary>
/// Register the singleton instance at Awake.
/// </summary>
protected virtual void Awake()
{
if (instance == null)
instance = this;
else
{
DebugLogs.LogError("[MonoSingleton:Awake] Found more than one instance of " + this.GetType().Name + " ›› Destroying the last one");
Destroy(this);
}
}
/// <summary>
/// Get the singleton instance.
/// </summary>
public static T Instance
{
get
{
if (instance != null)
return instance as T;
else
{
DebugLogs.LogError("[MonoSingleton:InstanceGet] Not found any instance of " + typeof(T).Name + " ›› Returning null");
return null;
}
}
}
/// <summary>
/// Check if a signleton instance is registered.
/// </summary>
public static bool HasInstance
{
get { return instance != null; }
}
#endregion
}
}
| using UnityEngine;
namespace CotcSdkTemplate
{
/// <summary>
/// A class derivated from MonoBehaviour and following the singleton design pattern.
/// </summary>
public class MonoSingleton<T> : MonoBehaviour where T : MonoBehaviour
{
#region Instance Handling
// The singleton instance
private static MonoSingleton<T> instance = null;
/// <summary>
/// Register the singleton instance at Awake.
/// </summary>
private void Awake()
{
if (instance == null)
instance = this;
else
{
DebugLogs.LogError("[MonoSingleton:Awake] Found more than one instance of " + this.GetType().Name + " ›› Destroying the last one");
Destroy(this);
}
}
/// <summary>
/// Get the singleton instance.
/// </summary>
public static T Instance
{
get
{
if (instance != null)
return instance as T;
else
{
DebugLogs.LogError("[MonoSingleton:InstanceGet] Not found any instance of " + typeof(T).Name + " ›› Returning null");
return null;
}
}
}
/// <summary>
/// Check if a signleton instance is registered.
/// </summary>
public static bool HasInstance
{
get { return instance != null; }
}
#endregion
}
}
| mit | C# |
41b6ed1038bb70f07628f4e76acaaedbbc57b47b | Update Mvc.cs | dd4t/DD4T.DI.Autofac,dd4t/dd4t-di-autofac | source/DD4T.DI.Autofac/Mvc.cs | source/DD4T.DI.Autofac/Mvc.cs | using System;
using System.IO;
using System.Linq;
using System.Reflection;
using Autofac;
namespace DD4T.DI.Autofac
{
public static class Mvc
{
public static void RegisterMvc(this ContainerBuilder builder)
{
var location = string.Format(@"{0}\bin\", AppDomain.CurrentDomain.BaseDirectory);
var file = Directory.GetFiles(location, "DD4T.MVC.dll").FirstOrDefault();
if (file == null)
return;
Assembly.LoadFile(file);
var provider = AppDomain.CurrentDomain.GetAssemblies().Where(ass => ass.FullName.StartsWith("DD4T.MVC", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (provider == null)
return;
var providerTypes = provider.GetTypes();
var iComponentPresentationRenderer = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.Html.IComponentPresentationRenderer", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var defaultComponentPresentationRenderer = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.Html.DefaultComponentPresentationRenderer", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var iXpmMarkupService = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.ViewModels.XPM.IXpmMarkupService", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var defaultXpmMarkupService = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.ViewModels.XPM.XpmMarkupService", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
//register default ComponentPresentationRenderer
if (iComponentPresentationRenderer != null || defaultComponentPresentationRenderer != null)
{
builder.RegisterType(defaultComponentPresentationRenderer).As(iComponentPresentationRenderer).PreserveExistingDefaults();
}
//register default XPmMarkupService
if (iXpmMarkupService != null || defaultXpmMarkupService != null)
{
builder.RegisterType(defaultXpmMarkupService).As(iXpmMarkupService).PreserveExistingDefaults();
}
}
}
}
| using Autofac;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DD4T.DI.Autofac
{
public static class Mvc
{
public static void RegisterMvc(this ContainerBuilder builder)
{
var location = string.Format(@"{0}\bin\", AppDomain.CurrentDomain.BaseDirectory);
var file = Directory.GetFiles(location, "DD4T.MVC.dll").FirstOrDefault();
if (file == null)
return;
var load = Assembly.LoadFile(file);
var provider = AppDomain.CurrentDomain.GetAssemblies().Where(ass => ass.FullName.StartsWith("DD4T.MVC")).FirstOrDefault();
if (provider == null)
return;
var providerTypes = provider.GetTypes();
var iComponentPresentationRenderer = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.Html.IComponentPresentationRenderer")).FirstOrDefault();
var defaultComponentPresentationRenderer = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.Html.DefaultComponentPresentationRenderer")).FirstOrDefault();
var iXpmMarkupService = providerTypes.Where(a => a.FullName.Equals("DD4T.MVC.ViewModels.XPM.IXpmMarkupService")).FirstOrDefault();
var defaultXpmMarkupService = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.ViewModels.XPM.XpmMarkupService")).FirstOrDefault();
//register default ComponentPresentationRenderer
if (iComponentPresentationRenderer != null || defaultComponentPresentationRenderer != null)
{
builder.RegisterType(defaultComponentPresentationRenderer).As(new[] { iComponentPresentationRenderer }).PreserveExistingDefaults();
}
//register default XPmMarkupService
if (iXpmMarkupService != null || defaultXpmMarkupService != null)
{
builder.RegisterType(defaultXpmMarkupService).As(new[] { iXpmMarkupService }).PreserveExistingDefaults();
}
}
}
}
| apache-2.0 | C# |
4be1f4c08d8f3337d7e6f59aefc163a1005c583c | Update Index.cshtml | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Home/Index.cshtml | Anlab.Mvc/Views/Home/Index.cshtml | @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: September 30, 2020<br /><br />
In response to the emergency need for the analysis of wine for smoke taint,
the UC Davis Department of Viticulture and Enology is partnering with the UC Davis Analytical Lab to offer testing<br /><br />
Please click <a href="/media/pdf/anlab_smoke-taint_instructions_v2.pdf" target="_blank"><strong>here</strong> for more information</a> on
<strong> Wine Testing for Smoke Taint</strong>.
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:[email protected]">[email protected]</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
| @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: September 30, 2020<br /><br />
In response to the emergency need for the analysis of wine for smoke taint,
the UC Davis Department of Viticulture and Enology is partnering with the UC Davis Analytical Lab to offer testing<br /><br />
Please click <a href="/media/pdf/anlab_smoke-taint_instructions.pdf" target="_blank"><strong>here</strong> for more information</a> on
<strong> Wine Testing for Smoke Taint</strong>.
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:[email protected]">[email protected]</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
| mit | C# |
987aa5a21c043360d71f0155b52d70e77ddd3a5e | Add testing of different strengths | peppy/osu,ppy/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu | osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAimAssist.cs | osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModAimAssist.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Game.Rulesets.Osu.Mods;
namespace osu.Game.Rulesets.Osu.Tests.Mods
{
public class TestSceneOsuModAimAssist : OsuModTestScene
{
[TestCase(0.1f)]
[TestCase(0.5f)]
[TestCase(1)]
public void TestAimAssist(float strength)
{
CreateModTest(new ModTestData
{
Mod = new OsuModAimAssist
{
AssistStrength = { Value = strength },
},
PassCondition = () => true,
Autoplay = false,
});
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Game.Rulesets.Osu.Mods;
namespace osu.Game.Rulesets.Osu.Tests.Mods
{
public class TestSceneOsuModAimAssist : OsuModTestScene
{
[Test]
public void TestAimAssist()
{
var mod = new OsuModAimAssist();
CreateModTest(new ModTestData
{
Autoplay = false,
Mod = mod,
});
}
}
}
| mit | C# |
cc3923be778ba8f2278111338f008dc1579dd189 | Check for null in IsNetworkAvailable implementation | Dav2070/UniversalSoundBoard | UniversalSoundBoard/Common/GeneralMethods.cs | UniversalSoundBoard/Common/GeneralMethods.cs | using davClassLibrary.Common;
using davClassLibrary.DataAccess;
using UniversalSoundBoard.DataAccess;
using Windows.Networking.Connectivity;
namespace UniversalSoundboard.Common
{
public class GeneralMethods : IGeneralMethods
{
public bool IsNetworkAvailable()
{
var connection = NetworkInformation.GetInternetConnectionProfile();
if (connection == null) return false;
var networkCostType = connection.GetConnectionCost().NetworkCostType;
return !(networkCostType != NetworkCostType.Unrestricted && networkCostType != NetworkCostType.Unknown);
}
public DavEnvironment GetEnvironment()
{
return FileManager.Environment;
}
}
}
| using davClassLibrary.Common;
using davClassLibrary.DataAccess;
using UniversalSoundBoard.DataAccess;
using Windows.Networking.Connectivity;
namespace UniversalSoundboard.Common
{
public class GeneralMethods : IGeneralMethods
{
public bool IsNetworkAvailable()
{
var connection = NetworkInformation.GetInternetConnectionProfile();
var networkCostType = connection.GetConnectionCost().NetworkCostType;
return !(networkCostType != NetworkCostType.Unrestricted && networkCostType != NetworkCostType.Unknown);
}
public DavEnvironment GetEnvironment()
{
return FileManager.Environment;
}
}
}
| mit | C# |
fc1ea1b0df2d0ea9cda8bac3e255d08ec9297661 | Fix minor rumble bug. | Eusth/VRGIN | VRGIN/Controls/Handlers/BodyRumbleHandler.cs | VRGIN/Controls/Handlers/BodyRumbleHandler.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using VRGIN.Core;
using VRGIN.Helpers;
namespace VRGIN.Controls.Handlers
{
public class BodyRumbleHandler : ProtectedBehaviour
{
private Controller _Controller;
private int _TouchCounter = 0;
private RumbleSession _Rumble;
protected override void OnStart()
{
base.OnStart();
_Controller = GetComponent<Controller>();
}
protected override void OnLevel(int level)
{
base.OnLevel(level);
OnStop();
}
protected void OnDisable()
{
OnStop();
}
protected void OnTriggerEnter(Collider collider)
{
if (VR.Interpreter.IsBody(collider))
{
_TouchCounter++;
if (_Rumble == null)
{
_Rumble = new RumbleSession(50, 10, 1f);
_Controller.StartRumble(_Rumble);
}
}
}
protected void OnTriggerStay(Collider collider)
{
if (VR.Interpreter.IsBody(collider))
{
_Rumble.Restart();
}
}
protected void OnTriggerExit(Collider collider)
{
if (VR.Interpreter.IsBody(collider))
{
_TouchCounter--;
if (_TouchCounter == 0)
{
OnStop();
}
}
}
protected void OnStop()
{
_TouchCounter = 0;
if (_Rumble != null)
{
_Rumble.Close();
_Rumble = null;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using VRGIN.Core;
using VRGIN.Helpers;
namespace VRGIN.Controls.Handlers
{
public class BodyRumbleHandler : ProtectedBehaviour
{
private Controller _Controller;
private int _TouchCounter = 0;
private RumbleSession _Rumble;
protected override void OnStart()
{
base.OnStart();
_Controller = GetComponent<Controller>();
}
protected override void OnLevel(int level)
{
base.OnLevel(level);
OnStop();
}
protected void OnDisable()
{
OnStop();
}
protected void OnTriggerEnter(Collider collider)
{
if (VR.Interpreter.IsBody(collider))
{
_TouchCounter++;
if (_Rumble == null)
{
_Rumble = new RumbleSession(50, 10, 1f);
_Controller.StartRumble(_Rumble);
}
}
}
protected void OnTriggerStay(Collider collider)
{
if (collider.gameObject.layer == LayerMask.NameToLayer("ToLiquidCollision"))
{
_Rumble.Restart();
}
}
protected void OnTriggerExit(Collider collider)
{
if (collider.gameObject.layer == LayerMask.NameToLayer("ToLiquidCollision"))
{
_TouchCounter--;
if (_TouchCounter == 0)
{
OnStop();
}
}
}
protected void OnStop()
{
_TouchCounter = 0;
if (_Rumble != null)
{
_Rumble.Close();
_Rumble = null;
}
}
}
}
| mit | C# |
ac3ff4471fb020a730c0a538c66f2b8352915ea8 | Fix namespace in httpclient registration | leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net | src/JoinRpg.Blazor.Client/ApiClients/HttpClientRegistration.cs | src/JoinRpg.Blazor.Client/ApiClients/HttpClientRegistration.cs | using JoinRpg.Web.CheckIn;
using JoinRpg.Web.ProjectCommon;
using JoinRpg.Web.ProjectMasterTools.ResponsibleMaster;
using JoinRpg.Web.ProjectMasterTools.Subscribe;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
namespace JoinRpg.Blazor.Client.ApiClients;
public static class HttpClientRegistration
{
private static WebAssemblyHostBuilder AddHttpClient<TClient, TImplementation>(
this WebAssemblyHostBuilder builder)
where TClient : class
where TImplementation : class, TClient
{
_ = builder.Services.AddHttpClient<TClient, TImplementation>(
client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress));
return builder;
}
public static WebAssemblyHostBuilder AddHttpClients(this WebAssemblyHostBuilder builder)
{
return builder
.AddHttpClient<IGameSubscribeClient, GameSubscribeClient>()
.AddHttpClient<ICharacterGroupsClient, CharacterGroupsClient>()
.AddHttpClient<ICheckInClient, CheckInClient>()
.AddHttpClient<IResponsibleMasterRuleClient, ResponsibleMasterRuleClient>();
}
}
| using JoinRpg.Web.CheckIn;
using JoinRpg.Web.ProjectCommon;
using JoinRpg.Web.ProjectMasterTools.ResponsibleMaster;
using JoinRpg.Web.ProjectMasterTools.Subscribe;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
namespace JoinRpg.Blazor.Client.ApiClients;
public static class HttpClientRegistration
{
private static WebAssemblyHostBuilder AddHttpClient<TClient, TImplementation>(
this WebAssemblyHostBuilder builder)
where TClient : class
where TImplementation : class, TClient
{
_ = builder.Services.AddHttpClient<TClient, TImplementation>(
client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress));
return builder;
}
public static WebAssemblyHostBuilder AddHttpClients(this WebAssemblyHostBuilder builder)
{
return builder
.AddHttpClient<IGameSubscribeClient, GameSubscribeClient>()
.AddHttpClient<ICharacterGroupsClient, CharacterGroupsClient>()
.AddHttpClient<ICheckInClient, CheckInClient>()
.AddHttpClient<IResponsibleMasterRuleClient, ApiClients.ResponsibleMasterRuleClient>();
}
}
| mit | C# |
73a1739fc1aa5a7fb1468a7e6e9cb1ae14370edf | Debug methods | Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum | src/Nethereum.RPC.Tests/Testers/DebugTraceTransactionTester.cs | src/Nethereum.RPC.Tests/Testers/DebugTraceTransactionTester.cs |
using System;
using System.Threading.Tasks;
using Nethereum.JsonRpc.Client;
using Nethereum.RPC.Eth;
using Nethereum.RPC.Tests;
using Xunit;
using Newtonsoft.Json.Linq;
using Nethereum.RPC.DebugGeth.DTOs;
namespace Nethereum.RPC.Sample.Testers
{
public class DebugTraceTransactionTester : RPCRequestTester<JObject>, IRPCRequestTester
{
[Fact]
public async void ShouldReturnAJObjectRepresentingTheTransactionStack()
{
var result = await ExecuteAsync(ClientFactory.GetClient());
Assert.NotNull(result);
}
public override async Task<JObject> ExecuteAsync(IClient client)
{
var debugTraceTransaction = new DebugTraceTransaction(client);
return await debugTraceTransaction.SendRequestAsync("0x31227fe8fdadbeb9e08626cfc2b869c2977fe8ab33ded0dc277d12ebce27c793", new TraceTransactionOptions());
}
public override Type GetRequestType()
{
return typeof(DebugTraceTransaction);
}
/*{"structLogs": [
{
"pc": 0,
"op": "PUSH1",
"gas": 62269,
"gasCost": 3,
"depth": 1,
"error": "",
"stack": [],
"memory": null,
"storage": {}
},
{
"pc": 2,
"op": "PUSH1",
"gas": 62266,
"gasCost": 3,
"depth": 1,
"error": "",
"stack": [
"0000000000000000000000000000000000000000000000000000000000000060"
],
"memory": null,
"storage": {}
},
{
"pc": 4,
"op": "MSTORE",
"gas": 62254,
"gasCost": 12,
"depth": 1,
"error": "",
"stack": [
"0000000000000000000000000000000000000000000000000000000000000060",
"0000000000000000000000000000000000000000000000000000000000000040"
],
"memory": [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
],
"storage": {}
},
{
"pc": 5,
"op": "PUSH1",
"gas": 62251,
"gasCost": 3,
"depth": 1,
"error": "",
"stack": [],
"memory": [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000060"
],
"storage": {}
},
{
"pc": 7,
"op": "DUP1",
"gas": 62248,
"gasCost": 3,
"depth": 1,
"error": "",
"stack": [
"0000000000000000000000000000000000000000000000000000000000000072"
],
"memory": [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000060"
],
"storage": {}
},
{
"pc": 8,
"op": "PUSH1",
"gas": 62245,
"gasCost": 3,
"depth": 1,
"error": "",
"stack": [
"0000000000000000000000000000000000000000000000000000000000000072",
"0000000000000000000000000000000000000000000000000000000000000072"
],
"memory": [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000060"
],
"storage": {}
},
{
"pc": 10,
"op": "PUSH1",
"gas": 62242,
"gasCost": 3,
"depth": 1,
"error": "",
"stack": [
"0000000000000000000000000000000000000000000000000000000000000072",
"0000000000000000000000000000000000000000000000000000000000000072",
"0000000000000000000000000000000000000000000000000000000000000010"
],
"memory": [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000060"
],
"storage": {}
},
{
"pc": 12,
"op": "CODECOPY",
"gas": 62224,
"gasCost": 18,
"depth": 1,
"error": "",
"stack": [
"0000000000000000000000000000000000000000000000000000000000000072",
"0000000000000000000000000000000000000000000000000000000000000072",
"0000000000000000000000000000000000000000000000000000000000000010",
"0000000000000000000000000000000000000000000000000000000000000000"
],
"memory": [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000060",
"0000000000000000000000000000000000000000000000000000000000000000"
],
"storage": {}
},
{
"pc": 13,
"op": "PUSH1",
"gas": 62221,
"gasCost": 3,
"depth": 1,
"error": "",
"stack": [
"0000000000000000000000000000000000000000000000000000000000000072"
],
"memory": [
"60606040526000357c0100000000000000000000000000000000000000000000",
"00000000000090048063c6888fa1146037576035565b005b604b600480803590",
"60200190919050506061565b6040518082815260200191505060405180910390",
"f35b6000600782029050606d565b919050560000000000000000000000000000"
],
"storage": {}
},
{
"pc": 15,
"op": "RETURN",
"gas": 62221,
"gasCost": 0,
"depth": 1,
"error": "",
"stack": [
"0000000000000000000000000000000000000000000000000000000000000072",
"0000000000000000000000000000000000000000000000000000000000000000"
],
"memory": [
"60606040526000357c0100000000000000000000000000000000000000000000",
"00000000000090048063c6888fa1146037576035565b005b604b600480803590",
"60200190919050506061565b6040518082815260200191505060405180910390",
"f35b6000600782029050606d565b919050560000000000000000000000000000"
],
"storage": {}
}
]}*/
}
}
|
using System;
using System.Threading.Tasks;
using Nethereum.JsonRpc.Client;
using Nethereum.RPC.Eth;
using Nethereum.RPC.Tests;
using Xunit;
using Newtonsoft.Json.Linq;
using Nethereum.RPC.DebugGeth.DTOs;
namespace Nethereum.RPC.Sample.Testers
{
public class DebugTraceTransactionTester : RPCRequestTester<JObject>, IRPCRequestTester
{
[Fact]
public async void Should()
{
var result = await ExecuteAsync(ClientFactory.GetClient());
//Assert.True();
}
public override async Task<JObject> ExecuteAsync(IClient client)
{
var debugTraceTransaction = new DebugTraceTransaction(client);
return await debugTraceTransaction.SendRequestAsync("0x31227fe8fdadbeb9e08626cfc2b869c2977fe8ab33ded0dc277d12ebce27c793", new TraceTransactionOptions());
}
public override Type GetRequestType()
{
return typeof(DebugTraceTransaction);
}
}
}
| mit | C# |
7da56ec7fd27ebddc7253b6151b50f93ad289dd4 | Add null check and xmldoc | smoogipoo/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,ppy/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,peppy/osu,UselessToucan/osu,NeoAdonis/osu | osu.Game/Screens/Play/ScreenSuspensionHandler.cs | osu.Game/Screens/Play/ScreenSuspensionHandler.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
namespace osu.Game.Screens.Play
{
/// <summary>
/// Ensures screen is not suspended / dimmed while gameplay is active.
/// </summary>
public class ScreenSuspensionHandler : Component
{
private readonly GameplayClockContainer gameplayClockContainer;
private Bindable<bool> isPaused;
[Resolved]
private GameHost host { get; set; }
public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer)
{
this.gameplayClockContainer = gameplayClockContainer ?? throw new ArgumentNullException(nameof(gameplayClockContainer));
}
protected override void LoadComplete()
{
base.LoadComplete();
isPaused = gameplayClockContainer.IsPaused.GetBoundCopy();
isPaused.BindValueChanged(paused => host.AllowScreenSuspension.Value = paused.NewValue, true);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
isPaused?.UnbindAll();
if (host != null)
host.AllowScreenSuspension.Value = true;
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
namespace osu.Game.Screens.Play
{
internal class ScreenSuspensionHandler : Component
{
private readonly GameplayClockContainer gameplayClockContainer;
private Bindable<bool> isPaused;
[Resolved]
private GameHost host { get; set; }
public ScreenSuspensionHandler(GameplayClockContainer gameplayClockContainer)
{
this.gameplayClockContainer = gameplayClockContainer;
}
protected override void LoadComplete()
{
base.LoadComplete();
isPaused = gameplayClockContainer.IsPaused.GetBoundCopy();
isPaused.BindValueChanged(paused => host.AllowScreenSuspension.Value = paused.NewValue, true);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
isPaused?.UnbindAll();
if (host != null)
host.AllowScreenSuspension.Value = true;
}
}
}
| mit | C# |
84a0ed4535a23820f0453dafb81e6cd7a17f2cc1 | Implement line of sight | KBroloes/WormsVsBirds | Assets/Scripts/Gunner.cs | Assets/Scripts/Gunner.cs | using UnityEngine;
using System.Collections;
public class Gunner : MonoBehaviour {
public Projectile Projectile;
[Header("Projectiles per Second")]
public float FiringRate = 0.5f;
public int range = 10;
bool canFire;
float deltaTime;
Unit unit;
void Start()
{
unit = GetComponent<Unit>();
}
void FixedUpdate()
{
deltaTime += Time.fixedDeltaTime;
if(deltaTime >= 1/FiringRate)
{
canFire = true;
deltaTime = 0f;
}
}
void Update()
{
if(canFire && DetectEnemy())
{
Projectile p = Instantiate(Projectile);
Vector2 pos = transform.position;
// TODO: Do some animation magic and maybe spawn the projectile in front of the worm
p.transform.position = transform.position;
if(unit != null)
{
// Assign the unit strength for convenience in strength checking
p.Strength = unit.Strength;
}
canFire = false;
}
}
bool DetectEnemy()
{
Vector2 rayCastFrom = transform.position;
rayCastFrom.y -= 0.5f; //Account for y position being top of coordinate and will detect two lanes at once.
RaycastHit2D[] hits = Physics2D.RaycastAll(rayCastFrom, new Vector2(1, 0), range);
Debug.DrawRay(transform.position, new Vector2(1, 0), Color.red, range);
foreach(RaycastHit2D hit in hits)
{
if(hit.collider.gameObject.tag == "Enemy")
{
return true;
}
}
return false;
}
}
| using UnityEngine;
using System.Collections;
public class Gunner : MonoBehaviour {
public Projectile Projectile;
[Header("Projectiles per Second")]
public float FiringRate = 0.5f;
bool canFire;
float deltaTime;
Unit unit;
void Start()
{
unit = GetComponent<Unit>();
}
void FixedUpdate()
{
deltaTime += Time.fixedDeltaTime;
if(deltaTime >= 1/FiringRate)
{
canFire = true;
deltaTime = 0f;
}
}
void Update()
{
if(canFire)
{
Projectile p = Instantiate(Projectile);
Vector2 pos = transform.position;
// TODO: Do some animation magic and maybe spawn the projectile in front of the worm
p.transform.position = transform.position;
if(unit != null)
{
// Assign the unit strength for convenience in strength checking
p.Strength = unit.Strength;
}
canFire = false;
}
}
}
| mit | C# |
67bb3bcf61314b8469e992bff30db93b231c3bb5 | Add PlaySound as a debugging 'tool' | Bumblebee/Bumblebee,kool79/Bumblebee,toddmeinershagen/Bumblebee,chrisblock/Bumblebee,Bumblebee/Bumblebee,toddmeinershagen/Bumblebee,kool79/Bumblebee,chrisblock/Bumblebee,qchicoq/Bumblebee,qchicoq/Bumblebee | Bumblebee/Extensions/Debugging.cs | Bumblebee/Extensions/Debugging.cs | using System;
using System.Threading;
namespace Bumblebee.Extensions
{
public static class Debugging
{
public static T DebugPrint<T>(this T obj)
{
Console.WriteLine(obj.ToString());
return obj;
}
public static T DebugPrint<T>(this T obj, string message)
{
Console.WriteLine(message);
return obj;
}
public static T DebugPrint<T>(this T obj, Func<T, object> func)
{
Console.WriteLine(func.Invoke(obj));
return obj;
}
public static T PlaySound<T>(this T obj, int pause = 0)
{
System.Media.SystemSounds.Exclamation.Play();
return obj.Pause(pause);
}
public static T Pause<T>(this T block, int seconds)
{
if (seconds > 0) Thread.Sleep(1000 * seconds);
return block;
}
}
} | using System;
using System.Threading;
namespace Bumblebee.Extensions
{
public static class Debugging
{
public static T DebugPrint<T>(this T obj)
{
Console.WriteLine(obj.ToString());
return obj;
}
public static T DebugPrint<T>(this T obj, string message)
{
Console.WriteLine(message);
return obj;
}
public static T DebugPrint<T>(this T obj, Func<T, object> func)
{
Console.WriteLine(func.Invoke(obj));
return obj;
}
public static T Pause<T>(this T block, int seconds)
{
if (seconds > 0) Thread.Sleep(1000 * seconds);
return block;
}
}
} | mit | C# |
d8b3c89444350c24793d424991399919dfd8503d | Add global filtering | morarj/ACStalkMarket,morarj/ACStalkMarket,morarj/ACStalkMarket | ACStalkMarket/ACStalkMarket/App_Start/FilterConfig.cs | ACStalkMarket/ACStalkMarket/App_Start/FilterConfig.cs | using System.Web;
using System.Web.Mvc;
namespace ACStalkMarket
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
filters.Add(new AuthorizeAttribute());
}
}
}
| using System.Web;
using System.Web.Mvc;
namespace ACStalkMarket
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}
| mit | C# |
330efe50988200496eb0fc0c412c30b1e0069840 | Use submit button | ucdavis/CRP,ucdavis/CRP,ucdavis/CRP | CRP.Mvc/Views/ItemManagement/_TabNotifications.cshtml | CRP.Mvc/Views/ItemManagement/_TabNotifications.cshtml | @using CRP.Controllers
@using Microsoft.Web.Mvc
@model IEnumerable<CRP.Core.Domain.Transaction>
<div class="tab-pane" id="Notifications">
<table id="table-Notifications" class="table table-bordered">
<thead>
<tr>
<th></th>
<th>Transaction</th>
<th>Notified</th>
<th>Notified Date</th>
<th>Paid</th>
<th>TotalPaid</th>
<th>Check</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Where(a => a.ParentTransaction == null && a.IsActive && (a.Paid || a.Notified)))
{
<tr>
<td>
@using (Html.BeginForm<TransactionController>(x => x.SendNotification(item.Id, null, null), FormMethod.Post, new {@class = "display_inline"}))
{
@Html.AntiForgeryToken()
<button type="submit" class="btn-link">Send</button>
}
</td>
<td>@Html.DisplayFor(modelItem => item.TransactionNumber)</td>
<td>@Html.DisplayFor(modelItem => item.Notified)</td>
<td>@Html.DisplayFor(modelItem => item.NotifiedDate)</td>
<td>@Html.DisplayFor(modelItem => item.Paid)</td>
<td data-sort="@item.TotalPaid">@string.Format("{0:$#,##0.00;($#,##0.00); }", item.TotalPaid)</td>
<td>@Html.DisplayFor(modelItem => item.Check)</td>
</tr>
}
</tbody>
</table>
</div>
| @using CRP.Controllers
@using Microsoft.Web.Mvc
@model IEnumerable<CRP.Core.Domain.Transaction>
<div class="tab-pane" id="Notifications">
<table id="table-Notifications" class="table table-bordered">
<thead>
<tr>
<th></th>
<th>Transaction</th>
<th>Notified</th>
<th>Notified Date</th>
<th>Paid</th>
<th>TotalPaid</th>
<th>Check</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Where(a => a.ParentTransaction == null && a.IsActive && (a.Paid || a.Notified)))
{
<tr>
<td>
@using (Html.BeginForm<TransactionController>(x => x.SendNotification(item.Id, null, null), FormMethod.Post, new {@class = "display_inline"}))
{
@Html.AntiForgeryToken()
<a href="javascript:;" class="FormSubmit">Send</a>
}
</td>
<td>@Html.DisplayFor(modelItem => item.TransactionNumber)</td>
<td>@Html.DisplayFor(modelItem => item.Notified)</td>
<td>@Html.DisplayFor(modelItem => item.NotifiedDate)</td>
<td>@Html.DisplayFor(modelItem => item.Paid)</td>
<td data-sort="@item.TotalPaid">@string.Format("{0:$#,##0.00;($#,##0.00); }", item.TotalPaid)</td>
<td>@Html.DisplayFor(modelItem => item.Check)</td>
</tr>
}
</tbody>
</table>
</div>
| mit | C# |
b4ec83ec3aaa6471d631b149dccb2b13b3894d31 | Modify AsyncResponseTimeout comment. | jlucansky/Camunda.Api.Client | Camunda.Api.Client/ExternalTask/FetchExternalTasks.cs | Camunda.Api.Client/ExternalTask/FetchExternalTasks.cs |
using System.Collections.Generic;
namespace Camunda.Api.Client.ExternalTask
{
public class FetchExternalTasks
{
/// <summary>
/// Mandatory. The maximum number of tasks to return.
/// </summary>
public int MaxTasks;
/// <summary>
/// Mandatory. The id of the worker on which behalf tasks are fetched. The returned tasks are locked for that worker and can only be completed when providing the same worker id.
/// </summary>
public string WorkerId;
/// <summary>
/// Indicates whether the task should be fetched based on its priority or arbitrarily.
/// </summary>
public bool UsePriority;
/// <summary>
/// The Long Polling timeout in milliseconds. The value cannot be set larger than 1.800.000 milliseconds (corresponds to 30 minutes).
/// </summary>
public long AsyncResponseTimeout;
/// <summary>
/// Array of topic objects for which external tasks should be fetched. The returned tasks may be arbitrarily distributed among these topics.
/// </summary>
public List<FetchExternalTaskTopic> Topics;
}
}
|
using System.Collections.Generic;
namespace Camunda.Api.Client.ExternalTask
{
public class FetchExternalTasks
{
/// <summary>
/// Mandatory. The maximum number of tasks to return.
/// </summary>
public int MaxTasks;
/// <summary>
/// Mandatory. The id of the worker on which behalf tasks are fetched. The returned tasks are locked for that worker and can only be completed when providing the same worker id.
/// </summary>
public string WorkerId;
/// <summary>
/// Indicates whether the task should be fetched based on its priority or arbitrarily.
/// </summary>
public bool UsePriority;
/// <summary>
/// Response timeout for long polling
/// </summary>
public long AsyncResponseTimeout;
/// <summary>
/// Array of topic objects for which external tasks should be fetched. The returned tasks may be arbitrarily distributed among these topics.
/// </summary>
public List<FetchExternalTaskTopic> Topics;
}
}
| mit | C# |
83925f8ca2bc05e41909b4256a2d9d1b40b41080 | Add ApiException that takes a message | appharbor/appharbor-cli | src/AppHarbor/ApiException.cs | src/AppHarbor/ApiException.cs | using System;
namespace AppHarbor
{
public class ApiException : Exception
{
public ApiException()
{
}
public ApiException(string message)
: base(message)
{
}
}
}
| using System;
namespace AppHarbor
{
public class ApiException : Exception
{
public ApiException()
{
}
}
}
| mit | C# |
52466d54a36fb9e927a954baec4dc06840d8c6d5 | Add FallBackFeeRate for RegTest (estimatefee always fails there) | DanGould/NTumbleBit,NTumbleBit/NTumbleBit | NTumbleBit.TumblerServer/Services/ExternalServices.cs | NTumbleBit.TumblerServer/Services/ExternalServices.cs | using NBitcoin.RPC;
#if !CLIENT
using NTumbleBit.TumblerServer.Services.RPCServices;
#else
using NTumbleBit.Client.Tumbler.Services.RPCServices;
#endif
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
#if !CLIENT
namespace NTumbleBit.TumblerServer.Services
#else
namespace NTumbleBit.Client.Tumbler.Services
#endif
{
public class ExternalServices
{
public static ExternalServices CreateFromRPCClient(RPCClient rpc, IRepository repository)
{
var info = rpc.SendCommand(RPCOperations.getinfo);
var minimumRate = new NBitcoin.FeeRate(NBitcoin.Money.Coins((decimal)(double)((Newtonsoft.Json.Linq.JValue)(info.Result["relayfee"])).Value), 1000);
ExternalServices service = new ExternalServices();
service.FeeService = new RPCFeeService(rpc) {
MinimumFeeRate = minimumRate
};
// on regtest the estimatefee always fails
if (rpc.Network == NBitcoin.Network.RegTest)
{
service.FeeService = new RPCFeeService(rpc)
{
MinimumFeeRate = minimumRate,
FallBackFeeRate = new NBitcoin.FeeRate(NBitcoin.Money.Satoshis(50), 1)
};
}
service.WalletService = new RPCWalletService(rpc);
service.BroadcastService = new RPCBroadcastService(rpc, repository);
service.BlockExplorerService = new RPCBlockExplorerService(rpc);
service.TrustedBroadcastService = new RPCTrustedBroadcastService(rpc, service.BroadcastService, service.BlockExplorerService, repository)
{
//BlockExplorer will already track the addresses, since they used a shared bitcoind, no need of tracking again (this would overwrite labels)
TrackPreviousScriptPubKey = false
};
return service;
}
public IFeeService FeeService
{
get; set;
}
public IWalletService WalletService
{
get; set;
}
public IBroadcastService BroadcastService
{
get; set;
}
public IBlockExplorerService BlockExplorerService
{
get; set;
}
public ITrustedBroadcastService TrustedBroadcastService
{
get; set;
}
}
}
| using NBitcoin.RPC;
#if !CLIENT
using NTumbleBit.TumblerServer.Services.RPCServices;
#else
using NTumbleBit.Client.Tumbler.Services.RPCServices;
#endif
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
#if !CLIENT
namespace NTumbleBit.TumblerServer.Services
#else
namespace NTumbleBit.Client.Tumbler.Services
#endif
{
public class ExternalServices
{
public static ExternalServices CreateFromRPCClient(RPCClient rpc, IRepository repository)
{
var info = rpc.SendCommand(RPCOperations.getinfo);
var minimumRate = new NBitcoin.FeeRate(NBitcoin.Money.Coins((decimal)(double)((Newtonsoft.Json.Linq.JValue)(info.Result["relayfee"])).Value), 1000);
ExternalServices service = new ExternalServices();
service.FeeService = new RPCFeeService(rpc) {
MinimumFeeRate = minimumRate
};
service.WalletService = new RPCWalletService(rpc);
service.BroadcastService = new RPCBroadcastService(rpc, repository);
service.BlockExplorerService = new RPCBlockExplorerService(rpc);
service.TrustedBroadcastService = new RPCTrustedBroadcastService(rpc, service.BroadcastService, service.BlockExplorerService, repository)
{
//BlockExplorer will already track the addresses, since they used a shared bitcoind, no need of tracking again (this would overwrite labels)
TrackPreviousScriptPubKey = false
};
return service;
}
public IFeeService FeeService
{
get; set;
}
public IWalletService WalletService
{
get; set;
}
public IBroadcastService BroadcastService
{
get; set;
}
public IBlockExplorerService BlockExplorerService
{
get; set;
}
public ITrustedBroadcastService TrustedBroadcastService
{
get; set;
}
}
}
| mit | C# |
950602b7b23e3412cff6ce38ae7c1ab7982494bf | fix missing theory attribute | mruhul/Bolt.Common.Extensions | src/Bolt.Common.Extensions.UnitTests/NullSafeExtensionsTests.cs | src/Bolt.Common.Extensions.UnitTests/NullSafeExtensionsTests.cs | using Xunit;
using Shouldly;
namespace Bolt.Common.Extensions.UnitTests
{
public class NullSafeExtensionsTests
{
[Theory]
[InlineData(null, 0)]
[InlineData(1, 1)]
public void NullIntTests(int? source, int expectedValue)
{
source.NullSafe().ShouldBe(expectedValue);
}
[Theory]
[InlineData(null, 1, 1)]
[InlineData(2, 1, 2)]
public void ValueOrDefaultTests(int? source, int defaultValue, int expectedValue)
{
source.NullSafe(defaultValue).ShouldBe(expectedValue);
}
[Theory]
[InlineData(null, false)]
[InlineData(true, true)]
[InlineData(false, false)]
public void NullBoolTests(bool? source, bool expectedValue)
{
source.NullSafe().ShouldBe(expectedValue);
}
[Theory]
[InlineData(null, Color.None)]
[InlineData(Color.Red, Color.Red)]
public void NullEnumTests(Color? source, Color expectedValue)
{
source.NullSafe().ShouldBe(expectedValue);
}
}
} | using Xunit;
using Shouldly;
namespace Bolt.Common.Extensions.UnitTests
{
public class NullSafeExtensionsTests
{
[InlineData(null, 0)]
[InlineData(1, 1)]
public void NullIntTests(int? source, int expectedValue)
{
source.NullSafe().ShouldBe(expectedValue);
}
[InlineData(null, 1, 1)]
[InlineData(2, 1, 2)]
public void ValueOrDefaultTests(int? source, int defaultValue, int expectedValue)
{
source.NullSafe(defaultValue).ShouldBe(expectedValue);
}
[InlineData(null, false)]
[InlineData(true, true)]
[InlineData(false, false)]
public void NullBoolTests(bool? source, bool expectedValue)
{
source.NullSafe().ShouldBe(expectedValue);
}
[InlineData(null, Color.None)]
[InlineData(Color.Red, Color.Red)]
public void NullEnumTests(Color? source, Color expectedValue)
{
source.NullSafe().ShouldBe(expectedValue);
}
}
} | mit | C# |
a38ddec6bc1cec5f82b16307bcac35014dd2ba76 | Add Cache-Control header to project files | GeorgDangl/WebDocu,GeorgDangl/WebDocu,GeorgDangl/WebDocu | src/Dangl.WebDocumentation/Controllers/ProjectsController.cs | src/Dangl.WebDocumentation/Controllers/ProjectsController.cs | using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Dangl.WebDocumentation.Models;
using Dangl.WebDocumentation.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
namespace Dangl.WebDocumentation.Controllers
{
public class ProjectsController : Controller
{
private readonly IProjectFilesService _projectFilesService;
private readonly IProjectsService _projectsService;
private readonly UserManager<ApplicationUser> _userManager;
public ProjectsController(UserManager<ApplicationUser> userManager,
IProjectFilesService projectFilesService,
IProjectsService projectsService)
{
_projectFilesService = projectFilesService;
_projectsService = projectsService;
_userManager = userManager;
}
/// <summary>
/// Returns a requested file for the project if the user has access or the project is public.
/// </summary>
/// <param name="projectName"></param>
/// <param name="pathToFile"></param>
/// <returns></returns>
[HttpGet]
[Route("Projects/{projectName}/{version}/{*pathToFile}")]
public async Task<IActionResult> GetFile(string projectName, string version, string pathToFile)
{
var userId = _userManager.GetUserId(User);
var hasProjectAccess = await _projectsService.UserHasAccessToProject(projectName, userId);
if (!hasProjectAccess)
{
// HttpNotFound for either the project not existing or the user not having access
return NotFound();
}
var projectFile = await _projectFilesService.GetFileForProject(projectName, version, pathToFile);
if (projectFile == null)
{
return NotFound();
}
Response.Headers.Add("Cache-Control", new Microsoft.Extensions.Primitives.StringValues("max-age=604800"));
return File(projectFile.FileStream, projectFile.MimeType);
}
}
}
| using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Dangl.WebDocumentation.Models;
using Dangl.WebDocumentation.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
namespace Dangl.WebDocumentation.Controllers
{
public class ProjectsController : Controller
{
private readonly IProjectFilesService _projectFilesService;
private readonly IProjectsService _projectsService;
private readonly UserManager<ApplicationUser> _userManager;
public ProjectsController(UserManager<ApplicationUser> userManager,
IProjectFilesService projectFilesService,
IProjectsService projectsService)
{
_projectFilesService = projectFilesService;
_projectsService = projectsService;
_userManager = userManager;
}
/// <summary>
/// Returns a requested file for the project if the user has access or the project is public.
/// </summary>
/// <param name="projectName"></param>
/// <param name="pathToFile"></param>
/// <returns></returns>
[HttpGet]
[Route("Projects/{projectName}/{version}/{*pathToFile}")]
public async Task<IActionResult> GetFile(string projectName, string version, string pathToFile)
{
var userId = _userManager.GetUserId(User);
var hasProjectAccess = await _projectsService.UserHasAccessToProject(projectName, userId);
if (!hasProjectAccess)
{
// HttpNotFound for either the project not existing or the user not having access
return NotFound();
}
var projectFile = await _projectFilesService.GetFileForProject(projectName, version, pathToFile);
if (projectFile == null)
{
return NotFound();
}
return File(projectFile.FileStream, projectFile.MimeType);
}
}
}
| mit | C# |
53e63b347b1e6e36720d262940500b21ed1408ce | remove unnecessary using | pocketberserker/MessagePack.FSharpExtensions | src/MessagePack.FSharpExtensions/Formatters/UnitFormatter.cs | src/MessagePack.FSharpExtensions/Formatters/UnitFormatter.cs | using MessagePack.Formatters;
using Microsoft.FSharp.Core;
namespace MessagePack.FSharp.Formatters
{
public class UnitFormatter : IMessagePackFormatter<Unit>
{
public UnitFormatter() { }
public int Serialize(ref byte[] bytes, int offset, Unit value, IFormatterResolver formatterResolver)
{
return MessagePackBinary.WriteNil(ref bytes, offset);
}
public Unit Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
{
MessagePackBinary.ReadNil(bytes, offset, out readSize);
return null;
}
}
}
| using System;
using MessagePack.Formatters;
using Microsoft.FSharp.Core;
namespace MessagePack.FSharp.Formatters
{
public class UnitFormatter : IMessagePackFormatter<Unit>
{
public UnitFormatter() { }
public int Serialize(ref byte[] bytes, int offset, Unit value, IFormatterResolver formatterResolver)
{
return MessagePackBinary.WriteNil(ref bytes, offset);
}
public Unit Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
{
MessagePackBinary.ReadNil(bytes, offset, out readSize);
return null;
}
}
}
| mit | C# |
3b7a54f10d11c2269e9d187e4e5db3e21c84b408 | Update Shapes.cs | sfmskywalker/Orchard,bedegaming-aleksej/Orchard,Lombiq/Orchard,tobydodds/folklife,OrchardCMS/Orchard,OrchardCMS/Orchard,AdvantageCS/Orchard,Fogolan/OrchardForWork,jtkech/Orchard,xkproject/Orchard,hannan-azam/Orchard,jchenga/Orchard,ehe888/Orchard,yersans/Orchard,tobydodds/folklife,mvarblow/Orchard,abhishekluv/Orchard,abhishekluv/Orchard,Lombiq/Orchard,LaserSrl/Orchard,johnnyqian/Orchard,gcsuk/Orchard,LaserSrl/Orchard,yersans/Orchard,yersans/Orchard,brownjordaninternational/OrchardCMS,johnnyqian/Orchard,fassetar/Orchard,phillipsj/Orchard,Codinlab/Orchard,hbulzy/Orchard,gcsuk/Orchard,Serlead/Orchard,jchenga/Orchard,vairam-svs/Orchard,jchenga/Orchard,hannan-azam/Orchard,ehe888/Orchard,jimasp/Orchard,brownjordaninternational/OrchardCMS,fassetar/Orchard,jtkech/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,fassetar/Orchard,johnnyqian/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,SouleDesigns/SouleDesigns.Orchard,aaronamm/Orchard,jagraz/Orchard,brownjordaninternational/OrchardCMS,AdvantageCS/Orchard,Praggie/Orchard,rtpHarry/Orchard,hbulzy/Orchard,sfmskywalker/Orchard,phillipsj/Orchard,omidnasri/Orchard,rtpHarry/Orchard,grapto/Orchard.CloudBust,AdvantageCS/Orchard,AdvantageCS/Orchard,LaserSrl/Orchard,sfmskywalker/Orchard,LaserSrl/Orchard,aaronamm/Orchard,omidnasri/Orchard,mvarblow/Orchard,xkproject/Orchard,rtpHarry/Orchard,mvarblow/Orchard,bedegaming-aleksej/Orchard,li0803/Orchard,jchenga/Orchard,xkproject/Orchard,jimasp/Orchard,bedegaming-aleksej/Orchard,armanforghani/Orchard,aaronamm/Orchard,tobydodds/folklife,grapto/Orchard.CloudBust,tobydodds/folklife,gcsuk/Orchard,jtkech/Orchard,omidnasri/Orchard,Dolphinsimon/Orchard,omidnasri/Orchard,OrchardCMS/Orchard,omidnasri/Orchard,johnnyqian/Orchard,Dolphinsimon/Orchard,jagraz/Orchard,omidnasri/Orchard,Codinlab/Orchard,li0803/Orchard,jersiovic/Orchard,fassetar/Orchard,Serlead/Orchard,rtpHarry/Orchard,Praggie/Orchard,bedegaming-aleksej/Orchard,SouleDesigns/SouleDesigns.Orchard,phillipsj/Orchard,jtkech/Orchard,grapto/Orchard.CloudBust,SouleDesigns/SouleDesigns.Orchard,Serlead/Orchard,xkproject/Orchard,gcsuk/Orchard,tobydodds/folklife,Serlead/Orchard,sfmskywalker/Orchard,jtkech/Orchard,li0803/Orchard,OrchardCMS/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,jersiovic/Orchard,abhishekluv/Orchard,grapto/Orchard.CloudBust,fassetar/Orchard,Lombiq/Orchard,Praggie/Orchard,grapto/Orchard.CloudBust,Lombiq/Orchard,li0803/Orchard,mvarblow/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,jimasp/Orchard,yersans/Orchard,ehe888/Orchard,omidnasri/Orchard,IDeliverable/Orchard,vairam-svs/Orchard,vairam-svs/Orchard,armanforghani/Orchard,johnnyqian/Orchard,IDeliverable/Orchard,Praggie/Orchard,sfmskywalker/Orchard,phillipsj/Orchard,abhishekluv/Orchard,vairam-svs/Orchard,Serlead/Orchard,hannan-azam/Orchard,mvarblow/Orchard,sfmskywalker/Orchard,phillipsj/Orchard,hbulzy/Orchard,tobydodds/folklife,IDeliverable/Orchard,LaserSrl/Orchard,Fogolan/OrchardForWork,Dolphinsimon/Orchard,AdvantageCS/Orchard,OrchardCMS/Orchard,ehe888/Orchard,armanforghani/Orchard,jimasp/Orchard,bedegaming-aleksej/Orchard,jagraz/Orchard,vairam-svs/Orchard,aaronamm/Orchard,armanforghani/Orchard,jersiovic/Orchard,aaronamm/Orchard,hannan-azam/Orchard,jchenga/Orchard,Dolphinsimon/Orchard,ehe888/Orchard,Codinlab/Orchard,xkproject/Orchard,jersiovic/Orchard,Praggie/Orchard,Dolphinsimon/Orchard,Codinlab/Orchard,omidnasri/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard,hannan-azam/Orchard,jagraz/Orchard,jimasp/Orchard,brownjordaninternational/OrchardCMS,Fogolan/OrchardForWork,brownjordaninternational/OrchardCMS,Lombiq/Orchard,jersiovic/Orchard,jagraz/Orchard,Fogolan/OrchardForWork,yersans/Orchard,SouleDesigns/SouleDesigns.Orchard,Codinlab/Orchard,sfmskywalker/Orchard,Fogolan/OrchardForWork,omidnasri/Orchard,abhishekluv/Orchard,IDeliverable/Orchard,IDeliverable/Orchard,abhishekluv/Orchard,grapto/Orchard.CloudBust,armanforghani/Orchard,gcsuk/Orchard,li0803/Orchard,hbulzy/Orchard,rtpHarry/Orchard,hbulzy/Orchard,dmitry-urenev/extended-orchard-cms-v10.1 | src/Orchard.Web/Modules/Orchard.Lists/Shapes.cs | src/Orchard.Web/Modules/Orchard.Lists/Shapes.cs | using System;
using Orchard.ContentManagement;
using Orchard.Core.Containers.Models;
using Orchard.Core.Containers.Services;
using Orchard.DisplayManagement.Descriptors;
using Orchard.Environment;
namespace Orchard.Lists {
public class Shapes : IShapeTableProvider {
private readonly Work<IContainerService> _containerService;
public Shapes(Work<IContainerService> containerService) {
_containerService = containerService;
}
public void Discover(ShapeTableBuilder builder) {
builder.Describe("Breadcrumbs_ContentItem").OnDisplaying(context => {
// The breadcrumbs shape needs access to its items' containers latest version,
// instead of the published version as implemented by CommonPart.Container's lazyload handler.
// Instead of having this logic embedded in the view, we'll simply provide a pointer to it.
context.Shape.ContainerAccessor = (Func<IContent, IContent>) (content => _containerService.Value.GetContainer(content, VersionOptions.Latest));
});
builder.Describe("ListNavigation").OnDisplaying(context => {
var containable = (ContainablePart) context.Shape.ContainablePart;
var container = _containerService.Value.GetContainer(containable, VersionOptions.Latest);
if (container == null) return;
var previous = _containerService.Value.Previous(container.Id, containable);
var next = _containerService.Value.Next(container.Id, containable);
context.Shape.Previous(previous);
context.Shape.Next(next);
});
}
}
}
| using System;
using Orchard.ContentManagement;
using Orchard.Core.Containers.Models;
using Orchard.Core.Containers.Services;
using Orchard.DisplayManagement.Descriptors;
using Orchard.Environment;
namespace Orchard.Lists {
public class Shapes : IShapeTableProvider {
private readonly Work<IContainerService> _containerService;
public Shapes(Work<IContainerService> containerService) {
_containerService = containerService;
}
public void Discover(ShapeTableBuilder builder) {
builder.Describe("Breadcrumbs_ContentItem").OnDisplaying(context => {
// The breadcrumbs shape needs access to its items' containers latest version,
// instead of the published version as implemented by CommonPart.Container's lazyload handler.
// Instead of having this logic embedded in the view, we'll simply provide a pointer to it.
context.Shape.ContainerAccessor = (Func<IContent, IContent>) (content => _containerService.Value.GetContainer(content, VersionOptions.Latest));
});
builder.Describe("ListNavigation").OnDisplaying(context => {
var containable = (ContainablePart) context.Shape.ContainablePart;
var container = _containerService.Value.GetContainer(containable, VersionOptions.Latest);
var previous = _containerService.Value.Previous(container.Id, containable);
var next = _containerService.Value.Next(container.Id, containable);
context.Shape.Previous(previous);
context.Shape.Next(next);
});
}
}
} | bsd-3-clause | C# |
f1c89e033492f972c3346de0ebb14007b935c443 | Remove resharper comment (bug fixed in R#) | kirillkos/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net | Joinrpg/Helpers/MarkDownHelper.cs | Joinrpg/Helpers/MarkDownHelper.cs | using System;
using System.Web;
using CommonMark;
using JoinRpg.DataModel;
using Vereyon.Web;
namespace JoinRpg.Web.Helpers
{
public static class MarkDownHelper
{
private static readonly Lazy<HtmlSanitizer> SimpleHtml5SanitizerImpl = new Lazy<HtmlSanitizer>(HtmlSanitizer.SimpleHtml5Sanitizer);
private static HtmlSanitizer Sanitizer => SimpleHtml5SanitizerImpl.Value;
/// <summary>
/// Converts markdown to HtmlString with all sanitization
/// </summary>
public static HtmlString ToHtmlString(this MarkdownString markdownString)
{
return markdownString?.Contents == null ? null : new HtmlString(Convert(markdownString));
}
private static string Convert(MarkdownString markdownString)
{
var settings = CommonMarkSettings.Default.Clone();
settings.RenderSoftLineBreaksAsLineBreaks = true;
return Sanitizer.Sanitize(CommonMarkConverter.Convert(markdownString.Contents, settings));
}
}
}
| using System;
using System.Web;
using CommonMark;
using JoinRpg.DataModel;
using Vereyon.Web;
namespace JoinRpg.Web.Helpers
{
public static class MarkDownHelper
{
private static readonly Lazy<HtmlSanitizer> SimpleHtml5SanitizerImpl = new Lazy<HtmlSanitizer>(HtmlSanitizer.SimpleHtml5Sanitizer);
private static HtmlSanitizer Sanitizer => SimpleHtml5SanitizerImpl.Value;
/// <summary>
/// Converts markdown to HtmlString with all sanitization
/// </summary>
public static HtmlString ToHtmlString(this MarkdownString markdownString)
{
return markdownString?.Contents == null ? null : new HtmlString(Convert(markdownString));
}
// ReSharper disable once UnusedParameter.Local Reshaper are wrong here
private static string Convert(MarkdownString markdownString)
{
var settings = CommonMarkSettings.Default.Clone();
settings.RenderSoftLineBreaksAsLineBreaks = true;
return Sanitizer.Sanitize(CommonMarkConverter.Convert(markdownString.Contents, settings));
}
}
}
| mit | C# |
5ddd70ec786cda2cce58851bc86027c4d5716bd2 | Fix the versioning info | rzhw/Squirrel.Windows,rzhw/Squirrel.Windows | src/Squirrel.Updater/Properties/AssemblyInfo.cs | src/Squirrel.Updater/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("Squirrel.Updater")]
[assembly: AssemblyDescription("Standalone Updater executable for Squirrel, for non-.NET apps")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Squirrel.Updater")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("25af65a4-d009-457b-94cb-c71e1bf0d981")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.4")]
[assembly: AssemblyFileVersion("0.7.4")]
[assembly: AssemblyInformationalVersion("0.7.4")] | 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("Squirrel.Updater")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Squirrel.Updater")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("25af65a4-d009-457b-94cb-c71e1bf0d981")]
// 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# |
c48bc6499381e69cc3163022aa8fe3680272a14f | fix #17 | NFig/NFig | NFig/SettingConverterAttribute.cs | NFig/SettingConverterAttribute.cs | using System;
using System.Linq;
using JetBrains.Annotations;
namespace NFig
{
/// <summary>
/// Used to mark individual settings as using a specific converter.
/// </summary>
public class SettingConverterAttribute : Attribute
{
/// <summary>
/// The converter object. It will implement <see cref="ISettingConverter{TValue}"/> where TValue is the property type of the setting.
/// </summary>
public ISettingConverter Converter { get; }
/// <summary>
/// Explicitly assigns a converter to a specific setting. If you want a converter to automatically apply to any setting of a particular type, pass the
/// converter as part of the "additionalDefaultConverters" argument to the NFigStore you're using.
/// </summary>
/// <param name="converterType">The type must implement <see cref="ISettingConverter{TValue}"/> where TValue is the property type of the setting.</param>
public SettingConverterAttribute(Type converterType)
{
ValidateConverterType(converterType);
Converter = (ISettingConverter)Activator.CreateInstance(converterType);
}
/// <summary>
/// Explicitly assigns a converter to a specific setting. If you want a converter to automatically apply to any setting of a particular type, pass the
/// converter as part of the "additionalDefaultConverters" argument to the NFigStore you're using.
/// </summary>
/// <param name="converter">
/// An instance of <see cref="ISettingConverter"/>. The concrete type must implement <see cref="ISettingConverter{TValue}"/>
/// where TValue is the property type of the setting.
/// </param>
protected SettingConverterAttribute([NotNull] ISettingConverter converter)
{
if (converter == null)
{
throw new ArgumentNullException(nameof(converter));
}
ValidateConverterType(converter.GetType());
Converter = converter;
}
static void ValidateConverterType(Type converterType)
{
// make sure type implements SettingsConverter<>
var genericType = typeof(ISettingConverter<>);
if (!converterType.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == genericType))
{
throw new InvalidOperationException($"Cannot use type {converterType.Name} as a setting converter. It does not implement ISettingConverter<T>.");
}
}
}
} | using System;
using System.Linq;
namespace NFig
{
/// <summary>
/// Used to mark individual settings as using a specific converter.
/// </summary>
public class SettingConverterAttribute : Attribute
{
/// <summary>
/// The converter object. It will implement <see cref="ISettingConverter{TValue}"/> where TValue is the property type of the setting.
/// </summary>
public ISettingConverter Converter { get; private set; }
/// <summary>
/// Explicitly assigns a converter to a specific setting. If you want a converter to automatically apply to any setting of a particular type, pass the
/// converter as part of the "additionalDefaultConverters" argument to the NFigStore you're using.
/// </summary>
/// <param name="converterType">The type must implement <see cref="ISettingConverter{TValue}"/> where TValue is the property type of the setting.</param>
public SettingConverterAttribute(Type converterType)
{
// make sure type implements SettingsConverter<>
var genericType = typeof(ISettingConverter<>);
if (!converterType.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == genericType))
{
throw new InvalidOperationException($"Cannot use type {converterType.Name} as a setting converter. It does not implement ISettingConverter<T>.");
}
Converter = (ISettingConverter)Activator.CreateInstance(converterType);
}
}
} | mit | C# |
535ad09a57cc22f473d7f75df292dd8a96082304 | Add check for Mono for LogicalCallContext | criteo/zipkin4net,criteo/zipkin4net | Criteo.Profiling.Tracing/TraceContext.cs | Criteo.Profiling.Tracing/TraceContext.cs | using System;
using System.Runtime.Remoting.Messaging;
namespace Criteo.Profiling.Tracing
{
internal static class TraceContext
{
private const string TraceCallContextKey = "crto_trace";
private static readonly bool IsRunningOnMono = (Type.GetType("Mono.Runtime") != null);
public static Trace Get()
{
if (IsRunningOnMono) return null;
return CallContext.LogicalGetData(TraceCallContextKey) as Trace;
}
public static void Set(Trace trace)
{
if (IsRunningOnMono) return;
CallContext.LogicalSetData(TraceCallContextKey, trace);
}
public static void Clear()
{
if (IsRunningOnMono) return;
CallContext.FreeNamedDataSlot(TraceCallContextKey);
}
}
}
| using System.Runtime.Remoting.Messaging;
namespace Criteo.Profiling.Tracing
{
internal static class TraceContext
{
private const string TraceCallContextKey = "crto_trace";
public static Trace Get()
{
return CallContext.LogicalGetData(TraceCallContextKey) as Trace;
}
public static void Set(Trace trace)
{
CallContext.LogicalSetData(TraceCallContextKey, trace);
}
public static void Clear()
{
CallContext.FreeNamedDataSlot(TraceCallContextKey);
}
}
}
| apache-2.0 | C# |
87e59ad885a1374508cd89187d3512cac0c01922 | Bump version number to 1.2.0.0. | da2x/EdgeDeflector | EdgeDeflector/Properties/AssemblyInfo.cs | EdgeDeflector/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("EdgeDeflector")]
[assembly: AssemblyDescription("Open MICROSOFT-EDGE:// links in your default web browser.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EdgeDeflector")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[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("64e191bc-e8ce-4190-939e-c77a75aa0e28")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Maintenance Number
// Build Number
//
// 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")]
| 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("EdgeDeflector")]
[assembly: AssemblyDescription("Open MICROSOFT-EDGE:// links in your default web browser.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EdgeDeflector")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[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("64e191bc-e8ce-4190-939e-c77a75aa0e28")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Maintenance Number
// Build Number
//
// 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.1.3.0")]
[assembly: AssemblyFileVersion("1.1.3.0")]
| mit | C# |
1b43c3db4179736d57225fdc27523a901d3d4ece | Update copyright year. | ollyau/FSActiveFires | FSActiveFires/Properties/AssemblyInfo.cs | FSActiveFires/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FSActiveFires")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FSActiveFires")]
[assembly: AssemblyCopyright("Copyright © Orion Lyau 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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.7.0")]
[assembly: AssemblyFileVersion("0.1.7.0")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FSActiveFires")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FSActiveFires")]
[assembly: AssemblyCopyright("Copyright © Orion Lyau 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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.7.0")]
[assembly: AssemblyFileVersion("0.1.7.0")]
| mit | C# |
87d36ae5168f48976f7c960a1e5db5be64ed4075 | Fix a TrackableContainerTrackerJsonConverter bug | SaladbowlCreative/TrackableData,SaladLab/TrackableData,SaladbowlCreative/TrackableData,SaladLab/TrackableData | core/TrackableData-Json/TrackableContainerTrackerJsonConverter.cs | core/TrackableData-Json/TrackableContainerTrackerJsonConverter.cs | using System;
using System.Reflection;
using Newtonsoft.Json;
namespace TrackableData.Json
{
public class TrackableContainerTrackerJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(IContainerTracker).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
JsonSerializer serializer)
{
if (reader.TokenType != JsonToken.StartObject)
return null;
var tracker = (ITracker)Activator.CreateInstance(objectType);
reader.Read();
while (true)
{
if (reader.TokenType != JsonToken.PropertyName)
break;
var pi = objectType.GetProperty((string)reader.Value + "Tracker");
reader.Read();
var subTracker = serializer.Deserialize(reader, pi.PropertyType);
reader.Read();
pi.SetValue(tracker, subTracker);
}
return tracker;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var tracker = (ITracker)value;
writer.WriteStartObject();
foreach (var pi in value.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
if (typeof(ITracker).IsAssignableFrom(pi.PropertyType) == false)
continue;
var subTracker = (ITracker)pi.GetValue(value);
if (subTracker != null && subTracker.HasChange)
{
writer.WritePropertyName(pi.Name.Substring(0, pi.Name.Length - 7));
serializer.Serialize(writer, subTracker);
}
}
writer.WriteEndObject();
}
}
}
| using System;
using System.Reflection;
using Newtonsoft.Json;
namespace TrackableData.Json
{
public class TrackableContainerTrackerJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(IContainerTracker).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
JsonSerializer serializer)
{
if (reader.TokenType != JsonToken.StartObject)
return null;
var tracker = (ITracker)Activator.CreateInstance(objectType);
reader.Read();
while (true)
{
if (reader.TokenType != JsonToken.PropertyName)
break;
var pi = objectType.GetField((string)reader.Value + "Tracker");
reader.Read();
var subTracker = serializer.Deserialize(reader, pi.FieldType);
reader.Read();
pi.SetValue(tracker, subTracker);
}
return tracker;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var tracker = (ITracker)value;
writer.WriteStartObject();
foreach (var fieldType in value.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public))
{
if (typeof(ITracker).IsAssignableFrom(fieldType.FieldType) == false)
continue;
var subTracker = (ITracker)fieldType.GetValue(value);
if (subTracker != null && subTracker.HasChange)
{
writer.WritePropertyName(fieldType.Name.Substring(0, fieldType.Name.Length - 7));
serializer.Serialize(writer, subTracker);
}
}
writer.WriteEndObject();
}
}
}
| mit | C# |
cf5dcaa368fab62da89bcda6f0ae1debdd3d0730 | Update CubicBezierDrawNode.cs | wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D/Modules/Renderer/SkiaSharp/Nodes/CubicBezierDrawNode.cs | src/Core2D/Modules/Renderer/SkiaSharp/Nodes/CubicBezierDrawNode.cs | #nullable enable
using Core2D.Model.Renderer;
using Core2D.Model.Renderer.Nodes;
using Core2D.ViewModels.Shapes;
using Core2D.ViewModels.Style;
using SkiaSharp;
namespace Core2D.Modules.Renderer.SkiaSharp.Nodes;
internal class CubicBezierDrawNode : DrawNode, ICubicBezierDrawNode
{
public CubicBezierShapeViewModel CubicBezier { get; set; }
public SKPath? Geometry { get; set; }
public CubicBezierDrawNode(CubicBezierShapeViewModel cubicBezier, ShapeStyleViewModel? style)
{
Style = style;
CubicBezier = cubicBezier;
UpdateGeometry();
}
public sealed override void UpdateGeometry()
{
ScaleThickness = CubicBezier.State.HasFlag(ShapeStateFlags.Thickness);
ScaleSize = CubicBezier.State.HasFlag(ShapeStateFlags.Size);
Geometry = PathGeometryConverter.ToSKPath(CubicBezier);
if (Geometry is { })
{
Center = new SKPoint(Geometry.Bounds.MidX, Geometry.Bounds.MidY);
}
else
{
Center = SKPoint.Empty;
}
}
public override void OnDraw(object? dc, double zoom)
{
if (dc is not SKCanvas canvas)
{
return;
}
if (CubicBezier.IsFilled)
{
canvas.DrawPath(Geometry, Fill);
}
if (CubicBezier.IsStroked)
{
canvas.DrawPath(Geometry, Stroke);
}
}
}
| #nullable enable
using Core2D.Model.Renderer;
using Core2D.Model.Renderer.Nodes;
using Core2D.ViewModels.Shapes;
using Core2D.ViewModels.Style;
using SkiaSharp;
namespace Core2D.Modules.Renderer.SkiaSharp.Nodes;
internal class CubicBezierDrawNode : DrawNode, ICubicBezierDrawNode
{
public CubicBezierShapeViewModel CubicBezier { get; set; }
public SKPath? Geometry { get; set; }
public CubicBezierDrawNode(CubicBezierShapeViewModel cubicBezier, ShapeStyleViewModel style)
{
Style = style;
CubicBezier = cubicBezier;
UpdateGeometry();
}
public sealed override void UpdateGeometry()
{
ScaleThickness = CubicBezier.State.HasFlag(ShapeStateFlags.Thickness);
ScaleSize = CubicBezier.State.HasFlag(ShapeStateFlags.Size);
Geometry = PathGeometryConverter.ToSKPath(CubicBezier);
if (Geometry is { })
{
Center = new SKPoint(Geometry.Bounds.MidX, Geometry.Bounds.MidY);
}
else
{
Center = SKPoint.Empty;
}
}
public override void OnDraw(object? dc, double zoom)
{
if (dc is not SKCanvas canvas)
{
return;
}
if (CubicBezier.IsFilled)
{
canvas.DrawPath(Geometry, Fill);
}
if (CubicBezier.IsStroked)
{
canvas.DrawPath(Geometry, Stroke);
}
}
}
| mit | C# |
a158a11cab93c5cc31e064f1f5ccb784eff2280b | Add [Serializable] attribute | dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute | Source/NSubstitute/Exceptions/ArgumentIsNotOutOrRefException.cs | Source/NSubstitute/Exceptions/ArgumentIsNotOutOrRefException.cs | using System;
using System.Runtime.Serialization;
namespace NSubstitute.Exceptions
{
[Serializable]
public class ArgumentIsNotOutOrRefException : SubstituteException
{
const string WhatProbablyWentWrong = "Could not set argument {0} ({1}) as it is not an out or ref argument.";
public ArgumentIsNotOutOrRefException(int argumentIndex, Type argumentType) : base(string.Format(WhatProbablyWentWrong, argumentIndex, argumentType.Name)) { }
protected ArgumentIsNotOutOrRefException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
| using System;
using System.Runtime.Serialization;
namespace NSubstitute.Exceptions
{
public class ArgumentIsNotOutOrRefException : SubstituteException
{
const string WhatProbablyWentWrong = "Could not set argument {0} ({1}) as it is not an out or ref argument.";
public ArgumentIsNotOutOrRefException(int argumentIndex, Type argumentType) : base(string.Format(WhatProbablyWentWrong, argumentIndex, argumentType.Name)) { }
protected ArgumentIsNotOutOrRefException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
} | bsd-3-clause | C# |
28537a51a3b175313d1053a7ad8bf7b5fc68e343 | Update UsingDefaultCache.cs | NMSLanX/Natasha | src/Natasha/Core/Engine/ScriptModule/Template/UsingDefaultCache.cs | src/Natasha/Core/Engine/ScriptModule/Template/UsingDefaultCache.cs | using Microsoft.Extensions.DependencyModel;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
namespace Natasha.Template
{
public static class UsingDefaultCache
{
public readonly static HashSet<string> DefaultNamesapce;
public readonly static StringBuilder DefaultScript;
static UsingDefaultCache()
{
DefaultScript = new StringBuilder();
DefaultNamesapce = new HashSet<string>();
var assemblyNames = DependencyContext.Default.GetDefaultAssemblyNames();
foreach (var name in assemblyNames)
{
var assembly = Assembly.Load(name);
if (assembly.FullName.Contains("System.Runtime.WindowsRuntime"))
{
continue;
}
if (assembly != default)
{
var types = assembly.ExportedTypes;
foreach (var item in types)
{
if (!DefaultNamesapce.Contains(item.Namespace) && item.Namespace != default)
{
DefaultNamesapce.Add(item.Namespace);
}
}
}
}
var entryTypes = Assembly.GetEntryAssembly().GetTypes();
foreach (var item in entryTypes)
{
if (!DefaultNamesapce.Contains(item.Namespace) && item.Namespace != default)
{
DefaultNamesapce.Add(item.Namespace);
}
}
DefaultNamesapce.Remove("System.Linq.Expressions.Interpreter");
DefaultNamesapce.Remove("System.Net.Internals");
DefaultNamesapce.Remove("System.Xml.Xsl.Runtime");
foreach (var @using in DefaultNamesapce)
{
DefaultScript.AppendLine($"using {@using};");
}
}
}
}
| using Microsoft.Extensions.DependencyModel;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
namespace Natasha.Template
{
public static class UsingDefaultCache
{
public readonly static HashSet<string> DefaultNamesapce;
public readonly static StringBuilder DefaultScript;
static UsingDefaultCache()
{
DefaultScript = new StringBuilder();
DefaultNamesapce = new HashSet<string>();
var assemblyNames = DependencyContext.Default.GetDefaultAssemblyNames();
foreach (var name in assemblyNames)
{
var assembly = Assembly.Load(name);
if (assembly.FullName.Contains("System.Runtime.WindowsRuntime"))
{
continue;
}
if (assembly != default)
{
var types = assembly.ExportedTypes;
foreach (var item in types)
{
if (!DefaultNamesapce.Contains(item.Namespace) && item.Namespace != default)
{
DefaultNamesapce.Add(item.Namespace);
}
}
}
}
DefaultNamesapce.Remove("System.Linq.Expressions.Interpreter");
DefaultNamesapce.Remove("System.Net.Internals");
DefaultNamesapce.Remove("System.Xml.Xsl.Runtime");
foreach (var @using in DefaultNamesapce)
{
DefaultScript.AppendLine($"using {@using};");
}
}
}
}
| mpl-2.0 | C# |
0d25b4ba3d2a4365579bf19b3acf39603935fd1e | fix tests | ThomasPe/PixabaySharp | PixabaySharp.Tests/ClientTests.cs | PixabaySharp.Tests/ClientTests.cs | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using PixabaySharp.Utility;
namespace PixabaySharp.Tests
{
[TestClass]
public class ClientTests
{
[TestMethod]
public async Task BasicTest()
{
var client = new PixabaySharpClient(Utility.ApiCredentials.ApiKey);
var images = await client.SearchAsync("dog");
Assert.IsNotNull(images);
}
[TestMethod]
public async Task QueryImagesTest()
{
var client = new PixabaySharpClient(Utility.ApiCredentials.ApiKey);
var result = await client.QueryImagesAsync(new ImageQueryBuilder()
{
Query = "Dog",
PerPage = 5
});
Assert.AreEqual(result.Images.Count, 5);
result = await client.QueryImagesAsync(new ImageQueryBuilder()
{
Query = "Dog",
PerPage = 15
});
Assert.AreEqual(result.Images.Count, 15);
}
}
}
| using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using PixabaySharp.Utility;
namespace PixabaySharp.Tests
{
[TestClass]
public class ClientTests
{
[TestMethod]
public async Task BasicTest()
{
var client = new PixabaySharpClient(Utility.ApiCredentials.ApiKey);
var images = await client.SearchAsync("dog");
Assert.IsNotNull(images);
}
[TestMethod]
public async Task QueryImagesTest()
{
var client = new PixabaySharpClient(Utility.ApiCredentials.ApiKey);
var result = await client.QueryImagesAsync(new ImageQueryBuilder()
{
Query = "Dog",
PerPage = 5
});
Assert.AreEqual(result.Images.Count, 5);
result = await client.QueryImages(new ImageQueryBuilder()
{
Query = "Dog",
PerPage = 15
});
Assert.AreEqual(result.Images.Count, 15);
}
}
}
| mit | C# |
67fc879a972441132893f743a825c7a5f0e99306 | Add test when IResponse not set | github/VisualStudio,github/VisualStudio,github/VisualStudio | test/GitHub.Exports.UnitTests/ApiExceptionExtensionsTests.cs | test/GitHub.Exports.UnitTests/ApiExceptionExtensionsTests.cs | using System.Collections.Generic;
using System.Collections.Immutable;
using Octokit;
using NSubstitute;
using NUnit.Framework;
using GitHub.Extensions;
public class ApiExceptionExtensionsTests
{
public class TheIsGitHubApiExceptionMethod
{
[TestCase("Not-GitHub-Request-Id", false)]
[TestCase("X-GitHub-Request-Id", true)]
[TestCase("x-github-request-id", true)]
public void NoGitHubRequestId(string key, bool expect)
{
var ex = CreateApiException(new Dictionary<string, string> { { key, "ANYTHING" } });
var result = ApiExceptionExtensions.IsGitHubApiException(ex);
Assert.That(result, Is.EqualTo(expect));
}
[Test]
public void NoResponse()
{
var ex = new ApiException();
var result = ApiExceptionExtensions.IsGitHubApiException(ex);
Assert.That(result, Is.EqualTo(false));
}
static ApiException CreateApiException(Dictionary<string, string> headers)
{
var response = Substitute.For<IResponse>();
response.Headers.Returns(headers.ToImmutableDictionary());
var ex = new ApiException(response);
return ex;
}
}
}
| using System.Collections.Generic;
using System.Collections.Immutable;
using Octokit;
using NSubstitute;
using NUnit.Framework;
using GitHub.Extensions;
public class ApiExceptionExtensionsTests
{
public class TheIsGitHubApiExceptionMethod
{
[TestCase("Not-GitHub-Request-Id", false)]
[TestCase("X-GitHub-Request-Id", true)]
[TestCase("x-github-request-id", true)]
public void NoGitHubRequestId(string key, bool expect)
{
var ex = CreateApiException(new Dictionary<string, string> { { key, "ANYTHING" } });
var result = ApiExceptionExtensions.IsGitHubApiException(ex);
Assert.That(result, Is.EqualTo(expect));
}
static ApiException CreateApiException(Dictionary<string, string> headers)
{
var response = Substitute.For<IResponse>();
response.Headers.Returns(headers.ToImmutableDictionary());
var ex = new ApiException(response);
return ex;
}
}
}
| mit | C# |
fb9fd714bfc9e131e7dc429a1aa907123c9afeed | set cookies during event handler | sean-sparkman/CookiesWebView,seansparkman/CookiesWebView | Cookies/CookieWebView.cs | Cookies/CookieWebView.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Cookies
{
public delegate void WebViewNavigatedHandler(object sender, CookieNavigatedEventArgs args);
public delegate void WebViewNavigatingHandler(object sender, CookieNavigationEventArgs args);
public class CookieWebView
: WebView
{
public CookieCollection Cookies { get; protected set; }
public event WebViewNavigatedHandler Navigated;
public event WebViewNavigatingHandler Navigating;
public virtual void OnNavigated(CookieNavigatedEventArgs args)
{
var eventHandler = Navigated;
if (eventHandler != null)
{
eventHandler(this, args);
Cookies = args.Cookies;
}
}
public virtual void OnNavigating(CookieNavigationEventArgs args)
{
var eventHandler = Navigating;
if (eventHandler != null)
{
eventHandler(this, args);
}
}
}
public class CookieNavigationEventArgs
: EventArgs
{
public string Url { get; set; }
}
public class CookieNavigatedEventArgs
: CookieNavigationEventArgs
{
public CookieCollection Cookies { get; set; }
public CookieNavigationMode NavigationMode { get; set; }
}
public enum CookieNavigationMode
{
Back,
Forward,
New,
Refresh,
Reset
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Cookies
{
public delegate void WebViewNavigatedHandler(object sender, CookieNavigatedEventArgs args);
public delegate void WebViewNavigatingHandler(object sender, CookieNavigationEventArgs args);
public class CookieWebView
: WebView
{
public CookieCollection Cookies { get; protected set; }
public event WebViewNavigatedHandler Navigated;
public event WebViewNavigatingHandler Navigating;
public virtual void OnNavigated(CookieNavigatedEventArgs args)
{
var eventHandler = Navigated;
if (eventHandler != null)
{
eventHandler(this, args);
}
}
public virtual void OnNavigating(CookieNavigationEventArgs args)
{
var eventHandler = Navigating;
if (eventHandler != null)
{
eventHandler(this, args);
}
}
}
public class CookieNavigationEventArgs
: EventArgs
{
public string Url { get; set; }
}
public class CookieNavigatedEventArgs
: CookieNavigationEventArgs
{
public CookieCollection Cookies { get; set; }
public CookieNavigationMode NavigationMode { get; set; }
}
public enum CookieNavigationMode
{
Back,
Forward,
New,
Refresh,
Reset
}
}
| mit | C# |
0b6ea047ea43f39efae6f6055fd8e21c660947b6 | Update Assets/MixedRealityToolkit.SDK/Experimental/Features/UX/BoundsControl/Visuals/ProximityEffect/IProximityEffectObjectProvider.cs | killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity | Assets/MixedRealityToolkit.SDK/Experimental/Features/UX/BoundsControl/Visuals/ProximityEffect/IProximityEffectObjectProvider.cs | Assets/MixedRealityToolkit.SDK/Experimental/Features/UX/BoundsControl/Visuals/ProximityEffect/IProximityEffectObjectProvider.cs | using System;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.UI.Experimental
{
/// <summary>
/// Interface for defining a proximity object provider used in <see cref="ProximityEffect" /> of <see cref="BoundsControl" />
/// ProximityEffectObjectProviders are responsible for providing gameobjects that are scaled / visually altered in ProximityEffect.
/// </summary>
public interface IProximityEffectObjectProvider
{
/// <summary>
/// Returns true if the provider has any visible objects
/// </summary>
/// <returns></returns>
bool IsActive();
/// <summary>
/// Base Material is applied to any proximity scaled object whenever in medium or far/no proximity mode
/// </summary>
/// <returns></returns>
Material GetBaseMaterial();
/// <summary>
/// Provides the highlighted material that gets applied to any proximity scaled object in close proximity mode
/// </summary>
/// <returns></returns>
Material GetHighlightedMaterial();
/// <summary>
/// Returns the original object size of the provided proximity scaled objects
/// </summary>
/// <returns></returns>
float GetObjectSize();
/// <summary>
/// This method allows iterating over the proximity scaled visuals. It should return the gameobject the scaling should be applied to.
/// </summary>
/// <param name="action"></param>
void ForEachProximityObject(Action<Transform> action);
}
}
| using System;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.UI.Experimental
{
/// <summary>
/// Interface for defining a proximity object provider used in <see cref="ProximityEffect" /> of <see cref="BoundsControl" />
/// ProximityEffectObjectProviders are responsible for providing gameobjects that are scaled / visually altered in ProximityEffect.
/// </summary>
public interface IProximityEffectObjectProvider
{
/// <summary>
/// returns true if the provide has any visible objects
/// </summary>
/// <returns></returns>
bool IsActive();
/// <summary>
/// Base Material is applied to any proximity scaled object whenever in medium or far/no proximity mode
/// </summary>
/// <returns></returns>
Material GetBaseMaterial();
/// <summary>
/// Provides the highlighted material that gets applied to any proximity scaled object in close proximity mode
/// </summary>
/// <returns></returns>
Material GetHighlightedMaterial();
/// <summary>
/// Returns the original object size of the provided proximity scaled objects
/// </summary>
/// <returns></returns>
float GetObjectSize();
/// <summary>
/// This method allows iterating over the proximity scaled visuals. It should return the gameobject the scaling should be applied to.
/// </summary>
/// <param name="action"></param>
void ForEachProximityObject(Action<Transform> action);
}
}
| mit | C# |
3e3305bab6e23ae79df3f615e4d9ef827a7cdd59 | Update Assembly version | inputfalken/Sharpy | Sharpy/Properties/AssemblyInfo.cs | 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.1.0.0")]
[assembly: AssemblyInformationalVersion("3.1.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.0.121.0")]
[assembly: AssemblyInformationalVersion("3.0.121")]
| mit | C# |
925a79c0615307ec94adb77bbb9945c04e00e406 | Test updates | clamidity/SalesforceMagic,bpandola/SalesforceMagic,michael-shattuck/SalesforceMagic | SalesforceMagicTests/SoqlVisitorTests.cs | SalesforceMagicTests/SoqlVisitorTests.cs | using System;
using System.Linq.Expressions;
using NUnit.Framework;
using SalesforceMagic.LinqProvider;
using Shouldly;
namespace SalesforceMagicTests
{
public class SoqlVisitorTests
{
[Test]
public void ShouldConvertBinaryExpressionsToSoql()
{
TestExpression(a => a.IsDeleted).ShouldBe("IsDeleted = True");
TestExpression(a => a.IsDeleted == true).ShouldBe("IsDeleted = True");
TestExpression(a => !a.IsDeleted).ShouldBe("IsDeleted != True");
TestExpression(a => a.IsDeleted != true).ShouldBe("IsDeleted != True");
TestExpression(a => a.IsDeleted == false).ShouldBe("IsDeleted = False");
TestExpression(a => a.IsDeleted != false).ShouldBe("IsDeleted != False");
TestExpression(a => !a.IsDeleted && !a.IsClosed).ShouldBe("IsDeleted != True AND IsClosed != True");
TestExpression(a => !a.IsDeleted && a.Id == "034687OAEB").ShouldBe("IsDeleted != True AND Id = '034687OAEB'");
TestExpression(a => a.Id == "034687OAEB" && !a.IsDeleted).ShouldBe("Id = '034687OAEB' AND IsDeleted != True");
}
private string TestExpression(Expression<Func<TestAccount, bool>> expression)
{
return SOQLVisitor.ConvertToSOQL(expression);
}
private class TestAccount
{
public string Id { get; set; }
public bool IsDeleted { get; set; }
public bool IsClosed { get; set; }
}
}
}
| using System;
using System.Linq.Expressions;
using NUnit.Framework;
using SalesforceMagic.LinqProvider;
using Shouldly;
namespace SalesforceMagicTests
{
public class SoqlVisitorTests
{
[Test]
public void ShouldConvertBinaryExpressionsToSoql()
{
TestExpression(a => a.IsDeleted).ShouldBe("IsDeleted = True");
TestExpression(a => a.IsDeleted == true).ShouldBe("IsDeleted = True");
TestExpression(a => !a.IsDeleted).ShouldBe("IsDeleted != True");
TestExpression(a => a.IsDeleted != true).ShouldBe("IsDeleted != True");
TestExpression(a => a.IsDeleted == false).ShouldBe("IsDeleted = False");
TestExpression(a => a.IsDeleted != false).ShouldBe("IsDeleted != False");
}
private string TestExpression(Expression<Func<TestAccount, bool>> expression)
{
return SOQLVisitor.ConvertToSOQL(expression);
}
private class TestAccount
{
public bool IsDeleted { get; set; }
}
}
}
| mit | C# |
8f61f378aa4df8dd1e29ab535b8f563505deb8cf | Fix API | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-unity/src/CSharp/Daemon/Stages/Highlightings/AbstractUnityGutterMark.cs | resharper/resharper-unity/src/CSharp/Daemon/Stages/Highlightings/AbstractUnityGutterMark.cs | using System.Collections.Generic;
using JetBrains.Application.UI.Controls.BulbMenu.Anchors;
using JetBrains.Application.UI.Controls.BulbMenu.Items;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Errors;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.TextControl.DocumentMarkup;
using JetBrains.UI.Icons;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.Highlightings
{
// This class describes the UI of a highlight (gutter icon), while an IHighlighting
// is an instance of a highlight at a specific location in a document. The IHighlighting
// instance refers to this highlighter's attribute ID to wire up the UI
public class AbstractUnityGutterMark : IconGutterMarkType
{
protected AbstractUnityGutterMark(IconId id) : base(id)
{
}
public override IAnchor Anchor => BulbMenuAnchors.PermanentBackgroundItems;
public override IEnumerable<BulbMenuItem> GetBulbMenuItems(IHighlighter highlighter)
{
var solution = Shell.Instance.GetComponent<SolutionsManager>().Solution;
if (solution == null)
return EmptyList<BulbMenuItem>.InstanceList;
var daemon = solution.GetComponent<IDaemon>();
var highlighting = daemon.GetHighlighting(highlighter);
if (highlighting != null)
{
var items = (highlighting as UnityGutterMarkInfo)?.Actions ??
(highlighting as UnityHotGutterMarkInfo)?.Actions;
if (items != null)
return items;
}
return EmptyList<BulbMenuItem>.InstanceList;
}
}
} | using System.Collections.Generic;
using JetBrains.Application.UI.Controls.BulbMenu.Anchors;
using JetBrains.Application.UI.Controls.BulbMenu.Items;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Errors;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.Highlightings;
using JetBrains.ReSharper.Plugins.Unity.Resources.Icons;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.TextControl.DocumentMarkup;
using JetBrains.UI.Icons;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.Highlightings
{
// This class describes the UI of a highlight (gutter icon), while an IHighlighting
// is an instance of a highlight at a specific location in a document. The IHighlighting
// instance refers to this highlighter's attribute ID to wire up the UI
public class AbstractUnityGutterMark : IconGutterMark
{
public AbstractUnityGutterMark(IconId id) : base(id)
{
}
public override IAnchor Anchor => BulbMenuAnchors.PermanentBackgroundItems;
public override IEnumerable<BulbMenuItem> GetBulbMenuItems(IHighlighter highlighter)
{
var solution = Shell.Instance.GetComponent<SolutionsManager>().Solution;
if (solution == null)
return EmptyList<BulbMenuItem>.InstanceList;
var daemon = solution.GetComponent<IDaemon>();
var highlighting = daemon.GetHighlighting(highlighter);
if (highlighting != null)
{
var items = (highlighting as UnityGutterMarkInfo)?.Actions ??
(highlighting as UnityHotGutterMarkInfo)?.Actions;
if (items != null)
return items;
}
return EmptyList<BulbMenuItem>.InstanceList;
}
}
} | apache-2.0 | C# |
9a4436ebf539be3ff53040685979aa925127a55e | Change project versioning | MarkKhromov/The-Log | TheLog/Properties/AssemblyInfo.cs | TheLog/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("The Log")]
[assembly: AssemblyProduct("The Log")]
[assembly: AssemblyCopyright("Copyright © Mark Khromov 2017")]
[assembly: AssemblyDescription("Library for logging.")]
[assembly: ComVisible(false)]
[assembly: Guid("968ef723-0186-4600-9c3b-674f480f7333")]
[assembly: AssemblyVersion("1.1.2")] | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("The Log")]
[assembly: AssemblyProduct("The Log")]
[assembly: AssemblyCopyright("Copyright © Mark Khromov 2017")]
[assembly: AssemblyDescription("Library for logging.")]
[assembly: ComVisible(false)]
[assembly: Guid("968ef723-0186-4600-9c3b-674f480f7333")]
[assembly: AssemblyVersion("1.1.*")] | mit | C# |
4ced0561c73b5109e825b85afb7455e75d145ddc | Fix after review | neo4j/neo4j-dotnet-driver,ali-ince/neo4j-dotnet-driver,neo4j/neo4j-dotnet-driver | Neo4j.Driver/Neo4j.Driver/Internal/Extensions/ErrorExtensions.cs | Neo4j.Driver/Neo4j.Driver/Internal/Extensions/ErrorExtensions.cs | // Copyright (c) 2002-2017 "Neo Technology,"
// Network Engine for Objects in Lund AB [http://neotechnology.com]
//
// This file is part of Neo4j.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.IO;
using System.Net.Sockets;
using Neo4j.Driver.V1;
namespace Neo4j.Driver.Internal
{
internal static class ErrorExtensions
{
public static bool IsRecoverableError(this Exception error)
{
return error is ClientException || error is TransientException;
}
public static bool IsConnectionError(this Exception error)
{
return error is IOException || error is SocketException ||
error.GetBaseException() is IOException || error.GetBaseException() is SocketException;
}
public static bool IsClusterError(this Exception error)
{
return IsClusterNotALeaderError(error)
|| IsForbiddenOnReadOnlyDatabaseError(error);
}
public static bool IsClusterNotALeaderError(this Exception error)
{
return error.HasErrorCode("Neo.ClientError.Cluster.NotALeader");
}
public static bool IsForbiddenOnReadOnlyDatabaseError(this Exception error)
{
return error.HasErrorCode("Neo.ClientError.General.ForbiddenOnReadOnlyDatabase");
}
private static bool HasErrorCode(this Exception error, string code)
{
var exception = error as Neo4jException;
return exception?.Code != null && exception.Code.Equals(code);
}
}
} | // Copyright (c) 2002-2017 "Neo Technology,"
// Network Engine for Objects in Lund AB [http://neotechnology.com]
//
// This file is part of Neo4j.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.IO;
using System.Net.Sockets;
using Neo4j.Driver.V1;
namespace Neo4j.Driver.Internal
{
internal static class ErrorExtensions
{
public static bool IsRecoverableError(this Exception error)
{
return error is ClientException || error is TransientException;
}
public static bool IsConnectionError(this Exception error)
{
return error is IOException || error is SocketException ||
error.GetBaseException() is IOException || error.GetBaseException() is SocketException;
}
public static bool IsClusterError(this Exception error)
{
return IsClusterNotALeaderError(error)
|| IsForbiddenOnReadOnlyDatabaseError(error);
}
public static bool IsClusterNotALeaderError(this Exception error)
{
var exception = error as Neo4jException;
return exception != null && exception.Code != null &&
exception.Code.Equals("Neo.ClientError.Cluster.NotALeader");
}
public static bool IsForbiddenOnReadOnlyDatabaseError(this Exception error)
{
var exception = error as Neo4jException;
return exception != null && exception.Code != null &&
exception.Code.Equals("Neo.ClientError.General.ForbiddenOnReadOnlyDatabase");
}
}
} | apache-2.0 | C# |
feb39920c5d9e3d5353ab71eb5be230767af1273 | Allow rotation lock on Android to function properly | NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,UselessToucan/osu | osu.Android/OsuGameActivity.cs | osu.Android/OsuGameActivity.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;
using osu.Framework.Android;
namespace osu.Android
{
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullUser, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false)]
public class OsuGameActivity : AndroidGameActivity
{
protected override Framework.Game CreateGame() => new OsuGameAndroid();
protected override void OnCreate(Bundle savedInstanceState)
{
// The default current directory on android is '/'.
// On some devices '/' maps to the app data directory. On others it maps to the root of the internal storage.
// In order to have a consistent current directory on all devices the full path of the app data directory is set as the current directory.
System.Environment.CurrentDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
base.OnCreate(savedInstanceState);
Window.AddFlags(WindowManagerFlags.Fullscreen);
Window.AddFlags(WindowManagerFlags.KeepScreenOn);
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;
using osu.Framework.Android;
namespace osu.Android
{
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullSensor, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false)]
public class OsuGameActivity : AndroidGameActivity
{
protected override Framework.Game CreateGame() => new OsuGameAndroid();
protected override void OnCreate(Bundle savedInstanceState)
{
// The default current directory on android is '/'.
// On some devices '/' maps to the app data directory. On others it maps to the root of the internal storage.
// In order to have a consistent current directory on all devices the full path of the app data directory is set as the current directory.
System.Environment.CurrentDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
base.OnCreate(savedInstanceState);
Window.AddFlags(WindowManagerFlags.Fullscreen);
Window.AddFlags(WindowManagerFlags.KeepScreenOn);
}
}
}
| mit | C# |
f5413cb2f8111d5cc8fec0843df363e5f9d2beab | add display names | SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery | AstroPhotoGallery/AstroPhotoGallery/Models/ApplicationUser.cs | AstroPhotoGallery/AstroPhotoGallery/Models/ApplicationUser.cs | using System.ComponentModel;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System.ComponentModel.DataAnnotations;
using System.Security.Claims;
using System.Threading.Tasks;
namespace AstroPhotoGallery.Models
{
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
[Required]
[DisplayName("First name")]
public string FirstName { get; set; }
[Required]
[DisplayName("Last name")]
public string LastName { get; set; }
public string Gender { get; set; }
public string Country { get; set; }
public string City { get; set; }
// property PhoneNumber is part of IdentityUser by default:
// IdentityUser<TKey, TLogin, TRole, TClaim> - public virtual string PhoneNumber { get; set; }
public string Birthday { get; set; } = string.Empty; // default value when creating a user in order not to be null
public string ImagePath { get; set; }
public bool IsEmailPublic { get; set; } = false; // setting the default to be false due to privacy reasons
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
} | using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System.ComponentModel.DataAnnotations;
using System.Security.Claims;
using System.Threading.Tasks;
namespace AstroPhotoGallery.Models
{
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
[Required]
public string FirstName { get; set; }
[Required]
public string LastName { get; set; }
public string Gender { get; set; }
public string Country { get; set; }
public string City { get; set; }
// property PhoneNumber is part of IdentityUser by default:
// IdentityUser<TKey, TLogin, TRole, TClaim> - public virtual string PhoneNumber { get; set; }
public string Birthday { get; set; } = string.Empty; // default value when creating a user in order not to be null
public string ImagePath { get; set; }
public bool IsEmailPublic { get; set; } = false; // setting the default to be false due to privacy reasons
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
} | mit | C# |
f1840507aca1e20fff51bdf5107999ae1e9f10d1 | Implement CleanUpRawLine() static method for InstructionInterpreter | vejuhust/msft-scooter | ScooterController/ScooterController/InstructionInterpreter.cs | ScooterController/ScooterController/InstructionInterpreter.cs | using System;
using System.Collections.Generic;
using System.IO;
namespace ScooterController
{
class InstructionInterpreter
{
private const string CommentSymbol = ";";
private readonly List<string> instructionRawLines;
private int counterRawLine = 0;
public InstructionInterpreter(string filename = "instruction.txt")
{
using (var file = new StreamReader(filename))
{
string line;
var lines = new List<string>();
while ((line = file.ReadLine()) != null)
{
lines.Add(line);
}
this.instructionRawLines = lines;
}
}
public HardwareInstruction GetNextInstruction()
{
string rawLine;
while ((rawLine = this.GetNextRawLine()) != null)
{
var line = CleanUpRawLine(rawLine);
if (line != null)
{
Console.WriteLine("~" + line + "~");
}
}
return new HardwareInstruction();
}
private string GetNextRawLine()
{
return this.counterRawLine >= instructionRawLines.Count
? null
: instructionRawLines[this.counterRawLine++];
}
private static string CleanUpRawLine(string rawLine)
{
var commentIndex = rawLine.IndexOf(CommentSymbol, StringComparison.InvariantCultureIgnoreCase);
var line = commentIndex >= 0 ? rawLine.Substring(0, commentIndex) : rawLine;
line = line.Trim();
return !string.IsNullOrWhiteSpace(line) ? line : null;
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
namespace ScooterController
{
class InstructionInterpreter
{
private readonly List<string> instructionRawLines;
private int counterRawLine = 0;
public InstructionInterpreter(string filename = "instruction.txt")
{
using (var file = new StreamReader(filename))
{
string line;
var lines = new List<string>();
while ((line = file.ReadLine()) != null)
{
lines.Add(line);
}
this.instructionRawLines = lines;
}
}
public HardwareInstruction GetNextInstruction()
{
string line;
while ((line = this.GetNextRawLine()) != null)
{
Console.WriteLine(line);
}
return new HardwareInstruction();
}
private string GetNextRawLine()
{
return this.counterRawLine >= instructionRawLines.Count
? null
: instructionRawLines[this.counterRawLine++];
}
}
}
| mit | C# |
d73619a1cfef50239deca60408458813824deb88 | Use readonly on fields that should not be modified | tomba/Toolkit,sharpdx/Toolkit,sharpdx/Toolkit | Source/Toolkit/SharpDX.Toolkit.Graphics/InputSignatureManager.cs | Source/Toolkit/SharpDX.Toolkit.Graphics/InputSignatureManager.cs | // Copyright (c) 2010-2013 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Collections.Generic;
using SharpDX.Direct3D11;
namespace SharpDX.Toolkit.Graphics
{
internal struct InputLayoutPair
{
public InputLayoutPair(VertexInputLayout vertexInputLayout, InputLayout inputLayout)
{
VertexInputLayout = vertexInputLayout;
InputLayout = inputLayout;
}
public readonly VertexInputLayout VertexInputLayout;
public readonly InputLayout InputLayout;
}
internal class InputSignatureManager : Component
{
private readonly Direct3D11.Device device;
public readonly byte[] Bytecode;
private readonly Dictionary<VertexInputLayout, InputLayoutPair> Cache;
public InputSignatureManager(GraphicsDevice device, byte[] byteCode)
{
this.device = device;
Bytecode = byteCode;
Cache = new Dictionary<VertexInputLayout, InputLayoutPair>();
}
public void GetOrCreate(VertexInputLayout layout, out InputLayoutPair currentPassPreviousPair)
{
lock (Cache)
{
if (!Cache.TryGetValue(layout, out currentPassPreviousPair))
{
currentPassPreviousPair = new InputLayoutPair(layout, ToDispose(new InputLayout(device, Bytecode, layout.InputElements)));
Cache.Add(layout, currentPassPreviousPair);
}
}
}
}
} | // Copyright (c) 2010-2013 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Collections.Generic;
using SharpDX.Direct3D11;
namespace SharpDX.Toolkit.Graphics
{
internal struct InputLayoutPair
{
public VertexInputLayout VertexInputLayout;
public InputLayout InputLayout;
}
internal class InputSignatureManager : Component
{
private readonly Direct3D11.Device device;
public readonly byte[] Bytecode;
private readonly Dictionary<VertexInputLayout, InputLayoutPair> Cache;
public InputSignatureManager(GraphicsDevice device, byte[] byteCode)
{
this.device = device;
Bytecode = byteCode;
Cache = new Dictionary<VertexInputLayout, InputLayoutPair>();
}
public void GetOrCreate(VertexInputLayout layout, out InputLayoutPair currentPassPreviousPair)
{
lock (Cache)
{
if (!Cache.TryGetValue(layout, out currentPassPreviousPair))
{
currentPassPreviousPair.InputLayout = ToDispose(new InputLayout(device, Bytecode, layout.InputElements));
currentPassPreviousPair.VertexInputLayout = layout;
Cache.Add(layout, currentPassPreviousPair);
}
}
}
}
} | mit | C# |
02462381e4cfc0d63b32ef1b730a72dcf50ab378 | Add settings to config | Kerbas-ad-astra/Orbital-Science,DMagic1/Orbital-Science | Source/DMConfigLoader.cs | Source/DMConfigLoader.cs |
using System.Collections.Generic;
using UnityEngine;
namespace DMagic
{
[KSPAddon(KSPAddon.Startup.MainMenu, true)]
internal class DMConfigLoader: MonoBehaviour
{
internal static Dictionary<string, DMcontractScience> availableScience = new Dictionary<string, DMcontractScience>();
internal static float science, reward, forward, penalty;
private void Start()
{
configLoad();
}
private void configLoad()
{
ConfigNode setNode = GameDatabase.Instance.GetConfigNode("DM_CONTRACT_SETTINGS");
if (setNode != null)
{
science = float.Parse(setNode.GetValue("Global_Science_Return"));
reward = float.Parse(setNode.GetValue("Global_Fund_Reward"));
forward = float.Parse(setNode.GetValue("Global_Fund_Forward"));
penalty = float.Parse(setNode.GetValue("Global_Fund_Penalty"));
Debug.Log(string.Format("[DM] Contract Variables Set; Science Reward: {0} ; Completion Reward: {1} ; Forward Amount: {2} ; Penalty Amount: {3}", science.ToString(), reward.ToString(), forward.ToString(), penalty.ToString())
);
}
foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("DM_CONTRACT_EXPERIMENT"))
{
string name, part, techNode, agent, expID = "";
int sitMask, bioMask = 0;
expID = node.GetValue("experimentID");
ScienceExperiment exp = ResearchAndDevelopment.GetExperiment(expID);
if (exp != null)
{
name = node.GetValue("name");
sitMask = int.Parse(node.GetValue("sitMask"));
bioMask = int.Parse(node.GetValue("bioMask"));
part = node.GetValue("part");
if (node.HasValue("techNode"))
techNode = node.GetValue("techNode");
else
techNode = "None";
if (node.HasValue("agent"))
agent = node.GetValue("agent");
else
agent = "Any";
availableScience.Add(name, new DMcontractScience(expID, exp, sitMask, bioMask, part, techNode, agent));
Debug.Log(string.Format("[DM] New Experiment: [{0}] Available For Contracts", exp.experimentTitle));
}
}
Debug.Log(string.Format("[DM] Successfully Added {0} New Experiments To Contract List", availableScience.Count));
}
private void OnDestroy()
{
}
}
internal class DMcontractScience
{
internal string name;
internal int sitMask, bioMask;
internal ScienceExperiment exp;
internal string sciPart;
internal string sciNode;
internal string agent;
internal DMcontractScience(string expName, ScienceExperiment sciExp, int sciSitMask, int sciBioMask, string sciPartID, string sciTechNode, string agentName)
{
name = expName;
sitMask = sciSitMask;
bioMask = sciBioMask;
exp = sciExp;
sciPart = sciPartID;
sciNode = sciTechNode;
agent = agentName;
}
}
}
|
using System.Collections.Generic;
using UnityEngine;
namespace DMagic
{
[KSPAddon(KSPAddon.Startup.MainMenu, true)]
internal class DMConfigLoader: MonoBehaviour
{
internal static Dictionary<string, DMcontractScience> availableScience = new Dictionary<string, DMcontractScience>();
private void Start()
{
configLoad();
}
private void configLoad()
{
foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("CONTRACT_EXPERIMENT"))
{
string name, part, techNode, agent, expID = "";
int sitMask, bioMask = 0;
expID = node.GetValue("experimentID");
ScienceExperiment exp = ResearchAndDevelopment.GetExperiment(expID);
if (exp != null)
{
name = node.GetValue("name");
sitMask = int.Parse(node.GetValue("sitMask"));
bioMask = int.Parse(node.GetValue("bioMask"));
part = node.GetValue("part");
if (node.HasValue("techNode"))
techNode = node.GetValue("techNode");
else
techNode = "None";
if (node.HasValue("agent"))
agent = node.GetValue("agent");
else
agent = "Any";
availableScience.Add(name, new DMcontractScience(expID, exp, sitMask, bioMask, part, techNode, agent));
Debug.Log(string.Format("[DM] New Experiment: [{0}] Available For Contracts", exp.experimentTitle));
}
}
Debug.Log(string.Format("[DM] Successfully Added {0} New Experiments To Contract List", availableScience.Count));
}
private void OnDestroy()
{
}
}
internal class DMcontractScience
{
internal string name;
internal int sitMask, bioMask;
internal ScienceExperiment exp;
internal string sciPart;
internal string sciNode;
internal string agent;
internal DMcontractScience(string expName, ScienceExperiment sciExp, int sciSitMask, int sciBioMask, string sciPartID, string sciTechNode, string agentName)
{
name = expName;
sitMask = sciSitMask;
bioMask = sciBioMask;
exp = sciExp;
sciPart = sciPartID;
sciNode = sciTechNode;
agent = agentName;
}
}
}
| bsd-3-clause | C# |
1bd0f9658826c06a6eed61127a4d141c798676c1 | Edit receipt model | krprasert/VilageMGN,surrealist/VilageMGN,surrealist/VilageMGN,teeteerapol/VilageMGN,tonanumart/VilageMGN,sanarujung/VilageMGN,teeteerapol/VilageMGN,sanarujung/VilageMGN,tonanumart/VilageMGN,teeteerapol/VilageMGN,tonanumart/VilageMGN,surrealist/VilageMGN,krprasert/VilageMGN,sanarujung/VilageMGN,krprasert/VilageMGN | Village.Model/Receipt.cs | Village.Model/Receipt.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Village.Model
{
public class Receipt
{
public int Id { get; set; }
public int InvoiceId { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Village.Model
{
public class Receipt
{
}
}
| mit | C# |
cc46d0ca12547591d09c1a96cc24718ae78d0f50 | Add detail panel, currently empty | mhutch/MonoDevelop.AddinMaker,mhutch/MonoDevelop.AddinMaker | AddinBrowser/AddinBrowserWidget.cs | AddinBrowser/AddinBrowserWidget.cs | using Gtk;
using Mono.Addins;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Components;
namespace MonoDevelop.AddinMaker.AddinBrowser
{
class AddinBrowserWidget : HPaned
{
ExtensibleTreeView treeView;
public AddinBrowserWidget (AddinRegistry registry)
{
Registry = registry;
Build ();
foreach (var addin in registry.GetAddins ()) {
treeView.AddChild (addin);
}
}
void Build ()
{
//TODO: make extensible?
treeView = new ExtensibleTreeView (
new NodeBuilder[] {
new AddinNodeBuilder (),
new ExtensionFolderNodeBuilder (),
new ExtensionNodeBuilder (),
new ExtensionPointNodeBuilder (),
new ExtensionPointFolderNodeBuilder (),
new DependencyFolderNodeBuilder (),
new DependencyNodeBuilder (),
},
new TreePadOption[0]
);
treeView.Tree.Selection.Mode = SelectionMode.Single;
treeView.WidthRequest = 300;
Pack1 (treeView, false, false);
SetDetail (null);
ShowAll ();
}
void SetDetail (Widget detail)
{
var child2 = Child2;
if (child2 != null) {
Remove (child2);
}
detail = detail ?? new Label ();
detail.WidthRequest = 300;
detail.Show ();
Pack2 (detail, true, false);
}
public void SetToolbar (DocumentToolbar toolbar)
{
}
public AddinRegistry Registry {
get; private set;
}
}
}
| using Gtk;
using Mono.Addins;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Components;
namespace MonoDevelop.AddinMaker.AddinBrowser
{
class AddinBrowserWidget : VBox
{
ExtensibleTreeView treeView;
public AddinBrowserWidget (AddinRegistry registry)
{
Registry = registry;
Build ();
foreach (var addin in registry.GetAddins ()) {
treeView.AddChild (addin);
}
}
void Build ()
{
//TODO: make extensible?
treeView = new ExtensibleTreeView (
new NodeBuilder[] {
new AddinNodeBuilder (),
new ExtensionFolderNodeBuilder (),
new ExtensionNodeBuilder (),
new ExtensionPointNodeBuilder (),
new ExtensionPointFolderNodeBuilder (),
new DependencyFolderNodeBuilder (),
new DependencyNodeBuilder (),
},
new TreePadOption[0]
);
treeView.Tree.Selection.Mode = SelectionMode.Single;
PackStart (treeView, true, true, 0);
ShowAll ();
}
public void SetToolbar (DocumentToolbar toolbar)
{
}
public AddinRegistry Registry {
get; private set;
}
}
}
| mit | C# |
8c33934a2988be5344c47a0b737d9dca595bf9f2 | Fix download didn't start by close response in getFileDetail, implement FillCredential method | witoong623/TirkxDownloader,witoong623/TirkxDownloader | Models/DetailProvider.cs | Models/DetailProvider.cs | using System;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using TirkxDownloader.Framework;
using TirkxDownloader.Models;
namespace TirkxDownloader.Models
{
public class DetailProvider
{
private AuthorizationManager _authenticationManager;
public DetailProvider(AuthorizationManager authenticationManager)
{
_authenticationManager = authenticationManager;
}
public async Task GetFileDetail(DownloadInfo detail, CancellationToken ct)
{
try
{
var request = (HttpWebRequest)HttpWebRequest.Create(detail.DownloadLink);
request.Method = "HEAD";
var response = await request.GetResponseAsync(ct);
detail.FileSize = response.ContentLength;
response.Close();
}
catch (OperationCanceledException) { }
}
public async Task FillCredential(HttpWebRequest request)
{
string targetDomain = "";
string domain = request.Host;
AuthorizationInfo authorizationInfo = _authenticationManager.GetCredential(domain);
using (StreamReader str = new StreamReader("Target domain.dat", Encoding.UTF8))
{
string storedDomian;
while ((storedDomian = await str.ReadLineAsync()) != null)
{
if (storedDomian.Like(domain))
{
targetDomain = storedDomian;
// if it isn't wildcards, it done
if (!storedDomian.Contains("*"))
{
break;
}
}
}
}
AuthorizationInfo credential = _authenticationManager.GetCredential(targetDomain);
if (credential != null)
{
var netCredential = new NetworkCredential(credential.Username, credential.Password, domain);
request.Credentials = netCredential;
}
else
{
// if no credential was found, try to use default credential
request.UseDefaultCredentials = true;
}
}
}
}
| using System;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using TirkxDownloader.Framework;
namespace TirkxDownloader.Models
{
public class DetailProvider
{
public async Task GetFileDetail(DownloadInfo detail, CancellationToken ct)
{
try
{
var request = (HttpWebRequest)HttpWebRequest.Create(detail.DownloadLink);
request.Method = "HEAD";
var response = await request.GetResponseAsync(ct);
detail.FileSize = response.ContentLength;
}
catch (OperationCanceledException) { }
}
public bool FillCredential(string doamin)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
e8148034c9077943e25d6ca43ec47090c1d9c026 | Make Info.Web and Resource.Uri URIs | darbio/cap-net,TeamnetGroup/cap-net | src/CAPNet/Models/Resource.cs | src/CAPNet/Models/Resource.cs | using System;
namespace CAPNet.Models
{
/// <summary>
///
/// </summary>
public class Resource
{
/// <summary>
///
/// </summary>
public string Description { get; set; }
/// <summary>
///
/// </summary>
public string MimeType { get; set; }
/// <summary>
///
/// </summary>
public int? Size { get; set; }
/// <summary>
///
/// </summary>
public Uri Uri { get; set; }
/// <summary>
///
/// </summary>
public string DereferencedUri { get; set; }
/// <summary>
///
/// </summary>
public string Digest { get; set; }
}
}
| using System;
namespace CAPNet.Models
{
/// <summary>
///
/// </summary>
public class Resource
{
/// <summary>
///
/// </summary>
public string Description { get; set; }
/// <summary>
///
/// </summary>
public string MimeType { get; set; }
/// <summary>
///
/// </summary>
public int? Size { get; set; }
/// <summary>
///
/// </summary>
public Uri Uri { get; set; }
/// <summary>
///
/// </summary>
public string DereferencedUri { get; set; }
/// <summary>
///
/// </summary>
public string Digest { get; set; }
}
}
| mit | C# |
50246405f29d6906961a8617ba997820a7c39beb | Add a few more needed libraries to the public space | dlech/monomac,kangaroo/monomac,PlayScriptRedux/monomac | src/Foundation/NSObjectMac.cs | src/Foundation/NSObjectMac.cs | //
// Copyright 2010, Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
// Used to preload the Foundation and AppKit libraries as our runtime
// requires this. This will be replaced later with a dynamic system
//
using System;
using MonoMac.ObjCRuntime;
namespace MonoMac.Foundation {
public partial class NSObject {
// Used to force the loading of AppKit and Foundation
static IntPtr fl = Dlfcn.dlopen (Constants.FoundationLibrary, 1);
static IntPtr al = Dlfcn.dlopen (Constants.AppKitLibrary, 1);
static IntPtr wl = Dlfcn.dlopen (Constants.WebKitLibrary, 1);
static IntPtr zl = Dlfcn.dlopen (Constants.QuartzLibrary, 1);
static IntPtr ql = Dlfcn.dlopen (Constants.QTKitLibrary, 1);
static IntPtr cl = Dlfcn.dlopen (Constants.CoreLocationLibrary, 1);
static IntPtr ll = Dlfcn.dlopen (Constants.SecurityLibrary, 1);
}
}
| //
// Copyright 2010, Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
// Used to preload the Foundation and AppKit libraries as our runtime
// requires this. This will be replaced later with a dynamic system
//
using System;
using MonoMac.ObjCRuntime;
namespace MonoMac.Foundation {
public partial class NSObject {
// Used to force the loading of AppKit and Foundation
static IntPtr fl = Dlfcn.dlopen (Constants.FoundationLibrary, 1);
static IntPtr al = Dlfcn.dlopen (Constants.AppKitLibrary, 1);
static IntPtr wl = Dlfcn.dlopen (Constants.WebKitLibrary, 1);
static IntPtr ql = Dlfcn.dlopen (Constants.QTKitLibrary, 1);
}
}
| apache-2.0 | C# |
21fa0bc5b50044a17b70c05f19118ea08adbfcac | make serialization more tolerant of changes | fszlin/certes,fszlin/certes | src/Certes/Json/JsonUtil.cs | src/Certes/Json/JsonUtil.cs | using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
namespace Certes.Json
{
/// <summary>
/// Helper methods for JSON serialization.
/// </summary>
public static class JsonUtil
{
/// <summary>
/// Creates the <see cref="JsonSerializerSettings"/> used for ACME entity serialization.
/// </summary>
/// <returns>The JSON serializer settings.</returns>
public static JsonSerializerSettings CreateSettings()
{
var jsonSettings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore
};
jsonSettings.Converters.Add(new StringEnumConverter());
return jsonSettings;
}
}
}
| using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
namespace Certes.Json
{
/// <summary>
/// Helper methods for JSON serialization.
/// </summary>
public static class JsonUtil
{
/// <summary>
/// Creates the <see cref="JsonSerializerSettings"/> used for ACME entity serialization.
/// </summary>
/// <returns>The JSON serializer settings.</returns>
public static JsonSerializerSettings CreateSettings()
{
var jsonSettings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore
};
jsonSettings.Converters.Add(new StringEnumConverter());
return jsonSettings;
}
}
}
| mit | C# |
89466631efe398927f0ceabfb0f45146b04d8121 | Add the CostCenterId to the exposed interface of the Booking.Product type. | ivvycode/ivvy-sdk-net | src/Venue/Bookings/Product.cs | src/Venue/Bookings/Product.cs | using Ivvy.API.Json;
using Newtonsoft.Json;
namespace Ivvy.API.Venue.Bookings
{
/// <summary>
/// Details of a product on a venue booking session.
/// </summary>
public class Product : ISerializable
{
[JsonProperty("id")]
public int Id
{
get; set;
}
[JsonProperty("sessionId")]
public int SessionId
{
get; set;
}
[JsonProperty("name")]
public string Name
{
get; set;
}
[JsonProperty("quantity")]
public int Quantity
{
get; set;
}
[JsonProperty("includeInPackage")]
public bool IncludeInPackage
{
get; set;
}
[JsonProperty("totalDiscount")]
public decimal? TotalDiscount
{
get; set;
}
[JsonProperty("costCenterId")]
public int CostCenterId
{
get; set;
}
[JsonProperty("totalAmount")]
public decimal TotalAmount
{
get; set;
}
[JsonProperty("taxDetails")]
public TaxDetail[] TaxDetails
{
get; set;
}
}
} | using Ivvy.API.Json;
using Newtonsoft.Json;
namespace Ivvy.API.Venue.Bookings
{
/// <summary>
/// Details of a product on a venue booking session.
/// </summary>
public class Product : ISerializable
{
[JsonProperty("id")]
public int Id
{
get; set;
}
[JsonProperty("sessionId")]
public int SessionId
{
get; set;
}
[JsonProperty("name")]
public string Name
{
get; set;
}
[JsonProperty("quantity")]
public int Quantity
{
get; set;
}
[JsonProperty("includeInPackage")]
public bool IncludeInPackage
{
get; set;
}
[JsonProperty("totalDiscount")]
public decimal? TotalDiscount
{
get; set;
}
[JsonProperty("totalAmount")]
public decimal TotalAmount
{
get; set;
}
[JsonProperty("taxDetails")]
public TaxDetail[] TaxDetails
{
get; set;
}
}
} | mit | C# |
46af983e6804176fd36839db03b7aa2f06f6a45e | Replace deprecated method LocalizedString | roycornelissen/GMImagePicker.Xamarin | src/GMImagePicker/TranslationExtensions.cs | src/GMImagePicker/TranslationExtensions.cs | //
// TranslationExtensions.cs
// GMPhotoPicker.Xamarin
//
// Created by Roy Cornelissen on 23/03/16.
// Based on original GMImagePicker implementation by Guillermo Muntaner Perelló.
// https://github.com/guillermomuntaner/GMImagePicker
//
using Foundation;
namespace GMImagePicker
{
[Register ("DummyClass")]
internal class DummyClass: NSObject
{
}
internal static class TranslationExtensions
{
public static string Translate(this string translate, string defaultValue = "*NO TRANSLATION*")
{
var bundleClass = new DummyClass ().Class;
var languageBundle = NSBundle.FromClass (bundleClass);
var translatedString = languageBundle.GetLocalizedString(translate, defaultValue, "GMImagePicker");
return translatedString;
}
}
}
| //
// TranslationExtensions.cs
// GMPhotoPicker.Xamarin
//
// Created by Roy Cornelissen on 23/03/16.
// Based on original GMImagePicker implementation by Guillermo Muntaner Perelló.
// https://github.com/guillermomuntaner/GMImagePicker
//
using Foundation;
namespace GMImagePicker
{
[Register ("DummyClass")]
internal class DummyClass: NSObject
{
}
internal static class TranslationExtensions
{
public static string Translate(this string translate, string defaultValue = "*NO TRANSLATION*")
{
var bundleClass = new DummyClass ().Class;
var languageBundle = NSBundle.FromClass (bundleClass);
var translatedString = languageBundle.LocalizedString(translate, defaultValue, "GMImagePicker");
return translatedString;
}
}
}
| mit | C# |
7d2613c02df7826daca9cf25d14995765786ddf6 | Update version | Yonom/CupCake | CupCake/Properties/AssemblyInfo.cs | CupCake/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("CupCake")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CupCake")]
[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("45412037-53ac-4f20-97ce-4245dcc4c215")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.9.1")] | 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("CupCake")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CupCake")]
[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("45412037-53ac-4f20-97ce-4245dcc4c215")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.9.0")] | mit | C# |
a730349629c5b3f39a0107980a39bbb5161125cf | Remove the ignore attribute once again | ppy/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu | osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs | osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Screens.Play.HUD;
using osu.Game.Skinning;
using osu.Game.Tests.Visual;
using osuTK;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestSceneCatchPlayerLegacySkin : LegacySkinPlayerTestScene
{
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
[Test]
public void TestLegacyHUDComboCounterHidden([Values] bool withModifiedSkin)
{
if (withModifiedSkin)
{
AddStep("change component scale", () => Player.ChildrenOfType<LegacyScoreCounter>().First().Scale = new Vector2(2f));
AddStep("update target", () => Player.ChildrenOfType<SkinnableTargetContainer>().ForEach(LegacySkin.UpdateDrawableTarget));
AddStep("exit player", () => Player.Exit());
CreateTest(null);
}
AddAssert("legacy HUD combo counter hidden", () =>
{
return Player.ChildrenOfType<LegacyComboCounter>().All(c => !c.ChildrenOfType<Container>().Single().IsPresent);
});
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Screens.Play.HUD;
using osu.Game.Skinning;
using osu.Game.Tests.Visual;
using osuTK;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestSceneCatchPlayerLegacySkin : LegacySkinPlayerTestScene
{
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
[Test]
[Ignore("HUD components broken, remove when fixed.")]
public void TestLegacyHUDComboCounterHidden([Values] bool withModifiedSkin)
{
if (withModifiedSkin)
{
AddStep("change component scale", () => Player.ChildrenOfType<LegacyScoreCounter>().First().Scale = new Vector2(2f));
AddStep("update target", () => Player.ChildrenOfType<SkinnableTargetContainer>().ForEach(LegacySkin.UpdateDrawableTarget));
AddStep("exit player", () => Player.Exit());
CreateTest(null);
}
AddAssert("legacy HUD combo counter hidden", () =>
{
return Player.ChildrenOfType<LegacyComboCounter>().All(c => !c.ChildrenOfType<Container>().Single().IsPresent);
});
}
}
}
| mit | C# |
754a4a920900e1ae56d4fdae7cbdfd02bcb8cbd1 | Fix incomplete intellisense on Context | michael-wolfenden/Polly | src/Polly.Shared/Context.cs | src/Polly.Shared/Context.cs | using System;
using System.Collections.Generic;
using Polly.Wrap;
namespace Polly
{
/// <summary>
/// Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added.
/// <remarks>Do not re-use an instance of <see cref="Context"/> across more than one execution.</remarks>
/// </summary>
public partial class Context
{
internal static readonly Context None = new Context();
private Guid? _executionGuid;
/// <summary>
/// Initializes a new instance of the <see cref="Context"/> class, with the specified <paramref name="executionKey"/>.
/// </summary>
/// <param name="executionKey">The execution key.</param>
public Context(String executionKey)
{
ExecutionKey = executionKey;
}
internal Context()
{
}
/// <summary>
/// When execution is through a <see cref="PolicyWrap"/>, identifies the PolicyWrap executing the current delegate by returning the <see cref="Policy.PolicyKey"/> of the outermost layer in the PolicyWrap; otherwise, null.
/// </summary>
public String PolicyWrapKey { get; internal set; }
/// <summary>
/// The <see cref="Policy.PolicyKey"/> of the <see cref="Policy"/> instance executing the current delegate.
/// </summary>
public String PolicyKey { get; internal set; }
/// <summary>
/// A key unique to the call site of the current execution.
/// <remarks><see cref="Policy"/> instances are commonly reused across multiple call sites. Set an ExecutionKey so that logging and metrics can distinguish usages of policy instances at different call sites.</remarks>
/// <remarks>The value is set by using the <see cref="Context(String)"/> constructor taking an executionKey parameter.</remarks>
/// </summary>
public String ExecutionKey { get; }
/// <summary>
/// A Guid guaranteed to be unique to each execution.
/// <remarks>Acts as a correlation id so that events specific to a single execution can be identified in logging and telemetry.</remarks>
/// </summary>
public Guid ExecutionGuid
{
get
{
if (!_executionGuid.HasValue) { _executionGuid = Guid.NewGuid(); }
return _executionGuid.Value;
}
}
}
}
| using System;
using System.Collections.Generic;
namespace Polly
{
/// <summary>
/// Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added.
/// <remarks>Do not re-use an instance of <see cref="Context"/> across more than one execution.</remarks>
/// </summary>
public partial class Context
{
internal static readonly Context None = new Context();
private Guid? _executionGuid;
/// <summary>
/// Initializes a new instance of the <see cref="Context"/> class, with the specified <paramref name="executionKey"/>.
/// </summary>
/// <param name="executionKey">The execution key.</param>
public Context(String executionKey)
{
ExecutionKey = executionKey;
}
internal Context()
{
}
/// <summary>
/// A key unique to the outermost <see cref="Polly.Wrap.PolicyWrap"/> instance involved in the current PolicyWrap execution.
/// </summary>
public String PolicyWrapKey { get; internal set; }
/// <summary>
/// A key unique to the <see cref="Policy"/> instance executing the current delegate.
/// </summary>
public String PolicyKey { get; internal set; }
/// <summary>
/// A key unique to the call site of the current execution.
/// <remarks>The value is set </remarks>
/// </summary>
public String ExecutionKey { get; }
/// <summary>
/// A Guid guaranteed to be unique to each execution.
/// </summary>
public Guid ExecutionGuid
{
get
{
if (!_executionGuid.HasValue) { _executionGuid = Guid.NewGuid(); }
return _executionGuid.Value;
}
}
}
} | bsd-3-clause | C# |
b00ee67895cba2bdbe64c49c9b698f87413bb2fc | Remove excess whitespace | ppy/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,ppy/osu,smoogipooo/osu,peppy/osu-new,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu | osu.Game/Overlays/Dashboard/DashboardOverlayHeader.cs | osu.Game/Overlays/Dashboard/DashboardOverlayHeader.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.ComponentModel;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Dashboard
{
public class DashboardOverlayHeader : TabControlOverlayHeader<DashboardOverlayTabs>
{
protected override OverlayTitle CreateTitle() => new DashboardTitle();
private class DashboardTitle : OverlayTitle
{
public DashboardTitle()
{
Title = HomeStrings.UserTitle;
Description = "view your friends and other information";
IconTexture = "Icons/Hexacons/social";
}
}
}
[LocalisableEnum(typeof(DashboardOverlayTabsEnumLocalisationMapper))]
public enum DashboardOverlayTabs
{
Friends,
[Description("Currently Playing")]
CurrentlyPlaying
}
public class DashboardOverlayTabsEnumLocalisationMapper : EnumLocalisationMapper<DashboardOverlayTabs>
{
public override LocalisableString Map(DashboardOverlayTabs value)
{
switch (value)
{
case DashboardOverlayTabs.Friends:
return FriendsStrings.TitleCompact;
case DashboardOverlayTabs.CurrentlyPlaying:
return @"Currently Playing";
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.ComponentModel;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Dashboard
{
public class DashboardOverlayHeader : TabControlOverlayHeader<DashboardOverlayTabs>
{
protected override OverlayTitle CreateTitle() => new DashboardTitle();
private class DashboardTitle : OverlayTitle
{
public DashboardTitle()
{
Title = HomeStrings.UserTitle;
Description = "view your friends and other information";
IconTexture = "Icons/Hexacons/social";
}
}
}
[LocalisableEnum(typeof(DashboardOverlayTabsEnumLocalisationMapper))]
public enum DashboardOverlayTabs
{
Friends,
[Description("Currently Playing")]
CurrentlyPlaying
}
public class DashboardOverlayTabsEnumLocalisationMapper : EnumLocalisationMapper<DashboardOverlayTabs>
{
public override LocalisableString Map(DashboardOverlayTabs value)
{
switch (value)
{
case DashboardOverlayTabs.Friends:
return FriendsStrings.TitleCompact;
case DashboardOverlayTabs.CurrentlyPlaying:
return @"Currently Playing";
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}
}
| mit | C# |
1c815cfe5d54288405d7e780d558ac7554fdbd20 | Clarify Context intellisense | michael-wolfenden/Polly | src/Polly.Shared/Context.cs | src/Polly.Shared/Context.cs | using System;
using System.Collections.Generic;
using Polly.Wrap;
namespace Polly
{
/// <summary>
/// Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added.
/// <remarks>Do not re-use an instance of <see cref="Context"/> across more than one call through .Execute(...) or .ExecuteAsync(...).</remarks>
/// </summary>
public partial class Context
{
internal static readonly Context None = new Context();
private Guid? _executionGuid;
/// <summary>
/// Initializes a new instance of the <see cref="Context"/> class, with the specified <paramref name="executionKey"/>.
/// </summary>
/// <param name="executionKey">The execution key.</param>
public Context(String executionKey)
{
ExecutionKey = executionKey;
}
internal Context()
{
}
/// <summary>
/// When execution is through a <see cref="PolicyWrap"/>, identifies the PolicyWrap executing the current delegate by returning the <see cref="Policy.PolicyKey"/> of the outermost layer in the PolicyWrap; otherwise, null.
/// </summary>
public String PolicyWrapKey { get; internal set; }
/// <summary>
/// The <see cref="Policy.PolicyKey"/> of the <see cref="Policy"/> instance executing the current delegate.
/// </summary>
public String PolicyKey { get; internal set; }
/// <summary>
/// A key unique to the call site of the current execution.
/// <remarks><see cref="Policy"/> instances are commonly reused across multiple call sites. Set an ExecutionKey so that logging and metrics can distinguish usages of policy instances at different call sites.</remarks>
/// <remarks>The value is set by using the <see cref="Context(String)"/> constructor taking an executionKey parameter.</remarks>
/// </summary>
public String ExecutionKey { get; }
/// <summary>
/// A Guid guaranteed to be unique to each execution.
/// <remarks>Acts as a correlation id so that events specific to a single execution can be identified in logging and telemetry.</remarks>
/// </summary>
public Guid ExecutionGuid
{
get
{
if (!_executionGuid.HasValue) { _executionGuid = Guid.NewGuid(); }
return _executionGuid.Value;
}
}
}
}
| using System;
using System.Collections.Generic;
using Polly.Wrap;
namespace Polly
{
/// <summary>
/// Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added.
/// <remarks>Do not re-use an instance of <see cref="Context"/> across more than one execution.</remarks>
/// </summary>
public partial class Context
{
internal static readonly Context None = new Context();
private Guid? _executionGuid;
/// <summary>
/// Initializes a new instance of the <see cref="Context"/> class, with the specified <paramref name="executionKey"/>.
/// </summary>
/// <param name="executionKey">The execution key.</param>
public Context(String executionKey)
{
ExecutionKey = executionKey;
}
internal Context()
{
}
/// <summary>
/// When execution is through a <see cref="PolicyWrap"/>, identifies the PolicyWrap executing the current delegate by returning the <see cref="Policy.PolicyKey"/> of the outermost layer in the PolicyWrap; otherwise, null.
/// </summary>
public String PolicyWrapKey { get; internal set; }
/// <summary>
/// The <see cref="Policy.PolicyKey"/> of the <see cref="Policy"/> instance executing the current delegate.
/// </summary>
public String PolicyKey { get; internal set; }
/// <summary>
/// A key unique to the call site of the current execution.
/// <remarks><see cref="Policy"/> instances are commonly reused across multiple call sites. Set an ExecutionKey so that logging and metrics can distinguish usages of policy instances at different call sites.</remarks>
/// <remarks>The value is set by using the <see cref="Context(String)"/> constructor taking an executionKey parameter.</remarks>
/// </summary>
public String ExecutionKey { get; }
/// <summary>
/// A Guid guaranteed to be unique to each execution.
/// <remarks>Acts as a correlation id so that events specific to a single execution can be identified in logging and telemetry.</remarks>
/// </summary>
public Guid ExecutionGuid
{
get
{
if (!_executionGuid.HasValue) { _executionGuid = Guid.NewGuid(); }
return _executionGuid.Value;
}
}
}
}
| bsd-3-clause | C# |
7136c842159f6517b1665aa4cbbde7b25b892844 | Remove redundant extension method | anilmujagic/DeploymentCockpit,anilmujagic/DeploymentCockpit,anilmujagic/DeploymentCockpit | src/DeploymentCockpit.Core/Common/IEnumerableExtensions.cs | src/DeploymentCockpit.Core/Common/IEnumerableExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace DeploymentCockpit.Common
{
public static class IEnumerableExtensions
{
public static IEnumerable<T> Each<T>(this IEnumerable<T> enumerable, Action<T> itemAction)
{
foreach (var item in enumerable)
{
itemAction(item);
}
return enumerable; // Enable method chaining
}
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> enumerable)
{
return new HashSet<T>(enumerable);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace DeploymentCockpit.Common
{
public static class IEnumerableExtensions
{
public static bool IsNullOrEmpty<T>(this IEnumerable<T> enumerable)
{
return enumerable == null || !enumerable.Any();
}
public static IEnumerable<T> Each<T>(this IEnumerable<T> enumerable, Action<T> itemAction)
{
foreach (var item in enumerable)
{
itemAction(item);
}
return enumerable; // Enable method chaining
}
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> enumerable)
{
return new HashSet<T>(enumerable);
}
}
}
| apache-2.0 | C# |
0aac9df887b44b72f91582297dc98d6fccfacc37 | Fix line sampling | jomar/NGraphics,praeclarum/NGraphics | NGraphics/Line.cs | NGraphics/Line.cs | using System;
using System.Globalization;
namespace NGraphics
{
public class Line : Element
{
protected Point start;
protected Point end;
public Line (Point start, Point end, Pen pen)
: base (pen, null)
{
this.start = start;
this.end = end;
}
protected override void DrawElement (ICanvas canvas)
{
canvas.DrawLine(start, end, Pen);
}
public override string ToString ()
{
return string.Format (CultureInfo.InvariantCulture, "Line ({0}-{1})", start, end);
}
#region implemented abstract members of Element
public override EdgeSamples[] GetEdgeSamples (double tolerance, int minSamples, int maxSamples)
{
var ps = SampleLine (start, end, true, tolerance, minSamples, maxSamples);
for (int i = 0; i < ps.Length; i++) {
var p = Transform.TransformPoint (ps [i]);
ps [i] = p;
}
return new[] { new EdgeSamples { Points = ps } };
}
public override Rect SampleableBox {
get {
var bb = new Rect (start, Size.Zero);
return bb.Union (end);
}
}
#endregion
}
}
| using System;
using System.Globalization;
namespace NGraphics
{
public class Line : Element
{
protected Point start;
protected Point end;
public Line (Point start, Point end, Pen pen)
: base (pen, null)
{
this.start = start;
this.end = end;
}
protected override void DrawElement (ICanvas canvas)
{
canvas.DrawLine(start, end, Pen);
}
public override string ToString ()
{
return string.Format (CultureInfo.InvariantCulture, "Line ({0}-{1})", start, end);
}
#region implemented abstract members of Element
public override EdgeSamples[] GetEdgeSamples (double tolerance, int minSamples, int maxSamples)
{
var ps = SampleLine (start, end, true, tolerance, minSamples, maxSamples);
return new[] { new EdgeSamples { Points = ps } };
}
public override Rect SampleableBox {
get {
var bb = new Rect (start, Size.Zero);
return bb.Union (end);
}
}
#endregion
}
}
| mit | C# |
2f7bc43d2d15c3252e6eeb4dd7675dd833fd56f3 | Update OverlappedDataImpl.cs | CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos | source/Cosmos.Core_Plugs/System/Threading/OverlappedDataImpl.cs | source/Cosmos.Core_Plugs/System/Threading/OverlappedDataImpl.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System.Threading
{
[Plug()]
class OverlappedDataImpl
{
[PlugMethod(Signature = "System_Threading_OverlappedData__System_Threading_OverlappedData_GetOverlappedFromNative_System_Threading_NativeOverlapped__")]
public unsafe static void GetOverlappedFromNative(NativeOverlapped* a)
{
throw new NotImplementedException();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using IL2CPU.API.Attribs;
namespace Cosmos.Core_Plugs.System.Threading
{
class OverlappedDataImpl
{
[PlugMethod(Signature = "System_Threading_OverlappedData__System_Threading_OverlappedData_GetOverlappedFromNative_System_Threading_NativeOverlapped__")]
public unsafe static void GetOverlappedFromNative(NativeOverlapped* a)
{
throw new NotImplementedException();
}
}
}
| bsd-3-clause | C# |
88f450e1d0b3e0beb982f74cb1fa4936694098fb | Remove accidental `nullable enable` spec | peppy/osu,peppy/osu,peppy/osu,ppy/osu,ppy/osu,ppy/osu | osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs | osu.Game/Screens/Utility/SampleComponents/LatencyCursorContainer.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. 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.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osuTK;
using osuTK.Input;
namespace osu.Game.Screens.Utility.SampleComponents
{
public class LatencyCursorContainer : CursorContainer
{
protected override Drawable CreateCursor() => new LatencyCursor();
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
public LatencyCursorContainer()
{
State.Value = Visibility.Hidden;
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
// Scheduling is required to ensure updating of cursor position happens in limited rate.
// We can alternatively solve this by a PassThroughInputManager layer inside LatencyArea,
// but that would mean including input lag to this test, which may not be desired.
Schedule(() => base.OnMouseMove(e));
return false;
}
private class LatencyCursor : LatencySampleComponent
{
public LatencyCursor()
{
AutoSizeAxes = Axes.Both;
Origin = Anchor.Centre;
InternalChild = new Circle { Size = new Vector2(40) };
}
protected override void UpdateAtLimitedRate(InputState inputState)
{
Colour = inputState.Mouse.IsPressed(MouseButton.Left) ? OverlayColourProvider.Content1 : OverlayColourProvider.Colour2;
}
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osuTK;
using osuTK.Input;
namespace osu.Game.Screens.Utility.SampleComponents
{
public class LatencyCursorContainer : CursorContainer
{
protected override Drawable CreateCursor() => new LatencyCursor();
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
public LatencyCursorContainer()
{
State.Value = Visibility.Hidden;
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
// Scheduling is required to ensure updating of cursor position happens in limited rate.
// We can alternatively solve this by a PassThroughInputManager layer inside LatencyArea,
// but that would mean including input lag to this test, which may not be desired.
Schedule(() => base.OnMouseMove(e));
return false;
}
private class LatencyCursor : LatencySampleComponent
{
public LatencyCursor()
{
AutoSizeAxes = Axes.Both;
Origin = Anchor.Centre;
InternalChild = new Circle { Size = new Vector2(40) };
}
protected override void UpdateAtLimitedRate(InputState inputState)
{
Colour = inputState.Mouse.IsPressed(MouseButton.Left) ? OverlayColourProvider.Content1 : OverlayColourProvider.Colour2;
}
}
}
}
| mit | C# |
341c27f51a64a9ff05f2a9617a7d99d8bf9f6653 | Make ExchangeDeclare derivable | pardahlman/RawRabbit | src/RawRabbit/Pipe/Middleware/ExchangeDeclareMiddleware.cs | src/RawRabbit/Pipe/Middleware/ExchangeDeclareMiddleware.cs | using System;
using System.Threading;
using System.Threading.Tasks;
using RawRabbit.Common;
using RawRabbit.Configuration.Exchange;
using RawRabbit.Logging;
namespace RawRabbit.Pipe.Middleware
{
public class ExchangeDeclareOptions
{
public Func<IPipeContext, ExchangeDeclaration> ExchangeFunc { get; set; }
public bool ThrowOnFail { get; set; }
public Func<IPipeContext, bool> ThrowOnFailFunc { get; set; }
}
public class ExchangeDeclareMiddleware : Middleware
{
protected readonly ITopologyProvider TopologyProvider;
protected readonly Func<IPipeContext, ExchangeDeclaration> ExchangeFunc;
protected Func<IPipeContext, bool> ThrowOnFailFunc;
private readonly ILogger _logger = LogManager.GetLogger<ExchangeDeclareMiddleware>();
public ExchangeDeclareMiddleware(ITopologyProvider topologyProvider, ExchangeDeclareOptions options = null)
{
TopologyProvider = topologyProvider;
ExchangeFunc = options?.ExchangeFunc;
ThrowOnFailFunc = options?.ThrowOnFailFunc ?? (context => false);
}
public override Task InvokeAsync(IPipeContext context, CancellationToken token)
{
var exchangeCfg = GetExchangeDeclaration(context);
if (exchangeCfg != null)
{
_logger.LogDebug($"Exchange configuration found. Declaring '{exchangeCfg.Name}'.");
return DeclareExchangeAsync(exchangeCfg, context, token)
.ContinueWith(t => Next.InvokeAsync(context, token), token)
.Unwrap();
}
if (GetThrowOnFail(context))
{
throw new ArgumentNullException(nameof(exchangeCfg));
}
return Next.InvokeAsync(context, token);
}
protected virtual ExchangeDeclaration GetExchangeDeclaration(IPipeContext context)
{
return ExchangeFunc?.Invoke(context);
}
protected virtual bool GetThrowOnFail(IPipeContext context)
{
return ThrowOnFailFunc(context);
}
protected virtual Task DeclareExchangeAsync(ExchangeDeclaration exchange, IPipeContext context, CancellationToken token)
{
return TopologyProvider.DeclareExchangeAsync(exchange);
}
}
} | using System;
using System.Threading;
using System.Threading.Tasks;
using RawRabbit.Common;
using RawRabbit.Configuration.Exchange;
using RawRabbit.Logging;
namespace RawRabbit.Pipe.Middleware
{
public class ExchangeDeclareOptions
{
public Func<IPipeContext, ExchangeDeclaration> ExchangeFunc { get; set; }
public bool ThrowOnFail { get; set; }
public static ExchangeDeclareOptions For(Func<IPipeContext, ExchangeDeclaration> func)
{
return new ExchangeDeclareOptions
{
ExchangeFunc = func
};
}
}
public class ExchangeDeclareMiddleware : Middleware
{
private readonly ITopologyProvider _topologyProvider;
private readonly Func<IPipeContext, ExchangeDeclaration> _exchangeFunc;
private readonly bool _throwOnFail;
private readonly ILogger _logger = LogManager.GetLogger<ExchangeDeclareMiddleware>();
public ExchangeDeclareMiddleware(ITopologyProvider topologyProvider)
: this(topologyProvider, ExchangeDeclareOptions.For(c => c.GetExchangeDeclaration()))
{ }
public ExchangeDeclareMiddleware(ITopologyProvider topologyProvider, ExchangeDeclareOptions options)
{
_topologyProvider = topologyProvider;
_exchangeFunc = options.ExchangeFunc;
_throwOnFail = (bool) options?.ThrowOnFail;
}
public override Task InvokeAsync(IPipeContext context, CancellationToken token)
{
var exchangeCfg = _exchangeFunc(context);
if (exchangeCfg != null)
{
_logger.LogDebug($"Exchange configuration found. Declaring '{exchangeCfg.Name}'.");
return DeclareExchangeAsync(exchangeCfg)
.ContinueWith(t => Next.InvokeAsync(context, token), token)
.Unwrap();
}
_logger.LogDebug($"No Exchange configuration found. Throw on fail: {_throwOnFail}");
if (_throwOnFail)
{
throw new ArgumentNullException(nameof(exchangeCfg));
}
return Next.InvokeAsync(context, token);
}
protected virtual Task DeclareExchangeAsync(ExchangeDeclaration exchange)
{
return _topologyProvider.DeclareExchangeAsync(exchange);
}
}
} | mit | C# |
116421a35d8abcd3905514284e66ff0c79353b38 | Fix 404 error when calling GetMammals, incorrect route | MortenLiebmann/holoholona,MortenLiebmann/holoholona | Holoholona/Views/Home/Index.cshtml | Holoholona/Views/Home/Index.cshtml | <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script>
var data = (function ($) {
var getData = (function() {
$.ajax({
method: "GET",
url: "@Url.Action("GetMammals", "Home")",
dataType: "json",
success: function (response) {
print(response);
},
failure: function (response) {
alert(response.d);
}
});
});
function print(data) {
document.write(
data.Dog.Name + ": " + data.Dog.Type + " / " +
data.Cat.Name + ": " + data.Cat.Type
);
}
return {
getData: getData
}
})(jQuery);
</script>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<div>
<script>
data.getData();
</script>
</div>
</body>
</html>
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script>
var data = (function ($) {
var getData = (function() {
$.ajax({
method: "GET",
url: "GetMammals",
dataType: "json",
success: function (response) {
print(response);
},
failure: function (response) {
alert(response.d);
}
});
});
function print(data) {
document.write(
data.Dog.Name + ": " + data.Dog.Type + " / " +
data.Cat.Name + ": " + data.Cat.Type
);
}
return {
getData: getData
}
})(jQuery);
</script>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<div>
<script>
data.getData();
</script>
</div>
</body>
</html>
| mit | C# |
14729716bcb1b2b605f0b8dd6bb6e1a11d6c1446 | Add xml documentation | imasm/CSharpExtensions | CSharpEx.Forms/ControlEx.cs | CSharpEx.Forms/ControlEx.cs | using System;
using System.Windows.Forms;
namespace CSharpEx.Forms
{
/// <summary>
/// Control extensions
/// </summary>
public static class ControlEx
{
/// <summary>
/// Invoke action if Invoke is requiered.
/// </summary>
public static void InvokeIfRequired<T>(this T c, Action<T> action) where T : Control
{
if (c.InvokeRequired)
{
c.Invoke(new Action(() => action(c)));
}
else
{
action(c);
}
}
}
}
| using System;
using System.Windows.Forms;
namespace CSharpEx.Forms
{
public static class ControlEx
{
/// <summary>
/// Invoke action if Invoke is requiered.
/// </summary>
public static void InvokeIfRequired<T>(this T c, Action<T> action) where T : Control
{
if (c.InvokeRequired)
{
c.Invoke(new Action(() => action(c)));
}
else
{
action(c);
}
}
}
}
| apache-2.0 | C# |
9f8dd8557bade54a06c77287a3d632f86ee71510 | Add RealtimePushTests to newtonsoft test suite | nkreipke/rethinkdb-net,nkreipke/rethinkdb-net,LukeForder/rethinkdb-net,kangkot/rethinkdb-net,Ernesto99/rethinkdb-net,LukeForder/rethinkdb-net,kangkot/rethinkdb-net,bbqchickenrobot/rethinkdb-net,bbqchickenrobot/rethinkdb-net,Ernesto99/rethinkdb-net | rethinkdb-net-newtonsoft-test/Integration/CoreIntegrationTests.cs | rethinkdb-net-newtonsoft-test/Integration/CoreIntegrationTests.cs | using NUnit.Framework;
using RethinkDb.Newtonsoft.Configuration;
using RethinkDb.Test.Integration;
namespace RethinkDb.Newtonsoft.Test.Integration
{
[SetUpFixture]
public class NIntegrationTestSetup : IntegrationTestSetup
{
}
[TestFixture]
public class NSingleObjectTest : SingleObjectTests
{
static NSingleObjectTest()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NTableTests : TableTests
{
static NTableTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NMultiTableTests : MultiTableTests
{
static NMultiTableTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NMultiObjectTests : MultiObjectTests
{
static NMultiObjectTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NManyObjectTests : ManyObjectTests
{
static NManyObjectTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NBlankTests : BlankTests
{
static NBlankTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NDatabaseTests : DatabaseTests
{
static NDatabaseTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NGroupingTests : GroupingTests
{
static NGroupingTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NHasFieldsTests : HasFieldsTests
{
static NHasFieldsTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NRealtimePushTests : RealtimePushTests
{
static NRealtimePushTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
}
| using NUnit.Framework;
using RethinkDb.Newtonsoft.Configuration;
using RethinkDb.Test.Integration;
namespace RethinkDb.Newtonsoft.Test.Integration
{
[SetUpFixture]
public class NIntegrationTestSetup : IntegrationTestSetup
{
}
[TestFixture]
public class NSingleObjectTest : SingleObjectTests
{
static NSingleObjectTest()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NTableTests : TableTests
{
static NTableTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NMultiTableTests : MultiTableTests
{
static NMultiTableTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NMultiObjectTests : MultiObjectTests
{
static NMultiObjectTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NManyObjectTests : ManyObjectTests
{
static NManyObjectTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NBlankTests : BlankTests
{
static NBlankTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NDatabaseTests : DatabaseTests
{
static NDatabaseTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NGroupingTests : GroupingTests
{
static NGroupingTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
[TestFixture]
public class NHasFieldsTests : HasFieldsTests
{
static NHasFieldsTests()
{
ConnectionFactory = ConfigurationAssembler.CreateConnectionFactory("testCluster");
}
}
} | apache-2.0 | C# |
a84b341748584e6a46af5c12ffe6f378faab8a26 | Add more tests when target file exists | eggapauli/ExtractTypeToFileDiagnostic | ExtractTypeToFileDiagnostic/ExtractTypeToFileDiagnostic.Test/CodeFixes/GivenExistingDocument.cs | ExtractTypeToFileDiagnostic/ExtractTypeToFileDiagnostic.Test/CodeFixes/GivenExistingDocument.cs | using FluentAssertions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
using NUnit.Framework;
using System.Linq;
using System.Threading.Tasks;
namespace ExtractTypeToFileDiagnostic.Test.CodeFixes
{
[TestFixture]
public class GivenExistingDocument : DiagnosticAndCodeFixTest
{
private const string ContentClass1 = @"using System;
using System.Linq;
namespace TestNamespace
{
class TypeA { }
}";
private const string ContentTypeA = @"using System;
using System.Linq;
namespace TestNamespace
{
class SomeType { }
}";
[Test]
public async Task ShouldNotCreateNewDocument()
{
var solution = await SetupAndApplyAsync();
solution.Projects.Single().Documents.Should().ContainSingle(d => d.Name == "TypeA.cs");
}
[Test]
public async Task ShouldRemoveOldDocument()
{
var solution = await SetupAndApplyAsync();
solution.Projects.Single().Documents.Should().NotContain(d => d.Name == "Class1.cs");
}
[Test]
public async Task ShouldIntegrateIntoExistingDocument()
{
var solution = await SetupAndApplyAsync();
var content = await solution.Projects.Single().Documents.Single(d => d.Name == "TypeA.cs").GetTextAsync();
content.ToString().Should().Be(@"using System;
using System.Linq;
namespace TestNamespace
{
class SomeType { }
class TypeA { }
}");
}
private async Task<Solution> SetupAndApplyAsync()
{
var syntaxTree = SyntaxFactory.ParseSyntaxTree(ContentClass1);
var diagnostic = Diagnostic.Create(
ExtractTypeToFileAnalyzer.Rule,
Location.Create(syntaxTree, new TextSpan(ContentClass1.IndexOf("TypeA"), "TypeA".Length)),
"TypeA",
"Class1");
var document = CreateSampleProject()
.AddDocument("TypeA.cs", ContentTypeA).Project
.AddDocument("Class1.cs", ContentClass1);
var codeFixProvider = CreateCodeFixProvider();
return await ApplyFixAsync(codeFixProvider, document, diagnostic);
}
}
}
| using FluentAssertions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
using NUnit.Framework;
using System.Linq;
using System.Threading.Tasks;
namespace ExtractTypeToFileDiagnostic.Test.CodeFixes
{
[TestFixture]
public class GivenExistingDocument : DiagnosticAndCodeFixTest
{
private const string ContentClass1 = @"using System;
using System.Linq;
namespace TestNamespace
{
class TypeA { }
}";
private const string ContentTypeA = @"using System;
using System.Linq;
namespace TestNamespace
{
class SomeType { }
}";
[Test]
public async Task ShouldNotCreateNewDocument()
{
var solution = await SetupAndApplyAsync();
solution.Projects.Single().Documents.Should().ContainSingle(d => d.Name == "TypeA.cs");
}
private async Task<Solution> SetupAndApplyAsync()
{
var syntaxTree = SyntaxFactory.ParseSyntaxTree(ContentClass1);
var diagnostic = Diagnostic.Create(
ExtractTypeToFileAnalyzer.Rule,
Location.Create(syntaxTree, new TextSpan(ContentClass1.IndexOf("TypeA"), "TypeA".Length)),
"TypeA",
"Class1");
var document = CreateSampleProject()
.AddDocument("TypeA.cs", ContentTypeA).Project
.AddDocument("Class1.cs", ContentClass1);
var codeFixProvider = CreateCodeFixProvider();
return await ApplyFixAsync(codeFixProvider, document, diagnostic);
}
}
}
| mit | C# |
85c4dc88f9e5d3c6c3b29e439a9847a39fa7559a | Add missing property on Team class | CSGO-Analysis/CSGO-Analyzer | DemoParser/Entities/Team.cs | DemoParser/Entities/Team.cs | using DemoParser_Core.Packets;
using System;
namespace DemoParser_Core.Entities
{
public class Team : IComparable
{
internal Entity Entity;
public int Id { get { return Entity.ID; } }
public int Num { get; internal set; }
public string Name { get; internal set; }
/// <summary>
/// ISO Alpha 2 country flag
/// e.g. US = United States
/// http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
/// </summary>
public string Flag { get; internal set; }
public int Score { get; internal set; }
public int ScoreFirstHalf { get; internal set; }
public int ScoreSecondHalf { get; internal set; }
public int[] player_array { get; internal set; }
public TeamSide Side { get { return (TeamSide)Num; } }
internal Team(Entity entity)
{
this.Entity = entity;
if (entity.Properties.ContainsKey("m_iTeamNum"))
{
this.Num = (int)entity.Properties["m_iTeamNum"];
if (entity.Properties.ContainsKey("m_szTeamname"))
{
this.Name = (string)entity.Properties.GetValueOrDefault<string, object>("m_szClanTeamname", (string)entity.Properties["m_szTeamname"]);
this.Flag = (string)entity.Properties.GetValueOrDefault<string, object>("m_szTeamFlagImage", string.Empty);
//this.player_array = (int[])entity.Properties.GetValueOrDefault<string, object>("\"player_array\"", new int[5]);
}
}
}
internal void Update(Entity entity)
{
if (entity.Properties.ContainsKey("m_iTeamNum"))
{
this.Num = (int)entity.Properties["m_iTeamNum"];
if (entity.Properties.ContainsKey("m_szTeamname"))
{
this.Name = (string)entity.Properties.GetValueOrDefault<string, object>("m_szClanTeamname", (string)entity.Properties["m_szTeamname"]);
this.Flag = (string)entity.Properties.GetValueOrDefault<string, object>("m_szTeamFlagImage", string.Empty);
//this.player_array = (int[])entity.Properties.GetValueOrDefault<string, object>("\"player_array\"", new int[5]);
}
}
if (entity.Properties.ContainsKey("m_scoreTotal") && entity.Properties.ContainsKey("m_scoreFirstHalf"))
{
this.Score = (int)entity.Properties["m_scoreTotal"];
this.ScoreFirstHalf = (int)entity.Properties["m_scoreFirstHalf"];
if (entity.Properties.ContainsKey("m_scoreSecondHalf"))
{
this.ScoreSecondHalf = (int)entity.Properties["m_scoreSecondHalf"];
}
}
}
public override string ToString()
{
return Name;
}
public int CompareTo(object obj)
{
return Name.CompareTo(((Team)obj).Name);
}
public enum TeamSide
{
Spectator = 1,
T = 2,
CT = 3,
}
}
}
| using DemoParser_Core.Packets;
using System;
namespace DemoParser_Core.Entities
{
public class Team : IComparable
{
internal Entity Entity;
public int Num { get; internal set; }
public string Name { get; internal set; }
/// <summary>
/// ISO Alpha 2 country flag
/// e.g. US = United States
/// http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
/// </summary>
public string Flag { get; internal set; }
public int Score { get; internal set; }
public int ScoreFirstHalf { get; internal set; }
public int ScoreSecondHalf { get; internal set; }
public int[] player_array { get; internal set; }
public TeamSide Side { get { return (TeamSide)Num; } }
internal Team(Entity entity)
{
this.Entity = entity;
if (entity.Properties.ContainsKey("m_iTeamNum"))
{
this.Num = (int)entity.Properties["m_iTeamNum"];
if (entity.Properties.ContainsKey("m_szTeamname"))
{
this.Name = (string)entity.Properties.GetValueOrDefault<string, object>("m_szClanTeamname", (string)entity.Properties["m_szTeamname"]);
this.Flag = (string)entity.Properties.GetValueOrDefault<string, object>("m_szTeamFlagImage", string.Empty);
//this.player_array = (int[])entity.Properties.GetValueOrDefault<string, object>("\"player_array\"", new int[5]);
}
}
}
internal void Update(Entity entity)
{
if (entity.Properties.ContainsKey("m_iTeamNum"))
{
this.Num = (int)entity.Properties["m_iTeamNum"];
if (entity.Properties.ContainsKey("m_szTeamname"))
{
this.Name = (string)entity.Properties.GetValueOrDefault<string, object>("m_szClanTeamname", (string)entity.Properties["m_szTeamname"]);
this.Flag = (string)entity.Properties.GetValueOrDefault<string, object>("m_szTeamFlagImage", string.Empty);
//this.player_array = (int[])entity.Properties.GetValueOrDefault<string, object>("\"player_array\"", new int[5]);
}
}
if (entity.Properties.ContainsKey("m_scoreTotal") && entity.Properties.ContainsKey("m_scoreFirstHalf"))
{
this.Score = (int)entity.Properties["m_scoreTotal"];
this.ScoreFirstHalf = (int)entity.Properties["m_scoreFirstHalf"];
if (entity.Properties.ContainsKey("m_scoreSecondHalf"))
{
this.ScoreSecondHalf = (int)entity.Properties["m_scoreSecondHalf"];
}
}
}
public override string ToString()
{
return Name;
}
public int CompareTo(object obj)
{
return Name.CompareTo(((Team)obj).Name);
}
public enum TeamSide
{
Spectator = 1,
T = 2,
CT = 3,
}
}
}
| mit | C# |
705ab24b9f055cb7c5b972fe7d853ad75e06e7cd | bump assembly version | cgerrior/recurly-client-net,jvalladolid/recurly-client-net | Library/Properties/AssemblyInfo.cs | Library/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("Recurly Client Library")]
[assembly: AssemblyDescription("Recurly makes subscription billing easy for .NET developers.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Recurly, Inc.")]
[assembly: AssemblyProduct("Recurly")]
[assembly: AssemblyCopyright("")]
[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("25932cc0-45c7-4db4-b8d5-dd172555522c")]
// 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.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]
| 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("Recurly Client Library")]
[assembly: AssemblyDescription("Recurly makes subscription billing easy for .NET developers.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Recurly, Inc.")]
[assembly: AssemblyProduct("Recurly")]
[assembly: AssemblyCopyright("")]
[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("25932cc0-45c7-4db4-b8d5-dd172555522c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
| mit | C# |
d0279c1c98778d578576683b25eb249b56f01c56 | Correct SVN tags | michael-mayes/capturedpackets | PacketCaptureAnalyser/MainWindowFormConstants.cs | PacketCaptureAnalyser/MainWindowFormConstants.cs | // $Id$
// $URL$
// <copyright file="MainWindowFormConstants.cs" company="Public Domain">
// Released into the public domain
// </copyright>
// This file is part of the C# Packet Capture application. It is free and
// unencumbered software released into the public domain as detailed in
// the UNLICENSE file in the top level directory of this distribution
namespace PacketCaptureAnalyser
{
/// <summary>
/// This class provides constants for use by the main window form processing
/// </summary>
public class MainWindowFormConstants
{
/// <summary>
/// Enumerated list of the types of packet captures supported by the main window form
/// </summary>
public enum PacketCaptureType
{
/// <summary>
/// PCAP Next Generation capture
/// </summary>
PCAPNextGeneration = 0,
/// <summary>
/// PCAP packet capture
/// </summary>
PCAP = 1,
/// <summary>
/// NA Sniffer (DOS) packet capture
/// </summary>
NASnifferDOS = 2,
/// <summary>
/// Invalid value for type of packet capture
/// </summary>
Incorrect = 3,
/// <summary>
/// Unknown value for type of packet capture
/// </summary>
Unknown = 4
}
}
} | // $Id
// $URL
// <copyright file="MainWindowFormConstants.cs" company="Public Domain">
// Released into the public domain
// </copyright>
// This file is part of the C# Packet Capture application. It is free and
// unencumbered software released into the public domain as detailed in
// the UNLICENSE file in the top level directory of this distribution
namespace PacketCaptureAnalyser
{
/// <summary>
/// This class provides constants for use by the main window form processing
/// </summary>
public class MainWindowFormConstants
{
/// <summary>
/// Enumerated list of the types of packet captures supported by the main window form
/// </summary>
public enum PacketCaptureType
{
/// <summary>
/// PCAP Next Generation capture
/// </summary>
PCAPNextGeneration = 0,
/// <summary>
/// PCAP packet capture
/// </summary>
PCAP = 1,
/// <summary>
/// NA Sniffer (DOS) packet capture
/// </summary>
NASnifferDOS = 2,
/// <summary>
/// Invalid value for type of packet capture
/// </summary>
Incorrect = 3,
/// <summary>
/// Unknown value for type of packet capture
/// </summary>
Unknown = 4
}
}
} | unlicense | C# |
54190e6560cfe7c785843db165ba25e57da4e469 | indent changes | Faiz7412/or-tools,tdegrunt/or-tools,FreeScienceCommunity/or-tools,pbomta/or-tools,FreeScienceCommunity/or-tools,pombredanne/or-tools,capturePointer/or-tools,or-tools/or-tools,ThatRfernand/or-tools,WendellDuncan/or-tools,or-tools/or-tools,FreeScienceCommunity/or-tools,hj3938/or-tools,2947721120/curly-hockeypuck,legrosbuffle/or-tools,FreeScienceCommunity/or-tools,ds0nt/or-tools,ds0nt/or-tools,greatmazinger/or-tools,or-tools/or-tools,abhishekgahlot/or-tools,KapecK/or-tools,linsicai/or-tools,AlperSaltabas/OR_Tools_Google_API,hj3938/or-tools,tdegrunt/or-tools,bourreauEric/or-tools,greatmazinger/or-tools,Faiz7412/or-tools,bourreauEric/or-tools,pombredanne/or-tools,2947721120/or-tools,tdegrunt/or-tools,google/or-tools,AlperSaltabas/OR_Tools_Google_API,lfiaschi/or-tools,2947721120/curly-hockeypuck,WendellDuncan/or-tools,KapecK/or-tools,tdegrunt/or-tools,google/or-tools,simonlynen/or-tools,linsicai/or-tools,FreeScienceCommunity/or-tools,pbomta/or-tools,2947721120/or-tools,bourreauEric/or-tools,google/or-tools,zhxwmessi/or-tools,google/or-tools,capturePointer/or-tools,lfiaschi/or-tools,google/or-tools,Faiz7412/or-tools,pbomta/or-tools,legrosbuffle/or-tools,abhishekgahlot/or-tools,linsicai/or-tools,simonlynen/or-tools,linsicai/or-tools,2947721120/curly-hockeypuck,Faiz7412/or-tools,KapecK/or-tools,hj3938/or-tools,2947721120/curly-hockeypuck,KapecK/or-tools,pombredanne/or-tools,hj3938/or-tools,bourreauEric/or-tools,legrosbuffle/or-tools,tdegrunt/or-tools,ds0nt/or-tools,capturePointer/or-tools,abhishekgahlot/or-tools,zhxwmessi/or-tools,AlperSaltabas/OR_Tools_Google_API,pbomta/or-tools,Faiz7412/or-tools,zhxwmessi/or-tools,AlperSaltabas/OR_Tools_Google_API,lfiaschi/or-tools,ds0nt/or-tools,lfiaschi/or-tools,2947721120/or-tools,WendellDuncan/or-tools,lfiaschi/or-tools,legrosbuffle/or-tools,hj3938/or-tools,or-tools/or-tools,simonlynen/or-tools,bourreauEric/or-tools,greatmazinger/or-tools,pombredanne/or-tools,greatmazinger/or-tools,ThatRfernand/or-tools,ds0nt/or-tools,bourreauEric/or-tools,hj3938/or-tools,AlperSaltabas/OR_Tools_Google_API,tdegrunt/or-tools,WendellDuncan/or-tools,pbomta/or-tools,ThatRfernand/or-tools,WendellDuncan/or-tools,2947721120/or-tools,lfiaschi/or-tools,or-tools/or-tools,ThatRfernand/or-tools,2947721120/or-tools,abhishekgahlot/or-tools,capturePointer/or-tools,zhxwmessi/or-tools,FreeScienceCommunity/or-tools,WendellDuncan/or-tools,zhxwmessi/or-tools,ds0nt/or-tools,2947721120/curly-hockeypuck,abhishekgahlot/or-tools,capturePointer/or-tools,simonlynen/or-tools,KapecK/or-tools,linsicai/or-tools,capturePointer/or-tools,Faiz7412/or-tools,pombredanne/or-tools,abhishekgahlot/or-tools,pbomta/or-tools,KapecK/or-tools,pombredanne/or-tools,ThatRfernand/or-tools,legrosbuffle/or-tools,AlperSaltabas/OR_Tools_Google_API,linsicai/or-tools,2947721120/or-tools,zhxwmessi/or-tools,or-tools/or-tools,2947721120/curly-hockeypuck,google/or-tools,simonlynen/or-tools,greatmazinger/or-tools,simonlynen/or-tools,greatmazinger/or-tools | src/com/google/ortools/constraintsolver/IntervalVarArrayHelper.cs | src/com/google/ortools/constraintsolver/IntervalVarArrayHelper.cs | // Copyright 2010-2012 Google
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace Google.OrTools.ConstraintSolver
{
using System;
using System.Collections.Generic;
// IntervalVar[] helper class.
public static class IntervalVarArrayHelper
{
// get solver from array of interval variables
private static Solver GetSolver(IntervalVar[] vars)
{
if (vars == null || vars.Length <= 0)
throw new ArgumentException("Array <vars> cannot be null or empty");
return vars[0].solver();
}
public static Constraint Disjunctive(this IntervalVar[] vars)
{
Solver solver = GetSolver(vars);
return solver.MakeDisjunctiveConstraint(vars);
}
public static SequenceVar SequenceVar(this IntervalVar[] vars, String name)
{
Solver solver = GetSolver(vars);
return solver.MakeSequenceVar(vars, name);
}
public static Constraint Cumulative(this IntervalVar[] vars,
long[] demands,
long capacity,
String name)
{
Solver solver = GetSolver(vars);
return solver.MakeCumulative(vars, demands, capacity, name);
}
public static Constraint Cumulative(this IntervalVar[] vars,
int[] demands,
long capacity,
String name)
{
Solver solver = GetSolver(vars);
return solver.MakeCumulative(vars, demands, capacity, name);
}
}
} // namespace Google.OrTools.ConstraintSolver
| // Copyright 2010-2012 Google
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace Google.OrTools.ConstraintSolver
{
using System;
using System.Collections.Generic;
// IntervalVar[] helper class.
public static class IntervalVarArrayHelper
{
// get solver from array of interval variables
private static Solver GetSolver(IntervalVar[] vars)
{
if (vars == null || vars.Length <= 0)
throw new ArgumentException("Array <vars> cannot be null or empty");
return vars[0].solver();
}
public static Constraint Disjunctive(this IntervalVar[] vars)
{
Solver solver = GetSolver(vars);
return solver.MakeDisjunctiveConstraint(vars);
}
public static SequenceVar SequenceVar(this IntervalVar[] vars, String name)
{
Solver solver = GetSolver(vars);
return solver.MakeSequenceVar(vars, name);
}
public static Constraint Cumulative(this IntervalVar[] vars,
long[] demands,
long capacity,
String name)
{
Solver solver = GetSolver(vars);
return solver.MakeCumulative(vars, demands, capacity, name);
}
public static Constraint Cumulative(this IntervalVar[] vars,
int[] demands,
long capacity,
String name)
{
Solver solver = GetSolver(vars);
return solver.MakeCumulative(vars, demands, capacity, name);
}
}
} // namespace Google.OrTools.ConstraintSolver
| apache-2.0 | C# |
2019c317e574e43224c9d1a136ab890af68c6b24 | Initialize CreateAppCommand with a TextWriter | appharbor/appharbor-cli | src/AppHarbor/Commands/CreateAppCommand.cs | src/AppHarbor/Commands/CreateAppCommand.cs | using System;
using System.IO;
using System.Linq;
namespace AppHarbor.Commands
{
[CommandHelp("Create an application", "[NAME]", "create")]
public class CreateAppCommand : ICommand
{
private readonly IAppHarborClient _appHarborClient;
private readonly IApplicationConfiguration _applicationConfiguration;
private readonly TextWriter _textWriter;
public CreateAppCommand(IAppHarborClient appHarborClient, IApplicationConfiguration applicationConfiguration, TextWriter textWriter)
{
_appHarborClient = appHarborClient;
_applicationConfiguration = applicationConfiguration;
_textWriter = textWriter;
}
public void Execute(string[] arguments)
{
if (arguments.Length == 0)
{
throw new CommandException("An application name must be provided to create an application");
}
var result = _appHarborClient.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault());
Console.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", result.ID);
Console.WriteLine("");
try
{
Console.WriteLine("This directory is already configured to track application \"{0}\".",
_applicationConfiguration.GetApplicationId());
}
catch (ApplicationConfigurationException)
{
_applicationConfiguration.SetupApplication(result.ID, _appHarborClient.GetUser());
}
}
}
}
| using System;
using System.Linq;
namespace AppHarbor.Commands
{
[CommandHelp("Create an application", "[NAME]", "create")]
public class CreateAppCommand : ICommand
{
private readonly IAppHarborClient _appHarborClient;
private readonly IApplicationConfiguration _applicationConfiguration;
public CreateAppCommand(IAppHarborClient appHarborClient, IApplicationConfiguration applicationConfiguration)
{
_appHarborClient = appHarborClient;
_applicationConfiguration = applicationConfiguration;
}
public void Execute(string[] arguments)
{
if (arguments.Length == 0)
{
throw new CommandException("An application name must be provided to create an application");
}
var result = _appHarborClient.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault());
Console.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", result.ID);
Console.WriteLine("");
try
{
Console.WriteLine("This directory is already configured to track application \"{0}\".",
_applicationConfiguration.GetApplicationId());
}
catch (ApplicationConfigurationException)
{
_applicationConfiguration.SetupApplication(result.ID, _appHarborClient.GetUser());
}
}
}
}
| mit | C# |
224e1370c7366a8d7b012b09ad9e95834b991ec6 | Refactor TestResult | arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5 | src/Arkivverket.Arkade/Tests/TestResult.cs | src/Arkivverket.Arkade/Tests/TestResult.cs | namespace Arkivverket.Arkade.Tests
{
public class TestResult
{
public ResultType Result { get; }
public string Message { get; }
public TestResult(ResultType result, string message)
{
Result = result;
Message = message;
}
public bool IsError()
{
return Result == ResultType.Error;
}
public override string ToString()
{
return $"[{Result}] {Message}";
}
}
public enum ResultType
{
Success,
Error
}
} | namespace Arkivverket.Arkade.Tests
{
public class TestResult
{
public ResultType Result { get; private set; }
public string Message { get; private set; }
public TestResult(ResultType result, string message)
{
Result = result;
Message = message;
}
public bool IsError()
{
return Result == ResultType.Error;
}
public override string ToString()
{
return $"[{Result}] {Message}";
}
}
public enum ResultType
{
Success, Error
}
}
| agpl-3.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.