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 |
|---|---|---|---|---|---|---|---|---|
2bb4fccc147f25f88492b99d3c7d3437500485c7 | add necessary game data to the Main window | svmnotn/cuddly-octo-adventure | Game/UI/MainWindow.cs | Game/UI/MainWindow.cs | namespace COA.Game.UI {
using System;
using System.Windows.Forms;
using Controls;
using Data;
internal partial class MainWindow : Form {
UserControl current;
internal UserControl Current {
get { return current; }
set {
if(!Controls.Contains(value)) {
Controls.Add(value);
}
if(current != null) {
current.Visible = false;
}
current = value;
if(!string.IsNullOrWhiteSpace(archive.settings.backgroundLoc)) {
current.BackgroundImage = archive.settings.background ?? Extensions.LoadImage(Program.ArchivePath(archive), archive.settings.backgroundLoc);
}
current.BackColor = archive.settings.backgroundColor;
current.Visible = true;
}
}
internal readonly Archive archive;
internal readonly Team[] teams;
internal int currTeam;
internal GameMode gm;
internal MainWindow() : this(Archive.Default) { }
internal MainWindow(Archive a) {
InitializeComponent();
archive = a;
teams = archive.settings.teams.ToArray();
Text = a.name;
var mode = new ModeSelect();
mode.Dock = DockStyle.Fill;
Current = mode;
}
private void OnTick(object sender, EventArgs e) {
((Timer)sender).Enabled = false;
}
private void OnClose(object sender, FormClosedEventArgs e) {
Application.Exit();
}
}
} | namespace COA.Game.UI {
using System;
using System.Windows.Forms;
using Data;
internal partial class MainWindow : Form {
Archive archive;
UserControl current;
internal UserControl Current {
get { return current; }
set {
if(current != null) {
current.Visible = false;
}
current = value;
if(!string.IsNullOrWhiteSpace(archive.settings.backgroundLoc)) {
current.BackgroundImage = archive.settings.background ?? Extensions.LoadImage(Program.ArchivePath(archive), archive.settings.backgroundLoc);
}
current.BackColor = archive.settings.backgroundColor;
current.Visible = true;
}
}
internal MainWindow() : this(Archive.Default) { }
internal MainWindow(Archive a) {
InitializeComponent();
archive = a;
Text = a.name;
}
private void OnTick(object sender, EventArgs e) {
((Timer)sender).Enabled = false;
}
private void OnClose(object sender, FormClosedEventArgs e) {
Application.Exit();
}
}
} | mit | C# |
db5099de3ad38a6a986f4870ed30e4e97df51bfa | Add missing licence header | peppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu-new,smoogipooo/osu | osu.Game.Tests/Database/GeneralUsageTests.cs | osu.Game.Tests/Database/GeneralUsageTests.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
#nullable enable
namespace osu.Game.Tests.Database
{
[TestFixture]
public class GeneralUsageTests : RealmTest
{
/// <summary>
/// Just test the construction of a new database works.
/// </summary>
[Test]
public void TestConstructRealm()
{
RunTestWithRealm((realmFactory, _) => { realmFactory.CreateContext().Refresh(); });
}
[Test]
public void TestBlockOperations()
{
RunTestWithRealm((realmFactory, _) =>
{
using (realmFactory.BlockAllOperations())
{
}
});
}
[Test]
public void TestBlockOperationsWithContention()
{
RunTestWithRealm((realmFactory, _) =>
{
ManualResetEventSlim stopThreadedUsage = new ManualResetEventSlim();
ManualResetEventSlim hasThreadedUsage = new ManualResetEventSlim();
Task.Factory.StartNew(() =>
{
using (realmFactory.CreateContext())
{
hasThreadedUsage.Set();
stopThreadedUsage.Wait();
}
}, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler);
hasThreadedUsage.Wait();
Assert.Throws<TimeoutException>(() =>
{
using (realmFactory.BlockAllOperations())
{
}
});
stopThreadedUsage.Set();
});
}
}
}
| using System;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
#nullable enable
namespace osu.Game.Tests.Database
{
[TestFixture]
public class GeneralUsageTests : RealmTest
{
/// <summary>
/// Just test the construction of a new database works.
/// </summary>
[Test]
public void TestConstructRealm()
{
RunTestWithRealm((realmFactory, _) => { realmFactory.CreateContext().Refresh(); });
}
[Test]
public void TestBlockOperations()
{
RunTestWithRealm((realmFactory, _) =>
{
using (realmFactory.BlockAllOperations())
{
}
});
}
[Test]
public void TestBlockOperationsWithContention()
{
RunTestWithRealm((realmFactory, _) =>
{
ManualResetEventSlim stopThreadedUsage = new ManualResetEventSlim();
ManualResetEventSlim hasThreadedUsage = new ManualResetEventSlim();
Task.Factory.StartNew(() =>
{
using (realmFactory.CreateContext())
{
hasThreadedUsage.Set();
stopThreadedUsage.Wait();
}
}, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler);
hasThreadedUsage.Wait();
Assert.Throws<TimeoutException>(() =>
{
using (realmFactory.BlockAllOperations())
{
}
});
stopThreadedUsage.Set();
});
}
}
}
| mit | C# |
54d8dd34a375fb9df5b4eea32e73741a9bae9885 | Add the accumulator addressing mode. | joshpeterson/mos,joshpeterson/mos,joshpeterson/mos | Mos6510/Instructions/AddressingMode.cs | Mos6510/Instructions/AddressingMode.cs | namespace Mos6510.Instructions
{
public enum AddressingMode
{
Absolute,
AbsoluteX,
AbsoluteY,
Accumulator,
Immediate,
Implied,
IndirectX,
IndirectY,
Zeropage,
ZeropageX,
ZeropageY,
}
}
| namespace Mos6510.Instructions
{
public enum AddressingMode
{
Implied,
Immediate,
Absolute,
AbsoluteX,
AbsoluteY,
Zeropage,
ZeropageX,
ZeropageY,
IndirectX,
IndirectY
}
}
| mit | C# |
9be3f71384e6d6ab8d2e07ca4f79746d70039c79 | Update Exercise8B.cs | lizaamini/CSharpExercises | Sheet-8/Exercise8B.cs | Sheet-8/Exercise8B.cs | using System;
namespace Exercise8B
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Please enter a 7-bit binary number: ");
String binary = Console.ReadLine ();
while (binary.Length != 7) {
Console.WriteLine ("Please enter a 7-bit binary number: ");
binary = Console.ReadLine();
}
Console.WriteLine (addParityBit(binary));
}
public static String addParityBit(string binaryNumber) {
int count = 0;
for (int i = 0; i < binaryNumber.Length; i++) {
if (binaryNumber.Substring (i, 1) == "1") {
count++;
}
}
if (count % 2 == 0) {
// Console.WriteLine (count);
return binaryNumber + "0";
}
else {
// Console.WriteLine (count);
return binaryNumber + "1";
}
}
}
}
| mit | C# | |
068fe1e2538b6b7c30da527874826d7c84045427 | Add PrintToChat method for 7 Days to Die thanks to @bawNg | Visagalis/Oxide,LaserHydra/Oxide,bawNg/Oxide,Visagalis/Oxide,bawNg/Oxide,MSylvia/Oxide,Nogrod/Oxide-2,ApocDev/Oxide,Nogrod/Oxide-2,ApocDev/Oxide,MSylvia/Oxide,LaserHydra/Oxide | Oxide.Ext.SevenDays/SevenDaysPlugin.cs | Oxide.Ext.SevenDays/SevenDaysPlugin.cs | namespace Oxide.Plugins
{
public abstract class SevenDaysPlugin : CSharpPlugin
{
GameManager _gameManager;
protected GameManager gameManager
{
get
{
if (_gameManager == null)
_gameManager = UnityEngine.Object.FindObjectOfType<GameManager>();
return _gameManager;
}
}
protected void PrintToChat(string message)
{
PrintToChat("", message);
}
protected void PrintToChat(string name, string message)
{
gameManager.SendChatMessage(message, -1, name);
}
}
}
| namespace Oxide.Plugins
{
public abstract class SevenDaysPlugin : CSharpPlugin
{
}
}
| mit | C# |
3bff2141ce6d29020c5e2ad8f297dedab6ca087c | Update AssemblyInfo.cs | DevExpress/BigQueryProvider | BigQueryProvider/Properties/AssemblyInfo.cs | BigQueryProvider/Properties/AssemblyInfo.cs | /*
Copyright 2015 Developer Express Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("DevExpress.DataAccess.BigQuery")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DevExpress.DataAccess.BigQuery")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
| /*
Copyright 2015 Developer Express Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("DevExpress.DataAccess.BigQuery")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DevExpress.DataAccess.BigQuery")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| apache-2.0 | C# |
d5490c37a709bd468db6645b525f740a6076f664 | Fix failing when passing null | angellaa/RetailStoreSpike | RetailStore/RetailStore/RetailStore.cs | RetailStore/RetailStore/RetailStore.cs | using System.Collections.Generic;
namespace RetailStore
{
public class RetailStore
{
private readonly Screen m_Screen;
private readonly Dictionary<string, string> m_Products;
public RetailStore(Screen screen, Dictionary<string, string> products)
{
m_Screen = screen;
m_Products = products ?? new Dictionary<string, string>();
}
public void OnBarcode(string barcode)
{
if (barcode == null || !m_Products.ContainsKey(barcode))
{
m_Screen.ShowText("Product Not Found");
return;
}
var product = m_Products[barcode];
m_Screen.ShowText(product);
}
}
} | using System.Collections.Generic;
namespace RetailStore
{
public class RetailStore
{
private readonly Screen m_Screen;
private readonly Dictionary<string, string> m_Products;
public RetailStore(Screen screen, Dictionary<string, string> products)
{
m_Screen = screen;
m_Products = products;
}
public void OnBarcode(string barcode)
{
if (barcode == null || !m_Products.ContainsKey(barcode))
{
m_Screen.ShowText("Product Not Found");
return;
}
var product = m_Products[barcode];
m_Screen.ShowText(product);
}
}
} | mit | C# |
b3bd17ca45e82afb696f34d931070f791f6ddc0d | Call the ResolveDependency method on the scope (#30) | mgrosperrin/commandlineparser | src/MGR.CommandLineParser/DependencyResolverCommandActivator.cs | src/MGR.CommandLineParser/DependencyResolverCommandActivator.cs | using System;
using System.Reflection;
using MGR.CommandLineParser.Command;
namespace MGR.CommandLineParser
{
/// <summary>
/// Implementation of <see cref="ICommandActivator"/> based on <see cref="DependencyResolver"/>.
/// </summary>
public sealed class DependencyResolverCommandActivator : ICommandActivator
{
private readonly IDependencyResolverScope _dependencyResolverScope;
private static readonly MethodInfo GenericResolveServiceMethodInfo = typeof(IDependencyResolverScope).GetMethod(nameof(IDependencyResolverScope.ResolveDependency));
/// <summary>
/// Creates a new instance of <see cref="DependencyResolverCommandActivator"/>.
/// </summary>
public DependencyResolverCommandActivator(IDependencyResolverScope dependencyResolverScope)
{
_dependencyResolverScope = dependencyResolverScope;
}
/// <inheritdoc />
public ICommand ActivateCommand(Type commandType)
{
var resolveServiceMethod = GenericResolveServiceMethodInfo.MakeGenericMethod(commandType);
var command = resolveServiceMethod.Invoke(_dependencyResolverScope, null);
return command as ICommand;
}
}
} | using System;
using System.Reflection;
using MGR.CommandLineParser.Command;
namespace MGR.CommandLineParser
{
/// <summary>
/// Implementation of <see cref="ICommandActivator"/> based on <see cref="DependencyResolver"/>.
/// </summary>
public sealed class DependencyResolverCommandActivator : ICommandActivator
{
private readonly MethodInfo _genericResolveServiceMethodInfo;
/// <summary>
/// Creates a new instance of <see cref="DependencyResolverCommandActivator"/>.
/// </summary>
public DependencyResolverCommandActivator()
{
var serviceResolverType = typeof (IDependencyResolverScope);
_genericResolveServiceMethodInfo = serviceResolverType.GetMethod(nameof(IDependencyResolverScope.ResolveDependency));
}
/// <inheritdoc />
public ICommand ActivateCommand(Type commandType)
{
var resolveServiceMethod = _genericResolveServiceMethodInfo.MakeGenericMethod(commandType);
var command = resolveServiceMethod.Invoke(DependencyResolver.Current, null);
return command as ICommand;
}
}
} | mit | C# |
92c3097d497c6b80ca795a81539cb608fba06674 | remove unnecessary restriction | ResourceDataInc/Simpler.Data,ResourceDataInc/Simpler.Data,gregoryjscott/Simpler,ResourceDataInc/Simpler.Data,gregoryjscott/Simpler | Simpler/TitoTask.cs | Simpler/TitoTask.cs | using System;
using Simpler.Injection;
namespace Simpler
{
[InjectSubTasks]
public abstract class TitoTask<TI, TO> : Task
{
public override dynamic Inputs
{
get { return InputsModel; }
set
{
InputsModel = (TI)Activator.CreateInstance(typeof(TI));
Mapper.Map<TI>(value, InputsModel);
}
}
public override dynamic Outputs
{
get { return OutputsModel; }
set
{
OutputsModel = (TO)Activator.CreateInstance(typeof(TO));
Mapper.Map<TO>(value, OutputsModel);
}
}
public virtual TI InputsModel { get; set; }
public virtual TO OutputsModel { get; set; }
}
}
| using System;
using Simpler.Injection;
namespace Simpler
{
[InjectSubTasks]
public abstract class TitoTask<TI, TO> : Task where TI : class where TO : class
{
public override dynamic Inputs
{
get { return InputsModel; }
set
{
InputsModel = (TI)Activator.CreateInstance(typeof(TI));
Mapper.Map<TI>(value, InputsModel);
}
}
public override dynamic Outputs
{
get { return OutputsModel; }
set
{
OutputsModel = (TO)Activator.CreateInstance(typeof(TO));
Mapper.Map<TO>(value, OutputsModel);
}
}
public virtual TI InputsModel { get; set; }
public virtual TO OutputsModel { get; set; }
}
}
| mit | C# |
7af35e075dd0c741235d28e05bb597de66a935dc | Add doc and degree | aloisdg/edx-csharp | edX/Module1/Program.cs | edX/Module1/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace Module1
{
class Program
{
/// <summary>
/// Facebook allow 71 gender options
/// </summary>
enum Gender
{
Male,
Female,
Other
}
enum SchoolStatus
{
Student,
Professor,
Other
}
enum DegreeType
{
Bachelor,
Master,
PhD,
Other
}
/// <summary>
/// AddressLine3 is required for some countries like France
/// </summary>
class Address
{
public string AddressLine1 { get; set; }
public string AddressLine2 { get; set; }
public string AddressLine3 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
public string Country { get; set; }
}
abstract class APerson
{
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime Birthdate { get; set; }
public Address Address { get; set; }
public Gender Gender { get; set; }
public abstract SchoolStatus SchoolStatus { get; }
}
class Student : APerson
{
public override SchoolStatus SchoolStatus { get { return SchoolStatus.Student; }}
}
class Professor : APerson
{
public override SchoolStatus SchoolStatus { get { return SchoolStatus.Professor; }}
}
// TODO : Idea for a degreeType notation ? I dont want to keep hungarian
interface IDegree
{
string Name { get; set; }
//string DegreeType Dt { get; set; }
}
class University
{
IEnumerable<Student> Students { get; set; }
IEnumerable<Professor> Professors { get; set; }
private IEnumerable<IDegree> Degrees { get; set; }
}
static void Main(string[] args)
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Module1
{
class Program
{
enum Gender
{
Male,
Female,
Other
}
enum SchoolStatus
{
Student,
Professor,
Other
}
class Address
{
public string AddressLine1 { get; set; }
public string AddressLine2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
public string Country { get; set; }
}
abstract class APerson
{
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime Birthdate { get; set; }
public Address Address { get; set; }
public Gender Gender { get; set; }
public abstract SchoolStatus SchoolStatus { get; }
}
class Student : APerson
{
public override SchoolStatus SchoolStatus { get { return SchoolStatus.Student; }}
}
class Professor : APerson
{
public override SchoolStatus SchoolStatus { get { return SchoolStatus.Professor; }}
}
static void Main(string[] args)
{
}
}
}
| mit | C# |
5218e6be97aa20428104366afb34bf6e0800c451 | Add IEmbed#ToEmbedBuilder extension method (#863) | AntiTcb/Discord.Net,RogueException/Discord.Net | src/Discord.Net.Rest/Extensions/EmbedBuilderExtensions.cs | src/Discord.Net.Rest/Extensions/EmbedBuilderExtensions.cs | using System;
namespace Discord
{
public static class EmbedBuilderExtensions
{
public static EmbedBuilder WithColor(this EmbedBuilder builder, uint rawValue) =>
builder.WithColor(new Color(rawValue));
public static EmbedBuilder WithColor(this EmbedBuilder builder, byte r, byte g, byte b) =>
builder.WithColor(new Color(r, g, b));
public static EmbedBuilder WithColor(this EmbedBuilder builder, int r, int g, int b) =>
builder.WithColor(new Color(r, g, b));
public static EmbedBuilder WithColor(this EmbedBuilder builder, float r, float g, float b) =>
builder.WithColor(new Color(r, g, b));
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IUser user) =>
builder.WithAuthor($"{user.Username}#{user.Discriminator}", user.GetAvatarUrl());
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IGuildUser user) =>
builder.WithAuthor($"{user.Nickname ?? user.Username}#{user.Discriminator}", user.GetAvatarUrl());
public static EmbedBuilder ToEmbedBuilder(this IEmbed embed)
{
if (embed.Type != EmbedType.Rich)
throw new InvalidOperationException($"Only {nameof(EmbedType.Rich)} embeds may be built.");
var builder = new EmbedBuilder
{
Author = new EmbedAuthorBuilder
{
Name = embed.Author?.Name,
IconUrl = embed.Author?.IconUrl,
Url = embed.Author?.Url
},
Color = embed.Color ?? Color.Default,
Description = embed.Description,
Footer = new EmbedFooterBuilder
{
Text = embed.Footer?.Text,
IconUrl = embed.Footer?.IconUrl
},
ImageUrl = embed.Image?.Url,
ThumbnailUrl = embed.Thumbnail?.Url,
Timestamp = embed.Timestamp,
Title = embed.Title,
Url = embed.Url
};
foreach (var field in embed.Fields)
builder.AddField(field.Name, field.Value, field.Inline);
return builder;
}
}
}
| namespace Discord
{
public static class EmbedBuilderExtensions
{
public static EmbedBuilder WithColor(this EmbedBuilder builder, uint rawValue) =>
builder.WithColor(new Color(rawValue));
public static EmbedBuilder WithColor(this EmbedBuilder builder, byte r, byte g, byte b) =>
builder.WithColor(new Color(r, g, b));
public static EmbedBuilder WithColor(this EmbedBuilder builder, int r, int g, int b) =>
builder.WithColor(new Color(r, g, b));
public static EmbedBuilder WithColor(this EmbedBuilder builder, float r, float g, float b) =>
builder.WithColor(new Color(r, g, b));
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IUser user) =>
builder.WithAuthor($"{user.Username}#{user.Discriminator}", user.GetAvatarUrl());
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IGuildUser user) =>
builder.WithAuthor($"{user.Nickname ?? user.Username}#{user.Discriminator}", user.GetAvatarUrl());
}
}
| mit | C# |
dcc5d7fe43aa53abcb17f9ab2ee061d1d9b916a2 | Update version numbers and copyright dates in AssemblyInfo.cs files. | eylvisaker/AgateLib | Drivers/AgateMDX/Properties/AssemblyInfo.cs | Drivers/AgateMDX/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("AgateMDX")]
[assembly: AssemblyDescription("Managed DirectX driver for AgateLib")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AgateMDX")]
[assembly: AssemblyCopyright("Copyright © 2006-9")]
[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("73577432-c4eb-4067-b87f-71d14bb10770")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.3.0.0")]
[assembly: AssemblyFileVersion("0.3.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AgateMDX")]
[assembly: AssemblyDescription("Managed DirectX driver for AgateLib")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ERY")]
[assembly: AssemblyProduct("AgateMDX")]
[assembly: AssemblyCopyright("Copyright © 2006")]
[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("73577432-c4eb-4067-b87f-71d14bb10770")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.2.5.0")]
[assembly: AssemblyFileVersion("0.2.5.0")]
| mit | C# |
1df0952797cd9bd976a350eea04fa545f0b2616e | Add new fields | SoftFx/TTWebClient-CSharp | TTWebClient/Domain/TTHistoryRequest.cs | TTWebClient/Domain/TTHistoryRequest.cs | using System;
namespace TTWebClient.Domain
{
/// <summary>
/// Streaming directions
/// </summary>
public enum TTStreamingDirections
{
Forward,
Backward
}
/// <summary>
/// Trade history request
/// </summary>
public class TTTradeHistoryRequest
{
/// <summary>Lower timestamp bound of the trade history request (optional)</summary>
public DateTime? TimestampFrom { get; set; }
/// <summary>Upper timestamp bound of the trade history request (optional)</summary>
public DateTime? TimestampTo { get; set; }
/// <summary>OrderId to filter the trade history request (optional)</summary>
public long? OrderId { get; set; }
/// <summary>Skip canel order history records (optional)</summary>
public bool? SkipCancelOrder { get; set; }
/// <summary>Request paging direction ("Forward" or "Backward"). Default is "Forward" (optional)</summary>
public TTStreamingDirections? RequestDirection { get; set; }
/// <summary>Request paging size. Default is 100 (optional)</summary>
public int? RequestPageSize { get; set; }
/// <summary>Request paging last Id (optional)</summary>
public string RequestLastId { get; set; }
}
}
| using System;
namespace TTWebClient.Domain
{
/// <summary>
/// Streaming directions
/// </summary>
public enum TTStreamingDirections
{
Forward,
Backward
}
/// <summary>
/// Trade history request
/// </summary>
public class TTTradeHistoryRequest
{
/// <summary>Lower timestamp bound of the trade history request (optional)</summary>
public DateTime? TimestampFrom { get; set; }
/// <summary>Upper timestamp bound of the trade history request (optional)</summary>
public DateTime? TimestampTo { get; set; }
/// <summary>Request paging direction ("Forward" or "Backward"). Default is "Forward" (optional)</summary>
public TTStreamingDirections? RequestDirection { get; set; }
/// <summary>Request paging size. Default is 100 (optional)</summary>
public int? RequestPageSize { get; set; }
/// <summary>Request paging last Id (optional)</summary>
public string RequestLastId { get; set; }
}
}
| mit | C# |
73545125ed1c688a73083f1fb208cee6abb6abf6 | Use TempyConfiguration.Configuration | fxlv/tempy,fxlv/tempy,fxlv/tempy,fxlv/tempy | TempyAPI/Program.cs | TempyAPI/Program.cs | using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Serilog;
using TempyLogger;
namespace TempyAPI
{
public class Program
{
public static void Main(string[] args)
{
TempyConfiguration.Configuration tConfiguration = new TempyConfiguration.Configuration();
Logger.Initilize(tConfiguration);
CreateWebHostBuilder(args).Build().Run();
Log.Information("Web server started");
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, config) =>
{
// Call additional providers here as needed.
// Call AddEnvironmentVariables last if you need to allow environment
// variables to override values from other providers.
config.AddEnvironmentVariables("SETTINGS_");
config.AddJsonFile("appsettings.json");
})
.UseStartup<Startup>()
.UseUrls("http://*:5000");
}
// TODO: move this somewhere else, not sure where yet.
public static void LogHttpRequest(string method, string statusCode, string remoteIp, string requestPath)
{
Log.Debug($"{method} {statusCode} {remoteIp} {requestPath}");
}
}
} | using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Serilog;
using TempyWorker;
namespace TempyAPI
{
public class Program
{
public static void Main(string[] args)
{
TempyConfiguration tConfiguration = new TempyConfiguration();
TempyLogger.Initilize(tConfiguration);
CreateWebHostBuilder(args).Build().Run();
Log.Information("Web server started");
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, config) =>
{
// Call additional providers here as needed.
// Call AddEnvironmentVariables last if you need to allow environment
// variables to override values from other providers.
config.AddEnvironmentVariables("SETTINGS_");
config.AddJsonFile("appsettings.json");
})
.UseStartup<Startup>()
.UseUrls("http://*:5000");
}
// TODO: move this somewhere else, not sure where yet.
public static void LogHttpRequest(string method, string statusCode, string remoteIp, string requestPath)
{
Log.Debug($"{method} {statusCode} {remoteIp} {requestPath}");
}
}
} | isc | C# |
40019e91c0ffd61061a17e940631f81e4a85f20f | fix duplicate logic | Pathoschild/StardewMods | TractorMod/Framework/CustomSaveData.cs | TractorMod/Framework/CustomSaveData.cs | using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using StardewValley.Buildings;
namespace TractorMod.Framework
{
/// <summary>Contains custom data that's stored outside the save file to avoid issues.</summary>
internal class CustomSaveData
{
/*********
** Accessors
*********/
/// <summary>The custom buildings for this save.</summary>
public CustomSaveBuilding[] Buildings { get; set; }
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <remarks>This constructor is needed to deserialise from JSON.</remarks>
public CustomSaveData() { }
/// <summary>Construct an instance.</summary>
/// <param name="buildings">The custom buildings to save.</param>
public CustomSaveData(IEnumerable<Building> buildings)
: this(buildings.Select(garage => new CustomSaveBuilding(new Vector2(garage.tileX, garage.tileY), garage.buildingType))) { }
/// <summary>Construct an instance.</summary>
/// <param name="buildings">The custom buildings to save.</param>
public CustomSaveData(IEnumerable<CustomSaveBuilding> buildings)
{
this.Buildings = buildings.ToArray();
}
}
}
| using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using StardewValley.Buildings;
namespace TractorMod.Framework
{
/// <summary>Contains custom data that's stored outside the save file to avoid issues.</summary>
internal class CustomSaveData
{
/*********
** Accessors
*********/
/// <summary>The custom buildings for this save.</summary>
public CustomSaveBuilding[] Buildings { get; set; }
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <remarks>This constructor is needed to deserialise from JSON.</remarks>
public CustomSaveData() { }
/// <summary>Construct an instance.</summary>
/// <param name="buildings">The custom buildings to save.</param>
public CustomSaveData(IEnumerable<Building> buildings)
{
this.Buildings =
(
from garage in buildings
let tile = new Vector2(garage.tileX, garage.tileY)
select new CustomSaveBuilding(tile, garage.buildingType)
)
.ToArray();
}
/// <summary>Construct an instance.</summary>
/// <param name="buildings">The custom buildings to save.</param>
public CustomSaveData(IEnumerable<CustomSaveBuilding> buildings)
{
this.Buildings = buildings.ToArray();
}
}
}
| mit | C# |
9a09c97457bfbd233ee29f961d5326c4ee054b41 | Fix "Barrel Roll" tooltip not limiting decimal places for spin speed | NeoAdonis/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,ppy/osu | osu.Game/Rulesets/Mods/ModBarrelRoll.cs | osu.Game/Rulesets/Mods/ModBarrelRoll.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.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModBarrelRoll<TObject> : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<TObject>
where TObject : HitObject
{
/// <summary>
/// The current angle of rotation being applied by this mod.
/// Generally should be used to apply inverse rotation to elements which should not be rotated.
/// </summary>
protected float CurrentRotation { get; private set; }
[SettingSource("Roll speed", "Rotations per minute")]
public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(0.5)
{
MinValue = 0.02,
MaxValue = 12,
Precision = 0.01,
};
[SettingSource("Direction", "The direction of rotation")]
public Bindable<RotationDirection> Direction { get; } = new Bindable<RotationDirection>();
public override string Name => "Barrel Roll";
public override string Acronym => "BR";
public override string Description => "The whole playfield is on a wheel!";
public override double ScoreMultiplier => 1;
public override string SettingDescription => $"{SpinSpeed.Value:N2} rpm {Direction.Value.GetDescription().ToLowerInvariant()}";
public void Update(Playfield playfield)
{
playfield.Rotation = CurrentRotation = (Direction.Value == RotationDirection.Counterclockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
}
public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)
{
// scale the playfield to allow all hitobjects to stay within the visible region.
var playfieldSize = drawableRuleset.Playfield.DrawSize;
float minSide = MathF.Min(playfieldSize.X, playfieldSize.Y);
float maxSide = MathF.Max(playfieldSize.X, playfieldSize.Y);
drawableRuleset.Playfield.Scale = new Vector2(minSide / maxSide);
}
}
}
| // 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.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModBarrelRoll<TObject> : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<TObject>
where TObject : HitObject
{
/// <summary>
/// The current angle of rotation being applied by this mod.
/// Generally should be used to apply inverse rotation to elements which should not be rotated.
/// </summary>
protected float CurrentRotation { get; private set; }
[SettingSource("Roll speed", "Rotations per minute")]
public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(0.5)
{
MinValue = 0.02,
MaxValue = 12,
Precision = 0.01,
};
[SettingSource("Direction", "The direction of rotation")]
public Bindable<RotationDirection> Direction { get; } = new Bindable<RotationDirection>();
public override string Name => "Barrel Roll";
public override string Acronym => "BR";
public override string Description => "The whole playfield is on a wheel!";
public override double ScoreMultiplier => 1;
public override string SettingDescription => $"{SpinSpeed.Value} rpm {Direction.Value.GetDescription().ToLowerInvariant()}";
public void Update(Playfield playfield)
{
playfield.Rotation = CurrentRotation = (Direction.Value == RotationDirection.Counterclockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
}
public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)
{
// scale the playfield to allow all hitobjects to stay within the visible region.
var playfieldSize = drawableRuleset.Playfield.DrawSize;
float minSide = MathF.Min(playfieldSize.X, playfieldSize.Y);
float maxSide = MathF.Max(playfieldSize.X, playfieldSize.Y);
drawableRuleset.Playfield.Scale = new Vector2(minSide / maxSide);
}
}
}
| mit | C# |
04fe4a0c5792c5c76f8e87586cb81ecd052eb276 | Fix RectangleNode bounds. | SuperJMN/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,jazzay/Perspex,wieslawsoltes/Perspex,MrDaedra/Avalonia,akrisiun/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,MrDaedra/Avalonia | src/Avalonia.Visuals/Rendering/SceneGraph/RectangleNode.cs | src/Avalonia.Visuals/Rendering/SceneGraph/RectangleNode.cs | // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using Avalonia.Media;
namespace Avalonia.Rendering.SceneGraph
{
public class RectangleNode : IGeometryNode
{
public RectangleNode(Matrix transform, IBrush brush, Pen pen, Rect rect, float cornerRadius)
{
Bounds = (rect * transform).Inflate(pen?.Thickness ?? 0);
Transform = transform;
Brush = brush;
Pen = pen;
Rect = rect;
CornerRadius = cornerRadius;
}
public Rect Bounds { get; }
public Matrix Transform { get; }
public IBrush Brush { get; }
public Pen Pen { get; }
public Rect Rect { get; }
public float CornerRadius { get; }
public bool Equals(Matrix transform, IBrush brush, Pen pen, Rect rect, float cornerRadius)
{
return transform == Transform &&
Equals(brush, Brush) &&
pen == Pen &&
rect == Rect &&
cornerRadius == CornerRadius;
}
public void Render(IDrawingContextImpl context)
{
context.Transform = Transform;
if (Brush != null)
{
context.FillRectangle(Brush, Rect, CornerRadius);
}
if (Pen != null)
{
context.DrawRectangle(Pen, Rect, CornerRadius);
}
}
public bool HitTest(Point p) => Bounds.Contains(p);
}
}
| // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using Avalonia.Media;
namespace Avalonia.Rendering.SceneGraph
{
public class RectangleNode : IGeometryNode
{
public RectangleNode(Matrix transform, IBrush brush, Pen pen, Rect rect, float cornerRadius)
{
Bounds = rect * transform;
Transform = transform;
Brush = brush;
Pen = pen;
Rect = rect;
CornerRadius = cornerRadius;
}
public Rect Bounds { get; }
public Matrix Transform { get; }
public IBrush Brush { get; }
public Pen Pen { get; }
public Rect Rect { get; }
public float CornerRadius { get; }
public bool Equals(Matrix transform, IBrush brush, Pen pen, Rect rect, float cornerRadius)
{
return transform == Transform &&
Equals(brush, Brush) &&
pen == Pen &&
rect == Rect &&
cornerRadius == CornerRadius;
}
public void Render(IDrawingContextImpl context)
{
context.Transform = Transform;
if (Brush != null)
{
context.FillRectangle(Brush, Rect, CornerRadius);
}
if (Pen != null)
{
context.DrawRectangle(Pen, Rect, CornerRadius);
}
}
public bool HitTest(Point p) => Bounds.Contains(p);
}
}
| mit | C# |
747037d006bd173a3dc322cce01c851536da4580 | Improve 'Non found errors' module description | ChristopherJennings/KInspector,KenticoBSoltis/KInspector,ChristopherJennings/KInspector,JosefDvorak/KInspector,pnmcosta/KInspector,petrsvihlik/KInspector,KenticoBSoltis/KInspector,martbrow/KInspector,pnmcosta/KInspector,ChristopherJennings/KInspector,petrsvihlik/KInspector,JosefDvorak/KInspector,pnmcosta/KInspector,Kentico/KInspector,TheEskhaton/KInspector,KenticoBSoltis/KInspector,Kentico/KInspector,martbrow/KInspector,anibalvelarde/KInspector,Kentico/KInspector,JosefDvorak/KInspector,TheEskhaton/KInspector,anibalvelarde/KInspector,anibalvelarde/KInspector,Kentico/KInspector,TheEskhaton/KInspector,ChristopherJennings/KInspector,petrsvihlik/KInspector,martbrow/KInspector | KInspector.Modules/Modules/EventLog/PageNotFoundsModule.cs | KInspector.Modules/Modules/EventLog/PageNotFoundsModule.cs | using System;
using Kentico.KInspector.Core;
namespace Kentico.KInspector.Modules
{
public class PageNotFoundsModule : IModule
{
public ModuleMetadata GetModuleMetadata()
{
return new ModuleMetadata
{
Name = "Not found errors (404)",
SupportedVersions = new[] {
new Version("6.0"),
new Version("7.0"),
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0")
},
Comment = @"Displays all the 404 errors from the event log.
If there are any 404 errors, there is a broken link somewhere on your website. Check the referrer URL and fix all the broken links.
You should avoid broken links on your website as it hurts SEO and generates unnecessary traffic.
For the complete website analysis, you can use some external tool like www.deadlinkchecker.com.",
Category = "Event log"
};
}
public ModuleResults GetResults(InstanceInfo instanceInfo)
{
var dbService = instanceInfo.DBService;
var results = dbService.ExecuteAndGetTableFromFile("PageNotFoundsModule.sql");
if (results.Rows.Count > 0)
{
return new ModuleResults
{
Result = results,
ResultComment = "Page not founds found! Check the referrers, if the links to these non existing pages can be removed.",
Status = results.Rows.Count > 10 ? Status.Error : Status.Warning,
};
}
return new ModuleResults
{
ResultComment = "No page not founds were found in the event log.",
Status = Status.Good
};
}
}
}
| using System;
using Kentico.KInspector.Core;
namespace Kentico.KInspector.Modules
{
public class PageNotFoundsModule : IModule
{
public ModuleMetadata GetModuleMetadata()
{
return new ModuleMetadata
{
Name = "Not found errors (404)",
SupportedVersions = new[] {
new Version("6.0"),
new Version("7.0"),
new Version("8.0"),
new Version("8.1"),
new Version("8.2"),
new Version("9.0")
},
Comment = @"Displays all the 404 errors from the event log.
If there are any 404 errors, maybe there is a broken link somewhere on your pages.
Check the referrer and try to fix all the broken links. For the other links, try to fix a root cause.
In general, you want to avoid this error because it's an unnecessary waste of resources.",
Category = "Event log"
};
}
public ModuleResults GetResults(InstanceInfo instanceInfo)
{
var dbService = instanceInfo.DBService;
var results = dbService.ExecuteAndGetTableFromFile("PageNotFoundsModule.sql");
if (results.Rows.Count > 0)
{
return new ModuleResults
{
Result = results,
ResultComment = "Page not founds found! Check the referrers, if the links to these non existing pages can be removed",
Status = results.Rows.Count > 10 ? Status.Error : Status.Warning,
};
}
return new ModuleResults
{
ResultComment = "No page not founds were found in the event log.",
Status = Status.Good
};
}
}
}
| mit | C# |
9b6ea72eb2d0c4724562e6d294aa01da34e8bad4 | Edit DataQueue.cs | 60071jimmy/UartOscilloscope,60071jimmy/UartOscilloscope | QueueDataGraphic/QueueDataGraphic/CSharpFiles/DataQueue.cs | QueueDataGraphic/QueueDataGraphic/CSharpFiles/DataQueue.cs | /********************************************************************
* Develop by Jimmy Hu *
* This program is licensed under the Apache License 2.0. *
* DataQueue.cs *
* 本檔案建立繪圖資料佇列單元物件 *
********************************************************************
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{ // namespace start
class DataQueue
{
/// <summary>
/// GraphicData is the queue for storing the graphic data.
/// GraphicData佇列用於儲存繪圖資料
/// </summary>
private Queue<object> GraphicData;
/// <summary>
/// GraphicDataQueueMax is the max number of count of GraphData elements.
/// GraphicDataQueueMax為GraphData物件數量上限
/// </summary>
private int GraphicDataQueueMax;
/// <summary>
/// RemovingOverload method would remove the data when GraphicData.count > GraphicDataQueueMax
/// RemovingOverload用於清除多於物件數量上限之資料
/// </summary>
public void RemovingOverload() // RemovingOverload method, RemovingOverload方法
{ // RemovingOverload method start, 進入RemovingOverload方法
while(GraphicData.Count > GraphicDataQueueMax) // when GraphicData.Count more than GraphicDataQueueMax, 當有過多資料
{ // while loop start, 進入while迴圈
} // while loop end, 結束while迴圈
} // RemovingOverload method end, 結束RemovingOverload方法
}
} // namespace end
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{ // namespace start
class DataQueue
{
}
} // namespace end
| apache-2.0 | C# |
7f4bfad10a11e6b9bf8a3813a30cb1e77e34ae4f | fix for broken caustics reference | John3/Torque3D,Duion/Torque3D,chaigler/Torque3D,FITTeamIndecisive/Torque3D,Phantom139/Torque3D,GarageGames/Torque3D,Will-of-the-Wisp/Torque3D,Bloodknight/Torque3D,aaravamudan2014/Torque3D,GarageGames/Torque3D,aaravamudan2014/Torque3D,Azaezel/Torque3D,ValtoGameEngines/Torque3D,rextimmy/Torque3D,Bloodknight/Torque3D,GarageGames/Torque3D,Torque3D-GameEngine/Torque3D,JeffProgrammer/Torque3D,Duion/Torque3D,Torque3D-GameEngine/Torque3D,lukaspj/Speciality,elfprince13/Torque3D,Will-of-the-Wisp/Torque3D,FITTeamIndecisive/Torque3D,Torque3D-GameEngine/Torque3D,rextimmy/Torque3D,chaigler/Torque3D,rextimmy/Torque3D,ValtoGameEngines/Torque3D,Torque3D-GameEngine/Torque3D,ValtoGameEngines/Torque3D,rextimmy/Torque3D,chaigler/Torque3D,Will-of-the-Wisp/Torque3D,chaigler/Torque3D,Torque3D-GameEngine/Torque3D,Will-of-the-Wisp/Torque3D,ValtoGameEngines/Torque3D,Duion/Torque3D,aaravamudan2014/Torque3D,Duion/Torque3D,Will-of-the-Wisp/Torque3D,JeffProgrammer/Torque3D,Bloodknight/Torque3D,John3/Torque3D,rextimmy/Torque3D,Azaezel/Torque3D,Will-of-the-Wisp/Torque3D,JeffProgrammer/Torque3D,ValtoGameEngines/Torque3D,chaigler/Torque3D,Phantom139/Torque3D,Bloodknight/Torque3D,FITTeamIndecisive/Torque3D,Bloodknight/Torque3D,FITTeamIndecisive/Torque3D,Duion/Torque3D,elfprince13/Torque3D,lukaspj/Speciality,FITTeamIndecisive/Torque3D,lukaspj/Speciality,John3/Torque3D,Will-of-the-Wisp/Torque3D,Azaezel/Torque3D,FITTeamIndecisive/Torque3D,rextimmy/Torque3D,FITTeamIndecisive/Torque3D,Bloodknight/Torque3D,ValtoGameEngines/Torque3D,John3/Torque3D,Azaezel/Torque3D,rextimmy/Torque3D,FITTeamIndecisive/Torque3D,aaravamudan2014/Torque3D,JeffProgrammer/Torque3D,chaigler/Torque3D,John3/Torque3D,JeffProgrammer/Torque3D,JeffProgrammer/Torque3D,Torque3D-GameEngine/Torque3D,Phantom139/Torque3D,Duion/Torque3D,ValtoGameEngines/Torque3D,lukaspj/Speciality,elfprince13/Torque3D,lukaspj/Speciality,John3/Torque3D,lukaspj/Speciality,ValtoGameEngines/Torque3D,Torque3D-GameEngine/Torque3D,Phantom139/Torque3D,lukaspj/Speciality,Duion/Torque3D,John3/Torque3D,GarageGames/Torque3D,John3/Torque3D,lukaspj/Speciality,FITTeamIndecisive/Torque3D,elfprince13/Torque3D,Will-of-the-Wisp/Torque3D,elfprince13/Torque3D,GarageGames/Torque3D,aaravamudan2014/Torque3D,Will-of-the-Wisp/Torque3D,Azaezel/Torque3D,aaravamudan2014/Torque3D,chaigler/Torque3D,Bloodknight/Torque3D,ValtoGameEngines/Torque3D,aaravamudan2014/Torque3D,John3/Torque3D,Phantom139/Torque3D,Phantom139/Torque3D,FITTeamIndecisive/Torque3D,GarageGames/Torque3D,elfprince13/Torque3D,elfprince13/Torque3D,lukaspj/Speciality,aaravamudan2014/Torque3D,Will-of-the-Wisp/Torque3D,Duion/Torque3D,Azaezel/Torque3D,elfprince13/Torque3D,Bloodknight/Torque3D,rextimmy/Torque3D,Azaezel/Torque3D,Bloodknight/Torque3D,Will-of-the-Wisp/Torque3D,Torque3D-GameEngine/Torque3D,Azaezel/Torque3D,Torque3D-GameEngine/Torque3D,Phantom139/Torque3D,GarageGames/Torque3D,Duion/Torque3D,Duion/Torque3D,chaigler/Torque3D,elfprince13/Torque3D,JeffProgrammer/Torque3D,chaigler/Torque3D,Azaezel/Torque3D,rextimmy/Torque3D,GarageGames/Torque3D,rextimmy/Torque3D,ValtoGameEngines/Torque3D,Torque3D-GameEngine/Torque3D,Phantom139/Torque3D,John3/Torque3D,Phantom139/Torque3D,JeffProgrammer/Torque3D,Azaezel/Torque3D,aaravamudan2014/Torque3D,Phantom139/Torque3D,aaravamudan2014/Torque3D,lukaspj/Speciality,GarageGames/Torque3D,elfprince13/Torque3D | Templates/Full/game/core/scripts/client/postFx/caustics.cs | Templates/Full/game/core/scripts/client/postFx/caustics.cs | //-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// 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.
//-----------------------------------------------------------------------------
singleton GFXStateBlockData( PFX_CausticsStateBlock : PFX_DefaultStateBlock )
{
blendDefined = true;
blendEnable = true;
blendSrc = GFXBlendOne;
blendDest = GFXBlendOne;
samplersDefined = true;
samplerStates[0] = SamplerClampLinear;
samplerStates[1] = SamplerWrapLinear;
samplerStates[2] = SamplerWrapLinear;
};
singleton ShaderData( PFX_CausticsShader )
{
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "shaders/common/postFx/caustics/causticsP.hlsl";
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
OGLPixelShaderFile = "shaders/common/postFx/caustics/gl/causticsP.glsl";
samplerNames[0] = "$prepassTex";
samplerNames[1] = "$causticsTex0";
samplerNames[2] = "$causticsTex1";
pixVersion = 3.0;
};
singleton PostEffect( CausticsPFX )
{
isEnabled = false;
renderTime = "PFXAfterDiffuse";
renderBin = "ObjTranslucentBin";
//renderPriority = 0.1;
shader = PFX_CausticsShader;
stateBlock = PFX_CausticsStateBlock;
texture[0] = "#prepass";
texture[1] = "textures/caustics_1";
texture[2] = "textures/caustics_2";
target = "$backBuffer";
};
| //-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// 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.
//-----------------------------------------------------------------------------
singleton GFXStateBlockData( PFX_CausticsStateBlock : PFX_DefaultStateBlock )
{
blendDefined = true;
blendEnable = true;
blendSrc = GFXBlendOne;
blendDest = GFXBlendOne;
samplersDefined = true;
samplerStates[0] = SamplerClampLinear;
samplerStates[1] = SamplerWrapLinear;
samplerStates[2] = SamplerWrapLinear;
};
singleton ShaderData( PFX_CausticsShader )
{
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "shaders/common/postFx/caustics/causticsP.hlsl";
OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl";
OGLPixelShaderFile = "shaders/common/postFx/caustics/gl/causticsP.glsl";
samplerNames[0] = "$prepassTex";
samplerNames[1] = "$causticsTex0";
samplerNames[2] = "$causticsTex1";
pixVersion = 3.0;
};
singleton PostEffect( CausticsPFX )
{
isEnabled = false;
renderTime = "PFXAfterDiffuse";
renderBin = "ObjTranslucentBin";
//renderPriority = 0.1;
shader = PFX_CausticsShader;
stateBlock = PFX_CausticsStateBlock;
texture[0] = "#prepass";
texture[1] = "textures/caustics_1";
texture[2] = "textures/caustics_2";
target = "$backBuffer";
};
| mit | C# |
0f530a3d02eaba9a41039f9b599410b8512c7079 | add redis to controller to get stats | agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov | WebAPI.Dashboard/Areas/admin/Controllers/HomeController.cs | WebAPI.Dashboard/Areas/admin/Controllers/HomeController.cs | using System.Linq;
using System.Web.Mvc;
using Raven.Client;
using StackExchange.Redis;
using WebAPI.Common.Models.Raven.Admin;
using WebAPI.Dashboard.Controllers;
namespace WebAPI.Dashboard.Areas.admin.Controllers
{
[Authorize]
public class HomeController : RavenController
{
private readonly ConnectionMultiplexer _redis;
public HomeController(IDocumentStore store, ConnectionMultiplexer redis)
: base(store)
{
_redis = redis;
}
[HttpGet]
public ActionResult Index()
{
if (!Session.Query<AdminContainer>().Any(x => x.Emails.Any(y => y == Account.Email)))
{
ErrorMessage = "Nothing to see there.";
return RedirectToRoute("default", new
{
controller = "Home"
});
}
return View("Index");
}
}
} | using System.Linq;
using System.Web.Mvc;
using Raven.Client;
using WebAPI.Common.Models.Raven.Admin;
using WebAPI.Dashboard.Controllers;
namespace WebAPI.Dashboard.Areas.admin.Controllers
{
[Authorize]
public class HomeController : RavenController
{
public HomeController(IDocumentStore store)
: base(store)
{
}
[HttpGet]
public ActionResult Index()
{
if (!Session.Query<AdminContainer>().Any(x => x.Emails.Any(y => y == Account.Email)))
{
ErrorMessage = "Nothing to see there.";
return RedirectToRoute("default", new
{
controller = "Home"
});
}
return View("Index");
}
}
} | mit | C# |
bffc0e6c799b812540d819423bda1076ed63967b | Define the 'return' operator | jonathanvdc/cs-wasm,jonathanvdc/cs-wasm | libwasm/Instructions/Operators.cs | libwasm/Instructions/Operators.cs | using System.Collections.Generic;
namespace Wasm.Instructions
{
/// <summary>
/// A collection of operator definitions.
/// </summary>
public static class Operators
{
static Operators()
{
opsByOpCode = new Dictionary<byte, Operator>();
Unreachable = Register(new NullaryOperator(0x00, WasmType.Empty, "unreachable"));
Nop = Register(new NullaryOperator(0x01, WasmType.Empty, "nop"));
Return = Register(new NullaryOperator(0x0f, WasmType.Empty, "return"));
}
/// <summary>
/// The 'unreachable' operator, which traps immediately.
/// </summary>
public static readonly Operator Unreachable;
/// <summary>
/// The 'nop' operator, which does nothing.
/// </summary>
public static readonly Operator Nop;
/// <summary>
/// The 'return' operator, which returns zero or one value from a function.
/// </summary>
public static readonly Operator Return;
/// <summary>
/// The 'else' opcode, which begins an 'if' expression's 'else' block.
/// </summary>
public const byte ElseOpCode = 0x05;
/// <summary>
/// The 'end' opcode, which ends a block, loop or if.
/// </summary>
public const byte EndOpCode = 0x0b;
/// <summary>
/// A map of opcodes to the operators that define them.
/// </summary>
private static Dictionary<byte, Operator> opsByOpCode;
/// <summary>
/// Gets a map of opcodes to the operators that define them.
/// </summary>
public static IReadOnlyDictionary<byte, Operator> OperatorsByOpCode => opsByOpCode;
/// <summary>
/// Registers the given operator.
/// </summary>
/// <param name="Op">The operator to register.</param>
/// <returns>The operator.</returns>
private static Operator Register(Operator Op)
{
opsByOpCode.Add(Op.OpCode, Op);
return Op;
}
}
} | using System.Collections.Generic;
namespace Wasm.Instructions
{
/// <summary>
/// A collection of operator definitions.
/// </summary>
public static class Operators
{
static Operators()
{
opsByOpCode = new Dictionary<byte, Operator>();
Unreachable = Register(new NullaryOperator(0x00, WasmType.Empty, "unreachable"));
Nop = Register(new NullaryOperator(0x01, WasmType.Empty, "nop"));
}
/// <summary>
/// The 'unreachable' operator, which traps immediately.
/// </summary>
public static readonly Operator Unreachable;
/// <summary>
/// The 'nop' operator, which does nothing.
/// </summary>
public static readonly Operator Nop;
/// <summary>
/// The 'else' opcode, which begins an 'if' expression's 'else' block.
/// </summary>
public const byte ElseOpCode = 0x05;
/// <summary>
/// The 'end' opcode, which ends a block, loop or if.
/// </summary>
public const byte EndOpCode = 0x0b;
/// <summary>
/// A map of opcodes to the operators that define them.
/// </summary>
private static Dictionary<byte, Operator> opsByOpCode;
/// <summary>
/// A map of opcodes to the operators that define them.
/// </summary>
public static IReadOnlyDictionary<byte, Operator> OperatorsByOpCode => opsByOpCode;
/// <summary>
/// Registers the given operator.
/// </summary>
/// <param name="Op">The operator to register.</param>
/// <returns>The operator.</returns>
private static Operator Register(Operator Op)
{
opsByOpCode.Add(Op.OpCode, Op);
return Op;
}
}
} | mit | C# |
7300a72904edb9881116bfd499f9f92d4e50687e | Update 20180327.LuckWheelManager.cs | twilightspike/cuddly-disco,twilightspike/cuddly-disco | main/20180327.LuckWheelManager.cs | main/20180327.LuckWheelManager.cs | using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System;
public class LuckWheelManager: MonoBehaviour{
/*stuffset*/
private bool _beStarted;
private float[] _angleSector;
private float _angleFinal;
private float _angleBegin;
private float _lerpRotateTimeNow;
/*message_how much*/
public int PressCost = 250; //pay how much on playing
public int MoneyPrevTotal;
public int MoneyNowTotal = 1000;
/*ui_basuc*/
public Button buttonPress;
public GameObject circleWheel;
/*message_win or lose*/
public Text MoneyDeltaText;
public Text MoneyNowText;
/*action*/
private void Awake(){
MoneyPrevTotal = MoneyNowTotal;
MoneyNowText.text = MoneyNowTotal.ToString();
}
public void SpinWheel(){
if(MoneyNowTotal >= PressCost){
_lerpRotateTimeNow = 0f;
_angleSector = new float[]{
30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360
};
int circleFull = 5;
float randomAngleFinal = _angleSector [UnityEngine.Random.Range(0, _angleSector.Length)];
/*angle would rotate*/
_angleFinal = -(circleFull * 360 + randomAngleFinal);
_beStarted = true;
MoneyPrevTotal = MoneyNowTotal;
/*Whenever I play, my wallet fades*/
MoneyNowTotal = -PressCost;
/*Addict to it?!*/
MoneyDeltaText.text = PressCost + "bye!";
MoneyDeltaText.gameObject.SetActive(true);
StartCoroutine(MoneyDeltaHide());
StartCoroutine(MoneyTotalUpdate());
}
}
/*void RewardByAngle(){
switch(_angleBegin){}
}*/
void Update(){
/*The Poor is banned*/
if(_beStarted || MoneyNowTotal < PressCost){
buttonPress.interactable = false;
/*buttonPress.GetComponent<Image>.color = new Color();*/
}else{
buttonPress.interactable = true;
/*buttonPress.GetComponent<Image>.color = new Color();*/
}
if(!_beStarted){
return;
float LerpRotateTimeMax = 4f;
/*calculate increment time once per frame*/
_lerpRotateTimeNow += Time.deltaTime;
if(_lerpRotateTimeNow > LerpRotateTimeMax || circleWheel.transform.EulerAngles.z == _angleFinal){
_lerpRotateTimeNow = LerpRotateTimeMax;
_beStarted = false;
_angleBegin = _angleFinal % 360;
AwardByAngle();
StartCoroutine(MoneyDeltaHide());
}
/**/
}
}
}
| using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System;
public class LuckWheelManager: MonoBehaviour{
/*stuffset*/
private bool _beStarted;
private float[] _angleSector;
private float _angleFinal;
private float _angleBegin;
private float _lerpRotateTimeNow;
/*message_how much*/
public int PressCost = 250; //pay how much on playing
public int MoneyPrevTotal;
public int MoneyNowTotal = 1000;
/*ui_basuc*/
public Button buttonPress;
public GameObject circleWheel;
/*message_win or lose*/
public Text MoneyDeltaText;
public Text MoneyNowText;
/*action*/
private void Awake(){
MoneyPrevTotal = MoneyNowTotal;
MoneyNowText.text = MoneyNowTotal.ToString();
}
public void SpinWheel(){
if(MoneyNowTotal >= PressCost){
_lerpRotateTimeNow = 0f;
_angleSector = new float[]{
30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360
};
int circleFull = 5;
float randomAngleFinal = _angleSector [UnityEngine.Random.Range(0, _angleSector.Length)];
/*angle would rotate*/
_angleFinal = -(circleFull * 360 + randomAngleFinal);
_beStarted = true;
MoneyPrevTotal = MoneyNowTotal;
/*Whenever I play, my wallet fades*/
MoneyNowTotal = -PressCost;
/*Addict to it?!*/
MoneyDeltaText.text = PressCost + "bye!";
MoneyDeltaText.gameObject.SetActive(true);
StartCoroutine(MoneyDeltaHide());
StartCoroutine(MoneyTotalUpdate());
}
}
/*void RewardByAngle(){
switch(_angleBegin){}
}*/
void Update(){
/*The Poor is banned*/
if(_beStarted || MoneyNowTotal < PressCost){
buttonPress.interactable = false;
/*buttonPress.GetComponent<Image>.color = new Color();*/
}else{
buttonPress.interactable = true;
/*buttonPress.GetComponent<Image>.color = new Color();*/
}
if(!_beStarted){
return;
float LerpRotateTimeMax = 4f;
_lerpRotateTimeNow += Time.deltaTime;
if(_lerpRotateTimeNow > LerpRotateTimeMax || circleWheel.transform.EulerAngles.z == _angleFinal){
_lerpRotateTimeNow = LerpRotateTimeMax;
}
}
}
}
| mit | C# |
0d71903aef9da89dcd1a5e18a5e53bd6f60db866 | add methods to interface | aloisdeniel/Mvvmicro | Sources/Mvvmicro/Dependencies/IContainer.cs | Sources/Mvvmicro/Dependencies/IContainer.cs | namespace Mvvmicro
{
using System;
/// <summary>
/// A container for managing dependencies between objects.
/// </summary>
public interface IContainer
{
/// <summary>
/// Register a factory for the given type.
/// </summary>
/// <returns>The register.</returns>
/// <param name="factory">Factory.</param>
/// <typeparam name="T">The registered type.</typeparam>
void Register<T>(Func<IContainer, T> factory, bool isInstance = false);
/// <summary>
/// Get an instance of the given type.
/// </summary>
/// <remarks>
/// The type should be registered before use.
/// </remarks>
/// <returns>The of.</returns>
/// <typeparam name="T">The requested type.</typeparam>
T Get<T>();
/// <summary>
/// Returns true if the type has been registered.
/// </summary>
/// <returns><c>true</c>, if type has been registered, <c>false</c> otherwise.</returns>
/// <typeparam name="T">The type parameter.</typeparam>
bool IsRegistered<T>();
/// <summary>
/// Create a new instance (even if the type has been registered as an instance).
/// </summary>
/// <returns>The new.</returns>
/// <typeparam name="T">The 1st type parameter.</typeparam>
T New<T>();
/// <summary>
/// Unregister the factory for a given instance type, and deletes any existing instance of this type.
/// </summary>
/// <typeparam name="T">The 1st type parameter.</typeparam>
void Unregister<T>();
/// <summary>
/// Wipes the container of all factories and instances.
/// </summary>
void WipeContainer();
}
}
| namespace Mvvmicro
{
using System;
/// <summary>
/// A container for managing dependencies between objects.
/// </summary>
public interface IContainer
{
/// <summary>
/// Register a factory for the given type.
/// </summary>
/// <returns>The register.</returns>
/// <param name="factory">Factory.</param>
/// <typeparam name="T">The registered type.</typeparam>
void Register<T>(Func<IContainer, T> factory, bool isInstance = false);
/// <summary>
/// Get an instance of the given type.
/// </summary>
/// <remarks>
/// The type should be registered before use.
/// </remarks>
/// <returns>The of.</returns>
/// <typeparam name="T">The requested type.</typeparam>
T Get<T>();
/// <summary>
/// Returns true if the type has been registered.
/// </summary>
/// <returns><c>true</c>, if type has been registered, <c>false</c> otherwise.</returns>
/// <typeparam name="T">The type parameter.</typeparam>
bool IsRegistered<T>();
/// <summary>
/// Create a new instance (even if the type has been registered as an instance).
/// </summary>
/// <returns>The new.</returns>
/// <typeparam name="T">The 1st type parameter.</typeparam>
T New<T>();
}
}
| mit | C# |
121b7a497c44c2eb7c8c748e33c98e140eefd27d | Move back to list link | mattgwagner/alert-roster | alert-roster.web/Views/Home/New.cshtml | alert-roster.web/Views/Home/New.cshtml | @model alert_roster.web.Models.Message
@{
ViewBag.Title = "Create New Message";
}
<h2>@ViewBag.Title</h2>
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@using (Html.BeginForm("New", "Home", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Message</h4>
<hr />
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(model => model.Content, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Content)
@Html.ValidationMessageFor(model => model.Content)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
| @model alert_roster.web.Models.Message
@{
ViewBag.Title = "Create New Message";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm("New", "Home", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Message</h4>
<hr />
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(model => model.Content, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Content)
@Html.ValidationMessageFor(model => model.Content)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
| mit | C# |
ddb48a190cdce70615914d6da4f1d867b334fc00 | Fix `Quantity` to be nullable on `SubscriptionSchedulePhaseItem` | stripe/stripe-dotnet | src/Stripe.net/Entities/SubscriptionsSchedules/SubscriptionSchedulePhaseItem.cs | src/Stripe.net/Entities/SubscriptionsSchedules/SubscriptionSchedulePhaseItem.cs | namespace Stripe
{
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class SubscriptionSchedulePhaseItem : StripeEntity<SubscriptionSchedulePhaseItem>
{
/// <summary>
/// Define thresholds at which an invoice will be sent, and the subscription advanced to a
/// new billing period.
/// </summary>
[JsonProperty("billing_thresholds")]
public SubscriptionItemBillingThresholds BillingThresholds { get; set; }
#region Expandable Plan
/// <summary>
/// ID of the <see cref="Plan"/> included in the phase for this subscription schedule.
/// <para>Expandable.</para>
/// </summary>
[JsonIgnore]
public string PlanId
{
get => this.InternalPlan?.Id;
set => this.InternalPlan = SetExpandableFieldId(value, this.InternalPlan);
}
/// <summary>
/// (Expanded) The <see cref="Plan"/> included in the phase for this subscription schedule.
/// </summary>
[JsonIgnore]
public Plan Plan
{
get => this.InternalPlan?.ExpandedObject;
set => this.InternalPlan = SetExpandableFieldObject(value, this.InternalPlan);
}
[JsonProperty("plan")]
[JsonConverter(typeof(ExpandableFieldConverter<Plan>))]
internal ExpandableField<Plan> InternalPlan { get; set; }
#endregion
/// <summary>
/// Quantity of the plan to which the customer should be subscribed.
/// </summary>
[JsonProperty("quantity")]
public long? Quantity { get; set; }
/// <summary>
/// The tax rates which apply to this specific item on the phase for a subscription
/// schedule.
/// </summary>
[JsonProperty("tax_rates")]
public List<TaxRate> TaxRates { get; set; }
}
}
| namespace Stripe
{
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class SubscriptionSchedulePhaseItem : StripeEntity<SubscriptionSchedulePhaseItem>
{
/// <summary>
/// Define thresholds at which an invoice will be sent, and the subscription advanced to a
/// new billing period.
/// </summary>
[JsonProperty("billing_thresholds")]
public SubscriptionItemBillingThresholds BillingThresholds { get; set; }
#region Expandable Plan
/// <summary>
/// ID of the <see cref="Plan"/> included in the phase for this subscription schedule.
/// <para>Expandable.</para>
/// </summary>
[JsonIgnore]
public string PlanId
{
get => this.InternalPlan?.Id;
set => this.InternalPlan = SetExpandableFieldId(value, this.InternalPlan);
}
/// <summary>
/// (Expanded) The <see cref="Plan"/> included in the phase for this subscription schedule.
/// </summary>
[JsonIgnore]
public Plan Plan
{
get => this.InternalPlan?.ExpandedObject;
set => this.InternalPlan = SetExpandableFieldObject(value, this.InternalPlan);
}
[JsonProperty("plan")]
[JsonConverter(typeof(ExpandableFieldConverter<Plan>))]
internal ExpandableField<Plan> InternalPlan { get; set; }
#endregion
/// <summary>
/// Quantity of the plan to which the customer should be subscribed.
/// </summary>
[JsonProperty("quantity")]
public long Quantity { get; set; }
/// <summary>
/// The tax rates which apply to this specific item on the phase for a subscription
/// schedule.
/// </summary>
[JsonProperty("tax_rates")]
public List<TaxRate> TaxRates { get; set; }
}
}
| apache-2.0 | C# |
521a12fd5ccf9f6f8df0e8cfadf2fbd4421438ac | Add test for IComponent typeconverter register in TypeDescriptor (#40959) (#40977) | BrennanConroy/corefx,BrennanConroy/corefx,BrennanConroy/corefx | src/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.netcoreapp.cs | src/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.netcoreapp.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Xunit;
namespace System.ComponentModel.Tests
{
public partial class TypeDescriptorTests
{
[Theory]
[InlineData(typeof(Version), typeof(VersionConverter))]
[InlineData(typeof(IComponent), typeof(ComponentConverter))]
public static void GetConverter_NetCoreApp(Type targetType, Type resultConverterType) =>
GetConverter(targetType, resultConverterType);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Xunit;
namespace System.ComponentModel.Tests
{
public partial class TypeDescriptorTests
{
[Theory]
[InlineData(typeof(Version), typeof(VersionConverter))]
public static void GetConverter_NetCoreApp(Type targetType, Type resultConverterType) =>
GetConverter(targetType, resultConverterType);
}
}
| mit | C# |
fa7a484a05623a04cfa169247dbab5a4c7b903da | Add XML comments to LogLevel | atata-framework/atata,atata-framework/atata,YevgeniyShunevych/Atata,YevgeniyShunevych/Atata | src/Atata/Logging/LogLevel.cs | src/Atata/Logging/LogLevel.cs | namespace Atata
{
/// <summary>
/// Specifies the level of log event.
/// </summary>
public enum LogLevel
{
/// <summary>
/// Trace log level.
/// </summary>
Trace,
/// <summary>
/// Debug log level.
/// </summary>
Debug,
/// <summary>
/// Info log level.
/// </summary>
Info,
/// <summary>
/// Warn log level.
/// </summary>
Warn,
/// <summary>
/// Error log level.
/// </summary>
Error,
/// <summary>
/// Fatal log level.
/// </summary>
Fatal
}
}
| namespace Atata
{
/// <summary>
/// Specifies the level of log event.
/// </summary>
public enum LogLevel
{
Trace,
Debug,
Info,
Warn,
Error,
Fatal
}
}
| apache-2.0 | C# |
2cf1eec7da74277570f441e6b804b07806f54ba4 | remove test data | akaSybe/Disqus.NET | src/Disqus.NET/Disqus.NET.Tests/DisqusTestsInitializer.cs | src/Disqus.NET/Disqus.NET.Tests/DisqusTestsInitializer.cs | using System;
using NUnit.Framework;
namespace Disqus.NET.Tests
{
public class DisqusTestsInitializer
{
private const string DisqusKey = "";
protected static class TestData
{
public const string AccessToken = "";
public const string Forum = "";
public const int UserId = 0;
public const string UserName = "";
}
protected IDisqusApi Disqus;
[OneTimeSetUp]
public void OneTimeSetUp()
{
if (string.IsNullOrWhiteSpace(DisqusKey))
{
throw new ArgumentNullException(DisqusKey, "You should explicit specify Disqus Secret Key!");
}
if (string.IsNullOrWhiteSpace(TestData.AccessToken))
{
throw new ArgumentNullException(TestData.AccessToken, "You should explicit specify Disqus Access Token!");
}
Disqus = new DisqusApi(new DisqusRequestProcessor(new DisqusRestClient()), DisqusAuthMethod.SecretKey, DisqusKey);
}
}
}
| using System;
using NUnit.Framework;
namespace Disqus.NET.Tests
{
public class DisqusTestsInitializer
{
private const string DisqusKey = "X06iuWTeIlPzxRByY43SXFQO3oBnFoYtJ8MHQQG6J8MOEoBiHIHJogK7A69whLs7";
protected static class TestData
{
public const string AccessToken = "";
public const string Forum = "";
public const int UserId = 0;
public const string UserName = "";
}
protected IDisqusApi Disqus;
[OneTimeSetUp]
public void OneTimeSetUp()
{
if (string.IsNullOrWhiteSpace(DisqusKey))
{
throw new ArgumentNullException(DisqusKey, "You should explicit specify Disqus Secret Key!");
}
if (string.IsNullOrWhiteSpace(TestData.AccessToken))
{
throw new ArgumentNullException(TestData.AccessToken, "You should explicit specify Disqus Access Token!");
}
Disqus = new DisqusApi(new DisqusRequestProcessor(new DisqusRestClient()), DisqusAuthMethod.SecretKey, DisqusKey);
}
}
}
| mit | C# |
f68a55854f89cfca2a13bce0ddecdbdef584dd49 | upgrade ecommon.jsonnet to 1.4.1 | tangxuehua/ecommon,Aaron-Liu/ecommon | src/Extensions/ECommon.JsonNet/Properties/AssemblyInfo.cs | src/Extensions/ECommon.JsonNet/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ECommon.JsonNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ECommon.JsonNet")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("bd583d24-9fd4-4740-b951-17a64eb4c9e1")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ECommon.JsonNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ECommon.JsonNet")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("bd583d24-9fd4-4740-b951-17a64eb4c9e1")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
| mit | C# |
b5ae26141f360165afec8d0d6039f6404155a02e | Change OrderDetails table name from 'OrderDetails' to 'Order Details' in the mapping. | shilin-he/spa-northwind,shilin-he/spa-northwind | src/Northwind.Model/Mapping/OrderDetailMap.cs | src/Northwind.Model/Mapping/OrderDetailMap.cs | using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
namespace Northwind.Model.Mapping
{
public class OrderDetailMap : EntityTypeConfiguration<OrderDetail>
{
public OrderDetailMap()
{
// Primary Key
HasKey(t => new { t.OrderId, t.ProductId });
// Properties
Property(t => t.OrderId)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
Property(t => t.ProductId)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
// Table & Column Mappings
ToTable("Order Details");
Property(t => t.OrderId).HasColumnName("OrderID");
Property(t => t.ProductId).HasColumnName("ProductID");
Property(t => t.UnitPrice).HasColumnName("UnitPrice");
Property(t => t.Quantity).HasColumnName("Quantity");
Property(t => t.Discount).HasColumnName("Discount");
// Relationships
HasRequired(t => t.Order)
.WithMany(t => t.OrderDetails)
.HasForeignKey(d => d.OrderId);
HasRequired(t => t.Product)
.WithMany(t => t.OrderDetails)
.HasForeignKey(d => d.ProductId);
}
}
}
| using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
namespace Northwind.Model.Mapping
{
public class OrderDetailMap : EntityTypeConfiguration<OrderDetail>
{
public OrderDetailMap()
{
// Primary Key
HasKey(t => new { t.OrderId, t.ProductId });
// Properties
Property(t => t.OrderId)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
Property(t => t.ProductId)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
// Table & Column Mappings
ToTable("OrderDetails");
Property(t => t.OrderId).HasColumnName("OrderID");
Property(t => t.ProductId).HasColumnName("ProductID");
Property(t => t.UnitPrice).HasColumnName("UnitPrice");
Property(t => t.Quantity).HasColumnName("Quantity");
Property(t => t.Discount).HasColumnName("Discount");
// Relationships
HasRequired(t => t.Order)
.WithMany(t => t.OrderDetails)
.HasForeignKey(d => d.OrderId);
HasRequired(t => t.Product)
.WithMany(t => t.OrderDetails)
.HasForeignKey(d => d.ProductId);
}
}
}
| unlicense | C# |
b3be3f82f8e5a12c531113c51b4f89a404b06841 | Sort completion items. | mrward/typescript-addin,chrisber/typescript-addin,chrisber/typescript-addin,mrward/typescript-addin | src/TypeScriptBinding/TypeScriptCompletionItemProvider.cs | src/TypeScriptBinding/TypeScriptCompletionItemProvider.cs | //
// TypeScriptCompletionItemProvider.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Linq;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptCompletionItemProvider : AbstractCompletionItemProvider
{
TypeScriptContext context;
bool memberCompletion;
public TypeScriptCompletionItemProvider(TypeScriptContext context)
{
this.context = context;
}
public bool ShowCompletion(ITextEditor editor, bool memberCompletion)
{
this.memberCompletion = memberCompletion;
ICompletionItemList list = GenerateCompletionList(editor);
if (list.Items.Any()) {
editor.ShowCompletionWindow(list);
return true;
}
return false;
}
public override ICompletionItemList GenerateCompletionList(ITextEditor editor)
{
CompletionInfo result = context.GetCompletionItems(
editor.FileName,
editor.Caret.Offset,
editor.Document.Text,
memberCompletion);
var itemList = new DefaultCompletionItemList();
if (result != null) {
var completionDetailsProvider = new CompletionEntryDetailsProvider(
context,
editor.FileName,
editor.Caret.Offset);
itemList.Items.AddRange(result.entries.Select(entry => new TypeScriptCompletionItem(entry, completionDetailsProvider)));
itemList.SortItems();
}
return itemList;
}
}
}
| //
// TypeScriptCompletionItemProvider.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Linq;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class TypeScriptCompletionItemProvider : AbstractCompletionItemProvider
{
TypeScriptContext context;
bool memberCompletion;
public TypeScriptCompletionItemProvider(TypeScriptContext context)
{
this.context = context;
}
public bool ShowCompletion(ITextEditor editor, bool memberCompletion)
{
this.memberCompletion = memberCompletion;
ICompletionItemList list = GenerateCompletionList(editor);
if (list.Items.Any()) {
editor.ShowCompletionWindow(list);
return true;
}
return false;
}
public override ICompletionItemList GenerateCompletionList(ITextEditor editor)
{
CompletionInfo result = context.GetCompletionItems(
editor.FileName,
editor.Caret.Offset,
editor.Document.Text,
memberCompletion);
var itemList = new DefaultCompletionItemList();
if (result != null) {
var completionDetailsProvider = new CompletionEntryDetailsProvider(
context,
editor.FileName,
editor.Caret.Offset);
itemList.Items.AddRange(result.entries.Select(entry => new TypeScriptCompletionItem(entry, completionDetailsProvider)));
}
return itemList;
}
}
}
| mit | C# |
2556a3ff2386a28e6558fe3c67124750e1d4ac1d | change version | Sdzeng/Abp.TinyMapper | Abp.TinyMapper/Properties/AssemblyInfo.cs | Abp.TinyMapper/Properties/AssemblyInfo.cs | using Nelibur.ObjectMapper.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Abp.TinyMapper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Abp.TinyMapper")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("0b6149d6-ecf8-494c-87fb-fb77c45d91b4")]
//[assembly: InternalsVisibleTo(DynamicAssemblyBuilder.AssemblyName)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
// 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.
| using Nelibur.ObjectMapper.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Abp.TinyMapper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Abp.TinyMapper")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("0b6149d6-ecf8-494c-87fb-fb77c45d91b4")]
//[assembly: InternalsVisibleTo(DynamicAssemblyBuilder.AssemblyName)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// 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.
| mit | C# |
e73ea95a4d8a6aec85943e6d494ee656f1c089a8 | Change Cwd implementation | skarpdev/dotnet-version-cli | src/CsProj/FileSystem/DotNetFileSystemProvider.cs | src/CsProj/FileSystem/DotNetFileSystemProvider.cs | using System;
using System.Collections.Generic;
using System.IO;
namespace Skarpdev.DotnetVersion.CsProj.FileSystem
{
public class DotNetFileSystemProvider : IFileSystemProvider
{
/// <summary>
/// List the files of the given path
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public IEnumerable<string> List(string path)
{
return Directory.EnumerateFiles(path);
}
/// <summary>
/// Determines whether the given path is actually a csproj file
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public bool IsCsProjectFile(string path)
{
return File.Exists(path) && path.EndsWith(".csproj");
}
/// <summary>
/// Gets the current working directory of the running application
/// </summary>
/// <returns></returns>
public string Cwd()
{
return Directory.GetCurrentDirectory();
}
/// <summary>
/// Load content from the given file
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public string LoadContent(string filePath)
{
return File.ReadAllText(filePath);
}
}
} | using System;
using System.Collections.Generic;
using System.IO;
namespace Skarpdev.DotnetVersion.CsProj.FileSystem
{
public class DotNetFileSystemProvider : IFileSystemProvider
{
/// <summary>
/// List the files of the given path
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public IEnumerable<string> List(string path)
{
return Directory.EnumerateFiles(path);
}
/// <summary>
/// Determines whether the given path is actually a csproj file
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public bool IsCsProjectFile(string path)
{
return File.Exists(path) && path.EndsWith(".csproj");
}
/// <summary>
/// Gets the current working directory of the running application
/// </summary>
/// <returns></returns>
public string Cwd()
{
return System.AppContext.BaseDirectory;
}
/// <summary>
/// Load content from the given file
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public string LoadContent(string filePath)
{
return File.ReadAllText(filePath);
}
}
} | mit | C# |
564d6ba3291ddbff162a0997723a0423c85a0526 | Remove this test as the API is broken | stripe/stripe-dotnet,richardlawley/stripe.net | src/Stripe.net.Tests/account/account_behaviors.cs | src/Stripe.net.Tests/account/account_behaviors.cs | using Machine.Specifications;
namespace Stripe.Tests
{
[Behaviors]
public class account_behaviors
{
protected static StripeAccountSharedOptions CreateOrUpdateOptions;
protected static StripeAccount StripeAccount;
//It should_have_the_correct_email_address = () =>
// StripeAccount.Email.ShouldEqual(CreateOrUpdateOptions.Email);
It should_have_the_correct_business_info = () =>
{
StripeAccount.BusinessName.ShouldEqual(CreateOrUpdateOptions.BusinessName);
StripeAccount.BusinessPrimaryColor.ShouldEqual(CreateOrUpdateOptions.BusinessPrimaryColor);
StripeAccount.BusinessUrl.ShouldEqual(CreateOrUpdateOptions.BusinessUrl);
};
It should_have_the_correct_debit_negative_balances = () =>
StripeAccount.DebitNegativeBalances.ShouldEqual(CreateOrUpdateOptions.DebitNegativeBalances.Value);
It should_have_the_correct_default_currency = () =>
StripeAccount.DefaultCurrency.ShouldEqual(CreateOrUpdateOptions.DefaultCurrency);
}
}
| using Machine.Specifications;
namespace Stripe.Tests
{
[Behaviors]
public class account_behaviors
{
protected static StripeAccountSharedOptions CreateOrUpdateOptions;
protected static StripeAccount StripeAccount;
//It should_have_the_correct_email_address = () =>
// StripeAccount.Email.ShouldEqual(CreateOrUpdateOptions.Email);
It should_have_the_correct_business_info = () =>
{
StripeAccount.BusinessName.ShouldEqual(CreateOrUpdateOptions.BusinessName);
StripeAccount.BusinessPrimaryColor.ShouldEqual(CreateOrUpdateOptions.BusinessPrimaryColor);
StripeAccount.BusinessUrl.ShouldEqual(CreateOrUpdateOptions.BusinessUrl);
};
It should_have_the_correct_debit_negative_balances = () =>
StripeAccount.DebitNegativeBalances.ShouldEqual(CreateOrUpdateOptions.DebitNegativeBalances.Value);
It should_have_the_correct_decline_charge_values = () =>
{
StripeAccount.DeclineChargeOn.AvsFailure.ShouldEqual(CreateOrUpdateOptions.DeclineChargeOnAvsFailure.Value);
StripeAccount.DeclineChargeOn.CvcFailure.ShouldEqual(CreateOrUpdateOptions.DeclineChargeOnCvcFailure.Value);
};
It should_have_the_correct_default_currency = () =>
StripeAccount.DefaultCurrency.ShouldEqual(CreateOrUpdateOptions.DefaultCurrency);
}
}
| apache-2.0 | C# |
0affe7b79d338e808f001476af5b2ae5cee89293 | Remove unnecessary using | peppy/osu,ppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu | osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs | osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.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 osuTK;
using osu.Game.Audio;
using System.Collections.Generic;
namespace osu.Game.Rulesets.Objects.Legacy.Mania
{
/// <summary>
/// A HitObjectParser to parse legacy osu!mania Beatmaps.
/// </summary>
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
{
public ConvertHitObjectParser(double offset, int formatVersion)
: base(offset, formatVersion)
{
}
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{
return new ConvertHit
{
X = position.X
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, PathControlPoint[] controlPoints, double? length, int repeatCount,
IList<IList<HitSampleInfo>> nodeSamples)
{
return new ConvertSlider
{
X = position.X,
Path = new SliderPath(controlPoints, length),
NodeSamples = nodeSamples,
RepeatCount = repeatCount
};
}
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
{
return new ConvertSpinner
{
X = position.X,
Duration = duration
};
}
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
{
return new ConvertHold
{
X = position.X,
Duration = duration
};
}
}
}
| // 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 osuTK;
using osu.Game.Audio;
using System.Collections.Generic;
using osu.Framework.Bindables;
namespace osu.Game.Rulesets.Objects.Legacy.Mania
{
/// <summary>
/// A HitObjectParser to parse legacy osu!mania Beatmaps.
/// </summary>
public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser
{
public ConvertHitObjectParser(double offset, int formatVersion)
: base(offset, formatVersion)
{
}
protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset)
{
return new ConvertHit
{
X = position.X
};
}
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, PathControlPoint[] controlPoints, double? length, int repeatCount,
IList<IList<HitSampleInfo>> nodeSamples)
{
return new ConvertSlider
{
X = position.X,
Path = new SliderPath(controlPoints, length),
NodeSamples = nodeSamples,
RepeatCount = repeatCount
};
}
protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double duration)
{
return new ConvertSpinner
{
X = position.X,
Duration = duration
};
}
protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double duration)
{
return new ConvertHold
{
X = position.X,
Duration = duration
};
}
}
}
| mit | C# |
7016803f7d2af9597781f66b6ff06c655b0781c4 | Revert exposing Capture.Text (#27669) | mmitche/corefx,ericstj/corefx,shimingsg/corefx,shimingsg/corefx,ViktorHofer/corefx,wtgodbe/corefx,shimingsg/corefx,ptoonen/corefx,shimingsg/corefx,ptoonen/corefx,BrennanConroy/corefx,ViktorHofer/corefx,ericstj/corefx,ptoonen/corefx,BrennanConroy/corefx,ViktorHofer/corefx,ptoonen/corefx,Jiayili1/corefx,Jiayili1/corefx,ericstj/corefx,wtgodbe/corefx,mmitche/corefx,ViktorHofer/corefx,ericstj/corefx,shimingsg/corefx,shimingsg/corefx,shimingsg/corefx,ptoonen/corefx,mmitche/corefx,wtgodbe/corefx,Jiayili1/corefx,ptoonen/corefx,wtgodbe/corefx,BrennanConroy/corefx,Jiayili1/corefx,ptoonen/corefx,Jiayili1/corefx,mmitche/corefx,wtgodbe/corefx,mmitche/corefx,ViktorHofer/corefx,mmitche/corefx,ericstj/corefx,ericstj/corefx,Jiayili1/corefx,wtgodbe/corefx,ViktorHofer/corefx,ericstj/corefx,Jiayili1/corefx,ViktorHofer/corefx,wtgodbe/corefx,mmitche/corefx | src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Capture.cs | src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Capture.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.
// Capture is just a location/length pair that indicates the
// location of a regular expression match. A single regexp
// search may return multiple Capture within each capturing
// RegexGroup.
namespace System.Text.RegularExpressions
{
/// <summary>
/// Represents the results from a single subexpression capture. The object represents
/// one substring for a single successful capture.
/// </summary>
public class Capture
{
internal Capture(string text, int index, int length)
{
Text = text;
Index = index;
Length = length;
}
/// <summary>
/// Returns the position in the original string where the first character of
/// captured substring was found.
/// </summary>
public int Index { get; private protected set; }
/// <summary>
/// Returns the length of the captured substring.
/// </summary>
public int Length { get; private protected set; }
/// <summary>
/// The original string
/// </summary>
internal string Text { get; private protected set; }
/// <summary>
/// Returns the value of this Regex Capture.
/// </summary>
public string Value => Text.Substring(Index, Length);
/// <summary>
/// Returns the substring that was matched.
/// </summary>
public override string ToString() => Value;
/// <summary>
/// The substring to the left of the capture
/// </summary>
internal ReadOnlySpan<char> GetLeftSubstring() => Text.AsSpan(0, Index);
/// <summary>
/// The substring to the right of the capture
/// </summary>
internal ReadOnlySpan<char> GetRightSubstring() => Text.AsSpan(Index + Length, Text.Length - Index - Length);
}
}
| // 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.
// Capture is just a location/length pair that indicates the
// location of a regular expression match. A single regexp
// search may return multiple Capture within each capturing
// RegexGroup.
namespace System.Text.RegularExpressions
{
/// <summary>
/// Represents the results from a single subexpression capture. The object represents
/// one substring for a single successful capture.
/// </summary>
public class Capture
{
internal Capture(string text, int index, int length)
{
Text = text;
Index = index;
Length = length;
}
/// <summary>
/// Returns the position in the original string where the first character of
/// captured substring was found.
/// </summary>
public int Index { get; private protected set; }
/// <summary>
/// Returns the length of the captured substring.
/// </summary>
public int Length { get; private protected set; }
/// <summary>
/// The original string
/// </summary>
public string Text { get; private protected set; }
/// <summary>
/// Returns the value of this Regex Capture.
/// </summary>
public string Value => Text.Substring(Index, Length);
/// <summary>
/// Returns the substring that was matched.
/// </summary>
public override string ToString() => Value;
/// <summary>
/// The substring to the left of the capture
/// </summary>
internal ReadOnlySpan<char> GetLeftSubstring() => Text.AsSpan(0, Index);
/// <summary>
/// The substring to the right of the capture
/// </summary>
internal ReadOnlySpan<char> GetRightSubstring() => Text.AsSpan(Index + Length, Text.Length - Index - Length);
}
}
| mit | C# |
d751a0a69484fba49d429129c8c60c61447346b3 | Add icons font | maximegelinas-cegepsth/GEC-strawberry-sass,maximegelinas-cegepsth/GEC-strawberry-sass | StrawberrySass/src/StrawberrySass/UI/Shared/_Layout.cshtml | StrawberrySass/src/StrawberrySass/UI/Shared/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<base href="@ViewData["BaseUrl"]">
<title>@ViewData["Title"] - StrawberrySass</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="https://cdn.rawgit.com/strawberrysass/strawberry-branding/master/favicons/favicon.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="/Vendor/@@angular2-material/core/overlay/overlay.css" rel="stylesheet">
<link href="/Shared/Assets/Main.css" rel="stylesheet" />
@RenderSection("styles", required: false)
</head>
<body>
<app-layout>
@RenderBody()
</app-layout>
<script src="/Vendor/zone.js/dist/zone.min.js"></script>
<script src="/Vendor/reflect-metadata/Reflect.js"></script>
<script src="/Vendor/systemjs/dist/system.src.js"></script>
<script src="/Vendor/hammerjs/hammer.min.js"></script>
@RenderSection("scripts", required: false)
<script src="SystemJsConfig.js"></script>
<script>
System.import('app').catch(function (err) { console.error(err); });
</script>
</body>
</html> | <!DOCTYPE html>
<html>
<head>
<base href="@ViewData["BaseUrl"]">
<title>@ViewData["Title"] - StrawberrySass</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="https://cdn.rawgit.com/strawberrysass/strawberry-branding/master/favicons/favicon.ico" type="image/x-icon" />
<link href="/Vendor/@@angular2-material/core/overlay/overlay.css" rel="stylesheet" />
<link href="/Shared/Assets/Main.css" rel="stylesheet" />
@RenderSection("styles", required: false)
</head>
<body>
<app-layout>
@RenderBody()
</app-layout>
<script src="/Vendor/zone.js/dist/zone.min.js"></script>
<script src="/Vendor/reflect-metadata/Reflect.js"></script>
<script src="/Vendor/systemjs/dist/system.src.js"></script>
<script src="/Vendor/hammerjs/hammer.min.js"></script>
@RenderSection("scripts", required: false)
<script src="SystemJsConfig.js"></script>
<script>
System.import('app').catch(function (err) { console.error(err); });
</script>
</body>
</html> | mit | C# |
be7319a8b728d0a299712a7419dea8696bc8f377 | Fix onRemove not being called in Selector.Clear | SnpM/Lockstep-Framework,erebuswolf/LockstepFramework,yanyiyun/LockstepFramework | Core/Game/Player/Utility/Selector.cs | Core/Game/Player/Utility/Selector.cs | using UnityEngine;
using System;
namespace Lockstep {
public static class Selector {
public static event Action onChange;
public static event Action onAdd;
public static event Action onRemove;
private static LSAgent _mainAgent;
static Selector () {
onAdd += Change;
onRemove += Change;
}
private static void Change () {
if (onChange != null)
onChange();
}
public static LSAgent MainSelectedAgent {get {return _mainAgent;}
private set{
_mainAgent = value;
}
}
private static FastSorter<LSAgent> SelectedAgents;
public static void Initialize (){
}
public static void Add(LSAgent agent) {
agent.Controller.AddToSelection (agent);
agent.IsSelected = true;
if (MainSelectedAgent == null) MainSelectedAgent = agent;
onAdd ();
}
public static void Remove(LSAgent agent) {
agent.Controller.RemoveFromSelection (agent);
agent.IsSelected = false;
if (agent == MainSelectedAgent) {
agent = SelectedAgents.Count > 0 ? SelectedAgents.PopMax () : null;
}
onRemove ();
}
public static void Clear() {
for (int i = 0; i < PlayerManager.AgentControllerCount; i++)
{
FastBucket<LSAgent> selectedAgents = PlayerManager.AgentControllers[i].SelectedAgents;
for (int j = 0; j < selectedAgents.PeakCount; j++) {
if (selectedAgents.arrayAllocation[j]) {
selectedAgents[j].IsSelected = false;
}
}
selectedAgents.FastClear ();
}
MainSelectedAgent = null;
onRemove ();
}
}
} | using UnityEngine;
using System;
namespace Lockstep {
public static class Selector {
public static event Action onChange;
public static event Action onAdd;
public static event Action onRemove;
private static LSAgent _mainAgent;
static Selector () {
onAdd += Change;
onRemove += Change;
}
private static void Change () {
if (onChange != null)
onChange();
}
public static LSAgent MainSelectedAgent {get {return _mainAgent;}
private set{
_mainAgent = value;
}
}
private static FastSorter<LSAgent> SelectedAgents;
public static void Initialize (){
}
public static void Add(LSAgent agent) {
agent.Controller.AddToSelection (agent);
agent.IsSelected = true;
if (MainSelectedAgent == null) MainSelectedAgent = agent;
onAdd ();
}
public static void Remove(LSAgent agent) {
agent.Controller.RemoveFromSelection (agent);
agent.IsSelected = false;
if (agent == MainSelectedAgent) {
agent = SelectedAgents.Count > 0 ? SelectedAgents.PopMax () : null;
}
onRemove ();
}
public static void Clear() {
for (int i = 0; i < PlayerManager.AgentControllerCount; i++)
{
FastBucket<LSAgent> selectedAgents = PlayerManager.AgentControllers[i].SelectedAgents;
for (int j = 0; j < selectedAgents.PeakCount; j++) {
if (selectedAgents.arrayAllocation[j]) {
selectedAgents[j].IsSelected = false;
}
}
selectedAgents.FastClear ();
}
MainSelectedAgent = null;
}
}
} | mit | C# |
706d2ad17f3cb1bfd4080f31fb4f9497ba0ef31a | increase version number to 0.2.0.0 | ChrisDeadman/KSPPartRemover | KSPPartRemover/Properties/AssemblyInfo.cs | KSPPartRemover/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("KSPPartRemover")]
[assembly: AssemblyDescription("Removes parts from KSP save files")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Deadman")]
[assembly: AssemblyProduct("KSPPartRemover")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7e074eb8-495e-4401-afc9-9608b11403c3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KSPPartRemover")]
[assembly: AssemblyDescription("Removes parts from KSP save files")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Deadman")]
[assembly: AssemblyProduct("KSPPartRemover")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7e074eb8-495e-4401-afc9-9608b11403c3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
| mit | C# |
7138d46b252ae9e174c76050882548f8aee70e90 | Enforce HTTPS (Disable) | WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework | Framework/Server/StartupFramework.cs | Framework/Server/StartupFramework.cs | namespace Framework.Server
{
using Framework.Config;
using Framework.DataAccessLayer.DatabaseMemory;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using System;
/// <summary>
/// ASP.NET Core configuration.
/// </summary>
public static class StartupFramework
{
public static void ConfigureServices(IServiceCollection services)
{
// Dependency Injection DI. See also https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.1
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); // Needed for IIS. Otherwise new HttpContextAccessor(); results in null reference exception.
services.AddSingleton<DatabaseMemoryInternal>();
services.AddDistributedMemoryCache();
services.AddSession(options =>
{
options.Cookie.Name = "FrameworkSession";
options.IdleTimeout = TimeSpan.FromSeconds(60);
});
}
public static void Configure(IApplicationBuilder applicationBuilder)
{
UtilServer.ApplicationBuilder = applicationBuilder;
if (UtilServer.IsIssServer == false)
{
// Running in Visual Studio environment.
if (ConfigServer.Load().IsServerSideRendering)
{
UtilServer.StartUniversalServer();
}
}
if (ConfigServer.Load().IsUseDeveloperExceptionPage)
{
applicationBuilder.UseDeveloperExceptionPage();
}
applicationBuilder.UseDefaultFiles(); // Used for index.html
applicationBuilder.UseStaticFiles(); // Enable access to files in folder wwwwroot.
applicationBuilder.UseSession();
// Enforce HTTPS in ASP.NET Core https://docs.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-5.0&tabs=visual-studio
// applicationBuilder.UseHsts();
// applicationBuilder.UseHttpsRedirection();
applicationBuilder.Run(new Request().RunAsync);
}
}
}
| namespace Framework.Server
{
using Framework.Config;
using Framework.DataAccessLayer.DatabaseMemory;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using System;
/// <summary>
/// ASP.NET Core configuration.
/// </summary>
public static class StartupFramework
{
public static void ConfigureServices(IServiceCollection services)
{
// Dependency Injection DI. See also https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.1
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); // Needed for IIS. Otherwise new HttpContextAccessor(); results in null reference exception.
services.AddSingleton<DatabaseMemoryInternal>();
services.AddDistributedMemoryCache();
services.AddSession(options =>
{
options.Cookie.Name = "FrameworkSession";
options.IdleTimeout = TimeSpan.FromSeconds(60);
});
}
public static void Configure(IApplicationBuilder applicationBuilder)
{
UtilServer.ApplicationBuilder = applicationBuilder;
if (UtilServer.IsIssServer == false)
{
// Running in Visual Studio environment.
if (ConfigServer.Load().IsServerSideRendering)
{
UtilServer.StartUniversalServer();
}
}
if (ConfigServer.Load().IsUseDeveloperExceptionPage)
{
applicationBuilder.UseDeveloperExceptionPage();
}
applicationBuilder.UseDefaultFiles(); // Used for index.html
applicationBuilder.UseStaticFiles(); // Enable access to files in folder wwwwroot.
applicationBuilder.UseSession();
// Enforce HTTPS in ASP.NET Core https://docs.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-5.0&tabs=visual-studio
applicationBuilder.UseHsts();
applicationBuilder.UseHttpsRedirection();
applicationBuilder.Run(new Request().RunAsync);
}
}
}
| mit | C# |
5e56100cf7049b99c6058ef59fe745df25493403 | use Mean() method in Accord.NET instead of IEnumerable.Average() | y-takashina/HtmZetaOne | HtmZetaOne/Sampling.cs | HtmZetaOne/Sampling.cs | using System.Collections.Generic;
using System.Linq;
using Accord.MachineLearning;
using Accord.Statistics;
namespace HtmZetaOne
{
public static class Sampling
{
public static double[] CalcSamplePoints(IEnumerable<double> data, int n)
{
var array = data.Where(v => !double.IsNaN(v)).ToArray();
var average = array.Mean();
var stddev = array.StandardDeviation();
var min = average - 3 * stddev;
var max = average + 3 * stddev;
var interval = (max - min) / n;
var points = Enumerable.Range(0, n).Select(i => max - i * interval).ToArray();
points[0] = average + 4 * stddev;
points[n - 1] = average - 4 * stddev;
return points;
}
public static double[] KMeansSampling(IEnumerable<double> data, int k)
{
var model = new KMeans(k) {UseSeeding = Seeding.Uniform};
model.Learn(data.Select(v => new[] {v}).ToArray());
return model.Clusters.Centroids.Select(vector => vector.First()).ToArray();
}
}
} | using System.Collections.Generic;
using System.Linq;
using Accord.MachineLearning;
using Accord.Statistics;
namespace HtmZetaOne
{
public static class Sampling
{
public static double[] CalcSamplePoints(IEnumerable<double> data, int n)
{
var array = data.Where(v => !double.IsNaN(v)).ToArray();
var average = array.Average();
var stddev = array.StandardDeviation();
var min = average - 3 * stddev;
var max = average + 3 * stddev;
var interval = (max - min) / n;
var points = Enumerable.Range(0, n).Select(i => max - i * interval).ToArray();
points[0] = average + 4 * stddev;
points[n - 1] = average - 4 * stddev;
return points;
}
public static double[] KMeansSampling(IEnumerable<double> data, int k)
{
var model = new KMeans(k) {UseSeeding = Seeding.Uniform};
model.Learn(data.Select(v => new[] {v}).ToArray());
return model.Clusters.Centroids.Select(vector => vector.First()).ToArray();
}
}
} | mit | C# |
1a5d2dbb1c4f82c9589f9bb369cee0441f744e1c | Fix delete | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | Battery-Commander.Web/Views/Reports/Index.cshtml | Battery-Commander.Web/Views/Reports/Index.cshtml | @model Unit
@{
ViewBag.Title = "Reports";
}
<h2>@ViewBag.Reports</h2>
@Html.ActionLink("Add", "Add", new { ViewBag.UnitId })
<div>
<table class="table table striped">
@foreach (var report in Model.ReportSettings)
{
<tr>
<td>@report.Type</td>
<td><a href="mailto:@report.From.EmailAddress">@report.From.Name</a></td>
<td>
<td>
@using (Html.BeginForm("Toggle", "Reports", FormMethod.Post))
{
@Html.Hidden("Type", report.Type)
@Html.Hidden("UnitId", Model.Id)
@Html.Hidden("Enable", !report.Enabled)
<button type="submit">@(report.Enabled ? "Disable" : "Enable")</button>
}
</td>
<td>
<ul>
@foreach (var recipient in report.Recipients)
{
<li><a href="mailto:@recipient.EmailAddress">@recipient.Name</a></li>
}
</ul>
</td>
<td>
@using (Html.BeginForm("Delete", "Reports", FormMethod.Post))
{
@Html.Hidden("UnitId", (int)ViewBag.Unitid)
@Html.Hidden("Type", report.Type)
<button type="submit">Delete</button>
}
</td>
</tr>
}
</table>
</div> | @model Unit
@{
ViewBag.Title = "Reports";
}
<h2>@ViewBag.Reports</h2>
@Html.ActionLink("Add", "Add", new { ViewBag.UnitId })
<div>
<table class="table table striped">
@foreach (var report in Model.ReportSettings)
{
<tr>
<td>@report.Type</td>
<td><a href="mailto:@report.From.EmailAddress">@report.From.Name</a></td>
<td>
<td>
@using (Html.BeginForm("Toggle", "Reports", FormMethod.Post))
{
@Html.Hidden("Type", report.Type)
@Html.Hidden("UnitId", Model.Id)
@Html.Hidden("Enable", !report.Enabled)
<button type="submit">@(report.Enabled ? "Disable" : "Enable")</button>
}
</td>
<td>
<ul>
@foreach (var recipient in report.Recipients)
{
<li><a href="mailto:@recipient.EmailAddress">@recipient.Name</a></li>
}
</ul>
</td>
<td>
@using (Html.BeginForm("Delete", "Reports", FormMethod.Post, new { report.Type, ViewBag.UnitId }))
{
<button type="submit">Delete</button>
}
</td>
</tr>
}
</table>
</div> | mit | C# |
be340d4ba4181bafdba189078b6f698012fdb0c3 | Fix the typo. | berdankoca/aspnetboilerplate,luchaoshuai/aspnetboilerplate,berdankoca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,beratcarsi/aspnetboilerplate,ilyhacker/aspnetboilerplate,oceanho/aspnetboilerplate,Nongzhsh/aspnetboilerplate,zclmoon/aspnetboilerplate,ilyhacker/aspnetboilerplate,4nonym0us/aspnetboilerplate,fengyeju/aspnetboilerplate,verdentk/aspnetboilerplate,zquans/aspnetboilerplate,zclmoon/aspnetboilerplate,oceanho/aspnetboilerplate,verdentk/aspnetboilerplate,luchaoshuai/aspnetboilerplate,lemestrez/aspnetboilerplate,4nonym0us/aspnetboilerplate,jaq316/aspnetboilerplate,4nonym0us/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,s-takatsu/aspnetboilerplate,oceanho/aspnetboilerplate,andmattia/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,virtualcca/aspnetboilerplate,lvjunlei/aspnetboilerplate,690486439/aspnetboilerplate,ryancyq/aspnetboilerplate,690486439/aspnetboilerplate,fengyeju/aspnetboilerplate,zquans/aspnetboilerplate,zquans/aspnetboilerplate,andmattia/aspnetboilerplate,ShiningRush/aspnetboilerplate,ZhaoRd/aspnetboilerplate,yuzukwok/aspnetboilerplate,AlexGeller/aspnetboilerplate,Nongzhsh/aspnetboilerplate,yuzukwok/aspnetboilerplate,AlexGeller/aspnetboilerplate,jaq316/aspnetboilerplate,virtualcca/aspnetboilerplate,SXTSOFT/aspnetboilerplate,zclmoon/aspnetboilerplate,Nongzhsh/aspnetboilerplate,SXTSOFT/aspnetboilerplate,lvjunlei/aspnetboilerplate,AlexGeller/aspnetboilerplate,ryancyq/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,s-takatsu/aspnetboilerplate,SXTSOFT/aspnetboilerplate,s-takatsu/aspnetboilerplate,ZhaoRd/aspnetboilerplate,690486439/aspnetboilerplate,verdentk/aspnetboilerplate,jaq316/aspnetboilerplate,carldai0106/aspnetboilerplate,andmattia/aspnetboilerplate,beratcarsi/aspnetboilerplate,fengyeju/aspnetboilerplate,yuzukwok/aspnetboilerplate,virtualcca/aspnetboilerplate,lemestrez/aspnetboilerplate,carldai0106/aspnetboilerplate,lvjunlei/aspnetboilerplate,lemestrez/aspnetboilerplate,ryancyq/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,ShiningRush/aspnetboilerplate,carldai0106/aspnetboilerplate,ShiningRush/aspnetboilerplate,berdankoca/aspnetboilerplate,beratcarsi/aspnetboilerplate,carldai0106/aspnetboilerplate,ZhaoRd/aspnetboilerplate,ilyhacker/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate | src/Abp/Configuration/Startup/LocalizationConfiguration.cs | src/Abp/Configuration/Startup/LocalizationConfiguration.cs | using System.Collections.Generic;
using Abp.Localization;
namespace Abp.Configuration.Startup
{
/// <summary>
/// Used for localization configurations.
/// </summary>
internal class LocalizationConfiguration : ILocalizationConfiguration
{
/// <inheritdoc/>
public IList<LanguageInfo> Languages { get; private set; }
/// <inheritdoc/>
public ILocalizationSourceList Sources { get; private set; }
/// <inheritdoc/>
public bool IsEnabled { get; set; }
/// <inheritdoc/>
public bool ReturnGivenTextIfNotFound { get; set; }
/// <inheritdoc/>
public bool WrapGivenTextIfNotFound { get; set; }
/// <inheritdoc/>
public bool HumanizeTextIfNotFound { get; set; }
public LocalizationConfiguration()
{
Languages = new List<LanguageInfo>();
Sources = new LocalizationSourceList();
IsEnabled = true;
ReturnGivenTextIfNotFound = true;
WrapGivenTextIfNotFound = false;
HumanizeTextIfNotFound = true;
}
}
} | using System.Collections.Generic;
using Abp.Localization;
namespace Abp.Configuration.Startup
{
/// <summary>
/// Used for localization configurations.
/// </summary>
internal class LocalizationConfiguration : ILocalizationConfiguration
{
/// <inheritdoc/>
public IList<LanguageInfo> Languages { get; private set; }
/// <inheritdoc/>
public ILocalizationSourceList Sources { get; private set; }
/// <inheritdoc/>
public bool IsEnabled { get; set; }
/// <inheritdoc/>
public bool ReturnGivenTextIfNotFound { get; set; }
/// <inheritdoc/>
public bool WrapGivenTextIfNotFound { get; set; }
/// <inheritdoc/>
public bool HumanizeTextIfNotFound { get; set; }
public LocalizationConfiguration()
{
Languages = new List<LanguageInfo>();
Sources = new LocalizationSourceList();
IsEnabled = true;
ReturnGivenTextIfNotFound = true;
WrapGivenTextIfNotFound = false;
HumanizeTextIfNotFound = false;
}
}
} | mit | C# |
81d3832e584503d782641dfac8810b42c2b28d37 | Use autoproperty for CellRangeReference.Range | ClosedXML/ClosedXML,igitur/ClosedXML | ClosedXML/Excel/CalcEngine/CellRangeReference.cs | ClosedXML/Excel/CalcEngine/CellRangeReference.cs | using System;
using System.Collections;
namespace ClosedXML.Excel.CalcEngine
{
internal class CellRangeReference : IValueObject, IEnumerable
{
private readonly XLCalcEngine _ce;
public CellRangeReference(IXLRange range, XLCalcEngine ce)
{
Range = range;
_ce = ce;
}
public IXLRange Range { get; }
// ** IValueObject
public object GetValue()
{
return GetValue(Range.FirstCell());
}
// ** IEnumerable
public IEnumerator GetEnumerator()
{
var maxRow = Math.Min(Range.RangeAddress.LastAddress.RowNumber, Range.Worksheet.LastCellUsed().Address.RowNumber);
var maxCol = Math.Min(Range.RangeAddress.LastAddress.ColumnNumber, Range.Worksheet.LastCellUsed().Address.ColumnNumber);
var trimmedRange = (XLRangeBase)Range.Worksheet.Range(Range.FirstCell().Address,
new XLAddress(maxRow, maxCol, false, false));
return trimmedRange.CellValues().GetEnumerator();
}
private Boolean _evaluating;
// ** implementation
private object GetValue(IXLCell cell)
{
if (_evaluating || (cell as XLCell).IsEvaluating)
{
throw new InvalidOperationException($"Circular Reference occured during evaluation. Cell: {cell.Address.ToString(XLReferenceStyle.Default, true)}");
}
try
{
_evaluating = true;
var f = cell.FormulaA1;
if (String.IsNullOrWhiteSpace(f))
return cell.Value;
else
{
return (cell as XLCell).Evaluate();
}
}
finally
{
_evaluating = false;
}
}
}
}
| using System;
using System.Collections;
namespace ClosedXML.Excel.CalcEngine
{
internal class CellRangeReference : IValueObject, IEnumerable
{
private IXLRange _range;
private XLCalcEngine _ce;
public CellRangeReference(IXLRange range, XLCalcEngine ce)
{
_range = range;
_ce = ce;
}
public IXLRange Range { get { return _range; } }
// ** IValueObject
public object GetValue()
{
return GetValue(_range.FirstCell());
}
// ** IEnumerable
public IEnumerator GetEnumerator()
{
var maxRow = Math.Min(_range.RangeAddress.LastAddress.RowNumber, _range.Worksheet.LastCellUsed().Address.RowNumber);
var maxCol = Math.Min(_range.RangeAddress.LastAddress.ColumnNumber, _range.Worksheet.LastCellUsed().Address.ColumnNumber);
var trimmedRange = (XLRangeBase) _range.Worksheet.Range(_range.FirstCell().Address,
new XLAddress(maxRow, maxCol, false, false));
return trimmedRange.CellValues().GetEnumerator();
}
private Boolean _evaluating;
// ** implementation
private object GetValue(IXLCell cell)
{
if (_evaluating || (cell as XLCell).IsEvaluating)
{
throw new InvalidOperationException($"Circular Reference occured during evaluation. Cell: {cell.Address.ToString(XLReferenceStyle.Default, true)}");
}
try
{
_evaluating = true;
var f = cell.FormulaA1;
if (String.IsNullOrWhiteSpace(f))
return cell.Value;
else
{
return (cell as XLCell).Evaluate();
}
}
finally
{
_evaluating = false;
}
}
}
}
| mit | C# |
62661dd6bed94e3d00c45919f9ef02c329d19f6b | Update CSharpGeneratorSettings.cs | RSuter/NJsonSchema,NJsonSchema/NJsonSchema | src/NJsonSchema.CodeGeneration/CSharp/CSharpGeneratorSettings.cs | src/NJsonSchema.CodeGeneration/CSharp/CSharpGeneratorSettings.cs | //-----------------------------------------------------------------------
// <copyright file="CSharpGeneratorSettings.cs" company="NJsonSchema">
// Copyright (c) Rico Suter. All rights reserved.
// </copyright>
// <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license>
// <author>Rico Suter, mail@rsuter.com</author>
//-----------------------------------------------------------------------
namespace NJsonSchema.CodeGeneration.CSharp
{
/// <summary>The generator settings.</summary>
public class CSharpGeneratorSettings
{
/// <summary>Initializes a new instance of the <see cref="CSharpGeneratorSettings"/> class.</summary>
public CSharpGeneratorSettings()
{
DateTimeType = "DateTime";
ArrayType = "ObservableCollection";
DictionaryType = "Dictionary";
RequiredPropertiesMustBeDefined = true;
ClassStyle = CSharpClassStyle.Inpc;
}
/// <summary>Gets or sets the .NET namespace of the generated types.</summary>
public string Namespace { get; set; }
/// <summary>Gets or sets a value indicating whether a required property must be defined in JSON
/// (sets Required.Always when the property is required) (default: true).</summary>
public bool RequiredPropertiesMustBeDefined { get; set; }
/// <summary>Gets or sets the date time .NET type (default: 'DateTime').</summary>
public string DateTimeType { get; set; }
/// <summary>Gets or sets the generic array .NET type (default: 'ObservableCollection').</summary>
public string ArrayType { get; set; }
/// <summary>Gets or sets the generic dictionary .NET type (default: 'Dictionary').</summary>
public string DictionaryType { get; set; }
/// <summary>Gets or sets the CSharp class style (default: 'Poco').</summary>
public CSharpClassStyle ClassStyle { get; set; }
}
}
| //-----------------------------------------------------------------------
// <copyright file="CSharpGeneratorSettings.cs" company="NJsonSchema">
// Copyright (c) Rico Suter. All rights reserved.
// </copyright>
// <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license>
// <author>Rico Suter, mail@rsuter.com</author>
//-----------------------------------------------------------------------
namespace NJsonSchema.CodeGeneration.CSharp
{
/// <summary>The generator settings.</summary>
public class CSharpGeneratorSettings
{
/// <summary>Initializes a new instance of the <see cref="CSharpGeneratorSettings"/> class.</summary>
public CSharpGeneratorSettings()
{
DateTimeType = "DateTime";
ArrayType = "ObservableCollection";
DictionaryType = "Dictionary";
RequiredPropertiesMustBeDefined = true;
ClassStyle = CSharpClassStyle.Inpc;
}
/// <summary>Gets or sets the namespace.</summary>
public string Namespace { get; set; }
/// <summary>Gets or sets a value indicating whether a required property must be defined in JSON
/// (sets Required.Always when the property is required) (default: true).</summary>
public bool RequiredPropertiesMustBeDefined { get; set; }
/// <summary>Gets or sets the date time .NET type (default: 'DateTime').</summary>
public string DateTimeType { get; set; }
/// <summary>Gets or sets the generic array .NET type (default: 'ObservableCollection').</summary>
public string ArrayType { get; set; }
/// <summary>Gets or sets the generic dictionary .NET type (default: 'Dictionary').</summary>
public string DictionaryType { get; set; }
/// <summary>Gets or sets the CSharp class style (default: 'Poco').</summary>
public CSharpClassStyle ClassStyle { get; set; }
}
} | mit | C# |
7588b9812eefbcc83ad3f08186611d2fe1977dee | increase version number | gigya/microdot | Gigya.ServiceContract/Properties/AssemblyInfo.cs | Gigya.ServiceContract/Properties/AssemblyInfo.cs | #region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER 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 HOLDER 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.
#endregion
using System;
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("Gigya.ServiceContract")]
[assembly: AssemblyProduct("Gigya.ServiceContract")]
[assembly: InternalsVisibleTo("Gigya.Microdot.ServiceProxy")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("db6d3561-835e-40d5-b9d4-83951cf426df")]
[assembly: AssemblyCompany("Gigya")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyInformationalVersion("2.4.11")]// if pre-release should be in the format of "2.4.11-pre01".
[assembly: AssemblyVersion("2.4.11")]
[assembly: AssemblyFileVersion("2.4.11")]
[assembly: AssemblyDescription("")]
// 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)]
[assembly: CLSCompliant(false)] | #region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER 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 HOLDER 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.
#endregion
using System;
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("Gigya.ServiceContract")]
[assembly: AssemblyProduct("Gigya.ServiceContract")]
[assembly: InternalsVisibleTo("Gigya.Microdot.ServiceProxy")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("db6d3561-835e-40d5-b9d4-83951cf426df")]
[assembly: AssemblyCompany("Gigya")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyInformationalVersion("2.4.10")]// if pre-release should be in the format of "2.4.11-pre01".
[assembly: AssemblyVersion("2.4.10")]
[assembly: AssemblyFileVersion("2.4.10")]
[assembly: AssemblyDescription("")]
// 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)]
[assembly: CLSCompliant(false)] | apache-2.0 | C# |
f86c5e676932f899b28fdc1efd7e72ec7e7ca342 | Revert "Revert "Force fix for new databases"" | Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,stevenhillcox/voting-application,tpkelly/voting-application,stevenhillcox/voting-application,stevenhillcox/voting-application,Generic-Voting-Application/voting-application,tpkelly/voting-application,Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,JDawes-ScottLogic/voting-application,tpkelly/voting-application | VotingApplication/VotingApplication.Web.Api/Global.asax.cs | VotingApplication/VotingApplication.Web.Api/Global.asax.cs | using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Newtonsoft.Json;
using VotingApplication.Data.Context;
using VotingApplication.Web.Api.Migrations;
namespace VotingApplication.Web.Api
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
// Fix the infinite recursion of Session.OptionSet.Options[0].OptionSets[0].Options[0].[...]
// by not populating the Option.OptionSets after already encountering Session.OptionSet
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
//Enable automatic migrations
//Database.SetInitializer(new MigrateDatabaseToLatestVersion<VotingContext, Configuration>());
//new VotingContext().Database.Initialize(false);
}
}
}
| using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Newtonsoft.Json;
using VotingApplication.Data.Context;
using VotingApplication.Web.Api.Migrations;
namespace VotingApplication.Web.Api
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
// Fix the infinite recursion of Session.OptionSet.Options[0].OptionSets[0].Options[0].[...]
// by not populating the Option.OptionSets after already encountering Session.OptionSet
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
//Enable automatic migrations
Database.SetInitializer(new MigrateDatabaseToLatestVersion<VotingContext, Configuration>());
new VotingContext().Database.Initialize(false);
}
}
}
| apache-2.0 | C# |
3ec91c58b823d3f4c8ff6afe0c2a0d5aa1a09be7 | Fix NPE where saveData was accessed before being initialized | edwardrowe/unity-custom-tool-example | Assets/PrimativeCreator/Editor/PrimitiveCreatorSaveData.cs | Assets/PrimativeCreator/Editor/PrimitiveCreatorSaveData.cs | namespace RedBlueGames.ToolsExamples
{
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PrimitiveCreatorSaveData : ScriptableObject
{
public List<PrimitiveCreator.Config> ConfigPresets;
private void OnEnable()
{
if (this.ConfigPresets == null)
{
this.ConfigPresets = new List<PrimitiveCreator.Config>();
}
}
public bool HasConfigForIndex(int index)
{
if (this.ConfigPresets == null || this.ConfigPresets.Count == 0)
{
return false;
}
return index >= 0 && index < this.ConfigPresets.Count;
}
}
} | namespace RedBlueGames.ToolsExamples
{
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PrimitiveCreatorSaveData : ScriptableObject
{
public List<PrimitiveCreator.Config> ConfigPresets;
public bool HasConfigForIndex(int index)
{
if (this.ConfigPresets == null || this.ConfigPresets.Count == 0)
{
return false;
}
return index >= 0 && index < this.ConfigPresets.Count;
}
}
} | mit | C# |
b008a86d8c0904a05a847ea27101c98a3336a825 | Remove unused using statement | smoogipoo/osu,peppy/osu,peppy/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu | osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs | osu.Game.Tournament.Tests/Screens/TestSceneTeamWinScreen.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Tournament.Screens.TeamWin;
namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneTeamWinScreen : TournamentTestScene
{
[Test]
public void TestBasic()
{
var match = Ladder.CurrentMatch.Value;
match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals");
match.Completed.Value = true;
Add(new TeamWinScreen
{
FillMode = FillMode.Fit,
FillAspectRatio = 16 / 9f
});
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Tournament.Screens.TeamWin;
namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneTeamWinScreen : TournamentTestScene
{
[Test]
public void TestBasic()
{
var match = Ladder.CurrentMatch.Value;
match.Round.Value = Ladder.Rounds.FirstOrDefault(g => g.Name.Value == "Finals");
match.Completed.Value = true;
Add(new TeamWinScreen
{
FillMode = FillMode.Fit,
FillAspectRatio = 16 / 9f
});
}
}
}
| mit | C# |
c9ab3d52e8d685ff7c84cc029362ad634c20894e | Fix typo in DocumentPositions.cs | AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp | src/AngleSharp/Dom/DocumentPositions.cs | src/AngleSharp/Dom/DocumentPositions.cs | namespace AngleSharp.Dom
{
using AngleSharp.Attributes;
using System;
/// <summary>
/// Enumeration of possible document position values.
/// </summary>
[Flags]
[DomName("Document")]
public enum DocumentPositions : byte
{
/// <summary>
/// It is the same node.
/// </summary>
Same = 0,
/// <summary>
/// There is no relation.
/// </summary>
[DomName("DOCUMENT_POSITION_DISCONNECTED")]
Disconnected = 0x01,
/// <summary>
/// The node preceeds the other element.
/// </summary>
[DomName("DOCUMENT_POSITION_PRECEDING")]
Preceding = 0x02,
/// <summary>
/// The node follows the other element.
/// </summary>
[DomName("DOCUMENT_POSITION_FOLLOWING")]
Following = 0x04,
/// <summary>
/// The node contains the other element.
/// </summary>
[DomName("DOCUMENT_POSITION_CONTAINS")]
Contains = 0x08,
/// <summary>
/// The node is contained in the other element.
/// </summary>
[DomName("DOCUMENT_POSITION_CONTAINED_BY")]
ContainedBy = 0x10,
/// <summary>
/// The relation is implementation specific.
/// </summary>
[DomName("DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC")]
ImplementationSpecific = 0x20
}
}
| namespace AngleSharp.Dom
{
using AngleSharp.Attributes;
using System;
/// <summary>
/// Enumeration of possible document position values.
/// </summary>
[Flags]
[DomName("Document")]
public enum DocumentPositions : byte
{
/// <summary>
/// It is the same node.
/// </summary>
Same = 0,
/// <summary>
/// There is no relation.
/// </summary>
[DomName("DOCUMENT_POSITION_DISCONNECTED")]
Disconnected = 0x01,
/// <summary>
/// The node preceeds the other element.
/// </summary>
[DomName("DOCUMENT_POSITION_PRECEDING")]
Preceding = 0x02,
/// <summary>
/// The node follows the other element.
/// </summary>
[DomName("DOCUMENT_POSITION_FOLLOWING")]
Following = 0x04,
/// <summary>
/// The node is contains the other element.
/// </summary>
[DomName("DOCUMENT_POSITION_CONTAINS")]
Contains = 0x08,
/// <summary>
/// The node is contained in the other element.
/// </summary>
[DomName("DOCUMENT_POSITION_CONTAINED_BY")]
ContainedBy = 0x10,
/// <summary>
/// The relation is implementation specific.
/// </summary>
[DomName("DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC")]
ImplementationSpecific = 0x20
}
}
| mit | C# |
7351ff231902609371ea2aed3839314419dd210c | Document EnumerableExtensions and its Sum method | omar/ByteSize | src/ByteSizeLib/EnumerableExtensions.cs | src/ByteSizeLib/EnumerableExtensions.cs | using System.Collections.Generic;
using System.Linq;
namespace ByteSizeLib
{
/// <summary>
/// Extension methods on sequence of <see cref="ByteSize"/> values.
/// </summary>
public static class EnumerableExtensions
{
/// <summary>
/// Computes the sum of a sequence of <see cref="ByteSize"/> values.
/// </summary>
/// <param name="byteSizes">A sequence of <see cref="ByteSize"/> values to calculate the sum of.</param>
/// <returns>The sum of the values in the sequence.</returns>
public static ByteSize Sum(this IEnumerable<ByteSize> byteSizes)
{
return byteSizes.Aggregate((current, byteSize) => current + byteSize);
}
}
} | using System.Collections.Generic;
using System.Linq;
namespace ByteSizeLib
{
public static class EnumerableExtensions
{
public static ByteSize Sum(this IEnumerable<ByteSize> byteSizes)
{
return byteSizes.Aggregate((current, byteSize) => current + byteSize);
}
}
} | mit | C# |
3b7488783f9cc9c694b9c4228839eae1a3550d22 | resolve reset password issue in the TodoTemplate #2496 (#2579) | bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework | src/Templates/TodoTemplate/Bit.TodoTemplate/Web/Pages/ResetPasswordPage.razor.cs | src/Templates/TodoTemplate/Bit.TodoTemplate/Web/Pages/ResetPasswordPage.razor.cs | using TodoTemplate.Shared.Dtos.Account;
namespace TodoTemplate.App.Pages;
public partial class ResetPasswordPage
{
[AutoInject] private HttpClient httpClient = default!;
[AutoInject] private NavigationManager navigationManager = default!;
[AutoInject] private IAuthenticationService authService = default!;
[AutoInject] private AppAuthenticationStateProvider authStateProvider = default!;
[Parameter]
[SupplyParameterFromQuery]
public string? Email { get; set; }
[Parameter]
[SupplyParameterFromQuery]
public string? Token { get; set; }
public ResetPasswordRequestDto ResetPasswordModel { get; set; } = new();
public bool IsLoading { get; set; }
public BitMessageBarType ResetPasswordMessageType { get; set; }
public string? ResetPasswordMessage { get; set; }
private bool IsSubmitButtonEnabled =>
ResetPasswordModel.Password.HasValue()
&& ResetPasswordModel.ConfirmPassword.HasValue()
&& IsLoading is false;
private async Task Submit()
{
if (IsLoading)
{
return;
}
IsLoading = true;
ResetPasswordMessage = null;
try
{
await httpClient.PostAsJsonAsync("Auth/ResetPassword", ResetPasswordModel, AppJsonContext.Default.ResetPasswordRequestDto);
ResetPasswordMessageType = BitMessageBarType.Success;
ResetPasswordMessage = "Your password changed successfully.";
await authService.SignIn(new SignInRequestDto
{
UserName = Email,
Password = ResetPasswordModel.Password
});
navigationManager.NavigateTo("/");
}
catch (KnownException e)
{
ResetPasswordMessageType = BitMessageBarType.Error;
ResetPasswordMessage = ErrorStrings.ResourceManager.Translate(e.Message, Email!);
}
finally
{
IsLoading = false;
}
}
protected override void OnInitialized()
{
ResetPasswordModel.Email = Email;
ResetPasswordModel.Token = Token;
base.OnInitialized();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
if (await authStateProvider.IsUserAuthenticated())
{
navigationManager.NavigateTo("/");
}
}
await base.OnAfterRenderAsync(firstRender);
}
}
| using TodoTemplate.Shared.Dtos.Account;
namespace TodoTemplate.App.Pages;
public partial class ResetPasswordPage
{
[AutoInject] private HttpClient httpClient = default!;
[AutoInject] private NavigationManager navigationManager = default!;
[AutoInject] private IAuthenticationService authService = default!;
[AutoInject] private AppAuthenticationStateProvider authStateProvider = default!;
[Parameter]
[SupplyParameterFromQuery]
public string? Email { get; set; }
[Parameter]
[SupplyParameterFromQuery]
public string? Token { get; set; }
public ResetPasswordRequestDto ResetPasswordModel { get; set; } = new();
public bool IsLoading { get; set; }
public BitMessageBarType ResetPasswordMessageType { get; set; }
public string? ResetPasswordMessage { get; set; }
private bool IsSubmitButtonEnabled =>
ResetPasswordModel.Password.HasValue()
&& ResetPasswordModel.ConfirmPassword.HasValue()
&& IsLoading is false;
private async Task Submit()
{
if (IsLoading)
{
return;
}
IsLoading = true;
ResetPasswordMessage = null;
try
{
ResetPasswordModel.Email = Email;
ResetPasswordModel.Token = Token;
await httpClient.PostAsJsonAsync("Auth/ResetPassword", ResetPasswordModel, AppJsonContext.Default.ResetPasswordRequestDto);
ResetPasswordMessageType = BitMessageBarType.Success;
ResetPasswordMessage = "Your password changed successfully.";
await authService.SignIn(new SignInRequestDto
{
UserName = Email,
Password = ResetPasswordModel.Password
});
navigationManager.NavigateTo("/");
}
catch (KnownException e)
{
ResetPasswordMessageType = BitMessageBarType.Error;
ResetPasswordMessage = ErrorStrings.ResourceManager.Translate(e.Message, Email!);
}
finally
{
IsLoading = false;
}
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
if (await authStateProvider.IsUserAuthenticated())
{
navigationManager.NavigateTo("/");
}
}
await base.OnAfterRenderAsync(firstRender);
}
}
| mit | C# |
ed2e0f20aef538296bd9baeff39674d869f06d9e | fix footer link | kreeben/resin,kreeben/resin | src/Sir.HttpServer/Views/_Layout.cshtml | src/Sir.HttpServer/Views/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="/css/theme.css">
</head>
<body>
<a href="/" title="Go.go! v0.3a"><h1 class="logo">Go<span class="sub">■</span>go!</h1></a>
<div>
@RenderBody()
</div>
<footer>
<div>
<p>Just another non-tracking search engine powered by <a href="https://github.com/kreeben/resin">Resin</a> on servers from <a href="https://freenode.net/">freenode</a>.</p>
@if (ViewData["doc_count"] != null)
{
<p>Index size: @ViewData["doc_count"] documents</p>
}
@if (ViewData["last_processed_url"] != null)
{
<p>Last crawled: <a href="@ViewData["last_processed_url"]">@ViewData["last_processed_title"]</a></p>
}
<p><a href="/queryparser?collection=www&q=trump%20tower&fields=title&fields=body&skip=0&take=10">Create your own web collection.</a></p>
<p>Coming soon: NEAR operator, join between collections, semantic search, optional 100% PII-less personalized search</p>
</div>
</footer>
</body>
</html> | <!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="/css/theme.css">
</head>
<body>
<a href="/" title="Go.go! v0.3a"><h1 class="logo">Go<span class="sub">■</span>go!</h1></a>
<div>
@RenderBody()
</div>
<footer>
<div>
<p>Just another non-tracking search engine powered by <a href="https://github.com/kreeben/resin">Resin</a> on servers from <a href="https://freenode.net/">freenode</a>.</p>
@if (ViewData["doc_count"] != null)
{
<p>Index size: @ViewData["doc_count"] documents</p>
}
@if (ViewData["last_processed_url"] != null)
{
<p>Last crawled: <a href="@ViewData["last_processed_url"]">@ViewData["last_processed_title"]</a></p>
}
<p><a href="/queryparser?collection=www&q=trump%20tower&fields=title&fields=body&skip=0&take=10"></a>Create your own web collection.</p>
<p>Coming soon: NEAR operator, join between collections, semantic search, optional 100% PII-less personalized search</p>
</div>
</footer>
</body>
</html> | mit | C# |
bee0851f62848f0e31ff3dc7daa25899a869540b | Update BehaviorOfT.cs | wieslawsoltes/AvaloniaBehaviors,XamlBehaviors/XamlBehaviors,wieslawsoltes/AvaloniaBehaviors,XamlBehaviors/XamlBehaviors | src/Avalonia.Xaml.Interactivity/BehaviorOfT.cs | src/Avalonia.Xaml.Interactivity/BehaviorOfT.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.ComponentModel;
namespace Avalonia.Xaml.Interactivity
{
/// <summary>
/// A base class for behaviors making them code compatible with older frameworks,
/// and allow for typed associated objects.
/// </summary>
/// <typeparam name="T">The object type to attach to</typeparam>
public abstract class Behavior<T> : Behavior where T : AvaloniaObject
{
/// <summary>
/// Gets the object to which this behavior is attached.
/// </summary>
public new T AssociatedObject => base.AssociatedObject as T;
/// <summary>
/// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>.
/// </summary>
/// <remarks>
/// Override this to hook up functionality to the <see cref="Behavior.AssociatedObject"/>
/// </remarks>
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject == null)
{
string actualType = base.AssociatedObject.GetType().FullName;
string expectedType = typeof(T).FullName;
string message = string.Format("AssociatedObject is of type {0} but should be of type {1}.", actualType, expectedType);
throw new InvalidOperationException(message);
}
}
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.ComponentModel;
namespace Avalonia.Xaml.Interactivity
{
/// <summary>
/// A base class for behaviors making them code compatible with older frameworks,
/// and allow for typed associated objects.
/// </summary>
/// <typeparam name="T">The object type to attach to</typeparam>
public abstract class Behavior<T> : Behavior where T : AvaloniaObject
{
/// <summary>
/// Gets the object to which this behavior is attached.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public new T AssociatedObject => base.AssociatedObject as T;
/// <summary>
/// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>.
/// </summary>
/// <remarks>
/// Override this to hook up functionality to the <see cref="Behavior.AssociatedObject"/>
/// </remarks>
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject == null)
{
string actualType = base.AssociatedObject.GetType().FullName;
string expectedType = typeof(T).FullName;
string message = string.Format("AssociatedObject is of type {0} but should be of type {1}.", actualType, expectedType);
throw new InvalidOperationException(message);
}
}
}
}
| mit | C# |
716c150c853c8c9a7ff8f80ce04ede85a4009fc9 | clean up | tainicom/Aether | Source/Core/Serialization/DefaultTypeResolver.cs | Source/Core/Serialization/DefaultTypeResolver.cs | #region License
// Copyright 2015 Kastellanos Nikolaos
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using tainicom.Aether.Elementary.Serialization;
using tainicom.Aether.Elementary;
namespace tainicom.Aether.Core.Serialization
{
public class DefaultTypeResolver: IAetherTypeResolver
{
public IAether CreateInstance(string typeName)
{
Type particleType;
particleType = Type.GetType(typeName, false);
IAether particle = (IAether)Activator.CreateInstance(particleType);
return particle;
}
}
}
| #region License
// Copyright 2015 Kastellanos Nikolaos
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using tainicom.Aether.Elementary.Serialization;
using tainicom.Aether.Elementary;
namespace tainicom.Aether.Core.Serialization
{
public class DefaultTypeResolver: IAetherTypeResolver
{
public IAether CreateInstance(string typeName)
{
Type particleType;
particleType = Type.GetType(typeName, false);
if (particleType == null)
particleType = Type.GetType(typeName.Replace("TableEngine", "tainicom.Aether"));
if (particleType == null)
particleType = Type.GetType(typeName.Replace("TableEngine", "tainicom.Aether").Replace("Aether.Core", "tainicom.Aether.Core"));
IAether particle = (IAether)Activator.CreateInstance(particleType);
return particle;
}
}
}
| apache-2.0 | C# |
1dbca983ffc62214dd24399d42ba590ae7f33dc7 | Fix GetObject definition | mono/at-spi-sharp,mono/at-spi-sharp,mono/at-spi-sharp | at-spi/Hyperlink.cs | at-spi/Hyperlink.cs | // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Mike Gorse <mgorse@novell.com>
//
using System;
using System.Collections.Generic;
using NDesk.DBus;
using org.freedesktop.DBus;
namespace Atspi
{
public class Hyperlink
{
private IHyperlink proxy;
private Application application;
private Properties properties;
private const string IFACE = "org.a11y.atspi.Hyperlink";
public Hyperlink (Accessible accessible, string path)
{
application = accessible.application;
ObjectPath op = new ObjectPath (path);
proxy = Registry.Bus.GetObject<IHyperlink> (application.name, op);
properties = Registry.Bus.GetObject<Properties> (application.name, op);
}
public int NAnchors {
get {
return (int) properties.Get (IFACE, "NAnchors");
}
}
public int StartIndex {
get {
return (int) properties.Get (IFACE, "StartIndex");
}
}
public int EndIndex {
get {
return (int) properties.Get (IFACE, "EndIndex");
}
}
public Accessible GetObject (int index)
{
AccessiblePath path = proxy.GetObject (index);
Accessible ret = Registry.GetElement (path, true);
// hack -- we get an object which we may not have
// received an event for.
if (ret != null)
ret.AddInterface ("org.a11y.atspi.Action");
return ret;
}
public string GetURI (int i)
{
return proxy.GetURI (i);
}
}
[Interface ("org.a11y.atspi.Hyperlink")]
interface IHyperlink : Introspectable
{
AccessiblePath GetObject (int index);
string GetURI (int i);
}
}
| // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Mike Gorse <mgorse@novell.com>
//
using System;
using System.Collections.Generic;
using NDesk.DBus;
using org.freedesktop.DBus;
namespace Atspi
{
public class Hyperlink
{
private IHyperlink proxy;
private Application application;
private Properties properties;
private const string IFACE = "org.a11y.atspi.Hyperlink";
public Hyperlink (Accessible accessible, string path)
{
application = accessible.application;
ObjectPath op = new ObjectPath (path);
proxy = Registry.Bus.GetObject<IHyperlink> (application.name, op);
properties = Registry.Bus.GetObject<Properties> (application.name, op);
}
public int NAnchors {
get {
return (int) properties.Get (IFACE, "NAnchors");
}
}
public int StartIndex {
get {
return (int) properties.Get (IFACE, "StartIndex");
}
}
public int EndIndex {
get {
return (int) properties.Get (IFACE, "EndIndex");
}
}
public Accessible GetObject (int index)
{
ObjectPath path = proxy.GetObject (index);
Accessible ret = application.GetElement (path, true);
// hack -- we get an object which we may not have
// received an event for.
if (ret != null)
ret.AddInterface ("org.a11y.atspi.Action");
return ret;
}
public string GetURI (int i)
{
return proxy.GetURI (i);
}
}
[Interface ("org.a11y.atspi.Hyperlink")]
interface IHyperlink : Introspectable
{
ObjectPath GetObject (int index);
string GetURI (int i);
}
}
| mit | C# |
b0f2deb9fb4d05f05c686545b78f46ef23c76042 | Update copyright | MindscapeHQ/raygun4net,MindscapeHQ/raygun4net,MindscapeHQ/raygun4net | Mindscape.Raygun4Net.AspNetCore/Properties/AssemblyInfo.cs | Mindscape.Raygun4Net.AspNetCore/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("Raygun4Net.AspNetCore")]
[assembly: AssemblyDescription("Raygun provider for ASP.NET Core projects")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Raygun")]
[assembly: AssemblyProduct("Raygun4Net")]
[assembly: AssemblyCopyright("Copyright © Raygun 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("72856682-3b04-495f-8e1f-bdd4b698b20e")]
| 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("Raygun4Net.AspNetCore")]
[assembly: AssemblyDescription("Raygun provider for ASP.NET Core projects")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Raygun")]
[assembly: AssemblyProduct("Raygun4Net")]
[assembly: AssemblyCopyright("Copyright © Raygun 2016-2019")]
[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("72856682-3b04-495f-8e1f-bdd4b698b20e")]
| mit | C# |
c5339528af094e27c37fd083d6afadbb13be7c7d | use pooled dbcontext for perf (ef core 2.0) | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | src/FilterLists.Services/DependencyInjection/Extensions/ConfigureServicesCollection.cs | src/FilterLists.Services/DependencyInjection/Extensions/ConfigureServicesCollection.cs | using FilterLists.Data.Contexts;
using FilterLists.Data.Repositories.Contracts;
using FilterLists.Data.Repositories.Implementations;
using FilterLists.Services.Contracts;
using FilterLists.Services.Implementations;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace FilterLists.Services.DependencyInjection.Extensions
{
public static class ConfigureServicesCollection
{
public static void AddFilterListsServices(this IServiceCollection services, IConfiguration configuration)
{
services.AddSingleton(c => configuration);
services.AddEntityFrameworkMySql().AddDbContextPool<FilterListsDbContext>(options =>
options.UseMySql(configuration.GetConnectionString("FilterListsConnection")));
services.TryAddScoped<IFilterListRepository, FilterListRepository>();
services.TryAddScoped<IFilterListService, FilterListService>();
}
}
} | using FilterLists.Data.Contexts;
using FilterLists.Data.Repositories.Contracts;
using FilterLists.Data.Repositories.Implementations;
using FilterLists.Services.Contracts;
using FilterLists.Services.Implementations;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace FilterLists.Services.DependencyInjection.Extensions
{
public static class ConfigureServicesCollection
{
public static void AddFilterListsServices(this IServiceCollection services, IConfiguration configuration)
{
services.AddSingleton(c => configuration);
services.AddEntityFrameworkMySql().AddDbContext<FilterListsDbContext>(options =>
options.UseMySql(configuration.GetConnectionString("FilterListsConnection")));
services.TryAddScoped<IFilterListRepository, FilterListRepository>();
services.TryAddScoped<IFilterListService, FilterListService>();
}
}
} | mit | C# |
6eec48167260a31618719d66b11d5d49eb9e30bd | Allow Eye Dropper to be used as macro parameter editor | marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS | src/Umbraco.Infrastructure/PropertyEditors/EyeDropperColorPickerPropertyEditor.cs | src/Umbraco.Infrastructure/PropertyEditors/EyeDropperColorPickerPropertyEditor.cs | using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
namespace Umbraco.Cms.Core.PropertyEditors
{
[DataEditor(
Constants.PropertyEditors.Aliases.ColorPickerEyeDropper,
EditorType.PropertyValue | EditorType.MacroParameter,
"Eye Dropper Color Picker",
"eyedropper",
Icon = "icon-colorpicker",
Group = Constants.PropertyEditors.Groups.Pickers)]
public class EyeDropperColorPickerPropertyEditor : DataEditor
{
private readonly IIOHelper _ioHelper;
public EyeDropperColorPickerPropertyEditor(
IDataValueEditorFactory dataValueEditorFactory,
IIOHelper ioHelper,
EditorType type = EditorType.PropertyValue)
: base(dataValueEditorFactory, type)
{
_ioHelper = ioHelper;
}
/// <inheritdoc />
protected override IConfigurationEditor CreateConfigurationEditor() => new EyeDropperColorPickerConfigurationEditor(_ioHelper);
}
}
| using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
namespace Umbraco.Cms.Core.PropertyEditors
{
[DataEditor(
Constants.PropertyEditors.Aliases.ColorPickerEyeDropper,
"Eye Dropper Color Picker",
"eyedropper",
Icon = "icon-colorpicker",
Group = Constants.PropertyEditors.Groups.Pickers)]
public class EyeDropperColorPickerPropertyEditor : DataEditor
{
private readonly IIOHelper _ioHelper;
public EyeDropperColorPickerPropertyEditor(
IDataValueEditorFactory dataValueEditorFactory,
IIOHelper ioHelper,
EditorType type = EditorType.PropertyValue)
: base(dataValueEditorFactory, type)
{
_ioHelper = ioHelper;
}
/// <inheritdoc />
protected override IConfigurationEditor CreateConfigurationEditor() => new EyeDropperColorPickerConfigurationEditor(_ioHelper);
}
}
| mit | C# |
41e8d5e5fc3e43bfb045151070d7f9b51b6c3491 | Update LiteralInlineRenderer.cs | lunet-io/markdig | src/Markdig/Renderers/Html/Inlines/LiteralInlineRenderer.cs | src/Markdig/Renderers/Html/Inlines/LiteralInlineRenderer.cs | // Copyright (c) Alexandre Mutel. All rights reserved.
// This file is licensed under the BSD-Clause 2 license.
// See the license.txt file in the project root for more information.
using Markdig.Syntax.Inlines;
namespace Markdig.Renderers.Html.Inlines
{
/// <summary>
/// A HTML renderer for a <see cref="LiteralInline"/>.
/// </summary>
/// <seealso cref="Markdig.Renderers.Html.HtmlObjectRenderer{Markdig.Syntax.Inlines.LiteralInline}" />
public class LiteralInlineRenderer : HtmlObjectRenderer<LiteralInline>
{
protected override void Write(HtmlRenderer renderer, LiteralInline obj)
{
if (renderer.EnableHtmlForInline)
{
renderer.WriteEscape(obj.Content);
}
else
{
renderer.Write(obj.Content);
}
}
}
}
| // Copyright (c) Alexandre Mutel. All rights reserved.
// This file is licensed under the BSD-Clause 2 license.
// See the license.txt file in the project root for more information.
using Markdig.Syntax.Inlines;
namespace Markdig.Renderers.Html.Inlines
{
/// <summary>
/// A HTML renderer for a <see cref="LiteralInline"/>.
/// </summary>
/// <seealso cref="Markdig.Renderers.Html.HtmlObjectRenderer{Markdig.Syntax.Inlines.LiteralInline}" />
public class LiteralInlineRenderer : HtmlObjectRenderer<LiteralInline>
{
protected override void Write(HtmlRenderer renderer, LiteralInline obj)
{
if (renderer.EnableHtmlForInline)
renderer.WriteEscape(obj.Content);
else
renderer.Write(obj.Content);
}
}
}
| bsd-2-clause | C# |
5ce92c441beb8b1b46f489f24b42ce9ea0eea98b | Update TestCampaign.cs | plivo/plivo-dotnet,plivo/plivo-dotnet | tests_netcore/Plivo.NetCore.Test/Resources/TestCampaign.cs | tests_netcore/Plivo.NetCore.Test/Resources/TestCampaign.cs | using System.Collections.Generic;
using Xunit;
using Plivo.Http;
using Plivo.Resource;
using Plivo.Resource.Campaign;
using Plivo.Utilities;
using System;
namespace Plivo.NetCore.Test.Resources
{
public class TestCampaign : BaseTestCase
{
[Fact]
public void TestCampaignList()
{
var data = new Dictionary<string, object>();
var request =
new PlivoRequest(
"GET",
"Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/",
"",
data);
var response =
System.IO.File.ReadAllText(
SOURCE_DIR + @"../Mocks/campaignListResponse.json"
);
Setup<ListResponse<ListCampaigns>>(
200,
response
);
// res= Api.Campaign.List();
AssertRequest(request);
}
[Fact]
public void TestCampaignGet()
{
var id = "CMPT4EP";
var request =
new PlivoRequest(
"GET",
"Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/" + id + "/",
"");
var response =
System.IO.File.ReadAllText(
SOURCE_DIR + @"../Mocks/campaignGetResponse.json"
);
Setup<GetCampaign>(
200,
response
);
// res = Api.Campaign.Get(id);
AssertRequest(request);
}
}
}
| using System.Collections.Generic;
using Xunit;
using Plivo.Http;
using Plivo.Resource;
using Plivo.Resource.Campaign;
using Plivo.Utilities;
using System;
namespace Plivo.NetCore.Test.Resources
{
public class TestCampaign : BaseTestCase
{
[Fact]
public void TestCampaignList()
{
var data = new Dictionary<string, object>();
var request =
new PlivoRequest(
"GET",
"Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/",
"",
data);
var response =
System.IO.File.ReadAllText(
SOURCE_DIR + @"../Mocks/campaignListResponse.json"
);
Setup<ListResponse<ListCampaigns>>(
200,
response
);
res= Api.Campaign.List();
AssertRequest(request);
}
[Fact]
public void TestCampaignGet()
{
var id = "CMPT4EP";
var request =
new PlivoRequest(
"GET",
"Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/" + id + "/",
"");
var response =
System.IO.File.ReadAllText(
SOURCE_DIR + @"../Mocks/campaignGetResponse.json"
);
Setup<GetCampaign>(
200,
response
);
res = Api.Campaign.Get(id);
AssertRequest(request);
}
}
} | mit | C# |
a3979fa5130953822c2f238e4ea575ea4cc46d75 | Fix test datacard path case | tarakreddy/ADMPlugin,strhea/ADMPlugin,ADAPT/ADMPlugin | TestUtilities/DatacardUtility.cs | TestUtilities/DatacardUtility.cs | using System;
using System.IO;
using System.IO.Compression;
using System.Reflection;
namespace TestUtilities
{
public static class DatacardUtility
{
public static string WriteDatacard(string name)
{
var directory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(directory);
WriteDatacard(name, directory);
return directory;
}
public static void WriteDatacard(string name, string directory)
{
var bytes = GetDatacard(name);
Directory.CreateDirectory(directory);
var zipFilePath = Path.Combine(directory, "Datacard.zip");
File.WriteAllBytes(zipFilePath, bytes);
ZipFile.ExtractToDirectory(zipFilePath, directory);
}
public static byte[] GetDatacard(string name)
{
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Datacards", Path.ChangeExtension(name.Replace(" ", "_"), ".zip"));
return File.ReadAllBytes(path);
}
}
}
| using System;
using System.IO;
using System.IO.Compression;
using System.Reflection;
namespace TestUtilities
{
public static class DatacardUtility
{
public static string WriteDatacard(string name)
{
var directory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(directory);
WriteDatacard(name, directory);
return directory;
}
public static void WriteDatacard(string name, string directory)
{
var bytes = GetDatacard(name);
Directory.CreateDirectory(directory);
var zipFilePath = Path.Combine(directory, "DataCard.zip");
File.WriteAllBytes(zipFilePath, bytes);
ZipFile.ExtractToDirectory(zipFilePath, directory);
}
public static byte[] GetDatacard(string name)
{
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataCards", Path.ChangeExtension(name.Replace(" ", "_"), ".zip"));
return File.ReadAllBytes(path);
}
}
}
| epl-1.0 | C# |
f919746b01ab5add05df35870d86bd6b318197fb | Document CoffeeScript usage. | honestegg/cassette,damiensawyer/cassette,honestegg/cassette,honestegg/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette,andrewdavey/cassette,BluewireTechnologies/cassette,BluewireTechnologies/cassette,damiensawyer/cassette | src/Website/Views/Documentation/Scripts_CoffeeScript.cshtml | src/Website/Views/Documentation/Scripts_CoffeeScript.cshtml | <h1>CoffeeScript</h1>
<p>Cassette provides built-in support for the excellent <a href="http://coffeescript.org/">CoffeeScript</a> language.
Add <code>.coffee</code> files to your project and Cassette will compile them into JavaScript and bundle them with the rest of your scripts.
</p>
<p>
<strong>Important:</strong> All <code>.coffee</code> files must have their Build Action set to <code>Content</code> so they will get deployed with the web application.
</p>
<ol>
<li>Select the files in the Visual Studio Solution Explorer</li>
<li>Right-click > Properties</li>
<li>In the Properties window, set Build Action to <code>Content</code></li>
</ol>
<h2>Improving Performance</h2>
<p>Cassette's default CoffeeScript compiler can be slow for large files. To improve performance try using the Internet Explorer based compiler.
In <code>CassetteConfiguration</code> change the compiler:</p>
<pre><code><span class="keyword">public</span> <span class="keyword">class</span> <span class="code-type">CassetteConfiguration</span> : <span class="code-type">ICassetteConfiguration</span>
{
<span class="keyword">public</span> <span class="keyword">void</span> Configure(<span class="code-type">BundleCollection</span> bundles, <span class="code-type">CassetteSettings</span> settings)
{
bundles.AddPerSubDirectory<<code class="code-type">ScriptBundle</code>>(
<span class="string">"Scripts"</span>,
b => b.Processor = <span class="keyword">new</span> <span class="code-type">ScriptPipeline</span>
{
CoffeeScriptCompiler = <span class="keyword">new</span> <span class="code-type">IECoffeeScriptCompiler</span>()
}
);
}
}</code></pre>
<p>Please note: The <code>IECoffeeScriptCompiler</code> requires Full Trust because it uses COM Interop to access Internet Explorer's JavaScript engine.
You should also have Internet Explorer 9 or better installed to see a significant performance boost.</p> | <h1>CoffeeScript</h1>
<p>Documentation under construction. Please check back soon!</p> | mit | C# |
49ab72f70ab734ebbf9310957a5672b3cd1f51f7 | Remove bad '#r "System.Web.Http"' | mattchenderson/azure-webjobs-sdk-templates,Azure/azure-webjobs-sdk-templates,soninaren/azure-webjobs-sdk-templates,davidlai-msft/azure-webjobs-sdk-templates,mattchenderson/azure-webjobs-sdk-templates,davidlai-msft/azure-webjobs-sdk-templates,soninaren/azure-webjobs-sdk-templates,mattchenderson/azure-webjobs-sdk-templates,davidlai-msft/azure-webjobs-sdk-templates,davidlai-msft/azure-webjobs-sdk-templates,Azure/azure-webjobs-sdk-templates,mattchenderson/azure-webjobs-sdk-templates,tohling/azure-webjobs-sdk-templates,tohling/azure-webjobs-sdk-templates,mattchenderson/azure-webjobs-sdk-templates,soninaren/azure-webjobs-sdk-templates,davidlai-msft/azure-webjobs-sdk-templates,mattchenderson/azure-webjobs-sdk-templates,Azure/azure-webjobs-sdk-templates,tohling/azure-webjobs-sdk-templates,tohling/azure-webjobs-sdk-templates,Azure/azure-webjobs-sdk-templates,tohling/azure-webjobs-sdk-templates,Azure/azure-webjobs-sdk-templates,Azure/azure-webjobs-sdk-templates | Templates/HttpTrigger-CSharp/run.csx | Templates/HttpTrigger-CSharp/run.csx | using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Diagnostics;
using Microsoft.Azure.WebJobs.Host;
public static Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
var queryParamms = req.GetQueryNameValuePairs()
.ToDictionary(p => p.Key, p => p.Value, StringComparer.OrdinalIgnoreCase);
log.Verbose(string.Format("CSharp HTTP trigger function processed a request. Name={0}", req.RequestUri));
HttpResponseMessage res = null;
string name;
if (queryParamms.TryGetValue("name", out name))
{
res = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent("Hello " + name)
};
}
else
{
res = new HttpResponseMessage(HttpStatusCode.BadRequest)
{
Content = new StringContent("Please pass a name on the query string")
};
}
return Task.FromResult(res);
}
| #r "System.Web.Http"
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Diagnostics;
using Microsoft.Azure.WebJobs.Host;
public static Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
var queryParamms = req.GetQueryNameValuePairs()
.ToDictionary(p => p.Key, p => p.Value, StringComparer.OrdinalIgnoreCase);
log.Verbose(string.Format("CSharp HTTP trigger function processed a request. Name={0}", req.RequestUri));
HttpResponseMessage res = null;
string name;
if (queryParamms.TryGetValue("name", out name))
{
res = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent("Hello " + name)
};
}
else
{
res = new HttpResponseMessage(HttpStatusCode.BadRequest)
{
Content = new StringContent("Please pass a name on the query string")
};
}
return Task.FromResult(res);
} | mit | C# |
92fdf15774239b605c3bcaf6295e18392400a32f | Use correct claims in case UserPrincipal has more than one identity | anyeloamt1/Bonobo-Git-Server,larshg/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,igoryok-zp/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,crowar/Bonobo-Git-Server,larshg/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,gencer/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,NipponSysits/IIS.Git-Connector,padremortius/Bonobo-Git-Server,willdean/Bonobo-Git-Server,lkho/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,crowar/Bonobo-Git-Server,larshg/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,crowar/Bonobo-Git-Server,lkho/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,willdean/Bonobo-Git-Server,willdean/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,lkho/Bonobo-Git-Server,gencer/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,igoryok-zp/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,crowar/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,Acute-sales-ltd/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,gencer/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,Acute-sales-ltd/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,Acute-sales-ltd/Bonobo-Git-Server,larshg/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,gencer/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,willdean/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,crowar/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,braegelno5/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,NipponSysits/IIS.Git-Connector,anyeloamt1/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,crowar/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,lkho/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,willdean/Bonobo-Git-Server,padremortius/Bonobo-Git-Server | Bonobo.Git.Server/Extensions/UserExtensions.cs | Bonobo.Git.Server/Extensions/UserExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Security.Claims;
using System.Security.Principal;
using System.Web;
namespace Bonobo.Git.Server
{
public static class UserExtensions
{
public static string GetClaim(this IPrincipal user, string claimName)
{
string result = null;
try
{
ClaimsIdentity claimsIdentity = GetClaimsIdentity(user);
if (claimsIdentity != null)
{
result = claimsIdentity.FindFirst(claimName).Value;
}
}
catch
{
}
return result;
}
public static string Id(this IPrincipal user)
{
return user.GetClaim(ClaimTypes.Upn);
}
public static string Name(this IPrincipal user)
{
return user.GetClaim(ClaimTypes.Name);
}
public static bool IsWindowsPrincipal(this IPrincipal user)
{
return user.Identity is WindowsIdentity;
}
public static string[] Roles(this IPrincipal user)
{
string[] result = null;
try
{
ClaimsIdentity claimsIdentity = GetClaimsIdentity(user);
if (claimsIdentity != null)
{
result = claimsIdentity.FindAll(ClaimTypes.Role).Select(x => x.Value).ToArray();
}
}
catch
{
}
return result;
}
private static ClaimsIdentity GetClaimsIdentity(this IPrincipal user)
{
ClaimsIdentity result = null;
ClaimsPrincipal claimsPrincipal = user as ClaimsPrincipal;
if (claimsPrincipal != null)
{
result = claimsPrincipal.Identities.FirstOrDefault(x => x is ClaimsIdentity);
}
return result;
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Security.Claims;
using System.Security.Principal;
using System.Web;
namespace Bonobo.Git.Server
{
public static class UserExtensions
{
public static string GetClaim(this IPrincipal user, string claimName)
{
string result = null;
ClaimsIdentity claimsIdentity = user.Identity as ClaimsIdentity;
if (claimsIdentity != null)
{
try
{
result = claimsIdentity.FindFirst(claimName).Value;
}
catch
{
}
}
return result;
}
public static string Id(this IPrincipal user)
{
return user.GetClaim(ClaimTypes.Upn);
}
public static string Name(this IPrincipal user)
{
return user.GetClaim(ClaimTypes.Name);
}
public static string[] Roles(this IPrincipal user)
{
string[] result = null;
ClaimsIdentity claimsIdentity = user.Identity as ClaimsIdentity;
if (claimsIdentity != null)
{
try
{
result = claimsIdentity.FindAll(ClaimTypes.Role).Select(x => x.Value).ToArray();
}
catch
{
}
}
return result;
}
}
} | mit | C# |
6b936cd29e579500652f17c1680391dc0d5a55b3 | Remove unused directives | Paymentsense/Dapper.SimpleSave | PS.Mothership.Core/PS.Mothership.Core.Common/Contracts/IEchoSignCallbackService.cs | PS.Mothership.Core/PS.Mothership.Core.Common/Contracts/IEchoSignCallbackService.cs | using System.ServiceModel;
using PS.Mothership.Core.Common.Enums.EchoSign;
namespace PS.Mothership.Core.Common.Contracts
{
[ServiceContract(Name = "EchoSignService")]
public interface IEchoSignCallbackService
{
[OperationContract]
void DocumentNotification(string agreementId, AgreementStatusEnum status, EventTypeEnum eventType);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using PS.Mothership.Core.Common.Enums.EchoSign;
namespace PS.Mothership.Core.Common.Contracts
{
[ServiceContract(Name = "EchoSignService")]
public interface IEchoSignCallbackService
{
[OperationContract]
void DocumentNotification(string agreementId, AgreementStatusEnum status, EventTypeEnum eventType);
}
}
| mit | C# |
3fad8106e79139b7dc514286fd8b6249128bacef | Fix crash on multiple symbols | occar421/MyAnalyzerSamples | PublicFieldAnalyzer/PublicFieldAnalyzer/PublicFieldAnalyzer/PublicFieldAnalyzer.cs | PublicFieldAnalyzer/PublicFieldAnalyzer/PublicFieldAnalyzer/PublicFieldAnalyzer.cs | using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
namespace AnalyzerTests
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
class PublicFieldAnalyzer : DiagnosticAnalyzer
{
public const string DiagnosticId = "PublicField";
private static readonly string Title = "Public field sucks.";
private static readonly string MessageFormat = "{0} {1} public field.";
private static readonly string Description = "Using public field is usually bad implemention.";
private const string Category = "PublicField.CSharp.Suggestion";
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
get
{
return ImmutableArray.Create(Rule);
}
}
public override void Initialize(AnalysisContext context)
{
context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.FieldDeclaration);
}
private static void Analyze(SyntaxNodeAnalysisContext context)
{
var field = (FieldDeclarationSyntax)context.Node;
if (field.Modifiers.Any(SyntaxKind.PublicKeyword) && !field.Modifiers.Any(SyntaxKind.ConstKeyword))
{
var fieldNameTokens = field.DescendantNodes().OfType<VariableDeclaratorSyntax>()
.Select(x => x.ChildTokens().Where(xx => xx.IsKind(SyntaxKind.IdentifierToken)).Single());
var diagnostic = Diagnostic.Create(Rule, field.GetLocation(), string.Join(", ", fieldNameTokens.Select(x => $"\"{x}\"")), fieldNameTokens.Skip(1).Any() ? "are" : "is");
context.ReportDiagnostic(diagnostic);
}
}
}
} | using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
namespace AnalyzerTests
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
class PublicFieldAnalyzer : DiagnosticAnalyzer
{
public const string DiagnosticId = "PublicField";
private static readonly string Title = "Public field sucks.";
private static readonly string MessageFormat = "\"{0}\" is public field.";
private static readonly string Description = "Using public field is usually bad implemention.";
private const string Category = "PublicField.CSharp.Suggestion";
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
get
{
return ImmutableArray.Create(Rule);
}
}
public override void Initialize(AnalysisContext context)
{
context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.FieldDeclaration);
}
private static void Analyze(SyntaxNodeAnalysisContext context)
{
var field = (FieldDeclarationSyntax)context.Node;
if (field.Modifiers.Any(SyntaxKind.PublicKeyword) && !field.Modifiers.Any(SyntaxKind.ConstKeyword))
{
var fieldNameToken = field.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single()
.ChildTokens().Where(x => x.IsKind(SyntaxKind.IdentifierToken)).Single();
var diagnostic = Diagnostic.Create(Rule, field.GetLocation(), fieldNameToken.ValueText);
context.ReportDiagnostic(diagnostic);
}
}
}
} | mit | C# |
696a647ea21a000dc5a88e4adca1ce0229a71e9c | Remove previous manual code for DatastoreClientBuilder now it's generated | jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/gcloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet | apis/Google.Cloud.Datastore.V1/Google.Cloud.Datastore.V1/DatastoreClientBuilder.cs | apis/Google.Cloud.Datastore.V1/Google.Cloud.Datastore.V1/DatastoreClientBuilder.cs | // Copyright 2019 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Google.Api.Gax.Grpc;
namespace Google.Cloud.Datastore.V1
{
// Support for DatastoreDbBuilder.
public sealed partial class DatastoreClientBuilder : ClientBuilderBase<DatastoreClient>
{
/// <summary>
/// Creates a new instance with no settings.
/// </summary>
public DatastoreClientBuilder()
{
}
internal DatastoreClientBuilder(DatastoreDbBuilder builder)
{
Settings = builder.Settings;
CopyCommonSettings(builder);
}
}
}
| // Copyright 2019 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Google.Api.Gax.Grpc;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Google.Cloud.Datastore.V1
{
// Note: the generator would just generate an internal property to start with, so there'd be no need for this
// partial.
public partial class DatastoreClient
{
internal static ChannelPool ChannelPool => s_channelPool;
}
// Note: this partial class would be generated.
/// <summary>
/// Builder class for <see cref="DatastoreClient"/> to provide simple configuration of credentials, endpoint etc.
/// </summary>
public sealed partial class DatastoreClientBuilder : ClientBuilderBase<DatastoreClient>
{
/// <summary>
/// The settings to use for RPCs, or null for the default settings.
/// </summary>
public DatastoreSettings Settings { get; set; }
/// <inheritdoc />
public override DatastoreClient Build()
{
Validate();
var callInvoker = CreateCallInvoker();
return DatastoreClient.Create(callInvoker, Settings);
}
/// <inheritdoc />
public override async Task<DatastoreClient> BuildAsync(CancellationToken cancellationToken = default)
{
Validate();
var callInvoker = await CreateCallInvokerAsync(cancellationToken).ConfigureAwait(false);
return DatastoreClient.Create(callInvoker, Settings);
}
/// <inheritdoc />
protected override ServiceEndpoint GetDefaultEndpoint() => DatastoreClient.DefaultEndpoint;
/// <inheritdoc />
protected override IReadOnlyList<string> GetDefaultScopes() => DatastoreClient.DefaultScopes;
/// <inheritdoc />
protected override ChannelPool GetChannelPool() => DatastoreClient.ChannelPool;
}
// Note: this partial class wouldn't be generated
public sealed partial class DatastoreClientBuilder : ClientBuilderBase<DatastoreClient>
{
/// <summary>
/// Creates a new instance with no settings.
/// </summary>
public DatastoreClientBuilder()
{
}
internal DatastoreClientBuilder(DatastoreDbBuilder builder)
{
Settings = builder.Settings;
CopyCommonSettings(builder);
}
}
}
| apache-2.0 | C# |
8058dafb681d3ffc9324bd6d78307853283d1d7d | add missing param/return | xmlunit/xmlunit.net,xmlunit/xmlunit.net | src/main/net-core/Diff/IComparisonFormatter.cs | src/main/net-core/Diff/IComparisonFormatter.cs | /*
This file is licensed to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
namespace Org.XmlUnit.Diff {
/// <summary>
/// Formatter methods for a Comparison Object.
/// </summary>
public interface IComparisonFormatter {
/// <summary>
/// Return a short String of the Comparison including the
/// XPath and the shorten value of the effected control and
/// test Node.
/// </summary>
/// <param name="comparison">The Comparison to describe.</param>
/// <return>a short description of the comparison</return>
/// <remarks>
/// <para>
/// This is used for Diff#ToString().
/// </para>
/// </remarks>
string GetDescription(Comparison comparison);
/// <summary>
/// Return the xml node from Detail#Target as formatted String.
/// </summary>
/// <param name="details">The Comparison#ControlDetails or
/// Comparison#TestDetails.</param>
/// <param name="type">The implementation can return different
/// details depending on the ComparisonType.</param>
/// <param name="formatXml">set this to true if the Comparison
/// was generated with DiffBuilder#IgnoreWhitespace.</param>
/// <return>the full xml node</return>
string GetDetails(Comparison.Detail details, ComparisonType type,
bool formatXml);
}
}
| /*
This file is licensed to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
namespace Org.XmlUnit.Diff {
/// <summary>
/// Formatter methods for a Comparison Object.
/// </summary>
public interface IComparisonFormatter {
/// <summary>
/// Return a short String of the Comparison including the
/// XPath and the shorten value of the effected control and
/// test Node.
/// </summary>
/// <remarks>
/// <para>
/// This is used for Diff#ToString().
/// </para>
/// </remarks>
string GetDescription(Comparison comparison);
/// <summary>
/// Return the xml node from Detail#Target as formatted String.
/// </summary>
/// <param name="details">The Comparison#ControlDetails or
/// Comparison#TestDetails.</param>
/// <param name="type">The implementation can return different
/// details depending on the ComparisonType.</param>
/// <param name="formatXml">set this to true if the Comparison
/// was generated with DiffBuilder#IgnoreWhitespace.</param>
/// <return>the full xml node</return>
string GetDetails(Comparison.Detail details, ComparisonType type,
bool formatXml);
}
}
| apache-2.0 | C# |
41729d3df12a218dbe1190e5bc3e438e2ca0772d | Prepare for export | NebcoOrganization/Yuffie,NebcoOrganization/Yuffie | WebApp/Controllers/HomeController.cs | WebApp/Controllers/HomeController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Yuffie.WebApp;
namespace WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View("Index", YuffieApp.Config);
}
public IActionResult Admin()
{
object data = null;
var sb = new StringBuilder();
return View("Admin", YuffieApp.Config);
}
[HttpPost]
public IActionResult PushData(string data)
{
var parsed = JsonConvert.DeserializeObject<List<YuffieFrontValue>>(data);
//TODO ALT object is here
return Redirect("/Home/Index");
}
public IActionResult Error()
{
return View();
}
public class YuffieFrontValue
{
public string Key {get;set;}
public object Value {get;set;}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Yuffie.WebApp;
namespace WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View("Index", YuffieApp.Config);
}
public IActionResult Admin()
{
return View("Admin", YuffieApp.Config);
}
[HttpPost]
public IActionResult PushData(string data)
{
var parsed = JsonConvert.DeserializeObject<List<YuffieFrontValue>>(data);
//TODO ALT object is here
return Redirect("/Home/Index");
}
public IActionResult Error()
{
return View();
}
public class YuffieFrontValue
{
public string Key {get;set;}
public object Value {get;set;}
}
}
}
| mit | C# |
c2d6575d5380ca27e27116197d72ff1638ffb938 | Optimize element and text rendering for modern Windows versions | InspiringCode/Inspiring.MVVM | Source/Mvvm/Views/WindowService/WindowService.cs | Source/Mvvm/Views/WindowService/WindowService.cs | namespace Inspiring.Mvvm.Views {
using System.Windows;
using System.Windows.Media;
using Inspiring.Mvvm.Common;
using Inspiring.Mvvm.Screens;
public class WindowService : IWindowService {
public static readonly Event<InitializeWindowEventArgs> InitializeWindowEvent = new Event<InitializeWindowEventArgs>();
public virtual Window CreateWindow(Window owner, string title, bool modal) {
var window = new Window();
if (title != null) {
window.Title = title;
}
if (owner != null) {
window.Owner = owner;
}
if (modal) {
window.ShowInTaskbar = false;
}
// Needed for sharp element rendering.
window.UseLayoutRounding = true;
// Needed for sharp text rendering.
TextOptions.SetTextFormattingMode(window, TextFormattingMode.Display);
return window;
}
public virtual void ShowWindow(Window window, bool modal) {
if (modal) {
window.ShowDialog();
} else {
window.Show();
}
}
}
public sealed class InitializeWindowEventArgs : ScreenEventArgs {
public InitializeWindowEventArgs(IScreenBase target, Window window)
: base(target) {
Window = window;
}
public Window Window { get; private set; }
}
}
| namespace Inspiring.Mvvm.Views {
using System.Windows;
using System.Windows.Media;
using Inspiring.Mvvm.Common;
using Inspiring.Mvvm.Screens;
public class WindowService : IWindowService {
public static readonly Event<InitializeWindowEventArgs> InitializeWindowEvent = new Event<InitializeWindowEventArgs>();
public virtual Window CreateWindow(Window owner, string title, bool modal) {
Window window = new Window();
if (title != null) {
window.Title = title;
}
if (owner != null) {
window.Owner = owner;
}
if (modal) {
window.ShowInTaskbar = false;
}
// Needed for sharp text rendering.
TextOptions.SetTextFormattingMode(window, TextFormattingMode.Display);
TextOptions.SetTextRenderingMode(window, TextRenderingMode.Aliased);
return window;
}
public virtual void ShowWindow(Window window, bool modal) {
if (modal) {
window.ShowDialog();
} else {
window.Show();
}
}
}
public sealed class InitializeWindowEventArgs : ScreenEventArgs {
public InitializeWindowEventArgs(IScreenBase target, Window window)
: base(target) {
Window = window;
}
public Window Window { get; private set; }
}
} | epl-1.0 | C# |
695a1a345e11fbcd0bb1ddc7119c5fca4d56a518 | Fix namespace | canton7/Stylet,cH40z-Lord/Stylet,canton7/Stylet,cH40z-Lord/Stylet | StyletUnitTests/StyletIoC/UnboundGenericTests.cs | StyletUnitTests/StyletIoC/UnboundGenericTests.cs | using NUnit.Framework;
using StyletIoC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StyletUnitTests
{
[TestFixture]
public class StyletIoCUnboundGenericTests
{
interface I1<T> { }
class C1<T> : I1<T> { }
interface I2<T, U> { }
class C2<T, U> : I2<U, T> { }
[Test]
public void ResolvesSingleGenericType()
{
var builder = new StyletIoCBuilder();
builder.Bind(typeof(C1<>)).ToSelf();
var ioc = builder.BuildContainer();
Assert.DoesNotThrow(() => ioc.Get<C1<int>>());
}
[Test]
public void ResolvesGenericTypeFromInterface()
{
var builder = new StyletIoCBuilder();
builder.Bind(typeof(I1<>)).To(typeof(C1<>));
var ioc = builder.BuildContainer();
var result = ioc.Get<I1<int>>();
Assert.IsInstanceOf<C1<int>>(result);
}
[Test]
public void ResolvesGenericTypeWhenOrderOfTypeParamsChanged()
{
var builder = new StyletIoCBuilder();
builder.Bind(typeof(I2<,>)).To(typeof(C2<,>));
var ioc = builder.BuildContainer();
var c2 = ioc.Get<I2<int, bool>>();
Assert.IsInstanceOf<C2<bool, int>>(c2);
}
}
}
| using NUnit.Framework;
using StyletIoC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StyletUnitTests.StyletIoC
{
[TestFixture]
public class StyletIoCUnboundGenericTests
{
interface I1<T> { }
class C1<T> : I1<T> { }
interface I2<T, U> { }
class C2<T, U> : I2<U, T> { }
[Test]
public void ResolvesSingleGenericType()
{
var builder = new StyletIoCBuilder();
builder.Bind(typeof(C1<>)).ToSelf();
var ioc = builder.BuildContainer();
Assert.DoesNotThrow(() => ioc.Get<C1<int>>());
}
[Test]
public void ResolvesGenericTypeFromInterface()
{
var builder = new StyletIoCBuilder();
builder.Bind(typeof(I1<>)).To(typeof(C1<>));
var ioc = builder.BuildContainer();
var result = ioc.Get<I1<int>>();
Assert.IsInstanceOf<C1<int>>(result);
}
[Test]
public void ResolvesGenericTypeWhenOrderOfTypeParamsChanged()
{
var builder = new StyletIoCBuilder();
builder.Bind(typeof(I2<,>)).To(typeof(C2<,>));
var ioc = builder.BuildContainer();
var c2 = ioc.Get<I2<int, bool>>();
Assert.IsInstanceOf<C2<bool, int>>(c2);
}
}
}
| mit | C# |
2190168241f70827f15e6e9b39ede5ad2de6dedd | Update Program.cs | medhajoshi27/GitTest1 | ConsoleApplication1/ConsoleApplication1/Program.cs | ConsoleApplication1/ConsoleApplication1/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//hello
Console.WriteLine("HELLO");
Console.WriteLine("World");
//medha
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//hello
Console.WriteLine("HELLO");
Console.WriteLine("World");
}
}
}
| mit | C# |
078490c63033721bc9ec04284b07ed4a8bc0ee57 | Fix status update after conflict resolving | michael-reichenauer/GitMind | GitMind/Features/Diffing/Private/GitDiffService.cs | GitMind/Features/Diffing/Private/GitDiffService.cs | using System;
using System.IO;
using System.Threading.Tasks;
using GitMind.ApplicationHandling;
using GitMind.Common.ProgressHandling;
using GitMind.Features.StatusHandling;
using GitMind.Git;
using GitMind.Git.Private;
using GitMind.GitModel;
using GitMind.Utils;
namespace GitMind.Features.Diffing.Private
{
internal class GitDiffService : IGitDiffService
{
private readonly WorkingFolder workingFolder;
private readonly IRepoCaller repoCaller;
private readonly IGitDiffParser gitDiffParser;
private readonly Lazy<IProgressService> progressService;
private readonly Lazy<IStatusService> statusService;
public GitDiffService(
WorkingFolder workingFolder,
IRepoCaller repoCaller,
IGitDiffParser gitDiffParser,
Lazy<IProgressService> progressService,
Lazy<IStatusService> statusService)
{
this.workingFolder = workingFolder;
this.repoCaller = repoCaller;
this.gitDiffParser = gitDiffParser;
this.progressService = progressService;
this.statusService = statusService;
}
public Task<R<CommitDiff>> GetFileDiffAsync(string commitId, string path)
{
Log.Debug($"Get diff for file {path} for commit {commitId} ...");
return repoCaller.UseRepoAsync(async repo =>
{
string patch = repo.Diff.GetFilePatch(commitId, path);
CommitDiff commitDiff = await gitDiffParser.ParseAsync(commitId, patch, false);
if (commitId == Commit.UncommittedId)
{
string filePath = Path.Combine(workingFolder, path);
if (File.Exists(filePath))
{
commitDiff = new CommitDiff(commitDiff.LeftPath, filePath);
}
}
return commitDiff;
});
}
public Task<R<CommitDiff>> GetCommitDiffAsync(string commitId)
{
Log.Debug($"Get diff for commit {commitId} ...");
return repoCaller.UseRepoAsync(async repo =>
{
string patch = repo.Diff.GetPatch(commitId);
return await gitDiffParser.ParseAsync(commitId, patch);
});
}
public Task<R<CommitDiff>> GetCommitDiffRangeAsync(string id1, string id2)
{
Log.Debug($"Get diff for commit range {id1}-{id2} ...");
return repoCaller.UseRepoAsync(async repo =>
{
string patch = repo.Diff.GetPatchRange(id1, id2);
return await gitDiffParser.ParseAsync(null, patch);
});
}
public void GetFile(string fileId, string filePath)
{
Log.Debug($"Get file {fileId}, {filePath} ...");
repoCaller.UseRepo(repo => repo.GetFile(fileId, filePath));
}
public Task ResolveAsync(string path)
{
Log.Debug($"Resolve {path} ...");
using (statusService.Value.PauseStatusNotifications())
using (progressService.Value.ShowDialog("Resolving ..."))
{
return repoCaller.UseRepoAsync(repo => repo.Resolve(path));
}
}
}
} | using System.IO;
using System.Threading.Tasks;
using GitMind.ApplicationHandling;
using GitMind.Git;
using GitMind.Git.Private;
using GitMind.GitModel;
using GitMind.Utils;
namespace GitMind.Features.Diffing.Private
{
internal class GitDiffService : IGitDiffService
{
private readonly WorkingFolder workingFolder;
private readonly IRepoCaller repoCaller;
private readonly IGitDiffParser gitDiffParser;
public GitDiffService(
WorkingFolder workingFolder,
IRepoCaller repoCaller,
IGitDiffParser gitDiffParser)
{
this.workingFolder = workingFolder;
this.repoCaller = repoCaller;
this.gitDiffParser = gitDiffParser;
}
public Task<R<CommitDiff>> GetFileDiffAsync(string commitId, string path)
{
Log.Debug($"Get diff for file {path} for commit {commitId} ...");
return repoCaller.UseRepoAsync(async repo =>
{
string patch = repo.Diff.GetFilePatch(commitId, path);
CommitDiff commitDiff = await gitDiffParser.ParseAsync(commitId, patch, false);
if (commitId == Commit.UncommittedId)
{
string filePath = Path.Combine(workingFolder, path);
if (File.Exists(filePath))
{
commitDiff = new CommitDiff(commitDiff.LeftPath, filePath);
}
}
return commitDiff;
});
}
public Task<R<CommitDiff>> GetCommitDiffAsync(string commitId)
{
Log.Debug($"Get diff for commit {commitId} ...");
return repoCaller.UseRepoAsync(async repo =>
{
string patch = repo.Diff.GetPatch(commitId);
return await gitDiffParser.ParseAsync(commitId, patch);
});
}
public Task<R<CommitDiff>> GetCommitDiffRangeAsync(string id1, string id2)
{
Log.Debug($"Get diff for commit range {id1}-{id2} ...");
return repoCaller.UseRepoAsync(async repo =>
{
string patch = repo.Diff.GetPatchRange(id1, id2);
return await gitDiffParser.ParseAsync(null, patch);
});
}
public void GetFile(string fileId, string filePath)
{
Log.Debug($"Get file {fileId}, {filePath} ...");
repoCaller.UseRepo(repo => repo.GetFile(fileId, filePath));
}
public Task ResolveAsync(string path)
{
Log.Debug($"Resolve {path} ...");
return repoCaller.UseRepoAsync(repo => repo.Resolve(path));
}
}
} | mit | C# |
db3a570079db33bcb115dca9df159b9a281c7bae | address mssing reference specification | jwChung/Experimentalism,jwChung/Experimentalism | test/ExperimentalUnitTest/AssemblyLevelTest.cs | test/ExperimentalUnitTest/AssemblyLevelTest.cs | using System.Linq;
using System.Reflection;
using Xunit;
namespace Jwc.Experimental
{
public class AssemblyLevelTest
{
[Fact]
public void SutOnlyReferencesSpecifiedAssemblies()
{
var sut = Assembly.LoadFrom("Jwc.Experimental.dll");
Assert.NotNull(sut);
var specifiedAssemblies = new []
{
"mscorlib",
"xunit"
};
var actual = sut.GetReferencedAssemblies().Select(an => an.Name).ToArray();
Assert.Equal(specifiedAssemblies.Length, actual.Length);
Assert.False(specifiedAssemblies.Except(actual).Any(), "Empty");
}
}
} | using System.Linq;
using System.Reflection;
using Xunit;
namespace Jwc.Experimental
{
public class AssemblyLevelTest
{
[Fact]
public void SutOnlyReferencesSpecifiedAssemblies()
{
var sut = Assembly.LoadFrom("Jwc.Experimental.dll");
Assert.NotNull(sut);
var specifiedAssemblies = new []
{
"mscorlib"
};
var actual = sut.GetReferencedAssemblies().Select(an => an.Name).ToArray();
Assert.Equal(specifiedAssemblies.Length, actual.Length);
Assert.False(specifiedAssemblies.Except(actual).Any(), "Empty");
}
}
} | mit | C# |
00ebef4c2950bef40fbb2cd6eb35046adc1c673f | Fix registration of IActiveStatementSpanTrackerFactory | jasonmalinowski/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,gafter/roslyn,KevinRansom/roslyn,wvdd007/roslyn,tannergooding/roslyn,mgoertz-msft/roslyn,AlekseyTs/roslyn,gafter/roslyn,eriawan/roslyn,tannergooding/roslyn,genlu/roslyn,genlu/roslyn,mavasani/roslyn,weltkante/roslyn,tmat/roslyn,KevinRansom/roslyn,aelij/roslyn,dotnet/roslyn,sharwell/roslyn,bartdesmet/roslyn,brettfo/roslyn,tmat/roslyn,heejaechang/roslyn,KevinRansom/roslyn,stephentoub/roslyn,wvdd007/roslyn,physhi/roslyn,stephentoub/roslyn,heejaechang/roslyn,CyrusNajmabadi/roslyn,aelij/roslyn,tannergooding/roslyn,diryboy/roslyn,jmarolf/roslyn,CyrusNajmabadi/roslyn,brettfo/roslyn,CyrusNajmabadi/roslyn,jmarolf/roslyn,ErikSchierboom/roslyn,panopticoncentral/roslyn,AmadeusW/roslyn,mavasani/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,mgoertz-msft/roslyn,sharwell/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,diryboy/roslyn,diryboy/roslyn,physhi/roslyn,bartdesmet/roslyn,heejaechang/roslyn,dotnet/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,genlu/roslyn,weltkante/roslyn,AmadeusW/roslyn,weltkante/roslyn,KirillOsenkov/roslyn,aelij/roslyn,eriawan/roslyn,dotnet/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,brettfo/roslyn,shyamnamboodiripad/roslyn,KirillOsenkov/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,gafter/roslyn,panopticoncentral/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,eriawan/roslyn,KirillOsenkov/roslyn,tmat/roslyn,sharwell/roslyn | src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementSpanTrackerFactory.cs | src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementSpanTrackerFactory.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.
#nullable enable
using System;
using System.Composition;
using Microsoft.CodeAnalysis.EditAndContinue;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue
{
internal sealed class ActiveStatementSpanTrackerFactory : IActiveStatementSpanTrackerFactory
{
[ExportWorkspaceServiceFactory(typeof(IActiveStatementSpanTrackerFactory), ServiceLayer.Editor), Shared]
private sealed class Factory : IWorkspaceServiceFactory
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public Factory() { }
[Obsolete(MefConstruction.FactoryMethodMessage, error: true)]
public IWorkspaceService CreateService(HostWorkspaceServices services)
=> new ActiveStatementSpanTrackerFactory(services);
}
private readonly IActiveStatementSpanTracker _tracker;
[Obsolete(MefConstruction.FactoryMethodMessage, error: true)]
public ActiveStatementSpanTrackerFactory(HostWorkspaceServices services)
{
_tracker = new Tracker(services.GetRequiredService<IActiveStatementTrackingService>());
}
public IActiveStatementSpanTracker GetOrCreateActiveStatementSpanTracker()
{
return _tracker;
}
private sealed class Tracker : IActiveStatementSpanTracker
{
private readonly IActiveStatementTrackingService _trackingService;
[Obsolete(MefConstruction.FactoryMethodMessage, error: true)]
public Tracker(IActiveStatementTrackingService activeStatementTrackingService)
{
_trackingService = activeStatementTrackingService;
}
public bool TryGetSpan(ActiveStatementId id, SourceText source, out TextSpan span)
=> _trackingService.TryGetSpan(id, source, out span);
}
}
}
| // 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.
#nullable enable
using System;
using System.Composition;
using Microsoft.CodeAnalysis.EditAndContinue;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue
{
internal sealed class ActiveStatementSpanTrackerFactory : IActiveStatementSpanTrackerFactory
{
[ExportWorkspaceServiceFactory(typeof(IActiveStatementSpanTracker), ServiceLayer.Editor), Shared]
private sealed class Factory : IWorkspaceServiceFactory
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public Factory() { }
[Obsolete(MefConstruction.FactoryMethodMessage, error: true)]
public IWorkspaceService CreateService(HostWorkspaceServices services)
=> new ActiveStatementSpanTrackerFactory(services);
}
private readonly IActiveStatementSpanTracker _tracker;
[Obsolete(MefConstruction.FactoryMethodMessage, error: true)]
public ActiveStatementSpanTrackerFactory(HostWorkspaceServices services)
{
_tracker = new Tracker(services.GetRequiredService<IActiveStatementTrackingService>());
}
public IActiveStatementSpanTracker GetOrCreateActiveStatementSpanTracker()
{
return _tracker;
}
private sealed class Tracker : IActiveStatementSpanTracker
{
private readonly IActiveStatementTrackingService _trackingService;
[Obsolete(MefConstruction.FactoryMethodMessage, error: true)]
public Tracker(IActiveStatementTrackingService activeStatementTrackingService)
{
_trackingService = activeStatementTrackingService;
}
public bool TryGetSpan(ActiveStatementId id, SourceText source, out TextSpan span)
=> _trackingService.TryGetSpan(id, source, out span);
}
}
}
| mit | C# |
fcd6d751348d78aaea22686f4250302be2991ee2 | Add helper method to create `LinearAnimation` | Weingartner/SolidworksAddinFramework | SolidworksAddinFramework/OpenGl/Animation/LinearAnimation.cs | SolidworksAddinFramework/OpenGl/Animation/LinearAnimation.cs | using System;
using System.Diagnostics;
using System.Numerics;
using ReactiveUI;
namespace SolidworksAddinFramework.OpenGl.Animation
{
public class LinearAnimation<T> : ReactiveObject, IAnimationSection
where T : IInterpolatable<T>
{
public T From { get; }
public T To { get; }
public TimeSpan Duration { get; }
public LinearAnimation(TimeSpan duration, T @from, T to)
{
Duration = duration;
From = @from;
To = to;
}
public Matrix4x4 Transform( TimeSpan deltaTime)
{
var beta = deltaTime.TotalMilliseconds/Duration.TotalMilliseconds;
return BlendTransform(beta);
}
public Matrix4x4 BlendTransform(double beta)
{
Debug.Assert(beta>=0 && beta<=1);
return From.Interpolate(To, beta).Transform();
}
}
public static class LinearAnimation
{
public static LinearAnimation<T> Create<T>(TimeSpan duration, T from, T to)
where T : IInterpolatable<T>
{
return new LinearAnimation<T>(duration, from, to);
}
}
} | using System;
using System.Diagnostics;
using System.Numerics;
using ReactiveUI;
namespace SolidworksAddinFramework.OpenGl.Animation
{
public class LinearAnimation<T> : ReactiveObject, IAnimationSection
where T : IInterpolatable<T>
{
public T From { get; }
public T To { get; }
public TimeSpan Duration { get; }
public LinearAnimation(TimeSpan duration, T @from, T to)
{
Duration = duration;
From = @from;
To = to;
}
public Matrix4x4 Transform( TimeSpan deltaTime)
{
var beta = deltaTime.TotalMilliseconds/Duration.TotalMilliseconds;
return BlendTransform(beta);
}
public Matrix4x4 BlendTransform(double beta)
{
Debug.Assert(beta>=0 && beta<=1);
return From.Interpolate(To, beta).Transform();
}
}
} | mit | C# |
aa17a3ffbdafecc1ec233c77178b615456708787 | Change test timing | rainersigwald/msbuild,AndyGerlicher/msbuild,AndyGerlicher/msbuild,sean-gilliam/msbuild,AndyGerlicher/msbuild,rainersigwald/msbuild,rainersigwald/msbuild,AndyGerlicher/msbuild,sean-gilliam/msbuild,sean-gilliam/msbuild,sean-gilliam/msbuild,rainersigwald/msbuild | src/Build.UnitTests/BackEnd/RedirectConsoleWriter_Tests.cs | src/Build.UnitTests/BackEnd/RedirectConsoleWriter_Tests.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Build.Experimental;
using Shouldly;
using Xunit;
namespace Microsoft.Build.Engine.UnitTests.BackEnd
{
public class RedirectConsoleWriter_Tests
{
[Fact]
public async Task EmitConsoleMessages()
{
StringBuilder sb = new StringBuilder();
using (TextWriter writer = OutOfProcServerNode.RedirectConsoleWriter.Create(text => sb.Append(text)))
{
writer.WriteLine("Line 1");
await Task.Delay(80); // should be somehow bigger than `RedirectConsoleWriter` flush period - see its constructor
writer.Write("Line 2");
}
sb.ToString().ShouldBe($"Line 1{Environment.NewLine}Line 2");
}
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Build.Experimental;
using Shouldly;
using Xunit;
namespace Microsoft.Build.Engine.UnitTests.BackEnd
{
public class RedirectConsoleWriter_Tests
{
[Fact]
public async Task EmitConsoleMessages()
{
StringBuilder sb = new StringBuilder();
using (TextWriter writer = OutOfProcServerNode.RedirectConsoleWriter.Create(text => sb.Append(text)))
{
writer.WriteLine("Line 1");
await Task.Delay(300);
writer.Write("Line 2");
}
sb.ToString().ShouldBe($"Line 1{Environment.NewLine}Line 2");
}
}
}
| mit | C# |
a47d9b6487dad0303eec8728f30bc14c25d911c8 | Improve comments ColorSpectrumChannels clarifying axis mappings | AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia | src/Avalonia.Controls/ColorPicker/ColorSpectrumChannels.cs | src/Avalonia.Controls/ColorPicker/ColorSpectrumChannels.cs | // This source file is adapted from the WinUI project.
// (https://github.com/microsoft/microsoft-ui-xaml)
//
// Licensed to The Avalonia Project under the MIT License.
using Avalonia.Controls.Primitives;
namespace Avalonia.Controls
{
/// <summary>
/// Defines the two HSV color channels displayed by a <see cref="ColorSpectrum"/>.
/// </summary>
/// <remarks>
/// Order of the color channels is important and correspond with an X/Y axis in Box
/// shape or a degree/radius in Ring shape.
/// </remarks>
public enum ColorSpectrumChannels
{
/// <summary>
/// The Hue and Value channels.
/// </summary>
/// <remarks>
/// In Box shape, Hue is mapped to the X-axis and Value is mapped to the Y-axis.
/// In Ring shape, Hue is mapped to degrees and Value is mapped to radius.
/// </remarks>
HueValue,
/// <summary>
/// The Value and Hue channels.
/// </summary>
/// <remarks>
/// In Box shape, Value is mapped to the X-axis and Hue is mapped to the Y-axis.
/// In Ring shape, Value is mapped to degrees and Hue is mapped to radius.
/// </remarks>
ValueHue,
/// <summary>
/// The Hue and Saturation channels.
/// </summary>
/// <remarks>
/// In Box shape, Hue is mapped to the X-axis and Saturation is mapped to the Y-axis.
/// In Ring shape, Hue is mapped to degrees and Saturation is mapped to radius.
/// </remarks>
HueSaturation,
/// <summary>
/// The Saturation and Hue channels.
/// </summary>
/// <remarks>
/// In Box shape, Saturation is mapped to the X-axis and Hue is mapped to the Y-axis.
/// In Ring shape, Saturation is mapped to degrees and Hue is mapped to radius.
/// </remarks>
SaturationHue,
/// <summary>
/// The Saturation and Value channels.
/// </summary>
/// <remarks>
/// In Box shape, Saturation is mapped to the X-axis and Value is mapped to the Y-axis.
/// In Ring shape, Saturation is mapped to degrees and Value is mapped to radius.
/// </remarks>
SaturationValue,
/// <summary>
/// The Value and Saturation channels.
/// </summary>
/// <remarks>
/// In Box shape, Value is mapped to the X-axis and Saturation is mapped to the Y-axis.
/// In Ring shape, Value is mapped to degrees and Saturation is mapped to radius.
/// </remarks>
ValueSaturation,
};
}
| // This source file is adapted from the WinUI project.
// (https://github.com/microsoft/microsoft-ui-xaml)
//
// Licensed to The Avalonia Project under the MIT License.
using Avalonia.Controls.Primitives;
namespace Avalonia.Controls
{
/// <summary>
/// Defines the two HSV color channels displayed by a <see cref="ColorSpectrum"/>.
/// Order of the color channels is important.
/// </summary>
public enum ColorSpectrumChannels
{
/// <summary>
/// The Hue and Value channels.
/// </summary>
HueValue,
/// <summary>
/// The Value and Hue channels.
/// </summary>
ValueHue,
/// <summary>
/// The Hue and Saturation channels.
/// </summary>
HueSaturation,
/// <summary>
/// The Saturation and Hue channels.
/// </summary>
SaturationHue,
/// <summary>
/// The Saturation and Value channels.
/// </summary>
SaturationValue,
/// <summary>
/// The Value and Saturation channels.
/// </summary>
ValueSaturation,
};
}
| mit | C# |
c6fd87158aa0c65f3a4a38b8387202642fe74574 | Bump version nr. | galtrold/propeller.mvc,galtrold/propeller.mvc,galtrold/propeller.mvc,galtrold/propeller.mvc,galtrold/propeller.mvc | src/Framework/PropellerMvcModel/Properties/AssemblyInfo.cs | src/Framework/PropellerMvcModel/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("Propeller.Mvc.Model")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Propeller.Mvc.Model")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("479a5641-1614-4d2a-aeab-afa79884e207")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.13")]
[assembly: AssemblyFileVersion("1.1.0.13")]
| 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("Propeller.Mvc.Model")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Propeller.Mvc.Model")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("479a5641-1614-4d2a-aeab-afa79884e207")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.12")]
[assembly: AssemblyFileVersion("1.1.0.12")]
| mit | C# |
145fa82f4ed5a827de09e0cc6202eea6cb72309b | Fix issue #33 | XAM-Consulting/FreshEssentials,XAM-Consulting/FreshEssentials | src/FreshEssentials/Gestures/ListViewItemTappedAttached.cs | src/FreshEssentials/Gestures/ListViewItemTappedAttached.cs | using System;
using Xamarin.Forms;
using System.Windows.Input;
namespace FreshEssentials
{
public class ListViewItemTappedAttached
{
public static readonly BindableProperty CommandProperty =
BindableProperty.CreateAttached(
propertyName: "Command",
returnType: typeof(ICommand),
declaringType: typeof(ListView),
defaultValue: null,
defaultBindingMode: BindingMode.OneWay,
validateValue: null,
propertyChanged: OnItemTappedChanged);
public static ICommand GetItemTapped(BindableObject bindable)
{
return (ICommand)bindable.GetValue(CommandProperty);
}
public static void SetItemTapped(BindableObject bindable, ICommand value)
{
bindable.SetValue(CommandProperty, value);
}
public static void OnItemTappedChanged(BindableObject bindable, object oldValue, object newValue)
{
if (!(bindable is ListView listView))
return;
if (oldValue != null)
listView.ItemTapped -= OnItemTapped;
if (newValue != null)
listView.ItemTapped += OnItemTapped;
}
private static void OnItemTapped(object sender, ItemTappedEventArgs e)
{
var control = sender as ListView;
var command = GetItemTapped(control);
if (command != null && command.CanExecute(e.Item))
command.Execute(e.Item);
}
}
}
| using System;
using Xamarin.Forms;
using System.Windows.Input;
namespace FreshEssentials
{
public class ListViewItemTappedAttached
{
public static readonly BindableProperty CommandProperty =
BindableProperty.CreateAttached(
propertyName: "Command",
returnType: typeof(ICommand),
declaringType: typeof(ListView),
defaultValue: null,
defaultBindingMode: BindingMode.OneWay,
validateValue: null,
propertyChanged: OnItemTappedChanged);
public static ICommand GetItemTapped(BindableObject bindable)
{
return (ICommand)bindable.GetValue(CommandProperty);
}
public static void SetItemTapped(BindableObject bindable, ICommand value)
{
bindable.SetValue(CommandProperty, value);
}
public static void OnItemTappedChanged(BindableObject bindable, object oldValue, object newValue)
{
var control = bindable as ListView;
if (control != null)
control.ItemTapped += OnItemTapped;
}
private static void OnItemTapped(object sender, ItemTappedEventArgs e)
{
var control = sender as ListView;
var command = GetItemTapped(control);
if (command != null && command.CanExecute(e.Item))
command.Execute(e.Item);
}
}
}
| apache-2.0 | C# |
807463edca90444b66ffe254d03103c697f69b21 | Replace any API endpoint [::] for localhost when configuring HttpClient base address | duracellko/planningpoker4azure,duracellko/planningpoker4azure,duracellko/planningpoker4azure | src/Duracellko.PlanningPoker.Web/HttpClientSetupService.cs | src/Duracellko.PlanningPoker.Web/HttpClientSetupService.cs | using System;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.Extensions.Hosting;
namespace Duracellko.PlanningPoker.Web
{
public class HttpClientSetupService : BackgroundService
{
private readonly HttpClient _httpClient;
private readonly IServer _server;
public HttpClientSetupService(HttpClient httpClient, IServer server)
{
_httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
_server = server ?? throw new ArgumentNullException(nameof(server));
}
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
var serverAddresses = _server.Features.Get<IServerAddressesFeature>();
var address = serverAddresses.Addresses.FirstOrDefault();
if (address == null)
{
// Default ASP.NET Core Kestrel endpoint
address = "http://localhost:5000";
}
else
{
address = address.Replace("*", "localhost", StringComparison.Ordinal);
address = address.Replace("+", "localhost", StringComparison.Ordinal);
address = address.Replace("[::]", "localhost", StringComparison.Ordinal);
}
_httpClient.BaseAddress = new Uri(address);
return Task.CompletedTask;
}
}
}
| using System;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.Extensions.Hosting;
namespace Duracellko.PlanningPoker.Web
{
public class HttpClientSetupService : BackgroundService
{
private readonly HttpClient _httpClient;
private readonly IServer _server;
public HttpClientSetupService(HttpClient httpClient, IServer server)
{
_httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
_server = server ?? throw new ArgumentNullException(nameof(server));
}
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
var serverAddresses = _server.Features.Get<IServerAddressesFeature>();
var address = serverAddresses.Addresses.FirstOrDefault();
if (address == null)
{
// Default ASP.NET Core Kestrel endpoint
address = "http://localhost:5000";
}
else
{
address = address.Replace("*", "localhost", StringComparison.Ordinal);
address = address.Replace("+", "localhost", StringComparison.Ordinal);
}
_httpClient.BaseAddress = new Uri(address);
return Task.CompletedTask;
}
}
}
| mit | C# |
5719051bbc616be9423a925bc70981d3e4db7755 | Remove duplicate mapping logic. | JasonGT/NorthwindTraders,JasonGT/NorthwindTraders,JasonGT/NorthwindTraders,JasonGT/NorthwindTraders | Northwind.Application/Customers/Queries/GetCustomerDetail/GetCustomerDetailQueryHandler.cs | Northwind.Application/Customers/Queries/GetCustomerDetail/GetCustomerDetailQueryHandler.cs | using System.Threading;
using System.Threading.Tasks;
using MediatR;
using Northwind.Application.Exceptions;
using Northwind.Domain.Entities;
using Northwind.Persistence;
namespace Northwind.Application.Customers.Queries.GetCustomerDetail
{
public class GetCustomerDetailQueryHandler : IRequestHandler<GetCustomerDetailQuery, CustomerDetailModel>
{
private readonly NorthwindDbContext _context;
public GetCustomerDetailQueryHandler(NorthwindDbContext context)
{
_context = context;
}
public async Task<CustomerDetailModel> Handle(GetCustomerDetailQuery request, CancellationToken cancellationToken)
{
var entity = await _context.Customers
.FindAsync(request.Id);
if (entity == null)
{
throw new NotFoundException(nameof(Customer), request.Id);
}
return CustomerDetailModel.Create(entity);
}
}
}
| using System.Threading;
using System.Threading.Tasks;
using MediatR;
using Northwind.Application.Exceptions;
using Northwind.Domain.Entities;
using Northwind.Persistence;
namespace Northwind.Application.Customers.Queries.GetCustomerDetail
{
public class GetCustomerDetailQueryHandler : IRequestHandler<GetCustomerDetailQuery, CustomerDetailModel>
{
private readonly NorthwindDbContext _context;
public GetCustomerDetailQueryHandler(NorthwindDbContext context)
{
_context = context;
}
public async Task<CustomerDetailModel> Handle(GetCustomerDetailQuery request, CancellationToken cancellationToken)
{
var entity = await _context.Customers
.FindAsync(request.Id);
if (entity == null)
{
throw new NotFoundException(nameof(Customer), request.Id);
}
return new CustomerDetailModel
{
Id = entity.CustomerId,
Address = entity.Address,
City = entity.City,
CompanyName = entity.CompanyName,
ContactName = entity.ContactName,
ContactTitle = entity.ContactTitle,
Country = entity.Country,
Fax = entity.Fax,
Phone = entity.Phone,
PostalCode = entity.PostalCode,
Region = entity.Region
};
}
}
}
| mit | C# |
35b9dddabdee020e952181dc657791d4299a684b | Add Uri Path Extension - constraints: new { ext = @"|json|xml|csv" } | DataBooster/DbWebApi,DataBooster/DbWebApi,DataBooster/DbWebApi,DataBooster/DbWebApi | Examples/MyDbWebApi/App_Start/WebApiConfig.cs | Examples/MyDbWebApi/App_Start/WebApiConfig.cs | using System;
using System.Web.Http;
using DataBooster.DbWebApi;
namespace MyDbWebApi
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DbWebApi",
routeTemplate: "{sp}/{ext}",
defaults: new { controller = "DbWebApi", ext = RouteParameter.Optional },
constraints: new { ext = @"|json|xml|csv" }
);
config.SupportCsvMediaType();
DbWebApiOptions.DerivedParametersCacheExpireInterval = new TimeSpan(0, 15, 0);
}
}
}
| using System;
using System.Web.Http;
using DataBooster.DbWebApi;
namespace MyDbWebApi
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DbWebApi",
routeTemplate: "{sp}",
defaults: new { controller = "DbWebApi" }
);
config.SupportCsvMediaType();
DbWebApiOptions.DerivedParametersCacheExpireInterval = new TimeSpan(0, 15, 0);
}
}
}
| mit | C# |
da66e0c40052f8fb719f0e3da6706720ade05ada | Change Id to be an object instead of a string. | Gekctek/JsonRpc.Router,edjCase/JsonRpc,edjCase/JsonRpc | src/JsonRpc.Core/RpcRequest.cs | src/JsonRpc.Core/RpcRequest.cs | using System.Collections.Generic;
using edjCase.JsonRpc.Core.JsonConverters;
using Newtonsoft.Json;
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Local
// ReSharper disable UnusedMember.Local
namespace edjCase.JsonRpc.Core
{
/// <summary>
/// Model representing a Rpc request
/// </summary>
[JsonObject]
public class RpcRequest
{
[JsonConstructor]
private RpcRequest()
{
}
/// <param name="id">Request id</param>
/// <param name="method">Target method name</param>
/// <param name="parameterList">List of parameters for the target method</param>
public RpcRequest(object id, string method, params object[] parameterList)
{
this.Id = id;
this.JsonRpcVersion = JsonRpcContants.JsonRpcVersion;
this.Method = method;
this.RawParameters = parameterList;
}
/// <param name="id">Request id</param>
/// <param name="method">Target method name</param>
/// <param name="parameterMap">Map of parameter name to parameter value for the target method</param>
public RpcRequest(object id, string method, Dictionary<string, object> parameterMap)
{
this.Id = id;
this.JsonRpcVersion = JsonRpcContants.JsonRpcVersion;
this.Method = method;
this.RawParameters = parameterMap;
}
/// <summary>
/// Request Id (Optional)
/// </summary>
[JsonProperty("id")]
[JsonConverter(typeof(RpcIdJsonConverter))]
public object Id { get; private set; }
/// <summary>
/// Version of the JsonRpc to be used (Required)
/// </summary>
[JsonProperty("jsonrpc", Required = Required.Always)]
public string JsonRpcVersion { get; private set; }
/// <summary>
/// Name of the target method (Required)
/// </summary>
[JsonProperty("method", Required = Required.Always)]
public string Method { get; private set; }
/// <summary>
/// Parameters to invoke the method with (Optional)
/// </summary>
[JsonProperty("params")]
[JsonConverter(typeof(RpcParametersJsonConverter))]
public object RawParameters { get; private set; }
/// <summary>
/// Gets the raw parameters as an object array
/// </summary>
[JsonIgnore]
public object[] ParameterList => this.RawParameters as object[];
/// <summary>
/// Gets the raw parameters as a parameter map
/// </summary>
[JsonIgnore]
public Dictionary<string, object> ParameterMap => this.RawParameters as Dictionary<string, object>;
}
}
| using System.Collections.Generic;
using edjCase.JsonRpc.Core.JsonConverters;
using Newtonsoft.Json;
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Local
// ReSharper disable UnusedMember.Local
namespace edjCase.JsonRpc.Core
{
/// <summary>
/// Model representing a Rpc request
/// </summary>
[JsonObject]
public class RpcRequest
{
[JsonConstructor]
private RpcRequest()
{
}
/// <param name="id">Request id</param>
/// <param name="method">Target method name</param>
/// <param name="parameterList">List of parameters for the target method</param>
public RpcRequest(string id, string method, params object[] parameterList)
{
this.Id = id;
this.JsonRpcVersion = JsonRpcContants.JsonRpcVersion;
this.Method = method;
this.RawParameters = parameterList;
}
/// <param name="id">Request id</param>
/// <param name="method">Target method name</param>
/// <param name="parameterMap">Map of parameter name to parameter value for the target method</param>
public RpcRequest(string id, string method, Dictionary<string, object> parameterMap)
{
this.Id = id;
this.JsonRpcVersion = JsonRpcContants.JsonRpcVersion;
this.Method = method;
this.RawParameters = parameterMap;
}
/// <summary>
/// Request Id (Optional)
/// </summary>
[JsonProperty("id")]
[JsonConverter(typeof(RpcIdJsonConverter))]
public object Id { get; private set; }
/// <summary>
/// Version of the JsonRpc to be used (Required)
/// </summary>
[JsonProperty("jsonrpc", Required = Required.Always)]
public string JsonRpcVersion { get; private set; }
/// <summary>
/// Name of the target method (Required)
/// </summary>
[JsonProperty("method", Required = Required.Always)]
public string Method { get; private set; }
/// <summary>
/// Parameters to invoke the method with (Optional)
/// </summary>
[JsonProperty("params")]
[JsonConverter(typeof(RpcParametersJsonConverter))]
public object RawParameters { get; private set; }
/// <summary>
/// Gets the raw parameters as an object array
/// </summary>
[JsonIgnore]
public object[] ParameterList => this.RawParameters as object[];
/// <summary>
/// Gets the raw parameters as a parameter map
/// </summary>
[JsonIgnore]
public Dictionary<string, object> ParameterMap => this.RawParameters as Dictionary<string, object>;
}
}
| mit | C# |
12a21a9e0a68071a1f5e5aecfe7f765eb052910d | Fix build method visibility | StanleyGoldman/NRules,NRules/NRules,prashanthr/NRules,StanleyGoldman/NRules | src/NRules/NRules.RuleModel/Builders/ActionGroupBuilder.cs | src/NRules/NRules.RuleModel/Builders/ActionGroupBuilder.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace NRules.RuleModel.Builders
{
/// <summary>
/// Builder to compose a group of rule actions.
/// </summary>
public class ActionGroupBuilder : RuleElementBuilder, IBuilder<ActionGroupElement>
{
private readonly List<ActionElement> _actions = new List<ActionElement>();
internal ActionGroupBuilder(SymbolTable scope) : base(scope)
{
}
/// <summary>
/// Adds a rule action to the group.
/// </summary>
/// <param name="expression">Rule action expression.</param>
public void Action(LambdaExpression expression)
{
if (expression.Parameters.Count == 0 ||
expression.Parameters.First().Type != typeof(IContext))
{
throw new ArgumentException(
string.Format("Action expression must have {0} as its first parameter", typeof(IContext)));
}
IEnumerable<ParameterExpression> parameters = expression.Parameters.Skip(1);
IEnumerable<Declaration> declarations = parameters.Select(p => Scope.Lookup(p.Name, p.Type));
var actionElement = new ActionElement(declarations, expression);
_actions.Add(actionElement);
}
ActionGroupElement IBuilder<ActionGroupElement>.Build()
{
var actionGroup = new ActionGroupElement(_actions);
return actionGroup;
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace NRules.RuleModel.Builders
{
/// <summary>
/// Builder to compose a group of rule actions.
/// </summary>
public class ActionGroupBuilder : RuleElementBuilder, IBuilder<ActionGroupElement>
{
private readonly List<ActionElement> _actions = new List<ActionElement>();
internal ActionGroupBuilder(SymbolTable scope) : base(scope)
{
}
/// <summary>
/// Adds a rule action to the group.
/// </summary>
/// <param name="expression">Rule action expression.</param>
public void Action(LambdaExpression expression)
{
if (expression.Parameters.Count == 0 ||
expression.Parameters.First().Type != typeof(IContext))
{
throw new ArgumentException(
string.Format("Action expression must have {0} as its first parameter", typeof(IContext)));
}
IEnumerable<ParameterExpression> parameters = expression.Parameters.Skip(1);
IEnumerable<Declaration> declarations = parameters.Select(p => Scope.Lookup(p.Name, p.Type));
var actionElement = new ActionElement(declarations, expression);
_actions.Add(actionElement);
}
public ActionGroupElement Build()
{
var actionGroup = new ActionGroupElement(_actions);
return actionGroup;
}
}
} | mit | C# |
06720ca68077eeb545932e881d5413f2bb1bf784 | Initialize AggregateRepository only for CommandConsumer | Elders/Cronus,Elders/Cronus | src/Elders.Cronus/Properties/AssemblyInfo.cs | src/Elders.Cronus/Properties/AssemblyInfo.cs | // <auto-generated/>
using System.Reflection;
[assembly: AssemblyTitleAttribute("Elders.Cronus")]
[assembly: AssemblyDescriptionAttribute("Elders.Cronus")]
[assembly: AssemblyProductAttribute("Elders.Cronus")]
[assembly: AssemblyVersionAttribute("1.2.8")]
[assembly: AssemblyInformationalVersionAttribute("1.2.8")]
[assembly: AssemblyFileVersionAttribute("1.2.8")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "1.2.8";
}
}
| // <auto-generated/>
using System.Reflection;
[assembly: AssemblyTitleAttribute("Elders.Cronus")]
[assembly: AssemblyDescriptionAttribute("Elders.Cronus")]
[assembly: AssemblyProductAttribute("Elders.Cronus")]
[assembly: AssemblyVersionAttribute("1.2.7")]
[assembly: AssemblyInformationalVersionAttribute("1.2.7")]
[assembly: AssemblyFileVersionAttribute("1.2.7")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "1.2.7";
}
}
| apache-2.0 | C# |
da0114bb9264952cc84f2656df801f5cf3b9bc90 | use loose comparison in GetRecords | nerai/CMenu | src/ExampleMenu/Recording/FileRecordStore.cs | src/ExampleMenu/Recording/FileRecordStore.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ExampleMenu.Recording
{
/// <summary>
/// Stores records to files
/// </summary>
public class FileRecordStore : IRecordStore
{
public FileRecordStore ()
{
RecordDirectory = ".\\Records\\";
}
public string RecordDirectory
{
get;
set;
}
public void AddRecord (string name, IEnumerable<string> lines)
{
if (name == null) {
throw new ArgumentNullException ("name");
}
if (lines == null) {
throw new ArgumentNullException ("lines");
}
Directory.CreateDirectory (RecordDirectory);
var path = RecordDirectory + name;
File.WriteAllLines (path, lines);
}
/// <summary>
/// Retrieves the specified record.
///
/// The record chosen is the first one to match, in order, any of the following:
/// a) an exact match
/// b) a record name starting with the specified name
/// c) a record name containing the specified name
/// d) a record name containing the specified name nonconsecutively
/// </summary>
public IEnumerable<string> GetRecord (string name)
{
if (name == null) {
throw new ArgumentNullException ("name");
}
var path = RecordDirectory + name;
if (!File.Exists (path)) {
var rec = Util.LooseSelect (GetRecordNames (), name, StringComparison.CurrentCultureIgnoreCase);
if (rec == null) {
return null;
}
path = RecordDirectory + rec;
}
var lines = File.ReadAllLines (path);
return lines;
}
public IEnumerable<string> GetRecordNames ()
{
if (!Directory.Exists (RecordDirectory)) {
return new string[0];
}
var files = Directory
.EnumerateFiles (RecordDirectory)
.Select (f => f.Substring (RecordDirectory.Length));
return files;
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ExampleMenu.Recording
{
/// <summary>
/// Stores records to files
/// </summary>
public class FileRecordStore : IRecordStore
{
public FileRecordStore ()
{
RecordDirectory = ".\\Records\\";
}
public string RecordDirectory
{
get;
set;
}
public void AddRecord (string name, IEnumerable<string> lines)
{
if (name == null) {
throw new ArgumentNullException ("name");
}
if (lines == null) {
throw new ArgumentNullException ("lines");
}
Directory.CreateDirectory (RecordDirectory);
var path = RecordDirectory + name;
File.WriteAllLines (path, lines);
}
/// <summary>
/// Retrieves the specified record.
///
/// The record chosen is the first one to match, in order, any of the following:
/// a) an exact match
/// b) a record name starting with the specified name
/// c) a record name containing the specified name
/// </summary>
public IEnumerable<string> GetRecord (string name)
{
if (name == null) {
throw new ArgumentNullException ("name");
}
var path = RecordDirectory + name;
if (!File.Exists (path)) {
var rec = GetRecordNames ().FirstOrDefault (n => n.StartsWith (name, StringComparison.InvariantCultureIgnoreCase));
rec = rec ?? GetRecordNames ().FirstOrDefault (n => n.Contains (name));
if (rec == null) {
return null;
}
path = RecordDirectory + rec;
}
var lines = File.ReadAllLines (path);
return lines;
}
public IEnumerable<string> GetRecordNames ()
{
if (!Directory.Exists (RecordDirectory)) {
return new string[0];
}
var files = Directory
.EnumerateFiles (RecordDirectory)
.Select (f => f.Substring (RecordDirectory.Length));
return files;
}
}
}
| mit | C# |
f6401567875ceffee7b4d720d9cd7e6616c16dda | Include missing fields. | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/MaximilianLærum.cs | src/Firehose.Web/Authors/MaximilianLærum.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MaximilianLærum : IAmACommunityMember
{
public string FirstName => "Maximilian";
public string LastName => "Lærum";
public string ShortBioOrTagLine => "PowerShell enthusiast";
public string StateOrRegion => "Norway";
public string TwitterHandle => "tr4psec";
public string GravatarHash => "0e45a9759e36d29ac45cf020882cdf5c";
public string GitHubHandle => "Tr4pSec";
public GeoPosition Position => new GeoPosition(59.4172096, 10.4834299);
public string EmailAddress => "";
public Uri WebSite => new Uri("https://get-help.guru/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://get-help.guru/rss"); } }
}
}
| public class MaximilianLærum : IAmACommunityMember
{
public string FirstName => "Maximilian";
public string LastName => "Lærum";
public string ShortBioOrTagLine => "PowerShell enthusiast";
public string StateOrRegion => "Norway";
public string TwitterHandle => "tr4psec";
public string GravatarHash => "0e45a9759e36d29ac45cf020882cdf5c";
public string GitHubHandle => "Tr4pSec";
public GeoPosition Position => new GeoPosition(59.4172096, 10.4834299);
public Uri WebSite => new Uri("https://get-help.guru/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://get-help.guru/rss"); } }
}
| mit | C# |
87fbb45099a39c9942424033c11ddf537ea142a6 | Fix comment | adamhathcock/sharpcompress,adamhathcock/sharpcompress,adamhathcock/sharpcompress | src/SharpCompress/Common/Entry.cs | src/SharpCompress/Common/Entry.cs | using System;
using System.Collections.Generic;
namespace SharpCompress.Common
{
public abstract class Entry : IEntry
{
/// <summary>
/// The File's 32 bit CRC Hash
/// </summary>
public abstract long Crc { get; }
/// <summary>
/// The string key of the file internal to the Archive.
/// </summary>
public abstract string Key { get; }
/// <summary>
/// The compressed file size
/// </summary>
public abstract long CompressedSize { get; }
/// <summary>
/// The compression type
/// </summary>
public abstract CompressionType CompressionType { get; }
/// <summary>
/// The uncompressed file size
/// </summary>
public abstract long Size { get; }
/// <summary>
/// The entry last modified time in the archive, if recorded
/// </summary>
public abstract DateTime? LastModifiedTime { get; }
/// <summary>
/// The entry create time in the archive, if recorded
/// </summary>
public abstract DateTime? CreatedTime { get; }
/// <summary>
/// The entry last accessed time in the archive, if recorded
/// </summary>
public abstract DateTime? LastAccessedTime { get; }
/// <summary>
/// The entry time when archived, if recorded
/// </summary>
public abstract DateTime? ArchivedTime { get; }
/// <summary>
/// Entry is password protected and encrypted and cannot be extracted.
/// </summary>
public abstract bool IsEncrypted { get; }
/// <summary>
/// Entry is directory.
/// </summary>
public abstract bool IsDirectory { get; }
/// <summary>
/// Entry is split among multiple volumes
/// </summary>
public abstract bool IsSplitAfter { get; }
/// <inheritdoc/>
public override string ToString()
{
return Key;
}
internal abstract IEnumerable<FilePart> Parts { get; }
internal bool IsSolid { get; set; }
internal virtual void Close()
{
}
/// <summary>
/// Entry file attribute.
/// </summary>
public virtual int? Attrib => throw new NotImplementedException();
}
}
| using System;
using System.Collections.Generic;
namespace SharpCompress.Common
{
public abstract class Entry : IEntry
{
/// <summary>
/// The File's 32 bit CRC Hash
/// </summary>
public abstract long Crc { get; }
/// <summary>
/// The string key of the file internal to the Archive.
/// </summary>
public abstract string Key { get; }
/// <summary>
/// The compressed file size
/// </summary>
public abstract long CompressedSize { get; }
/// <summary>
/// The compression type
/// </summary>
public abstract CompressionType CompressionType { get; }
/// <summary>
/// The uncompressed file size
/// </summary>
public abstract long Size { get; }
/// <summary>
/// The entry last modified time in the archive, if recorded
/// </summary>
public abstract DateTime? LastModifiedTime { get; }
/// <summary>
/// The entry create time in the archive, if recorded
/// </summary>
public abstract DateTime? CreatedTime { get; }
/// <summary>
/// The entry last accessed time in the archive, if recorded
/// </summary>
public abstract DateTime? LastAccessedTime { get; }
/// <summary>
/// The entry time when archived, if recorded
/// </summary>
public abstract DateTime? ArchivedTime { get; }
/// <summary>
/// Entry is password protected and encrypted and cannot be extracted.
/// </summary>
public abstract bool IsEncrypted { get; }
/// <summary>
/// Entry is password protected and encrypted and cannot be extracted.
/// </summary>
public abstract bool IsDirectory { get; }
/// <summary>
/// Entry is split among multiple volumes
/// </summary>
public abstract bool IsSplitAfter { get; }
/// <inheritdoc/>
public override string ToString()
{
return Key;
}
internal abstract IEnumerable<FilePart> Parts { get; }
internal bool IsSolid { get; set; }
internal virtual void Close()
{
}
/// <summary>
/// Entry file attribute.
/// </summary>
public virtual int? Attrib => throw new NotImplementedException();
}
} | mit | C# |
bbae674e231454355601690b47ad1a596ce03ee8 | 修改 Welcome view 接收 view Object. | NemoChenTW/MvcMovie,NemoChenTW/MvcMovie,NemoChenTW/MvcMovie | src/MvcMovie/Views/HelloWorld/Welcome.cshtml | src/MvcMovie/Views/HelloWorld/Welcome.cshtml | @{
ViewData["Title"] = "About";
}
<h2>Welcome</h2>
<ul>
@for (int i = 0; i < (int)ViewData["NumTimes"]; i++)
{
<li>@ViewData["Message"]</li>
}
</ul> | @*
For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
| apache-2.0 | C# |
10e50ae7a7627eaa713878eec59169338a226118 | Fix MethodInvoker.Invoke to use PreviousCallContainsDebuggerStepInCode | shrah/corert,yizhang82/corert,gregkalapos/corert,botaberg/corert,shrah/corert,krytarowski/corert,botaberg/corert,krytarowski/corert,botaberg/corert,shrah/corert,yizhang82/corert,yizhang82/corert,gregkalapos/corert,tijoytom/corert,yizhang82/corert,krytarowski/corert,gregkalapos/corert,tijoytom/corert,gregkalapos/corert,shrah/corert,tijoytom/corert,tijoytom/corert,krytarowski/corert,botaberg/corert | src/System.Private.Reflection.Core/src/Internal/Reflection/Core/Execution/MethodInvoker.cs | src/System.Private.Reflection.Core/src/Internal/Reflection/Core/Execution/MethodInvoker.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Reflection;
using System.Diagnostics;
using System.Globalization;
using System.Reflection.Runtime.General;
namespace Internal.Reflection.Core.Execution
{
//
// This class polymorphically implements the MethodBase.Invoke() api and its close cousins. MethodInvokers are designed to be built once and cached
// for maximum Invoke() throughput.
//
public abstract class MethodInvoker
{
protected MethodInvoker() { }
[DebuggerGuidedStepThrough]
public Object Invoke(Object thisObject, Object[] arguments, Binder binder, BindingFlags invokeAttr, CultureInfo cultureInfo)
{
BinderBundle binderBundle = binder.ToBinderBundle(invokeAttr, cultureInfo);
Object result = Invoke(thisObject, arguments, binderBundle);
System.Diagnostics.DebugAnnotations.PreviousCallContainsDebuggerStepInCode();
return result;
}
public abstract Object Invoke(Object thisObject, Object[] arguments, BinderBundle binderBundle);
public abstract Delegate CreateDelegate(RuntimeTypeHandle delegateType, Object target, bool isStatic, bool isVirtual, bool isOpen);
// This property is used to retrieve the target method pointer. It is used by the RuntimeMethodHandle.GetFunctionPointer API
public abstract IntPtr LdFtnResult { get; }
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Reflection;
using System.Diagnostics;
using System.Globalization;
using System.Reflection.Runtime.General;
namespace Internal.Reflection.Core.Execution
{
//
// This class polymorphically implements the MethodBase.Invoke() api and its close cousins. MethodInvokers are designed to be built once and cached
// for maximum Invoke() throughput.
//
public abstract class MethodInvoker
{
protected MethodInvoker() { }
[DebuggerGuidedStepThrough]
public Object Invoke(Object thisObject, Object[] arguments, Binder binder, BindingFlags invokeAttr, CultureInfo cultureInfo)
{
BinderBundle binderBundle = binder.ToBinderBundle(invokeAttr, cultureInfo);
Object result = Invoke(thisObject, arguments, binderBundle);
System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
return result;
}
public abstract Object Invoke(Object thisObject, Object[] arguments, BinderBundle binderBundle);
public abstract Delegate CreateDelegate(RuntimeTypeHandle delegateType, Object target, bool isStatic, bool isVirtual, bool isOpen);
// This property is used to retrieve the target method pointer. It is used by the RuntimeMethodHandle.GetFunctionPointer API
public abstract IntPtr LdFtnResult { get; }
}
}
| mit | C# |
ee17b84e25c44dd27f2c96e0eef70156015bc38b | set mezzi db | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.Persistence.MongoDB/GestioneComposizioneMezzi/SetComposizioneMezzi.cs | src/backend/SO115App.Persistence.MongoDB/GestioneComposizioneMezzi/SetComposizioneMezzi.cs | using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.API.Models.Classi.Composizione;
using SO115App.Models.Servizi.Infrastruttura.Composizione;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SO115App.Persistence.MongoDB.GestioneComposizioneMezzi
{
public class SetComposizioneMezzi : ISetComposizioneMezzi
{
private readonly DbContext _dbContext;
public SetComposizioneMezzi(DbContext dbContext) => _dbContext = dbContext;
public void Set(List<ComposizioneMezzi> mezzi)
{
foreach (var mezzo in mezzi)
{
var filter = Builders<ComposizioneMezzi>.Filter.Eq(s => s.Id, mezzo.Id);
if (_dbContext.ComposizioneMezziCollection.CountDocuments(filter) <= 0)
_dbContext.ComposizioneMezziCollection.InsertOne(mezzo);
}
}
}
}
| using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.API.Models.Classi.Composizione;
using SO115App.Models.Servizi.Infrastruttura.Composizione;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SO115App.Persistence.MongoDB.GestioneComposizioneMezzi
{
public class SetComposizioneMezzi : ISetComposizioneMezzi
{
private readonly DbContext _dbContext;
public SetComposizioneMezzi(DbContext dbContext) => _dbContext = dbContext;
public void Set(List<ComposizioneMezzi> mezzi)
{
Parallel.ForEach(mezzi, mezzo =>
{
var filter = Builders<ComposizioneMezzi>.Filter.Eq(s => s.Id, mezzo.Id);
if (_dbContext.ComposizioneMezziCollection.CountDocuments(filter) <= 0)
_dbContext.ComposizioneMezziCollection.InsertOne(mezzo);
});
}
}
}
| agpl-3.0 | C# |
a3bdd989ba474e9a3df1e95b805ff3456fccf6e5 | Remove OpCode and Task from mapping | TIMEmSYSTEM/slab-mongodb | sources/TIMEmSYSTEM.SemanticLogging.Mongo/EventEntryExtensions.cs | sources/TIMEmSYSTEM.SemanticLogging.Mongo/EventEntryExtensions.cs | using System.Collections.Generic;
using System.Linq;
using Microsoft.Practices.EnterpriseLibrary.SemanticLogging;
using MongoDB.Bson;
namespace TIMEmSYSTEM.SemanticLogging.Mongo
{
internal static class EventEntryExtensions
{
internal static BsonDocument AsBsonDocument(this EventEntry eventEntry)
{
var payload = eventEntry.Schema.Payload.Zip(eventEntry.Payload,
(key, value) => new KeyValuePair<string, object>(key, value)).ToDictionary(x => x.Key, y => y.Value);
var dictionary = new Dictionary<string, object>
{
{"event", eventEntry.EventId},
{"message", eventEntry.FormattedMessage},
{"timestamp", eventEntry.Timestamp.LocalDateTime},
{"provider", eventEntry.ProviderId},
{"activity", eventEntry.ActivityId},
{"process", eventEntry.ProcessId},
{"thread", eventEntry.ThreadId},
{"level", (int) eventEntry.Schema.Level},
{"keywords", (long) eventEntry.Schema.Keywords},
{"payload", new BsonDocument(payload)}
};
return new BsonDocument(dictionary);
}
internal static BsonDocument[] AsBsonDocuments(this IEnumerable<EventEntry> eventEntries)
{
return eventEntries.Select(AsBsonDocument).ToArray();
}
}
} | using System.Collections.Generic;
using System.Linq;
using Microsoft.Practices.EnterpriseLibrary.SemanticLogging;
using MongoDB.Bson;
namespace TIMEmSYSTEM.SemanticLogging.Mongo
{
internal static class EventEntryExtensions
{
internal static BsonDocument AsBsonDocument(this EventEntry eventEntry)
{
var payload = eventEntry.Schema.Payload.Zip(eventEntry.Payload,
(key, value) => new KeyValuePair<string, object>(key, value)).ToDictionary(x => x.Key, y => y.Value);
var dictionary = new Dictionary<string, object>
{
{"event", eventEntry.EventId},
{"message", eventEntry.FormattedMessage},
{"timestamp", eventEntry.Timestamp.LocalDateTime},
{"provider", eventEntry.ProviderId},
{"activity", eventEntry.ActivityId},
{"process", eventEntry.ProcessId},
{"thread", eventEntry.ThreadId},
{"level", (int) eventEntry.Schema.Level},
{"task", (int) eventEntry.Schema.Task},
{"ocode", (int) eventEntry.Schema.Opcode},
{"keywords", (long) eventEntry.Schema.Keywords},
{"payload", new BsonDocument(payload)}
};
return new BsonDocument(dictionary);
}
internal static BsonDocument[] AsBsonDocuments(this IEnumerable<EventEntry> eventEntries)
{
return eventEntries.Select(AsBsonDocument).ToArray();
}
}
} | mit | C# |
2339bdc9663cdc27efb17ae5b020f9c29ebaf985 | Update SslSettingsPartDriver.cs | DonnotRain/Orchard,Praggie/Orchard,vairam-svs/Orchard,andyshao/Orchard,phillipsj/Orchard,dozoft/Orchard,Anton-Am/Orchard,phillipsj/Orchard,omidnasri/Orchard,grapto/Orchard.CloudBust,angelapper/Orchard,omidnasri/Orchard,AndreVolksdorf/Orchard,yersans/Orchard,IDeliverable/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,planetClaire/Orchard-LETS,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,enspiral-dev-academy/Orchard,SouleDesigns/SouleDesigns.Orchard,infofromca/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,OrchardCMS/Orchard,IDeliverable/Orchard,hannan-azam/Orchard,JRKelso/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,dozoft/Orchard,oxwanawxo/Orchard,Codinlab/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,mvarblow/Orchard,RoyalVeterinaryCollege/Orchard,kouweizhong/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,arminkarimi/Orchard,smartnet-developers/Orchard,Praggie/Orchard,marcoaoteixeira/Orchard,OrchardCMS/Orchard-Harvest-Website,arminkarimi/Orchard,xiaobudian/Orchard,SzymonSel/Orchard,aaronamm/Orchard,aaronamm/Orchard,Sylapse/Orchard.HttpAuthSample,Fogolan/OrchardForWork,sfmskywalker/Orchard,dburriss/Orchard,stormleoxia/Orchard,Praggie/Orchard,brownjordaninternational/OrchardCMS,dmitry-urenev/extended-orchard-cms-v10.1,dburriss/Orchard,dcinzona/Orchard-Harvest-Website,dcinzona/Orchard,SzymonSel/Orchard,johnnyqian/Orchard,li0803/Orchard,omidnasri/Orchard,dcinzona/Orchard,gcsuk/Orchard,oxwanawxo/Orchard,openbizgit/Orchard,phillipsj/Orchard,patricmutwiri/Orchard,openbizgit/Orchard,Lombiq/Orchard,SzymonSel/Orchard,geertdoornbos/Orchard,AndreVolksdorf/Orchard,angelapper/Orchard,Serlead/Orchard,bedegaming-aleksej/Orchard,DonnotRain/Orchard,xiaobudian/Orchard,jchenga/Orchard,yersans/Orchard,li0803/Orchard,Sylapse/Orchard.HttpAuthSample,dcinzona/Orchard,JRKelso/Orchard,jerryshi2007/Orchard,ehe888/Orchard,huoxudong125/Orchard,DonnotRain/Orchard,jerryshi2007/Orchard,SeyDutch/Airbrush,TaiAivaras/Orchard,xiaobudian/Orchard,JRKelso/Orchard,Inner89/Orchard,abhishekluv/Orchard,jtkech/Orchard,Anton-Am/Orchard,abhishekluv/Orchard,abhishekluv/Orchard,TalaveraTechnologySolutions/Orchard,abhishekluv/Orchard,dburriss/Orchard,sebastienros/msc,omidnasri/Orchard,dburriss/Orchard,xiaobudian/Orchard,bigfont/orchard-cms-modules-and-themes,m2cms/Orchard,kouweizhong/Orchard,sebastienros/msc,kgacova/Orchard,infofromca/Orchard,AdvantageCS/Orchard,AdvantageCS/Orchard,bigfont/orchard-cms-modules-and-themes,TaiAivaras/Orchard,mvarblow/Orchard,ehe888/Orchard,johnnyqian/Orchard,sebastienros/msc,kgacova/Orchard,SeyDutch/Airbrush,arminkarimi/Orchard,SzymonSel/Orchard,arminkarimi/Orchard,jimasp/Orchard,emretiryaki/Orchard,sfmskywalker/Orchard,phillipsj/Orchard,rtpHarry/Orchard,jagraz/Orchard,hbulzy/Orchard,LaserSrl/Orchard,enspiral-dev-academy/Orchard,johnnyqian/Orchard,oxwanawxo/Orchard,tobydodds/folklife,omidnasri/Orchard,LaserSrl/Orchard,jtkech/Orchard,fassetar/Orchard,dozoft/Orchard,spraiin/Orchard,alejandroaldana/Orchard,abhishekluv/Orchard,hhland/Orchard,arminkarimi/Orchard,Dolphinsimon/Orchard,ehe888/Orchard,AndreVolksdorf/Orchard,Lombiq/Orchard,OrchardCMS/Orchard-Harvest-Website,smartnet-developers/Orchard,planetClaire/Orchard-LETS,grapto/Orchard.CloudBust,rtpHarry/Orchard,MetSystem/Orchard,geertdoornbos/Orchard,Sylapse/Orchard.HttpAuthSample,jimasp/Orchard,omidnasri/Orchard,spraiin/Orchard,openbizgit/Orchard,sfmskywalker/Orchard,smartnet-developers/Orchard,bedegaming-aleksej/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,bedegaming-aleksej/Orchard,dcinzona/Orchard-Harvest-Website,OrchardCMS/Orchard,jerryshi2007/Orchard,brownjordaninternational/OrchardCMS,Anton-Am/Orchard,jagraz/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,infofromca/Orchard,dcinzona/Orchard-Harvest-Website,SzymonSel/Orchard,mgrowan/Orchard,Inner89/Orchard,angelapper/Orchard,LaserSrl/Orchard,qt1/Orchard,emretiryaki/Orchard,johnnyqian/Orchard,openbizgit/Orchard,gcsuk/Orchard,enspiral-dev-academy/Orchard,Sylapse/Orchard.HttpAuthSample,johnnyqian/Orchard,Serlead/Orchard,OrchardCMS/Orchard-Harvest-Website,kouweizhong/Orchard,abhishekluv/Orchard,patricmutwiri/Orchard,escofieldnaxos/Orchard,alejandroaldana/Orchard,Praggie/Orchard,yonglehou/Orchard,hhland/Orchard,OrchardCMS/Orchard,qt1/Orchard,harmony7/Orchard,grapto/Orchard.CloudBust,infofromca/Orchard,fortunearterial/Orchard,jtkech/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,OrchardCMS/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,neTp9c/Orchard,Codinlab/Orchard,dcinzona/Orchard,enspiral-dev-academy/Orchard,escofieldnaxos/Orchard,sebastienros/msc,fortunearterial/Orchard,rtpHarry/Orchard,Lombiq/Orchard,hannan-azam/Orchard,andyshao/Orchard,jimasp/Orchard,sfmskywalker/Orchard,dcinzona/Orchard-Harvest-Website,ehe888/Orchard,angelapper/Orchard,sfmskywalker/Orchard,dcinzona/Orchard-Harvest-Website,Fogolan/OrchardForWork,grapto/Orchard.CloudBust,luchaoshuai/Orchard,Ermesx/Orchard,planetClaire/Orchard-LETS,jersiovic/Orchard,Anton-Am/Orchard,stormleoxia/Orchard,jerryshi2007/Orchard,bigfont/orchard-cms-modules-and-themes,neTp9c/Orchard,Serlead/Orchard,escofieldnaxos/Orchard,marcoaoteixeira/Orchard,AndreVolksdorf/Orchard,mgrowan/Orchard,gcsuk/Orchard,qt1/Orchard,RoyalVeterinaryCollege/Orchard,omidnasri/Orchard,stormleoxia/Orchard,xkproject/Orchard,li0803/Orchard,Inner89/Orchard,jtkech/Orchard,yersans/Orchard,TalaveraTechnologySolutions/Orchard,fassetar/Orchard,OrchardCMS/Orchard,Codinlab/Orchard,patricmutwiri/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,NIKASoftwareDevs/Orchard,bedegaming-aleksej/Orchard,li0803/Orchard,tobydodds/folklife,OrchardCMS/Orchard-Harvest-Website,aaronamm/Orchard,Ermesx/Orchard,andyshao/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,armanforghani/Orchard,RoyalVeterinaryCollege/Orchard,jersiovic/Orchard,AdvantageCS/Orchard,luchaoshuai/Orchard,mvarblow/Orchard,emretiryaki/Orchard,Ermesx/Orchard,tobydodds/folklife,qt1/Orchard,brownjordaninternational/OrchardCMS,hbulzy/Orchard,escofieldnaxos/Orchard,m2cms/Orchard,fortunearterial/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Inner89/Orchard,stormleoxia/Orchard,vairam-svs/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard,neTp9c/Orchard,yonglehou/Orchard,spraiin/Orchard,IDeliverable/Orchard,jchenga/Orchard,xkproject/Orchard,yonglehou/Orchard,geertdoornbos/Orchard,MetSystem/Orchard,JRKelso/Orchard,patricmutwiri/Orchard,bigfont/orchard-cms-modules-and-themes,Ermesx/Orchard,yersans/Orchard,alejandroaldana/Orchard,hhland/Orchard,RoyalVeterinaryCollege/Orchard,xkproject/Orchard,infofromca/Orchard,armanforghani/Orchard,smartnet-developers/Orchard,jerryshi2007/Orchard,omidnasri/Orchard,dozoft/Orchard,LaserSrl/Orchard,DonnotRain/Orchard,Lombiq/Orchard,Inner89/Orchard,hannan-azam/Orchard,jersiovic/Orchard,neTp9c/Orchard,jagraz/Orchard,SouleDesigns/SouleDesigns.Orchard,gcsuk/Orchard,JRKelso/Orchard,jagraz/Orchard,armanforghani/Orchard,tobydodds/folklife,Serlead/Orchard,m2cms/Orchard,harmony7/Orchard,spraiin/Orchard,Codinlab/Orchard,hannan-azam/Orchard,smartnet-developers/Orchard,DonnotRain/Orchard,ehe888/Orchard,jchenga/Orchard,aaronamm/Orchard,m2cms/Orchard,TalaveraTechnologySolutions/Orchard,qt1/Orchard,gcsuk/Orchard,sfmskywalker/Orchard,fassetar/Orchard,andyshao/Orchard,TaiAivaras/Orchard,hbulzy/Orchard,SeyDutch/Airbrush,tobydodds/folklife,IDeliverable/Orchard,spraiin/Orchard,luchaoshuai/Orchard,escofieldnaxos/Orchard,OrchardCMS/Orchard-Harvest-Website,NIKASoftwareDevs/Orchard,Praggie/Orchard,Dolphinsimon/Orchard,NIKASoftwareDevs/Orchard,NIKASoftwareDevs/Orchard,rtpHarry/Orchard,cooclsee/Orchard,yonglehou/Orchard,kouweizhong/Orchard,armanforghani/Orchard,kgacova/Orchard,huoxudong125/Orchard,Codinlab/Orchard,emretiryaki/Orchard,fortunearterial/Orchard,planetClaire/Orchard-LETS,jersiovic/Orchard,grapto/Orchard.CloudBust,jimasp/Orchard,neTp9c/Orchard,dozoft/Orchard,IDeliverable/Orchard,mvarblow/Orchard,jtkech/Orchard,andyshao/Orchard,harmony7/Orchard,kgacova/Orchard,AndreVolksdorf/Orchard,NIKASoftwareDevs/Orchard,hhland/Orchard,angelapper/Orchard,Dolphinsimon/Orchard,Dolphinsimon/Orchard,marcoaoteixeira/Orchard,fortunearterial/Orchard,luchaoshuai/Orchard,hbulzy/Orchard,harmony7/Orchard,dcinzona/Orchard-Harvest-Website,Anton-Am/Orchard,jersiovic/Orchard,aaronamm/Orchard,Lombiq/Orchard,vairam-svs/Orchard,vairam-svs/Orchard,TalaveraTechnologySolutions/Orchard,planetClaire/Orchard-LETS,xiaobudian/Orchard,huoxudong125/Orchard,jchenga/Orchard,enspiral-dev-academy/Orchard,SouleDesigns/SouleDesigns.Orchard,OrchardCMS/Orchard-Harvest-Website,openbizgit/Orchard,mgrowan/Orchard,Ermesx/Orchard,alejandroaldana/Orchard,hbulzy/Orchard,oxwanawxo/Orchard,MetSystem/Orchard,dcinzona/Orchard,RoyalVeterinaryCollege/Orchard,jagraz/Orchard,bigfont/orchard-cms-modules-and-themes,Sylapse/Orchard.HttpAuthSample,cooclsee/Orchard,armanforghani/Orchard,cooclsee/Orchard,cooclsee/Orchard,Serlead/Orchard,SeyDutch/Airbrush,Fogolan/OrchardForWork,sebastienros/msc,jchenga/Orchard,marcoaoteixeira/Orchard,omidnasri/Orchard,cooclsee/Orchard,brownjordaninternational/OrchardCMS,MetSystem/Orchard,geertdoornbos/Orchard,xkproject/Orchard,xkproject/Orchard,huoxudong125/Orchard,TalaveraTechnologySolutions/Orchard,huoxudong125/Orchard,AdvantageCS/Orchard,TalaveraTechnologySolutions/Orchard,kouweizhong/Orchard,sfmskywalker/Orchard,Fogolan/OrchardForWork,emretiryaki/Orchard,yonglehou/Orchard,li0803/Orchard,vairam-svs/Orchard,stormleoxia/Orchard,fassetar/Orchard,yersans/Orchard,LaserSrl/Orchard,bedegaming-aleksej/Orchard,tobydodds/folklife,MetSystem/Orchard,SouleDesigns/SouleDesigns.Orchard,mgrowan/Orchard,AdvantageCS/Orchard,dburriss/Orchard,TalaveraTechnologySolutions/Orchard,harmony7/Orchard,fassetar/Orchard,marcoaoteixeira/Orchard,rtpHarry/Orchard,Dolphinsimon/Orchard,hannan-azam/Orchard,TaiAivaras/Orchard,grapto/Orchard.CloudBust,phillipsj/Orchard,Fogolan/OrchardForWork,geertdoornbos/Orchard,hhland/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,alejandroaldana/Orchard,patricmutwiri/Orchard,m2cms/Orchard,TalaveraTechnologySolutions/Orchard,oxwanawxo/Orchard,mgrowan/Orchard,mvarblow/Orchard,TaiAivaras/Orchard,jimasp/Orchard,kgacova/Orchard,brownjordaninternational/OrchardCMS,luchaoshuai/Orchard,SeyDutch/Airbrush | src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Drivers/SslSettingsPartDriver.cs | src/Orchard.Web/Modules/Orchard.SecureSocketsLayer/Drivers/SslSettingsPartDriver.cs | using Orchard.Caching;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.Handlers;
using Orchard.Localization;
using Orchard.SecureSocketsLayer.Models;
namespace Orchard.SecureSocketsLayer.Drivers {
public class SslSettingsPartDriver : ContentPartDriver<SslSettingsPart> {
private readonly ISignals _signals;
private const string TemplateName = "Parts/SecureSocketsLayer.Settings";
public SslSettingsPartDriver(ISignals signals) {
_signals = signals;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
protected override string Prefix {
get { return "SslSettings"; }
}
protected override DriverResult Editor(SslSettingsPart part, dynamic shapeHelper) {
return ContentShape("Parts_SslSettings_Edit",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix))
.OnGroup("Ssl");
}
protected override DriverResult Editor(SslSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
if (updater.TryUpdateModel(part, Prefix, null, null)) {
_signals.Trigger(SslSettingsPart.CacheKey);
}
return Editor(part, shapeHelper);
}
protected override void Importing(SslSettingsPart part, ImportContentContext context) {
base.Importing(part, context);
_signals.Trigger(SslSettingsPart.CacheKey);
}
}
}
| using Orchard.Caching;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.Handlers;
using Orchard.Localization;
using Orchard.SecureSocketsLayer.Models;
namespace Orchard.SecureSocketsLayer.Drivers {
public class SslSettingsPartDriver : ContentPartDriver<SslSettingsPart> {
private readonly ISignals _signals;
private const string TemplateName = "Parts/SecureSocketsLayer.Settings";
public SslSettingsPartDriver(ISignals signals) {
_signals = signals;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
protected override string Prefix {
get { return "SslSettings"; }
}
protected override DriverResult Editor(SslSettingsPart part, dynamic shapeHelper) {
return ContentShape("Parts_SslSettings_Edit",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix))
.OnGroup("Ssl");
}
protected override DriverResult Editor(SslSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
if (updater.TryUpdateModel(part, Prefix, null, null)) {
_signals.Trigger(SslSettingsPart.CacheKey);
}
return Editor(part, shapeHelper);
}
protected override void Importing(SslSettingsPart part, ImportContentContext context) {
var elementName = part.PartDefinition.Name;
part.Enabled = bool.Parse(context.Attribute(elementName, "Enabled") ?? "false");
part.SecureEverything = bool.Parse(context.Attribute(elementName, "SecureEverything") ?? "true");
part.CustomEnabled = bool.Parse(context.Attribute(elementName, "CustomEnabled") ?? "false");
part.Urls = context.Attribute(elementName, "Urls") ?? "";
part.InsecureHostName = context.Attribute(elementName, "InsecureHostName") ?? "";
part.SecureHostName = context.Attribute(elementName, "SecureHostName") ?? "";
_signals.Trigger(SslSettingsPart.CacheKey);
}
protected override void Exporting(SslSettingsPart part, ExportContentContext context) {
var el = context.Element(part.PartDefinition.Name);
el.SetAttributeValue("Enabled", part.Enabled);
el.SetAttributeValue("SecureEverything", part.SecureEverything);
el.SetAttributeValue("CustomEnabled", part.CustomEnabled);
el.SetAttributeValue("Urls", part.Urls);
el.SetAttributeValue("InsecureHostName", part.InsecureHostName);
el.SetAttributeValue("SecureHostName", part.SecureHostName);
}
}
} | bsd-3-clause | C# |
9b4224f3151835fead03ea7bf3e3c939d6bbdb0f | Update twitchsocketclient | Aux/NTwitch,Aux/NTwitch | src/NTwitch.WebSocket/TwitchSocketClient.cs | src/NTwitch.WebSocket/TwitchSocketClient.cs | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace NTwitch.WebSocket
{
public partial class TwitchSocketClient : ITwitchClient
{
private SocketApiClient SocketClient { get; }
public string SocketUrl { get; }
public TwitchSocketClient() : this(new TwitchSocketConfig()) { }
public TwitchSocketClient(TwitchSocketConfig config)
{
SocketUrl = config.SocketUrl;
}
// ITwitchClient
public ConnectionState ConnectionState { get; } = ConnectionState.Disconnected;
public Task LoginAsync(string clientid, string token = null)
{
throw new NotImplementedException();
}
public Task ConnectAsync()
{
throw new NotImplementedException();
}
public Task DisconnectAsync()
{
throw new NotImplementedException();
}
public Task<IChannel> GetChannelAsync(ulong id)
{
throw new NotImplementedException();
}
public Task<IEnumerable<ITopGame>> GetTopGames(TwitchPageOptions options = null)
{
throw new NotImplementedException();
}
public Task<IEnumerable<IIngest>> GetIngestsAsync()
{
throw new NotImplementedException();
}
public Task<IEnumerable<IChannel>> FindChannelsAsync(string query, TwitchPageOptions options = null)
{
throw new NotImplementedException();
}
public Task<IEnumerable<IGame>> FindGamesAsync(string query, bool islive = true)
{
throw new NotImplementedException();
}
public Task<IStream> GetStreamAsync(ulong id, StreamType type = StreamType.All)
{
throw new NotImplementedException();
}
public Task<IEnumerable<IStream>> FindStreamsAsync(string query, bool hls = true, TwitchPageOptions options = null)
{
throw new NotImplementedException();
}
public Task<IEnumerable<IStream>> GetStreamsAsync(string game = null, ulong[] channelids = null, string language = null, StreamType type = StreamType.All, TwitchPageOptions options = null)
{
throw new NotImplementedException();
}
public Task<IEnumerable<IFeaturedStream>> GetFeaturedStreamsAsync(TwitchPageOptions options = null)
{
throw new NotImplementedException();
}
public Task<IEnumerable<IStreamSummary>> GetStreamSummaryAsync(string game)
{
throw new NotImplementedException();
}
public Task<IEnumerable<ITeamInfo>> GetTeamsAsync(TwitchPageOptions options = null)
{
throw new NotImplementedException();
}
public Task<IEnumerable<ITeam>> GetTeamAsync(string name)
{
throw new NotImplementedException();
}
public Task<IUser> GetUserAsync(ulong id)
{
throw new NotImplementedException();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace NTwitch.WebSocket
{
public partial class TwitchSocketClient : ITwitchClient
{
private SocketApiClient SocketClient { get; }
public string SocketUrl { get; }
public TwitchSocketClient() : this(new TwitchSocketConfig()) { }
public TwitchSocketClient(TwitchSocketConfig config)
{
SocketUrl = config.SocketUrl;
}
// ITwitchClient
public ConnectionState ConnectionState { get; } = ConnectionState.Disconnected;
public Task LoginAsync(string clientid, string token = null)
{
throw new NotImplementedException();
}
public Task ConnectAsync()
{
throw new NotImplementedException();
}
public Task DisconnectAsync()
{
throw new NotImplementedException();
}
}
}
| mit | C# |
81a64ad8d80b0da269d0a72337ddff112a9d7aa7 | Add new option to redirect to output from command line | Seddryck/Idunn.SqlServer | IdunnSql.Console/ExecuteOptions.cs | IdunnSql.Console/ExecuteOptions.cs | using CommandLine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IdunnSql.Console
{
[Verb("execute", HelpText = "Execute the permission checks defined in a file")]
public class ExecuteOptions
{
[Option('s', "source", Required = true,
HelpText = "Name of the file containing information about the permissions to check")]
public string Source { get; set; }
[Option('p', "principal", Required = false,
HelpText = "Name of the principal to impersonate.")]
public string Principal { get; set; }
[Option('o', "output", Required = false,
HelpText = "Name of the file to redirect the output of the console.")]
public string Output { get; set; }
}
}
| using CommandLine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IdunnSql.Console
{
[Verb("execute", HelpText = "Execute the permission checks defined in a file")]
public class ExecuteOptions
{
[Option('s', "source", Required = true,
HelpText = "Name of the file containing information about the permissions to check")]
public string Source { get; set; }
[Option('p', "principal", Required = false,
HelpText = "Name of the principal to impersonate.")]
public string Principal { get; set; }
}
}
| apache-2.0 | C# |
0eb86139fe8f0daf9dc6893150b701980d90e52d | Mark CharEnumerator as [Serializable] (#11124) | jamesqo/coreclr,mmitche/coreclr,tijoytom/coreclr,James-Ko/coreclr,ragmani/coreclr,russellhadley/coreclr,parjong/coreclr,ruben-ayrapetyan/coreclr,rartemev/coreclr,krytarowski/coreclr,hseok-oh/coreclr,sagood/coreclr,JonHanna/coreclr,ragmani/coreclr,wateret/coreclr,krk/coreclr,jamesqo/coreclr,James-Ko/coreclr,kyulee1/coreclr,rartemev/coreclr,AlexGhiondea/coreclr,poizan42/coreclr,cydhaselton/coreclr,pgavlin/coreclr,yeaicc/coreclr,sagood/coreclr,krytarowski/coreclr,kyulee1/coreclr,JosephTremoulet/coreclr,gkhanna79/coreclr,parjong/coreclr,mskvortsov/coreclr,krytarowski/coreclr,tijoytom/coreclr,tijoytom/coreclr,pgavlin/coreclr,gkhanna79/coreclr,poizan42/coreclr,krk/coreclr,dpodder/coreclr,sagood/coreclr,alexperovich/coreclr,poizan42/coreclr,mskvortsov/coreclr,AlexGhiondea/coreclr,cmckinsey/coreclr,wtgodbe/coreclr,cydhaselton/coreclr,parjong/coreclr,russellhadley/coreclr,wtgodbe/coreclr,jamesqo/coreclr,ruben-ayrapetyan/coreclr,mskvortsov/coreclr,wateret/coreclr,yeaicc/coreclr,cydhaselton/coreclr,krk/coreclr,mskvortsov/coreclr,JosephTremoulet/coreclr,yizhang82/coreclr,gkhanna79/coreclr,YongseopKim/coreclr,yizhang82/coreclr,wateret/coreclr,botaberg/coreclr,poizan42/coreclr,ruben-ayrapetyan/coreclr,russellhadley/coreclr,AlexGhiondea/coreclr,jamesqo/coreclr,ragmani/coreclr,James-Ko/coreclr,pgavlin/coreclr,tijoytom/coreclr,dpodder/coreclr,qiudesong/coreclr,cmckinsey/coreclr,ruben-ayrapetyan/coreclr,qiudesong/coreclr,yeaicc/coreclr,AlexGhiondea/coreclr,alexperovich/coreclr,yeaicc/coreclr,cydhaselton/coreclr,JosephTremoulet/coreclr,rartemev/coreclr,rartemev/coreclr,wtgodbe/coreclr,JonHanna/coreclr,JosephTremoulet/coreclr,cshung/coreclr,YongseopKim/coreclr,ragmani/coreclr,dpodder/coreclr,sagood/coreclr,YongseopKim/coreclr,kyulee1/coreclr,cshung/coreclr,botaberg/coreclr,poizan42/coreclr,yeaicc/coreclr,mmitche/coreclr,JosephTremoulet/coreclr,YongseopKim/coreclr,YongseopKim/coreclr,cmckinsey/coreclr,cshung/coreclr,cydhaselton/coreclr,pgavlin/coreclr,cshung/coreclr,kyulee1/coreclr,yizhang82/coreclr,parjong/coreclr,cmckinsey/coreclr,russellhadley/coreclr,AlexGhiondea/coreclr,botaberg/coreclr,qiudesong/coreclr,yizhang82/coreclr,rartemev/coreclr,hseok-oh/coreclr,hseok-oh/coreclr,wtgodbe/coreclr,dpodder/coreclr,JonHanna/coreclr,tijoytom/coreclr,russellhadley/coreclr,cydhaselton/coreclr,botaberg/coreclr,mskvortsov/coreclr,YongseopKim/coreclr,yeaicc/coreclr,sagood/coreclr,ruben-ayrapetyan/coreclr,krytarowski/coreclr,kyulee1/coreclr,mskvortsov/coreclr,jamesqo/coreclr,rartemev/coreclr,yizhang82/coreclr,James-Ko/coreclr,ragmani/coreclr,wateret/coreclr,qiudesong/coreclr,mmitche/coreclr,mmitche/coreclr,dpodder/coreclr,hseok-oh/coreclr,botaberg/coreclr,sagood/coreclr,russellhadley/coreclr,JosephTremoulet/coreclr,wtgodbe/coreclr,jamesqo/coreclr,gkhanna79/coreclr,ragmani/coreclr,mmitche/coreclr,poizan42/coreclr,qiudesong/coreclr,wtgodbe/coreclr,krytarowski/coreclr,wateret/coreclr,cmckinsey/coreclr,hseok-oh/coreclr,hseok-oh/coreclr,wateret/coreclr,krk/coreclr,parjong/coreclr,kyulee1/coreclr,botaberg/coreclr,qiudesong/coreclr,gkhanna79/coreclr,mmitche/coreclr,JonHanna/coreclr,pgavlin/coreclr,alexperovich/coreclr,pgavlin/coreclr,JonHanna/coreclr,ruben-ayrapetyan/coreclr,yizhang82/coreclr,yeaicc/coreclr,alexperovich/coreclr,JonHanna/coreclr,parjong/coreclr,James-Ko/coreclr,cmckinsey/coreclr,James-Ko/coreclr,tijoytom/coreclr,krk/coreclr,alexperovich/coreclr,krytarowski/coreclr,alexperovich/coreclr,dpodder/coreclr,gkhanna79/coreclr,AlexGhiondea/coreclr,krk/coreclr,cshung/coreclr,cshung/coreclr,cmckinsey/coreclr | src/mscorlib/shared/System/CharEnumerator.cs | src/mscorlib/shared/System/CharEnumerator.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.
/*============================================================
**
**
**
** Purpose: Enumerates the characters on a string. skips range
** checks.
**
**
============================================================*/
using System.Collections;
using System.Collections.Generic;
namespace System
{
[Serializable]
public sealed class CharEnumerator : IEnumerator, IEnumerator<char>, IDisposable, ICloneable
{
private String _str;
private int _index;
private char _currentElement;
internal CharEnumerator(String str)
{
_str = str;
_index = -1;
}
public object Clone()
{
return MemberwiseClone();
}
public bool MoveNext()
{
if (_index < (_str.Length - 1))
{
_index++;
_currentElement = _str[_index];
return true;
}
else
_index = _str.Length;
return false;
}
public void Dispose()
{
if (_str != null)
_index = _str.Length;
_str = null;
}
Object IEnumerator.Current
{
get { return Current; }
}
public char Current
{
get
{
if (_index == -1)
throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted);
if (_index >= _str.Length)
throw new InvalidOperationException(SR.InvalidOperation_EnumEnded);
return _currentElement;
}
}
public void Reset()
{
_currentElement = (char)0;
_index = -1;
}
}
}
| // 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.
/*============================================================
**
**
**
** Purpose: Enumerates the characters on a string. skips range
** checks.
**
**
============================================================*/
using System.Collections;
using System.Collections.Generic;
namespace System
{
public sealed class CharEnumerator : IEnumerator, IEnumerator<char>, IDisposable, ICloneable
{
private String _str;
private int _index;
private char _currentElement;
internal CharEnumerator(String str)
{
_str = str;
_index = -1;
}
public object Clone()
{
return MemberwiseClone();
}
public bool MoveNext()
{
if (_index < (_str.Length - 1))
{
_index++;
_currentElement = _str[_index];
return true;
}
else
_index = _str.Length;
return false;
}
public void Dispose()
{
if (_str != null)
_index = _str.Length;
_str = null;
}
Object IEnumerator.Current
{
get { return Current; }
}
public char Current
{
get
{
if (_index == -1)
throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted);
if (_index >= _str.Length)
throw new InvalidOperationException(SR.InvalidOperation_EnumEnded);
return _currentElement;
}
}
public void Reset()
{
_currentElement = (char)0;
_index = -1;
}
}
}
| mit | C# |
a15e49c9c32bf9a746096caeb5399806c0398126 | Update AssemblyInfo.cs | robbihun/NStatsD.Client | NStatsD/Properties/AssemblyInfo.cs | NStatsD/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NStatsD.Client")]
[assembly: AssemblyDescription("A .NET 4.0 client for Etsy's StatsD server.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Rob Bihun")]
[assembly: AssemblyProduct("NStatsD.Client")]
[assembly: AssemblyCopyright("Copyright © Rob Bihun 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d89b14ce-141c-4d50-9886-a422e52d117c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NStatsD.Client")]
[assembly: AssemblyDescription("A .NET 4.0 client for Etsy's StatsD server.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Rob Bihun")]
[assembly: AssemblyProduct("NStatsD.Client")]
[assembly: AssemblyCopyright("Copyright © Rob Bihun 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d89b14ce-141c-4d50-9886-a422e52d117c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.