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 |
---|---|---|---|---|---|---|---|---|
b8e24e93bb189eac7f4fc58d7e90512c4ad69720
|
Add (intentionally) broken Lazy ORM Employee service
|
hgcummings/DataAccessExamples,hgcummings/DataAccessExamples
|
DataAccessExamples.Core/Services/Employee/LazyOrmEmployeeService.cs
|
DataAccessExamples.Core/Services/Employee/LazyOrmEmployeeService.cs
|
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;
using DataAccessExamples.Core.Actions;
using DataAccessExamples.Core.Data;
using DataAccessExamples.Core.ViewModels;
namespace DataAccessExamples.Core.Services.Employee
{
public class LazyOrmEmployeeService : IEmployeeService
{
private readonly EmployeesContext context;
public LazyOrmEmployeeService(EmployeesContext context)
{
this.context = context;
}
public void AddEmployee(AddEmployee action)
{
var employee = Mapper.Map<Data.Employee>(action);
employee.DepartmentEmployees.Add(new DepartmentEmployee
{
Employee = employee,
DepartmentCode = action.DepartmentCode,
FromDate = action.HireDate,
ToDate = DateTime.MaxValue
});
context.Employees.Add(employee);
context.SaveChanges();
}
public EmployeeList ListRecentHires()
{
return new EmployeeList
{
Employees = context.Employees
.Where(e => e.HireDate > DateTime.Now.AddDays(-7))
.OrderByDescending(e => e.HireDate)
};
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataAccessExamples.Core.Actions;
using DataAccessExamples.Core.ViewModels;
namespace DataAccessExamples.Core.Services.Employee
{
public class LazyOrmEmployeeService : IEmployeeService
{
public void AddEmployee(AddEmployee action)
{
throw new NotImplementedException();
}
public EmployeeList ListRecentHires()
{
throw new NotImplementedException();
}
}
}
|
cc0-1.0
|
C#
|
8c735233be7e2aa5372d597b8a5e3a1e70ed10fe
|
Update HomeController.cs
|
UmbrellaInc/FalconSharp,UmbrellaInc/FalconSharp
|
src/FalconSharp.TestHarness/Controllers/HomeController.cs
|
src/FalconSharp.TestHarness/Controllers/HomeController.cs
|
using System.Linq;
using System.Net;
using System.Web.Mvc;
namespace FalconSharp.TestHarness.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
var fiddlerProxy = new WebProxy("127.0.0.1", 8888);
//var falcon = new FalconClient("api_key");
var falcon = new FalconClient("api_key", fiddlerProxy);
var channels = falcon.GetChannels();
var uniqueNetworks = channels.Items.Select(x => x.Network).Distinct().ToArray();
foreach (var uniqueNetwork in uniqueNetworks)
{
var chan = channels.Items.First(x => x.Network == uniqueNetwork);
var content = falcon.GetChannelContent(chan.Id, limit: 10, offset: 100);
var t = 1;
}
return View();
}
}
}
|
using System.Linq;
using System.Net;
using System.Web.Mvc;
namespace FalconSharp.TestHarness.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
var fiddlerProxy = new WebProxy("127.0.0.1", 8888);
//var falcon = new FalconClient("NLcbUTN3IAsKH2X89Dh5NCU2XZX_SXou_7gy3t8uJONHbI3bSyqG1hwusZwwTOo3C8D4f4N6MCB9e5UH2yWW_8y4S-86SKRmtLkLR_xWCzmRZymBVnoGPDVSUThywK9cc9xMfWEN_M-fXpCCuviU5CLP4A7HdgL9OyxbzF2AmAo");
var falcon = new FalconClient("NLcbUTN3IAsKH2X89Dh5NCU2XZX_SXou_7gy3t8uJONHbI3bSyqG1hwusZwwTOo3C8D4f4N6MCB9e5UH2yWW_8y4S-86SKRmtLkLR_xWCzmRZymBVnoGPDVSUThywK9cc9xMfWEN_M-fXpCCuviU5CLP4A7HdgL9OyxbzF2AmAo", fiddlerProxy);
var channels = falcon.GetChannels();
var uniqueNetworks = channels.Items.Select(x => x.Network).Distinct().ToArray();
foreach (var uniqueNetwork in uniqueNetworks)
{
var chan = channels.Items.First(x => x.Network == uniqueNetwork);
var content = falcon.GetChannelContent(chan.Id, limit: 10, offset: 100);
var t = 1;
}
return View();
}
}
}
|
mit
|
C#
|
08970b8e0bd7c7f7328fb0317c6aa13fbc464e69
|
set these name betterlabels to messagebox font to be more visible
|
andrew-polk/libpalaso,chrisvire/libpalaso,ermshiperete/libpalaso,darcywong00/libpalaso,chrisvire/libpalaso,andrew-polk/libpalaso,marksvc/libpalaso,ddaspit/libpalaso,hatton/libpalaso,JohnThomson/libpalaso,mccarthyrb/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,gmartin7/libpalaso,sillsdev/libpalaso,glasseyes/libpalaso,darcywong00/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,ddaspit/libpalaso,sillsdev/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,andrew-polk/libpalaso,ddaspit/libpalaso,hatton/libpalaso,tombogle/libpalaso,gtryus/libpalaso,chrisvire/libpalaso,gmartin7/libpalaso,marksvc/libpalaso,glasseyes/libpalaso,andrew-polk/libpalaso,gmartin7/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,hatton/libpalaso,marksvc/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,JohnThomson/libpalaso,ddaspit/libpalaso,JohnThomson/libpalaso,JohnThomson/libpalaso,darcywong00/libpalaso,ermshiperete/libpalaso,hatton/libpalaso,mccarthyrb/libpalaso,sillsdev/libpalaso,ermshiperete/libpalaso,chrisvire/libpalaso
|
PalasoUIWindowsForms/WritingSystems/WritingSystemSetupView.cs
|
PalasoUIWindowsForms/WritingSystems/WritingSystemSetupView.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Palaso.UI.WindowsForms.WritingSystems.WSTree;
using Palaso.WritingSystems;
namespace Palaso.UI.WindowsForms.WritingSystems
{
public partial class WritingSystemSetupView : UserControl
{
private WritingSystemSetupModel _model;
public WritingSystemSetupView()
{
InitializeComponent();
}
public WritingSystemSetupView(WritingSystemSetupModel model)
: this()
{
BindToModel(model);
}
public void BindToModel(WritingSystemSetupModel model)
{
_model = model;
_model.MethodToShowUiToBootstrapNewDefinition= ShowCreateNewWritingSystemDialog;
_buttonBar.BindToModel(_model);
_propertiesTabControl.BindToModel(_model);
var treeModel = new WritingSystemTreeModel(_model);
treeModel.Suggestor = model.WritingSystemSuggestor;
_treeView.BindToModel(treeModel);
_model.SelectionChanged += UpdateHeaders;
_model.CurrentItemUpdated += UpdateHeaders;
UpdateHeaders(null, null);
}
/// <summary>
/// Use this to set the appropriate kinds of writing systems according to your
/// application. For example, is the user of your app likely to want voice? ipa? dialects?
/// </summary>
public WritingSystemSuggestor WritingSystemSuggestor
{
get { return _model.WritingSystemSuggestor; }
}
public int LeftColumnWidth
{
get { return splitContainer2.SplitterDistance; }
set { splitContainer2.SplitterDistance = value; }
}
public void SetWritingSystemsInRepo()
{
_propertiesTabControl.MoveDataFromViewToModel();
_model.SetAllPossibleAndRemoveOthers();
}
public void UnwireBeforeClosing()
{
_propertiesTabControl.UnwireBeforeClosing();
}
private void UpdateHeaders(object sender, EventArgs e)
{
if(_model.CurrentDefinition ==null)
{
_rfc4646.Text = "";
_languageName.Text = "";
}
else
{
_rfc4646.Text = _model.CurrentDefinition.Bcp47Tag;
_languageName.Text = _model.CurrentDefinition.ListLabel;
_languageName.Font = SystemFonts.MessageBoxFont;
_rfc4646.Font = SystemFonts.MessageBoxFont;
}
}
private static WritingSystemDefinition ShowCreateNewWritingSystemDialog()
{
var dlg= new LookupISOCodeDialog();
dlg.ShowDialog();
if(dlg.DialogResult!=DialogResult.OK)
return null;
var variant = String.Empty;
if(dlg.ISOCode == WellKnownSubTags.Unlisted.Language)
{
variant = "x-" + "Unlisted";
}
return new WritingSystemDefinition(dlg.ISOCode, string.Empty, string.Empty, variant, dlg.ISOCode, false);
}
private void _propertiesTabControl_Load(object sender, EventArgs e)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Palaso.UI.WindowsForms.WritingSystems.WSTree;
using Palaso.WritingSystems;
namespace Palaso.UI.WindowsForms.WritingSystems
{
public partial class WritingSystemSetupView : UserControl
{
private WritingSystemSetupModel _model;
public WritingSystemSetupView()
{
InitializeComponent();
}
public WritingSystemSetupView(WritingSystemSetupModel model)
: this()
{
BindToModel(model);
}
public void BindToModel(WritingSystemSetupModel model)
{
_model = model;
_model.MethodToShowUiToBootstrapNewDefinition= ShowCreateNewWritingSystemDialog;
_buttonBar.BindToModel(_model);
_propertiesTabControl.BindToModel(_model);
var treeModel = new WritingSystemTreeModel(_model);
treeModel.Suggestor = model.WritingSystemSuggestor;
_treeView.BindToModel(treeModel);
_model.SelectionChanged += UpdateHeaders;
_model.CurrentItemUpdated += UpdateHeaders;
UpdateHeaders(null, null);
}
/// <summary>
/// Use this to set the appropriate kinds of writing systems according to your
/// application. For example, is the user of your app likely to want voice? ipa? dialects?
/// </summary>
public WritingSystemSuggestor WritingSystemSuggestor
{
get { return _model.WritingSystemSuggestor; }
}
public int LeftColumnWidth
{
get { return splitContainer2.SplitterDistance; }
set { splitContainer2.SplitterDistance = value; }
}
public void SetWritingSystemsInRepo()
{
_propertiesTabControl.MoveDataFromViewToModel();
_model.SetAllPossibleAndRemoveOthers();
}
public void UnwireBeforeClosing()
{
_propertiesTabControl.UnwireBeforeClosing();
}
private void UpdateHeaders(object sender, EventArgs e)
{
if(_model.CurrentDefinition ==null)
{
_rfc4646.Text = "";
_languageName.Text = "";
}
else
{
_rfc4646.Text = _model.CurrentDefinition.Bcp47Tag;
_languageName.Text = _model.CurrentDefinition.ListLabel;
}
}
private static WritingSystemDefinition ShowCreateNewWritingSystemDialog()
{
var dlg= new LookupISOCodeDialog();
dlg.ShowDialog();
if(dlg.DialogResult!=DialogResult.OK)
return null;
var variant = String.Empty;
if(dlg.ISOCode == WellKnownSubTags.Unlisted.Language)
{
variant = "x-" + "Unlisted";
}
return new WritingSystemDefinition(dlg.ISOCode, string.Empty, string.Empty, variant, dlg.ISOCode, false);
}
private void _propertiesTabControl_Load(object sender, EventArgs e)
{
}
}
}
|
mit
|
C#
|
ea419ce94d42ff06ce3cd5ce53f58b2df4884554
|
Update AssemblyInfo.cs
|
Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal
|
Master/Appleseed/Projects/Appleseed.Framework.Providers.AppleseedSqlTableProfileProvider/Properties/AssemblyInfo.cs
|
Master/Appleseed/Projects/Appleseed.Framework.Providers.AppleseedSqlTableProfileProvider/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("SqlTableProfileProvider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("SqlTableProfileProvider")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-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("e4837a25-2ba1-428f-9251-6ce0d96edc84")]
// 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.4.98.383")]
[assembly: AssemblyFileVersion("1.4.98.383")]
|
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("SqlTableProfileProvider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("SqlTableProfileProvider")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e4837a25-2ba1-428f-9251-6ce0d96edc84")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
638ebba9c3052a5f34d1051531b84f585eb5fe4a
|
Update garbage spewing client to use test doubles namespace.
|
jagrem/msg
|
src/Msg.Acceptance.Tests/TestDoubles/GarbageSpewingClient.cs
|
src/Msg.Acceptance.Tests/TestDoubles/GarbageSpewingClient.cs
|
using System.Threading.Tasks;
using Version = Msg.Domain.Version;
using System;
using System.Net.Sockets;
using System.Net;
namespace Msg.Acceptance.Tests.TestDoubles
{
class GarbageSpewingClient
{
TcpClient client;
public async Task<byte[]> ConnectAsync() {
client = new TcpClient ();
await client.ConnectAsync (IPAddress.Loopback, 1984);
var stream = client.GetStream ();
await stream.WriteAsync (new byte[] { 1, 9, 8, 4 }, 0, 4);
var buffer = new byte[8];
await stream.ReadAsync (buffer, 0, 8);
return buffer;
}
public bool IsConnected()
{
return client != null && client.Connected;
}
}
}
|
using System.Threading.Tasks;
using Version = Msg.Domain.Version;
using System;
using System.Net.Sockets;
using System.Net;
namespace Msg.Acceptance.Tests
{
class GarbageSpewingClient
{
TcpClient client;
public async Task<byte[]> ConnectAsync() {
client = new TcpClient ();
await client.ConnectAsync (IPAddress.Loopback, 1984);
var stream = client.GetStream ();
await stream.WriteAsync (new byte[] { 1, 9, 8, 4 }, 0, 4);
var buffer = new byte[8];
await stream.ReadAsync (buffer, 0, 8);
return buffer;
}
public bool IsConnected()
{
return client != null && client.Connected;
}
}
}
|
apache-2.0
|
C#
|
982a108d2e85ff67cc195f136fcc5d4e5a4d2c1a
|
Add isDisabled to ApplicationLanguage ctor.
|
abdllhbyrktr/module-zero,aspnetboilerplate/module-zero
|
src/Abp.Zero.Common/Localization/ApplicationLanguage.cs
|
src/Abp.Zero.Common/Localization/ApplicationLanguage.cs
|
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
namespace Abp.Localization
{
/// <summary>
/// Represents a language of the application.
/// </summary>
[Serializable]
[Table("AbpLanguages")]
public class ApplicationLanguage : FullAuditedEntity, IMayHaveTenant
{
/// <summary>
/// The maximum name length.
/// </summary>
public const int MaxNameLength = 10;
/// <summary>
/// The maximum display name length.
/// </summary>
public const int MaxDisplayNameLength = 64;
/// <summary>
/// The maximum icon length.
/// </summary>
public const int MaxIconLength = 128;
/// <summary>
/// TenantId of this entity. Can be null for host.
/// </summary>
public virtual int? TenantId { get; set; }
/// <summary>
/// Gets or sets the name of the culture, like "en" or "en-US".
/// </summary>
[Required]
[StringLength(MaxNameLength)]
public virtual string Name { get; set; }
/// <summary>
/// Gets or sets the display name.
/// </summary>
[Required]
[StringLength(MaxDisplayNameLength)]
public virtual string DisplayName { get; set; }
/// <summary>
/// Gets or sets the icon.
/// </summary>
[StringLength(MaxIconLength)]
public virtual string Icon { get; set; }
/// <summary>
/// Is this language active. Inactive languages are not get by <see cref="IApplicationLanguageManager"/>.
/// </summary>
public bool IsDisabled { get; set; }
/// <summary>
/// Creates a new <see cref="ApplicationLanguage"/> object.
/// </summary>
public ApplicationLanguage()
{
}
public ApplicationLanguage(int? tenantId, string name, string displayName, string icon = null, bool isDisabled = false)
{
TenantId = tenantId;
Name = name;
DisplayName = displayName;
Icon = icon;
IsDisabled = isDisabled;
}
public virtual LanguageInfo ToLanguageInfo()
{
return new LanguageInfo(Name, DisplayName, Icon, isDisabled: IsDisabled);
}
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
namespace Abp.Localization
{
/// <summary>
/// Represents a language of the application.
/// </summary>
[Serializable]
[Table("AbpLanguages")]
public class ApplicationLanguage : FullAuditedEntity, IMayHaveTenant
{
/// <summary>
/// The maximum name length.
/// </summary>
public const int MaxNameLength = 10;
/// <summary>
/// The maximum display name length.
/// </summary>
public const int MaxDisplayNameLength = 64;
/// <summary>
/// The maximum icon length.
/// </summary>
public const int MaxIconLength = 128;
/// <summary>
/// TenantId of this entity. Can be null for host.
/// </summary>
public virtual int? TenantId { get; set; }
/// <summary>
/// Gets or sets the name of the culture, like "en" or "en-US".
/// </summary>
[Required]
[StringLength(MaxNameLength)]
public virtual string Name { get; set; }
/// <summary>
/// Gets or sets the display name.
/// </summary>
[Required]
[StringLength(MaxDisplayNameLength)]
public virtual string DisplayName { get; set; }
/// <summary>
/// Gets or sets the icon.
/// </summary>
[StringLength(MaxIconLength)]
public virtual string Icon { get; set; }
/// <summary>
/// Is this language active. Inactive languages are not get by <see cref="IApplicationLanguageManager"/>.
/// </summary>
public bool IsDisabled { get; set; }
/// <summary>
/// Creates a new <see cref="ApplicationLanguage"/> object.
/// </summary>
public ApplicationLanguage()
{
}
public ApplicationLanguage(int? tenantId, string name, string displayName, string icon = null)
{
TenantId = tenantId;
Name = name;
DisplayName = displayName;
Icon = icon;
}
public virtual LanguageInfo ToLanguageInfo()
{
return new LanguageInfo(Name, DisplayName, Icon, isDisabled: IsDisabled);
}
}
}
|
mit
|
C#
|
a7ffa8e95c1906276cd035c16383466c2eacb8a3
|
Remove parent attribute in FloorSwitch
|
Steguer/MTLGJ,Steguer/MTLGJ
|
Assets/Scripts/FloorSwitch.cs
|
Assets/Scripts/FloorSwitch.cs
|
using UnityEngine;
using System.Collections;
public class FloorSwitch : Switch {
public bool state = false;
public Sprite sprite1;
public Sprite sprite2;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D(Collider2D collider2d)
{
Debug.Log("Entering");
GetComponent<SpriteRenderer>().sprite = sprite2;
parent.activateEvent();
}
void OnTriggerStay2D(Collider2D collider2d) {
}
void OnTriggerExit2D(Collider2D collider2d)
{
Debug.Log("Exiting");
GetComponent<SpriteRenderer>().sprite = sprite1;
parent.deactivateEvent();
}
}
|
using UnityEngine;
using System.Collections;
public class FloorSwitch : Switch {
public bool state = false;
public SwitchEvent parent;
public Sprite sprite1;
public Sprite sprite2;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D(Collider2D collider2d)
{
Debug.Log("Entering");
GetComponent<SpriteRenderer>().sprite = sprite2;
parent.activateEvent();
}
void OnTriggerStay2D(Collider2D collider2d) {
}
void OnTriggerExit2D(Collider2D collider2d)
{
Debug.Log("Exiting");
GetComponent<SpriteRenderer>().sprite = sprite1;
parent.deactivateEvent();
}
}
|
mit
|
C#
|
cd0834beedd0c2aaa4cec8ecdff2118f23180dfb
|
Convert line endings to CR (unix) in both samples before comparing.
|
Stift/SlimJim,themotleyfool/SlimJim
|
src/SlimJim.Test/Infrastructure/SlnFileRendererTests.cs
|
src/SlimJim.Test/Infrastructure/SlnFileRendererTests.cs
|
using NUnit.Framework;
using SlimJim.Infrastructure;
using SlimJim.Model;
using SlimJim.Test.Model;
using SlimJim.Test.SampleFiles;
namespace SlimJim.Test.Infrastructure
{
[TestFixture]
public class SlnFileRendererTests
{
private Sln solution;
private SlnFileRenderer renderer;
private ProjectPrototypes projects;
[SetUp]
public void BeforeEach()
{
projects = new ProjectPrototypes();
}
[Test]
public void EmptySolution()
{
MakeSolution("BlankSolution");
TestRender();
}
[Test]
public void SingleProjectSolution()
{
MakeSolution("SingleProject", projects.MyProject);
TestRender();
}
[Test]
public void ThreeProjectSolution()
{
MakeSolution("ThreeProjects", projects.MyProject, projects.OurProject1, projects.OurProject2);
TestRender();
}
[Test]
public void ManyProjectSolution()
{
MakeSolution("ManyProjects", projects.MyProject, projects.OurProject1, projects.OurProject2,
projects.TheirProject1, projects.TheirProject2, projects.TheirProject3);
TestRender();
}
[Test]
public void VisualStudio2008Solution()
{
MakeSolution("VS2008");
solution.Version = VisualStudioVersion.VS2008;
TestRender();
}
private void MakeSolution(string name, params CsProj[] csProjs)
{
solution = new Sln(name, "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}");
solution.AddProjects(csProjs);
}
private void TestRender()
{
renderer = new SlnFileRenderer(solution);
string actualContents = renderer.Render().Replace("\r\n", "\n");
string expectedContents = SampleFileHelper.GetSlnFileContents(solution.Name).Replace("\r\n", "\n");
Assert.That(actualContents, Is.EqualTo(expectedContents));
}
}
}
|
using NUnit.Framework;
using SlimJim.Infrastructure;
using SlimJim.Model;
using SlimJim.Test.Model;
using SlimJim.Test.SampleFiles;
namespace SlimJim.Test.Infrastructure
{
[TestFixture]
public class SlnFileRendererTests
{
private Sln solution;
private SlnFileRenderer renderer;
private ProjectPrototypes projects;
[SetUp]
public void BeforeEach()
{
projects = new ProjectPrototypes();
}
[Test]
public void EmptySolution()
{
MakeSolution("BlankSolution");
TestRender();
}
[Test]
public void SingleProjectSolution()
{
MakeSolution("SingleProject", projects.MyProject);
TestRender();
}
[Test]
public void ThreeProjectSolution()
{
MakeSolution("ThreeProjects", projects.MyProject, projects.OurProject1, projects.OurProject2);
TestRender();
}
[Test]
public void ManyProjectSolution()
{
MakeSolution("ManyProjects", projects.MyProject, projects.OurProject1, projects.OurProject2,
projects.TheirProject1, projects.TheirProject2, projects.TheirProject3);
TestRender();
}
[Test]
public void VisualStudio2008Solution()
{
MakeSolution("VS2008");
solution.Version = VisualStudioVersion.VS2008;
TestRender();
}
private void MakeSolution(string name, params CsProj[] csProjs)
{
solution = new Sln(name, "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}");
solution.AddProjects(csProjs);
}
private void TestRender()
{
renderer = new SlnFileRenderer(solution);
string actualContents = renderer.Render();
string expectedContents = SampleFileHelper.GetSlnFileContents(solution.Name);
Assert.That(actualContents, Is.EqualTo(expectedContents));
}
}
}
|
mit
|
C#
|
ba268d4648f12bb78df3272c177aa186c5f63b6a
|
make fluent. because why not
|
Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen
|
Dashen/DashenConfiguration.cs
|
Dashen/DashenConfiguration.cs
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Net.Http;
using Dashen.Endpoints.Static.ContentProviders;
using Dashen.Infrastructure;
namespace Dashen
{
public class DashenConfiguration
{
public Uri ListenOn { get; set; }
public Color HighlightColor { get; set; }
public Color LowlightColor { get; set; }
public List<DelegatingHandler> MessageHandlers { get; private set; }
internal Dictionary<string, AdhocContentProvider.ResourceContent> Resources { get; private set; }
public DashenConfiguration()
{
Resources = new Dictionary<string, AdhocContentProvider.ResourceContent>();
MessageHandlers = new List<DelegatingHandler>();
ListenOn = new Uri("http://localhost:8080");
HighlightColor = ColorTranslator.FromHtml("#33CC33");
LowlightColor = ColorTranslator.FromHtml("#248F24");
}
/// <summary>
/// Adds a resource to be used in the webui.
/// </summary>
/// <param name="relativeUrlFragment">The relative path, e.g. "/img/good.png"</param>
/// <param name="content">The content to be used. The stream can be safely closed after this call.</param>
/// <param name="mimeType">The mimetype for the resource, e.g. "image/png"</param>
public DashenConfiguration AddResource(string relativeUrlFragment, Stream content, string mimeType)
{
using (var ms = new MemoryStream())
{
content.CopyTo(ms);
Resources[relativeUrlFragment] = new AdhocContentProvider.ResourceContent
{
StreamBytes = ms.ToArray(),
MimeType = mimeType
};
}
return this;
}
/// <summary>
/// Logs all requests to the Console.<br/>
/// To add custom handlers, use the <see cref="MessageHandlers"/> property.
/// </summary>
public DashenConfiguration EnableConsoleLog()
{
MessageHandlers.Add(new ConsoleLoggingHandler());
return this;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Net.Http;
using Dashen.Endpoints.Static.ContentProviders;
using Dashen.Infrastructure;
namespace Dashen
{
public class DashenConfiguration
{
public Uri ListenOn { get; set; }
public Color HighlightColor { get; set; }
public Color LowlightColor { get; set; }
public List<DelegatingHandler> MessageHandlers { get; private set; }
internal Dictionary<string, AdhocContentProvider.ResourceContent> Resources { get; private set; }
public DashenConfiguration()
{
Resources = new Dictionary<string, AdhocContentProvider.ResourceContent>();
MessageHandlers = new List<DelegatingHandler>();
ListenOn = new Uri("http://localhost:8080");
HighlightColor = ColorTranslator.FromHtml("#33CC33");
LowlightColor = ColorTranslator.FromHtml("#248F24");
}
/// <summary>
/// Adds a resource to be used in the webui.
/// </summary>
/// <param name="relativeUrlFragment">The relative path, e.g. "/img/good.png"</param>
/// <param name="content">The content to be used. The stream can be safely closed after this call.</param>
/// <param name="mimeType">The mimetype for the resource, e.g. "image/png"</param>
public void AddResource(string relativeUrlFragment, Stream content, string mimeType)
{
using (var ms = new MemoryStream())
{
content.CopyTo(ms);
Resources[relativeUrlFragment] = new AdhocContentProvider.ResourceContent
{
StreamBytes = ms.ToArray(),
MimeType = mimeType
};
}
}
/// <summary>
/// Logs all requests to the Console.<br/>
/// To add custom handlers, use the <see cref="MessageHandlers"/> property.
/// </summary>
public void EnableConsoleLog()
{
MessageHandlers.Add(new ConsoleLoggingHandler());
}
}
}
|
lgpl-2.1
|
C#
|
49f4aa6a6a916ed4f7803e96f04fbed2f35b56ff
|
Update Sampling.cs
|
matt77hias/cs-smallpt
|
cs-smallpt/core/Sampling.cs
|
cs-smallpt/core/Sampling.cs
|
using System;
namespace cs_smallpt {
public static class Sampling {
public static Vector3 UniformSampleOnHemisphere(double u1, double u2) {
double sin_theta = Math.Sqrt(Math.Max(0.0, 1.0 - u1 * u1));
double phi = 2.0 * MathUtils.M_PI * u2;
return new Vector3(Math.Cos(phi) * sin_theta, Math.Sin(phi) * sin_theta, u1);
}
public static Vector3 CosineWeightedSampleOnHemisphere(double u1, double u2) {
double cos_theta = Math.Sqrt(1.0 - u1);
double sin_theta = Math.Sqrt(u1);
double phi = 2.0 * MathUtils.M_PI * u2;
return new Vector3(Math.Cos(phi) * sin_theta, Math.Sin(phi) * sin_theta, cos_theta);
}
}
}
|
using System;
namespace cs_smallpt {
public class Sampling {
public static Vector3 UniformSampleOnHemisphere(double u1, double u2) {
double sin_theta = Math.Sqrt(Math.Max(0.0, 1.0 - u1 * u1));
double phi = 2.0 * MathUtils.M_PI * u2;
return new Vector3(Math.Cos(phi) * sin_theta, Math.Sin(phi) * sin_theta, u1);
}
public static Vector3 CosineWeightedSampleOnHemisphere(double u1, double u2) {
double cos_theta = Math.Sqrt(1.0 - u1);
double sin_theta = Math.Sqrt(u1);
double phi = 2.0 * MathUtils.M_PI * u2;
return new Vector3(Math.Cos(phi) * sin_theta, Math.Sin(phi) * sin_theta, cos_theta);
}
}
}
|
mit
|
C#
|
3af4b83c2d7c5090f3e95063bc6ae5b293abc7a6
|
Make benchmark more accurate
|
iarovyi/EasyHash
|
EasyHash.Benchmark/Program.cs
|
EasyHash.Benchmark/Program.cs
|
namespace EasyHash.Benchmark
{
using System;
using System.Diagnostics;
using System.Threading;
using FizzWare.NBuilder;
using static System.Console;
using static Helpers.ConsoleHelper;
class Program
{
private const int Times = 1000000;
static void Main(string[] args)
{
try
{
WriteLine($"Benchmark started", ConsoleColor.Green);
WriteLine($"Each hashing implementation will be executed {Times} times", ConsoleColor.Green);
long manualMs = Benchmark(New<HashedManually>());
WriteLine($"1) Hashing with regular implementation: {manualMs}");
long easyHashMs = Benchmark(New<HashedWithEasyHash>());
WriteLine($"2) Hashing with EasyHash: {easyHashMs}");
long reflectionMs = Benchmark(New<HashedWithReflection>());
WriteLine($"3) Hashing with cached reflection: {reflectionMs}");
WriteLine($"Benchmark Finished", ConsoleColor.Green);
}
catch (Exception ex)
{
WriteLine(ex.Message, ConsoleColor.Red);
}
WriteLine("Press enter to exit", ConsoleColor.Yellow);
ReadKey();
}
private static T New<T>() => Builder<T>.CreateNew().Build();
private static long Benchmark(object target, int times = Times)
{
InitBenchmark();
//Warm up processor cache
for (int i = 0; i < times; i++)
{
target.GetHashCode();
}
var sw = Stopwatch.StartNew();
for (int i = 0; i < times; i++)
{
target.GetHashCode();
}
return sw.ElapsedMilliseconds;
}
private static void InitBenchmark()
{
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
Thread.CurrentThread.Priority = ThreadPriority.Highest;
//Force thread to be executed on core #1 as result preventing thread to jump between cores.
Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(1);
GC.Collect();
}
}
}
|
namespace EasyHash.Benchmark
{
using System;
using System.Diagnostics;
using FizzWare.NBuilder;
using static System.Console;
using static Helpers.ConsoleHelper;
class Program
{
private const int Times = 1000000;
static void Main(string[] args)
{
try
{
WriteLine($"Benchmark started", ConsoleColor.Green);
WriteLine($"Each hashing implementation will be executed {Times} times", ConsoleColor.Green);
long manualMs = Benchmark(New<HashedManually>());
WriteLine($"1) Hashing with regular implementation: {manualMs}");
long easyHashMs = Benchmark(New<HashedWithEasyHash>());
WriteLine($"2) Hashing with EasyHash: {easyHashMs}");
long reflectionMs = Benchmark(New<HashedWithReflection>());
WriteLine($"3) Hashing with cached reflection: {reflectionMs}");
WriteLine($"Benchmark Finished", ConsoleColor.Green);
}
catch (Exception ex)
{
WriteLine(ex.Message, ConsoleColor.Red);
}
WriteLine("Press enter to exit", ConsoleColor.Yellow);
ReadKey();
}
private static T New<T>() => Builder<T>.CreateNew().Build();
private static long Benchmark(object target, int times = Times)
{
var sw = new Stopwatch();
target.GetHashCode();
sw.Start();
for (int i = 0; i < times; i++)
{
target.GetHashCode();
}
return sw.ElapsedMilliseconds;
}
}
}
|
mit
|
C#
|
a4ba4106fa3eab31f4dca561a1e220775923c758
|
Comment update
|
JScott/cardboard-controls,harschell/cardboard-controls,zodsoft/cardboard-controls
|
ExampleCharacterController.cs
|
ExampleCharacterController.cs
|
using UnityEngine;
using System.Collections;
public class ExampleCharacterController : MonoBehaviour {
private static CardboardInput cardboard;
private Vector3 moveDirection = Vector3.zero;
private CharacterController controller;
void Start () {
controller = GetComponent<CharacterController>();
/*
Start by declaring an instance of CardboardInput.
This is a good point to pass your methods to its delegates.
Unity provides a good primer on delegates here:
http://unity3d.com/learn/tutorials/modules/intermediate/scripting/delegates
*/
cardboard = new CardboardInput();
cardboard.OnMagnetDown += CardboardDown; // When the magnet goes down
cardboard.OnMagnetUp += CardboardUp; // When the magnet comes back up
// When the magnet goes down and up within the "click threshold" time
// That limit is public as cardboard.clickSpeedThreshold
cardboard.OnMagnetClicked += CardboardClick;
// Not shown here is the OnMagnetMoved delegate.
// This is triggered when the magnet goes up or down.
}
/*
In this demo, we change sphere colours for each event triggered.
The CardboardEvent will eventually pass useful data related to the event
but it's currently just a placeholder.
*/
public void CardboardDown(object sender, CardboardEvent cardboardEvent) {
ChangeSphereColor("SphereDown");
}
public void CardboardUp(object sender, CardboardEvent cardboardEvent) {
ChangeSphereColor("SphereUp");
}
public void CardboardClick(object sender, CardboardEvent cardboardEvent) {
ChangeSphereColor("SphereClick");
TextMesh textMesh = GameObject.Find("SphereClick/Counter").GetComponent<TextMesh>();
int increment = int.Parse(textMesh.text) + 1;
textMesh.text = increment.ToString();
}
public void ChangeSphereColor(string name) {
GameObject sphere = GameObject.Find(name);
sphere.renderer.material.color = new Color(Random.value, Random.value, Random.value);
}
/*
During our game we can utilize data from CardboardInput.
*/
void Update() {
TextMesh textMesh = GameObject.Find("SphereDown/Counter").GetComponent<TextMesh>();
// Be sure to update CardboardInput during your cycle
cardboard.Update();
// IsMagnetHeld is true when the magnet has gone down but not back up yet.
if (!cardboard.IsMagnetHeld() ) {
textMesh.renderer.enabled = Time.time % 1 < 0.5;
}
else {
textMesh.renderer.enabled = true;
// SecondsMagnetHeld is the number of seconds we've held the magnet down.
// It stops when when the magnet goes up and resets when the magnet goes down.
textMesh.text = cardboard.SecondsMagnetHeld().ToString("#.##");
}
// Not shown here is the WasClicked method.
// This tells you if magnet was clicked
// since the last time the method was called.
}
}
|
using UnityEngine;
using System.Collections;
public class ExampleCharacterController : MonoBehaviour {
private static CardboardInput cardboard;
private Vector3 moveDirection = Vector3.zero;
private CharacterController controller;
void Start () {
controller = GetComponent<CharacterController>();
/*
Start by declaring an instance of CardboardInput.
This is a good point to pass your methods to its delegates.
*/
cardboard = new CardboardInput();
cardboard.OnMagnetDown += CardboardDown; // When the magnet goes down
cardboard.OnMagnetUp += CardboardUp; // When the magnet comes back up
// When the magnet goes down and up within the "click threshold" time
// That limit is public as cardboard.clickSpeedThreshold
cardboard.OnMagnetClicked += CardboardClick;
// Not shown here is the OnMagnetMoved delegate.
// This is triggered when the magnet goes up or down.
}
/*
In this demo, we change sphere colours for each event triggered.
The CardboardEvent will eventually pass useful data related to the event
but it's currently just a placeholder.
*/
public void CardboardDown(object sender, CardboardEvent cardboardEvent) {
ChangeSphereColor("SphereDown");
}
public void CardboardUp(object sender, CardboardEvent cardboardEvent) {
ChangeSphereColor("SphereUp");
}
public void CardboardClick(object sender, CardboardEvent cardboardEvent) {
ChangeSphereColor("SphereClick");
TextMesh textMesh = GameObject.Find("SphereClick/Counter").GetComponent<TextMesh>();
int increment = int.Parse(textMesh.text) + 1;
textMesh.text = increment.ToString();
}
public void ChangeSphereColor(string name) {
GameObject sphere = GameObject.Find(name);
sphere.renderer.material.color = new Color(Random.value, Random.value, Random.value);
}
/*
During our game we can utilize data from CardboardInput.
*/
void Update() {
TextMesh textMesh = GameObject.Find("SphereDown/Counter").GetComponent<TextMesh>();
// Be sure to update CardboardInput during your cycle
cardboard.Update();
// IsMagnetHeld is true when the magnet has gone down but not back up yet.
if (!cardboard.IsMagnetHeld() ) {
textMesh.renderer.enabled = Time.time % 1 < 0.5;
}
else {
textMesh.renderer.enabled = true;
// SecondsMagnetHeld is the number of seconds we've held the magnet down.
// It stops when when the magnet goes up and resets when the magnet goes down.
textMesh.text = cardboard.SecondsMagnetHeld().ToString("#.##");
}
// Not shown here is the WasClicked method.
// This tells you if magnet was clicked
// since the last time the method was called.
}
}
|
mit
|
C#
|
545fa93e4829dc260f966095518c0a8ec80b8396
|
Update to use correct ISO code
|
yadyn/JabbR,yadyn/JabbR,M-Zuber/JabbR,JabbR/JabbR,yadyn/JabbR,M-Zuber/JabbR,JabbR/JabbR
|
JabbR/Commands/FlagCommand.cs
|
JabbR/Commands/FlagCommand.cs
|
using System;
using JabbR.Models;
using JabbR.Services;
namespace JabbR.Commands
{
[Command("flag", "Flag_CommandInfo", "Iso 3166-2 Code", "user")]
public class FlagCommand : UserCommand
{
public override void Execute(CommandContext context, CallerContext callerContext, ChatUser callingUser, string[] args)
{
if (args.Length == 0)
{
// Clear the flag.
callingUser.Flag = null;
}
else
{
// Set the flag.
string isoCode = String.Join(" ", args[0]).ToLowerInvariant();
ChatService.ValidateIsoCode(isoCode);
callingUser.Flag = isoCode;
}
context.NotificationService.ChangeFlag(callingUser);
context.Repository.CommitChanges();
}
}
}
|
using System;
using JabbR.Models;
using JabbR.Services;
namespace JabbR.Commands
{
[Command("flag", "Flag_CommandInfo", "Iso 3366-2 Code", "user")]
public class FlagCommand : UserCommand
{
public override void Execute(CommandContext context, CallerContext callerContext, ChatUser callingUser, string[] args)
{
if (args.Length == 0)
{
// Clear the flag.
callingUser.Flag = null;
}
else
{
// Set the flag.
string isoCode = String.Join(" ", args[0]).ToLowerInvariant();
ChatService.ValidateIsoCode(isoCode);
callingUser.Flag = isoCode;
}
context.NotificationService.ChangeFlag(callingUser);
context.Repository.CommitChanges();
}
}
}
|
mit
|
C#
|
703239916bf3b76a90dd356db8eae11bfdece7f0
|
add cancellations
|
alexbabkin/ReCaster
|
MCatcher/IMulticastCatcher.cs
|
MCatcher/IMulticastCatcher.cs
|
using System.Threading;
namespace Recaster.MCatcher
{
interface IMulticastCatcher
{
void Start();
void Stop();
}
}
|
using System.Threading;
namespace Recaster.MCatcher
{
interface IMulticastCatcher
{
void Start(CancellationToken ct);
void Stop();
}
}
|
mit
|
C#
|
9ecc89bb88717fb957d93faea3c653b21303b6fa
|
fix build bug
|
qin-nz/kanbanflow-csharp-sdk
|
KanbanFlow.CSharpSDK/KanbanFlow.CSharpSDK/KanbanFlowClient.cs
|
KanbanFlow.CSharpSDK/KanbanFlow.CSharpSDK/KanbanFlowClient.cs
|
using KanbanFlow.CSharpSDK.Internal;
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace KanbanFlow.CSharpSDK
{
public class KanbanFlowClient : HttpClient
{
public KanbanFlowClient(string apiToken, string baseAddress = "https://kanbanflow.com/api/v1/")
{
if (string.IsNullOrWhiteSpace(apiToken))
{
throw new ArgumentNullException(nameof(apiToken));
}
string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes("apiToken:" + apiToken));
BaseAddress = new Uri(baseAddress);
DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", base64);
}
public async Task<Board> GetBoardAsync()
{
Board board = new Board(this);
var boardResponse = await GetBoardInfo();
board.Id = boardResponse.Id;
board.Name = boardResponse.Name;
board.Users = await GetUsers();
board.Cells = await GetAllTasks(board);
return board;
}
private async Task<GetBoardResponse> GetBoardInfo()
{
var body = await GetStringAsync("board");
return JsonConvert.DeserializeObject<GetBoardResponse>(body);
}
private async Task<User[]> GetUsers()
{
var body = await GetStringAsync("users");
return JsonConvert.DeserializeObject<User[]>(body);
}
internal async Task<Cell[]> GetAllTasks(Board board)
{
var body = await GetStringAsync("tasks");
var cells = JsonConvert.DeserializeObject<Cell[]>(body);
foreach (var cell in cells)
{
foreach (var task in cell.Tasks)
{
task.Board = board;
task.BoradClient = this;
}
}
return cells;
}
}
}
|
using KanbanFlow.CSharpSDK.Internal;
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace KanbanFlow.CSharpSDK
{
public class KanbanFlowClient : HttpClient
{
public KanbanFlowClient(string apiToken, string baseAddress = "https://kanbanflow.com/api/v1/")
{
if (string.IsNullOrWhiteSpace(apiToken))
{
throw new ArgumentNullException(nameof(apiToken));
}
string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes("apiToken:" + apiToken));
BaseAddress = new Uri(baseAddress);
DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", base64);
}
public async Task<Board> GetBoardAsync()
{
Board board = new Board(this);
var boardResponse = await GetBoardInfo();
board.Id = boardResponse.Id;
board.Name = boardResponse.Name;
board.Users = await GetUsers();
board.Cells = await GetAllTasks(board);
return board;
}
private async Task<GetBoardResponse> GetBoardInfo()
{
var body = await GetStringAsync("board");
return JsonConvert.DeserializeObject<GetBoardResponse>(body);
}
private async Task<User[]> GetUsers()
{
var body = await GetStringAsync("users");
return JsonConvert.DeserializeObject<User[]>(body);
}
private async Task<Cell[]> GetAllTasks(Board board)
{
var body = await GetStringAsync("tasks");
var cells = JsonConvert.DeserializeObject<Cell[]>(body);
foreach (var cell in cells)
{
foreach (var task in cell.Tasks)
{
task.Board = board;
task.BoradClient = this;
}
}
return cells;
}
}
}
|
mit
|
C#
|
6277d032adec3dbe0b08b85502ae5da6100d9226
|
remove blank line
|
DrabWeb/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework
|
osu.Framework/Input/IDontLogKeyPresses.cs
|
osu.Framework/Input/IDontLogKeyPresses.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Framework.Input
{
/// <summary>
/// Marker interface which allows to suppress logging of keyboard input.
/// </summary>
public interface IDontLogKeyPresses
{
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Framework.Input
{
/// <summary>
/// Marker interface which allows to suppress logging of keyboard input.
/// </summary>
public interface IDontLogKeyPresses
{
}
}
|
mit
|
C#
|
73ede914999efb21429cc93399e281e7d4ddbd2f
|
Implement GetNextRawLine() in class 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 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++];
}
}
}
|
using System.Collections.Generic;
using System.IO;
namespace ScooterController
{
class InstructionInterpreter
{
private readonly List<string> instructionRawLines;
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()
{
return new HardwareInstruction();
}
}
}
|
mit
|
C#
|
15b321ac07e017f9344ba964dc44c7302621f2d4
|
Add get best id method for user images.
|
henrikfroehling/TraktApiSharp
|
Source/Lib/TraktApiSharp/Objects/Get/Users/TraktUserImages.cs
|
Source/Lib/TraktApiSharp/Objects/Get/Users/TraktUserImages.cs
|
namespace TraktApiSharp.Objects.Get.Users
{
using Basic;
using Newtonsoft.Json;
/// <summary>A collection of images and image sets for a Trakt user.</summary>
public class TraktUserImages
{
/// <summary>Gets or sets the avatar image.</summary>
[JsonProperty(PropertyName = "avatar")]
public TraktImage Avatar { get; set; }
}
}
|
namespace TraktApiSharp.Objects.Get.Users
{
using Basic;
using Newtonsoft.Json;
public class TraktUserImages
{
[JsonProperty(PropertyName = "avatar")]
public TraktImage Avatar { get; set; }
}
}
|
mit
|
C#
|
c5dfca606d316027cd1a6d267d4d872c68f62b42
|
Add binding mode and comment.
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml.cs
|
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml.cs
|
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Markup.Xaml;
using ReactiveUI;
using System;
using System.Reactive.Linq;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinListView : UserControl
{
public static readonly StyledProperty<bool> SelectAllNonPrivateVisibleProperty =
AvaloniaProperty.Register<CoinListView, bool>(nameof(SelectAllNonPrivateVisible), defaultBindingMode: BindingMode.OneWayToSource);
public bool SelectAllNonPrivateVisible
{
get => GetValue(SelectAllNonPrivateVisibleProperty);
set => SetValue(SelectAllNonPrivateVisibleProperty, value);
}
public CoinListView()
{
InitializeComponent();
SelectAllNonPrivateVisible = true;
this.WhenAnyValue(x => x.DataContext)
.Subscribe(dataContext =>
{
if (dataContext is CoinListViewModel viewmodel)
{
// Value is only propagated when DataContext is set at the beginning.
viewmodel.SelectAllNonPrivateVisible = SelectAllNonPrivateVisible;
}
});
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Markup.Xaml;
using ReactiveUI;
using System;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinListView : UserControl
{
public static readonly StyledProperty<bool> SelectAllNonPrivateVisibleProperty =
AvaloniaProperty.Register<CoinListView, bool>(nameof(SelectAllNonPrivateVisible), defaultBindingMode: BindingMode.TwoWay);
public bool SelectAllNonPrivateVisible
{
get => GetValue(SelectAllNonPrivateVisibleProperty);
set => SetValue(SelectAllNonPrivateVisibleProperty, value);
}
public CoinListView()
{
InitializeComponent();
SelectAllNonPrivateVisible = true;
this.WhenAnyValue(x => x.DataContext)
.Subscribe(dataContext =>
{
if (dataContext is CoinListViewModel viewmodel)
{
viewmodel.SelectAllNonPrivateVisible = SelectAllNonPrivateVisible;
}
});
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
mit
|
C#
|
a339c5ea87c90b5c9017724db7d6470da2647271
|
Fix CodeFactor
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi/Backend/Models/Responses/CcjRunningRoundState.cs
|
WalletWasabi/Backend/Models/Responses/CcjRunningRoundState.cs
|
using NBitcoin;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using WalletWasabi.JsonConverters;
using WalletWasabi.Models.ChaumianCoinJoin;
namespace WalletWasabi.Backend.Models.Responses
{
public class CcjRunningRoundState
{
[JsonConverter(typeof(StringEnumConverter))]
public CcjRoundPhase Phase { get; set; }
[JsonConverter(typeof(MoneyBtcJsonConverter))]
public Money Denomination { get; set; }
[JsonConverter(typeof(BlockCypherDateTimeOffsetJsonConverter))]
public DateTimeOffset InputRegistrationTimesout { get; set; }
public IEnumerable<SchnorrPubKey> SchnorrPubKeys { get; set; }
public int RegisteredPeerCount { get; set; }
public int RequiredPeerCount { get; set; }
public int MaximumInputCountPerPeer { get; set; }
public int RegistrationTimeout { get; set; }
[JsonConverter(typeof(MoneySatoshiJsonConverter))]
public Money FeePerInputs { get; set; }
[JsonConverter(typeof(MoneySatoshiJsonConverter))]
public Money FeePerOutputs { get; set; }
public decimal CoordinatorFeePercent { get; set; }
public long RoundId { get; set; }
/// <summary>
/// This is round independent, it is only here because of backward compatibility.
/// </summary>
public int SuccessfulRoundCount { get; set; }
public Money CalculateRequiredAmount(params Money[] queuedCoinAmounts)
{
var tried = new List<Money>();
Money baseMinimum = Denomination + (FeePerOutputs * 2); // + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount);
if (queuedCoinAmounts != default)
{
foreach (Money amount in queuedCoinAmounts.OrderByDescending(x => x))
{
tried.Add(amount);
Money required = baseMinimum + (FeePerInputs * tried.Count);
if (required <= tried.Sum() || tried.Count == MaximumInputCountPerPeer)
{
return required;
}
}
}
return baseMinimum + FeePerInputs;
//return baseMinimum + (FeePerInputs * MaximumInputCountPerPeer);
}
public bool HaveEnoughQueued(params Money[] queuedCoinAmounts)
{
var tried = new List<Money>();
Money baseMinimum = Denomination + (FeePerOutputs * 2); // + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount);
if (queuedCoinAmounts != default)
{
foreach (Money amount in queuedCoinAmounts.OrderByDescending(x => x))
{
tried.Add(amount);
Money required = baseMinimum + (FeePerInputs * tried.Count);
if (required <= tried.Sum())
{
return true;
}
if (tried.Count == MaximumInputCountPerPeer)
{
return false;
}
}
}
return false;
}
}
}
|
using NBitcoin;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using WalletWasabi.JsonConverters;
using WalletWasabi.Models.ChaumianCoinJoin;
namespace WalletWasabi.Backend.Models.Responses
{
public class CcjRunningRoundState
{
[JsonConverter(typeof(StringEnumConverter))]
public CcjRoundPhase Phase { get; set; }
[JsonConverter(typeof(MoneyBtcJsonConverter))]
public Money Denomination { get; set; }
[JsonConverter(typeof(BlockCypherDateTimeOffsetJsonConverter))]
public DateTimeOffset InputRegistrationTimesout { get; set; }
public IEnumerable<SchnorrPubKey> SchnorrPubKeys { get; set; }
public int RegisteredPeerCount { get; set; }
public int RequiredPeerCount { get; set; }
public int MaximumInputCountPerPeer { get; set; }
public int RegistrationTimeout { get; set; }
[JsonConverter(typeof(MoneySatoshiJsonConverter))]
public Money FeePerInputs { get; set; }
[JsonConverter(typeof(MoneySatoshiJsonConverter))]
public Money FeePerOutputs { get; set; }
public decimal CoordinatorFeePercent { get; set; }
public long RoundId { get; set; }
/// <summary>
/// This is round independent, it is only here because of backward compatibility.
/// </summary>
public int SuccessfulRoundCount { get; set; }
public Money CalculateRequiredAmount(params Money[] queuedCoinAmounts)
{
var tried = new List<Money>();
Money baseMinimum = Denomination + (FeePerOutputs * 2);// + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount);
if (queuedCoinAmounts != default)
{
foreach (Money amount in queuedCoinAmounts.OrderByDescending(x => x))
{
tried.Add(amount);
Money required = baseMinimum + (FeePerInputs * tried.Count);
if (required <= tried.Sum() || tried.Count == MaximumInputCountPerPeer)
{
return required;
}
}
}
return baseMinimum + FeePerInputs;
//return baseMinimum + (FeePerInputs * MaximumInputCountPerPeer);
}
public bool HaveEnoughQueued(params Money[] queuedCoinAmounts)
{
var tried = new List<Money>();
Money baseMinimum = Denomination + (FeePerOutputs * 2);// + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount);
if (queuedCoinAmounts != default)
{
foreach (Money amount in queuedCoinAmounts.OrderByDescending(x => x))
{
tried.Add(amount);
Money required = baseMinimum + (FeePerInputs * tried.Count);
if (required <= tried.Sum())
{
return true;
}
if (tried.Count == MaximumInputCountPerPeer)
{
return false;
}
}
}
return false;
}
}
}
|
mit
|
C#
|
c7b80062c3022cfe3b735b5ed5d07322781a002c
|
send list of all active users to new user on register
|
pako1337/Arena,pako1337/Arena
|
Arena/Hubs/FightArenaHub.cs
|
Arena/Hubs/FightArenaHub.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
using System.Collections.Concurrent;
namespace Arena.Hubs
{
public class FightArenaHub : Hub
{
private static ConcurrentBag<string> _users = new ConcurrentBag<string>();
public void Register()
{
_users.Add(Context.ConnectionId);
_users.ToList()
.Where(u => u != Context.ConnectionId)
.Select(u => Clients.Client(Context.ConnectionId).NewUser(u))
.ToList();
Clients.AllExcept(Context.ConnectionId).NewUser(Context.ConnectionId);
}
public void MoveUser(int x, int y)
{
Clients.AllExcept(Context.ConnectionId).MoveUser(Context.ConnectionId, x, y);
}
public override System.Threading.Tasks.Task OnDisconnected(bool stopCalled)
{
Clients.All.UserExit(Context.ConnectionId);
return base.OnDisconnected(stopCalled);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
namespace Arena.Hubs
{
public class FightArenaHub : Hub
{
public void Register()
{
Clients.AllExcept(Context.ConnectionId).NewUser(Context.ConnectionId);
}
public void MoveUser(int x, int y)
{
Clients.AllExcept(Context.ConnectionId).MoveUser(Context.ConnectionId, x, y);
}
public override System.Threading.Tasks.Task OnDisconnected(bool stopCalled)
{
Clients.All.UserExit(Context.ConnectionId);
return base.OnDisconnected(stopCalled);
}
}
}
|
mit
|
C#
|
ab86ab8ed78d783f247476c0473008fc635f0daa
|
Use Length property
|
rhynodegreat/CSharpGameLibrary,vazgriz/CSharpGameLibrary,vazgriz/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary
|
CSGL.Vulkan/ShaderModule.cs
|
CSGL.Vulkan/ShaderModule.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using CSGL.Vulkan.Unmanaged;
namespace CSGL.Vulkan {
public class ShaderModuleCreateInfo {
public byte[] data;
}
public class ShaderModule : IDisposable, INative<VkShaderModule> {
VkShaderModule shaderModule;
bool disposed = false;
Device device;
vkCreateShaderModuleDelegate createShaderModule;
vkDestroyShaderModuleDelegate destroyShaderModule;
public VkShaderModule Native {
get {
return shaderModule;
}
}
public ShaderModule(Device device, ShaderModuleCreateInfo info) {
if (device == null) throw new ArgumentNullException(nameof(device));
if (info == null) throw new ArgumentNullException(nameof(info));
if (info.data == null) throw new ArgumentNullException(nameof(info.data));
this.device = device;
createShaderModule = device.Commands.createShaderModule;
destroyShaderModule = device.Commands.destroyShaderModule;
CreateShader(info);
}
void CreateShader(ShaderModuleCreateInfo mInfo) {
VkShaderModuleCreateInfo info = new VkShaderModuleCreateInfo();
info.sType = VkStructureType.ShaderModuleCreateInfo;
info.codeSize = (IntPtr)mInfo.data.Length;
var dataPinned = new PinnedArray<byte>(mInfo.data);
info.pCode = dataPinned.Address;
using (dataPinned) {
var result = createShaderModule(device.Native, ref info, device.Instance.AllocationCallbacks, out shaderModule);
if (result != VkResult.Success) throw new ShaderModuleException(string.Format("Error creating shader module: {0}"));
}
}
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
void Dispose(bool disposing) {
if (disposed) return;
destroyShaderModule(device.Native, shaderModule, device.Instance.AllocationCallbacks);
disposed = true;
}
~ShaderModule() {
Dispose(false);
}
}
public class ShaderModuleException : Exception {
public ShaderModuleException(string message) : base(message) { }
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using CSGL.Vulkan.Unmanaged;
namespace CSGL.Vulkan {
public class ShaderModuleCreateInfo {
public byte[] data;
}
public class ShaderModule : IDisposable, INative<VkShaderModule> {
VkShaderModule shaderModule;
bool disposed = false;
Device device;
vkCreateShaderModuleDelegate createShaderModule;
vkDestroyShaderModuleDelegate destroyShaderModule;
public VkShaderModule Native {
get {
return shaderModule;
}
}
public ShaderModule(Device device, ShaderModuleCreateInfo info) {
if (device == null) throw new ArgumentNullException(nameof(device));
if (info == null) throw new ArgumentNullException(nameof(info));
if (info.data == null) throw new ArgumentNullException(nameof(info.data));
this.device = device;
createShaderModule = device.Commands.createShaderModule;
destroyShaderModule = device.Commands.destroyShaderModule;
CreateShader(info);
}
void CreateShader(ShaderModuleCreateInfo mInfo) {
VkShaderModuleCreateInfo info = new VkShaderModuleCreateInfo();
info.sType = VkStructureType.ShaderModuleCreateInfo;
info.codeSize = (IntPtr)mInfo.data.LongLength;
var dataPinned = new PinnedArray<byte>(mInfo.data);
info.pCode = dataPinned.Address;
using (dataPinned) {
var result = createShaderModule(device.Native, ref info, device.Instance.AllocationCallbacks, out shaderModule);
if (result != VkResult.Success) throw new ShaderModuleException(string.Format("Error creating shader module: {0}"));
}
}
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
void Dispose(bool disposing) {
if (disposed) return;
destroyShaderModule(device.Native, shaderModule, device.Instance.AllocationCallbacks);
disposed = true;
}
~ShaderModule() {
Dispose(false);
}
}
public class ShaderModuleException : Exception {
public ShaderModuleException(string message) : base(message) { }
}
}
|
mit
|
C#
|
e328a4b3199ed4bd27c9c6f7c81f36d4936a62fc
|
Initialize FNLog at launch
|
freenet/wintray,freenet/wintray
|
Program.cs
|
Program.cs
|
using System;
using System.Windows.Forms;
namespace FreenetTray
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
FNLog.Initialize();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CommandsMenu());
}
}
}
|
using System;
using System.Windows.Forms;
namespace FreenetTray
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CommandsMenu());
}
}
}
|
mit
|
C#
|
de25085901afc409189d8cf3b0c3c9d234c68cbf
|
Update FirstFactorial.cs
|
michaeljwebb/Algorithm-Practice
|
Coderbyte/FirstFactorial.cs
|
Coderbyte/FirstFactorial.cs
|
//Take the num parameter being passed and return the factorial of it.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class MainClass
{
public static int FirstFactorial(int num)
{
int fact = num;
for (int i = num - 1; i >= 1; i--)
{
fact = fact * i;
num = fact;
}
return num;
}
static void Main()
{
// keep this function call here
Console.WriteLine(FirstFactorial(Int32.Parse((Console.ReadLine()))));
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class MainClass
{
public static int FirstFactorial(int num)
{
int fact = num;
for (int i = num - 1; i >= 1; i--)
{
fact = fact * i;
num = fact;
}
return num;
}
static void Main()
{
// keep this function call here
Console.WriteLine(FirstFactorial(Int32.Parse((Console.ReadLine()))));
}
}
|
mit
|
C#
|
d8868dd2792b5b1760177ee04a8c24599b2bc354
|
Remove title and date from product item page
|
shengoo/umb,shengoo/umb
|
Site/Views/ProductItem.cshtml
|
Site/Views/ProductItem.cshtml
|
@using Site.App_Code
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "SW_Master.cshtml";
}
<div class="clearfix">
@Html.Partial("LeftNavigation",@Model.Content)
<div class="" style="float: left;width: 75%;padding-left: 30px;">
@*<h3>
@Model.Content.GetTitleOrName()
</h3>
<p>
@Convert.ToDateTime(Model.Content.UpdateDate).ToString("D")
</p>*@
<p>
@Html.Raw(Model.Content.GetPropertyValue<string>("bodyText"))
</p>
</div>
@Html.Partial("ContentPanels",@Model.Content)
</div>
|
@using Site.App_Code
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "SW_Master.cshtml";
}
<div class="clearfix">
@Html.Partial("LeftNavigation",@Model.Content)
<div class="" style="float: left;width: 75%;padding-left: 30px;">
<h3>
@Model.Content.GetTitleOrName()
</h3>
<p>
@Convert.ToDateTime(Model.Content.UpdateDate).ToString("D")
</p>
<p>
@Html.Raw(Model.Content.GetPropertyValue<string>("bodyText"))
</p>
</div>
@Html.Partial("ContentPanels",@Model.Content)
</div>
|
mit
|
C#
|
6db2ad34c97299b580418dc300e7e5ec056175a9
|
Fix for Android StackOverflow problem when ShowNumberOfWeek is enabled
|
rebeccaXam/XamForms.Controls.Calendar
|
XamForms.Controls.Calendar.Droid/CalendarButtonRenderer.cs
|
XamForms.Controls.Calendar.Droid/CalendarButtonRenderer.cs
|
using Android.Graphics.Drawables;
using XamForms.Controls.Droid;
using Xamarin.Forms.Platform.Android;
using XamForms.Controls;
using Android.Runtime;
using System;
[assembly: Xamarin.Forms.ExportRenderer(typeof(CalendarButton), typeof(CalendarButtonRenderer))]
namespace XamForms.Controls.Droid
{
[Preserve(AllMembers = true)]
public class CalendarButtonRenderer : ButtonRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
{
base.OnElementChanged(e);
if (Control == null) return;
Control.TextChanged += (sender, a) =>
{
var element = Element as CalendarButton;
if (Control.Text == element.TextWithoutMeasure || (string.IsNullOrEmpty(Control.Text) && string.IsNullOrEmpty(element.TextWithoutMeasure))) return;
Control.Text = element.TextWithoutMeasure;
};
}
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
var element = Element as CalendarButton;
if (e.PropertyName == nameof(element.TextWithoutMeasure) || e.PropertyName == "Renderer")
{
Control.Text = element.TextWithoutMeasure;
}
if (e.PropertyName == nameof(Element.TextColor) || e.PropertyName == "Renderer")
{
Control.SetTextColor(Element.TextColor.ToAndroid());
}
if (e.PropertyName == nameof(Element.BorderWidth) || e.PropertyName == nameof(Element.BorderColor) || e.PropertyName == nameof(Element.BackgroundColor) || e.PropertyName == "Renderer")
{
var drawable = new GradientDrawable();
drawable.SetShape(ShapeType.Rectangle);
drawable.SetStroke((int)Element.BorderWidth, Element.BorderColor.ToAndroid());
drawable.SetColor(Element.BackgroundColor.ToAndroid());
Control.SetBackground(drawable);
Control.SetPadding(0, 0, 0, 0);
}
}
}
public static class Calendar
{
public static void Init()
{
var d = "";
}
}
}
|
using Android.Graphics.Drawables;
using XamForms.Controls.Droid;
using Xamarin.Forms.Platform.Android;
using XamForms.Controls;
using Android.Runtime;
using System;
[assembly: Xamarin.Forms.ExportRenderer(typeof(CalendarButton), typeof(CalendarButtonRenderer))]
namespace XamForms.Controls.Droid
{
[Preserve(AllMembers = true)]
public class CalendarButtonRenderer : ButtonRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
{
base.OnElementChanged(e);
if (Control == null) return;
Control.TextChanged += (sender, a) =>
{
var element = Element as CalendarButton;
if (Control.Text == element.TextWithoutMeasure) return;
Control.Text = element.TextWithoutMeasure;
};
}
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
var element = Element as CalendarButton;
if (e.PropertyName == nameof(element.TextWithoutMeasure) || e.PropertyName == "Renderer")
{
Control.Text = element.TextWithoutMeasure;
}
if (e.PropertyName == nameof(Element.TextColor) || e.PropertyName == "Renderer")
{
Control.SetTextColor(Element.TextColor.ToAndroid());
}
if (e.PropertyName == nameof(Element.BorderWidth) || e.PropertyName == nameof(Element.BorderColor) || e.PropertyName == nameof(Element.BackgroundColor) || e.PropertyName == "Renderer")
{
var drawable = new GradientDrawable();
drawable.SetShape(ShapeType.Rectangle);
drawable.SetStroke((int)Element.BorderWidth, Element.BorderColor.ToAndroid());
drawable.SetColor(Element.BackgroundColor.ToAndroid());
Control.SetBackground(drawable);
Control.SetPadding(0, 0, 0, 0);
}
}
}
public static class Calendar
{
public static void Init()
{
var d = "";
}
}
}
|
mit
|
C#
|
84532624b7bef96ae27faeaec68f1aa01998dd34
|
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: November 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 on
<strong> Wine Testing for Smoke Taint</strong></a>.<br /><br />
Please Note Receiving Hours: M - F, 8 - 5.<br /><br />
<strong>Please Note Important Date:<br /><br />
The emergency arrangement for wine testing will end in December with samples accepted through December 8th.</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:anlab@ucdavis.edu">anlab@ucdavis.edu</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: November 12, 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 on
<strong> Wine Testing for Smoke Taint</strong></a>.<br /><br />
Please Note Receiving Hours: M - F, 8 - 5.<br /><br />
<strong>Please Note Important Dates<br /><br />
Wine samples will <i>not</i> be accepted during Thanksgiving week (November 23 through 27).<br /><br />
The emergency arrangement for wine testing will end in December with samples accepted through December 8th.</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:anlab@ucdavis.edu">anlab@ucdavis.edu</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#
|
48ba9b4819ba07fcffdf1ed32d0b7bfbdd33d9d4
|
Change ClientCanSwapTemplatesAttribute to ReqFilter
|
NServiceKit/NServiceKit,nataren/NServiceKit,ZocDoc/ServiceStack,MindTouch/NServiceKit,MindTouch/NServiceKit,NServiceKit/NServiceKit,nataren/NServiceKit,timba/NServiceKit,ZocDoc/ServiceStack,timba/NServiceKit,MindTouch/NServiceKit,nataren/NServiceKit,ZocDoc/ServiceStack,timba/NServiceKit,ZocDoc/ServiceStack,MindTouch/NServiceKit,timba/NServiceKit,nataren/NServiceKit,NServiceKit/NServiceKit,NServiceKit/NServiceKit
|
src/ServiceStack.ServiceInterface/ClientCanSwapTemplatesAttribute.cs
|
src/ServiceStack.ServiceInterface/ClientCanSwapTemplatesAttribute.cs
|
using System;
using ServiceStack.ServiceHost;
namespace ServiceStack.ServiceInterface
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public class ClientCanSwapTemplatesAttribute : RequestFilterAttribute
{
public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto)
{
req.Items["View"] = req.GetParam("View");
req.Items["Template"] = req.GetParam("Template");
}
}
}
|
using System;
using ServiceStack.ServiceHost;
namespace ServiceStack.ServiceInterface
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public class ClientCanSwapTemplatesAttribute : ResponseFilterAttribute
{
public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto)
{
req.Items["View"] = req.GetParam("View");
req.Items["Template"] = req.GetParam("Template");
}
}
}
|
bsd-3-clause
|
C#
|
7ced3bfabd900eb3a5f4f2103bc2bec16c5d1de2
|
Add System.Diagnostics.Process serialization
|
jlin177/corefx,YoupHulsebos/corefx,shimingsg/corefx,dotnet-bot/corefx,ericstj/corefx,krytarowski/corefx,billwert/corefx,mmitche/corefx,nbarbettini/corefx,lggomez/corefx,twsouthwick/corefx,the-dwyer/corefx,nchikanov/corefx,ravimeda/corefx,JosephTremoulet/corefx,gkhanna79/corefx,Petermarcu/corefx,DnlHarvey/corefx,lggomez/corefx,mmitche/corefx,stone-li/corefx,dhoehna/corefx,tijoytom/corefx,weltkante/corefx,Petermarcu/corefx,alexperovich/corefx,richlander/corefx,Jiayili1/corefx,gkhanna79/corefx,yizhang82/corefx,dotnet-bot/corefx,nchikanov/corefx,tijoytom/corefx,elijah6/corefx,Petermarcu/corefx,jlin177/corefx,yizhang82/corefx,nbarbettini/corefx,the-dwyer/corefx,gkhanna79/corefx,ericstj/corefx,MaggieTsang/corefx,the-dwyer/corefx,dotnet-bot/corefx,yizhang82/corefx,yizhang82/corefx,billwert/corefx,krytarowski/corefx,parjong/corefx,weltkante/corefx,ptoonen/corefx,zhenlan/corefx,marksmeltzer/corefx,jlin177/corefx,ericstj/corefx,the-dwyer/corefx,shimingsg/corefx,wtgodbe/corefx,alexperovich/corefx,elijah6/corefx,lggomez/corefx,twsouthwick/corefx,cydhaselton/corefx,fgreinacher/corefx,MaggieTsang/corefx,Jiayili1/corefx,dotnet-bot/corefx,DnlHarvey/corefx,krytarowski/corefx,rjxby/corefx,MaggieTsang/corefx,rjxby/corefx,ViktorHofer/corefx,YoupHulsebos/corefx,mmitche/corefx,JosephTremoulet/corefx,parjong/corefx,rubo/corefx,YoupHulsebos/corefx,weltkante/corefx,ericstj/corefx,DnlHarvey/corefx,rahku/corefx,Petermarcu/corefx,dhoehna/corefx,gkhanna79/corefx,marksmeltzer/corefx,Ermiar/corefx,rjxby/corefx,dotnet-bot/corefx,richlander/corefx,richlander/corefx,ericstj/corefx,axelheer/corefx,wtgodbe/corefx,shimingsg/corefx,rahku/corefx,ViktorHofer/corefx,lggomez/corefx,seanshpark/corefx,seanshpark/corefx,shimingsg/corefx,axelheer/corefx,dhoehna/corefx,ViktorHofer/corefx,stephenmichaelf/corefx,parjong/corefx,DnlHarvey/corefx,seanshpark/corefx,JosephTremoulet/corefx,alexperovich/corefx,axelheer/corefx,rjxby/corefx,ravimeda/corefx,twsouthwick/corefx,Jiayili1/corefx,the-dwyer/corefx,nchikanov/corefx,seanshpark/corefx,YoupHulsebos/corefx,ptoonen/corefx,twsouthwick/corefx,Jiayili1/corefx,billwert/corefx,cydhaselton/corefx,ravimeda/corefx,yizhang82/corefx,stephenmichaelf/corefx,nbarbettini/corefx,marksmeltzer/corefx,tijoytom/corefx,BrennanConroy/corefx,wtgodbe/corefx,weltkante/corefx,ptoonen/corefx,mazong1123/corefx,Ermiar/corefx,zhenlan/corefx,billwert/corefx,DnlHarvey/corefx,Ermiar/corefx,cydhaselton/corefx,weltkante/corefx,mmitche/corefx,the-dwyer/corefx,stone-li/corefx,mazong1123/corefx,jlin177/corefx,rahku/corefx,yizhang82/corefx,twsouthwick/corefx,zhenlan/corefx,DnlHarvey/corefx,dotnet-bot/corefx,Ermiar/corefx,mazong1123/corefx,richlander/corefx,shimingsg/corefx,ericstj/corefx,seanshpark/corefx,nbarbettini/corefx,tijoytom/corefx,fgreinacher/corefx,mazong1123/corefx,marksmeltzer/corefx,rjxby/corefx,Petermarcu/corefx,weltkante/corefx,ravimeda/corefx,ViktorHofer/corefx,dhoehna/corefx,dhoehna/corefx,JosephTremoulet/corefx,lggomez/corefx,cydhaselton/corefx,elijah6/corefx,Ermiar/corefx,zhenlan/corefx,ericstj/corefx,MaggieTsang/corefx,parjong/corefx,gkhanna79/corefx,nbarbettini/corefx,alexperovich/corefx,krytarowski/corefx,billwert/corefx,stone-li/corefx,zhenlan/corefx,wtgodbe/corefx,Jiayili1/corefx,wtgodbe/corefx,jlin177/corefx,Petermarcu/corefx,krk/corefx,nchikanov/corefx,JosephTremoulet/corefx,YoupHulsebos/corefx,BrennanConroy/corefx,nbarbettini/corefx,Jiayili1/corefx,rahku/corefx,stephenmichaelf/corefx,ravimeda/corefx,rjxby/corefx,jlin177/corefx,krk/corefx,mmitche/corefx,MaggieTsang/corefx,cydhaselton/corefx,nchikanov/corefx,stephenmichaelf/corefx,rubo/corefx,nchikanov/corefx,wtgodbe/corefx,ViktorHofer/corefx,seanshpark/corefx,billwert/corefx,alexperovich/corefx,twsouthwick/corefx,dhoehna/corefx,ravimeda/corefx,axelheer/corefx,krk/corefx,BrennanConroy/corefx,YoupHulsebos/corefx,rubo/corefx,krk/corefx,stephenmichaelf/corefx,Jiayili1/corefx,rahku/corefx,rahku/corefx,mmitche/corefx,the-dwyer/corefx,tijoytom/corefx,Ermiar/corefx,lggomez/corefx,dhoehna/corefx,alexperovich/corefx,weltkante/corefx,gkhanna79/corefx,elijah6/corefx,alexperovich/corefx,marksmeltzer/corefx,axelheer/corefx,richlander/corefx,ptoonen/corefx,krk/corefx,ViktorHofer/corefx,lggomez/corefx,zhenlan/corefx,elijah6/corefx,wtgodbe/corefx,tijoytom/corefx,billwert/corefx,mazong1123/corefx,twsouthwick/corefx,elijah6/corefx,stone-li/corefx,marksmeltzer/corefx,stone-li/corefx,axelheer/corefx,ptoonen/corefx,fgreinacher/corefx,shimingsg/corefx,DnlHarvey/corefx,Petermarcu/corefx,zhenlan/corefx,tijoytom/corefx,jlin177/corefx,cydhaselton/corefx,shimingsg/corefx,parjong/corefx,stone-li/corefx,nbarbettini/corefx,mazong1123/corefx,ptoonen/corefx,YoupHulsebos/corefx,dotnet-bot/corefx,rubo/corefx,krytarowski/corefx,krytarowski/corefx,seanshpark/corefx,yizhang82/corefx,ravimeda/corefx,marksmeltzer/corefx,stephenmichaelf/corefx,MaggieTsang/corefx,fgreinacher/corefx,MaggieTsang/corefx,mmitche/corefx,richlander/corefx,ViktorHofer/corefx,cydhaselton/corefx,JosephTremoulet/corefx,ptoonen/corefx,parjong/corefx,Ermiar/corefx,rubo/corefx,richlander/corefx,gkhanna79/corefx,krytarowski/corefx,rahku/corefx,stone-li/corefx,JosephTremoulet/corefx,elijah6/corefx,stephenmichaelf/corefx,parjong/corefx,nchikanov/corefx,krk/corefx,rjxby/corefx,krk/corefx,mazong1123/corefx
|
src/System.Diagnostics.Process/src/System/Diagnostics/ThreadState.cs
|
src/System.Diagnostics.Process/src/System/Diagnostics/ThreadState.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Diagnostics
{
/// <devdoc>
/// Specifies the execution state of a thread.
/// </devdoc>
[Serializable]
public enum ThreadState
{
/// <devdoc>
/// The thread has been initialized, but has not started yet.
/// </devdoc>
Initialized,
/// <devdoc>
/// The thread is in ready state.
/// </devdoc>
Ready,
/// <devdoc>
/// The thread is running.
/// </devdoc>
Running,
/// <devdoc>
/// The thread is in standby state.
/// </devdoc>
Standby,
/// <devdoc>
/// The thread has exited.
/// </devdoc>
Terminated,
/// <devdoc>
/// The thread is waiting.
/// </devdoc>
Wait,
/// <devdoc>
/// The thread is transitioning between states.
/// </devdoc>
Transition,
/// <devdoc>
/// The thread state is unknown.
/// </devdoc>
Unknown
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Diagnostics
{
/// <devdoc>
/// Specifies the execution state of a thread.
/// </devdoc>
public enum ThreadState
{
/// <devdoc>
/// The thread has been initialized, but has not started yet.
/// </devdoc>
Initialized,
/// <devdoc>
/// The thread is in ready state.
/// </devdoc>
Ready,
/// <devdoc>
/// The thread is running.
/// </devdoc>
Running,
/// <devdoc>
/// The thread is in standby state.
/// </devdoc>
Standby,
/// <devdoc>
/// The thread has exited.
/// </devdoc>
Terminated,
/// <devdoc>
/// The thread is waiting.
/// </devdoc>
Wait,
/// <devdoc>
/// The thread is transitioning between states.
/// </devdoc>
Transition,
/// <devdoc>
/// The thread state is unknown.
/// </devdoc>
Unknown
}
}
|
mit
|
C#
|
2ebdeb51cc008c41cd0e22f681e72d8f8c80baa5
|
Add JSON extension method
|
nbarbettini/FlexibleConfiguration
|
src/FlexibleConfiguration/ConfigurationBuilderProviderExtensions.cs
|
src/FlexibleConfiguration/ConfigurationBuilderProviderExtensions.cs
|
// Copyright (c) Nate Barbettini.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using FlexibleConfiguration.Providers;
namespace FlexibleConfiguration
{
public static class ConfigurationBuilderProviderExtensions
{
/// <summary>
/// Adds an <see cref="IConfigurationProvider"/> that reads configuration values from environment variables
/// with a specified prefix.
/// </summary>
/// <param name="builder">The <see cref="IConfigurationBuilder"/> to add to.</param>
/// <param name="mustStartWith">The prefix that environment variable names must start with.</param>
/// <param name="separator">The separator character or string between key and value names.</param>
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
public static ConfigurationBuilder AddEnvironmentVariables(
this ConfigurationBuilder builder,
string mustStartWith,
string separator,
string root)
{
builder.Add(new EnvironmentVariablesProvider(mustStartWith, separator, root));
return builder;
}
/// <summary>
/// Adds configuration values from a JSON string.
/// </summary>
/// <param name="json">The JSON string.</param>
/// <param name="root">
/// An optional root name to apply to any configuration values.
/// For example, if <paramref name="root"/> is <c>foo</c>, and the value <c>bar = baz</c>
/// is discovered, the actual added value will be <c>foo.bar = baz</c>.
/// </param>
public static ConfigurationBuilder AddJson(
this ConfigurationBuilder builder,
string json,
string root = null)
{
var provider = new JsonProvider(json, root);
builder.Add(provider);
return builder;
}
/// <summary>
/// Adds configuration values from a JSON file.
/// </summary>
/// <param name="filePath">The file path.</param>
/// <param name="required">
/// Determines whether the file can be skipped silently. If <paramref name="required"/> is <see langword="true"/>,
/// and the file does not exist, a <see cref="System.IO.FileNotFoundException"/> will be thrown. If <paramref name="required"/>
/// is <see langword="false"/>, the method will return silently.
/// </param>
/// <param name="root">
/// An optional root name to apply to any configuration values.
/// For example, if <paramref name="root"/> is <c>foo</c>, and the value <c>bar = baz</c>
/// is discovered, the actual added value will be <c>foo.bar = baz</c>.
/// </param>
public static ConfigurationBuilder AddJsonFile(
this ConfigurationBuilder builder,
string filePath,
bool required = true,
string root = null)
{
var json = FileOperations.Load(filePath);
return builder.AddJson(json, root);
}
}
}
|
// Copyright (c) Nate Barbettini.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using FlexibleConfiguration.Providers;
namespace FlexibleConfiguration
{
public static class ConfigurationBuilderProviderExtensions
{
/// <summary>
/// Adds an <see cref="IConfigurationProvider"/> that reads configuration values from environment variables
/// with a specified prefix.
/// </summary>
/// <param name="configurationBuilder">The <see cref="IConfigurationBuilder"/> to add to.</param>
/// <param name="mustStartWith">The prefix that environment variable names must start with.</param>
/// <param name="separator">The separator character or string between key and value names.</param>
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
public static ConfigurationBuilder AddEnvironmentVariables(
this ConfigurationBuilder configurationBuilder,
string mustStartWith,
string separator,
string root)
{
configurationBuilder.Add(new EnvironmentVariablesProvider(mustStartWith, separator, root));
return configurationBuilder;
}
}
}
|
apache-2.0
|
C#
|
3ef284e2c9049d0ff22af135e549b91157bc2110
|
Sort usings
|
OmniSharp/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,OmniSharp/omnisharp-roslyn
|
src/OmniSharp.Roslyn.CSharp/Services/Files/OnFilesChangedService.cs
|
src/OmniSharp.Roslyn.CSharp/Services/Files/OnFilesChangedService.cs
|
using System.Collections.Generic;
using System.Composition;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using OmniSharp.FileWatching;
using OmniSharp.Mef;
using OmniSharp.Models.FilesChanged;
namespace OmniSharp.Roslyn.CSharp.Services.Files
{
[OmniSharpHandler(OmniSharpEndpoints.FilesChanged, LanguageNames.CSharp)]
public class OnFilesChangedService : IRequestHandler<IEnumerable<FilesChangedRequest>, FilesChangedResponse>
{
private readonly IFileSystemWatcher _watcher;
[ImportingConstructor]
public OnFilesChangedService(IFileSystemWatcher watcher)
{
_watcher = watcher;
}
public Task<FilesChangedResponse> Handle(IEnumerable<FilesChangedRequest> requests)
{
foreach (var request in requests)
{
_watcher.TriggerChange(request.FileName, request.ChangeType);
}
return Task.FromResult(new FilesChangedResponse());
}
}
}
|
using Microsoft.CodeAnalysis;
using OmniSharp.FileWatching;
using OmniSharp.Mef;
using OmniSharp.Models.FilesChanged;
using System.Collections.Generic;
using System.Composition;
using System.Threading.Tasks;
namespace OmniSharp.Roslyn.CSharp.Services.Files
{
[OmniSharpHandler(OmniSharpEndpoints.FilesChanged, LanguageNames.CSharp)]
public class OnFilesChangedService : IRequestHandler<IEnumerable<FilesChangedRequest>, FilesChangedResponse>
{
private readonly IFileSystemWatcher _watcher;
[ImportingConstructor]
public OnFilesChangedService(IFileSystemWatcher watcher)
{
_watcher = watcher;
}
public Task<FilesChangedResponse> Handle(IEnumerable<FilesChangedRequest> requests)
{
foreach (var request in requests)
{
_watcher.TriggerChange(request.FileName, request.ChangeType);
}
return Task.FromResult(new FilesChangedResponse());
}
}
}
|
mit
|
C#
|
6183c006ddc87126c08cf61c098b46f8f293ea20
|
Update BackgroundWorkerManager.cs
|
lvjunlei/aspnetboilerplate,Nongzhsh/aspnetboilerplate,zclmoon/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,jaq316/aspnetboilerplate,carldai0106/aspnetboilerplate,690486439/aspnetboilerplate,Nongzhsh/aspnetboilerplate,oceanho/aspnetboilerplate,berdankoca/aspnetboilerplate,beratcarsi/aspnetboilerplate,zquans/aspnetboilerplate,4nonym0us/aspnetboilerplate,luchaoshuai/aspnetboilerplate,lemestrez/aspnetboilerplate,verdentk/aspnetboilerplate,4nonym0us/aspnetboilerplate,lvjunlei/aspnetboilerplate,virtualcca/aspnetboilerplate,ZhaoRd/aspnetboilerplate,zquans/aspnetboilerplate,SXTSOFT/aspnetboilerplate,ryancyq/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,luchaoshuai/aspnetboilerplate,AlexGeller/aspnetboilerplate,zclmoon/aspnetboilerplate,ShiningRush/aspnetboilerplate,ShiningRush/aspnetboilerplate,jaq316/aspnetboilerplate,virtualcca/aspnetboilerplate,Tobyee/aspnetboilerplate,SXTSOFT/aspnetboilerplate,beratcarsi/aspnetboilerplate,ZhaoRd/aspnetboilerplate,jaq316/aspnetboilerplate,yuzukwok/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,virtualcca/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ilyhacker/aspnetboilerplate,oceanho/aspnetboilerplate,ZhaoRd/aspnetboilerplate,yuzukwok/aspnetboilerplate,s-takatsu/aspnetboilerplate,lemestrez/aspnetboilerplate,nineconsult/Kickoff2016Net,andmattia/aspnetboilerplate,ilyhacker/aspnetboilerplate,AlexGeller/aspnetboilerplate,690486439/aspnetboilerplate,andmattia/aspnetboilerplate,690486439/aspnetboilerplate,SXTSOFT/aspnetboilerplate,berdankoca/aspnetboilerplate,berdankoca/aspnetboilerplate,Nongzhsh/aspnetboilerplate,yuzukwok/aspnetboilerplate,ryancyq/aspnetboilerplate,andmattia/aspnetboilerplate,fengyeju/aspnetboilerplate,fengyeju/aspnetboilerplate,Tobyee/aspnetboilerplate,nineconsult/Kickoff2016Net,verdentk/aspnetboilerplate,ShiningRush/aspnetboilerplate,4nonym0us/aspnetboilerplate,beratcarsi/aspnetboilerplate,s-takatsu/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,lvjunlei/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,Tobyee/aspnetboilerplate,verdentk/aspnetboilerplate,carldai0106/aspnetboilerplate,fengyeju/aspnetboilerplate,s-takatsu/aspnetboilerplate,ilyhacker/aspnetboilerplate,oceanho/aspnetboilerplate,AlexGeller/aspnetboilerplate,zquans/aspnetboilerplate,ryancyq/aspnetboilerplate,lemestrez/aspnetboilerplate,zclmoon/aspnetboilerplate
|
src/Abp/Threading/BackgroundWorkers/BackgroundWorkerManager.cs
|
src/Abp/Threading/BackgroundWorkers/BackgroundWorkerManager.cs
|
using System;
using System.Collections.Generic;
using Abp.Dependency;
namespace Abp.Threading.BackgroundWorkers
{
/// <summary>
/// Implements <see cref="IBackgroundWorkerManager"/>.
/// </summary>
public class BackgroundWorkerManager : RunnableBase, IBackgroundWorkerManager, ISingletonDependency, IDisposable
{
private readonly IIocResolver _iocResolver;
private readonly List<IBackgroundWorker> _backgroundJobs;
/// <summary>
/// Initializes a new instance of the <see cref="BackgroundWorkerManager"/> class.
/// </summary>
public BackgroundWorkerManager(IIocResolver iocResolver)
{
_iocResolver = iocResolver;
_backgroundJobs = new List<IBackgroundWorker>();
}
public override void Start()
{
base.Start();
_backgroundJobs.ForEach(job => job.Start());
}
public override void Stop()
{
_backgroundJobs.ForEach(job => job.Stop());
base.Stop();
}
public override void WaitToStop()
{
_backgroundJobs.ForEach(job => job.WaitToStop());
base.WaitToStop();
}
public void Add(IBackgroundWorker worker)
{
_backgroundJobs.Add(worker);
if (IsRunning)
{
worker.Start();
}
}
private bool _isDisposed;
public void Dispose()
{
if (_isDisposed)
{
return;
}
_isDisposed = true;
_backgroundJobs.ForEach(_iocResolver.Release);
_backgroundJobs.Clear();
}
}
}
|
using System;
using System.Collections.Generic;
using Abp.Dependency;
namespace Abp.Threading.BackgroundWorkers
{
/// <summary>
/// Implements <see cref="IBackgroundWorkerManager"/>.
/// </summary>
public class BackgroundWorkerManager : RunnableBase, IBackgroundWorkerManager, ISingletonDependency, IDisposable
{
private readonly IIocResolver _iocResolver;
private readonly List<IBackgroundWorker> _backgroundJobs;
/// <summary>
/// Initializes a new instance of the <see cref="BackgroundWorkerManager"/> class.
/// </summary>
public BackgroundWorkerManager(IIocResolver iocResolver)
{
_iocResolver = iocResolver;
_backgroundJobs = new List<IBackgroundWorker>();
}
public override void Start()
{
base.Start();
_backgroundJobs.ForEach(job => job.Start());
}
public override void Stop()
{
_backgroundJobs.ForEach(job => job.Stop());
base.WaitToStop();
}
public override void WaitToStop()
{
_backgroundJobs.ForEach(job => job.WaitToStop());
base.WaitToStop();
}
public void Add(IBackgroundWorker worker)
{
_backgroundJobs.Add(worker);
if (IsRunning)
{
worker.Start();
}
}
private bool _isDisposed;
public void Dispose()
{
if (_isDisposed)
{
return;
}
_isDisposed = true;
_backgroundJobs.ForEach(_iocResolver.Release);
_backgroundJobs.Clear();
}
}
}
|
mit
|
C#
|
ba25618a6d755e1e84f8fb51e94ac060c722b9ee
|
Fix Components.Tests that require IStatusBar
|
karthiknadig/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS
|
src/Windows/R/Components/Test/Fixtures/RComponentServicesFixture.cs
|
src/Windows/R/Components/Test/Fixtures/RComponentServicesFixture.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.Generic;
using Microsoft.Common.Core.Services;
using Microsoft.Common.Core.Test.Fixtures;
using Microsoft.R.Components.Settings;
using Microsoft.R.Components.StatusBar;
using Microsoft.R.Components.Test.Fakes.StatusBar;
using Microsoft.R.Components.Test.StubFactories;
using Microsoft.R.Host.Client;
using Microsoft.R.Interpreters;
using Microsoft.UnitTests.Core.XUnit;
namespace Microsoft.R.Components.Test.Fixtures {
public class RComponentsServicesFixture : ServiceManagerWithMefFixture {
protected override IEnumerable<string> GetAssemblyNames() => new[] {
"Microsoft.VisualStudio.CoreUtility.dll",
"Microsoft.VisualStudio.Text.Data.dll",
"Microsoft.VisualStudio.Text.Logic.dll",
"Microsoft.VisualStudio.Text.UI.dll",
"Microsoft.VisualStudio.Text.UI.Wpf.dll",
"Microsoft.VisualStudio.InteractiveWindow.dll",
"Microsoft.VisualStudio.Editor.dll",
"Microsoft.VisualStudio.Language.Intellisense.dll",
"Microsoft.VisualStudio.Platform.VSEditor.dll",
"Microsoft.R.Components.dll",
"Microsoft.R.Components.Windows.dll",
"Microsoft.R.Components.Test.dll"
};
protected override void SetupServices(IServiceManager serviceManager, ITestInput testInput) {
base.SetupServices(serviceManager, testInput);
serviceManager
.AddWindowsRInterpretersServices()
.AddWindowsHostClientServices()
.AddService<IStatusBar, TestStatusBar>()
.AddService<IRSettings>(RSettingsStubFactory.CreateForExistingRPath(testInput.FileSytemSafeName));
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.Generic;
using Microsoft.Common.Core.Services;
using Microsoft.Common.Core.Test.Fixtures;
using Microsoft.R.Components.Settings;
using Microsoft.R.Components.Test.StubFactories;
using Microsoft.R.Host.Client;
using Microsoft.R.Interpreters;
using Microsoft.UnitTests.Core.XUnit;
namespace Microsoft.R.Components.Test.Fixtures {
public class RComponentsServicesFixture : ServiceManagerWithMefFixture {
protected override IEnumerable<string> GetAssemblyNames() => new[] {
"Microsoft.VisualStudio.CoreUtility.dll",
"Microsoft.VisualStudio.Text.Data.dll",
"Microsoft.VisualStudio.Text.Logic.dll",
"Microsoft.VisualStudio.Text.UI.dll",
"Microsoft.VisualStudio.Text.UI.Wpf.dll",
"Microsoft.VisualStudio.InteractiveWindow.dll",
"Microsoft.VisualStudio.Editor.dll",
"Microsoft.VisualStudio.Language.Intellisense.dll",
"Microsoft.VisualStudio.Platform.VSEditor.dll",
"Microsoft.R.Components.dll",
"Microsoft.R.Components.Windows.dll",
"Microsoft.R.Components.Test.dll"
};
protected override void SetupServices(IServiceManager serviceManager, ITestInput testInput) {
base.SetupServices(serviceManager, testInput);
serviceManager
.AddWindowsRInterpretersServices()
.AddWindowsHostClientServices()
.AddService<IRSettings>(RSettingsStubFactory.CreateForExistingRPath(testInput.FileSytemSafeName));
}
}
}
|
mit
|
C#
|
17eed66ecb4444c8f55c2b3effabcb21139c1125
|
Update session provider key
|
billboga/dnxflash,billboga/dnxflash
|
src/DnxFlash.AspNet.MessageProviders/SessionMessageProvider.cs
|
src/DnxFlash.AspNet.MessageProviders/SessionMessageProvider.cs
|
using Microsoft.AspNet.Http.Features;
using Newtonsoft.Json;
using System.Text;
namespace DnxFlash.AspNet.MessageProviders
{
public class SessionMessageProvider : IMessageProvider
{
public SessionMessageProvider(ISession session)
{
this.session = session;
}
private static JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings()
{
TypeNameHandling = TypeNameHandling.All
};
private readonly ISession session;
private const string sessionKey = "dnxflash-session-message-provider";
public object Get()
{
byte[] value;
object messages = null;
if (session.TryGetValue(sessionKey, out value))
{
if (value != null)
{
messages =
JsonConvert.DeserializeObject(
Encoding.UTF8.GetString(value),
jsonSerializerSettings);
}
}
return messages;
}
public void Set(object messages)
{
session.Set(
sessionKey,
Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(
messages,
jsonSerializerSettings)));
}
}
}
|
using Microsoft.AspNet.Http.Features;
using Newtonsoft.Json;
using System.Text;
namespace DnxFlash.AspNet.MessageProviders
{
public class SessionMessageProvider : IMessageProvider
{
public SessionMessageProvider(ISession session)
{
this.session = session;
}
private static JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings()
{
TypeNameHandling = TypeNameHandling.All
};
private readonly ISession session;
private const string sessionKey = "marquee-messenger-session-message-provider";
public object Get()
{
byte[] value;
object messages = null;
if (session.TryGetValue(sessionKey, out value))
{
if (value != null)
{
messages =
JsonConvert.DeserializeObject(
Encoding.UTF8.GetString(value),
jsonSerializerSettings);
}
}
return messages;
}
public void Set(object messages)
{
session.Set(
sessionKey,
Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(
messages,
jsonSerializerSettings)));
}
}
}
|
mit
|
C#
|
fb545f67bc216db948f9910a2b3c5df4a021193b
|
Remove unnecessary methods
|
Elevator89/RimWorld-Subtranslator
|
Elevator.Subtranslator/Program.cs
|
Elevator.Subtranslator/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommandLine;
using CommandLine.Text;
using System.IO;
using System.Xml.Linq;
namespace Elevator.Subtranslator
{
class Options
{
[Option('d', "defs", Required = true, HelpText = "Definition folder location.")]
public string DefsLocation { get; set; }
[Option('i', "injections", Required = true, HelpText = "Localized 'DefInjected' folder location.")]
public string InjectionsLocation { get; set; }
[Option('o', "output", Required = false, HelpText = "Output folder location.")]
public string OutputLocation { get; set; }
}
class DefDirectoryNameComparer : IEqualityComparer<string>
{
public bool Equals(string x, string y)
{
string clearX = x.Replace("Defs", "").Replace("Def", "").TrimEnd('s');
string clearY = y.Replace("Defs", "").Replace("Def", "").TrimEnd('s');
return clearX == clearY;
}
public int GetHashCode(string obj)
{
return obj.GetHashCode();
}
}
class Program
{
static void Main(string[] args)
{
ParserResult<Options> parseResult = Parser.Default.ParseArguments<Options>(args);
if (parseResult.Errors.Any()) return;
Options options = parseResult.Value;
XDocument mergedDoc = MergeDefs(options.DefsLocation);
mergedDoc.Save(Path.Combine(options.OutputLocation, "Defs.xml"));
}
static XDocument MergeDefs(string defsFullPath)
{
XDocument mergedXml = new XDocument();
XElement mergedDefs = new XElement("Defs");
mergedXml.Add(mergedDefs);
foreach (string defFilePath in Directory.EnumerateFiles(defsFullPath, "*.xml", SearchOption.AllDirectories))
{
XDocument defXml = XDocument.Load(defFilePath);
XElement defs = defXml.Root;
foreach (XElement def in defs.Elements())
{
mergedDefs.Add(new XElement(def));
}
}
return mergedXml;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommandLine;
using CommandLine.Text;
using System.IO;
using System.Xml.Linq;
namespace Elevator.Subtranslator
{
class Options
{
[Option('d', "defs", Required = true, HelpText = "Definition folder location.")]
public string DefsLocation { get; set; }
[Option('i', "injections", Required = true, HelpText = "Localized 'DefInjected' folder location.")]
public string InjectionsLocation { get; set; }
[Option('o', "output", Required = false, HelpText = "Output folder location.")]
public string OutputLocation { get; set; }
}
class DefDirectoryNameComparer : IEqualityComparer<string>
{
public bool Equals(string x, string y)
{
string clearX = x.Replace("Defs", "").Replace("Def", "").TrimEnd('s');
string clearY = y.Replace("Defs", "").Replace("Def", "").TrimEnd('s');
return clearX == clearY;
}
public int GetHashCode(string obj)
{
return obj.GetHashCode();
}
}
class Program
{
static void Main(string[] args)
{
ParserResult<Options> parseResult = Parser.Default.ParseArguments<Options>(args);
if (parseResult.Errors.Any()) return;
Options options = parseResult.Value;
XDocument mergedDoc = MergeDefs(options.DefsLocation);
SaveXml(mergedDoc, Path.Combine(options.OutputLocation, "Defs.xml"));
}
static XDocument MergeDefs(string defsFullPath)
{
XDocument mergedXml = new XDocument();
XElement mergedDefs = new XElement("Defs");
mergedXml.Add(mergedDefs);
foreach (string defFilePath in Directory.EnumerateFiles(defsFullPath, "*.xml", SearchOption.AllDirectories))
{
XDocument defXml = LoadXml(defFilePath);
XElement defs = defXml.Root;
foreach (XElement def in defs.Elements())
{
mergedDefs.Add(new XElement(def));
}
}
return mergedXml;
}
static XDocument LoadXml(string filename)
{
using (StreamReader reader = File.OpenText(filename))
{
return XDocument.Load(reader, LoadOptions.PreserveWhitespace);
}
}
static void SaveXml(XDocument doc, string filename)
{
string output = doc.ToString(SaveOptions.None);
File.WriteAllText(filename, output);
}
}
}
|
apache-2.0
|
C#
|
9d00b88cddb9c602ebdbb083867ebda2007b2a9f
|
Add "Press any key to exit."
|
OlsonDev/PersonalWebApp,OlsonDev/PersonalWebApp
|
BuildSpritesheet/Program.cs
|
BuildSpritesheet/Program.cs
|
#if DNX451
using System;
using System.IO;
namespace BuildSpritesheet {
class Program {
static void Main(string[] args) {
PrepareOutputDirectory();
SpritePreparer.PrepareSprites();
Console.WriteLine();
Console.WriteLine("Done processing individual files");
Console.WriteLine();
SpritesheetBuilder.BuildSpritesheet();
Console.WriteLine();
Console.WriteLine("Done building spritesheet. Press any key to exit.");
Console.ReadKey();
}
private static void PrepareOutputDirectory() {
Directory.CreateDirectory(Config.WwwRootSkillsPath);
var outputDirectory = new DirectoryInfo(Config.WwwRootSkillsPath);
outputDirectory.Empty();
}
}
}
#endif
|
#if DNX451
using System;
using System.IO;
namespace BuildSpritesheet {
class Program {
static void Main(string[] args) {
PrepareOutputDirectory();
SpritePreparer.PrepareSprites();
Console.WriteLine();
Console.WriteLine("Done processing individual files");
Console.WriteLine();
SpritesheetBuilder.BuildSpritesheet();
Console.WriteLine();
Console.WriteLine("Done building spritesheet");
Console.ReadKey();
}
private static void PrepareOutputDirectory() {
Directory.CreateDirectory(Config.WwwRootSkillsPath);
var outputDirectory = new DirectoryInfo(Config.WwwRootSkillsPath);
outputDirectory.Empty();
}
}
}
#endif
|
mit
|
C#
|
c099f76ed6f1cc3d4520bc5067f5b1dcfb0e4bb9
|
Update Program.cs
|
cybervoid/BetterProgramming,cybervoid/BetterProgramming
|
SoftwareEngineering/ProjectEuler/ProjectEuler/Program.cs
|
SoftwareEngineering/ProjectEuler/ProjectEuler/Program.cs
|
using ProjectEuler.Problems.P001;
using ProjectEuler.Problems.P002;
using ProjectEuler.Problems.P003;
using ProjectEuler.Problems.P004;
using ProjectEuler.Problems.P005;
using ProjectEuler.Problems.P006;
using ProjectEuler.Problems.P007;
using ProjectEuler.Problems.P008;
using ProjectEuler.Problems.P010;
using ProjectEuler.Problems.P011;
using ProjectEuler.Problems.P012;
using ProjectEuler.Problems.P015;
using ProjectEuler.Problems.P016;
using ProjectEuler.Problems.P018;
using ProjectEuler.Problems.P020;
using ProjectEuler.Problems.P022;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectEuler
{
class Program
{
static void Main(string[] args)
{
TriangleNumber tn = new TriangleNumber();
tn.Run();
Console.ReadLine();
//LargestProductSeries lps = new LargestProductSeries();
//lps.Run();
/*
AltSolution a = new AltSolution();
a.Run();
*/
/*
LargestPrimeFactor l = new LargestPrimeFactor();
l.Run();
*/
/*
EvenFibonacci ef = new EvenFibonacci();
ef.Run();
*/
/*
NameScores ns = new NameScores();
ns.Run();
*/
/*
FactorialDigitSum f = new FactorialDigitSum();
f.Run();
*/
/*
PowerDigitSum pds = new PowerDigitSum();
pds.Run();
*/
/*
MaximumSumTriangle mst = new MaximumSumTriangle();
mst.Run();*/
/*
SieveEratosthenes se = new SieveEratosthenes();
se.Run();
*/
/*
LatticePattern lp = new LatticePattern();
lp.Run();
*/
/*
TriangleNumber tn = new TriangleNumber();
tn.Run();
*/
/*
ProductInGrid pg = new ProductInGrid();
pg.Run();
*/
/*
SumOfPrimes sop = new SumOfPrimes();
sop.Run();
*/
/*
Prime p = new Prime();
p.Run();
*/
/*
SumSquareDifference ssd = new SumSquareDifference();
ssd.Run();
*/
/*
SmallestMultiple sm = new SmallestMultiple();
sm.Run();
*/
/*
Palindrome p = new Palindrome();
p.Run();
*/
/*
FindNumbers fn = new FindNumbers();
fn.Run();
*/
}
}
}
|
using ProjectEuler.Problems.P001;
using ProjectEuler.Problems.P002;
using ProjectEuler.Problems.P003;
using ProjectEuler.Problems.P004;
using ProjectEuler.Problems.P005;
using ProjectEuler.Problems.P006;
using ProjectEuler.Problems.P007;
using ProjectEuler.Problems.P008;
using ProjectEuler.Problems.P010;
using ProjectEuler.Problems.P011;
using ProjectEuler.Problems.P012;
using ProjectEuler.Problems.P015;
using ProjectEuler.Problems.P016;
using ProjectEuler.Problems.P018;
using ProjectEuler.Problems.P020;
using ProjectEuler.Problems.P022;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectEuler
{
class Program
{
static void Main(string[] args)
{
LargestProductSeries lps = new LargestProductSeries();
lps.Run();
Console.ReadLine();
/*
AltSolution a = new AltSolution();
a.Run();
*/
/*
LargestPrimeFactor l = new LargestPrimeFactor();
l.Run();
*/
/*
EvenFibonacci ef = new EvenFibonacci();
ef.Run();
*/
/*
NameScores ns = new NameScores();
ns.Run();
*/
/*
FactorialDigitSum f = new FactorialDigitSum();
f.Run();
*/
/*
PowerDigitSum pds = new PowerDigitSum();
pds.Run();
*/
/*
MaximumSumTriangle mst = new MaximumSumTriangle();
mst.Run();*/
/*
SieveEratosthenes se = new SieveEratosthenes();
se.Run();
*/
/*
LatticePattern lp = new LatticePattern();
lp.Run();
*/
/*
TriangleNumber tn = new TriangleNumber();
tn.Run();
*/
/*
ProductInGrid pg = new ProductInGrid();
pg.Run();
*/
/*
SumOfPrimes sop = new SumOfPrimes();
sop.Run();
*/
/*
Prime p = new Prime();
p.Run();
*/
/*
SumSquareDifference ssd = new SumSquareDifference();
ssd.Run();
*/
/*
SmallestMultiple sm = new SmallestMultiple();
sm.Run();
*/
/*
Palindrome p = new Palindrome();
p.Run();
*/
/*
FindNumbers fn = new FindNumbers();
fn.Run();
*/
}
}
}
|
mit
|
C#
|
c9959fd054fde68eb6429a9fe45342ce64c17a7a
|
hide subcommand 'run' in release build
|
li-rongcheng/CoreCmd
|
CoreProject/Commands/RunCommand.cs
|
CoreProject/Commands/RunCommand.cs
|
#if DEBUG
using CoreProject.Services;
using System;
using System.Collections.Generic;
using System.Text;
namespace CoreProject.Commands
{
class RunCommand
{
public void AddClass(string className, string path)
{
new ScaffoldingService().GenerateClassFile(className, path);
}
public void ViewCSproj()
{
//new CsprojFileService().GetRootNamespace(@"e:\rp\git\CoreCmdPlayground\CoreCmdPlayground\CoreCmdPlayground.csproj");
Console.WriteLine("Searching .csproj file...");
Console.WriteLine(new CsprojFileService().FindCsprojFile());
}
public void ViewVersion()
{
var svc = new CsprojFileService();
var projFile = svc.FindCsprojFile();
var ver = svc.GetVersion(projFile);
Console.WriteLine($"Version from {projFile} : {ver}");
}
}
}
#endif
|
using CoreProject.Services;
using System;
using System.Collections.Generic;
using System.Text;
namespace CoreProject.Commands
{
class RunCommand
{
public void AddClass(string className, string path)
{
new ScaffoldingService().GenerateClassFile(className, path);
}
public void ViewCSproj()
{
//new CsprojFileService().GetRootNamespace(@"e:\rp\git\CoreCmdPlayground\CoreCmdPlayground\CoreCmdPlayground.csproj");
Console.WriteLine("Searching .csproj file...");
Console.WriteLine(new CsprojFileService().FindCsprojFile());
}
public void ViewVersion()
{
var svc = new CsprojFileService();
var projFile = svc.FindCsprojFile();
var ver = svc.GetVersion(projFile);
Console.WriteLine($"Version from {projFile} : {ver}");
}
}
}
|
mit
|
C#
|
1a05a6e5097a427e4c8283ee655f41b163112477
|
Hide irrelevant options from build action configuration
|
Zvirja/ReSharperHelpers
|
AlexPovar.ReSharperHelpers/Build/RunConfigProjectWithSolutionBuild.cs
|
AlexPovar.ReSharperHelpers/Build/RunConfigProjectWithSolutionBuild.cs
|
using System.Windows;
using JetBrains.DataFlow;
using JetBrains.IDE.RunConfig;
using JetBrains.ProjectModel;
using JetBrains.VsIntegration.IDE.RunConfig;
namespace AlexPovar.ReSharperHelpers.Build
{
public class RunConfigProjectWithSolutionBuild : RunConfigBase
{
public override void Execute(RunConfigContext context)
{
context.ExecutionProvider.Execute(null);
}
public override IRunConfigEditorAutomation CreateEditor(Lifetime lifetime, IRunConfigCommonAutomation commonEditor, ISolution solution)
{
//Configure commot editor to hide build options. We support solution build only.
commonEditor.IsWholeSolutionChecked.Value = true;
commonEditor.WholeSolutionVisibility.Value = Visibility.Collapsed;
commonEditor.IsSpecificProjectChecked.Value = false;
var casted = commonEditor as RunConfigCommonAutomation;
if (casted != null)
{
casted.ProjectRequiredVisibility.Value = Visibility.Collapsed;
}
return null;
}
}
}
|
using JetBrains.IDE.RunConfig;
namespace AlexPovar.ReSharperHelpers.Build
{
public class RunConfigProjectWithSolutionBuild : RunConfigBase
{
public override void Execute(RunConfigContext context)
{
context.ExecutionProvider.Execute(null);
}
}
}
|
mit
|
C#
|
9eb673b34d969f48e04938320d62008a0970d9e8
|
Fix compilation issue
|
jwollen/SharpDX,RobyDX/SharpDX,waltdestler/SharpDX,manu-silicon/SharpDX,waltdestler/SharpDX,sharpdx/SharpDX,weltkante/SharpDX,RobyDX/SharpDX,dazerdude/SharpDX,TigerKO/SharpDX,weltkante/SharpDX,fmarrabal/SharpDX,dazerdude/SharpDX,andrewst/SharpDX,andrewst/SharpDX,davidlee80/SharpDX-1,Ixonos-USA/SharpDX,dazerdude/SharpDX,TigerKO/SharpDX,VirusFree/SharpDX,manu-silicon/SharpDX,wyrover/SharpDX,Ixonos-USA/SharpDX,TigerKO/SharpDX,TechPriest/SharpDX,waltdestler/SharpDX,jwollen/SharpDX,PavelBrokhman/SharpDX,jwollen/SharpDX,TechPriest/SharpDX,Ixonos-USA/SharpDX,weltkante/SharpDX,andrewst/SharpDX,mrvux/SharpDX,TechPriest/SharpDX,VirusFree/SharpDX,weltkante/SharpDX,PavelBrokhman/SharpDX,wyrover/SharpDX,sharpdx/SharpDX,davidlee80/SharpDX-1,sharpdx/SharpDX,fmarrabal/SharpDX,fmarrabal/SharpDX,PavelBrokhman/SharpDX,manu-silicon/SharpDX,dazerdude/SharpDX,jwollen/SharpDX,RobyDX/SharpDX,TigerKO/SharpDX,wyrover/SharpDX,wyrover/SharpDX,Ixonos-USA/SharpDX,waltdestler/SharpDX,mrvux/SharpDX,PavelBrokhman/SharpDX,davidlee80/SharpDX-1,fmarrabal/SharpDX,manu-silicon/SharpDX,davidlee80/SharpDX-1,VirusFree/SharpDX,TechPriest/SharpDX,mrvux/SharpDX,VirusFree/SharpDX,RobyDX/SharpDX
|
Source/Toolkit/SharpDX.Toolkit.Graphics/ShaderResourceViewSelector.cs
|
Source/Toolkit/SharpDX.Toolkit.Graphics/ShaderResourceViewSelector.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;
using SharpDX.Direct3D11;
using SharpDX.DXGI;
namespace SharpDX.Toolkit.Graphics
{
/// <summary>
/// Used by <see cref="Texture"/> to provide a selector to a <see cref="ShaderResourceView"/>.
/// </summary>
public sealed class ShaderResourceViewSelector
{
private readonly Texture texture;
internal ShaderResourceViewSelector(Texture thisTexture)
{
this.texture = thisTexture;
}
/// <summary>
/// Gets a specific <see cref="ShaderResourceView" /> from this texture.
/// </summary>
/// <param name="viewType">Type of the view.</param>
/// <param name="arrayOrDepthSlice">The array or depth slice.</param>
/// <param name="mipIndex">Index of the mip.</param>
/// <returns>An <see cref="ShaderResourceView" /></returns>
public TextureView this[ViewType viewType, int arrayOrDepthSlice, int mipIndex]
{
get
{
if(FormatHelper.IsTypeless(texture.Format))
{
throw new InvalidOperationException(string.Format("Cannot create a SRV on a TypeLess texture format [{0}]", texture.Format));
}
return texture.GetShaderResourceView(texture.Format, viewType, arrayOrDepthSlice, mipIndex);
}
}
/// <summary>
/// Gets a specific <see cref="ShaderResourceView" /> from this texture.
/// </summary>
/// <param name="viewFormat">The view format.</param>
/// <param name="viewType">Type of the view.</param>
/// <param name="arrayOrDepthSlice">The array or depth slice.</param>
/// <param name="mipIndex">Index of the mip.</param>
/// <returns>An <see cref="ShaderResourceView" /></returns>
public TextureView this[DXGI.Format viewFormat, ViewType viewType, int arrayOrDepthSlice, int mipIndex] { get { return this.texture.GetShaderResourceView(viewFormat, viewType, arrayOrDepthSlice, mipIndex); } }
}
}
|
// 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 SharpDX.Direct3D11;
namespace SharpDX.Toolkit.Graphics
{
/// <summary>
/// Used by <see cref="Texture"/> to provide a selector to a <see cref="ShaderResourceView"/>.
/// </summary>
public sealed class ShaderResourceViewSelector
{
private readonly Texture texture;
internal ShaderResourceViewSelector(Texture thisTexture)
{
this.texture = thisTexture;
}
/// <summary>
/// Gets a specific <see cref="ShaderResourceView" /> from this texture.
/// </summary>
/// <param name="viewFormat">The view format.</param>
/// <param name="viewType">Type of the view.</param>
/// <param name="arrayOrDepthSlice">The array or depth slice.</param>
/// <param name="mipIndex">Index of the mip.</param>
/// <returns>An <see cref="ShaderResourceView" /></returns>
public TextureView this[DXGI.Format viewFormat, ViewType viewType, int arrayOrDepthSlice, int mipIndex] { get { return this.texture.GetShaderResourceView(viewFormat, viewType, arrayOrDepthSlice, mipIndex); } }
}
}
|
mit
|
C#
|
2bff7105cb4a842705063b446d070421f65844d8
|
Fix test
|
rockfordlhotka/csla,JasonBock/csla,rockfordlhotka/csla,rockfordlhotka/csla,MarimerLLC/csla,JasonBock/csla,JasonBock/csla,MarimerLLC/csla,MarimerLLC/csla
|
Source/csla.netcore.test/DataPortal/ServiceProviderInvocationTests.cs
|
Source/csla.netcore.test/DataPortal/ServiceProviderInvocationTests.cs
|
//-----------------------------------------------------------------------
// <copyright file="ServiceProviderMethodCallerTests.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>no summary</summary>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Csla;
using Csla.Reflection;
using Microsoft.Extensions.DependencyInjection;
#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
#endif
namespace Csla.Test.DataPortal
{
[TestClass]
public class ServiceProviderInvocationTests
{
[TestInitialize]
public void Initialize()
{
Csla.ApplicationContext.DefaultServiceProvider = null;
Csla.ApplicationContext.ServiceProviderScope = null;
}
[TestMethod]
public async Task NoServiceProvider_Throws()
{
var obj = new TestMethods();
var method = new ServiceProviderMethodInfo { MethodInfo = obj.GetType().GetMethod("Method1") };
Assert.IsNotNull(method, "needed method");
await Assert.ThrowsExceptionAsync<InjectException>(async () => await ServiceProviderMethodCaller.CallMethodTryAsync(obj, method, new object[] { 123 }));
}
[TestMethod]
public async Task WithServiceProvider()
{
IServiceCollection services = new ServiceCollection();
services.AddSingleton<ISpeak, Dog>();
Csla.ApplicationContext.DefaultServiceProvider = services.BuildServiceProvider();
var obj = new TestMethods();
var method = new ServiceProviderMethodInfo { MethodInfo = obj.GetType().GetMethod("GetSpeech") };
Assert.IsNotNull(method, "needed method");
var result = (string)await ServiceProviderMethodCaller.CallMethodTryAsync(obj, method, new object[] { 123 });
Assert.AreEqual("Bark", result);
}
}
public interface ISpeak
{
string Speak();
}
public class Dog : ISpeak
{
public string Speak()
{
return "Bark";
}
}
public class TestMethods
{
public bool Method1(int id, [Inject] ISpeak speaker)
{
return speaker == null;
}
public string GetSpeech(int id, [Inject] ISpeak speaker)
{
return speaker.Speak();
}
}
}
|
//-----------------------------------------------------------------------
// <copyright file="ServiceProviderMethodCallerTests.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>no summary</summary>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Csla;
using Csla.Reflection;
using Microsoft.Extensions.DependencyInjection;
#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
#endif
namespace Csla.Test.DataPortal
{
[TestClass]
public class ServiceProviderInvocationTests
{
[TestInitialize]
public void Initialize()
{
Csla.ApplicationContext.DefaultServiceProvider = null;
Csla.ApplicationContext.ServiceProviderScope = null;
}
[TestMethod]
public async Task NoServiceProvider()
{
var obj = new TestMethods();
var method = new ServiceProviderMethodInfo { MethodInfo = obj.GetType().GetMethod("Method1") };
Assert.IsNotNull(method, "needed method");
await Assert.ThrowsExceptionAsync<InvalidOperationException>(async () => await ServiceProviderMethodCaller.CallMethodTryAsync(obj, method, new object[] { 123 }));
}
[TestMethod]
public async Task WithServiceProvider()
{
IServiceCollection services = new ServiceCollection();
services.AddSingleton<ISpeak, Dog>();
Csla.ApplicationContext.DefaultServiceProvider = services.BuildServiceProvider();
var obj = new TestMethods();
var method = new ServiceProviderMethodInfo { MethodInfo = obj.GetType().GetMethod("GetSpeech") };
Assert.IsNotNull(method, "needed method");
var result = (string)await ServiceProviderMethodCaller.CallMethodTryAsync(obj, method, new object[] { 123 });
Assert.AreEqual("Bark", result);
}
}
public interface ISpeak
{
string Speak();
}
public class Dog : ISpeak
{
public string Speak()
{
return "Bark";
}
}
public class TestMethods
{
public bool Method1(int id, [Inject] ISpeak speaker)
{
return speaker == null;
}
public string GetSpeech(int id, [Inject] ISpeak speaker)
{
return speaker.Speak();
}
}
}
|
mit
|
C#
|
7d0d8f76dce6d042045da2320e6e02d6eae26bb2
|
Fix grass entity
|
mk-dev-team/mk-world-of-imagination
|
Sources/Hevadea/GameObjects/Entities/Blueprints/Legacy/EntityGrass.cs
|
Sources/Hevadea/GameObjects/Entities/Blueprints/Legacy/EntityGrass.cs
|
using Hevadea.Entities.Components;
using Hevadea.Framework;
using Hevadea.Framework.Graphic.SpriteAtlas;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Hevadea.Entities.Blueprints
{
public class EntityGrass : Entity
{
public int Variant { get; set; } = 0;
private static Sprite[] _sprites;
public EntityGrass()
{
SortingOffset = 1;
Variant = Rise.Rnd.Next(0, 4);
if (_sprites == null)
{
_sprites = new Sprite[4];
for (int i = 0; i < 4; i++)
{
_sprites[i] = new Sprite(Ressources.TileEntities, new Point(7, i));
}
}
AddComponent(new Breakable());
AddComponent(new Burnable(1f));
}
public override void OnDraw(SpriteBatch spriteBatch, GameTime gameTime)
{
_sprites[Variant].Draw(spriteBatch, new Vector2(X - 8, Y - 12), 1f, Color.White);
}
}
}
|
using Hevadea.Entities.Components;
using Hevadea.Framework;
using Hevadea.Framework.Graphic.SpriteAtlas;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Hevadea.Entities.Blueprints
{
public class EntityGrass : Entity
{
public int Variant { get; set; } = 0;
private static Sprite[] _sprites;
public EntityGrass()
{
SortingOffset = 0;
Variant = Rise.Rnd.Next(0, 4);
if (_sprites == null)
{
_sprites = new Sprite[4];
for (int i = 0; i < 4; i++)
{
_sprites[i] = new Sprite(Ressources.TileEntities, new Point(7, i));
}
}
AddComponent(new Breakable());
AddComponent(new Burnable(1f));
}
public override void OnDraw(SpriteBatch spriteBatch, GameTime gameTime)
{
_sprites[Variant].Draw(spriteBatch, new Vector2(X - 12, Y - 18), 1.5f, Color.White);
}
}
}
|
mit
|
C#
|
74c22be3c0cd4d9490453302778852240222f10e
|
Add the built-in properties to the Properties collection.
|
izrik/FbxSharp,izrik/FbxSharp,izrik/FbxSharp,izrik/FbxSharp,izrik/FbxSharp
|
AnimStack.cs
|
AnimStack.cs
|
using System;
namespace FbxSharp
{
public class AnimStack : Collection
{
public AnimStack(String name="")
: base(name)
{
Properties.Add(Description);
Properties.Add(LocalStart);
Properties.Add(LocalStop);
Properties.Add(ReferenceStart);
Properties.Add(ReferenceStop);
}
#region Public Attributes
public readonly PropertyT<string> Description = new PropertyT<string>( "Description");
public readonly PropertyT<FbxTime> LocalStart = new PropertyT<FbxTime>("LocalStart");
public readonly PropertyT<FbxTime> LocalStop = new PropertyT<FbxTime>("LocalStop");
public readonly PropertyT<FbxTime> ReferenceStart = new PropertyT<FbxTime>("ReferenceStart");
public readonly PropertyT<FbxTime> ReferenceStop = new PropertyT<FbxTime>("ReferenceStop");
#endregion
#region Utility functions.
public FbxTimeSpan GetLocalTimeSpan()
{
return new FbxTimeSpan(LocalStart.Get(), LocalStop.Get());
}
public void SetLocalTimeSpan(FbxTimeSpan pTimeSpan)
{
LocalStart.Set(pTimeSpan.GetStart());
LocalStop.Set(pTimeSpan.GetStop());
}
public FbxTimeSpan GetReferenceTimeSpan()
{
throw new NotImplementedException();
}
public void SetReferenceTimeSpan(FbxTimeSpan pTimeSpan)
{
throw new NotImplementedException();
}
public bool BakeLayers(AnimEvaluator pEvaluator, FbxTime pStart, FbxTime pStop, FbxTime pPeriod)
{
throw new NotImplementedException();
}
#endregion
}
}
|
using System;
namespace FbxSharp
{
public class AnimStack : Collection
{
#region Public Attributes
public readonly PropertyT<string> Description = new PropertyT<string>( "Description");
public readonly PropertyT<FbxTime> LocalStart = new PropertyT<FbxTime>("LocalStart");
public readonly PropertyT<FbxTime> LocalStop = new PropertyT<FbxTime>("LocalStop");
public readonly PropertyT<FbxTime> ReferenceStart = new PropertyT<FbxTime>("ReferenceStart");
public readonly PropertyT<FbxTime> ReferenceStop = new PropertyT<FbxTime>("ReferenceStop");
#endregion
#region Utility functions.
public FbxTimeSpan GetLocalTimeSpan()
{
return new FbxTimeSpan(LocalStart.Get(), LocalStop.Get());
}
public void SetLocalTimeSpan(FbxTimeSpan pTimeSpan)
{
LocalStart.Set(pTimeSpan.GetStart());
LocalStop.Set(pTimeSpan.GetStop());
}
public FbxTimeSpan GetReferenceTimeSpan()
{
throw new NotImplementedException();
}
public void SetReferenceTimeSpan(FbxTimeSpan pTimeSpan)
{
throw new NotImplementedException();
}
public bool BakeLayers(AnimEvaluator pEvaluator, FbxTime pStart, FbxTime pStop, FbxTime pPeriod)
{
throw new NotImplementedException();
}
#endregion
}
}
|
lgpl-2.1
|
C#
|
a2006283f0732608009629594609f99b72bcd0d5
|
Replace URL in address bar for easy copying
|
Sebazzz/IFS,Sebazzz/IFS,Sebazzz/IFS,Sebazzz/IFS
|
src/IFS.Web/Views/Upload/Complete.cshtml
|
src/IFS.Web/Views/Upload/Complete.cshtml
|
@using System.Text.Encodings.Web
@model IFS.Web.Core.Upload.UploadedFile
@{
ViewBag.Title = $"Upload complete: {Model.Metadata.OriginalFileName}";
}
<h2>@ViewBag.Title</h2>
<div class="alert alert-success">
The upload of your file has completed: <code>@Model.Metadata.OriginalFileName</code>.
</div>
@{
string downloadLink = this.Url.RouteUrl("DownloadFile", new {id = Model.Id}, this.Context.Request.Scheme);
}
<p>
Download link to share: <input type="text" value="@downloadLink" class="form-control" readonly="readonly"/>
</p>
<p>
Test link: <a href="@downloadLink">@downloadLink</a>
</p>
<p>
<a asp-action="Index" class="btn btn-primary">Upload another file</a>
</p>
@section scripts {
<script>
(function() {
// Replace URL for easy copying
if ('replaceState' in history) {
history.replaceState({}, null, '@JavaScriptEncoder.Default.Encode(downloadLink)');
}
})();
</script>
}
|
@model IFS.Web.Core.Upload.UploadedFile
@{
ViewBag.Title = $"Upload complete: {Model.Metadata.OriginalFileName}";
}
<h2>@ViewBag.Title</h2>
<div class="alert alert-success">
The upload of your file has completed: <code>@Model.Metadata.OriginalFileName</code>.
</div>
@{
string downloadLink = this.Url.RouteUrl("DownloadFile", new {id = Model.Id}, this.Context.Request.Scheme);
}
<p>
Download link to share: <input type="text" value="@downloadLink" class="form-control" readonly="readonly"/>
</p>
<p>
Test link: <a href="@downloadLink">@downloadLink</a>
</p>
<p>
<a asp-action="Index" class="btn btn-primary">Upload another file</a>
</p>
|
mit
|
C#
|
a4735da61fecade25311a4057f6a112e26a35cd2
|
Initialize MainThreadDispatcher on OnPostprocessScene
|
Useurmind/UniRx,ppcuni/UniRx,ic-sys/UniRx,zillakot/UniRx,saruiwa/UniRx,m-ishikawa/UniRx,cruwel/UniRx,InvertGames/UniRx,Useurmind/UniRx,juggernate/UniRx,Useurmind/UniRx,ufcpp/UniRx,zhutaorun/UniRx,juggernate/UniRx,zillakot/UniRx,ic-sys/UniRx,OC-Leon/UniRx,ic-sys/UniRx,endo0407/UniRx,cruwel/UniRx,kimsama/UniRx,TORISOUP/UniRx,neuecc/UniRx,cruwel/UniRx,OrangeCube/UniRx,zillakot/UniRx,zhutaorun/UniRx,juggernate/UniRx,ataihei/UniRx,zhutaorun/UniRx
|
Assets/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs
|
Assets/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs
|
#if UNITY_EDITOR
using System.Linq;
using UnityEditor;
using UnityEditor.Callbacks;
namespace UniRx
{
[InitializeOnLoad]
public class ScenePlaybackDetector
{
private static bool _isPlaying = false;
public static bool IsPlaying
{
get
{
return _isPlaying;
}
set
{
if (_isPlaying != value)
{
_isPlaying = value;
}
}
}
// This callback is notified just before building the scene, before Start().
[PostProcessScene]
public static void OnPostprocessScene()
{
IsPlaying = true;
// ensures the dispatcher GameObject is created by the main thread
MainThreadDispatcher.Initialize();
}
// InitializeOnLoad ensures that this constructor is called when the Unity Editor is started.
static ScenePlaybackDetector()
{
// This callback comes after Start(), it's too late. But it's useful for detecting playback stop.
EditorApplication.playmodeStateChanged += () => { IsPlaying = EditorApplication.isPlayingOrWillChangePlaymode; };
}
}
}
#endif
|
#if UNITY_EDITOR
using System.Linq;
using UnityEditor;
using UnityEditor.Callbacks;
namespace UniRx
{
[InitializeOnLoad]
public class ScenePlaybackDetector
{
private static bool _isPlaying = false;
public static bool IsPlaying
{
get
{
return _isPlaying;
}
set
{
if (_isPlaying != value)
{
_isPlaying = value;
}
}
}
// This callback is notified just before building the scene, before Start().
[PostProcessScene]
public static void OnPostprocessScene()
{
IsPlaying = true;
}
// InitializeOnLoad ensures that this constructor is called when the Unity Editor is started.
static ScenePlaybackDetector()
{
// This callback comes after Start(), it's too late. But it's useful for detecting playback stop.
EditorApplication.playmodeStateChanged += () => { IsPlaying = EditorApplication.isPlayingOrWillChangePlaymode; };
}
}
}
#endif
|
mit
|
C#
|
a0bf370ecc9ad457ac3eae23a4ccb6036ef9f836
|
Simplify scene processing
|
bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity
|
test/mobile/features/fixtures/maze_runner/Assets/Scripts/Builder.cs
|
test/mobile/features/fixtures/maze_runner/Assets/Scripts/Builder.cs
|
using System.Linq;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
public class Builder : MonoBehaviour
{
// Generates AndroidBuild/MyApp.apk
public static void AndroidBuild()
{
Debug.Log("Building Android app...");
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, "com.bugsnag.mazerunner");
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
var opts = CommonOptions("mazerunner.apk");
opts.target = BuildTarget.Android;
var result = BuildPipeline.BuildPlayer(opts);
Debug.Log("Result: " + result);
}
private static BuildPlayerOptions CommonOptions(string outputFile)
{
var scenes = EditorBuildSettings.scenes.Where(s => s.enabled).Select(s => s.path).ToArray();
BuildPlayerOptions opts = new BuildPlayerOptions();
opts.scenes = scenes;
opts.locationPathName = Application.dataPath + "/../" + outputFile;
opts.options = BuildOptions.None;
return opts;
}
}
#endif
|
using System.Linq;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
public class Builder : MonoBehaviour
{
// Generates AndroidBuild/MyApp.apk
public static void AndroidBuild()
{
Debug.Log("Building Android app...");
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, "com.bugsnag.mazerunner");
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
var opts = CommonOptions("mazerunner.apk");
opts.target = BuildTarget.Android;
var result = BuildPipeline.BuildPlayer(opts);
Debug.Log("Result: " + result);
}
private static BuildPlayerOptions CommonOptions(string outputFile)
{
var paths = new string[] { "Assets/Scenes/SampleScene.unity", "Assets/Scenes/OtherScene.unity" };
var newScenes = new EditorBuildSettingsScene[]
{
new EditorBuildSettingsScene()
{
path = paths[0],
enabled = true
},
new EditorBuildSettingsScene()
{
path = paths[1],
enabled = true
}
};
EditorBuildSettings.scenes = newScenes;
BuildPlayerOptions opts = new BuildPlayerOptions();
opts.scenes = paths;
opts.locationPathName = Application.dataPath + "/../" + outputFile;
opts.options = BuildOptions.None;
return opts;
}
}
#endif
|
mit
|
C#
|
b89778cb5125e5d34fb71ddc7e1686e2d42400ed
|
enhance test
|
Code-Inside/Sloader
|
tests/Sloader.Engine.Tests/UtilTests/StringExtensionCleanerTests.cs
|
tests/Sloader.Engine.Tests/UtilTests/StringExtensionCleanerTests.cs
|
using System.Threading.Tasks;
using Xunit;
using Sloader.Engine.Util;
namespace Sloader.Engine.Tests.UtilTests
{
public class StringExtensionCleanerTests
{
[Fact]
public void Can_Deal_With_null()
{
string test = null;
Assert.Equal(string.Empty, test.ToCleanString());
}
[Fact]
public void Returns_Normal_String_Without_ControlChar()
{
string test = "foobar test";
Assert.Equal("foobar test", test.ToCleanString());
}
[Fact]
public void Preserves_rnt()
{
string test = "\tfoobar\r\ntest";
Assert.Equal("\tfoobar\r\ntest", test.ToCleanString());
}
[Fact]
public void Returns_Cleaned_String_With_ControlChar()
{
// control char \u7f
char c = '\u007f';
string test = "foobar" + c + "test";
Assert.Equal("foobartest", test.ToCleanString());
}
[Fact]
public void Returns_Cleaned_String_With_ControlChar_Pure()
{
// control char \u7f
char c = '';
string test = "foobar" + c + "test";
Assert.Equal("foobartest", test.ToCleanString());
}
}
}
|
using System.Threading.Tasks;
using Xunit;
using Sloader.Engine.Util;
namespace Sloader.Engine.Tests.UtilTests
{
public class StringExtensionCleanerTests
{
[Fact]
public void Can_Deal_With_null()
{
string test = null;
Assert.Equal(string.Empty, test.ToCleanString());
}
[Fact]
public void Returns_Normal_String_Without_ControlChar()
{
string test = "foobar test";
Assert.Equal("foobar test", test.ToCleanString());
}
[Fact]
public void Preserves_rn()
{
string test = "foobar\r\ntest";
Assert.Equal("foobar\r\ntest", test.ToCleanString());
}
[Fact]
public void Returns_Cleaned_String_With_ControlChar()
{
// control char \u7f
char c = '\u007f';
string test = "foobar" + c + "test";
Assert.Equal("foobartest", test.ToCleanString());
}
[Fact]
public void Returns_Cleaned_String_With_ControlChar_Pure()
{
// control char \u7f
char c = '';
string test = "foobar" + c + "test";
Assert.Equal("foobartest", test.ToCleanString());
}
}
}
|
mit
|
C#
|
4053707c424d9ae2e7278bac1452670726ca46c6
|
Add Delete button to TabControlSection to test deleting tabs
|
PowerOfCode/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1,l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1
|
Source/Eto.Test/Eto.Test/Sections/Controls/TabControlSection.cs
|
Source/Eto.Test/Eto.Test/Sections/Controls/TabControlSection.cs
|
using System;
using Eto.Forms;
using Eto.Drawing;
namespace Eto.Test.Sections.Controls
{
public class TabControlSection : Panel
{
TabControl tabControl;
public TabControlSection ()
{
Create ();
}
protected virtual void Create ()
{
var layout = new DynamicLayout (this);
layout.AddSeparateRow (null, AddTab (), RemoveTab (), null);
layout.AddSeparateRow (tabControl = DefaultTabs ());
}
Control AddTab ()
{
var control = new Button { Text = "Add Tab" };
control.Click += (s, e) => {
var tab = new TabPage { Text = "Tab " + (tabControl.TabPages.Count + 1) };
tabControl.TabPages.Add (tab);
};
return control;
}
Control RemoveTab ()
{
var control = new Button { Text = "Remove Tab" };
control.Click += (s, e) => {
if (tabControl.SelectedIndex >= 0 && tabControl.TabPages.Count > 0) {
tabControl.TabPages.RemoveAt (tabControl.SelectedIndex);
}
};
return control;
}
TabControl DefaultTabs ()
{
var control = new TabControl ();
LogEvents (control);
var page = new TabPage { Text = "Tab 1" };
page.AddDockedControl (TabOne ());
control.TabPages.Add (page);
LogEvents (page);
page = new TabPage {
Text = "Tab 2",
Image = Icon.FromResource ("Eto.Test.TestIcon.ico")
};
LogEvents (page);
page.AddDockedControl (TabTwo ());
control.TabPages.Add (page);
page = new TabPage {
Text = "Tab 3"
};
LogEvents (page);
control.TabPages.Add (page);
return control;
}
Control TabOne ()
{
var control = new Panel ();
control.AddDockedControl (new LabelSection());
return control;
}
Control TabTwo ()
{
var control = new Panel ();
control.AddDockedControl (new TextAreaSection { Border = BorderType.None });
return control;
}
void LogEvents (TabControl control)
{
control.SelectedIndexChanged += delegate {
Log.Write (control, "SelectedIndexChanged, Index: {0}", control.SelectedIndex);
};
}
void LogEvents (TabPage control)
{
control.Click += delegate {
Log.Write (control, "Click, Item: {0}", control.Text);
};
}
}
public class ThemedTabControlSection : TabControlSection
{
protected override void Create ()
{
// Clone the current generator and add handlers
// for TabControl and TabPage. Create a TabControlSection
// using the new generator and then restore the previous generator.
var currentGenerator = Generator.Current;
try {
var generator = Activator.CreateInstance (currentGenerator.GetType ()) as Generator;
Generator.Initialize (generator);
generator.Add<ITabControl> (() => new Eto.Test.Handlers.TabControlHandler ());
generator.Add<ITabPage> (() => new Eto.Test.Handlers.TabPageHandler ());
base.Create ();
} finally {
Generator.Initialize (currentGenerator); // restore
}
}
}
}
|
using System;
using Eto.Forms;
using Eto.Drawing;
namespace Eto.Test.Sections.Controls
{
public class TabControlSection : Panel
{
public TabControlSection ()
{
Add();
}
protected virtual void Add()
{
var layout = new DynamicLayout(this);
var tabControl = DefaultTabs();
layout.Add(tabControl);
var button = new Button { Text = "Add Tab" };
button.Click += (s, e) => tabControl.TabPages.Add(new TabPage { Text = "Added" });
layout.Add(button);
}
TabControl DefaultTabs ()
{
var control = new TabControl ();
LogEvents (control);
var page = new TabPage { Text = "Tab 1" };
page.AddDockedControl (TabOne ());
control.TabPages.Add (page);
LogEvents (page);
page = new TabPage {
Text = "Tab 2",
Image = Icon.FromResource ("Eto.Test.TestIcon.ico")
};
LogEvents (page);
page.AddDockedControl (TabTwo ());
control.TabPages.Add (page);
page = new TabPage {
Text = "Tab 3"
};
LogEvents (page);
control.TabPages.Add (page);
return control;
}
Control TabOne ()
{
var control = new Panel ();
control.AddDockedControl (new LabelSection());
return control;
}
Control TabTwo ()
{
var control = new Panel ();
control.AddDockedControl (new TextAreaSection { Border = BorderType.None });
return control;
}
void LogEvents (TabControl control)
{
control.SelectedIndexChanged += delegate {
Log.Write (control, "SelectedIndexChanged, Index: {0}", control.SelectedIndex);
};
}
void LogEvents (TabPage control)
{
control.Click += delegate {
Log.Write (control, "Click, Item: {0}", control.Text);
};
}
}
public class ThemedTabControlSection : TabControlSection
{
protected override void Add()
{
// Clone the current generator and add handlers
// for TabControl and TabPage. Create a TabControlSection
// using the new generator and then restore the previous generator.
var currentGenerator = Generator.Current;
var generator = Activator.CreateInstance(currentGenerator.GetType()) as Generator;
Generator.Initialize(generator);
generator.Add<ITabControl>(() => new Eto.Test.Handlers.TabControlHandler());
generator.Add<ITabPage>(() => new Eto.Test.Handlers.TabPageHandler());
base.Add();
Generator.Initialize(currentGenerator); // restore
}
}
}
|
bsd-3-clause
|
C#
|
5b71d7eece9f7c7d6d4b381a63400cb4d1f25726
|
Fix reward string method
|
DMagic1/KSP_Contract_Window
|
Source/ContractsWindow/PanelInterfaces/StandardNodeUI.cs
|
Source/ContractsWindow/PanelInterfaces/StandardNodeUI.cs
|
using System;
using System.Collections.Generic;
using ContractsWindow.Unity.Interfaces;
using ProgressParser;
namespace ContractsWindow.PanelInterfaces
{
public class StandardNodeUI : IStandardNode
{
private progressStandard node;
public StandardNodeUI(progressStandard n)
{
if (n == null)
return;
node = n;
}
public bool IsComplete
{
get
{
if (node == null)
return false;
return node.IsComplete;
}
}
public string GetNote
{
get
{
if (node == null)
return "";
return string.Format(node.Note, node.NoteReference, node.KSPDateString);
}
}
public string NodeText
{
get
{
if (node == null)
return "";
return node.Descriptor;
}
}
private string coloredText(string s, char c, string color)
{
if (string.IsNullOrEmpty(s))
return "";
return string.Format("<color={0}>{1}{2}</color> ", color, c, s);
}
public string RewardText
{
get
{
if (node == null)
return "";
return string.Format("{0}{1}{2}", coloredText(node.FundsRewardString, '£', "#69D84FFF"), coloredText(node.SciRewardString, '©', "#02D8E9FF"), coloredText(node.RepRewardString, '¡', "#C9B003FF"));
}
}
}
}
|
using System;
using System.Collections.Generic;
using ContractsWindow.Unity.Interfaces;
using ProgressParser;
namespace ContractsWindow.PanelInterfaces
{
public class StandardNodeUI : IStandardNode
{
private progressStandard node;
public StandardNodeUI(progressStandard n)
{
if (n == null)
return;
node = n;
}
public bool IsComplete
{
get
{
if (node == null)
return false;
return node.IsComplete;
}
}
public string GetNote
{
get
{
if (node == null)
return "";
return string.Format(node.Note, node.NoteReference, node.KSPDateString);
}
}
public string NodeText
{
get
{
if (node == null)
return "";
return node.Descriptor;
}
}
public string RewardText
{
get
{
if (node == null)
return "";
return string.Format("<color=#69D84FFF>£ {0}</color> <color=#02D8E9FF>© {1}</color> <color=#C9B003FF>¡ {2}</color>", node.FundsRewardString, node.SciRewardString, node.RepRewardString);
}
}
}
}
|
mit
|
C#
|
32059a85e4670471d37a161b2bf25f0fb8a92e2b
|
Make ConfigurationEntry constructors internal
|
Zoxive/libgit2sharp,OidaTiftla/libgit2sharp,psawey/libgit2sharp,AArnott/libgit2sharp,AMSadek/libgit2sharp,nulltoken/libgit2sharp,Skybladev2/libgit2sharp,mono/libgit2sharp,vorou/libgit2sharp,github/libgit2sharp,nulltoken/libgit2sharp,whoisj/libgit2sharp,github/libgit2sharp,mono/libgit2sharp,OidaTiftla/libgit2sharp,Skybladev2/libgit2sharp,dlsteuer/libgit2sharp,GeertvanHorrik/libgit2sharp,xoofx/libgit2sharp,jamill/libgit2sharp,jorgeamado/libgit2sharp,libgit2/libgit2sharp,dlsteuer/libgit2sharp,ethomson/libgit2sharp,jeffhostetler/public_libgit2sharp,jamill/libgit2sharp,vivekpradhanC/libgit2sharp,rcorre/libgit2sharp,AMSadek/libgit2sharp,oliver-feng/libgit2sharp,shana/libgit2sharp,rcorre/libgit2sharp,AArnott/libgit2sharp,ethomson/libgit2sharp,xoofx/libgit2sharp,vorou/libgit2sharp,oliver-feng/libgit2sharp,PKRoma/libgit2sharp,jorgeamado/libgit2sharp,Zoxive/libgit2sharp,GeertvanHorrik/libgit2sharp,yishaigalatzer/LibGit2SharpCheckOutTests,sushihangover/libgit2sharp,yishaigalatzer/LibGit2SharpCheckOutTests,red-gate/libgit2sharp,psawey/libgit2sharp,jeffhostetler/public_libgit2sharp,red-gate/libgit2sharp,whoisj/libgit2sharp,vivekpradhanC/libgit2sharp,shana/libgit2sharp,sushihangover/libgit2sharp
|
LibGit2Sharp/ConfigurationEntry.cs
|
LibGit2Sharp/ConfigurationEntry.cs
|
using System;
using System.Diagnostics;
namespace LibGit2Sharp
{
/// <summary>
/// The full representation of a config option.
/// </summary>
/// <typeparam name="T">The configuration value type</typeparam>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class ConfigurationEntry<T>
{
/// <summary>
/// The fully-qualified option name.
/// </summary>
public virtual string Key { get; private set; }
/// <summary>
/// The option value.
/// </summary>
public virtual T Value { get; private set; }
/// <summary>
/// The origin store.
/// </summary>
public virtual ConfigurationLevel Level { get; private set; }
/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected ConfigurationEntry()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationEntry{T}"/> class with a given key and value
/// </summary>
/// <param name="key">The option name</param>
/// <param name="value">The option value</param>
/// <param name="level">The origin store</param>
internal ConfigurationEntry(string key, T value, ConfigurationLevel level)
{
Key = key;
Value = value;
Level = level;
}
private string DebuggerDisplay
{
get { return string.Format("{0} = \"{1}\"", Key, Value); }
}
}
/// <summary>
/// Enumerated config option
/// </summary>
[Obsolete("This class will be removed in the next release. Please use ConfigurationEntry<T> instead.")]
public class ConfigurationEntry : ConfigurationEntry<string>
{
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationEntry{T}"/> class with a given key and value
/// </summary>
/// <param name="key">The option name</param>
/// <param name="value">The option value</param>
/// <param name="level">The origin store</param>
internal ConfigurationEntry(string key, string value, ConfigurationLevel level) : base(key, value, level)
{ }
/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected ConfigurationEntry()
{ }
}
}
|
using System;
using System.Diagnostics;
namespace LibGit2Sharp
{
/// <summary>
/// The full representation of a config option.
/// </summary>
/// <typeparam name="T">The configuration value type</typeparam>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class ConfigurationEntry<T>
{
/// <summary>
/// The fully-qualified option name.
/// </summary>
public string Key { get; private set; }
/// <summary>
/// The option value.
/// </summary>
public T Value { get; private set; }
/// <summary>
/// The origin store.
/// </summary>
public ConfigurationLevel Level { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationEntry{T}"/> class with a given key and value
/// </summary>
/// <param name="key">The option name</param>
/// <param name="value">The option value</param>
/// <param name="level">The origin store</param>
public ConfigurationEntry(string key, T value, ConfigurationLevel level)
{
Key = key;
Value = value;
Level = level;
}
private string DebuggerDisplay
{
get { return string.Format("{0} = \"{1}\"", Key, Value); }
}
}
/// <summary>
/// Enumerated config option
/// </summary>
[Obsolete("This class will be removed in the next release. Please use ConfigurationEntry<T> instead.")]
public class ConfigurationEntry : ConfigurationEntry<string>
{
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationEntry{T}"/> class with a given key and value
/// </summary>
/// <param name="key">The option name</param>
/// <param name="value">The option value</param>
/// <param name="level">The origin store</param>
public ConfigurationEntry(string key, string value, ConfigurationLevel level) : base(key, value, level)
{ }
}
}
|
mit
|
C#
|
12ce8ef86613eb376a26c5777c3a98eb57f12ce6
|
make some readonly fields
|
LayoutFarm/PixelFarm
|
a_mini/projects/PixelFarm/MiniAgg/04_Scanline/0_ScanlineSpan.cs
|
a_mini/projects/PixelFarm/MiniAgg/04_Scanline/0_ScanlineSpan.cs
|
//BSD, 2014-2016, WinterDev
namespace PixelFarm.Agg
{
public struct ScanlineSpan
{
public readonly short x;
public short len;
public readonly short cover_index;
public ScanlineSpan(int x, int cover_index)
{
this.x = (short)x;
this.len = 1;
this.cover_index = (short)cover_index;
}
public ScanlineSpan(int x, int len, int cover_index)
{
this.x = (short)x;
this.len = (short)len;
this.cover_index = (short)cover_index;
}
#if DEBUG
public override string ToString()
{
return "x:" + x + ",len:" + len + ",cover:" + cover_index;
}
#endif
}
}
|
//BSD, 2014-2016, WinterDev
namespace PixelFarm.Agg
{
public struct ScanlineSpan
{
public short x;
public short len;
public short cover_index;
public ScanlineSpan(int x, int cover_index)
{
this.x = (short)x;
this.len = 1;
this.cover_index = (short)cover_index;
}
public ScanlineSpan(int x, int len, int cover_index)
{
this.x = (short)x;
this.len = (short)len;
this.cover_index = (short)cover_index;
}
#if DEBUG
public override string ToString()
{
return "x:" + x + ",len:" + len + ",cover:" + cover_index;
}
#endif
}
}
|
bsd-2-clause
|
C#
|
824352b26f29d895c272799377406e2b021264cd
|
Update RotateAndSum.cs
|
stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity
|
TechnologiesFundamentals/ProgrammingFundamentals/ArraysAndLists-Excercises/02.RotateAndSum/02.RotateAndSum/RotateAndSum.cs
|
TechnologiesFundamentals/ProgrammingFundamentals/ArraysAndLists-Excercises/02.RotateAndSum/02.RotateAndSum/RotateAndSum.cs
|
using System;
using System.Linq;
public class RotateAndSum
{
public static void Main(string[] args)
{
int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int numberRotates = int.Parse(Console.ReadLine());
int[] sum = new int[array.Length];
for (int rotations = 0; rotations < numberRotates; rotations++)
{
int lastElement = array[array.Length - 1];
for (int element = array.Length - 1; element > 0; element--)
{
array[element] = array[element - 1];
}
array[0] = lastElement;
for (int k = 0; k < array.Length; k++)
{
sum[k] += array[k];
}
}
sum.ToList().ForEach(e => Console.Write(e + " "));
}
}
|
using System;
using System.Linq;
public class RotateAndSum
{
public static void Main(string[] args)
{
int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int numberRotates = int.Parse(Console.ReadLine());
int[] sum = new int[array.Length];
for (int i = 0; i < numberRotates; i++)
{
int lastElement = array[array.Length - 1];
for (int j = array.Length - 1; j > 0; j--)
{
array[j] = array[j - 1];
}
array[0] = lastElement;
for (int k = 0; k < array.Length; k++)
{
sum[k] += array[k];
}
}
sum.ToList().ForEach(e => Console.Write(e + " "));
}
}
|
mit
|
C#
|
ad6d27f45e89fd7d03035dc15fcdc0a93bcdf3c9
|
Fix InfluencerBucket bug - LSInfluencer functional
|
erebuswolf/LockstepFramework,SnpM/Lockstep-Framework,yanyiyun/LockstepFramework
|
Core/Simulation/Grid/Influence/Utility/InfluencerBucket.cs
|
Core/Simulation/Grid/Influence/Utility/InfluencerBucket.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
namespace Lockstep
{
public class InfluencerBucket
{
#region Constants
const int MaxCapacity = 64;
const int StartCapacity = 8;
#endregion;
#region Static helpers
static int leIndex;
static int i;
#endregion
public int PeakCount;
public int Capacity = StartCapacity;
public int PeakCapacity;
public ulong arrayAllocation;
public FastStack<int> OpenSlots = new FastStack<int>(4);
public LSInfluencer[] innerArray = new LSInfluencer[StartCapacity];
public bool Add (LSInfluencer item)
{
leIndex = OpenSlots.Count > 0 ? OpenSlots.Pop () : PeakCount++;
if (leIndex >= MaxCapacity)
{
PeakCount = MaxCapacity;
return false;
}
if (PeakCount == Capacity)
{
Capacity *= 2;
if (Capacity > MaxCapacity) Capacity = MaxCapacity;
Array.Resize (ref innerArray, Capacity);
}
LSUtility.SetBitTrue(ref arrayAllocation,leIndex);
item.bucketIndex = leIndex;
innerArray[leIndex] = item;
return true;
}
public void Remove (LSInfluencer item)
{
leIndex = item.bucketIndex;
OpenSlots.Add (leIndex);
LSUtility.SetBitFalse (ref arrayAllocation, leIndex);
if (leIndex == PeakCount - 1)
{
PeakCount--;
for (i = leIndex - 1; i >= 0; i--)
{
if (LSUtility.GetBitFalse (arrayAllocation,i))
{
PeakCount--;
}
}
}
}
public IEnumerator GetEnumerator ()
{
return new InfluenceBucketEnumerator(this);
}
}
public class InfluenceBucketEnumerator : IEnumerator {
#region Foreach Implementation
public InfluenceBucketEnumerator(InfluencerBucket bucket)
{
_bucket = bucket;
}
InfluencerBucket _bucket;
int position = -1;
//IEnumerator
public bool MoveNext()
{
position++;
while (position <= _bucket.PeakCount)
{
if (LSUtility.GetBitTrue (_bucket.arrayAllocation, position))
{
break;
}
position++;
}
return (position < _bucket.PeakCount);
}
//IEnumerable
public void Reset()
{position = -1;}
//IEnumerable
public object Current
{
get { return _bucket.innerArray[position];}
}
#endregion
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
namespace Lockstep
{
public class InfluencerBucket
{
#region Constants
const int MaxCapacity = 64;
const int StartCapacity = 8;
#endregion;
#region Static helpers
static int leIndex;
static int i;
#endregion
public int PeakCount;
public int Capacity = StartCapacity;
public int PeakCapacity;
public ulong arrayAllocation;
public FastStack<int> OpenSlots = new FastStack<int>(4);
public LSInfluencer[] innerArray = new LSInfluencer[StartCapacity];
public bool Add (LSInfluencer item)
{
leIndex = OpenSlots.Count > 0 ? OpenSlots.Pop () : PeakCount++;
if (leIndex >= MaxCapacity)
{
PeakCount = MaxCapacity;
return false;
}
if (PeakCount == Capacity)
{
Capacity *= 2;
if (Capacity > MaxCapacity) Capacity = MaxCapacity;
Array.Resize (ref innerArray, Capacity);
}
LSUtility.SetBitTrue(ref arrayAllocation,leIndex);
item.bucketIndex = leIndex;
innerArray[leIndex] = item;
return true;
}
public void Remove (LSInfluencer item)
{
leIndex = item.bucketIndex;
OpenSlots.Add (leIndex);
LSUtility.SetBitFalse (ref arrayAllocation, leIndex);
if (leIndex == PeakCount - 1)
{
PeakCount--;
for (i = leIndex - 1; i >= 0; i--)
{
if (LSUtility.GetBitTrue (arrayAllocation,i))
{
PeakCount--;
}
}
}
else {
LSUtility.SetBitFalse(ref arrayAllocation,leIndex);
}
}
public IEnumerator GetEnumerator ()
{
return new InfluenceBucketEnumerator(this);
}
}
public class InfluenceBucketEnumerator : IEnumerator {
#region Foreach Implementation
public InfluenceBucketEnumerator(InfluencerBucket bucket)
{
_bucket = bucket;
}
InfluencerBucket _bucket;
int position = -1;
//IEnumerator
public bool MoveNext()
{
position++;
while (position <= _bucket.PeakCount)
{
if (LSUtility.GetBitTrue (_bucket.arrayAllocation, position))
{
break;
}
position++;
}
return (position < _bucket.PeakCount);
}
//IEnumerable
public void Reset()
{position = -1;}
//IEnumerable
public object Current
{
get { return _bucket.innerArray[position];}
}
#endregion
}
}
|
mit
|
C#
|
97b411fb42144e2db388118b409d67895c3bb27d
|
Add cancel button to Finish editing
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
src/SFA.DAS.EAS.Web/Views/EmployerCommitments/FinishedEditing.cshtml
|
src/SFA.DAS.EAS.Web/Views/EmployerCommitments/FinishedEditing.cshtml
|
@model SFA.DAS.EAS.Web.Models.SubmitCommitmentModel
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Finished editing</h1>
<div>
<p>
What do you want to do with this commitment?
</p>
<!--h2 class="heading-medium">
What do you want to update?
</h2-->
<form action="@Url.Action("FinishedEditingChoice")" method="post">
<legend class="visuallyhidden">Things to do next</legend>
<div class="form-group">
<label class="block-label" for="radio-1">
<input id="radio-1" type="radio" name="saveOrSend" value="send-amend">
<span id="changeOne">Send to provider to amend or add details</span>
</label>
<label class="block-label" for="radio-2">
<input id="radio-2" type="radio" name="saveOrSend" value="send-approve">
<span id="changeTwo">Approve and send to provider</span>
</label>
<label class="block-label" for="radio-3">
<input id="radio-3" type="radio" name="saveOrSend" value="save-no-send">
<span id="changeThree">Save but do not send to provider</span>
</label>
</div>
<div style="margin-top:20px;">
<input type="submit" class="button" id="paymentPlan" value="Save and continue">
<a class="button" href="@Url.Action("Details", new { hashedAccountId = Model.HashedAccountId, hashedCommitmentId = Model.HashedCommitmentId })">Cancel</a>
</div>
</form>
</div>
<div style="margin-top:35px"></div>
<div style="margin-top:50px"></div>
</div>
<div class="column-one-third">
</div>
</div>
|
@model SFA.DAS.EAS.Web.Models.SubmitCommitmentModel
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Finished editing</h1>
<div>
<p>
What do you want to do with this commitment?
</p>
<!--h2 class="heading-medium">
What do you want to update?
</h2-->
<form action="@Url.Action("FinishedEditingChoice")" method="post">
<legend class="visuallyhidden">Things to do next</legend>
<div class="form-group">
<label class="block-label" for="radio-1">
<input id="radio-1" type="radio" name="saveOrSend" value="send-amend">
<span id="changeOne">Send to provider to amend or add details</span>
</label>
<label class="block-label" for="radio-2">
<input id="radio-2" type="radio" name="saveOrSend" value="send-approve">
<span id="changeTwo">Approve and send to provider</span>
</label>
<label class="block-label" for="radio-3">
<input id="radio-3" type="radio" name="saveOrSend" value="save-no-send">
<span id="changeThree">Save but do not send to provider</span>
</label>
</div>
<div style="margin-top:20px;">
<input type="submit" class="button" id="paymentPlan" value="Save and continue">
</div>
</form>
</div>
<div style="margin-top:35px"></div>
<div style="margin-top:50px"></div>
</div>
<div class="column-one-third">
</div>
</div>
|
mit
|
C#
|
a480653d9e87ebac7d547300bb8028f664aee78e
|
add comment in the Sequencer.cs file
|
sebas77/Svelto.ECS,sebas77/Svelto-ECS
|
ECS/Sequencer.cs
|
ECS/Sequencer.cs
|
using System;
using Steps = System.Collections.Generic.Dictionary<Svelto.ECS.IEngine, System.Collections.Generic.Dictionary<System.Enum, Svelto.ECS.IStep[]>>;
namespace Svelto.ECS
{
public interface IStep
{ }
public interface IStep<T>:IStep
{
void Step(ref T token, Enum condition);
}
public class Sequencer
{
public void SetSequence(Steps steps)
{
_steps = steps;
}
public void Next<T>(IEngine engine, ref T param)
{
Next(engine, ref param, Condition.always);
}
public void Next<T>(IEngine engine, ref T param, Enum condition)
{
var tos = _steps[engine];
var steps = tos[condition];
if (steps != null)
for (int i = 0; i < steps.Length; i++)
((IStep<T>)steps[i]).Step(ref param, condition);
}
Steps _steps;
}
//you can inherit from Condition and add yours
public enum Condition
{
always
}
}
|
using System;
using Steps = System.Collections.Generic.Dictionary<Svelto.ECS.IEngine, System.Collections.Generic.Dictionary<System.Enum, Svelto.ECS.IStep[]>>;
namespace Svelto.ECS
{
public interface IStep
{ }
public interface IStep<T>:IStep
{
void Step(ref T token, Enum condition);
}
public class Sequencer
{
public Sequencer()
{}
public void SetSequence(Steps steps)
{
_steps = steps;
}
public void Next<T>(IEngine engine, ref T param)
{
Next(engine, ref param, Condition.always);
}
public void Next<T>(IEngine engine, ref T param, Enum condition)
{
var tos = _steps[engine];
var steps = tos[condition];
if (steps != null)
for (int i = 0; i < steps.Length; i++)
((IStep<T>)steps[i]).Step(ref param, condition);
}
Steps _steps;
}
public enum Condition
{
always
}
}
|
mit
|
C#
|
838d41daf7b838b3c58b3ebdad0de4a2e60d5423
|
Remove unnecessary recommendation
|
farity/farity
|
Farity/Filter.cs
|
Farity/Filter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Farity
{
public static partial class F
{
/// <summary>
/// Takes a predicate and an enumerable, and returns an enumerable of the same type containing the members of the given
/// enumerable which satisfy the given predicate. Pure functions are recommended as predicates.
/// </summary>
/// <typeparam name="T">The type of elements in the source.</typeparam>
/// <param name="predicate">The predicate function to filter with.</param>
/// <param name="source">The source of elements to filter.</param>
/// <returns>An enumerable with the elements filtered with the predicate.</returns>
public static IEnumerable<T> Filter<T>(Func<T, bool> predicate, IEnumerable<T> source)
=> source.Where(predicate);
/// <summary>
/// Takes a predicate and an enumerable, and returns an enumerable of the same type containing the members of the given
/// enumerable which satisfy the given predicate.
/// </summary>
/// <typeparam name="T">The type of elements in the source.</typeparam>
/// <param name="predicate">The predicate function to filter with.</param>
/// <param name="source">The source of elements to filter.</param>
/// <returns>An enumerable with the elements filtered with the predicate.</returns>
public static IEnumerable<T> Filter<T>(FuncAny<bool> predicate, IEnumerable<T> source)
=> Filter((T item) => predicate(item), source);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Farity
{
public static partial class F
{
/// <summary>
/// Takes a predicate and an enumerable, and returns an enumerable of the same type containing the members of the given
/// enumerable which satisfy the given predicate. Pure functions are recommended as predicates.
/// </summary>
/// <typeparam name="T">The type of elements in the source.</typeparam>
/// <param name="predicate">The predicate function to filter with.</param>
/// <param name="source">The source of elements to filter.</param>
/// <returns>An enumerable with the elements filtered with the predicate.</returns>
public static IEnumerable<T> Filter<T>(Func<T, bool> predicate, IEnumerable<T> source)
=> source.Where(predicate);
/// <summary>
/// Takes a predicate and an enumerable, and returns an enumerable of the same type containing the members of the given
/// enumerable which satisfy the given predicate. Pure functions are recommended as predicates.
/// </summary>
/// <typeparam name="T">The type of elements in the source.</typeparam>
/// <param name="predicate">The predicate function to filter with.</param>
/// <param name="source">The source of elements to filter.</param>
/// <returns>An enumerable with the elements filtered with the predicate.</returns>
public static IEnumerable<T> Filter<T>(FuncAny<bool> predicate, IEnumerable<T> source)
=> Filter((T item) => predicate(item), source);
}
}
|
mit
|
C#
|
3bc663a1cf8cc232305c1adb3a8e46a6783f8492
|
Update reCaptcha API js rendering script
|
aliencube/ReCaptcha.NET,aliencube/ReCaptcha.NET,aliencube/ReCaptcha.NET
|
SourceCodes/02_Apps/ReCaptcha.Wrapper.WebApp/Views/Home/Index.cshtml
|
SourceCodes/02_Apps/ReCaptcha.Wrapper.WebApp/Views/Home/Index.cshtml
|
@using Aliencube.ReCaptcha.Wrapper.Mvc
@model Aliencube.ReCaptcha.Wrapper.WebApp.Models.HomeIndexViewModel
@{
ViewBag.Title = "Index";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm(MVC.Home.ActionNames.Index, MVC.Home.Name, FormMethod.Post))
{
<div class="form-group">
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name, new Dictionary<string, object>() {{"class", "form-control"}})
</div>
@Html.ReCaptcha(new Dictionary<string, object>() { { "class", "form-group" }, { "data-sitekey", Model.SiteKey } })
<input class="btn btn-default" type="submit" name="Submit" />
}
@if (IsPost)
{
<div>
<ul>
<li>Success: @Model.Success</li>
@if (@Model.ErrorCodes != null && @Model.ErrorCodes.Any())
{
<li>
ErrorCodes:
<ul>
@foreach (var errorCode in Model.ErrorCodes)
{
<li>@errorCode</li>
}
</ul>
</li>
}
<li>ErorCodes: @Model.ErrorCodes</li>
</ul>
</div>
}
@section Scripts
{
@Html.ReCaptchaApiJs(Model.ApiUrl, JsRenderingOptions.Async | JsRenderingOptions.Defer)
}
|
@using Aliencube.ReCaptcha.Wrapper.Mvc
@model Aliencube.ReCaptcha.Wrapper.WebApp.Models.HomeIndexViewModel
@{
ViewBag.Title = "Index";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm(MVC.Home.ActionNames.Index, MVC.Home.Name, FormMethod.Post))
{
<div class="form-group">
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name, new Dictionary<string, object>() {{"class", "form-control"}})
</div>
@Html.ReCaptcha(new Dictionary<string, object>() { { "class", "form-group" }, { "data-sitekey", Model.SiteKey } })
<input class="btn btn-default" type="submit" name="Submit" />
}
@if (IsPost)
{
<div>
<ul>
<li>Success: @Model.Success</li>
@if (@Model.ErrorCodes != null && @Model.ErrorCodes.Any())
{
<li>
ErrorCodes:
<ul>
@foreach (var errorCode in Model.ErrorCodes)
{
<li>@errorCode</li>
}
</ul>
</li>
}
<li>ErorCodes: @Model.ErrorCodes</li>
</ul>
</div>
}
@section Scripts
{
@Html.ReCaptchaApiJs(new Dictionary<string, object>() { { "src", Model.ApiUrl } })
}
|
mit
|
C#
|
4c592f159609555f52d750ce2b49d6cfdebca03c
|
Bump version to 6.3.0
|
MindscapeHQ/raygun4net,MindscapeHQ/raygun4net,MindscapeHQ/raygun4net
|
Mindscape.Raygun4Net.NetCore/Properties/AssemblyVersionInfo.cs
|
Mindscape.Raygun4Net.NetCore/Properties/AssemblyVersionInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.3.0")]
[assembly: AssemblyFileVersion("6.3.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.2.0")]
[assembly: AssemblyFileVersion("6.2.0")]
|
mit
|
C#
|
6fabdf441379acac419af1fcb2c9136d354c884b
|
Reduce SplitButton to actual behavior
|
jlewin/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,mmoening/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,mmoening/MatterControl,unlimitedbacon/MatterControl
|
CustomWidgets/SplitButton.cs
|
CustomWidgets/SplitButton.cs
|
/*
Copyright (c) 2017, Matt Moening, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg.UI;
namespace MatterHackers.MatterControl
{
public class SplitButton : FlowLayoutWidget
{
public SplitButton(string buttonText, Direction direction = Direction.Down)
: base(FlowDirection.LeftToRight)
{
HAnchor = HAnchor.FitToChildren;
VAnchor = VAnchor.FitToChildren;
var button = ApplicationController.Instance.Theme.ButtonFactory.Generate(buttonText, centerText: true);
button.VAnchor = VAnchor.ParentCenter;
AddChild(button);
AddChild(new DropDownMenu("", direction)
{
VAnchor = VAnchor.ParentCenter,
MenuAsWideAsItems = false,
AlignToRightEdge = true,
Height = button.Height
});
}
public SplitButton(Button button, DropDownMenu altChoices)
: base(FlowDirection.LeftToRight)
{
HAnchor = HAnchor.FitToChildren;
VAnchor = VAnchor.FitToChildren;
button.VAnchor = VAnchor.ParentCenter;
AddChild(button);
AddChild(altChoices);
}
}
}
|
/*
Copyright (c) 2017, Matt Moening, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
namespace MatterHackers.MatterControl
{
public class SplitButton : FlowLayoutWidget
{
private DropDownMenu altChoices;
private Button DefaultButton { get; }
public SplitButton(string buttonText, Direction direction = Direction.Down)
: base(FlowDirection.LeftToRight)
{
HAnchor = HAnchor.FitToChildren;
VAnchor = VAnchor.FitToChildren;
this.DefaultButton = CreateDefaultButton(buttonText);
this.DefaultButton.VAnchor = VAnchor.ParentCenter;
altChoices = CreateDropDown(direction);
AddChild(this.DefaultButton);
AddChild(altChoices);
}
public SplitButton(Button button, DropDownMenu menu)
: base(FlowDirection.LeftToRight)
{
HAnchor = HAnchor.FitToChildren;
VAnchor = VAnchor.FitToChildren;
this.DefaultButton = button;
this.DefaultButton.VAnchor = VAnchor.ParentCenter;
altChoices = menu;
AddChild(this.DefaultButton);
AddChild(altChoices);
}
private DropDownMenu CreateDropDown(Direction direction)
{
return new DropDownMenu("", direction)
{
VAnchor = VAnchor.ParentCenter,
MenuAsWideAsItems = false,
AlignToRightEdge = true,
Height = this.DefaultButton.Height
};
}
private Button CreateDefaultButton(string buttonText)
{
var buttonFactory = new TextImageButtonFactory(new ButtonFactoryOptions()
{
FixedHeight = 30 * GuiWidget.DeviceScale,
Normal = new ButtonOptionSection()
{
FillColor = RGBA_Bytes.White,
TextColor = RGBA_Bytes.Black,
BorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
},
Hover = new ButtonOptionSection()
{
TextColor = RGBA_Bytes.Black,
FillColor = new RGBA_Bytes(255, 255, 255, 200),
BorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200)
},
BorderWidth = 1,
});
return buttonFactory.Generate(buttonText, centerText: true);
}
}
}
|
bsd-2-clause
|
C#
|
3ee410e53e1d95f366768a23458c59f05bd94e44
|
Index too
|
StevenThuriot/Horizon
|
EventCaller.cs
|
EventCaller.cs
|
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Horizon
{
class EventCaller : IEventCaller
{
readonly EventInfo _info;
readonly Lazy<bool> _isStatic;
readonly IMethodCaller _raise;
readonly ICaller _add;
readonly ICaller _remove;
public bool CanRaise { get; }
public Type EventHandlerType => _info.EventHandlerType;
public EventCaller(EventInfo info)
{
_info = info;
_isStatic = new Lazy<bool>(() => _info.AddMethod.IsStatic);
var raise = info.RaiseMethod;
CanRaise = raise != null;
_raise = CanRaise ? new MethodCaller(raise) : NullCaller.Instance;
_add = new MethodCaller(info.AddMethod);
_remove = new MethodCaller(info.RemoveMethod);
}
dynamic[] BuildCallerArguments(dynamic instance, dynamic[] arguments)
{
var length = arguments.Length;
if (!IsStatic)
length += 1;
var values = new dynamic[length];
if (!IsStatic)
values[0] = instance;
if (length != 0)
Array.Copy(arguments, 0, values, IsStatic ? 0 : 1, arguments.Length);
return values;
}
public object Call(IEnumerable<dynamic> values) => _raise.Call(values);
public void Raise(dynamic instance, params dynamic[] arguments)
{
dynamic[] values = BuildCallerArguments(instance, arguments);
_raise.Call(values);
}
public void Add(dynamic instance, params Delegate[] handlers)
{
dynamic[] values = BuildCallerArguments(instance, handlers);
_add.Call(values);
}
public void Remove(dynamic instance, params Delegate[] handlers)
{
dynamic[] values = BuildCallerArguments(instance, handlers);
_remove.Call(values);
}
public string Name => _info.Name;
public IReadOnlyList<SimpleParameterInfo> ParameterTypes => _raise.ParameterTypes;
public bool IsStatic => _isStatic.Value;
}
}
|
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Horizon
{
class EventCaller : IEventCaller
{
readonly EventInfo _info;
readonly Lazy<bool> _isStatic;
readonly IMethodCaller _raise;
readonly ICaller _add;
readonly ICaller _remove;
public bool CanRaise { get; }
public Type EventHandlerType => _info.EventHandlerType;
public EventCaller(EventInfo info)
{
_info = info;
_isStatic = new Lazy<bool>(() => _info.AddMethod.IsStatic);
var raise = info.RaiseMethod;
CanRaise = raise != null;
_raise = CanRaise ? new MethodCaller(raise) : NullCaller.Instance;
_add = new MethodCaller(info.AddMethod);
_remove = new MethodCaller(info.RemoveMethod);
}
dynamic[] BuildCallerArguments(dynamic instance, dynamic[] arguments)
{
var length = arguments.Length;
if (!IsStatic)
length += 1;
var values = new dynamic[length];
if (!IsStatic)
values[0] = instance;
if (length != 0)
Array.Copy(arguments, 0, values, 1, arguments.Length);
return values;
}
public object Call(IEnumerable<dynamic> values) => _raise.Call(values);
public void Raise(dynamic instance, params dynamic[] arguments)
{
dynamic[] values = BuildCallerArguments(instance, arguments);
_raise.Call(values);
}
public void Add(dynamic instance, params Delegate[] handlers)
{
dynamic[] values = BuildCallerArguments(instance, handlers);
_add.Call(values);
}
public void Remove(dynamic instance, params Delegate[] handlers)
{
dynamic[] values = BuildCallerArguments(instance, handlers);
_remove.Call(values);
}
public string Name => _info.Name;
public IReadOnlyList<SimpleParameterInfo> ParameterTypes => _raise.ParameterTypes;
public bool IsStatic => _isStatic.Value;
}
}
|
mit
|
C#
|
a59ad82ff39ebbe5445c632d3bdfab93b75e28d9
|
fix welcome
|
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
|
src/backend/SO115App.Models/Servizi/CQRS/Queries/GestioneSedi/GetDistaccamentiByCodSede/GetDistaccamentiByCodSedeQueryHandler.cs
|
src/backend/SO115App.Models/Servizi/CQRS/Queries/GestioneSedi/GetDistaccamentiByCodSede/GetDistaccamentiByCodSedeQueryHandler.cs
|
using CQRS.Queries;
using SO115App.API.Models.Classi.Condivise;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Distaccamenti;
using System.Linq;
namespace SO115App.Models.Servizi.CQRS.Queries.GestioneSedi.GetDistaccamentiByCodSede
{
public class GetDistaccamentiByCodSedeQueryHandler : IQueryHandler<GetDistaccamentiByCodSedeQuery, GetDistaccamentiByCodSedeResult>
{
private readonly IGetSedi _service;
public GetDistaccamentiByCodSedeQueryHandler(IGetSedi service)
{
_service = service;
}
public GetDistaccamentiByCodSedeResult Handle(GetDistaccamentiByCodSedeQuery query)
{
var lstSedi = _service.GetAll();
var codProvincia = query.CodiciSede[0]?.Split('.')[0];
var result = lstSedi.Where(s => s.attiva == 1 && s.codSede_TC.Equals(codProvincia))
.Select(s => new Sede($"{s.codProv}.{s.codFiglio_TC}", s.sede, "", new Coordinate(s.latitudine, s.longitudine)))
.OrderBy(s => s.Codice)
.ToList();
return new GetDistaccamentiByCodSedeResult() { DataArray = result };
}
}
}
|
using CQRS.Queries;
using SO115App.API.Models.Classi.Condivise;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Distaccamenti;
using System.Linq;
namespace SO115App.Models.Servizi.CQRS.Queries.GestioneSedi.GetDistaccamentiByCodSede
{
public class GetDistaccamentiByCodSedeQueryHandler : IQueryHandler<GetDistaccamentiByCodSedeQuery, GetDistaccamentiByCodSedeResult>
{
private readonly IGetSedi _service;
public GetDistaccamentiByCodSedeQueryHandler(IGetSedi service)
{
_service = service;
}
public GetDistaccamentiByCodSedeResult Handle(GetDistaccamentiByCodSedeQuery query)
{
var lstSedi = _service.GetAll();
var codProvincia = query.CodiciSede[0].Split('.')[0];
var result = lstSedi.Where(s => s.attiva == 1 && s.codSede_TC.Equals(codProvincia))
.Select(s => new Sede($"{s.codProv}.{s.codFiglio_TC}", s.sede, "", new Coordinate(s.latitudine, s.longitudine)))
.OrderBy(s => s.Codice)
.ToList();
return new GetDistaccamentiByCodSedeResult() { DataArray = result };
}
}
}
|
agpl-3.0
|
C#
|
b7f5cafc7172fd8833c326d5bec9fb1edcb72a85
|
Increase move the version number to 2.1.3
|
baynezy/Html2Markdown
|
src/Html2Markdown/Properties/AssemblyInfo.cs
|
src/Html2Markdown/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("Html2Markdown")]
[assembly: AssemblyDescription("A library for converting HTML to markdown syntax in C#")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Simon Baynes")]
[assembly: AssemblyProduct("Html2Markdown")]
[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("daf67b0f-5a0c-4789-ac19-799160a5e038")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.3.*")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Html2Markdown")]
[assembly: AssemblyDescription("A library for converting HTML to markdown syntax in C#")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Simon Baynes")]
[assembly: AssemblyProduct("Html2Markdown")]
[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("daf67b0f-5a0c-4789-ac19-799160a5e038")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.2.*")]
|
apache-2.0
|
C#
|
035fff94c1336b7244daafbd7d820c1c6a15c375
|
Update normalize extension method to use the built in hardware accelerated static method
|
dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo
|
DynamixelServo.Quadruped/Vector3Extensions.cs
|
DynamixelServo.Quadruped/Vector3Extensions.cs
|
using System.Numerics;
namespace DynamixelServo.Quadruped
{
public static class Vector3Extensions
{
public static Vector3 Normal(this Vector3 vector)
{
return Vector3.Normalize(vector);
}
public static bool Similar(this Vector3 a, Vector3 b, float marginOfError = float.Epsilon)
{
return Vector3.Distance(a, b) <= marginOfError;
}
}
}
|
using System.Numerics;
namespace DynamixelServo.Quadruped
{
public static class Vector3Extensions
{
public static Vector3 Normal(this Vector3 vector)
{
float len = vector.Length();
return new Vector3(vector.X / len, vector.Y / len, vector.Z / len);
}
public static bool Similar(this Vector3 a, Vector3 b, float marginOfError = float.Epsilon)
{
return Vector3.Distance(a, b) <= marginOfError;
}
}
}
|
apache-2.0
|
C#
|
61b88784dfba6442f82cb6bfbc1eb6d2be7b2e92
|
Fix absent documentation
|
rabbit-link/rabbit-link,rabbit-link/rabbit-link
|
src/RabbitLink.Microsoft.Extensions.Logging/LinkBuilderExtensions.cs
|
src/RabbitLink.Microsoft.Extensions.Logging/LinkBuilderExtensions.cs
|
using RabbitLink.Builders;
using Microsoft.Extensions.Logging;
namespace RabbitLink.Logging
{
/// <summary>
/// Extension methods for <see cref="ILinkBuilder"/>
/// </summary>
public static class LinkBuilderExtensions
{
/// <summary>
/// Use <see cref="Microsoft.Extensions.Logging.ILoggerFactory"/> as ILinkLogger
/// </summary>
/// <param name="builder">Link builder</param>
/// <param name="factory"><see cref="Microsoft.Extensions.Logging.ILoggerFactory"/> to use</param>
/// <param name="categoryPrefix">prefix the category of RabbitLink logging messages</param>
/// <returns></returns>
public static ILinkBuilder UseMicrosoftExtensionsLogging(this ILinkBuilder builder, ILoggerFactory factory,
string categoryPrefix = "RabbitLink.")
=> builder.LoggerFactory(new LoggerFactory(factory, categoryPrefix));
}
}
|
using RabbitLink.Builders;
using Microsoft.Extensions.Logging;
namespace RabbitLink.Logging
{
public static class LinkBuilderExtensions
{
/// <summary>
/// Use <see cref="Microsoft.Extensions.Logging.ILoggerFactory"/> as ILinkLogger
/// </summary>
/// <param name="builder">Link builder</param>
/// <param name="factory"><see cref="Microsoft.Extensions.Logging.ILoggerFactory"/> to use</param>
/// <param name="categoryPrefix">prefix the category of RabbitLink logging messages</param>
/// <returns></returns>
public static ILinkBuilder UseMicrosoftExtensionsLogging(this ILinkBuilder builder, ILoggerFactory factory,
string categoryPrefix = "RabbitLink.")
=> builder.LoggerFactory(new LoggerFactory(factory, categoryPrefix));
}
}
|
mit
|
C#
|
066269581e126b2bda21bb280d3e5d275f405659
|
add PostFormatEntityExtensions
|
tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web
|
src/Tugberk.Persistance.SqlServer/PostFormatEntity.cs
|
src/Tugberk.Persistance.SqlServer/PostFormatEntity.cs
|
using System;
using Tugberk.Domain;
namespace Tugberk.Persistance.SqlServer
{
public enum PostFormatEntity
{
PlainText = 1,
Html = 2,
Markdown = 3
}
public static class PostFormatEntityExtensions
{
public static PostFormat ToDomainModel(this PostFormatEntity postFormatEntity)
{
switch (postFormatEntity)
{
case PostFormatEntity.Html:
return PostFormat.Html;
case PostFormatEntity.Markdown:
return PostFormat.Markdown;
case PostFormatEntity.PlainText:
return PostFormat.PlainText;
default:
throw new NotSupportedException();
}
}
}
}
|
namespace Tugberk.Persistance.SqlServer
{
public enum PostFormatEntity
{
PlainText = 1,
Html = 2,
Markdown = 3
}
}
|
agpl-3.0
|
C#
|
4a3ceaf19daa3f79452572d1a6f7d761063ebde2
|
Test Fixup for a Line Normalization Issue.
|
aanshibudhiraja/Roslyn,ValentinRueda/roslyn,tannergooding/roslyn,grianggrai/roslyn,DustinCampbell/roslyn,vcsjones/roslyn,dovzhikova/roslyn,oocx/roslyn,jbhensley/roslyn,devharis/roslyn,AlekseyTs/roslyn,tang7526/roslyn,jcouv/roslyn,huoxudong125/roslyn,leppie/roslyn,paulvanbrenk/roslyn,jmarolf/roslyn,KevinH-MS/roslyn,aelij/roslyn,jeremymeng/roslyn,managed-commons/roslyn,balajikris/roslyn,moozzyk/roslyn,cston/roslyn,jhendrixMSFT/roslyn,CaptainHayashi/roslyn,Shiney/roslyn,CyrusNajmabadi/roslyn,MattWindsor91/roslyn,ahmedshuhel/roslyn,orthoxerox/roslyn,dpoeschl/roslyn,krishnarajbb/roslyn,VShangxiao/roslyn,basoundr/roslyn,xoofx/roslyn,akrisiun/roslyn,bbarry/roslyn,huoxudong125/roslyn,mgoertz-msft/roslyn,taylorjonl/roslyn,physhi/roslyn,abock/roslyn,MichalStrehovsky/roslyn,ErikSchierboom/roslyn,AlexisArce/roslyn,moozzyk/roslyn,nguerrera/roslyn,tvand7093/roslyn,Pvlerick/roslyn,ericfe-ms/roslyn,russpowers/roslyn,RipCurrent/roslyn,VitalyTVA/roslyn,krishnarajbb/roslyn,antiufo/roslyn,lorcanmooney/roslyn,AnthonyDGreen/roslyn,amcasey/roslyn,3F/roslyn,jaredpar/roslyn,mgoertz-msft/roslyn,KevinRansom/roslyn,MatthieuMEZIL/roslyn,YOTOV-LIMITED/roslyn,yeaicc/roslyn,tmeschter/roslyn,CaptainHayashi/roslyn,thomaslevesque/roslyn,nguerrera/roslyn,VSadov/roslyn,bartdesmet/roslyn,nagyistoce/roslyn,jeremymeng/roslyn,Giftednewt/roslyn,Maxwe11/roslyn,AlekseyTs/roslyn,YOTOV-LIMITED/roslyn,pjmagee/roslyn,CaptainHayashi/roslyn,magicbing/roslyn,swaroop-sridhar/roslyn,poizan42/roslyn,poizan42/roslyn,akrisiun/roslyn,vslsnap/roslyn,MattWindsor91/roslyn,balajikris/roslyn,Inverness/roslyn,nemec/roslyn,natgla/roslyn,dovzhikova/roslyn,danielcweber/roslyn,KevinRansom/roslyn,abock/roslyn,jasonmalinowski/roslyn,huoxudong125/roslyn,mseamari/Stuff,VShangxiao/roslyn,xoofx/roslyn,rgani/roslyn,bartdesmet/roslyn,pjmagee/roslyn,MichalStrehovsky/roslyn,kelltrick/roslyn,3F/roslyn,sharadagrawal/Roslyn,zmaruo/roslyn,lisong521/roslyn,natgla/roslyn,v-codeel/roslyn,Shiney/roslyn,robinsedlaczek/roslyn,taylorjonl/roslyn,Giftednewt/roslyn,stephentoub/roslyn,yjfxfjch/roslyn,vslsnap/roslyn,Hosch250/roslyn,zmaruo/roslyn,MattWindsor91/roslyn,vslsnap/roslyn,mattscheffer/roslyn,danielcweber/roslyn,OmarTawfik/roslyn,VShangxiao/roslyn,EricArndt/roslyn,antonssonj/roslyn,evilc0des/roslyn,khyperia/roslyn,wvdd007/roslyn,moozzyk/roslyn,MichalStrehovsky/roslyn,Inverness/roslyn,ilyes14/roslyn,taylorjonl/roslyn,eriawan/roslyn,hanu412/roslyn,YOTOV-LIMITED/roslyn,michalhosala/roslyn,yjfxfjch/roslyn,genlu/roslyn,srivatsn/roslyn,hanu412/roslyn,lorcanmooney/roslyn,stebet/roslyn,dpoeschl/roslyn,stebet/roslyn,ljw1004/roslyn,khellang/roslyn,magicbing/roslyn,mmitche/roslyn,lisong521/roslyn,AArnott/roslyn,ahmedshuhel/roslyn,ljw1004/roslyn,chenxizhang/roslyn,Hosch250/roslyn,jaredpar/roslyn,tmat/roslyn,tmat/roslyn,zooba/roslyn,jasonmalinowski/roslyn,ValentinRueda/roslyn,VPashkov/roslyn,supriyantomaftuh/roslyn,dotnet/roslyn,mattwar/roslyn,khyperia/roslyn,davkean/roslyn,robinsedlaczek/roslyn,jonatassaraiva/roslyn,ilyes14/roslyn,michalhosala/roslyn,FICTURE7/roslyn,jcouv/roslyn,mseamari/Stuff,kelltrick/roslyn,SeriaWei/roslyn,thomaslevesque/roslyn,amcasey/roslyn,abock/roslyn,tang7526/roslyn,AnthonyDGreen/roslyn,jroggeman/roslyn,jbhensley/roslyn,SeriaWei/roslyn,TyOverby/roslyn,jonatassaraiva/roslyn,AlexisArce/roslyn,EricArndt/roslyn,EricArndt/roslyn,shyamnamboodiripad/roslyn,doconnell565/roslyn,nemec/roslyn,drognanar/roslyn,VitalyTVA/roslyn,bbarry/roslyn,VPashkov/roslyn,mavasani/roslyn,KevinH-MS/roslyn,ErikSchierboom/roslyn,KiloBravoLima/roslyn,dpoeschl/roslyn,KirillOsenkov/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tmeschter/roslyn,aelij/roslyn,jonatassaraiva/roslyn,khyperia/roslyn,natidea/roslyn,sharwell/roslyn,oberxon/roslyn,stephentoub/roslyn,AmadeusW/roslyn,DustinCampbell/roslyn,RipCurrent/roslyn,AnthonyDGreen/roslyn,v-codeel/roslyn,doconnell565/roslyn,rgani/roslyn,VitalyTVA/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,russpowers/roslyn,jaredpar/roslyn,budcribar/roslyn,shyamnamboodiripad/roslyn,HellBrick/roslyn,jkotas/roslyn,dovzhikova/roslyn,drognanar/roslyn,mavasani/roslyn,panopticoncentral/roslyn,vcsjones/roslyn,devharis/roslyn,bbarry/roslyn,jmarolf/roslyn,reaction1989/roslyn,brettfo/roslyn,orthoxerox/roslyn,panopticoncentral/roslyn,yjfxfjch/roslyn,natgla/roslyn,GuilhermeSa/roslyn,leppie/roslyn,v-codeel/roslyn,Hosch250/roslyn,physhi/roslyn,danielcweber/roslyn,paulvanbrenk/roslyn,TyOverby/roslyn,supriyantomaftuh/roslyn,FICTURE7/roslyn,akrisiun/roslyn,tang7526/roslyn,yeaicc/roslyn,antonssonj/roslyn,jamesqo/roslyn,sharadagrawal/Roslyn,heejaechang/roslyn,vcsjones/roslyn,ljw1004/roslyn,brettfo/roslyn,chenxizhang/roslyn,bkoelman/roslyn,KevinRansom/roslyn,russpowers/roslyn,supriyantomaftuh/roslyn,budcribar/roslyn,RipCurrent/roslyn,reaction1989/roslyn,paulvanbrenk/roslyn,agocke/roslyn,khellang/roslyn,aanshibudhiraja/Roslyn,pdelvo/roslyn,panopticoncentral/roslyn,leppie/roslyn,KirillOsenkov/roslyn,oberxon/roslyn,enginekit/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,davkean/roslyn,dotnet/roslyn,agocke/roslyn,OmarTawfik/roslyn,zooba/roslyn,zooba/roslyn,cston/roslyn,diryboy/roslyn,natidea/roslyn,swaroop-sridhar/roslyn,rchande/roslyn,budcribar/roslyn,jkotas/roslyn,xasx/roslyn,natidea/roslyn,aanshibudhiraja/Roslyn,drognanar/roslyn,AArnott/roslyn,gafter/roslyn,GuilhermeSa/roslyn,pdelvo/roslyn,MihaMarkic/roslyn-prank,KirillOsenkov/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tvand7093/roslyn,weltkante/roslyn,oocx/roslyn,jhendrixMSFT/roslyn,nemec/roslyn,SeriaWei/roslyn,khellang/roslyn,DustinCampbell/roslyn,VSadov/roslyn,KiloBravoLima/roslyn,amcasey/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,MatthieuMEZIL/roslyn,enginekit/roslyn,MihaMarkic/roslyn-prank,CyrusNajmabadi/roslyn,reaction1989/roslyn,evilc0des/roslyn,ericfe-ms/roslyn,gafter/roslyn,mattscheffer/roslyn,tannergooding/roslyn,mmitche/roslyn,rgani/roslyn,Pvlerick/roslyn,bkoelman/roslyn,eriawan/roslyn,tannergooding/roslyn,jamesqo/roslyn,mattwar/roslyn,KamalRathnayake/roslyn,bartdesmet/roslyn,jbhensley/roslyn,antiufo/roslyn,ahmedshuhel/roslyn,weltkante/roslyn,oberxon/roslyn,Shiney/roslyn,mirhagk/roslyn,eriawan/roslyn,jeffanders/roslyn,KiloBravoLima/roslyn,basoundr/roslyn,hanu412/roslyn,AmadeusW/roslyn,bkoelman/roslyn,nagyistoce/roslyn,grianggrai/roslyn,HellBrick/roslyn,ValentinRueda/roslyn,kelltrick/roslyn,ilyes14/roslyn,robinsedlaczek/roslyn,jmarolf/roslyn,xoofx/roslyn,KamalRathnayake/roslyn,nagyistoce/roslyn,oocx/roslyn,diryboy/roslyn,evilc0des/roslyn,weltkante/roslyn,stephentoub/roslyn,enginekit/roslyn,KevinH-MS/roslyn,kienct89/roslyn,antonssonj/roslyn,jeremymeng/roslyn,AmadeusW/roslyn,tvand7093/roslyn,mattscheffer/roslyn,brettfo/roslyn,kienct89/roslyn,TyOverby/roslyn,Maxwe11/roslyn,MattWindsor91/roslyn,KamalRathnayake/roslyn,mattwar/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,nguerrera/roslyn,mseamari/Stuff,pdelvo/roslyn,michalhosala/roslyn,basoundr/roslyn,heejaechang/roslyn,FICTURE7/roslyn,zmaruo/roslyn,grianggrai/roslyn,jhendrixMSFT/roslyn,tmat/roslyn,chenxizhang/roslyn,OmarTawfik/roslyn,magicbing/roslyn,wvdd007/roslyn,mmitche/roslyn,stebet/roslyn,AlekseyTs/roslyn,genlu/roslyn,HellBrick/roslyn,jeffanders/roslyn,mirhagk/roslyn,mirhagk/roslyn,kienct89/roslyn,Pvlerick/roslyn,sharadagrawal/Roslyn,jroggeman/roslyn,cston/roslyn,srivatsn/roslyn,wvdd007/roslyn,AlexisArce/roslyn,doconnell565/roslyn,managed-commons/roslyn,lorcanmooney/roslyn,a-ctor/roslyn,tmeschter/roslyn,yeaicc/roslyn,sharwell/roslyn,VSadov/roslyn,3F/roslyn,MatthieuMEZIL/roslyn,jeffanders/roslyn,GuilhermeSa/roslyn,jkotas/roslyn,AArnott/roslyn,physhi/roslyn,swaroop-sridhar/roslyn,mgoertz-msft/roslyn,thomaslevesque/roslyn,xasx/roslyn,diryboy/roslyn,antiufo/roslyn,balajikris/roslyn,davkean/roslyn,ericfe-ms/roslyn,pjmagee/roslyn,a-ctor/roslyn,orthoxerox/roslyn,krishnarajbb/roslyn,lisong521/roslyn,rchande/roslyn,jroggeman/roslyn,Giftednewt/roslyn,gafter/roslyn,Inverness/roslyn,a-ctor/roslyn,srivatsn/roslyn,sharwell/roslyn,genlu/roslyn,jcouv/roslyn,devharis/roslyn,agocke/roslyn,aelij/roslyn,poizan42/roslyn,MihaMarkic/roslyn-prank,jamesqo/roslyn,heejaechang/roslyn,Maxwe11/roslyn,rchande/roslyn,xasx/roslyn,managed-commons/roslyn,VPashkov/roslyn
|
src/EditorFeatures/CSharpTest/Organizing/AbstractOrganizerTests.cs
|
src/EditorFeatures/CSharpTest/Organizing/AbstractOrganizerTests.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Linq;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Organizing;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Organizing;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Organizing
{
public abstract class AbstractOrganizerTests
{
protected void Check(string initial, string final)
{
CheckResult(initial, final);
CheckResult(initial, final, Options.Script);
}
protected void Check(string initial, string final, bool specialCaseSystem)
{
CheckResult(initial, final, specialCaseSystem);
CheckResult(initial, final, specialCaseSystem, Options.Script);
}
protected void CheckResult(string initial, string final, bool specialCaseSystem, CSharpParseOptions options = null)
{
using (var workspace = CSharpWorkspaceFactory.CreateWorkspaceFromFile(initial))
{
var document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);
var newRoot = OrganizingService.OrganizeAsync(document).Result.GetSyntaxRootAsync().Result;
Assert.Equal(final.NormalizeLineEndings(), newRoot.ToFullString());
}
}
protected void CheckResult(string initial, string final, CSharpParseOptions options = null)
{
CheckResult(initial, final, false, options);
}
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Linq;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Organizing;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Organizing;
using Microsoft.CodeAnalysis.Text;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Organizing
{
public abstract class AbstractOrganizerTests
{
protected void Check(string initial, string final)
{
CheckResult(initial, final);
CheckResult(initial, final, Options.Script);
}
protected void Check(string initial, string final, bool specialCaseSystem)
{
CheckResult(initial, final, specialCaseSystem);
CheckResult(initial, final, specialCaseSystem, Options.Script);
}
protected void CheckResult(string initial, string final, bool specialCaseSystem, CSharpParseOptions options = null)
{
using (var workspace = CSharpWorkspaceFactory.CreateWorkspaceFromFile(initial))
{
var document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);
var newRoot = OrganizingService.OrganizeAsync(document).Result.GetSyntaxRootAsync().Result;
Assert.Equal(final, newRoot.ToFullString());
}
}
protected void CheckResult(string initial, string final, CSharpParseOptions options = null)
{
CheckResult(initial, final, false, options);
}
}
}
|
apache-2.0
|
C#
|
bb6918cafc7f2645b7e8ea77cfc6f5cdbacc4478
|
Remove requirement for dependency nodes to have a version.
|
dotnet/buildtools,roncain/buildtools,schaabs/buildtools,karajas/buildtools,chcosta/buildtools,AlexGhiondea/buildtools,AlexGhiondea/buildtools,ChadNedzlek/buildtools,roncain/buildtools,maririos/buildtools,naamunds/buildtools,mmitche/buildtools,stephentoub/buildtools,nguerrera/buildtools,stephentoub/buildtools,ChadNedzlek/buildtools,JeremyKuhne/buildtools,tarekgh/buildtools,weshaggard/buildtools,nguerrera/buildtools,jhendrixMSFT/buildtools,crummel/dotnet_buildtools,roncain/buildtools,ChadNedzlek/buildtools,jhendrixMSFT/buildtools,karajas/buildtools,weshaggard/buildtools,MattGal/buildtools,jthelin/dotnet-buildtools,ianhays/buildtools,ericstj/buildtools,ianhays/buildtools,joperezr/buildtools,tarekgh/buildtools,schaabs/buildtools,chcosta/buildtools,ianhays/buildtools,schaabs/buildtools,MattGal/buildtools,jthelin/dotnet-buildtools,alexperovich/buildtools,mmitche/buildtools,ericstj/buildtools,schaabs/buildtools,dotnet/buildtools,MattGal/buildtools,maririos/buildtools,JeremyKuhne/buildtools,crummel/dotnet_buildtools,chcosta/buildtools,JeremyKuhne/buildtools,karajas/buildtools,maririos/buildtools,weshaggard/buildtools,mmitche/buildtools,mmitche/buildtools,joperezr/buildtools,stephentoub/buildtools,MattGal/buildtools,stephentoub/buildtools,dotnet/buildtools,maririos/buildtools,naamunds/buildtools,AlexGhiondea/buildtools,ericstj/buildtools,karajas/buildtools,dotnet/buildtools,ianhays/buildtools,alexperovich/buildtools,ChadNedzlek/buildtools,alexperovich/buildtools,jhendrixMSFT/buildtools,joperezr/buildtools,jthelin/dotnet-buildtools,roncain/buildtools,naamunds/buildtools,MattGal/buildtools,joperezr/buildtools,tarekgh/buildtools,crummel/dotnet_buildtools,tarekgh/buildtools,nguerrera/buildtools,weshaggard/buildtools,nguerrera/buildtools,joperezr/buildtools,crummel/dotnet_buildtools,AlexGhiondea/buildtools,naamunds/buildtools,JeremyKuhne/buildtools,jthelin/dotnet-buildtools,alexperovich/buildtools,chcosta/buildtools,ericstj/buildtools,mmitche/buildtools,jhendrixMSFT/buildtools,tarekgh/buildtools,alexperovich/buildtools
|
src/Microsoft.DotNet.Build.Tasks/UpdatePackageDependencyVersion.cs
|
src/Microsoft.DotNet.Build.Tasks/UpdatePackageDependencyVersion.cs
|
using Microsoft.Build.Framework;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
namespace Microsoft.DotNet.Build.Tasks
{
public class UpdatePackageDependencyVersion : VisitProjectDependencies
{
[Required]
public string PackageId { get; set; }
[Required]
public string OldVersion { get; set; }
[Required]
public string NewVersion { get; set; }
public override bool VisitPackage(JProperty package, string projectJsonPath)
{
var dependencyIdentifier = package.Name;
string dependencyVersion;
if (package.Value is JObject)
{
dependencyVersion = package.Value["version"]?.Value<string>();
}
else if (package.Value is JValue)
{
dependencyVersion = package.Value.ToObject<string>();
}
else
{
throw new ArgumentException(string.Format(
"Unrecognized dependency element for {0} in {1}",
package.Name,
projectJsonPath));
}
if (dependencyVersion == null)
{
return false;
}
if (dependencyIdentifier == PackageId && dependencyVersion == OldVersion)
{
Log.LogMessage(
"Changing {0} {1} to {2} in {3}",
dependencyIdentifier,
dependencyVersion,
NewVersion,
projectJsonPath);
if (package.Value is JObject)
{
package.Value["version"] = NewVersion;
}
else
{
package.Value = NewVersion;
}
return true;
}
return false;
}
}
}
|
using Microsoft.Build.Framework;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
namespace Microsoft.DotNet.Build.Tasks
{
public class UpdatePackageDependencyVersion : VisitProjectDependencies
{
[Required]
public string PackageId { get; set; }
[Required]
public string OldVersion { get; set; }
[Required]
public string NewVersion { get; set; }
public override bool VisitPackage(JProperty package, string projectJsonPath)
{
var dependencyIdentifier = package.Name;
string dependencyVersion;
if (package.Value is JObject)
{
dependencyVersion = package.Value["version"].Value<string>();
}
else if (package.Value is JValue)
{
dependencyVersion = package.Value.ToObject<string>();
}
else
{
throw new ArgumentException(string.Format(
"Unrecognized dependency element for {0} in {1}",
package.Name,
projectJsonPath));
}
if (dependencyIdentifier == PackageId && dependencyVersion == OldVersion)
{
Log.LogMessage(
"Changing {0} {1} to {2} in {3}",
dependencyIdentifier,
dependencyVersion,
NewVersion,
projectJsonPath);
if (package.Value is JObject)
{
package.Value["version"] = NewVersion;
}
else
{
package.Value = NewVersion;
}
return true;
}
return false;
}
}
}
|
mit
|
C#
|
5540744d17f47eef1d25ae784db59538577256da
|
Update AddingListBoxControl.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET
|
Examples/CSharp/DrawingObjects/Controls/AddingListBoxControl.cs
|
Examples/CSharp/DrawingObjects/Controls/AddingListBoxControl.cs
|
using System.IO;
using Aspose.Cells;
using Aspose.Cells.Drawing;
namespace Aspose.Cells.Examples.DrawingObjects.Controls
{
public class AddingListBoxControl
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Create a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet.
Worksheet sheet = workbook.Worksheets[0];
//Get the worksheet cells collection.
Cells cells = sheet.Cells;
//Input a value.
cells["B3"].PutValue("Choose Dept:");
//Set it bold.
cells["B3"].GetStyle().Font.IsBold = true;
//Input some values that denote the input range
//for the list box.
cells["A2"].PutValue("Sales");
cells["A3"].PutValue("Finance");
cells["A4"].PutValue("MIS");
cells["A5"].PutValue("R&D");
cells["A6"].PutValue("Marketing");
cells["A7"].PutValue("HRA");
//Add a new list box.
Aspose.Cells.Drawing.ListBox listBox = sheet.Shapes.AddListBox(2, 0, 3, 0, 122, 100);
//Set the placement type.
listBox.Placement = PlacementType.FreeFloating;
//Set the linked cell.
listBox.LinkedCell = "A1";
//Set the input range.
listBox.InputRange = "A2:A7";
//Set the selection tyle.
listBox.SelectionType = SelectionType.Single;
//Set the list box with 3-D shading.
listBox.Shadow = true;
//Saves the file.
workbook.Save(dataDir + "book1.out.xls");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
using Aspose.Cells.Drawing;
namespace Aspose.Cells.Examples.DrawingObjects.Controls
{
public class AddingListBoxControl
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Create a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet.
Worksheet sheet = workbook.Worksheets[0];
//Get the worksheet cells collection.
Cells cells = sheet.Cells;
//Input a value.
cells["B3"].PutValue("Choose Dept:");
//Set it bold.
cells["B3"].GetStyle().Font.IsBold = true;
//Input some values that denote the input range
//for the list box.
cells["A2"].PutValue("Sales");
cells["A3"].PutValue("Finance");
cells["A4"].PutValue("MIS");
cells["A5"].PutValue("R&D");
cells["A6"].PutValue("Marketing");
cells["A7"].PutValue("HRA");
//Add a new list box.
Aspose.Cells.Drawing.ListBox listBox = sheet.Shapes.AddListBox(2, 0, 3, 0, 122, 100);
//Set the placement type.
listBox.Placement = PlacementType.FreeFloating;
//Set the linked cell.
listBox.LinkedCell = "A1";
//Set the input range.
listBox.InputRange = "A2:A7";
//Set the selection tyle.
listBox.SelectionType = SelectionType.Single;
//Set the list box with 3-D shading.
listBox.Shadow = true;
//Saves the file.
workbook.Save(dataDir + "book1.out.xls");
}
}
}
|
mit
|
C#
|
e04fbc08e0d33695c5d2c722b91283f4d50321f7
|
Add test cases for Models.Th143.NicknameReplacer (cont.)
|
y-iihoshi/ThScoreFileConverter,y-iihoshi/ThScoreFileConverter
|
ThScoreFileConverterTests/Models/Th143/NicknameReplacerTests.cs
|
ThScoreFileConverterTests/Models/Th143/NicknameReplacerTests.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ThScoreFileConverter.Models.Th143;
using ThScoreFileConverterTests.Models.Th143.Stubs;
namespace ThScoreFileConverterTests.Models.Th143
{
[TestClass]
public class NicknameReplacerTests
{
internal static IStatus Status { get; } = new StatusStub(StatusTests.ValidStub);
[TestMethod]
public void NicknameReplacerTest()
{
var replacer = new NicknameReplacer(Status);
Assert.IsNotNull(replacer);
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void NicknameReplacerTestNull()
{
_ = new NicknameReplacer(null);
Assert.Fail(TestUtils.Unreachable);
}
[TestMethod]
public void ReplaceTest()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("究極反則生命体", replacer.Replace("%T143NICK70"));
}
[TestMethod]
public void ReplaceTestNotCleared()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("??????????", replacer.Replace("%T143NICK69"));
}
[TestMethod]
public void ReplaceTestZeroNumber()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("%T143NICK00", replacer.Replace("%T143NICK00"));
}
[TestMethod]
public void ReplaceTestExceededNumber()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("%T143NICK71", replacer.Replace("%T143NICK71"));
}
[TestMethod]
public void ReplaceTestInvalidFormat()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("%T143XXXX70", replacer.Replace("%T143XXXX70"));
}
[TestMethod]
public void ReplaceTestInvalidNumber()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("%T143NICKXX", replacer.Replace("%T143NICKXX"));
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ThScoreFileConverter.Models.Th143;
using ThScoreFileConverterTests.Models.Th143.Stubs;
namespace ThScoreFileConverterTests.Models.Th143
{
[TestClass]
public class NicknameReplacerTests
{
internal static IStatus Status { get; } = new StatusStub(StatusTests.ValidStub);
[TestMethod]
public void NicknameReplacerTest()
{
var replacer = new NicknameReplacer(Status);
Assert.IsNotNull(replacer);
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void NicknameReplacerTestNull()
{
_ = new NicknameReplacer(null);
Assert.Fail(TestUtils.Unreachable);
}
[TestMethod]
public void ReplaceTest()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("究極反則生命体", replacer.Replace("%T143NICK70"));
}
[TestMethod]
public void ReplaceTestNotCleared()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("??????????", replacer.Replace("%T143NICK69"));
}
[TestMethod]
public void ReplaceTestZeroNumber()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("%T143NICK00", replacer.Replace("%T143NICK00"));
}
[TestMethod]
public void ReplaceTestExceededNumber()
{
var replacer = new NicknameReplacer(Status);
Assert.AreEqual("%T143NICK71", replacer.Replace("%T143NICK71"));
}
}
}
|
bsd-2-clause
|
C#
|
7058bb60c1f734410c11a9c0667b981396d0037b
|
Add CreatedUTC to Created Thing
|
CrustyJew/RedditSharp,chuggafan/RedditSharp-1,Jinivus/RedditSharp,justcool393/RedditSharp-1,tomnolan95/RedditSharp,IAmAnubhavSaini/RedditSharp,ekaralar/RedditSharpWindowsStore,epvanhouten/RedditSharp,angelotodaro/RedditSharp,pimanac/RedditSharp,SirCmpwn/RedditSharp,RobThree/RedditSharp,nyanpasudo/RedditSharp,theonlylawislove/RedditSharp
|
RedditSharp/CreatedThing.cs
|
RedditSharp/CreatedThing.cs
|
using System;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
namespace RedditSharp
{
public class CreatedThing : Thing
{
private Reddit Reddit { get; set; }
public CreatedThing(Reddit reddit, JToken json) : base(json)
{
Reddit = reddit;
JsonConvert.PopulateObject(json["data"].ToString(), this, reddit.JsonSerializerSettings);
}
[JsonProperty("created")]
[JsonConverter(typeof(UnixTimestampConverter))]
public DateTime Created { get; set; }
[JsonProperty("created_utc")]
[JsonConverter(typeof(UnixTimestampConverter))]
public DateTime CreatedUTC { get; set; }
}
}
|
using System;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
namespace RedditSharp
{
public class CreatedThing : Thing
{
private Reddit Reddit { get; set; }
public CreatedThing(Reddit reddit, JToken json) : base(json)
{
Reddit = reddit;
JsonConvert.PopulateObject(json["data"].ToString(), this, reddit.JsonSerializerSettings);
}
[JsonProperty("created")]
[JsonConverter(typeof(UnixTimestampConverter))]
public DateTime Created { get; set; }
}
}
|
mit
|
C#
|
125e1434017835cb992cd9bcad8b6b580b818cd9
|
Fix banana shower placement outline initial opacity
|
ppy/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu-new,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,smoogipoo/osu
|
osu.Game.Rulesets.Catch/Edit/Blueprints/Components/TimeSpanOutline.cs
|
osu.Game.Rulesets.Catch/Edit/Blueprints/Components/TimeSpanOutline.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
{
public class TimeSpanOutline : CompositeDrawable
{
private const float border_width = 4;
private const float opacity_when_empty = 0.5f;
private bool isEmpty = true;
public TimeSpanOutline()
{
Anchor = Origin = Anchor.BottomLeft;
RelativeSizeAxes = Axes.X;
Masking = true;
BorderThickness = border_width;
Alpha = opacity_when_empty;
// A box is needed to make the border visible.
InternalChild = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Transparent
};
}
[BackgroundDependencyLoader]
private void load(OsuColour osuColour)
{
BorderColour = osuColour.Yellow;
}
public void UpdateFrom(ScrollingHitObjectContainer hitObjectContainer, BananaShower hitObject)
{
float startY = hitObjectContainer.PositionAtTime(hitObject.StartTime);
float endY = hitObjectContainer.PositionAtTime(hitObject.EndTime);
Y = Math.Max(startY, endY);
float height = Math.Abs(startY - endY);
bool wasEmpty = isEmpty;
isEmpty = height == 0;
if (wasEmpty != isEmpty)
this.FadeTo(isEmpty ? opacity_when_empty : 1f, 150);
Height = Math.Max(height, border_width);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
{
public class TimeSpanOutline : CompositeDrawable
{
private const float border_width = 4;
private bool isEmpty = true;
public TimeSpanOutline()
{
Anchor = Origin = Anchor.BottomLeft;
RelativeSizeAxes = Axes.X;
Masking = true;
BorderThickness = border_width;
// A box is needed to make the border visible.
InternalChild = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Transparent
};
}
[BackgroundDependencyLoader]
private void load(OsuColour osuColour)
{
BorderColour = osuColour.Yellow;
}
public void UpdateFrom(ScrollingHitObjectContainer hitObjectContainer, BananaShower hitObject)
{
float startY = hitObjectContainer.PositionAtTime(hitObject.StartTime);
float endY = hitObjectContainer.PositionAtTime(hitObject.EndTime);
Y = Math.Max(startY, endY);
float height = Math.Abs(startY - endY);
bool wasEmpty = isEmpty;
isEmpty = height == 0;
if (wasEmpty != isEmpty)
this.FadeTo(isEmpty ? 0.5f : 1f, 150);
Height = Math.Max(height, border_width);
}
}
}
|
mit
|
C#
|
f5d479682218f4aa576ee3553cc1bb5cdd2cd95e
|
bump ver
|
AntonyCorbett/OnlyT,AntonyCorbett/OnlyT
|
SolutionInfo.cs
|
SolutionInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2019, 2020 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.24")]
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2019 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.23")]
|
mit
|
C#
|
5a2d7aa1a55dded81ead05f884100dfbf0496be3
|
bump ver
|
AntonyCorbett/OnlyT,AntonyCorbett/OnlyT
|
SolutionInfo.cs
|
SolutionInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2018 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0.44")]
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2018 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0.43")]
|
mit
|
C#
|
e732d7b847c4e976d002817c0855090e969f2344
|
Update to 1.2
|
bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1
|
Source/GlobalAssemblyInfo.cs
|
Source/GlobalAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyCompany("Picoe Software Solutions Inc.")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("(c) 2010-2013 by Curtis Wensley aka Eto")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.*")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyCompany("Picoe Software Solutions Inc.")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("(c) 2010-2013 by Curtis Wensley aka Eto")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0.*")]
|
bsd-3-clause
|
C#
|
fbc3c635cc590280d7312b6552e40098724a0c84
|
support complex json token as parameter name (#7824)
|
xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2
|
src/OrchardCore/OrchardCore.Recipes.Core/ParametersMethodProvider.cs
|
src/OrchardCore/OrchardCore.Recipes.Core/ParametersMethodProvider.cs
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using OrchardCore.Scripting;
namespace OrchardCore.Recipes
{
public class ParametersMethodProvider : IGlobalMethodProvider
{
private readonly GlobalMethod _globalMethod;
public ParametersMethodProvider(object environment)
{
var environmentObject = JObject.FromObject(environment);
_globalMethod = new GlobalMethod
{
Name = "parameters",
Method = serviceprovider => (Func<string, object>)(name =>
{
return environmentObject.SelectToken(name)?.Value<string>();
})
};
}
public IEnumerable<GlobalMethod> GetMethods()
{
yield return _globalMethod;
}
}
}
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using OrchardCore.Scripting;
namespace OrchardCore.Recipes
{
public class ParametersMethodProvider : IGlobalMethodProvider
{
private readonly GlobalMethod _globalMethod;
public ParametersMethodProvider(object environment)
{
var environmentObject = JObject.FromObject(environment);
_globalMethod = new GlobalMethod
{
Name = "parameters",
Method = serviceprovider => (Func<string, object>)(name =>
{
return environmentObject[name].Value<string>();
})
};
}
public IEnumerable<GlobalMethod> GetMethods()
{
yield return _globalMethod;
}
}
}
|
bsd-3-clause
|
C#
|
65a996cdb331c4e1b09786a957be61af7701ce58
|
Add tests
|
joaoasrosa/nppxmltreeview,joaoasrosa/nppxmltreeview
|
tests/NppXmlTreeviewPlugin.Parsers.Tests.Unit/WhenParsingValidXml.cs
|
tests/NppXmlTreeviewPlugin.Parsers.Tests.Unit/WhenParsingValidXml.cs
|
using System.IO;
using FluentAssertions;
using Xunit;
namespace NppXmlTreeviewPlugin.Parsers.Tests.Unit
{
public class WhenParsingValidXml
{
[Theory]
[InlineData(@"./TestFiles/NPP_comments.xml")]
[InlineData(@"./TestFiles/NPP_nocomments.xml")]
public void GivenValidXml_ThenTryParseIsValid(string path)
{
var xml = File.ReadAllText(path);
NppXmlNode nppXmlNode;
var result = NppXmlNode.TryParse(xml, out nppXmlNode);
result.Should().BeTrue(because: "the XML is valid");
}
[Theory]
[InlineData(@"./TestFiles/NPP_comments.xml", 3)]
[InlineData(@"./TestFiles/NPP_nocomments.xml", 3)]
public void GivenValidXml_ThenNumberOfChildNodesMatch(string path, int nodeCount)
{
var xml = File.ReadAllText(path);
NppXmlNode nppXmlNode;
NppXmlNode.TryParse(xml, out nppXmlNode);
nppXmlNode.ChildNodes.Count.Should().Be(nodeCount, because: $"the number of child nodes is {nodeCount}");
}
}
}
|
using System.IO;
using FluentAssertions;
using Xunit;
namespace NppXmlTreeviewPlugin.Parsers.Tests.Unit
{
public class WhenParsingValidXml
{
[Theory]
[InlineData(@"./TestFiles/NPP_comments.xml")]
[InlineData(@"./TestFiles/NPP_nocomments.xml")]
public void GivenValidXml_ThenFoo(string path)
{
var xml = File.ReadAllText(path);
NppXmlNode nppXmlNode;
var result = NppXmlNode.TryParse(xml, out nppXmlNode);
result.Should().BeTrue();
}
}
}
|
apache-2.0
|
C#
|
490378d9e3b0c5f545c703c2bb570748c1b8214d
|
Fix InvalidCastException in WebApiSample
|
danielgerlag/workflow-core
|
src/samples/WebApiSample/WebApiSample/Controllers/EventsController.cs
|
src/samples/WebApiSample/WebApiSample/Controllers/EventsController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using WebApiSample.Workflows;
using WorkflowCore.Interface;
using WorkflowCore.Models;
namespace WebApiSample.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class EventsController : Controller
{
private readonly IWorkflowController _workflowService;
public EventsController(IWorkflowController workflowService)
{
_workflowService = workflowService;
}
[HttpPost("{eventName}/{eventKey}")]
public async Task<IActionResult> Post(string eventName, string eventKey, [FromBody]MyDataClass eventData)
{
await _workflowService.PublishEvent(eventName, eventKey, eventData.Value1);
return Ok();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using WorkflowCore.Interface;
using WorkflowCore.Models;
namespace WebApiSample.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class EventsController : Controller
{
private readonly IWorkflowController _workflowService;
public EventsController(IWorkflowController workflowService)
{
_workflowService = workflowService;
}
[HttpPost("{eventName}/{eventKey}")]
public async Task<IActionResult> Post(string eventName, string eventKey, [FromBody]object eventData)
{
await _workflowService.PublishEvent(eventName, eventKey, eventData);
return Ok();
}
}
}
|
mit
|
C#
|
271284194f54dd684b972d1980f3adadc0aa48e0
|
redefine CheckboxItem class member
|
peterhumbert/YARTE
|
YARTE/YARTE/CheckboxItem.cs
|
YARTE/YARTE/CheckboxItem.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace YARTE
{
public class CheckboxItem
{
private string strLabel;
private string strIdentifier;
public CheckboxItem(string label, string identifier)
{
strLabel = label;
strIdentifier = identifier;
}
public string Label
{
get { return strLabel; }
set { strLabel = value; }
}
public string Identifier
{
get { return strIdentifier; }
set { strIdentifier = value; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace YARTE
{
public class CheckboxItem
{
private string strLabel;
private int intIdentifier;
public CheckboxItem(string label, int identifier)
{
strLabel = label;
intIdentifier = identifier;
}
public string Label
{
get { return strLabel; }
set { strLabel = value; }
}
public int Identifier
{
get { return intIdentifier; }
set { intIdentifier = value; }
}
}
}
|
apache-2.0
|
C#
|
10e2df0b5248318917dc71c72de56fb90db4678e
|
change default scale factor to 1.0
|
unity3d-jp/AlembicImporter,unity3d-jp/AlembicImporter,unity3d-jp/AlembicImporter
|
AlembicImporter/Assets/UTJ/Alembic/Scripts/Importer/AlembicSettings.cs
|
AlembicImporter/Assets/UTJ/Alembic/Scripts/Importer/AlembicSettings.cs
|
using UnityEngine;
namespace UTJ.Alembic
{
[System.Serializable]
public class AlembicStreamSettings
{
[SerializeField] public aiNormalsMode normals = aiNormalsMode.CalculateIfMissing;
[SerializeField] public aiTangentsMode tangents = aiTangentsMode.Calculate;
[SerializeField] public aiAspectRatioMode cameraAspectRatio = aiAspectRatioMode.CameraAperture;
[SerializeField] public float scaleFactor = 1.0f;
[SerializeField] public bool swapHandedness = true;
[SerializeField] public bool flipFaces = false;
[SerializeField] public bool interpolateSamples = true;
[SerializeField] public bool importPointPolygon = true;
[SerializeField] public bool importLinePolygon = true;
[SerializeField] public bool importTrianglePolygon = true;
[SerializeField] public bool importXform = true;
[SerializeField] public bool importCameras = true;
[SerializeField] public bool importMeshes = true;
[SerializeField] public bool importPoints = true;
[SerializeField] public bool importVisibility = true;
[SerializeField] public bool serializeDynamicMeshes = false;
}
}
|
using UnityEngine;
namespace UTJ.Alembic
{
[System.Serializable]
public class AlembicStreamSettings
{
[SerializeField] public aiNormalsMode normals = aiNormalsMode.CalculateIfMissing;
[SerializeField] public aiTangentsMode tangents = aiTangentsMode.Calculate;
[SerializeField] public aiAspectRatioMode cameraAspectRatio = aiAspectRatioMode.CameraAperture;
[SerializeField] public float scaleFactor = 0.01f;
[SerializeField] public bool swapHandedness = true;
[SerializeField] public bool flipFaces = false;
[SerializeField] public bool interpolateSamples = true;
[SerializeField] public bool importPointPolygon = true;
[SerializeField] public bool importLinePolygon = true;
[SerializeField] public bool importTrianglePolygon = true;
[SerializeField] public bool importXform = true;
[SerializeField] public bool importCameras = true;
[SerializeField] public bool importMeshes = true;
[SerializeField] public bool importPoints = true;
[SerializeField] public bool importVisibility = true;
[SerializeField] public bool serializeDynamicMeshes = false;
}
}
|
mit
|
C#
|
812b128ce101a1d3389b386afbe5fa80812be02d
|
Add the new keyword.
|
averrunci/Carna
|
Spec/Carna.Runner.Spec/Runner/FixtureDescriptorAssertion.cs
|
Spec/Carna.Runner.Spec/Runner/FixtureDescriptorAssertion.cs
|
// Copyright (C) 2019-2021 Fievus
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
using System;
using Carna.Assertions;
namespace Carna.Runner
{
internal class FixtureDescriptorAssertion : AssertionObject
{
[AssertionProperty]
protected string Description { get; }
[AssertionProperty]
protected string Name { get; }
[AssertionProperty]
protected string FullName { get; }
[AssertionProperty]
protected Type FixtureAttributeType { get; }
public FixtureDescriptorAssertion(string description, string name, string fullName, Type fixtureAttributeType)
{
Description = description;
Name = name;
FullName = fullName;
FixtureAttributeType = fixtureAttributeType;
}
public static FixtureDescriptorAssertion Of(string description, string name, string fullName, Type fixtureAttributeType) => new FixtureDescriptorAssertion(description, name, fullName, fixtureAttributeType);
public static FixtureDescriptorAssertion Of(FixtureDescriptor descriptor) => new FixtureDescriptorAssertion(descriptor.Description, descriptor.Name, descriptor.FullName, descriptor.FixtureAttributeType);
}
internal class FixtureDescriptorWithBackgroundAssertion : FixtureDescriptorAssertion
{
[AssertionProperty]
string Background { get; }
public FixtureDescriptorWithBackgroundAssertion(string description, string name, string fullName, Type fixtureAttributeType, string background) : base(description, name, fullName, fixtureAttributeType)
{
Background = background;
}
public static FixtureDescriptorWithBackgroundAssertion Of(string description, string name, string fullName, Type fixtureAttributeType, string background) => new FixtureDescriptorWithBackgroundAssertion(description, name, fullName, fixtureAttributeType, background);
public new static FixtureDescriptorWithBackgroundAssertion Of(FixtureDescriptor descriptor) => new FixtureDescriptorWithBackgroundAssertion(descriptor.Description, descriptor.Name, descriptor.FullName, descriptor.FixtureAttributeType, descriptor.Background);
}
}
|
// Copyright (C) 2019 Fievus
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
using System;
using Carna.Assertions;
namespace Carna.Runner
{
internal class FixtureDescriptorAssertion : AssertionObject
{
[AssertionProperty]
protected string Description { get; }
[AssertionProperty]
protected string Name { get; }
[AssertionProperty]
protected string FullName { get; }
[AssertionProperty]
protected Type FixtureAttributeType { get; }
public FixtureDescriptorAssertion(string description, string name, string fullName, Type fixtureAttributeType)
{
Description = description;
Name = name;
FullName = fullName;
FixtureAttributeType = fixtureAttributeType;
}
public static FixtureDescriptorAssertion Of(string description, string name, string fullName, Type fixtureAttributeType) => new FixtureDescriptorAssertion(description, name, fullName, fixtureAttributeType);
public static FixtureDescriptorAssertion Of(FixtureDescriptor descriptor) => new FixtureDescriptorAssertion(descriptor.Description, descriptor.Name, descriptor.FullName, descriptor.FixtureAttributeType);
}
internal class FixtureDescriptorWithBackgroundAssertion : FixtureDescriptorAssertion
{
[AssertionProperty]
string Background { get; }
public FixtureDescriptorWithBackgroundAssertion(string description, string name, string fullName, Type fixtureAttributeType, string background) : base(description, name, fullName, fixtureAttributeType)
{
Background = background;
}
public static FixtureDescriptorWithBackgroundAssertion Of(string description, string name, string fullName, Type fixtureAttributeType, string background) => new FixtureDescriptorWithBackgroundAssertion(description, name, fullName, fixtureAttributeType, background);
public static FixtureDescriptorWithBackgroundAssertion Of(FixtureDescriptor descriptor) => new FixtureDescriptorWithBackgroundAssertion(descriptor.Description, descriptor.Name, descriptor.FullName, descriptor.FixtureAttributeType, descriptor.Background);
}
}
|
mit
|
C#
|
877091c0563a07a94e027d5a0d6342a89928fe8b
|
Update comments for DfsStorage.cs
|
alphaleonis/AlphaFS,modulexcite/AlphaFS,thomaslevesque/AlphaFS
|
AlphaFS/Network/DfsStorage.cs
|
AlphaFS/Network/DfsStorage.cs
|
/* Copyright (C) 2008-2015 Peter Palotas, Jeffrey Jangli, Alexandr Normuradov
*
* 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.Diagnostics.CodeAnalysis;
namespace Alphaleonis.Win32.Network
{
/// <summary>DFS_STORAGE_INFO
/// <para>Contains information about a DFS root or link target in a DFS namespace or from the cache maintained by the DFS client. This class cannot be inherited.</para>
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Dfs")]
public sealed class DfsStorage
{
#region Constructor
/// <summary>Initializes a new instance of the <see cref="DfsStorage"/> class, which acts as a wrapper for a DFS root or link target.</summary>
public DfsStorage()
{
}
/// <summary>Initializes a new instance of the <see cref="DfsStorage"/> class, which acts as a wrapper for a DFS root or link target.</summary>
/// <param name="structure">An initialized <see cref="NativeMethods.DfsStorageInfo"/> instance.</param>
internal DfsStorage(NativeMethods.DfsStorageInfo structure)
{
ServerName = structure.ServerName;
ShareName = structure.ShareName;
State = structure.State;
}
#endregion // Constructor
#region Properties
#region ServerName
/// <summary>The server name of the DFS root target or link target.</summary>
public string ServerName { get; private set; }
#endregion // ServerName
#region ShareName
/// <summary>The share name of the DFS root target or link target.</summary>
public string ShareName { get; private set; }
#endregion // ShareName
#region State
/// <summary>An <see cref="DfsStorageStates"/> enum of the DFS root target or link target.</summary>
public DfsStorageStates State { get; private set; }
#endregion // State
#endregion // Properties
}
}
|
/* Copyright (C) 2008-2015 Peter Palotas, Jeffrey Jangli, Alexandr Normuradov
*
* 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.Diagnostics.CodeAnalysis;
namespace Alphaleonis.Win32.Network
{
/// <summary>
/// <para>Contains information about a DFS root or link target in a DFS namespace</para>
/// <para>or from the cache maintained by the DFS client.</para>
/// <para>Win32: DFS_STORAGE_INFO structure.</para>
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Dfs")]
public sealed class DfsStorage
{
#region Constructor
/// <summary>Initializes a new instance of the <see cref="DfsStorage"/> class,
/// <para>which acts as a wrapper for a DFS root or link target.</para>
/// </summary>
public DfsStorage()
{
}
/// <summary>Initializes a new instance of the <see cref="DfsStorage"/> class,
/// <para>which acts as a wrapper for a DFS root or link target.</para>
/// </summary>
/// <param name="structure">An initialized <see cref="NativeMethods.DfsStorageInfo"/> instance.</param>
internal DfsStorage(NativeMethods.DfsStorageInfo structure)
{
ServerName = structure.ServerName;
ShareName = structure.ShareName;
State = structure.State;
}
#endregion // Constructor
#region Properties
#region ServerName
/// <summary>The server name of the DFS root target or link target.</summary>
public string ServerName { get; private set; }
#endregion // ServerName
#region ShareName
/// <summary>The share name of the DFS root target or link target.</summary>
public string ShareName { get; private set; }
#endregion // ShareName
#region State
/// <summary>An <see cref="DfsStorageStates"/> enum of the DFS root target or link target.</summary>
public DfsStorageStates State { get; private set; }
#endregion // State
#endregion // Properties
}
}
|
mit
|
C#
|
6e27a6aa6cdd9a06e517a6bb8ff156f1d2afb501
|
Refactor collider name for attack behaviour
|
bastuijnman/ludum-dare-36
|
Assets/Scripts/Building/AttackBuilding.cs
|
Assets/Scripts/Building/AttackBuilding.cs
|
using UnityEngine;
using System.Collections;
public class AttackBuilding : MonoBehaviour
{
BuildingProperties properties;
SphereCollider attackZone;
void Start () {
properties = GetComponent<BuildingProperties> ();
attackZone = gameObject.AddComponent<SphereCollider> ();
attackZone.isTrigger = true;
attackZone.radius = properties.radius;
}
void OnTriggerEnter (Collider col) {
// TODO: target enemy
}
}
|
using UnityEngine;
using System.Collections;
public class AttackBuilding : MonoBehaviour
{
BuildingProperties properties;
SphereCollider collider;
void Start () {
properties = GetComponent<BuildingProperties> ();
collider = gameObject.AddComponent<SphereCollider> ();
collider.isTrigger = true;
collider.radius = properties.radius;
}
void OnTriggerEnter (Collider col) {
// TODO: target enemy
}
}
|
mit
|
C#
|
dd252bcfb44d038c2a6635bf2a1bd2604924a838
|
update version
|
imanushin/CheckContracts
|
CheckContracts/Properties/AssemblyInfo.cs
|
CheckContracts/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Check Contracts")]
[assembly: AssemblyDescription("Code contracts for dynamic checks")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Igor Manushin")]
[assembly: AssemblyProduct("CheckContracts")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyVersion("1.4.3.0")]
[assembly: AssemblyFileVersion("1.4.3.0")]
[assembly: InternalsVisibleTo("CheckContracts.ResharperFileGeneration")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Check Contracts")]
[assembly: AssemblyDescription("Code contracts for dynamic checks")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Igor Manushin")]
[assembly: AssemblyProduct("CheckContracts")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyVersion("1.4.2.0")]
[assembly: AssemblyFileVersion("1.4.2.0")]
[assembly: InternalsVisibleTo("CheckContracts.ResharperFileGeneration")]
|
mit
|
C#
|
d1eea575d3e71b618a2adbf9eae7d9a185a4c7bb
|
Fix Dev15 build
|
karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS
|
src/Package/Impl/ProjectSystem/ProjectTreePropertiesProvider.cs
|
src/Package/Impl/ProjectSystem/ProjectTreePropertiesProvider.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#if VS15
using System.ComponentModel.Composition;
using System.IO;
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.ProjectSystem;
namespace Microsoft.VisualStudio.R.Package.ProjectSystem {
[Export(typeof(IProjectTreePropertiesProvider))]
[AppliesTo(ProjectConstants.RtvsProjectCapability)]
internal sealed class ProjectTreePropertiesProvider : IProjectTreePropertiesProvider {
public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext,
IProjectTreeCustomizablePropertyValues propertyValues) {
if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot)) {
propertyValues.Icon = ProjectIconProvider.ProjectNodeImage.ToProjectSystemType();
} else if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.FileOnDisk)) {
string ext = Path.GetExtension(propertyContext.ItemName).ToLowerInvariant();
if (ext == ".r") {
propertyValues.Icon = ProjectIconProvider.RFileNodeImage.ToProjectSystemType();
} else if (ext == ".rdata" || ext == ".rhistory") {
propertyValues.Icon = ProjectIconProvider.RDataFileNodeImage.ToProjectSystemType();
} else if (ext == ".md" || ext == ".rmd") {
propertyValues.Icon = KnownMonikers.MarkdownFile.ToProjectSystemType();
} else if (tree.FilePath.EndsWithIgnoreCase(SProcFileExtensions.QueryFileExtension)) {
propertyValues.Icon = KnownMonikers.DatabaseColumn.ToProjectSystemType();
} else if (tree.FilePath.EndsWithIgnoreCase(SProcFileExtensions.SProcFileExtension)) {
propertyValues.Icon = KnownMonikers.DatabaseStoredProcedures.ToProjectSystemType();
}
}
}
}
}
#endif
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#if VS15
using System.ComponentModel.Composition;
using System.IO;
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.ProjectSystem;
namespace Microsoft.VisualStudio.R.Package.ProjectSystem {
[Export(typeof(IProjectTreePropertiesProvider))]
[AppliesTo(Constants.RtvsProjectCapability)]
internal sealed class ProjectTreePropertiesProvider : IProjectTreePropertiesProvider {
public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext,
IProjectTreeCustomizablePropertyValues propertyValues) {
if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot)) {
propertyValues.Icon = ProjectIconProvider.ProjectNodeImage.ToProjectSystemType();
} else if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.FileOnDisk)) {
string ext = Path.GetExtension(propertyContext.ItemName).ToLowerInvariant();
if (ext == ".r") {
propertyValues.Icon = ProjectIconProvider.RFileNodeImage.ToProjectSystemType();
} else if (ext == ".rdata" || ext == ".rhistory") {
propertyValues.Icon = ProjectIconProvider.RDataFileNodeImage.ToProjectSystemType();
} else if (ext == ".md" || ext == ".rmd") {
propertyValues.Icon = KnownMonikers.MarkdownFile.ToProjectSystemType();
} else if (tree.FilePath.EndsWithIgnoreCase(SProcFileExtensions.QueryFileExtension)) {
propertyValues.Icon = KnownMonikers.DatabaseColumn.ToProjectSystemType();
} else if (tree.FilePath.EndsWithIgnoreCase(SProcFileExtensions.SProcFileExtension)) {
propertyValues.Icon = KnownMonikers.DatabaseStoredProcedures.ToProjectSystemType();
}
}
}
}
}
#endif
|
mit
|
C#
|
70b3a27f4b9b27443a960e06c0d6d0cc84e12311
|
Add namespace alias for Gherkin3.Ast
|
dirkrombauts/pickles,picklesdoc/pickles,picklesdoc/pickles,dirkrombauts/pickles,dirkrombauts/pickles,picklesdoc/pickles,dirkrombauts/pickles,blorgbeard/pickles,picklesdoc/pickles,blorgbeard/pickles,blorgbeard/pickles,blorgbeard/pickles,magicmonty/pickles,magicmonty/pickles,ludwigjossieaux/pickles,magicmonty/pickles,ludwigjossieaux/pickles,magicmonty/pickles,ludwigjossieaux/pickles
|
src/Pickles/Pickles.Test/ObjectModel/MapperTestsForDocString.cs
|
src/Pickles/Pickles.Test/ObjectModel/MapperTestsForDocString.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MapperTestsForDocString.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using NFluent;
using NUnit.Framework;
using PicklesDoc.Pickles.ObjectModel;
using G = Gherkin3.Ast;
namespace PicklesDoc.Pickles.Test.ObjectModel
{
[TestFixture]
public class MapperTestsForDocString
{
[Test]
public void MapToStringDocString_NullArgument_ReturnsNull()
{
var mapper = CreateMapper();
string docString = mapper.MapToString((G.DocString) null);
Check.That(docString).IsNull();
}
private static Mapper CreateMapper()
{
return FactoryMethods.CreateMapper();
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MapperTestsForDocString.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using NFluent;
using NUnit.Framework;
using PicklesDoc.Pickles.ObjectModel;
namespace PicklesDoc.Pickles.Test.ObjectModel
{
[TestFixture]
public class MapperTestsForDocString
{
[Test]
public void MapToStringDocString_NullArgument_ReturnsNull()
{
var mapper = CreateMapper();
string docString = mapper.MapToString((Gherkin3.Ast.DocString) null);
Check.That(docString).IsNull();
}
private static Mapper CreateMapper()
{
return FactoryMethods.CreateMapper();
}
}
}
|
apache-2.0
|
C#
|
ee2d23a8c749b3db958bc70f0826735e721484a8
|
Update ReserializeAssetsUtility.cs
|
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
|
Assets/MRTK/Tools/ReserializeAssetsUtility/ReserializeAssetsUtility.cs
|
Assets/MRTK/Tools/ReserializeAssetsUtility/ReserializeAssetsUtility.cs
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Utilities.Editor
{
/// <summary>
/// Adds menu items to automate reserializing specific files in Unity.
/// </summary>
/// <remarks>
/// <para>Reserialization can be needed between Unity versions or when the
/// underlying script or asset definitions are changed.</para>
/// </remarks>
public class ReserializeUtility
{
[MenuItem("Mixed Reality/Toolkit/Utilities/Reserialize/Prefabs, Scenes, and ScriptableObjects")]
private static void ReserializePrefabsAndScenes()
{
string[] array = GetAssets("t:Prefab t:Scene t:ScriptableObject");
AssetDatabase.ForceReserializeAssets(array);
Debug.Log($"Reserialized {array.Length} assets.");
}
[MenuItem("Mixed Reality/Toolkit/Utilities/Reserialize/Materials and Textures")]
private static void ReserializeMaterials()
{
string[] array = GetAssets("t:Material t:Texture");
AssetDatabase.ForceReserializeAssets(array);
Debug.Log($"Reserialized {array.Length} assets.");
}
[MenuItem("Mixed Reality/Toolkit/Utilities/Reserialize/Reserialize Selection")]
[MenuItem("Assets/Mixed Reality/Reserialize Selection")]
public static void ReserializeSelection()
{
Object[] selectedAssets = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
// Transform asset object to asset paths.
List<string> assetsPath = new List<string>();
foreach (Object asset in selectedAssets)
{
assetsPath.Add(AssetDatabase.GetAssetPath(asset));
}
string[] array = assetsPath.ToArray();
AssetDatabase.ForceReserializeAssets(array);
Debug.Log($"Reserialized {array.Length} assets.");
}
private static string[] GetAssets(string filter)
{
string[] allPrefabsGUID = AssetDatabase.FindAssets($"{filter}");
List<string> allPrefabs = new List<string>();
foreach (string guid in allPrefabsGUID)
{
allPrefabs.Add(AssetDatabase.GUIDToAssetPath(guid));
}
return allPrefabs.ToArray();
}
}
}
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Utilities.Editor
{
/// <summary>
/// Adds menu items to automate reserializing specific files in Unity.
/// </summary>
/// <remarks>
/// <para>Reserialization can be needed between Unity versions or when the
/// underlying script or asset definitions are changed.</para>
/// </remarks>
public class ReserializeUtility
{
[MenuItem("Mixed Reality/Toolkit/Utilities/Reserialize/Prefabs, Scenes, and ScriptableObjects")]
private static void ReserializePrefabsAndScenes()
{
var array = GetAssets("t:Prefab t:Scene t:ScriptableObject");
AssetDatabase.ForceReserializeAssets(array);
}
[MenuItem("Mixed Reality/Toolkit/Utilities/Reserialize/Materials and Textures")]
private static void ReserializeMaterials()
{
var array = GetAssets("t:Material t:Texture");
AssetDatabase.ForceReserializeAssets(array);
}
[MenuItem("Mixed Reality/Toolkit/Utilities/Reserialize/Reserialize Selection")]
[MenuItem("Assets/Mixed Reality/Reserialize Selection")]
public static void ReserializeSelection()
{
Object[] selectedAssets = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
// Transform asset object to asset paths.
List<string> assetsPath = new List<string>();
foreach (Object asset in selectedAssets)
{
assetsPath.Add(AssetDatabase.GetAssetPath(asset));
}
string[] array = assetsPath.ToArray();
AssetDatabase.ForceReserializeAssets(array);
Debug.Log($"Reserialized {assetsPath.Count} assets.");
}
private static string[] GetAssets(string filter)
{
string[] allPrefabsGUID = AssetDatabase.FindAssets($"{filter}");
List<string> allPrefabs = new List<string>();
foreach (string guid in allPrefabsGUID)
{
allPrefabs.Add(AssetDatabase.GUIDToAssetPath(guid));
}
return allPrefabs.ToArray();
}
}
}
|
mit
|
C#
|
d2c91722dd183d8b0484d9951feb47454c89b4d4
|
set only if not set previously
|
taka-oyama/UniHttp
|
Assets/UniHttp/HttpManager.cs
|
Assets/UniHttp/HttpManager.cs
|
using UnityEngine;
using System.IO;
using System.Collections.Generic;
using System;
namespace UniHttp
{
public sealed class HttpManager : MonoBehaviour
{
public string dataPath;
public int maxPersistentConnections;
public static IContentSerializer RequestBodySerializer;
public static ISslVerifier SslVerifier;
public static IFileHandler FileHandler;
public static CacheStorage CacheStorage;
internal static Queue<Action> MainThreadQueue;
internal static HttpStreamPool TcpConnectionPool;
internal static CookieJar CookieJar;
internal static CacheHandler CacheHandler;
public static HttpManager Initalize(string dataPath = null, int maxPersistentConnections = 6, bool dontDestroyOnLoad = true)
{
if(GameObject.Find("HttpManager")) {
throw new Exception("HttpManager should not be Initialized more than once");
}
GameObject go = new GameObject("HttpManager");
if(dontDestroyOnLoad) {
GameObject.DontDestroyOnLoad(go);
}
return go.AddComponent<HttpManager>().Setup(dataPath, maxPersistentConnections);
}
HttpManager Setup(string baseDataPath, int maxPersistentConnections)
{
this.dataPath = baseDataPath ?? Application.temporaryCachePath + "/UniHttp/";
this.maxPersistentConnections = maxPersistentConnections;
Directory.CreateDirectory(dataPath);
RequestBodySerializer = RequestBodySerializer ?? new JsonSerializer();
SslVerifier = SslVerifier ?? new DefaultSslVerifier();
FileHandler = FileHandler ?? new DefaultFileHandler();
CacheStorage = CacheStorage ?? new CacheStorage(FileHandler, new DirectoryInfo(dataPath + "Cache/"));
MainThreadQueue = new Queue<Action>();
TcpConnectionPool = new HttpStreamPool(maxPersistentConnections);
CookieJar = new CookieJar(new ObjectStorage(FileHandler, dataPath + "Cookie.bin"));
CacheHandler = new CacheHandler(new ObjectStorage(FileHandler, dataPath + "CacheInfo.bin"), CacheStorage);
return this;
}
void FixedUpdate()
{
while(MainThreadQueue.Count > 0) {
MainThreadQueue.Dequeue().Invoke();
}
}
internal static void Save()
{
CookieJar.SaveToFile();
CacheHandler.SaveToFile();
}
void OnApplicationPause(bool isPaused)
{
if(isPaused) {
Save();
}
}
void OnApplicationQuit()
{
Save();
}
}
}
|
using UnityEngine;
using System.IO;
using System.Collections.Generic;
using System;
namespace UniHttp
{
public sealed class HttpManager : MonoBehaviour
{
public string dataPath;
public int maxPersistentConnections;
public static IContentSerializer RequestBodySerializer;
public static ISslVerifier SslVerifier;
public static IFileHandler FileHandler;
public static CacheStorage CacheStorage;
internal static Queue<Action> MainThreadQueue;
internal static HttpStreamPool TcpConnectionPool;
internal static CookieJar CookieJar;
internal static CacheHandler CacheHandler;
public static HttpManager Initalize(string dataPath = null, int maxPersistentConnections = 6, bool dontDestroyOnLoad = true)
{
if(GameObject.Find("HttpManager")) {
throw new Exception("HttpManager should not be Initialized more than once");
}
GameObject go = new GameObject("HttpManager");
if(dontDestroyOnLoad) {
GameObject.DontDestroyOnLoad(go);
}
return go.AddComponent<HttpManager>().Setup(dataPath, maxPersistentConnections);
}
HttpManager Setup(string baseDataPath, int maxPersistentConnections)
{
this.dataPath = baseDataPath ?? Application.temporaryCachePath + "/UniHttp/";
this.maxPersistentConnections = maxPersistentConnections;
Directory.CreateDirectory(dataPath);
RequestBodySerializer = new JsonSerializer();
SslVerifier = new DefaultSslVerifier();
FileHandler = new DefaultFileHandler();
CacheStorage = new CacheStorage(FileHandler, new DirectoryInfo(dataPath + "Cache/"));
MainThreadQueue = new Queue<Action>();
TcpConnectionPool = new HttpStreamPool(maxPersistentConnections);
CookieJar = new CookieJar(new ObjectStorage(FileHandler, dataPath + "Cookie.bin"));
CacheHandler = new CacheHandler(new ObjectStorage(FileHandler, dataPath + "CacheInfo.bin"), CacheStorage);
return this;
}
void FixedUpdate()
{
while(MainThreadQueue.Count > 0) {
MainThreadQueue.Dequeue().Invoke();
}
}
internal static void Save()
{
CookieJar.SaveToFile();
CacheHandler.SaveToFile();
}
void OnApplicationPause(bool isPaused)
{
if(isPaused) {
Save();
}
}
void OnApplicationQuit()
{
Save();
}
}
}
|
mit
|
C#
|
c41530c50a36281333b34efd4d9691aaf2611782
|
Define returns defined symbol, not value
|
nja/keel,nja/keel
|
Keel/SpecialForms/Define.cs
|
Keel/SpecialForms/Define.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Keel.Objects;
using Keel.Builtins;
namespace Keel.SpecialForms
{
public class Define : SpecialForm
{
public Define()
: base("DEFINE")
{ }
public override LispObject Eval(Cons body, LispEnvironment env)
{
var symbol = Car.Of(body).As<Symbol>();
var value = env.Eval(Car.Of(Cdr.Of(body)));
env.AddBinding(symbol, value);
return symbol;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Keel.Objects;
using Keel.Builtins;
namespace Keel.SpecialForms
{
public class Define : SpecialForm
{
public Define()
: base("DEFINE")
{ }
public override LispObject Eval(Cons body, LispEnvironment env)
{
var symbol = Car.Of(body).As<Symbol>();
var value = env.Eval(Car.Of(Cdr.Of(body)));
env.AddBinding(symbol, value);
return value;
}
}
}
|
mit
|
C#
|
33b0f890fefc3afd392b64b3ed3d6e81194947dc
|
Revert incorrect changes for #8
|
agc93/Cake.VisualStudio,agc93/Cake.VisualStudio
|
build.cake
|
build.cake
|
#addin nuget:?package=Cake.Tfx
using Cake.Tfx.Extension.Publish;
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var solutionPath = File("./Cake.VisualStudio.sln");
var solution = ParseSolution(solutionPath);
var projects = solution.Projects;
var projectPaths = projects.Select(p => p.Path.GetDirectory());
var artifacts = "./dist/";
var accountVar = "Marketplace_Account";
var tokenVar = "Marketplace_Token";
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(ctx =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(ctx =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
// Clean solution directories.
foreach(var path in projectPaths)
{
Information("Cleaning {0}", path);
CleanDirectories(path + "/**/bin/" + configuration);
CleanDirectories(path + "/**/obj/" + configuration);
}
Information("Cleaning common files...");
CleanDirectory(artifacts);
});
Task("Restore")
.Does(() =>
{
// Restore all NuGet packages.
Information("Restoring solution...");
NuGetRestore(solutionPath);
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
Information("Building solution...");
MSBuild(solutionPath, settings =>
settings.SetPlatformTarget(PlatformTarget.MSIL)
.SetMSBuildPlatform(MSBuildPlatform.x86)
.WithProperty("TreatWarningsAsErrors","true")
.SetVerbosity(Verbosity.Quiet)
.WithTarget("Build")
.SetConfiguration(configuration));
});
Task("Post-Build")
.IsDependentOn("Build")
.Does(() =>
{
CopyFileToDirectory("./src/bin/" + configuration + "/Cake.VisualStudio.vsix", artifacts);
});
Task("Publish")
.IsDependentOn("Post-Build")
.WithCriteria(AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
AppVeyor.UploadArtifact(artifacts + "Cake.VisualStudio.vsix");
});
Task("Default")
.IsDependentOn("Publish");
RunTarget(target);
|
#addin nuget:?package=Cake.Tfx
using Cake.Tfx.Extension.Publish;
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var solutionPath = File("./Cake.VisualStudio.sln");
var solution = ParseSolution(solutionPath);
var projects = solution.Projects;
var projectPaths = projects.Select(p => p.Path.GetDirectory());
var artifacts = "./dist/";
var accountVar = "Marketplace_Account";
var tokenVar = "Marketplace_Token";
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(ctx =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(ctx =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
// Clean solution directories.
foreach(var path in projectPaths)
{
Information("Cleaning {0}", path);
CleanDirectories(path + "/**/bin/" + configuration);
CleanDirectories(path + "/**/obj/" + configuration);
}
Information("Cleaning common files...");
CleanDirectory(artifacts);
});
Task("Restore")
.Does(() =>
{
// Restore all NuGet packages.
Information("Restoring solution...");
NuGetRestore(solutionPath);
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
Information("Building solution...");
MSBuild(solutionPath, settings =>
settings.SetPlatformTarget(PlatformTarget.MSIL)
.SetMSBuildPlatform(MSBuildPlatform.x86)
.WithProperty("TreatWarningsAsErrors","true")
.SetVerbosity(Verbosity.Quiet)
.WithTarget("Build")
.SetConfiguration(configuration));
});
Task("Post-Build")
.IsDependentOn("Build")
.Does(() =>
{
CopyFileToDirectory("./src/bin/" + configuration + "/Cake.VisualStudio.vsix", artifacts);
});
Task("Publish")
.IsDependentOn("Post-Build")
.WithCriteria(() => HasEnvironmentVariable(accountVar) && HasEnvironmentVariable(tokenVar))
.Does(() => {
TfxExtensionPublish(artifacts + "Cake.VisualStudio.vsix", new List<string> { EnvironmentVariable(accountVar) }, new TfxExtensionPublishSettings()
{
AuthType = TfxAuthType.Pat,
Token = EnvironmentVariable(tokenVar)
});
});
Task("Default")
.IsDependentOn("Publish");
RunTarget(target);
|
mit
|
C#
|
2dacf2bd46faacc2eaa5c744c2e2f8f069f02661
|
Adjust namespaces
|
app-enhance/ae-di,app-enhance/ae-di
|
src/AE.Extensions.DependencyInjection/IServiceCollectionExtensions.cs
|
src/AE.Extensions.DependencyInjection/IServiceCollectionExtensions.cs
|
namespace AE.Extensions.DependencyInjection
{
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Builder;
using Microsoft.Extensions.DependencyInjection;
public static class IServiceCollectionExtensions
{
public static IServiceCollection AddFromAssemblies(this IServiceCollection serviceCollection, Assembly[] assebmlies)
{
var builder = new ServiceDescriptorsBuilder().AddSourceAssemblies(assebmlies);
BuildAndFill(serviceCollection, builder);
return serviceCollection;
}
public static IServiceCollection AddFromAssembly(this IServiceCollection serviceCollection, Assembly assembly)
{
var builder = new ServiceDescriptorsBuilder().AddSourceAssembly(assembly);
BuildAndFill(serviceCollection, builder);
return serviceCollection;
}
private static void BuildAndFill(IServiceCollection serviceCollection, ServiceDescriptorsBuilder builder)
{
builder.AddTypesProvider(new ExistingServiceCollectionTypesProvider(serviceCollection));
var serviceDescriptors = builder.Build();
MergeServiceDescriptions(serviceCollection, serviceDescriptors);
}
private static void MergeServiceDescriptions(IServiceCollection serviceCollection, IEnumerable<ServiceDescriptor> serviceDescriptors)
{
var excludedServiceDescriptors = serviceCollection.Where<ServiceDescriptor>(service => serviceDescriptors.Contains(service) == false);
foreach (var descriptor in excludedServiceDescriptors)
{
serviceCollection.Remove(descriptor);
}
foreach (var descriptor in serviceDescriptors)
{
serviceCollection.Add(descriptor);
}
}
private static bool Contains(this IEnumerable<ServiceDescriptor> serviceDescriptors, ServiceDescriptor serviceDescriptor)
{
return serviceDescriptors.Any(x => x.ImplementationType == serviceDescriptor.ImplementationType);
}
}
}
|
namespace AE.Extensions.DependencyInjection.Builder
{
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
public static class IServiceCollectionExtensions
{
public static IServiceCollection AddFromAssemblies(this IServiceCollection serviceCollection, Assembly[] assebmlies)
{
var builder = new ServiceDescriptorsBuilder().AddSourceAssemblies(assebmlies);
BuildAndFill(serviceCollection, builder);
return serviceCollection;
}
public static IServiceCollection AddFromAssembly(this IServiceCollection serviceCollection, Assembly assembly)
{
var builder = new ServiceDescriptorsBuilder().AddSourceAssembly(assembly);
BuildAndFill(serviceCollection, builder);
return serviceCollection;
}
private static void BuildAndFill(IServiceCollection serviceCollection, ServiceDescriptorsBuilder builder)
{
builder.AddTypesProvider(new ExistingServiceCollectionTypesProvider(serviceCollection));
var serviceDescriptors = builder.Build();
MergeServiceDescriptions(serviceCollection, serviceDescriptors);
}
private static void MergeServiceDescriptions(IServiceCollection serviceCollection, IEnumerable<ServiceDescriptor> serviceDescriptors)
{
var excludedServiceDescriptors = serviceCollection.Where(service => serviceDescriptors.Contains(service) == false);
foreach (var descriptor in excludedServiceDescriptors)
{
serviceCollection.Remove(descriptor);
}
foreach (var descriptor in serviceDescriptors)
{
serviceCollection.Add(descriptor);
}
}
private static bool Contains(this IEnumerable<ServiceDescriptor> serviceDescriptors, ServiceDescriptor serviceDescriptor)
{
return serviceDescriptors.Any(x => x.ImplementationType == serviceDescriptor.ImplementationType);
}
}
}
|
mit
|
C#
|
4caeaf862b73750f5bd6391c658e5584e992ee3e
|
fix System.InvalidOperationException: Headers are read-only, response… (#2)
|
AlegriGroup/AspNetCore-RTM-1.0-Demos,AlegriGroup/AspNetCore-RTM-1.0-Demos,AlegriGroup/AspNetCore-RTM-1.0-Demos
|
src/AspNetCore-Middlewares-CoreFx/Samples/ProcessingTimeMiddleware.cs
|
src/AspNetCore-Middlewares-CoreFx/Samples/ProcessingTimeMiddleware.cs
|
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
namespace AspNetCore_Middlewares_CoreFx.Samples
{
public static class ProcessingTimeMiddlewareExtensions
{
public static IApplicationBuilder UseProcessingTime(this IApplicationBuilder app)
{
return app.UseMiddleware(typeof(ProcessingTimeMiddleware));
}
}
public class ProcessingTimeMiddleware
{
private readonly RequestDelegate _next;
public ProcessingTimeMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
DateTime start = DateTime.UtcNow;
context.Response.OnStarting(x =>
{
context.Response.Headers.Add("X-Processing-Time", new[] { DateTime.UtcNow.Subtract(start).TotalMilliseconds.ToString("0.00") });
return Task.CompletedTask;
}, null);
await _next(context);
}
}
}
|
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
namespace AspNetCore_Middlewares_CoreFx.Samples
{
public static class ProcessingTimeMiddlewareExtensions
{
public static IApplicationBuilder UseProcessingTime(this IApplicationBuilder app)
{
return app.UseMiddleware(typeof(ProcessingTimeMiddleware));
}
}
public class ProcessingTimeMiddleware
{
private readonly RequestDelegate _next;
public ProcessingTimeMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
DateTime start = DateTime.UtcNow;
// Execute
await _next(context);
DateTime end = DateTime.UtcNow;
TimeSpan duration = end - start;
context.Response.Headers.Add("X-Processing-Time", duration.TotalMilliseconds.ToString("0.00"));
}
}
}
|
mit
|
C#
|
009821b3852d567b994f8e41b17adfbcc84014a0
|
update orleans to v1.0.5
|
weitaolee/Orleans.Storage.Couchbase
|
Orleans.Storage.Couchbase/Properties/AssemblyInfo.cs
|
Orleans.Storage.Couchbase/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Orleans.Storage.Couchbase")]
[assembly: AssemblyDescription("Orleans.Storage.Couchbase")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Witte Lee")]
[assembly: AssemblyProduct("Orleans.Storage.Couchbase")]
[assembly: AssemblyCopyright("Copyright © Witte Lee 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("f8940361-4b75-4198-bf30-ee8b39533e6e")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.2.0")]
[assembly: AssemblyFileVersion("1.2.2.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Orleans.Storage.Couchbase")]
[assembly: AssemblyDescription("Orleans.Storage.Couchbase")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Witte Lee")]
[assembly: AssemblyProduct("Orleans.Storage.Couchbase")]
[assembly: AssemblyCopyright("Copyright © Witte Lee 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("f8940361-4b75-4198-bf30-ee8b39533e6e")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
|
mit
|
C#
|
8bb3126de455a64e0214d613ddecd98ca9f28825
|
Fix and add comments
|
EasyPeasyLemonSqueezy/MadCat
|
MadCat/NutEngine/Physics/BodiesManager.cs
|
MadCat/NutEngine/Physics/BodiesManager.cs
|
using System.Collections.Generic;
namespace NutEngine.Physics
{
public class BodiesManager
{
public HashSet<Body> Bodies { get; private set; }
public HashSet<Collision> Collisions { get; private set; }
public BodiesManager()
{
Bodies = new HashSet<Body>();
Collisions = new HashSet<Collision>();
}
public void CalculateCollisions()
{
foreach (var body in Bodies) { // Here will be only rigid bodies
foreach (var body2 in Bodies) {
if (body != body2) {
if (Collider.Collide(body.Shape, body2.Shape, out var manifold)) {
Collisions.Add(new Collision(body, body2, manifold));
}
}
}
}
}
public void ResolveCollisions()
{
foreach (var collision in Collisions) {
Collider.ResolveCollision(collision);
// After resolve collision we have to zeroes velocity (After position correction),
// or we can add some "bounce" effect, it'll be awesome.
// Probably we should do it in .ResolveCollision.
}
}
public void ApplyImpulses()
{
foreach (var body in Bodies) {
body.ApplyImpulse();
}
}
/// <summary>
/// May the Force be with you.
/// </summary>
public void ApplyForces(float delta)
{
foreach (var body in Bodies) {
body.ApplyForce(delta);
}
}
}
}
|
using System.Collections.Generic;
namespace NutEngine.Physics
{
public class BodiesManager
{
public HashSet<Body> Bodies { get; private set; }
public HashSet<Collision> Collisions { get; private set; }
public BodiesManager()
{
Bodies = new HashSet<Body>();
Collisions = new HashSet<Collision>();
}
public void CalculateCollisions()
{
foreach (var body in Bodies) {
foreach (var body2 in Bodies) { // Here will be only static bodies
if (body != body2) {
if (Collider.Collide(body.Shape, body2.Shape, out var manifold)) {
Collisions.Add(new Collision(body, body2, manifold));
}
}
}
}
}
public void ResolveCollisions()
{
foreach (var collision in Collisions) {
Collider.ResolveCollision(collision);
}
}
public void ApplyImpulses()
{
foreach (var body in Bodies) {
body.ApplyImpulse();
}
}
/// <summary>
/// May the Force be with you.
/// </summary>
public void ApplyForces(float delta)
{
foreach (var body in Bodies) {
body.ApplyForce(delta);
}
}
}
}
|
mit
|
C#
|
207568c71a053fa1d30aaeb4371b2ede4ac769f3
|
Update DeletingARow.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET
|
Examples/CSharp/RowsColumns/InsertingAndDeleting/DeletingARow.cs
|
Examples/CSharp/RowsColumns/InsertingAndDeleting/DeletingARow.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.RowsColumns.InsertingAndDeleting
{
public class DeletingARow
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream(dataDir + "book1.xls", FileMode.Open);
//Instantiating a Workbook object
//Opening the Excel file through the file stream
Workbook workbook = new Workbook(fstream);
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];
//Deleting 3rd row from the worksheet
worksheet.Cells.DeleteRow(2);
//Saving the modified Excel file
workbook.Save(dataDir + "output.out.xls");
//Closing the file stream to free all resources
fstream.Close();
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.RowsColumns.InsertingAndDeleting
{
public class DeletingARow
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream(dataDir + "book1.xls", FileMode.Open);
//Instantiating a Workbook object
//Opening the Excel file through the file stream
Workbook workbook = new Workbook(fstream);
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];
//Deleting 3rd row from the worksheet
worksheet.Cells.DeleteRow(2);
//Saving the modified Excel file
workbook.Save(dataDir + "output.out.xls");
//Closing the file stream to free all resources
fstream.Close();
}
}
}
|
mit
|
C#
|
6ca8b2db395da4839becfe90dc99740e031153b8
|
fix critical sequence bug
|
zhennTil/LiteNetLib,RevenantX/LiteNetLib
|
LiteNetLib/NetConstants.cs
|
LiteNetLib/NetConstants.cs
|
namespace LiteNetLib
{
public enum SendOptions
{
Unreliable,
ReliableUnordered,
Sequenced,
ReliableOrdered
}
public static class NetConstants
{
public const int HeaderSize = 1;
public const int SequencedHeaderSize = 3;
public const int FragmentHeaderSize = 6;
public const int DefaultWindowSize = 64;
public const ushort MaxSequence = 32768;
public const ushort HalfMaxSequence = MaxSequence / 2;
//protocol
public const int MaxUdpHeaderSize = 68;
public const int PacketSizeLimit = ushort.MaxValue - MaxUdpHeaderSize;
public const int MinPacketSize = 576 - MaxUdpHeaderSize;
public const int MinPacketDataSize = MinPacketSize - HeaderSize;
public const int MinSequencedPacketDataSize = MinPacketSize - SequencedHeaderSize;
public static readonly int[] PossibleMtu =
{
576 - MaxUdpHeaderSize, //Internet Path MTU for X.25 (RFC 879)
1492 - MaxUdpHeaderSize, //Ethernet with LLC and SNAP, PPPoE (RFC 1042)
1500 - MaxUdpHeaderSize //Ethernet II (RFC 1191)
};
//peer specific
public const int FlowUpdateTime = 1000;
public const int FlowIncreaseThreshold = 4;
public const int PacketsPerSecondMax = 65535;
public const int DefaultPingInterval = 1000;
}
}
|
namespace LiteNetLib
{
public enum SendOptions
{
Unreliable,
ReliableUnordered,
Sequenced,
ReliableOrdered
}
public static class NetConstants
{
public const int HeaderSize = 1;
public const int SequencedHeaderSize = 3;
public const int FragmentHeaderSize = 6;
public const int DefaultWindowSize = 64;
public const ushort MaxSequence = 65535;
public const ushort HalfMaxSequence = MaxSequence / 2;
//protocol
public const int MaxUdpHeaderSize = 68;
public const int PacketSizeLimit = ushort.MaxValue - MaxUdpHeaderSize;
public const int MinPacketSize = 576 - MaxUdpHeaderSize;
public const int MinPacketDataSize = MinPacketSize - HeaderSize;
public const int MinSequencedPacketDataSize = MinPacketSize - SequencedHeaderSize;
public static readonly int[] PossibleMtu =
{
576 - MaxUdpHeaderSize, //Internet Path MTU for X.25 (RFC 879)
1492 - MaxUdpHeaderSize, //Ethernet with LLC and SNAP, PPPoE (RFC 1042)
1500 - MaxUdpHeaderSize //Ethernet II (RFC 1191)
};
//peer specific
public const int FlowUpdateTime = 1000;
public const int FlowIncreaseThreshold = 4;
public const int PacketsPerSecondMax = 65535;
public const int DefaultPingInterval = 1000;
}
}
|
mit
|
C#
|
051f200ffe41c49ded19745c6213e45086c0f41f
|
Fix up 32 bit constants.
|
TomPeters/WindowMessageLogger,TomPeters/WindowMessageLogger
|
ShellHookLauncher32/ShellHookConstants.cs
|
ShellHookLauncher32/ShellHookConstants.cs
|
namespace ShellHookLauncher
{
internal static partial class ShellHookHelper
{
public const string DllFileName = "ShellHook32.dll";
public const string PanelessNamedPipe = "PanelessHookId32-5b4f1ea2-c775-11e2-8888-47c85008ead5";
}
}
|
namespace ShellHookLauncher
{
internal static partial class ShellHookHelper
{
public const string DllFileName = "ShellHook64.dll";
public const string PanelessNamedPipe = "PanelessHookId64-5b4f1ea2-c775-11e2-8888-47c85008ead5";
}
}
|
mit
|
C#
|
9fff4ae69c2473140930b9a6edcd315566cb40c8
|
Fix for missing multiple image uploads checkbox on image upload field type.
|
PerplexInternetmarketing/Perplex-Umbraco-Forms,PerplexInternetmarketing/Perplex-Umbraco-Forms,PerplexInternetmarketing/Perplex-Umbraco-Forms
|
Perplex.Umbraco.Forms/FieldTypes/PerplexImageUpload.cs
|
Perplex.Umbraco.Forms/FieldTypes/PerplexImageUpload.cs
|
using PerplexUmbraco.Forms.Code.Configuration;
using System;
using System.Collections.Generic;
using Umbraco.Forms.Core;
using Umbraco.Forms.Core.Attributes;
namespace PerplexUmbraco.Forms.FieldTypes
{
public class PerplexImageUpload : PerplexBaseFileFieldType
{
protected override PerplexBaseFileConfig Config => PerplexUmbracoFormsConfig.Get.PerplexImageUpload;
public PerplexImageUpload()
{
Id = new Guid("11fff56b-7e0e-4bfc-97ba-b5126158d33d");
Name = "Perplex image upload";
FieldTypeViewName = $"FieldType.{ nameof(PerplexImageUpload) }.cshtml";
Description = "Renders an upload field";
Icon = "icon-download-alt";
DataType = FieldDataType.String;
SortOrder = 10;
Category = "Simple";
}
public override Dictionary<string, Setting> Settings()
{
Dictionary<string, Setting> settings = base.Settings() ?? new Dictionary<string, Setting>();
settings.Add("MultiUpload", new Setting("Multi upload")
{
description = "If checked, allows the user to upload multiple files",
view = "checkbox"
});
return settings;
}
}
}
|
using PerplexUmbraco.Forms.Code.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using static PerplexUmbraco.Forms.Code.Constants;
using Umbraco.Forms.Core;
namespace PerplexUmbraco.Forms.FieldTypes
{
public class PerplexImageUpload : PerplexBaseFileFieldType
{
protected override PerplexBaseFileConfig Config => PerplexUmbracoFormsConfig.Get.PerplexImageUpload;
public PerplexImageUpload()
{
Id = new Guid("11fff56b-7e0e-4bfc-97ba-b5126158d33d");
Name = "Perplex image upload";
FieldTypeViewName = $"FieldType.{ nameof(PerplexImageUpload) }.cshtml";
Description = "Renders an upload field";
Icon = "icon-download-alt";
DataType = FieldDataType.String;
SortOrder = 10;
Category = "Simple";
}
}
}
|
mit
|
C#
|
a8bd9120c27a17546bc7603030fbd580436dbbc6
|
Remove special case for odd numbers
|
martincostello/project-euler
|
src/ProjectEuler/Puzzles/Puzzle010.cs
|
src/ProjectEuler/Puzzles/Puzzle010.cs
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
using System.Linq;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=10</c>. This class cannot be inherited.
/// </summary>
internal sealed class Puzzle010 : Puzzle
{
/// <inheritdoc />
public override string Question => "Find the sum of all the primes below the specified value.";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
int max;
if (!TryParseInt32(args[0], out max) || max < 2)
{
Console.Error.WriteLine("The specified number is invalid.");
return -1;
}
long sum = ParallelEnumerable.Range(3, max - 3)
.Where((p) => Maths.IsPrime(p))
.Select((p) => (long)p)
.Sum();
Answer = sum + 2;
return 0;
}
}
}
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
using System.Linq;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=10</c>. This class cannot be inherited.
/// </summary>
internal sealed class Puzzle010 : Puzzle
{
/// <inheritdoc />
public override string Question => "Find the sum of all the primes below the specified value.";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
int max;
if (!TryParseInt32(args[0], out max) || max < 2)
{
Console.Error.WriteLine("The specified number is invalid.");
return -1;
}
long sum = ParallelEnumerable.Range(3, max - 3)
.Where((p) => p % 2 != 0)
.Where((p) => Maths.IsPrime(p))
.Select((p) => (long)p)
.Sum();
Answer = sum + 2;
return 0;
}
}
}
|
apache-2.0
|
C#
|
6b1c5f237c5b6d7794f06685e0010ddcae27c00b
|
Revert "Revert "Add OptimizationCount to UserData.""
|
nfleet/.net-sdk
|
NFleetSDK/Data/UserData.cs
|
NFleetSDK/Data/UserData.cs
|
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace NFleet.Data
{
[DataContract]
public class UserData : IResponseData
{
[IgnoreDataMember]
public int VersionNumber { get; set; }
[DataMember]
public int Id { get; set; }
[DataMember]
public int ProblemLimit { get; set; }
[DataMember]
public int VehicleLimit { get; set; }
[DataMember]
public int TaskLimit { get; set; }
[DataMember]
public int OptimizationQueueLimit { get; set; }
[DataMember]
public int OptimizationCount { get; set; }
#region Implementation of IResponseData
[DataMember]
public List<Link> Meta { get; set; }
#endregion
}
}
|
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace NFleet.Data
{
[DataContract]
public class UserData : IResponseData
{
[IgnoreDataMember]
public int VersionNumber { get; set; }
[DataMember]
public int Id { get; set; }
[DataMember]
public int ProblemLimit { get; set; }
[DataMember]
public int VehicleLimit { get; set; }
[DataMember]
public int TaskLimit { get; set; }
[DataMember]
public int OptimizationQueueLimit { get; set; }
#region Implementation of IResponseData
[DataMember]
public List<Link> Meta { get; set; }
#endregion
}
}
|
mit
|
C#
|
8527d5ed1b6cd1911082abd69336c82f7053d749
|
fix warning
|
WojcikMike/docs.particular.net,pashute/docs.particular.net,yuxuac/docs.particular.net,SzymonPobiega/docs.particular.net,eclaus/docs.particular.net,pedroreys/docs.particular.net
|
Snippets/Snippets_5/Outbox/NHibernate/AccessSession.cs
|
Snippets/Snippets_5/Outbox/NHibernate/AccessSession.cs
|
using NServiceBus;
using NServiceBus.Persistence.NHibernate;
#region OutboxNHibernateAccessSession
class OrderPlacedHandler : IHandleMessages<OrderPlaced>
{
NHibernateStorageContext nHibernateStorageContext;
public OrderPlacedHandler(NHibernateStorageContext nHibernateStorageContext)
{
this.nHibernateStorageContext = nHibernateStorageContext;
}
public void Handle(OrderPlaced message)
{
var order = nHibernateStorageContext.Session.Get<OrderEntity>(message.OrderId);
order.Shipped = true;
nHibernateStorageContext.Session.Update(order);
}
}
#endregion
class OrderEntity
{
public bool Shipped { get; set; }
}
class OrderPlaced
{
public object OrderId { get; set; }
}
|
using NServiceBus;
using NServiceBus.Persistence.NHibernate;
#region OutboxNHibernateAccessSession
class OrderPlacedHandler : IHandleMessages<OrderPlaced>
{
NHibernateStorageContext nHibernateStorageContext;
public OrderPlacedHandler(NHibernateStorageContext nHibernateStorageContext)
{
this.nHibernateStorageContext = nHibernateStorageContext;
}
public void Handle(OrderPlaced message)
{
var order = nHibernateStorageContext.Session.Get<OrderEntity>(message.OrderId);
order.Shipped = true;
nHibernateStorageContext.Session.Update(order);
}
}
#endregion
class OrderEntity
{
public bool Shipped;
}
class OrderPlaced
{
public object OrderId { get; set; }
}
|
apache-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.