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 |
|---|---|---|---|---|---|---|---|---|
65c9605019d71ee4625f1a1635ccefd66402ca4e | Implement IEquatable<T> for PlotLength #692 | zur003/oxyplot,Kaplas80/oxyplot,oxyplot/oxyplot,HermanEldering/oxyplot,objorke/oxyplot,ze-pequeno/oxyplot,GeertvanHorrik/oxyplot,GeertvanHorrik/oxyplot,DotNetDoctor/oxyplot,shoelzer/oxyplot,shoelzer/oxyplot,olegtarasov/oxyplot,Isolocis/oxyplot,olegtarasov/oxyplot,NilesDavis/oxyplot,shoelzer/oxyplot,GeertvanHorrik/oxyplot,objorke/oxyplot,Kaplas80/oxyplot,HermanEldering/oxyplot,DotNetDoctor/oxyplot,Jonarw/oxyplot,objorke/oxyplot,Jofta/oxyplot | Source/OxyPlot/Foundation/PlotLength.cs | Source/OxyPlot/Foundation/PlotLength.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="PlotLength.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// <summary>
// Represents absolute or relative lengths in data or screen space.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot
{
using System;
/// <summary>
/// Represents absolute or relative lengths in data or screen space.
/// </summary>
public struct PlotLength : IEquatable<PlotLength>
{
/// <summary>
/// The unit type
/// </summary>
private readonly PlotLengthUnit unit;
/// <summary>
/// The value
/// </summary>
private readonly double value;
/// <summary>
/// Initializes a new instance of the <see cref="PlotLength" /> struct.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="unit">The unit.</param>
public PlotLength(double value, PlotLengthUnit unit)
{
this.value = value;
this.unit = unit;
}
/// <summary>
/// Gets the value.
/// </summary>
/// <value>The value.</value>
public double Value
{
get
{
return this.value;
}
}
/// <summary>
/// Gets the type of the unit.
/// </summary>
/// <value>The type of the unit.</value>
public PlotLengthUnit Unit
{
get
{
return this.unit;
}
}
/// <summary>
/// Determines whether this instance and another specified <see cref="T:PlotLength" /> object have the same value.
/// </summary>
/// <param name="other">The length to compare to this instance.</param>
/// <returns><c>true</c> if the value of the <paramref name="other" /> parameter is the same as the value of this instance; otherwise, <c>false</c>.</returns>
public bool Equals(PlotLength other)
{
return this.value.Equals(other.value) && this.unit.Equals(other.unit);
}
}
} | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="PlotLength.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// <summary>
// Represents absolute or relative lengths in data or screen space.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot
{
/// <summary>
/// Represents absolute or relative lengths in data or screen space.
/// </summary>
public struct PlotLength
{
/// <summary>
/// The unit type
/// </summary>
private readonly PlotLengthUnit unit;
/// <summary>
/// The value
/// </summary>
private readonly double value;
/// <summary>
/// Initializes a new instance of the <see cref="PlotLength" /> struct.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="unit">The unit.</param>
public PlotLength(double value, PlotLengthUnit unit)
{
this.value = value;
this.unit = unit;
}
/// <summary>
/// Gets the value.
/// </summary>
/// <value>The value.</value>
public double Value
{
get
{
return this.value;
}
}
/// <summary>
/// Gets the type of the unit.
/// </summary>
/// <value>The type of the unit.</value>
public PlotLengthUnit Unit
{
get
{
return this.unit;
}
}
}
} | mit | C# |
6391919281c97cbaaf96e443a806ceadf0f22fb7 | Bump version | nixxquality/GitHubUpdate | GitHubUpdate/Properties/AssemblyInfo.cs | GitHubUpdate/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GitHub Update Check")]
[assembly: AssemblyDescription("Easily check if your program is up to date, using GitHub Releases")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("nixx quality")]
[assembly: AssemblyProduct("GitHubUpdate")]
[assembly: AssemblyCopyright("Copyright © nixx quality 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("747a3829-ff9f-461e-8dbb-e606e98fa25e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GitHub Update Check")]
[assembly: AssemblyDescription("Easily check if your program is up to date, using GitHub Releases")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("nixx quality")]
[assembly: AssemblyProduct("GitHubUpdate")]
[assembly: AssemblyCopyright("Copyright © nixx quality 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("747a3829-ff9f-461e-8dbb-e606e98fa25e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1")]
[assembly: NeutralResourcesLanguageAttribute("en")]
| mit | C# |
e6b8c78b5a9176ca43af0cd06d1b3bf3db2ce669 | Add HiddenAt property in TraktSyncShowsLastActivities | henrikfroehling/TraktApiSharp | Source/Lib/TraktApiSharp/Objects/Get/Syncs/Activities/TraktSyncShowsLastActivities.cs | Source/Lib/TraktApiSharp/Objects/Get/Syncs/Activities/TraktSyncShowsLastActivities.cs | namespace TraktApiSharp.Objects.Get.Syncs.Activities
{
using Newtonsoft.Json;
using System;
/// <summary>A collection of UTC datetimes of last activities for shows.</summary>
public class TraktSyncShowsLastActivities
{
/// <summary>Gets or sets the UTC datetime, when a show was lastly rated.</summary>
[JsonProperty(PropertyName = "rated_at")]
public DateTime? RatedAt { get; set; }
/// <summary>Gets or sets the UTC datetime, when a show was lastly added to the watchlist.</summary>
[JsonProperty(PropertyName = "watchlisted_at")]
public DateTime? WatchlistedAt { get; set; }
/// <summary>Gets or sets the UTC datetime, when a show was lastly commented.</summary>
[JsonProperty(PropertyName = "commented_at")]
public DateTime? CommentedAt { get; set; }
/// <summary>Gets or sets the UTC datetime, when a show was lastly hidden.</summary>
[JsonProperty(PropertyName = "hidden_at")]
public DateTime? HiddenAt { get; set; }
}
}
| namespace TraktApiSharp.Objects.Get.Syncs.Activities
{
using Newtonsoft.Json;
using System;
/// <summary>A collection of UTC datetimes of last activities for shows.</summary>
public class TraktSyncShowsLastActivities
{
/// <summary>Gets or sets the UTC datetime, when a show was lastly rated.</summary>
[JsonProperty(PropertyName = "rated_at")]
public DateTime? RatedAt { get; set; }
/// <summary>Gets or sets the UTC datetime, when a show was lastly added to the watchlist.</summary>
[JsonProperty(PropertyName = "watchlisted_at")]
public DateTime? WatchlistedAt { get; set; }
/// <summary>Gets or sets the UTC datetime, when a show was lastly commented.</summary>
[JsonProperty(PropertyName = "commented_at")]
public DateTime? CommentedAt { get; set; }
}
}
| mit | C# |
9af06d1ea597e97ec4c70a44a4e60d85164053de | add some token types | Code-017/WindLang | Source/Tokens.cs | Source/Tokens.cs | using System;
namespace WindLang
{
namespace Lexer
{
public class RawToken
{
public RawToken(string aLexeme)
{
Lexeme = aLexeme;
}
string Lexeme {public get;private set;}
}
public enum TokenType
{
LParen,RParen,LBracket,RBracket,LBrace,RBrace,Id,IntegerLiteral,StringLiteral,FloatLiteral,Use,Fn,Assign,LE,GE,Less,Greater,Equal,NotEq,True,False,Return,And,Or,Xor,Not,Break,
Continue,In,If,Else,While,For,Try,Except,Finally,Assert,Add,Minus,Multiply,Divide,AddInPlace,MinusInPlace,MultiplyInPlace,DivideInPlace,
}
public class Token
{
public Token(TokenType aType)
{
Type = aType;
}
TokenType Type{public get;private set;}
}
public class IdToken:Token
{
public IdToken(string aIdentifier):base(TokenType.Id)
{
Identifier = aIdentifier;
}
string Identifier{public get;private set;}
}
public class IntegerLiteralToken:Token
{
public IdToken(int aLiteral):base(TokenType.IntegerLiteral)
{
Literal = aLiteral;
}
int Literal{public get;private set;}
}
public class FloatLiteralToken:Token
{
public IdToken(double aLiteral):base(TokenType.IntegerLiteral)
{
Literal = aLiteral;
}
double Literal{public get;private set;}
}
}
}
| using System;
namespace WindLang
{
namespace Lexer
{
public class RawToken
{
public RawToken(string aLexeme)
{
Lexeme = aLexeme;
}
string Lexeme {public get;private set;}
}
public enum TokenType
{
LParen,RParen,LBracket,RBracket,LBrace,RBrace,Id,IntegerLiteral,StringLiteral,FloatLiteral,Use,Fn,Assign,LE,GE,Less,Greater,Equal,NotEq,True,False,Return,And,Or,Xor,Not,Break,
Continue,In,If,Else,While,For,Try,Except,Finally,Assert,
}
public class Token
{
public Token(TokenType aType)
{
Type = aType;
}
TokenType Type{public get;private set;}
}
public class IdToken:Token
{
public IdToken(string aIdentifier):base(TokenType.Id)
{
Identifier = aIdentifier;
}
string Identifier{public get;private set;}
}
public class IntegerLiteralToken:Token
{
public IdToken(int aLiteral):base(TokenType.IntegerLiteral)
{
Literal = aLiteral;
}
int Literal{public get;private set;}
}
public class FloatLiteralToken:Token
{
public IdToken(double aLiteral):base(TokenType.IntegerLiteral)
{
Literal = aLiteral;
}
double Literal{public get;private set;}
}
}
}
| mit | C# |
5917b61197d9363cd93d2a5b498850cd5add3627 | Verify that LoginCommand#Execute asks for username and password | appharbor/appharbor-cli | src/AppHarbor/Commands/LoginCommand.cs | src/AppHarbor/Commands/LoginCommand.cs | using System;
namespace AppHarbor.Commands
{
public class LoginCommand : ICommand
{
private readonly AppHarborApi _appHarborApi;
public LoginCommand(AppHarborApi appHarborApi)
{
_appHarborApi = appHarborApi;
}
public void Execute(string[] arguments)
{
Console.WriteLine("Username:");
var username = Console.ReadLine();
Console.WriteLine("Password:");
var password = Console.ReadLine();
}
}
}
| using System;
namespace AppHarbor.Commands
{
public class LoginCommand : ICommand
{
private readonly AppHarborApi _appHarborApi;
public LoginCommand(AppHarborApi appHarborApi)
{
_appHarborApi = appHarborApi;
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
2347ea01b4d4eef8dc906ca8fcd015e2e75830a1 | Clean up the IAsset interface. | honestegg/cassette,damiensawyer/cassette,andrewdavey/cassette,BluewireTechnologies/cassette,andrewdavey/cassette,honestegg/cassette,honestegg/cassette,andrewdavey/cassette,damiensawyer/cassette,BluewireTechnologies/cassette,damiensawyer/cassette | src/Cassette/IAsset.cs | src/Cassette/IAsset.cs | using System.Collections.Generic;
using System.IO;
using Cassette.IO;
namespace Cassette
{
public interface IAsset
{
/// <summary>
/// The application relative path of the asset.
/// </summary>
string SourceFilename { get; }
/// <summary>
/// The hash of the original asset contents, before any transformations are applied.
/// </summary>
byte[] Hash { get; }
IFile SourceFile { get; }
IEnumerable<AssetReference> References { get; }
void Accept(IAssetVisitor visitor);
void AddAssetTransformer(IAssetTransformer transformer);
void AddReference(string path, int lineNumber);
void AddRawFileReference(string relativeFilename);
/// <summary>
/// Opens a new stream to read the transformed contents of the asset.
/// </summary>
/// <returns>A readable <see cref="Stream"/>.</returns>
Stream OpenStream();
}
} | using System.Collections.Generic;
using System.IO;
using Cassette.IO;
namespace Cassette
{
public interface IAsset
{
void Accept(IAssetVisitor visitor);
string SourceFilename { get; }
byte[] Hash { get; }
IEnumerable<AssetReference> References { get; }
void AddReference(string path, int lineNumber);
void AddAssetTransformer(IAssetTransformer transformer);
Stream OpenStream();
IFile SourceFile { get; }
void AddRawFileReference(string relativeFilename);
}
}
| mit | C# |
ba15b1f311b9443c4975ed813f9d4a4e570678c9 | Update ValuesOut.cs | EricZimmerman/RegistryPlugins | RegistryPlugin.ProfileList/ValuesOut.cs | RegistryPlugin.ProfileList/ValuesOut.cs | using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.ProfileList
{
public class ValuesOut : IValueOut
{
public ValuesOut(string keyName, string profileimagepath, DateTimeOffset? timestamp)
{
KeyName = keyName;
ProfileImagePath = profileimagepath;
Timestamp = timestamp;
}
public DateTimeOffset? Timestamp { get; }
public string KeyName { get; }
public string ProfileImagePath { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"KeyName: {KeyName} ProfileImagePath: {ProfileImagePath}";
public string BatchValueData2 => $"Timestamp: {Timestamp?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData3 => string.Empty;
}
}
| using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.ProfileList
{
public class ValuesOut : IValueOut
{
public ValuesOut(string keyName, string profileimagepath, DateTimeOffset? timestamp)
{
KeyName = keyName;
ProfileImagePath = profileimagepath;
Timestamp = timestamp;
}
public DateTimeOffset? Timestamp { get; }
public string KeyName { get; }
public string ProfileImagePath { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"KeyName: {KeyName} ProfileImagePath: {ProfileImagePath}";
public string BatchValueData2 => $"Timestamp: {Timestamp?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff} ";
public string BatchValueData3 => string.Empty;
}
}
| mit | C# |
9ded9e4f885a54491dc4f2fe6c8f041b3787cc1f | bump version number of desktop app | PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer | StandUpTimer/Properties/AssemblyInfo.cs | StandUpTimer/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("0.7.3")]
[assembly: AssemblyFileVersion("0.7.3")]
[assembly: InternalsVisibleTo("StandUpTimer.UnitTests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] | using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("0.7.2")]
[assembly: AssemblyFileVersion("0.7.2")]
[assembly: InternalsVisibleTo("StandUpTimer.UnitTests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] | mit | C# |
f7ebe4e2976358a841db34799d3846ce78cf3178 | fix for workitem https://nuget.codeplex.com/workitem/3174 | chocolatey/nuget-chocolatey,rikoe/nuget,indsoft/NuGet2,mono/nuget,mrward/NuGet.V2,jholovacs/NuGet,OneGet/nuget,oliver-feng/nuget,oliver-feng/nuget,mrward/nuget,RichiCoder1/nuget-chocolatey,xoofx/NuGet,xoofx/NuGet,GearedToWar/NuGet2,oliver-feng/nuget,jholovacs/NuGet,mrward/NuGet.V2,pratikkagda/nuget,dolkensp/node.net,jholovacs/NuGet,jholovacs/NuGet,indsoft/NuGet2,mrward/nuget,GearedToWar/NuGet2,pratikkagda/nuget,chocolatey/nuget-chocolatey,pratikkagda/nuget,chocolatey/nuget-chocolatey,xoofx/NuGet,chocolatey/nuget-chocolatey,antiufo/NuGet2,akrisiun/NuGet,xoofx/NuGet,oliver-feng/nuget,mrward/NuGet.V2,ctaggart/nuget,jholovacs/NuGet,dolkensp/node.net,oliver-feng/nuget,pratikkagda/nuget,OneGet/nuget,mrward/NuGet.V2,rikoe/nuget,alluran/node.net,mrward/nuget,RichiCoder1/nuget-chocolatey,GearedToWar/NuGet2,jmezach/NuGet2,alluran/node.net,xoofx/NuGet,indsoft/NuGet2,mrward/nuget,RichiCoder1/nuget-chocolatey,jholovacs/NuGet,chocolatey/nuget-chocolatey,mrward/nuget,rikoe/nuget,mono/nuget,mrward/NuGet.V2,RichiCoder1/nuget-chocolatey,OneGet/nuget,GearedToWar/NuGet2,alluran/node.net,antiufo/NuGet2,chocolatey/nuget-chocolatey,jmezach/NuGet2,mrward/NuGet.V2,rikoe/nuget,ctaggart/nuget,antiufo/NuGet2,indsoft/NuGet2,alluran/node.net,dolkensp/node.net,ctaggart/nuget,mono/nuget,pratikkagda/nuget,xoofx/NuGet,akrisiun/NuGet,pratikkagda/nuget,antiufo/NuGet2,jmezach/NuGet2,jmezach/NuGet2,indsoft/NuGet2,jmezach/NuGet2,GearedToWar/NuGet2,jmezach/NuGet2,ctaggart/nuget,RichiCoder1/nuget-chocolatey,antiufo/NuGet2,dolkensp/node.net,OneGet/nuget,indsoft/NuGet2,antiufo/NuGet2,mono/nuget,RichiCoder1/nuget-chocolatey,oliver-feng/nuget,GearedToWar/NuGet2,mrward/nuget | src/Core/FileModifiers/Preprocessor.cs | src/Core/FileModifiers/Preprocessor.cs | using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;
using NuGet.Resources;
using System.Text;
namespace NuGet
{
/// <summary>
/// Simple token replacement system for content files.
/// </summary>
public class Preprocessor : IPackageFileTransformer
{
private static readonly Regex _tokenRegex = new Regex(@"\$(?<propertyName>\w+)\$");
public void TransformFile(IPackageFile file, string targetPath, IProjectSystem projectSystem)
{
ProjectSystemExtensions.TryAddFile(projectSystem, targetPath, () => Process(file, projectSystem).AsStream());
}
public void RevertFile(IPackageFile file, string targetPath, IEnumerable<IPackageFile> matchingFiles, IProjectSystem projectSystem)
{
Func<Stream> streamFactory = () => Process(file, projectSystem).AsStream();
FileSystemExtensions.DeleteFileSafe(projectSystem, targetPath, streamFactory);
}
internal static string Process(IPackageFile file, IPropertyProvider propertyProvider)
{
using (var stream = file.GetStream())
{
return Process(stream, propertyProvider, throwIfNotFound: false);
}
}
public static string Process(Stream stream, IPropertyProvider propertyProvider, bool throwIfNotFound = true)
{
// Fix for bug https://nuget.codeplex.com/workitem/3174, source code transfomation to support BOM
byte[] bytes = stream.ReadAllBytes();
string text = Encoding.UTF8.GetString(bytes);
return _tokenRegex.Replace(text, match => ReplaceToken(match, propertyProvider, throwIfNotFound));
}
private static string ReplaceToken(Match match, IPropertyProvider propertyProvider, bool throwIfNotFound)
{
string propertyName = match.Groups["propertyName"].Value;
var value = propertyProvider.GetPropertyValue(propertyName);
if (value == null && throwIfNotFound)
{
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, NuGetResources.TokenHasNoValue, propertyName));
}
return value;
}
}
}
| using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;
using NuGet.Resources;
namespace NuGet
{
/// <summary>
/// Simple token replacement system for content files.
/// </summary>
public class Preprocessor : IPackageFileTransformer
{
private static readonly Regex _tokenRegex = new Regex(@"\$(?<propertyName>\w+)\$");
public void TransformFile(IPackageFile file, string targetPath, IProjectSystem projectSystem)
{
ProjectSystemExtensions.TryAddFile(projectSystem, targetPath, () => Process(file, projectSystem).AsStream());
}
public void RevertFile(IPackageFile file, string targetPath, IEnumerable<IPackageFile> matchingFiles, IProjectSystem projectSystem)
{
Func<Stream> streamFactory = () => Process(file, projectSystem).AsStream();
FileSystemExtensions.DeleteFileSafe(projectSystem, targetPath, streamFactory);
}
internal static string Process(IPackageFile file, IPropertyProvider propertyProvider)
{
using (var stream = file.GetStream())
{
return Process(stream, propertyProvider, throwIfNotFound: false);
}
}
public static string Process(Stream stream, IPropertyProvider propertyProvider, bool throwIfNotFound = true)
{
string text = stream.ReadToEnd();
return _tokenRegex.Replace(text, match => ReplaceToken(match, propertyProvider, throwIfNotFound));
}
private static string ReplaceToken(Match match, IPropertyProvider propertyProvider, bool throwIfNotFound)
{
string propertyName = match.Groups["propertyName"].Value;
var value = propertyProvider.GetPropertyValue(propertyName);
if (value == null && throwIfNotFound)
{
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, NuGetResources.TokenHasNoValue, propertyName));
}
return value;
}
}
}
| apache-2.0 | C# |
82fb4baa0ae041b9ffda5994371796016d64ce5b | Fix minor issue about not using UPnP with ipv6 | PowerOfCode/lidgren-network-gen3 | UnitTests/Program.cs | UnitTests/Program.cs | using System;
using System.Reflection;
using Lidgren.Network;
using System.Net;
using System.Net.Sockets;
namespace UnitTests
{
class Program
{
static void Main(string[] args)
{
NetPeerConfiguration config = new NetPeerConfiguration("unittests");
if (Socket.OSSupportsIPv6)
config.LocalAddress = IPAddress.IPv6Loopback;
else
{
config.LocalAddress = IPAddress.Loopback;
config.EnableUPnP = false;
}
NetPeer peer = new NetPeer(config);
peer.Start(); // needed for initialization
Console.WriteLine("Unique identifier is " + NetUtility.ToHexString(peer.UniqueIdentifier));
ReadWriteTests.Run(peer);
NetQueueTests.Run();
MiscTests.Run(peer);
BitVectorTests.Run();
EncryptionTests.Run(peer);
var om = peer.CreateMessage();
peer.SendUnconnectedMessage(om, new IPEndPoint(config.LocalAddress, 14242));
try
{
peer.SendUnconnectedMessage(om, new IPEndPoint(config.LocalAddress, 14242));
}
catch (NetException nex)
{
if (nex.Message != "This message has already been sent! Use NetPeer.SendMessage() to send to multiple recipients efficiently")
throw;
}
peer.Shutdown("bye");
// read all message
NetIncomingMessage inc = peer.WaitMessage(5000);
while (inc != null)
{
switch (inc.MessageType)
{
case NetIncomingMessageType.DebugMessage:
case NetIncomingMessageType.VerboseDebugMessage:
case NetIncomingMessageType.WarningMessage:
case NetIncomingMessageType.ErrorMessage:
Console.WriteLine("Peer message: " + inc.ReadString());
break;
case NetIncomingMessageType.Error:
throw new Exception("Received error message!");
}
inc = peer.ReadMessage();
}
Console.WriteLine("Done");
}
/// <summary>
/// Helper method
/// </summary>
public static NetIncomingMessage CreateIncomingMessage(byte[] fromData, int bitLength)
{
NetIncomingMessage inc = (NetIncomingMessage)Activator.CreateInstance(typeof(NetIncomingMessage), true);
typeof(NetIncomingMessage).GetField("m_data", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(inc, fromData);
typeof(NetIncomingMessage).GetField("m_bitLength", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(inc, bitLength);
return inc;
}
}
}
| using System;
using System.Reflection;
using Lidgren.Network;
using System.Net;
using System.Net.Sockets;
namespace UnitTests
{
class Program
{
static void Main(string[] args)
{
NetPeerConfiguration config = new NetPeerConfiguration("unittests");
config.EnableUPnP = true;
if (Socket.OSSupportsIPv6)
config.LocalAddress = IPAddress.IPv6Loopback;
else
config.LocalAddress = IPAddress.Loopback;
NetPeer peer = new NetPeer(config);
peer.Start(); // needed for initialization
Console.WriteLine("Unique identifier is " + NetUtility.ToHexString(peer.UniqueIdentifier));
ReadWriteTests.Run(peer);
NetQueueTests.Run();
MiscTests.Run(peer);
BitVectorTests.Run();
EncryptionTests.Run(peer);
var om = peer.CreateMessage();
peer.SendUnconnectedMessage(om, new IPEndPoint(IPAddress.Loopback, 14242));
try
{
peer.SendUnconnectedMessage(om, new IPEndPoint(IPAddress.Loopback, 14242));
}
catch (NetException nex)
{
if (nex.Message != "This message has already been sent! Use NetPeer.SendMessage() to send to multiple recipients efficiently")
throw;
}
peer.Shutdown("bye");
// read all message
NetIncomingMessage inc = peer.WaitMessage(5000);
while (inc != null)
{
switch (inc.MessageType)
{
case NetIncomingMessageType.DebugMessage:
case NetIncomingMessageType.VerboseDebugMessage:
case NetIncomingMessageType.WarningMessage:
case NetIncomingMessageType.ErrorMessage:
Console.WriteLine("Peer message: " + inc.ReadString());
break;
case NetIncomingMessageType.Error:
throw new Exception("Received error message!");
}
inc = peer.ReadMessage();
}
Console.WriteLine("Done");
}
/// <summary>
/// Helper method
/// </summary>
public static NetIncomingMessage CreateIncomingMessage(byte[] fromData, int bitLength)
{
NetIncomingMessage inc = (NetIncomingMessage)Activator.CreateInstance(typeof(NetIncomingMessage), true);
typeof(NetIncomingMessage).GetField("m_data", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(inc, fromData);
typeof(NetIncomingMessage).GetField("m_bitLength", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(inc, bitLength);
return inc;
}
}
}
| mit | C# |
f634ea06cfefb1341ad7da6565b6ea8bfe9c2654 | Add caching to the GetBudgetsAsync method | haefele/YnabApi,haefele/Ynab | src/YnabApi/YnabApi.cs | src/YnabApi/YnabApi.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using YnabApi.Files;
using YnabApi.Helpers;
namespace YnabApi
{
public class YnabApi
{
private readonly IFileSystem _fileSystem;
private Lazy<Task<IList<Budget>>> _cachedBudgets;
public YnabApi(IFileSystem fileSystem)
{
this._fileSystem = fileSystem;
}
public Task<IList<Budget>> GetBudgetsAsync()
{
if (this._cachedBudgets == null)
{
this._cachedBudgets = new Lazy<Task<IList<Budget>>>(async () =>
{
string ynabSettingsFilePath = YnabPaths.YnabSettingsFile();
var ynabSettingsJson = await this._fileSystem.ReadFileAsync(ynabSettingsFilePath);
var ynabSettings = JObject.Parse(ynabSettingsJson);
string relativeBudgetsFolder = ynabSettings.Value<string>("relativeDefaultBudgetsFolder");
return ynabSettings
.Value<JArray>("relativeKnownBudgets")
.Values()
.Select(f => f.Value<string>())
.Select(f => new Budget(this._fileSystem, this.ExtractBudgetName(f, relativeBudgetsFolder), f))
.ToArray();
});
}
return this._cachedBudgets.Value;
}
private string ExtractBudgetName(string budgetPath, string budgetsFolderPath)
{
var regex = new Regex(budgetsFolderPath + "/(.*)~.*");
if (regex.IsMatch(budgetPath))
return regex.Match(budgetPath).Groups[1].Value;
return budgetPath;
}
}
} | using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using YnabApi.Files;
using YnabApi.Helpers;
namespace YnabApi
{
public class YnabApi
{
private readonly IFileSystem _fileSystem;
public YnabApi(IFileSystem fileSystem)
{
this._fileSystem = fileSystem;
}
public async Task<IList<Budget>> GetBudgetsAsync()
{
string ynabSettingsFilePath = YnabPaths.YnabSettingsFile();
var ynabSettingsJson = await this._fileSystem.ReadFileAsync(ynabSettingsFilePath);
var ynabSettings = JObject.Parse(ynabSettingsJson);
string relativeBudgetsFolder = ynabSettings.Value<string>("relativeDefaultBudgetsFolder");
return ynabSettings
.Value<JArray>("relativeKnownBudgets")
.Values()
.Select(f => f.Value<string>())
.Select(f => new Budget(this._fileSystem, this.ExtractBudgetName(f, relativeBudgetsFolder), f))
.ToArray();
}
private string ExtractBudgetName(string budgetPath, string budgetsFolderPath)
{
var regex = new Regex(budgetsFolderPath + "/(.*)~.*");
if (regex.IsMatch(budgetPath))
return regex.Match(budgetPath).Groups[1].Value;
return budgetPath;
}
}
} | mit | C# |
067ee3022c27b7ddcea298d3224c516721cdedd5 | Implement IMediaStore in ScrapeEngine | SnowflakePowered/snowflake,RonnChyran/snowflake,faint32/snowflake-1,RonnChyran/snowflake,SnowflakePowered/snowflake,RonnChyran/snowflake,faint32/snowflake-1,SnowflakePowered/snowflake,faint32/snowflake-1 | Snowflake.API/Core/ScrapeEngine.cs | Snowflake.API/Core/ScrapeEngine.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Snowflake.Information.Platform;
using Snowflake.Information.Game;
using Snowflake.Plugin;
using Snowflake.Constants;
using DuoVia.FuzzyStrings;
using Snowflake.Scraper;
using System.IO;
namespace Snowflake.Core
{
public class ScrapeEngine
{
private PlatformInfo ScrapePlatform { get; set; }
private IScraper ScraperPlugin { get; set; }
private IIdentifier IdentifierPlugin { get; set; }
public ScrapeEngine(PlatformInfo scrapePlatform)
{
this.ScrapePlatform = scrapePlatform;
this.ScraperPlugin = FrontendCore.LoadedCore.PluginManager.LoadedScrapers[ScrapePlatform.Defaults.Scraper];
this.IdentifierPlugin = FrontendCore.LoadedCore.PluginManager.LoadedIdentifiers[ScrapePlatform.Defaults.Identifier];
}
public GameInfo GetGameInfo(string fileName)
{
string gameName = this.IdentifierPlugin.IdentifyGame(fileName, this.ScrapePlatform.PlatformId);
var results = this.ScraperPlugin.GetSearchResults(gameName, this.ScrapePlatform.PlatformId).OrderBy(result => result.GameTitle.LevenshteinDistance(gameName)).ToList();
var resultdetails = this.ScraperPlugin.GetGameDetails(results[0].ID);
var gameinfo = resultdetails.Item1;
var gameUuid = ShortGuid.NewShortGuid();
return new GameInfo(
this.ScrapePlatform.PlatformId,
gameinfo[GameInfoFields.game_title],
resultdetails.Item2.ToMediaStore("game."+ScrapeEngine.ValidateFilename(gameinfo[GameInfoFields.game_title]).Replace(' ','_')+gameUuid),
gameinfo,
gameUuid,
fileName,
new Dictionary<string, dynamic>()
);
}
private static string ValidateFilename(string text, char? replacement = '_')
{
//from http://stackoverflow.com/a/25223884/1822679
StringBuilder sb = new StringBuilder(text.Length);
var invalids = Path.GetInvalidFileNameChars();
bool changed = false;
for (int i = 0; i < text.Length; i++)
{
char c = text[i];
if (invalids.Contains(c))
{
changed = true;
var repl = replacement ?? '\0';
if (repl != '\0')
sb.Append(repl);
}
else
sb.Append(c);
}
if (sb.Length == 0)
return "_";
return changed ? sb.ToString() : text;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Snowflake.Information.Platform;
using Snowflake.Information.Game;
using Snowflake.Plugin;
using Snowflake.Constants;
using DuoVia.FuzzyStrings;
using Snowflake.Scraper;
namespace Snowflake.Core
{
public class ScrapeEngine
{
private Platform ScrapePlatform { get; set; }
private IScraper ScraperPlugin { get; set; }
private IIdentifier IdentifierPlugin { get; set; }
public ScrapeEngine(Platform scrapePlatform)
{
this.ScrapePlatform = scrapePlatform;
this.ScraperPlugin = FrontendCore.LoadedCore.PluginManager.LoadedScrapers[ScrapePlatform.Defaults.Scraper];
this.IdentifierPlugin = FrontendCore.LoadedCore.PluginManager.LoadedIdentifiers[ScrapePlatform.Defaults.Identifier];
}
public Game GetGameInfo(string fileName)
{
string gameName = this.IdentifierPlugin.IdentifyGame(fileName, this.ScrapePlatform.PlatformId);
var results = this.ScraperPlugin.GetSearchResults(gameName, this.ScrapePlatform.PlatformId).OrderBy(result => result.GameTitle.LevenshteinDistance(gameName)).ToList();
var resultdetails = this.ScraperPlugin.GetGameDetails(results[0].ID);
var gameinfo = resultdetails.Item1;
return new Game(
this.ScrapePlatform.PlatformId,
gameinfo[GameInfoFields.game_title],
resultdetails.Item2,
gameinfo,
ShortGuid.NewShortGuid(),
fileName,
new Dictionary<string, dynamic>()
);
}
}
}
| mpl-2.0 | C# |
f2b18ab8f4c6bd1eb50938af04bd5e55d6c79d9c | Bump version number | opcon/Substructio,opcon/Substructio | src/Properties/AssemblyInfo.cs | src/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Substructio")]
[assembly: AssemblyDescription("Utility framework for OpenTK")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("VirtualHighRise")]
[assembly: AssemblyProduct("Substructio")]
[assembly: AssemblyCopyright("Copyright Patrick Yates © 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("7ec32a71-9e14-4227-92eb-e5391c34e48c")]
// 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.12.*")]
| 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("Substructio")]
[assembly: AssemblyDescription("Utility framework for OpenTK")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("VirtualHighRise")]
[assembly: AssemblyProduct("Substructio")]
[assembly: AssemblyCopyright("Copyright Patrick Yates © 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("7ec32a71-9e14-4227-92eb-e5391c34e48c")]
// 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.11.*")]
| mit | C# |
8ee4bebd9b9e0bcedf63359bc7eb05cf4ef19a27 | Update version to 2.5.30. Building against En Route SDK 2.13.58 | Glympse/enroute-xamarin-sdk,Glympse/enroute-xamarin-sdk,Glympse/enroute-xamarin-sdk | source/EnRouteApi/Source/Core/Config.cs | source/EnRouteApi/Source/Core/Config.cs | using System;
namespace EnRouteApi
{
public class Config
{
/**
* EnRoute Xamarin SDK version.
*/
public static readonly int ENROUTE_SDK_MAJOR = 2;
public static readonly int ENROUTE_SDK_MINOR = 5;
public static readonly int ENROUTE_SDK_BUILD = 30;
public static readonly int ENROUTE_SDK_BUGFIX = 0;
public static readonly int ENROUTE_SDK_ITER = 0;
}
}
| using System;
namespace EnRouteApi
{
public class Config
{
/**
* EnRoute Xamarin SDK version.
*/
public static readonly int ENROUTE_SDK_MAJOR = 2;
public static readonly int ENROUTE_SDK_MINOR = 5;
public static readonly int ENROUTE_SDK_BUILD = 29;
public static readonly int ENROUTE_SDK_BUGFIX = 0;
public static readonly int ENROUTE_SDK_ITER = 0;
}
}
| mit | C# |
a6e9b9fcb1efacc083f5b9893de9623ec727d05a | add claims factory to host | IdentityServer/IdentityServer3.AspNetIdentity,faithword/IdentityServer3.AspNetIdentity,sixten/IdentityServer3.AspNetIdentity | source/SelfHost/AspId/SimpleEntities.cs | source/SelfHost/AspId/SimpleEntities.cs | /*
* Copyright 2014 Dominick Baier, Brock Allen
*
* 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 Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Web;
namespace SelfHost.AspId
{
public class User : IdentityUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class Role : IdentityRole { }
public class Context : IdentityDbContext<User, Role, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>
{
public Context(string connString)
: base(connString)
{
}
}
public class UserStore : UserStore<User, Role, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>
{
public UserStore(Context ctx)
: base(ctx)
{
}
}
public class UserManager : UserManager<User, string>
{
public UserManager(UserStore store)
: base(store)
{
this.ClaimsIdentityFactory = new ClaimsFactory();
}
}
public class ClaimsFactory : ClaimsIdentityFactory<User, string>
{
public ClaimsFactory()
{
this.UserIdClaimType = Thinktecture.IdentityServer.Core.Constants.ClaimTypes.Subject;
this.UserNameClaimType = Thinktecture.IdentityServer.Core.Constants.ClaimTypes.PreferredUserName;
this.RoleClaimType = Thinktecture.IdentityServer.Core.Constants.ClaimTypes.Role;
}
public override async System.Threading.Tasks.Task<System.Security.Claims.ClaimsIdentity> CreateAsync(UserManager<User, string> manager, User user, string authenticationType)
{
var ci = await base.CreateAsync(manager, user, authenticationType);
if (!String.IsNullOrWhiteSpace(user.FirstName))
{
ci.AddClaim(new Claim("given_name", user.FirstName));
}
if (!String.IsNullOrWhiteSpace(user.LastName))
{
ci.AddClaim(new Claim("family_name", user.LastName));
}
return ci;
}
}
public class RoleStore : RoleStore<Role>
{
public RoleStore(Context ctx)
: base(ctx)
{
}
}
public class RoleManager : RoleManager<Role>
{
public RoleManager(RoleStore store)
: base(store)
{
}
}
} | /*
* Copyright 2014 Dominick Baier, Brock Allen
*
* 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 Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace SelfHost.AspId
{
public class User : IdentityUser { }
public class Role : IdentityRole { }
public class Context : IdentityDbContext<User, Role, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>
{
public Context(string connString)
: base(connString)
{
}
}
public class UserStore : UserStore<User>
{
public UserStore(Context ctx)
: base(ctx)
{
}
}
public class UserManager : UserManager<User>
{
public UserManager(UserStore store)
: base(store)
{
}
}
public class RoleStore : RoleStore<Role>
{
public RoleStore(Context ctx)
: base(ctx)
{
}
}
public class RoleManager : RoleManager<Role>
{
public RoleManager(RoleStore store)
: base(store)
{
}
}
} | apache-2.0 | C# |
3ffe93cd16f3d2ed06d445e64ef7b95c4761ea6e | Put Task.Run in a single line | zulhilmizainuddin/geoip,zulhilmizainuddin/geoip | src/GeoIP/Executers/MaxMindQuery.cs | src/GeoIP/Executers/MaxMindQuery.cs | using GeoIP.Models;
using MaxMind.GeoIP2;
using MaxMind.GeoIP2.Exceptions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace GeoIP.Executers
{
public class MaxMindQuery : IQuery
{
public async Task<object> Query(string ipAddress, string dataSource)
{
object result;
try
{
using (var reader = new DatabaseReader(dataSource))
{
var city = await Task.Run(() => { return reader.City(ipAddress); });
result = new Geolocation()
{
IPAddress = ipAddress,
City = city.City.Name,
Country = city.Country.Name,
Latitude = city.Location.Latitude,
Longitude = city.Location.Longitude
};
}
}
catch (AddressNotFoundException ex)
{
result = new Error()
{
ErrorMessage = ex.Message
};
}
return result;
}
}
}
| using GeoIP.Models;
using MaxMind.GeoIP2;
using MaxMind.GeoIP2.Exceptions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace GeoIP.Executers
{
public class MaxMindQuery : IQuery
{
public async Task<object> Query(string ipAddress, string dataSource)
{
object result;
try
{
using (var reader = new DatabaseReader(dataSource))
{
var city = await Task.Run(() =>
{
return reader.City(ipAddress);
});
result = new Geolocation()
{
IPAddress = ipAddress,
City = city.City.Name,
Country = city.Country.Name,
Latitude = city.Location.Latitude,
Longitude = city.Location.Longitude
};
}
}
catch (AddressNotFoundException ex)
{
result = new Error()
{
ErrorMessage = ex.Message
};
}
return result;
}
}
}
| mit | C# |
b11e8af0b96cc10732d2aeae18e6b4970b088811 | Fix fatal bugs for OSX | plenprojectcompany/plen-MotionEditor_Unity | Assets/Script/MotionInstall.cs | Assets/Script/MotionInstall.cs | using UnityEngine;
using System.Collections;
public class MotionInstall : MonoBehaviour {
#if UNITY_STANDALONE_WIN
void Start () {
}
void Update () {
}
/// <summary>
/// モーションインストーラ呼び出しメソッド
/// </summary>
/// <param name="jsonPath">モーションインストールを行いたいJSONファイルのパス</param>
/// <param name="fileName">JSONファイル名</param>
public void StartMotionInstallApp(string jsonPath, string fileName) {
// プロセス起動の各種設定.(MotionInstallerの仕様上第一引数:JSONファイルパス,第二引数:ファイル名である)
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo ();
//info.FileName = "c:/Git/plen2__ble_motion_installer_gui/bin/Debug/MotionInstaller.exe";
info.FileName = ObjectsController.ExternalFilePath + "MotionInstaller.exe";
info.Arguments = WWW.EscapeURL(jsonPath) + " " + WWW.EscapeURL(fileName);
Debug.Log (info.FileName);
// モーションインストーラ起動
System.Diagnostics.Process.Start (info);
}
#elif UNITY_STANDALONE_OSX
void Start() {
}
void Update() {
}
public void StartMotionInstallApp(string jsonPath, string fileName) {
// プロセス起動の各種設定.(MotionInstallerの仕様上第一引数:JSONファイルパス,第二引数:ファイル名である)
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = new System.Diagnostics.ProcessStartInfo () {
FileName = ObjectsController.ExternalFilePath + "MotionInstaller.app/Contents/MacOS/MotionInstaller",
Arguments = WWW.EscapeURL (jsonPath) + " " + WWW.EscapeURL (fileName)
};
// モーションインストーラ起動
process.Start ();
}
#else
void Start() {
}
void Update() {
}
public void StartMotionInstallApp(string jsonPath, string fileName) {
}
#endif
}
| using UnityEngine;
using System.Collections;
public class MotionInstall : MonoBehaviour {
#if UNITY_STANDALONE_WIN
void Start () {
}
void Update () {
}
/// <summary>
/// モーションインストーラ呼び出しメソッド
/// </summary>
/// <param name="jsonPath">モーションインストールを行いたいJSONファイルのパス</param>
/// <param name="fileName">JSONファイル名</param>
public void StartMotionInstallApp(string jsonPath, string fileName) {
// プロセス起動の各種設定.(MotionInstallerの仕様上第一引数:JSONファイルパス,第二引数:ファイル名である)
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo ();
//info.FileName = "c:/Git/plen2__ble_motion_installer_gui/bin/Debug/MotionInstaller.exe";
info.FileName = ObjectsController.ExternalFilePath + "MotionInstaller.exe";
info.Arguments = WWW.EscapeURL(jsonPath) + " " + WWW.EscapeURL(fileName);
Debug.Log (info.FileName);
// モーションインストーラ起動
System.Diagnostics.Process.Start (info);
}
#elif UNITY_STANDALONE_OSX
void Start() {
}
void Update() {
}
public void StartMotionInstallApp(string jsonPath, string fileName) {
// プロセス起動の各種設定.(MotionInstallerの仕様上第一引数:JSONファイルパス,第二引数:ファイル名である)
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = new System.Diagnostics.ProcessStartInfo () {
FileName = ObjectsController.externalFilePath + "MotionInstaller.app/Contents/MacOS/MotionInstaller",
Arguments = WWW.EscapeURL (jsonPath) + " " + WWW.EscapeURL (fileName)
};
// モーションインストーラ起動
process.Start ();
}
#else
void Start() {
}
void Update() {
}
public void StartMotionInstallApp(string jsonPath, string fileName) {
}
#endif
}
| mit | C# |
69f8cfa503cf5fe36bab88b82340c66d2db822b0 | Add TotalTips and BusserTipout to Shift model | BillChirico/Tipage,BillChirico/Tipage | src/Tipage.Web/Models/Shift.cs | src/Tipage.Web/Models/Shift.cs | using System;
using System.ComponentModel.DataAnnotations;
namespace Tipage.Web.Models
{
public class Shift
{
/// <summary>
/// Id of the shift.
/// </summary>
public int Id { get; set; }
/// <summary>
/// User of the shift.
/// </summary>
public ApplicationUser User { get; set; }
/// <summary>
/// Start of the shift.
/// </summary>
public DateTimeOffset Start { get; set; }
/// <summary>
/// End of the shift.
/// </summary>
public DateTimeOffset End { get; set; }
/// <summary>
/// Total amount of cash tips.
/// </summary>
[Display(Name = "Cash Tips")]
[DataType(DataType.Currency)]
public decimal CashTips { get; set; }
/// <summary>
/// Total amount of credit card tips.
/// </summary>
[Display(Name = "Credit Tips")]
[DataType(DataType.Currency)]
public decimal CreditTips { get; set; }
/// <summary>
/// Cash tips and Credit tips.
/// </summary>
public decimal TotalTips => CashTips + CreditTips;
public decimal BusserTipout => Math.Round((TotalTips * 10) / 100, 2, MidpointRounding.AwayFromZero);
}
}
| using System;
using System.ComponentModel.DataAnnotations;
namespace Tipage.Web.Models
{
public class Shift
{
/// <summary>
/// Id of the shift.
/// </summary>
public int Id { get; set; }
/// <summary>
/// User of the shift.
/// </summary>
public ApplicationUser User { get; set; }
/// <summary>
/// Start of the shift.
/// </summary>
public DateTimeOffset Start { get; set; }
/// <summary>
/// End of the shift.
/// </summary>
public DateTimeOffset End { get; set; }
/// <summary>
/// Total amount of cash tips.
/// </summary>
[Display(Name = "Cash Tips")]
[DataType(DataType.Currency)]
public decimal CashTips { get; set; }
/// <summary>
/// Total amount of credit card tips.
/// </summary>
[Display(Name = "Credit Tips")]
[DataType(DataType.Currency)]
public decimal CreditTips { get; set; }
}
}
| mit | C# |
23769228671a15867415b0a6953f1657b63fa094 | Fix assignment of Reason | aspnetboilerplate/aspnetboilerplate,fengyeju/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,Nongzhsh/aspnetboilerplate,ryancyq/aspnetboilerplate,verdentk/aspnetboilerplate,ryancyq/aspnetboilerplate,verdentk/aspnetboilerplate,luchaoshuai/aspnetboilerplate,carldai0106/aspnetboilerplate,virtualcca/aspnetboilerplate,fengyeju/aspnetboilerplate,AlexGeller/aspnetboilerplate,AlexGeller/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,beratcarsi/aspnetboilerplate,AlexGeller/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,andmattia/aspnetboilerplate,ilyhacker/aspnetboilerplate,ilyhacker/aspnetboilerplate,zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,andmattia/aspnetboilerplate,Nongzhsh/aspnetboilerplate,fengyeju/aspnetboilerplate,beratcarsi/aspnetboilerplate,beratcarsi/aspnetboilerplate,ilyhacker/aspnetboilerplate,virtualcca/aspnetboilerplate,zclmoon/aspnetboilerplate,luchaoshuai/aspnetboilerplate,andmattia/aspnetboilerplate,zclmoon/aspnetboilerplate,verdentk/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,Nongzhsh/aspnetboilerplate | src/Abp/EntityHistory/ReasonOverride.cs | src/Abp/EntityHistory/ReasonOverride.cs | namespace Abp.EntityHistory
{
public class ReasonOverride
{
public string Reason { get; }
public ReasonOverride(string reason)
{
Reason = reason;
}
}
}
| namespace Abp.EntityHistory
{
public class ReasonOverride
{
public string Reason { get; }
public ReasonOverride(string reason)
{
Reason = null;
}
}
}
| mit | C# |
1168e7d41129633ff4497199c7752b6e7cfdbdcf | Initialize ConfigCommand with an ApplicationConfiguration, AppHarborClient and TextWriter | appharbor/appharbor-cli | src/AppHarbor/Commands/ConfigCommand.cs | src/AppHarbor/Commands/ConfigCommand.cs | using System;
using System.IO;
namespace AppHarbor.Commands
{
public class ConfigCommand : ICommand
{
private readonly IApplicationConfiguration _applicationConfiguration;
private readonly IAppHarborClient _appharborClient;
private readonly TextWriter _writer;
public ConfigCommand(IApplicationConfiguration applicationConfiguration, IAppHarborClient appharborClient, TextWriter writer)
{
_applicationConfiguration = applicationConfiguration;
_appharborClient = appharborClient;
_writer = writer
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| using System;
namespace AppHarbor.Commands
{
public class ConfigCommand : ICommand
{
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
a127e2739d22b5db86ea240bc4696cfd2b33b8f6 | Add NotImplemented.ActiveIssue() method. | tijoytom/corefx,richlander/corefx,seanshpark/corefx,nbarbettini/corefx,zhenlan/corefx,dotnet-bot/corefx,twsouthwick/corefx,JosephTremoulet/corefx,the-dwyer/corefx,nbarbettini/corefx,gkhanna79/corefx,Jiayili1/corefx,ericstj/corefx,zhenlan/corefx,ravimeda/corefx,yizhang82/corefx,MaggieTsang/corefx,yizhang82/corefx,seanshpark/corefx,mazong1123/corefx,richlander/corefx,fgreinacher/corefx,alexperovich/corefx,ravimeda/corefx,DnlHarvey/corefx,ericstj/corefx,gkhanna79/corefx,parjong/corefx,nbarbettini/corefx,the-dwyer/corefx,ViktorHofer/corefx,krytarowski/corefx,nchikanov/corefx,gkhanna79/corefx,seanshpark/corefx,cydhaselton/corefx,tijoytom/corefx,twsouthwick/corefx,parjong/corefx,parjong/corefx,seanshpark/corefx,alexperovich/corefx,DnlHarvey/corefx,MaggieTsang/corefx,shimingsg/corefx,jlin177/corefx,nbarbettini/corefx,axelheer/corefx,ptoonen/corefx,gkhanna79/corefx,parjong/corefx,DnlHarvey/corefx,krytarowski/corefx,ViktorHofer/corefx,richlander/corefx,MaggieTsang/corefx,cydhaselton/corefx,stone-li/corefx,krk/corefx,rubo/corefx,richlander/corefx,fgreinacher/corefx,dotnet-bot/corefx,zhenlan/corefx,ViktorHofer/corefx,ericstj/corefx,zhenlan/corefx,DnlHarvey/corefx,cydhaselton/corefx,mmitche/corefx,mmitche/corefx,richlander/corefx,ravimeda/corefx,mazong1123/corefx,twsouthwick/corefx,JosephTremoulet/corefx,krk/corefx,krk/corefx,Ermiar/corefx,billwert/corefx,shimingsg/corefx,Jiayili1/corefx,Jiayili1/corefx,JosephTremoulet/corefx,shimingsg/corefx,dotnet-bot/corefx,zhenlan/corefx,gkhanna79/corefx,twsouthwick/corefx,ptoonen/corefx,stone-li/corefx,tijoytom/corefx,DnlHarvey/corefx,axelheer/corefx,dotnet-bot/corefx,richlander/corefx,Jiayili1/corefx,cydhaselton/corefx,wtgodbe/corefx,ViktorHofer/corefx,DnlHarvey/corefx,wtgodbe/corefx,ericstj/corefx,shimingsg/corefx,ViktorHofer/corefx,zhenlan/corefx,mazong1123/corefx,krytarowski/corefx,tijoytom/corefx,yizhang82/corefx,mazong1123/corefx,nchikanov/corefx,seanshpark/corefx,Jiayili1/corefx,wtgodbe/corefx,mmitche/corefx,Ermiar/corefx,MaggieTsang/corefx,wtgodbe/corefx,rubo/corefx,the-dwyer/corefx,ravimeda/corefx,JosephTremoulet/corefx,wtgodbe/corefx,mmitche/corefx,stone-li/corefx,Ermiar/corefx,mazong1123/corefx,twsouthwick/corefx,wtgodbe/corefx,nchikanov/corefx,zhenlan/corefx,mazong1123/corefx,Jiayili1/corefx,ViktorHofer/corefx,stone-li/corefx,the-dwyer/corefx,ptoonen/corefx,the-dwyer/corefx,fgreinacher/corefx,seanshpark/corefx,nchikanov/corefx,gkhanna79/corefx,cydhaselton/corefx,dotnet-bot/corefx,krk/corefx,billwert/corefx,Ermiar/corefx,BrennanConroy/corefx,jlin177/corefx,Jiayili1/corefx,seanshpark/corefx,nbarbettini/corefx,ravimeda/corefx,ptoonen/corefx,axelheer/corefx,billwert/corefx,ericstj/corefx,axelheer/corefx,JosephTremoulet/corefx,mazong1123/corefx,MaggieTsang/corefx,ravimeda/corefx,Ermiar/corefx,dotnet-bot/corefx,tijoytom/corefx,BrennanConroy/corefx,billwert/corefx,alexperovich/corefx,the-dwyer/corefx,MaggieTsang/corefx,JosephTremoulet/corefx,krk/corefx,parjong/corefx,billwert/corefx,ptoonen/corefx,alexperovich/corefx,krytarowski/corefx,shimingsg/corefx,alexperovich/corefx,yizhang82/corefx,nbarbettini/corefx,cydhaselton/corefx,wtgodbe/corefx,rubo/corefx,alexperovich/corefx,jlin177/corefx,krytarowski/corefx,ericstj/corefx,mmitche/corefx,nchikanov/corefx,twsouthwick/corefx,BrennanConroy/corefx,axelheer/corefx,nbarbettini/corefx,JosephTremoulet/corefx,jlin177/corefx,dotnet-bot/corefx,rubo/corefx,nchikanov/corefx,yizhang82/corefx,jlin177/corefx,stone-li/corefx,parjong/corefx,krk/corefx,ravimeda/corefx,rubo/corefx,yizhang82/corefx,alexperovich/corefx,yizhang82/corefx,MaggieTsang/corefx,twsouthwick/corefx,ptoonen/corefx,ericstj/corefx,cydhaselton/corefx,Ermiar/corefx,richlander/corefx,krytarowski/corefx,axelheer/corefx,stone-li/corefx,mmitche/corefx,nchikanov/corefx,the-dwyer/corefx,gkhanna79/corefx,krytarowski/corefx,shimingsg/corefx,shimingsg/corefx,krk/corefx,tijoytom/corefx,ptoonen/corefx,Ermiar/corefx,tijoytom/corefx,jlin177/corefx,billwert/corefx,billwert/corefx,fgreinacher/corefx,ViktorHofer/corefx,parjong/corefx,jlin177/corefx,DnlHarvey/corefx,mmitche/corefx,stone-li/corefx | src/Common/src/System/NotImplemented.cs | src/Common/src/System/NotImplemented.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System
{
//
// Support for tooling-friendly NotImplementedExceptions.
//
internal static class NotImplemented
{
/// <summary>
/// Permanent NotImplementedException with no message shown to user.
/// </summary>
internal static Exception ByDesign => new NotImplementedException();
/// <summary>
/// Permanent NotImplementedException with localized message shown to user.
/// </summary>
internal static Exception ByDesignWithMessage(string message)
{
return new NotImplementedException(message);
}
/// <summary>
/// Temporary NotImplementedException with no message shown to user.
/// Example: Exception.ActiveIssue("https://github.com/dotnet/corefx/issues/xxxx") or Exception.ActiveIssue("TFS xxxxxx").
/// </summary>
internal static Exception ActiveIssue(string issue) => new NotImplementedException();
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System
{
//
// This class enables one to throw a NotImplementedException using the following idiom:
//
// throw NotImplemented.ByDesign;
//
// Used by methods whose intended implementation is to throw a NotImplementedException (typically
// virtual methods in public abstract classes that intended to be subclassed by third parties.)
//
// This makes it distinguishable both from human eyes and CCI from NYI's that truly represent undone work.
//
internal static class NotImplemented
{
internal static Exception ByDesign => new NotImplementedException();
internal static Exception ByDesignWithMessage(string message)
{
return new NotImplementedException(message);
}
}
}
| mit | C# |
89dd01c41616999579fcc4f84f7448f1fafaa2a4 | Add filter property to popular shows request. | henrikfroehling/TraktApiSharp | Source/Lib/TraktApiSharp/Requests/WithoutOAuth/Shows/Common/TraktShowsPopularRequest.cs | Source/Lib/TraktApiSharp/Requests/WithoutOAuth/Shows/Common/TraktShowsPopularRequest.cs | namespace TraktApiSharp.Requests.WithoutOAuth.Shows.Common
{
using Base;
using Base.Get;
using Objects.Basic;
using Objects.Get.Shows;
internal class TraktShowsPopularRequest : TraktGetRequest<TraktPaginationListResult<TraktShow>, TraktShow>
{
internal TraktShowsPopularRequest(TraktClient client) : base(client) { }
protected override string UriTemplate => "shows/popular{?extended,page,limit,query,years,genres,languages,countries,runtimes,ratings,certifications,networks,status}";
protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired;
internal TraktShowFilter Filter { get; set; }
protected override bool SupportsPagination => true;
protected override bool IsListResult => true;
}
}
| namespace TraktApiSharp.Requests.WithoutOAuth.Shows.Common
{
using Base.Get;
using Objects.Basic;
using Objects.Get.Shows;
internal class TraktShowsPopularRequest : TraktGetRequest<TraktPaginationListResult<TraktShow>, TraktShow>
{
internal TraktShowsPopularRequest(TraktClient client) : base(client) { }
protected override string UriTemplate => "shows/popular{?extended,page,limit}";
protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired;
protected override bool SupportsPagination => true;
protected override bool IsListResult => true;
}
}
| mit | C# |
94b25d52585ff7d4cfe72d3cfd0df171e0417c1c | Update Utils.cs | AKouki/AspNetCore-ITrackerSPA,AKouki/AspNetCore-ITrackerSPA,AKouki/AspNetCore-ITrackerSPA | Helpers/Utils.cs | Helpers/Utils.cs | using System.IO;
using System.Linq;
using ITrackerSPA.Models.Enums;
using Microsoft.AspNetCore.Http;
namespace ITrackerSPA.Controllers
{
public class Utils
{
public static FileType GetFileType(IFormFile file)
{
string[] images = { "png", "jpg", "jpeg" };
var fileExtension = Path.GetExtension(file.FileName);
if (images.Any(e => fileExtension.Contains(e)))
return FileType.Image;
// Anyway...
return FileType.Document;
}
public static bool isValidFile(IFormFile file)
{
string[] allowedExtensions = { "png", "jpg", "jpeg", "pdf", "doc", "docx" };
string fileExtension = Path.GetExtension(file.FileName);
// Invalid file
if (file == null || file.Length == 0)
return false;
// Maximum file size: 500kb
if (file.Length > 512000)
return false;
// Only the above file extensions are allowed
if (!allowedExtensions.Any(e => fileExtension.Contains(e)))
return false;
return true;
}
}
}
| using System.IO;
using System.Linq;
using ITrackerSPA.Models.Enums;
using Microsoft.AspNetCore.Http;
namespace ITrackerSPA.Controllers
{
public class Utils
{
public static FileType GetFileType(IFormFile file)
{
string[] images = { "png", "jpg", "jpeg" };
var fileExtension = Path.GetExtension(file.FileName);
if (images.Any(e => fileExtension.Contains(e)))
return FileType.Image;
// Anyway...
return FileType.Document;
}
public static bool isValidFile(IFormFile file)
{
string[] allowedExtensions = { "png", "jpg", "jpeg", "pdf", "doc", "docx" };
string fileExtension = Path.GetExtension(file.FileName);
// Invalid file
if (file == null || file.Length == 0)
return false;
// Maximum file size: 500kb
if (file.Length > 512000)
return false;
// Only the above file extensions are allowed
if (!allowedExtensions.Any(e => fileExtension.Contains(e)))
return false;
return true;
}
}
}
| mit | C# |
5acc6e598c2ec9e77cdcff3c86fde17b5b6dd944 | Update ObjectExtensions.cs | apemost/Newq,apemost/Newq | src/Newq/Extensions/ObjectExtensions.cs | src/Newq/Extensions/ObjectExtensions.cs | namespace Newq.Extensions
{
using System;
/// <summary>
///
/// </summary>
public static class ObjectExtensions
{
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static string ToSqlValue(this object obj)
{
var value = string.Empty;
if (obj is string)
{
value = obj.ToString().Replace("'", "''");
value = string.Format("'{0}'", value);
}
else if (obj is DateTime)
{
value = string.Format("'{0}'", ((DateTime)obj).ToString("yyyy-MM-dd hh:mm:ss.fff"));
}
else if (obj == null)
{
value = "''";
}
else
{
value = obj.ToString();
}
return value;
}
}
}
| namespace Newq.Extensions
{
using System;
/// <summary>
///
/// </summary>
public static class ObjectExtensions
{
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static string ToSqlValue(this object obj)
{
var value = string.Empty;
if (obj is string || obj == null)
{
value = string.Format("'{0}'", obj);
}
else if (obj is DateTime)
{
value = string.Format("'{0}'", ((DateTime)obj).ToString("yyyy-MM-dd hh:mm:ss.fff"));
}
else
{
value = obj.ToString();
}
return value;
}
}
}
| mit | C# |
7d5c2747e0fb7535168ceed8c202d4d8055e27e1 | Use language string instead of Culture | picklesdoc/pickles,ludwigjossieaux/pickles,picklesdoc/pickles,dirkrombauts/pickles,blorgbeard/pickles,dirkrombauts/pickles,dirkrombauts/pickles,magicmonty/pickles,ludwigjossieaux/pickles,blorgbeard/pickles,dirkrombauts/pickles,magicmonty/pickles,magicmonty/pickles,blorgbeard/pickles,blorgbeard/pickles,picklesdoc/pickles,ludwigjossieaux/pickles,picklesdoc/pickles,magicmonty/pickles | src/Pickles/Pickles/LanguageServices.cs | src/Pickles/Pickles/LanguageServices.cs | #region License
/*
Copyright [2011] [Jeffrey Cameron]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#endregion
using System;
using System.Linq;
using Gherkin3;
namespace PicklesDoc.Pickles
{
public class LanguageServices
{
private readonly string language;
private readonly GherkinDialectProvider dialectProvider;
public LanguageServices(Configuration configuration)
{
this.language = configuration.Language;
this.dialectProvider = new GherkinDialectProvider();
this.whenStepKeywordsLazy = new Lazy<string[]>(() => this.GetLanguage().WhenStepKeywords.Select(s => s.Trim()).ToArray());
}
private readonly Lazy<string[]> whenStepKeywordsLazy;
public string[] WhenStepKeywords
{
get
{
return this.whenStepKeywordsLazy.Value;
}
}
public string[] GivenStepKeywords { get { return this.GetLanguage().GivenStepKeywords; } }
public string[] ThenStepKeywords { get { return this.GetLanguage().ThenStepKeywords; } }
public string[] AndStepKeywords { get { return this.GetLanguage().AndStepKeywords; } }
public string[] ButStepKeywords { get { return this.GetLanguage().ButStepKeywords; } }
private string[] GetBackgroundKeywords()
{
return this.GetLanguage().BackgroundKeywords;
}
public string GetKeyword(string key)
{
var keywords = this.GetBackgroundKeywords();
return keywords.FirstOrDefault();
}
private GherkinDialect GetLanguage()
{
if (string.IsNullOrWhiteSpace(this.language))
return this.dialectProvider.GetDialect("en", null);
return this.dialectProvider.GetDialect(this.language, null);
}
}
} | #region License
/*
Copyright [2011] [Jeffrey Cameron]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#endregion
using System;
using System.Globalization;
using System.Linq;
using Gherkin3;
namespace PicklesDoc.Pickles
{
public class LanguageServices
{
private readonly CultureInfo currentCulture;
private readonly GherkinDialectProvider dialectProvider;
public LanguageServices(Configuration configuration)
{
if (!string.IsNullOrEmpty(configuration.Language))
this.currentCulture = CultureInfo.GetCultureInfo(configuration.Language);
this.dialectProvider = new GherkinDialectProvider();
this.whenStepKeywordsLazy = new Lazy<string[]>(() => this.GetLanguage().WhenStepKeywords.Select(s => s.Trim()).ToArray());
}
private readonly Lazy<string[]> whenStepKeywordsLazy;
public string[] WhenStepKeywords
{
get
{
return this.whenStepKeywordsLazy.Value;
}
}
public string[] GivenStepKeywords { get { return this.GetLanguage().GivenStepKeywords; } }
public string[] ThenStepKeywords { get { return this.GetLanguage().ThenStepKeywords; } }
public string[] AndStepKeywords { get { return this.GetLanguage().AndStepKeywords; } }
public string[] ButStepKeywords { get { return this.GetLanguage().ButStepKeywords; } }
private string[] GetBackgroundKeywords()
{
return this.GetLanguage().BackgroundKeywords;
}
public string GetKeyword(string key)
{
var keywords = this.GetBackgroundKeywords();
return keywords.FirstOrDefault();
}
private GherkinDialect GetLanguage()
{
if (this.currentCulture == null)
return this.dialectProvider.GetDialect("en", null);
return this.dialectProvider.GetDialect(this.currentCulture.TwoLetterISOLanguageName, null);
}
}
} | apache-2.0 | C# |
e3e9593756c37fad226ab3a67e816164235ec962 | Write the DOCTYPE and use two-space indentation | tmds/Tmds.DBus | Introspection.cs | Introspection.cs | // Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Text;
namespace NDesk.DBus
{
//TODO: complete this class
public class Introspector
{
const string NAMESPACE = "http://www.freedesktop.org/standards/dbus";
const string PUBLIC_IDENTIFIER = "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN";
const string SYSTEM_IDENTIFIER = "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";
public string xml;
public Type target_type;
public void HandleIntrospect ()
{
XmlWriterSettings settings = new XmlWriterSettings ();
settings.Indent = true;
settings.IndentChars = (" ");
settings.OmitXmlDeclaration = true;
StringBuilder sb = new StringBuilder ();
XmlWriter writer;
writer = XmlWriter.Create (sb, settings);
writer.WriteDocType ("node", PUBLIC_IDENTIFIER, SYSTEM_IDENTIFIER, null);
writer.WriteStartElement ("node");
writer.WriteStartElement ("interface");
writer.WriteAttributeString ("name", "org.freedesktop.DBus.Introspectable");
writer.WriteStartElement ("method");
writer.WriteAttributeString ("name", "Introspect");
writer.WriteStartElement ("arg");
writer.WriteAttributeString ("name", "data");
writer.WriteAttributeString ("direction", "out");
writer.WriteAttributeString ("type", "s");
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.Flush ();
xml = sb.ToString ();
}
}
}
| // Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Text;
namespace NDesk.DBus
{
//TODO: complete this class
public class Introspector
{
public string xml;
public Type target_type;
public void HandleIntrospect ()
{
XmlWriterSettings settings = new XmlWriterSettings ();
settings.Indent = true;
settings.IndentChars = ("\t");
settings.OmitXmlDeclaration = true;
StringBuilder sb = new StringBuilder ();
XmlWriter writer;
//TODO: doctype
writer = XmlWriter.Create (sb, settings);
writer.WriteStartElement ("node");
writer.WriteStartElement ("interface");
writer.WriteAttributeString ("name", "org.freedesktop.DBus.Introspectable");
writer.WriteStartElement ("method");
writer.WriteAttributeString ("name", "Introspect");
writer.WriteStartElement ("arg");
writer.WriteAttributeString ("name", "data");
writer.WriteAttributeString ("direction", "out");
writer.WriteAttributeString ("type", "s");
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.WriteEndElement ();
writer.Flush ();
xml = sb.ToString ();
}
}
}
| mit | C# |
04900337c7f2b36fdfb25f16de22649a8abc8d21 | Support generic CultureInfo as language culture | gavinfaux/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,sargin48/Umbraco-CMS,KevinJump/Umbraco-CMS,aaronpowell/Umbraco-CMS,abjerner/Umbraco-CMS,base33/Umbraco-CMS,mittonp/Umbraco-CMS,aadfPT/Umbraco-CMS,NikRimington/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,WebCentrum/Umbraco-CMS,dawoe/Umbraco-CMS,rasmusfjord/Umbraco-CMS,gkonings/Umbraco-CMS,Phosworks/Umbraco-CMS,lars-erik/Umbraco-CMS,romanlytvyn/Umbraco-CMS,KevinJump/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,base33/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,mittonp/Umbraco-CMS,engern/Umbraco-CMS,WebCentrum/Umbraco-CMS,gavinfaux/Umbraco-CMS,WebCentrum/Umbraco-CMS,rasmuseeg/Umbraco-CMS,aaronpowell/Umbraco-CMS,leekelleher/Umbraco-CMS,rasmuseeg/Umbraco-CMS,rasmusfjord/Umbraco-CMS,abjerner/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,mittonp/Umbraco-CMS,rasmusfjord/Umbraco-CMS,aadfPT/Umbraco-CMS,neilgaietto/Umbraco-CMS,rasmusfjord/Umbraco-CMS,sargin48/Umbraco-CMS,Spijkerboer/Umbraco-CMS,mattbrailsford/Umbraco-CMS,rustyswayne/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,dawoe/Umbraco-CMS,neilgaietto/Umbraco-CMS,arknu/Umbraco-CMS,mittonp/Umbraco-CMS,rasmusfjord/Umbraco-CMS,aadfPT/Umbraco-CMS,marcemarc/Umbraco-CMS,Phosworks/Umbraco-CMS,mittonp/Umbraco-CMS,bjarnef/Umbraco-CMS,NikRimington/Umbraco-CMS,kgiszewski/Umbraco-CMS,dawoe/Umbraco-CMS,gkonings/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,Phosworks/Umbraco-CMS,base33/Umbraco-CMS,rustyswayne/Umbraco-CMS,rustyswayne/Umbraco-CMS,NikRimington/Umbraco-CMS,lars-erik/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,lars-erik/Umbraco-CMS,marcemarc/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,abryukhov/Umbraco-CMS,Spijkerboer/Umbraco-CMS,rasmuseeg/Umbraco-CMS,aaronpowell/Umbraco-CMS,lars-erik/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,TimoPerplex/Umbraco-CMS,hfloyd/Umbraco-CMS,sargin48/Umbraco-CMS,kasperhhk/Umbraco-CMS,madsoulswe/Umbraco-CMS,tcmorris/Umbraco-CMS,jchurchley/Umbraco-CMS,leekelleher/Umbraco-CMS,Phosworks/Umbraco-CMS,Phosworks/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,kasperhhk/Umbraco-CMS,neilgaietto/Umbraco-CMS,rustyswayne/Umbraco-CMS,TimoPerplex/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,abjerner/Umbraco-CMS,kgiszewski/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,romanlytvyn/Umbraco-CMS,tcmorris/Umbraco-CMS,romanlytvyn/Umbraco-CMS,TimoPerplex/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,Spijkerboer/Umbraco-CMS,engern/Umbraco-CMS,lars-erik/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS,gkonings/Umbraco-CMS,kasperhhk/Umbraco-CMS,romanlytvyn/Umbraco-CMS,abryukhov/Umbraco-CMS,sargin48/Umbraco-CMS,gavinfaux/Umbraco-CMS,gavinfaux/Umbraco-CMS,tompipe/Umbraco-CMS,engern/Umbraco-CMS,hfloyd/Umbraco-CMS,neilgaietto/Umbraco-CMS,tompipe/Umbraco-CMS,Spijkerboer/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,kasperhhk/Umbraco-CMS,engern/Umbraco-CMS,gkonings/Umbraco-CMS,bjarnef/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,romanlytvyn/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,gavinfaux/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,leekelleher/Umbraco-CMS,TimoPerplex/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,jchurchley/Umbraco-CMS,kgiszewski/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,jchurchley/Umbraco-CMS,madsoulswe/Umbraco-CMS,TimoPerplex/Umbraco-CMS,robertjf/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,engern/Umbraco-CMS,Spijkerboer/Umbraco-CMS,bjarnef/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,gkonings/Umbraco-CMS,rustyswayne/Umbraco-CMS,kasperhhk/Umbraco-CMS,sargin48/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,neilgaietto/Umbraco-CMS,bjarnef/Umbraco-CMS,tompipe/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS | src/Umbraco.Core/Models/Language.cs | src/Umbraco.Core/Models/Language.cs | using System;
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a Language
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
public class Language : Entity, ILanguage
{
private string _isoCode;
private string _cultureName;
public Language(string isoCode)
{
IsoCode = isoCode;
}
private static readonly PropertyInfo IsoCodeSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.IsoCode);
private static readonly PropertyInfo CultureNameSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.CultureName);
/// <summary>
/// Gets or sets the Iso Code for the Language
/// </summary>
[DataMember]
public string IsoCode
{
get { return _isoCode; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_isoCode = value;
return _isoCode;
}, _isoCode, IsoCodeSelector);
}
}
/// <summary>
/// Gets or sets the Culture Name for the Language
/// </summary>
[DataMember]
public string CultureName
{
get { return _cultureName; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cultureName = value;
return _cultureName;
}, _cultureName, CultureNameSelector);
}
}
/// <summary>
/// Returns a <see cref="CultureInfo"/> object for the current Language
/// </summary>
[IgnoreDataMember]
public CultureInfo CultureInfo
{
get { return CultureInfo.GetCultureInfo(IsoCode); }
}
}
} | using System;
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a Language
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
public class Language : Entity, ILanguage
{
private string _isoCode;
private string _cultureName;
public Language(string isoCode)
{
IsoCode = isoCode;
}
private static readonly PropertyInfo IsoCodeSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.IsoCode);
private static readonly PropertyInfo CultureNameSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.CultureName);
/// <summary>
/// Gets or sets the Iso Code for the Language
/// </summary>
[DataMember]
public string IsoCode
{
get { return _isoCode; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_isoCode = value;
return _isoCode;
}, _isoCode, IsoCodeSelector);
}
}
/// <summary>
/// Gets or sets the Culture Name for the Language
/// </summary>
[DataMember]
public string CultureName
{
get { return _cultureName; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_cultureName = value;
return _cultureName;
}, _cultureName, CultureNameSelector);
}
}
/// <summary>
/// Returns a <see cref="CultureInfo"/> object for the current Language
/// </summary>
[IgnoreDataMember]
public CultureInfo CultureInfo
{
get { return CultureInfo.CreateSpecificCulture(IsoCode); }
}
}
} | mit | C# |
6300770874e81033025ebde11642344cdb7af452 | add calendarlink type | rlittletht/RWLLPracticeTool,rlittletht/RWLLPracticeTool | Rwp/Types.cs | Rwp/Types.cs |
using System;
using System.Collections.Generic;
namespace Rwp
{
public class RSRBase
{
public bool Result { get; set; }
public string Reason { get; set; }
public bool Succeeded => Result;
}
public class RSR : RSRBase
{
}
public class TRSR<T> : RSRBase
{
public T TheValue { get; set; }
}
public class ServerInfo
{
public string sSqlServerHash;
public string sServerName;
}
public class CalItem
{
public string Title { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
public string Location { get; set; }
public string Description { get; set; }
public string UID { get; set; }
}
public class CalendarLink
{
public Guid Link { get; set; }
public string Team { get; set; }
public string Authority { get; set; }
public DateTime CreateDate { get; set; }
public string Comment { get; set; }
}
public class RSR_CalItems : TRSR<List<CalItem>>
{
}
} |
using System;
using System.Collections.Generic;
namespace Rwp
{
public class RSRBase
{
public bool Result { get; set; }
public string Reason { get; set; }
public bool Succeeded => Result;
}
public class RSR : RSRBase
{
}
public class TRSR<T> : RSRBase
{
public T TheValue { get; set; }
}
public class ServerInfo
{
public string sSqlServerHash;
public string sServerName;
}
public class CalItem
{
public string Title { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
public string Location { get; set; }
public string Description { get; set; }
public string UID { get; set; }
}
public class RSR_CalItems : TRSR<List<CalItem>>
{
}
} | mit | C# |
7526ba7ca4b50f36cc2042005146534cd045cb09 | Fix - Ricerca utente quando l'operatore viene cancellato dalla base dati | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.Persistence.MongoDB/GestioneUtenti/GestioneUtente/GetUtenteById.cs | src/backend/SO115App.Persistence.MongoDB/GestioneUtenti/GestioneUtente/GetUtenteById.cs | //-----------------------------------------------------------------------
// <copyright file="GetUtenteById.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.API.Models.Classi.Autenticazione;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti;
namespace SO115App.Persistence.MongoDB.GestioneUtenti.GestioneUtente
{
/// <summary>
/// classe che recupera l'utente a partire dal suo id
/// </summary>
public class GetUtenteById : IGetUtenteById
{
private readonly DbContext _dbContext;
/// <summary>
/// costruttore della classe
/// </summary>
/// <param name="dbContext"></param>
public GetUtenteById(DbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// metodo della classe che recupera l'utente a partire dall'id
/// </summary>
/// <param name="id">il id dell'utente su mongo</param>
/// <returns>L'utente</returns>
public Utente GetUtenteByCodice(string id)
{
return _dbContext.UtenteCollection.Find(Builders<Utente>.Filter.Eq(x => x.Id, id)).SingleOrDefault();
}
}
}
| //-----------------------------------------------------------------------
// <copyright file="GetUtenteById.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.API.Models.Classi.Autenticazione;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti;
namespace SO115App.Persistence.MongoDB.GestioneUtenti.GestioneUtente
{
/// <summary>
/// classe che recupera l'utente a partire dal suo id
/// </summary>
public class GetUtenteById : IGetUtenteById
{
private readonly DbContext _dbContext;
/// <summary>
/// costruttore della classe
/// </summary>
/// <param name="dbContext"></param>
public GetUtenteById(DbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// metodo della classe che recupera l'utente a partire dall'id
/// </summary>
/// <param name="id">il id dell'utente su mongo</param>
/// <returns>L'utente</returns>
public Utente GetUtenteByCodice(string id)
{
return _dbContext.UtenteCollection.Find(Builders<Utente>.Filter.Eq(x => x.Id, id)).Single();
}
}
}
| agpl-3.0 | C# |
21c96420381753d65f6a87f686f5f3e2aa28a4e6 | Fix application exit. | tfreitasleal/MvvmFx,MvvmFx/MvvmFx | Samples/CaliburnMicro/MasterDetailWithModel/MasterDetailWithModel.WisejWeb/MainForm.cs | Samples/CaliburnMicro/MasterDetailWithModel/MasterDetailWithModel.WisejWeb/MainForm.cs | using System;
using System.Collections.Generic;
#if WISEJ
using Wisej.Web;
#else
using System.Windows.Forms;
#endif
using MvvmFx.CaliburnMicro;
using MvvmFx.Windows.Data;
namespace MasterDetailWithModel
{
public partial class MainForm : Form, IHaveDataContext
{
private readonly BindingManager _bindingManager = new BindingManager();
private bool _isBindingSet;
public MainForm()
{
InitializeComponent();
}
public new void Close()
{
Application.Exit();
}
#region IHaveDataContext implementation
public event EventHandler<DataContextChangedEventArgs> DataContextChanged = delegate { };
private MainFormViewModel _viewModel;
public object DataContext
{
get { return _viewModel; }
set
{
if (value != _viewModel)
{
_viewModel = value as MainFormViewModel;
DataContextChanged(this, new DataContextChangedEventArgs());
}
}
}
#endregion
#region Bind menu items
public void BindMenuItems(List<Control> namedElements)
{
if (_isBindingSet)
return;
// Binds the control visible and enabled properties.
WinFormExtensionMethods.BindToolStripItemProxyProperties(namedElements, _viewModel, _bindingManager);
_isBindingSet = true;
}
#endregion
}
} | using System;
using System.Collections.Generic;
#if WISEJ
using Wisej.Web;
#else
using System.Windows.Forms;
#endif
using MvvmFx.CaliburnMicro;
using MvvmFx.Windows.Data;
namespace MasterDetailWithModel
{
public partial class MainForm : Form, IHaveDataContext
{
private readonly BindingManager _bindingManager = new BindingManager();
private bool _isBindingSet;
public MainForm()
{
InitializeComponent();
}
#region IHaveDataContext implementation
public event EventHandler<DataContextChangedEventArgs> DataContextChanged = delegate { };
private MainFormViewModel _viewModel;
public object DataContext
{
get { return _viewModel; }
set
{
if (value != _viewModel)
{
_viewModel = value as MainFormViewModel;
DataContextChanged(this, new DataContextChangedEventArgs());
}
}
}
#endregion
#region Bind menu items
public void BindMenuItems(List<Control> namedElements)
{
if (_isBindingSet)
return;
// Binds the control visible and enabled properties.
WinFormExtensionMethods.BindToolStripItemProxyProperties(namedElements, _viewModel, _bindingManager);
_isBindingSet = true;
}
#endregion
}
} | mit | C# |
2e0f64afd277d5f1ad97b512b5778f53ffbf9b18 | Remove an extra comment | Auxes/Dogey | Dogey/Modules/InspectModule.cs | Dogey/Modules/InspectModule.cs | using Discord;
using Discord.Commands;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Dogey.Modules
{
public class InspectModule : ModuleBase
{
public string Inspect<T>(T obj, string property = null)
{
var type = obj.GetType();
var info = type.GetTypeInfo();
var properties = type.GetProperties();
if (property != null)
return properties.FirstOrDefault(x => x.Name.ToLower() == property)?.GetValue(obj).ToString();
var builder = new StringBuilder();
builder.AppendLine($"{info.Name} ({info.Namespace})");
foreach(var p in properties)
{
builder.AppendLine($"{p.Name}: {p.GetValue(obj) ?? "null"}");
}
return $"```crystal\n{builder.ToString()}```";
}
[Command("inspect")]
public async Task Inspect(IChannel channel, string property = null)
{
var result = Inspect<IChannel>(channel, property);
await ReplyAsync(result);
}
[Command("inspect")]
public async Task Inspect(IRole role, string property = null)
{
var result = Inspect<IRole>(role, property);
await ReplyAsync(result);
}
[Command("inspect")]
public async Task Inspect(IUser user, string property = null)
{
var result = Inspect<IUser>(user, property);
await ReplyAsync(result);
}
[Command("inspect")]
public async Task Inspect(IMessage message, string property = null)
{
var result = Inspect<IMessage>(message, property);
await ReplyAsync(result);
}
}
}
| using Discord;
using Discord.Commands;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Dogey.Modules
{
public class InspectModule : ModuleBase
{
public string Inspect<T>(T obj, string property = null)
{
var type = obj.GetType();
var info = type.GetTypeInfo();
var properties = type.GetProperties()/*.OrderBy(x => x.PropertyType)*/;
if (property != null)
return properties.FirstOrDefault(x => x.Name.ToLower() == property)?.GetValue(obj).ToString();
var builder = new StringBuilder();
builder.AppendLine($"{info.Name} ({info.Namespace})");
foreach(var p in properties)
{
builder.AppendLine($"{p.Name}: {p.GetValue(obj) ?? "null"}");
}
return $"```crystal\n{builder.ToString()}```";
}
[Command("inspect")]
public async Task Inspect(IChannel channel, string property = null)
{
var result = Inspect<IChannel>(channel, property);
await ReplyAsync(result);
}
[Command("inspect")]
public async Task Inspect(IRole role, string property = null)
{
var result = Inspect<IRole>(role, property);
await ReplyAsync(result);
}
[Command("inspect")]
public async Task Inspect(IUser user, string property = null)
{
var result = Inspect<IUser>(user, property);
await ReplyAsync(result);
}
[Command("inspect")]
public async Task Inspect(IMessage message, string property = null)
{
var result = Inspect<IMessage>(message, property);
await ReplyAsync(result);
}
}
}
| apache-2.0 | C# |
7a71e1014ae4ef6b0bc4b9b9d3ee1a5e6d7a27eb | add a test wrt mutability of Hash property | milleniumbug/Taxonomy | Tests/Program.cs | Tests/Program.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Common;
using NUnit.Framework;
using TaxonomyLib;
namespace Tests
{
[TestFixture]
class ATest
{
private string projectDirectory;
private Taxonomy taxonomy;
[OneTimeSetUp]
public void OneTimeSetUp()
{
string executablePath = new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath;
projectDirectory = new FileInfo(executablePath).Directory.Parent.Parent.FullName;
Directory.SetCurrentDirectory(projectDirectory);
}
[SetUp]
public void SetUp()
{
taxonomy = Taxonomy.CreateNew(@"testdata\test.sql");
}
[TearDown]
public void TearDown()
{
taxonomy.Dispose();
}
[Test]
public void T()
{
var firstFile = taxonomy.GetFile(@"testdata\emptyfile.txt");
var sameFile = taxonomy.GetFile(@"testdata\emptyfile.txt");
Assert.AreSame(firstFile, sameFile);
var secondFile = taxonomy.GetFile(@"testdata\😂non😂bmp😂name😂\Audio.png");
var thirdFile =
taxonomy.GetFile(@"testdata\zażółć gęślą jaźń\samecontent2.txt");
var rodzaj = new Namespace("rodzaj");
var firstTag = taxonomy.AddTag(rodzaj, new TagName("film"));
var secondTag = taxonomy.AddTag(rodzaj, new TagName("ŚmieszneObrazki"));
firstFile.Tags.Add(firstTag);
thirdFile.Tags.Add(firstTag);
secondFile.Tags.Add(secondTag);
CollectionAssert.AreEquivalent(new[] {firstFile, thirdFile}, taxonomy.LookupFilesByTags(new[] {firstTag}).ToList());
CollectionAssert.AreEqual(new[] { rodzaj }, taxonomy.AllNamespaces().ToList());
CollectionAssert.AreEquivalent(new[] { firstTag, secondTag }, taxonomy.TagsInNamespace(rodzaj).ToList());
}
[Test]
public void RollingWindowTestWindowLongerThanList()
{
var t = Enumerable.Repeat(0, 50).Select((_, index) => index).ToList();
var actual = t.SplitToChunks(100).ToList();
Assert.AreEqual(1, actual.Count);
CollectionAssert.AreEqual(t, actual.First().ToList());
}
[Test]
public void HashesAreImmutable()
{
var firstFile = taxonomy.GetFile(@"testdata\emptyfile.txt");
var hash = firstFile.Hash;
var original = (byte[])hash.Clone();
hash[0] = 12;
var actual = firstFile.Hash;
CollectionAssert.AreEqual(original, actual);
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Common;
using NUnit.Framework;
using TaxonomyLib;
namespace Tests
{
[TestFixture]
class ATest
{
private string projectDirectory;
private Taxonomy taxonomy;
[OneTimeSetUp]
public void OneTimeSetUp()
{
string executablePath = new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath;
projectDirectory = new FileInfo(executablePath).Directory.Parent.Parent.FullName;
Directory.SetCurrentDirectory(projectDirectory);
}
[SetUp]
public void SetUp()
{
taxonomy = Taxonomy.CreateNew(@"testdata\test.sql");
}
[TearDown]
public void TearDown()
{
taxonomy.Dispose();
}
[Test]
public void T()
{
var firstFile = taxonomy.GetFile(@"testdata\emptyfile.txt");
var sameFile = taxonomy.GetFile(@"testdata\emptyfile.txt");
Assert.AreSame(firstFile, sameFile);
var secondFile = taxonomy.GetFile(@"testdata\😂non😂bmp😂name😂\Audio.png");
var thirdFile =
taxonomy.GetFile(@"testdata\zażółć gęślą jaźń\samecontent2.txt");
var rodzaj = new Namespace("rodzaj");
var firstTag = taxonomy.AddTag(rodzaj, new TagName("film"));
var secondTag = taxonomy.AddTag(rodzaj, new TagName("ŚmieszneObrazki"));
firstFile.Tags.Add(firstTag);
thirdFile.Tags.Add(firstTag);
secondFile.Tags.Add(secondTag);
CollectionAssert.AreEquivalent(new[] {firstFile, thirdFile}, taxonomy.LookupFilesByTags(new[] {firstTag}).ToList());
CollectionAssert.AreEqual(new[] { rodzaj }, taxonomy.AllNamespaces().ToList());
CollectionAssert.AreEquivalent(new[] { firstTag, secondTag }, taxonomy.TagsInNamespace(rodzaj).ToList());
}
[Test]
public void RollingWindowTestWindowLongerThanList()
{
var t = Enumerable.Repeat(0, 50).Select((_, index) => index).ToList();
var actual = t.SplitToChunks(100).ToList();
Assert.AreEqual(1, actual.Count);
CollectionAssert.AreEqual(t, actual.First().ToList());
}
}
}
| mit | C# |
d6454174cb03cf71edb2e327355b212088bd8dec | increase version no | gigya/microdot | SolutionVersion.cs | SolutionVersion.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.InteropServices;
[assembly: AssemblyCompany("Gigya Inc.")]
[assembly: AssemblyCopyright("© 2018 Gigya Inc.")]
[assembly: AssemblyDescription("Microdot Framework")]
[assembly: AssemblyVersion("1.13.2.0")]
[assembly: AssemblyFileVersion("1.13.2.0")]
[assembly: AssemblyInformationalVersion("1.13.2.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.
[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.InteropServices;
[assembly: AssemblyCompany("Gigya Inc.")]
[assembly: AssemblyCopyright("© 2018 Gigya Inc.")]
[assembly: AssemblyDescription("Microdot Framework")]
[assembly: AssemblyVersion("1.13.1.0")]
[assembly: AssemblyFileVersion("1.13.1.0")]
[assembly: AssemblyInformationalVersion("1.13.1.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.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
| apache-2.0 | C# |
62381bc4388c531d76b34fa119f96469ef757fc6 | Modify for rotation test ;-) | Vytek/HazelTestUDPClientUnity | Assets/Scripts/NetworkCube.cs | Assets/Scripts/NetworkCube.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NetworkCube : MonoBehaviour {
//The ID of the client that owns this player (so we can check if it's us updating)
public ushort objectID;
public bool DEBUG = true;
Vector3 lastPosition = Vector3.zero;
Vector3 nextPosition = Vector3.zero;
Quaternion lastRotation = Quaternion.identity;
Quaternion nextRotation = Quaternion.identity;
Vector3 lastScale;
// Use this for initialization
void Start () {
NetworkManager.OnReceiveMessageFromGameObjectUpdate += NetworkManager_OnReceiveMessageFromGameObjectUpdate;
//Initialize
lastPosition = transform.position;
lastRotation = transform.rotation;
}
public IEnumerator ThisWillBeExecutedOnTheMainThread()
{
Debug.Log("This is executed from the main thread");
//transform.position = new Vector3(newMessage.GameObjectPos.x, newMessage.GameObjectPos.y, newMessage.GameObjectPos.z);
lastPosition = nextPosition;
transform.position = nextPosition;
lastRotation = nextRotation;
transform.rotation = nextRotation;
//Add rotation
yield return null;
}
void NetworkManager_OnReceiveMessageFromGameObjectUpdate (NetworkManager.ReceiveMessageFromGameObject newMessage)
{
Debug.Log ("Raise event in GameObject");
Debug.Log (newMessage.MessageType);
Debug.Log (newMessage.GameObjectID);
Debug.Log (newMessage.GameObjectPos);
Debug.Log (newMessage.GameObjectRot);
//Update pos and rot
if (newMessage.GameObjectID == objectID)
{
nextPosition = new Vector3(newMessage.GameObjectPos.x, newMessage.GameObjectPos.y, newMessage.GameObjectPos.z);
nextRotation = new Quaternion(newMessage.GameObjectRot.x, newMessage.GameObjectPos.y, newMessage.GameObjectRot.z, newMessage.GameObjectRot.w);
UnityMainThreadDispatcher.Instance().Enqueue(ThisWillBeExecutedOnTheMainThread());
}
}
// Update is called once per frame
void Update () {
if ((Vector3.Distance(transform.position, lastPosition) > 0.05) || (Quaternion.Angle(transform.rotation, lastRotation) > 0.3))
{
NetworkManager.instance.SendMessage(NetworkManager.SendType.SENDTOOTHER, NetworkManager.PacketId.OBJECT_MOVE, this.objectID, transform.position, transform.rotation);
//Update stuff
lastPosition = transform.position;
lastRotation = transform.rotation;
}
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NetworkCube : MonoBehaviour {
//The ID of the client that owns this player (so we can check if it's us updating)
public ushort objectID;
public bool DEBUG = true;
Vector3 lastPosition = Vector3.zero;
Vector3 nextPosition = Vector3.zero;
Quaternion lastRotation = Quaternion.identity;
Quaternion nextRotation = Quaternion.identity;
Vector3 lastScale;
// Use this for initialization
void Start () {
NetworkManager.OnReceiveMessageFromGameObjectUpdate += NetworkManager_OnReceiveMessageFromGameObjectUpdate;
//Initialize
lastPosition = transform.position;
lastRotation = transform.rotation;
}
public IEnumerator ThisWillBeExecutedOnTheMainThread()
{
Debug.Log("This is executed from the main thread");
//transform.position = new Vector3(newMessage.GameObjectPos.x, newMessage.GameObjectPos.y, newMessage.GameObjectPos.z);
lastPosition = nextPosition;
transform.position = nextPosition;
//Add rotation
yield return null;
}
void NetworkManager_OnReceiveMessageFromGameObjectUpdate (NetworkManager.ReceiveMessageFromGameObject newMessage)
{
Debug.Log ("Raise event in GameObject");
Debug.Log (newMessage.MessageType);
Debug.Log (newMessage.GameObjectID);
Debug.Log (newMessage.GameObjectPos);
Debug.Log (newMessage.GameObjectRot);
//Update pos and rot
if (newMessage.GameObjectID == objectID)
{
nextPosition = new Vector3(newMessage.GameObjectPos.x, newMessage.GameObjectPos.y, newMessage.GameObjectPos.z);
UnityMainThreadDispatcher.Instance().Enqueue(ThisWillBeExecutedOnTheMainThread());
}
}
// Update is called once per frame
void Update () {
if ((Vector3.Distance(transform.position, lastPosition) > 0.05) || (Quaternion.Angle(transform.rotation, lastRotation) > 0.3))
{
NetworkManager.instance.SendMessage(NetworkManager.SendType.SENDTOOTHER, NetworkManager.PacketId.OBJECT_MOVE, this.objectID, transform.position, transform.rotation);
//Update stuff
lastPosition = transform.position;
lastRotation = transform.rotation;
}
}
}
| mit | C# |
884f99bb96c136b25dca3931aaba239d3c9ff628 | implement Game | generateui/YouTown | YouTown/IGame.cs | YouTown/IGame.cs | using System.Collections.Generic;
namespace YouTown
{
public interface IGame
{
IBoard Board { get; }
IGameOptions Options { get; }
IList<Chat> Chats { get; }
IActionQueue Queue { get; }
IBank Bank { get; }
IPlayerList Players { get; }
IIdentifier Identifier { get; }
IGamePhase GamePhase { get; }
DetermineFirstPlayer DetermineFirstPlayer { get; }
SetupGamePhase SetupGamePhase { get; }
PlaceInitialPieces PlaceInitialPieces { get; }
PlayTurns PlayTurns { get; }
EndOfGame EndOfGame { get; }
void MoveToNextPhase();
}
public interface IGameOptions
{
int VictoryPointsToWin { get; set; }
}
public class GameOptions : IGameOptions
{
public int VictoryPointsToWin { get; set; }
}
public class Game : IGame
{
private readonly List<IGamePhase> _gamePhases;
public Game(IBoard board, IBank bank, IPlayerList players)
{
Board = board;
Bank = bank;
Players = players;
GamePhase = DetermineFirstPlayer;
_gamePhases = new List<IGamePhase>
{
DetermineFirstPlayer,
SetupGamePhase,
PlaceInitialPieces,
PlayTurns,
EndOfGame
};
}
public IBoard Board { get; }
public IBank Bank { get; }
public IPlayerList Players { get; }
public IGameOptions Options { get; } = new GameOptions();
public IList<Chat> Chats { get; } = new List<Chat>();
public IActionQueue Queue { get; } = new ActionQueue();
public IIdentifier Identifier { get; } = new Identifier();
public IGamePhase GamePhase { get; private set; }
public DetermineFirstPlayer DetermineFirstPlayer { get; } = new DetermineFirstPlayer();
public SetupGamePhase SetupGamePhase { get; } = new SetupGamePhase();
public PlaceInitialPieces PlaceInitialPieces { get; } = new PlaceInitialPieces();
public PlayTurns PlayTurns { get; } = new PlayTurns();
public EndOfGame EndOfGame { get; } = new EndOfGame();
public void MoveToNextPhase()
{
var index = _gamePhases.IndexOf(GamePhase);
if (index - 1 >= _gamePhases.Count)
{
return;
}
var newIndex = index + 1;
GamePhase.End(this);
GamePhase = _gamePhases[newIndex];
GamePhase.Start(this);
}
}
}
| using System.Collections.Generic;
namespace YouTown
{
public interface IGame
{
IBoard Board { get; }
IGameOptions Options { get; }
IList<Chat> Chats { get; }
IActionQueue Queue { get; }
IBank Bank { get; }
IPlayerList Players { get; }
IIdentifier Identifier { get; }
IGamePhase GamePhase { get; }
DetermineFirstPlayer DetermineFirstPlayer { get; }
SetupGamePhase SetupGamePhase { get; }
PlaceInitialPieces PlaceInitialPieces { get; }
PlayTurns PlayTurns { get; }
EndOfGame EndOfGame { get; }
void MoveToNextPhase();
}
public interface IGameOptions
{
int VictoryPointsToWin { get; set; }
}
}
| mit | C# |
367a4ac5d7a0e9a091ff07720ef7ed8ec9a23afd | Fix FK conflict issue for DataTypeEnum | uo-lca/CalRecycleLCA,uo-lca/CalRecycleLCA | Database/DataModel/Enum.cs | Database/DataModel/Enum.cs |
namespace LcaDataModel {
using System;
public enum DataSourceEnum {
append=1,
fragments,
scenarios
}
public enum DataTypeEnum {
Flow=1,
FlowProperty=2,
Process=3,
UnitGroup=4,
Source=5,
LCIAMethod=6,
Contact=7,
Fragment=8
}
public enum DataPathEnum
{
flows=1,
flowproperties=2,
processes=3,
unitgroups=4,
sources=5,
lciamethods=6,
contacts=7,
fragments=8
};
public enum DirectionEnum {
Input=1, Output
}
public enum FlowTypeEnum {
IntermediateFlow=1,
ElementaryFlow
}
public enum NodeTypeEnum {
Process=1, Fragment, InputOutput, Background, Cutoff
}
public enum ParamTypeEnum {
Dependency = 1,
Conservation,
Distribution,
FlowProperty,
UNUSED, // Formerly, CompositionProperty
ProcessDissipation,
NodeDissipation,
ProcessEmission,
NodeEmission,
LCIAFactor
}
public enum VisibilityEnum {
Public = 1, Private
}
}
|
namespace LcaDataModel {
using System;
public enum DataSourceEnum {
append=1,
fragments,
scenarios
}
public enum DataTypeEnum {
Flow=1,
FlowProperty=2,
Process=3,
UnitGroup=4,
Source=5,
LCIAMethod=6,
Contact=7,
Fragment=0
}
public enum DataPathEnum
{
flows=1,
flowproperties=2,
processes=3,
unitgroups=4,
sources=5,
lciamethods=6,
contacts=7,
fragments=0
};
public enum DirectionEnum {
Input=1, Output
}
public enum FlowTypeEnum {
IntermediateFlow=1,
ElementaryFlow
}
public enum NodeTypeEnum {
Process=1, Fragment, InputOutput, Background, Cutoff
}
public enum ParamTypeEnum {
Dependency = 1,
Conservation,
Distribution,
FlowProperty,
UNUSED, // Formerly, CompositionProperty
ProcessDissipation,
NodeDissipation,
ProcessEmission,
NodeEmission,
LCIAFactor
}
public enum VisibilityEnum {
Public = 1, Private
}
}
| bsd-2-clause | C# |
6d437b7c73d9d47aa8b252dbbc02cbe4c4029717 | Reset current level in ILMode | Dalet/140-speedrun-timer,Dalet/140-speedrun-timer,Dalet/140-speedrun-timer | 140-speedrun-timer/LevelObject/ResetHotkey.cs | 140-speedrun-timer/LevelObject/ResetHotkey.cs | using System.Reflection;
using UnityEngine;
namespace SpeedrunTimerMod
{
class ResetHotkey : MonoBehaviour
{
static FieldInfo isInChargeStateField;
float _resetTimer;
float _resetHits;
void OnLevelWasLoaded(int level)
{
if (!ModLoader.IsLegacyVersion)
{
if (isInChargeStateField == null)
isInChargeStateField = typeof(ColorSphere).GetField("public_isInChargeState");
isInChargeStateField.SetValue(null, false);
}
}
void Update()
{
if (Application.isLoadingLevel)
return;
if (_resetHits == 1)
_resetTimer += Time.deltaTime;
if (_resetTimer > 0.5f)
_resetHits = 0;
if (Input.GetKeyDown(KeyCode.R))
{
if (_resetHits == 0)
_resetTimer = 0;
_resetHits++;
if (_resetHits > 1 && _resetTimer < 0.5f)
{
_resetHits = 0;
SpeedrunTimer.Instance.ResetTimer();
OldSpeedrunTimer.Instance.ResetTimer();
if (!ModLoader.Settings.ILMode || Input.GetKey(KeyCode.LeftShift))
{
MirrorModeManager.mirrorModeActive = false;
MirrorModeManager.respawnFromMirror = false;
}
if (Cheats.Enabled)
{
var cheatComponent = ModLoader.LevelObject.GetComponent<Cheats>();
cheatComponent.FlashWatermarkAcrossLoad();
}
if (!ModLoader.Settings.ILMode || Input.GetKey(KeyCode.LeftShift))
Application.LoadLevel("Level_Menu");
else
Application.LoadLevel(SceneManager.GetActiveScene().name);
}
}
}
}
}
| using System.Reflection;
using UnityEngine;
namespace SpeedrunTimerMod
{
class ResetHotkey : MonoBehaviour
{
static FieldInfo isInChargeStateField;
float _resetTimer;
float _resetHits;
void OnLevelWasLoaded(int level)
{
if (!ModLoader.IsLegacyVersion)
{
if (isInChargeStateField == null)
isInChargeStateField = typeof(ColorSphere).GetField("public_isInChargeState");
isInChargeStateField.SetValue(null, false);
}
}
void Update()
{
if (Application.isLoadingLevel)
return;
if (_resetHits == 1)
_resetTimer += Time.deltaTime;
if (_resetTimer > 0.5f)
_resetHits = 0;
if (Input.GetKeyDown(KeyCode.R))
{
if (_resetHits == 0)
_resetTimer = 0;
_resetHits++;
if (_resetHits > 1 && _resetTimer < 0.5f)
{
_resetHits = 0;
SpeedrunTimer.Instance.ResetTimer();
OldSpeedrunTimer.Instance.ResetTimer();
MirrorModeManager.mirrorModeActive = false;
MirrorModeManager.respawnFromMirror = false;
if (Cheats.Enabled)
{
var cheatComponent = ModLoader.LevelObject.GetComponent<Cheats>();
cheatComponent.FlashWatermarkAcrossLoad();
}
Application.LoadLevel("Level_Menu");
}
}
}
}
}
| unlicense | C# |
5b708fb8d47d6e5bb4374b6d1144ed8e89db999b | Revert "NR Improve display of version number" | jbe2277/waf | src/NewsReader/NewsReader.Presentation/Services/AppInfoService.cs | src/NewsReader/NewsReader.Presentation/Services/AppInfoService.cs | using Waf.NewsReader.Applications.Services;
using Xamarin.Essentials;
namespace Waf.NewsReader.Presentation.Services
{
public class AppInfoService : IAppInfoService
{
public AppInfoService()
{
AppName = AppInfo.Name;
VersionString = AppInfo.VersionString;
}
public string AppName { get; }
public string VersionString { get; }
}
}
| using Waf.NewsReader.Applications.Services;
using Xamarin.Essentials;
namespace Waf.NewsReader.Presentation.Services
{
public class AppInfoService : IAppInfoService
{
public AppInfoService()
{
AppName = AppInfo.Name;
VersionString = AppInfo.VersionString + "." + AppInfo.BuildString;
}
public string AppName { get; }
public string VersionString { get; }
}
}
| mit | C# |
71862c47ef4e8b407b0576faa17a62277f39867d | allow controllers to be added using a Type rather than a Generic Type | Pondidum/Conifer,Pondidum/Conifer | Conifer/ConventionalRouter.cs | Conifer/ConventionalRouter.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Web.Http.Controllers;
namespace Conifer
{
public class ConventionalRouter : IConventionalRouter
{
private readonly List<TypedRoute> _routes;
public ConventionalRouter()
{
_routes = new List<TypedRoute>();
}
public IEnumerable<TypedRoute> Routes { get { return _routes; } }
public void AddRoutes<TController>(List<IRouteConvention> conventions) where TController : IHttpController
{
AddRoutes(typeof(TController), conventions);
}
public void AddRoutes(Type controllerType, List<IRouteConvention> conventions)
{
var httpController = typeof(IHttpController);
if (httpController.IsAssignableFrom(controllerType) == false)
{
throw new ArgumentException(
string.Format("{0} must implement {1}", controllerType.Name, httpController.Name),
"controllerType");
}
var methods = FindMethods(controllerType);
foreach (var template in methods)
{
var route = template.Build(conventions);
_routes.Add(route);
}
}
public void AddRoute<TController>(Expression<Action<TController>> expression, List<IRouteConvention> conventions)
where TController : IHttpController
{
var method = MethodBuilder.GetMethodInfo(expression).Method;
if (IsValidAction(method) == false)
{
throw new ArgumentException(expression + " is not a valid controller action", "expression");
}
var template = new TypedRouteBuilder(typeof(TController), method);
_routes.Add(template.Build(conventions));
}
private static IEnumerable<TypedRouteBuilder> FindMethods(Type controllerType)
{
return controllerType
.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public)
.Where(IsValidAction)
.Select(m => new TypedRouteBuilder(controllerType, m));
}
private static bool IsValidAction(MethodInfo method)
{
return method.IsPublic && method.IsStatic == false && method.ReturnType != typeof(void);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Web.Http.Controllers;
namespace Conifer
{
public class ConventionalRouter : IConventionalRouter
{
private readonly List<TypedRoute> _routes;
public ConventionalRouter()
{
_routes = new List<TypedRoute>();
}
public IEnumerable<TypedRoute> Routes { get { return _routes; } }
public void AddRoutes<TController>(List<IRouteConvention> conventions) where TController : IHttpController
{
var methods = FindMethods<TController>();
foreach (var template in methods)
{
var route = template.Build(conventions);
_routes.Add(route);
}
}
public void AddRoute<TController>(Expression<Action<TController>> expression, List<IRouteConvention> conventions)
where TController : IHttpController
{
var method = MethodBuilder.GetMethodInfo(expression).Method;
if (IsValidAction(method) == false)
{
throw new ArgumentException(expression + " is not a valid controller action", "expression");
}
var template = new TypedRouteBuilder(typeof (TController), method);
_routes.Add(template.Build(conventions));
}
private static List<TypedRouteBuilder> FindMethods<TController>() where TController : IHttpController
{
var type = typeof(TController);
return type
.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public)
.Where(IsValidAction)
.Select(m => new TypedRouteBuilder(type, m))
.ToList();
}
private static bool IsValidAction(MethodInfo method)
{
return method.IsPublic && method.IsStatic == false && method.ReturnType != typeof (void);
}
}
}
| lgpl-2.1 | C# |
5e0a9d2d75ee6c72733d22a985ed4193bf4b80cd | Change to use contains | SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments | src/CommitmentsV2/SFA.DAS.CommitmentsV2/Extensions/QueryableApprenticeshipsExtensions.cs | src/CommitmentsV2/SFA.DAS.CommitmentsV2/Extensions/QueryableApprenticeshipsExtensions.cs | using System.Linq;
using SFA.DAS.CommitmentsV2.Models;
namespace SFA.DAS.CommitmentsV2.Extensions
{
public static class QueryableApprenticeshipsExtensions
{
public static IQueryable<Apprenticeship> Filter(this IQueryable<Apprenticeship> apprenticeships,
ApprenticeshipSearchFilters filters)
{
if (filters == null)
{
return apprenticeships;
}
if (!string.IsNullOrEmpty(filters.EmployerName))
{
apprenticeships = apprenticeships.Where(app => app.Cohort != null && filters.EmployerName.Equals(app.Cohort.LegalEntityName));
}
if (!string.IsNullOrEmpty(filters.CourseName))
{
apprenticeships = apprenticeships.Where(app => filters.CourseName.Equals(app.CourseName));
}
if (filters.Status.HasValue)
{
var paymentStatuses = filters.Status.Value.MapToPaymentStatuses();
apprenticeships = apprenticeships.Where(app => paymentStatuses.Contains(app.PaymentStatus));
}
if (filters.StartDate.HasValue)
{
apprenticeships = apprenticeships.Where(app =>
app.StartDate.HasValue &&
filters.StartDate.Value.Month.Equals(app.StartDate.Value.Month) &&
filters.StartDate.Value.Year.Equals(app.StartDate.Value.Year));
}
if (filters.EndDate.HasValue)
{
apprenticeships = apprenticeships.Where(app =>
app.EndDate.HasValue &&
filters.EndDate.Value.Month.Equals(app.EndDate.Value.Month) &&
filters.EndDate.Value.Year.Equals(app.EndDate.Value.Year));
}
return apprenticeships;
}
}
}
| using System.Linq;
using SFA.DAS.CommitmentsV2.Models;
namespace SFA.DAS.CommitmentsV2.Extensions
{
public static class QueryableApprenticeshipsExtensions
{
public static IQueryable<Apprenticeship> Filter(this IQueryable<Apprenticeship> apprenticeships,
ApprenticeshipSearchFilters filters)
{
if (filters == null)
{
return apprenticeships;
}
if (!string.IsNullOrEmpty(filters.EmployerName))
{
apprenticeships = apprenticeships.Where(app => app.Cohort != null && filters.EmployerName.Equals(app.Cohort.LegalEntityName));
}
if (!string.IsNullOrEmpty(filters.CourseName))
{
apprenticeships = apprenticeships.Where(app => filters.CourseName.Equals(app.CourseName));
}
if (filters.Status.HasValue)
{
var paymentStatuses = filters.Status.Value.MapToPaymentStatuses();
apprenticeships = apprenticeships.Where(app => paymentStatuses.Any(s => s.Equals(app.PaymentStatus)));
}
if (filters.StartDate.HasValue)
{
apprenticeships = apprenticeships.Where(app =>
app.StartDate.HasValue &&
filters.StartDate.Value.Month.Equals(app.StartDate.Value.Month) &&
filters.StartDate.Value.Year.Equals(app.StartDate.Value.Year));
}
if (filters.EndDate.HasValue)
{
apprenticeships = apprenticeships.Where(app =>
app.EndDate.HasValue &&
filters.EndDate.Value.Month.Equals(app.EndDate.Value.Month) &&
filters.EndDate.Value.Year.Equals(app.EndDate.Value.Year));
}
return apprenticeships;
}
}
}
| mit | C# |
3a98991cddd6382b0404c5d18c9a6692fd8f7c01 | Simplify code. | cston/roslyn,swaroop-sridhar/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,panopticoncentral/roslyn,drognanar/roslyn,dpoeschl/roslyn,tannergooding/roslyn,tannergooding/roslyn,srivatsn/roslyn,zooba/roslyn,reaction1989/roslyn,DustinCampbell/roslyn,khyperia/roslyn,tvand7093/roslyn,CyrusNajmabadi/roslyn,AlekseyTs/roslyn,bartdesmet/roslyn,KirillOsenkov/roslyn,DustinCampbell/roslyn,aelij/roslyn,KevinRansom/roslyn,VSadov/roslyn,TyOverby/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,KevinH-MS/roslyn,dotnet/roslyn,MichalStrehovsky/roslyn,gafter/roslyn,CyrusNajmabadi/roslyn,heejaechang/roslyn,mavasani/roslyn,ErikSchierboom/roslyn,bbarry/roslyn,mattscheffer/roslyn,robinsedlaczek/roslyn,jamesqo/roslyn,AnthonyDGreen/roslyn,wvdd007/roslyn,khyperia/roslyn,heejaechang/roslyn,VSadov/roslyn,MattWindsor91/roslyn,swaroop-sridhar/roslyn,paulvanbrenk/roslyn,eriawan/roslyn,ErikSchierboom/roslyn,tmat/roslyn,tvand7093/roslyn,AArnott/roslyn,Giftednewt/roslyn,cston/roslyn,jcouv/roslyn,bkoelman/roslyn,CaptainHayashi/roslyn,lorcanmooney/roslyn,aelij/roslyn,OmarTawfik/roslyn,amcasey/roslyn,nguerrera/roslyn,lorcanmooney/roslyn,AmadeusW/roslyn,xasx/roslyn,pdelvo/roslyn,genlu/roslyn,sharwell/roslyn,AmadeusW/roslyn,bartdesmet/roslyn,zooba/roslyn,jmarolf/roslyn,Hosch250/roslyn,khyperia/roslyn,AArnott/roslyn,sharwell/roslyn,tvand7093/roslyn,dotnet/roslyn,orthoxerox/roslyn,xoofx/roslyn,cston/roslyn,brettfo/roslyn,MattWindsor91/roslyn,swaroop-sridhar/roslyn,jmarolf/roslyn,sharwell/roslyn,eriawan/roslyn,Giftednewt/roslyn,OmarTawfik/roslyn,mattscheffer/roslyn,yeaicc/roslyn,abock/roslyn,tannergooding/roslyn,akrisiun/roslyn,mgoertz-msft/roslyn,dpoeschl/roslyn,diryboy/roslyn,yeaicc/roslyn,wvdd007/roslyn,abock/roslyn,brettfo/roslyn,heejaechang/roslyn,tmeschter/roslyn,DustinCampbell/roslyn,eriawan/roslyn,jmarolf/roslyn,drognanar/roslyn,amcasey/roslyn,bkoelman/roslyn,ErikSchierboom/roslyn,vslsnap/roslyn,a-ctor/roslyn,kelltrick/roslyn,panopticoncentral/roslyn,KevinH-MS/roslyn,xoofx/roslyn,xoofx/roslyn,davkean/roslyn,jasonmalinowski/roslyn,paulvanbrenk/roslyn,dotnet/roslyn,tmeschter/roslyn,MattWindsor91/roslyn,agocke/roslyn,jasonmalinowski/roslyn,pdelvo/roslyn,TyOverby/roslyn,yeaicc/roslyn,pdelvo/roslyn,xasx/roslyn,dpoeschl/roslyn,CaptainHayashi/roslyn,KevinRansom/roslyn,weltkante/roslyn,MattWindsor91/roslyn,tmat/roslyn,VSadov/roslyn,panopticoncentral/roslyn,Hosch250/roslyn,mavasani/roslyn,tmat/roslyn,mgoertz-msft/roslyn,jamesqo/roslyn,robinsedlaczek/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,mattwar/roslyn,srivatsn/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,jeffanders/roslyn,jkotas/roslyn,aelij/roslyn,agocke/roslyn,KevinRansom/roslyn,Giftednewt/roslyn,brettfo/roslyn,genlu/roslyn,jkotas/roslyn,mmitche/roslyn,stephentoub/roslyn,bbarry/roslyn,genlu/roslyn,OmarTawfik/roslyn,AArnott/roslyn,srivatsn/roslyn,amcasey/roslyn,kelltrick/roslyn,akrisiun/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,TyOverby/roslyn,abock/roslyn,jcouv/roslyn,nguerrera/roslyn,weltkante/roslyn,physhi/roslyn,xasx/roslyn,stephentoub/roslyn,drognanar/roslyn,AnthonyDGreen/roslyn,CyrusNajmabadi/roslyn,zooba/roslyn,AlekseyTs/roslyn,robinsedlaczek/roslyn,MichalStrehovsky/roslyn,wvdd007/roslyn,orthoxerox/roslyn,davkean/roslyn,a-ctor/roslyn,Hosch250/roslyn,reaction1989/roslyn,diryboy/roslyn,CaptainHayashi/roslyn,AmadeusW/roslyn,MichalStrehovsky/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,jeffanders/roslyn,physhi/roslyn,vslsnap/roslyn,lorcanmooney/roslyn,reaction1989/roslyn,agocke/roslyn,bbarry/roslyn,orthoxerox/roslyn,a-ctor/roslyn,shyamnamboodiripad/roslyn,akrisiun/roslyn,AlekseyTs/roslyn,diryboy/roslyn,jcouv/roslyn,mattwar/roslyn,vslsnap/roslyn,davkean/roslyn,KevinH-MS/roslyn,KirillOsenkov/roslyn,AnthonyDGreen/roslyn,tmeschter/roslyn,mattwar/roslyn,mgoertz-msft/roslyn,mattscheffer/roslyn,jeffanders/roslyn,gafter/roslyn,mavasani/roslyn,jamesqo/roslyn,bkoelman/roslyn,jkotas/roslyn,stephentoub/roslyn,mmitche/roslyn,gafter/roslyn,kelltrick/roslyn,mmitche/roslyn,paulvanbrenk/roslyn,physhi/roslyn,nguerrera/roslyn | src/Workspaces/Core/Portable/Remote/RemoteHostClientExtensions.cs | src/Workspaces/Core/Portable/Remote/RemoteHostClientExtensions.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Remote;
namespace Microsoft.CodeAnalysis.Remote
{
internal static class RemoteHostClientExtensions
{
public static Task<RemoteHostClient.Session> CreateCodeAnalysisServiceSessionAsync(
this RemoteHostClient client, Solution solution, CancellationToken cancellationToken)
{
return CreateCodeAnalysisServiceSessionAsync(
client, solution, callbackTarget: null, cancellationToken: cancellationToken);
}
public static Task<RemoteHostClient.Session> CreateCodeAnalysisServiceSessionAsync(
this RemoteHostClient client, Solution solution, object callbackTarget, CancellationToken cancellationToken)
{
return client.CreateServiceSessionAsync(
WellKnownServiceHubServices.CodeAnalysisService, solution, callbackTarget, cancellationToken);
}
public static Task<RemoteHostClient> GetRemoteHostClientAsync(this Workspace workspace, CancellationToken cancellationToken)
{
var clientService = workspace.Services.GetService<IRemoteHostClientService>();
return clientService?.GetRemoteHostClientAsync(cancellationToken);
}
}
} | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Remote;
namespace Microsoft.CodeAnalysis.Remote
{
internal static class RemoteHostClientExtensions
{
public static Task<RemoteHostClient.Session> CreateCodeAnalysisServiceSessionAsync(
this RemoteHostClient client, Solution solution, CancellationToken cancellationToken)
{
return CreateCodeAnalysisServiceSessionAsync(
client, solution, callbackTarget: null, cancellationToken: cancellationToken);
}
public static Task<RemoteHostClient.Session> CreateCodeAnalysisServiceSessionAsync(
this RemoteHostClient client, Solution solution, object callbackTarget, CancellationToken cancellationToken)
{
return client.CreateServiceSessionAsync(
WellKnownServiceHubServices.CodeAnalysisService, solution, callbackTarget, cancellationToken);
}
public static async Task<RemoteHostClient> GetRemoteHostClientAsync(this Workspace workspace, CancellationToken cancellationToken)
{
var clientService = workspace.Services.GetService<IRemoteHostClientService>();
if (clientService == null)
{
return null;
}
return await clientService.GetRemoteHostClientAsync(cancellationToken).ConfigureAwait(false);
}
}
} | mit | C# |
fafd44dc44387d31936c9b8cac50ba20fb54f138 | Update grammar in EmptyObjectInitializerTests.cs #839 | giggio/code-cracker,code-cracker/code-cracker,code-cracker/code-cracker,jwooley/code-cracker,carloscds/code-cracker,eriawan/code-cracker,carloscds/code-cracker | test/CSharp/CodeCracker.Test/Style/EmptyObjectInitializerTests.cs | test/CSharp/CodeCracker.Test/Style/EmptyObjectInitializerTests.cs | using CodeCracker.CSharp.Style;
using Microsoft.CodeAnalysis;
using System.Threading.Tasks;
using Xunit;
namespace CodeCracker.Test.CSharp.Style
{
public class EmptyObjectInitializerTests : CodeFixVerifier<EmptyObjectInitializerAnalyzer, EmptyObjectInitializerCodeFixProvider>
{
[Fact]
public async Task EmptyObjectInitializerTriggersFix()
{
const string code = @"var a = new A {};";
var expected = new DiagnosticResult
{
Id = DiagnosticId.EmptyObjectInitializer.ToDiagnosticId(),
Message = "Remove the empty object initializer.",
Severity = DiagnosticSeverity.Warning,
Locations = new[] { new DiagnosticResultLocation("Test0.cs", 1, 15) }
};
await VerifyCSharpDiagnosticAsync(code, expected);
}
[Fact]
public async Task EmptyObjectInitializerIsRemoved()
{
const string oldCode = @"var a = new A() {};";
const string newCode = @"var a = new A();";
await VerifyCSharpFixAsync(oldCode, newCode);
}
[Fact]
public async Task EmptyObjectInitializerWithNoArgsIsRemovedAndAddsEmptyArgs()
{
const string oldCode = @"var a = new A {};";
const string newCode = @"var a = new A();";
await VerifyCSharpFixAsync(oldCode, newCode);
}
[Fact]
public async Task FilledObjectInitializerIsIgnored()
{
const string code = @"var a = new A { X = 1 };";
await VerifyCSharpHasNoDiagnosticsAsync(code);
}
[Fact]
public async Task AbsenceOfObjectInitializerIsIgnored()
{
const string code = @"var a = new A();";
await VerifyCSharpHasNoDiagnosticsAsync(code);
}
}
}
| using CodeCracker.CSharp.Style;
using Microsoft.CodeAnalysis;
using System.Threading.Tasks;
using Xunit;
namespace CodeCracker.Test.CSharp.Style
{
public class EmptyObjectInitializerTests : CodeFixVerifier<EmptyObjectInitializerAnalyzer, EmptyObjectInitializerCodeFixProvider>
{
[Fact]
public async Task EmptyObjectInitializerTriggersFix()
{
const string code = @"var a = new A {};";
var expected = new DiagnosticResult
{
Id = DiagnosticId.EmptyObjectInitializer.ToDiagnosticId(),
Message = "Remove empty object initializer.",
Severity = DiagnosticSeverity.Warning,
Locations = new[] { new DiagnosticResultLocation("Test0.cs", 1, 15) }
};
await VerifyCSharpDiagnosticAsync(code, expected);
}
[Fact]
public async Task EmptyObjectInitializerIsRemoved()
{
const string oldCode = @"var a = new A() {};";
const string newCode = @"var a = new A();";
await VerifyCSharpFixAsync(oldCode, newCode);
}
[Fact]
public async Task EmptyObjectInitializerWithNoArgsIsRemovedAndAddsEmptyArgs()
{
const string oldCode = @"var a = new A {};";
const string newCode = @"var a = new A();";
await VerifyCSharpFixAsync(oldCode, newCode);
}
[Fact]
public async Task FilledObjectInitializerIsIgnored()
{
const string code = @"var a = new A { X = 1 };";
await VerifyCSharpHasNoDiagnosticsAsync(code);
}
[Fact]
public async Task AbsenceOfObjectInitializerIsIgnored()
{
const string code = @"var a = new A();";
await VerifyCSharpHasNoDiagnosticsAsync(code);
}
}
} | apache-2.0 | C# |
1a2796818f99063494ca80b2bfffa20790d91a4c | Update AssemblyInfo to match others. | ztizzlegaming/CSGOWinBig-SteamBot,Murzyneczka/CSGOWinBig-SteamBot,ztizzlegaming/CSGOWinBig-SteamBot,Wendt9222/SteamBot-1,trervorx/SteamBot,wowzone/gamerpro,stackia/SteamBot,stackia/SteamBot,MadBender/SteamBot,Banana23/Tryout,waylaidwanderer/SteamTradeOffersBot,JackHarknes/Bot1,wqbill/SteamBot,terryhau/SteamBot,MattrAus/SteamBot,MattrAus/SteamBot,TheRod1990/SteamBot,Jessecar96/SteamBot,MadBender/SteamBot,terryhau/SteamBot,BuzzyOG/CSGOWinBig-SteamBot,avoak/SteamBot,fjch1997/SteamBot,alanfort/CSGOWinBig-SteamBot,xversial/SteamBot,novasdream/SteamBot,23RDGit/CSGOWinBig-SteamBot,icodingforfood/SteamBot,BuzzyOG/CSGOWinBig-SteamBot,JackHarknes/Bot1,Moondarker/CSGOWinBig-SteamBot,GAMELASTER/SteamBot,Murzyneczka/CSGOWinBig-SteamBot,Wendt9222/SteamBot-1,niachris/SteamBotNew,zigagrcar/SteamTradeOffersBot,Alex-Nabu/CSGOWinBig-SteamBot,TheRod1990/SteamBot,23RDGit/CSGOWinBig-SteamBot,novasdream/SteamBot,Banana23/Tryout,StormReaper/SteamBot,StormReaper/SteamBot,stigping/SteamBot,ChalkyBrush/SteamBots,Moondarker/CSGOWinBig-SteamBot,nuller1joe/SteamBot,Alex-Nabu/CSGOWinBig-SteamBot,fjch1997/SteamBot,stigping/SteamBot,avoak/SteamBot,Bottswana/SteamBot,ChalkyBrush/SteamBots,icodingforfood/SteamBot,zigagrcar/SteamTradeOffersBot,nuller1joe/SteamBot,tarun200897/SteamBot,wowzone/gamerpro,GAMELASTER/SteamBot,niachris/SteamBotNew,martingabriel/SteamBot,wqbill/SteamBot,xversial/SteamBot,martingabriel/SteamBot,BlueRaja/SteamBot,Bottswana/SteamBot,Schwehn42/SteamBot,GoeGaming/SteamBot,Schwehn42/SteamBot,JackHarknes/Bot1,darren1998s/SteambotTest,alanfort/CSGOWinBig-SteamBot,tarun200897/SteamBot,trervorx/SteamBot,GoeGaming/SteamBot | SteamTrade/AssemblyInfo.cs | SteamTrade/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("SteamTrade")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SteamTrade")]
[assembly: AssemblyCopyright("C) 2012 SteamBot Contributors")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("0.0.1.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("SteamTrade")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("cwhelchel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| mit | C# |
8800dfd766f4b803a4f2d7ceb1452d28cbcbc26a | make readonly | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | unity/EditorPlugin/ModelWithLifetime.cs | unity/EditorPlugin/ModelWithLifetime.cs | using JetBrains.DataFlow;
using JetBrains.Platform.Unity.EditorPluginModel;
namespace JetBrains.Rider.Unity.Editor
{
public class ModelWithLifetime
{
public readonly EditorPluginModel Model;
public readonly Lifetime Lifetime;
public ModelWithLifetime(EditorPluginModel model, Lifetime lifetime)
{
Model = model;
Lifetime = lifetime;
}
}
} | using JetBrains.DataFlow;
using JetBrains.Platform.Unity.EditorPluginModel;
namespace JetBrains.Rider.Unity.Editor
{
public class ModelWithLifetime
{
public EditorPluginModel Model;
public Lifetime Lifetime;
public ModelWithLifetime(EditorPluginModel model, Lifetime lifetime)
{
Model = model;
Lifetime = lifetime;
}
}
} | apache-2.0 | C# |
ce16fda7e11781d67b3fe85ad8ef9c393e803841 | update assembly info | TheAngryByrd/DataflowEx,gridsum/DataflowEx | Gridsum.DataflowEx/Properties/AssemblyInfo.cs | Gridsum.DataflowEx/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("Gridsum.DataflowEx")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Gridsum.DataflowEx")]
[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("e5fa731c-50c1-461c-b43a-406276e72135")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.9.3")]
[assembly: AssemblyFileVersion("1.0.9.3")]
[assembly: AssemblyInformationalVersion("1.0.9.3")]
| 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("Gridsum.DataflowEx")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Gridsum.DataflowEx")]
[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("e5fa731c-50c1-461c-b43a-406276e72135")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.9.2")]
[assembly: AssemblyFileVersion("1.0.9.2")]
[assembly: AssemblyInformationalVersion("1.0.9.2")]
| mit | C# |
9dc702de153daa472f63529721a18ed13b945d02 | Bump version number | Harteex/OpenPackageCreator | OpenPackageCreator/Properties/AssemblyInfo.cs | OpenPackageCreator/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("Open Package Creator")]
[assembly: AssemblyDescription("Open Package Creator is a tool to easily package an application in an OPK file, complete with a generated .desktop meta data file.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Open Package Creator")]
[assembly: AssemblyCopyright("Copyright © Harteex 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e64f34e4-a915-4c69-8ce2-320e1190941f")]
// 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.2.0")]
[assembly: AssemblyFileVersion("1.1.2.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("Open Package Creator")]
[assembly: AssemblyDescription("Open Package Creator is a tool to easily package an application in an OPK file, complete with a generated .desktop meta data file.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Open Package Creator")]
[assembly: AssemblyCopyright("Copyright © Harteex 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("e64f34e4-a915-4c69-8ce2-320e1190941f")]
// 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.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
| mit | C# |
90404ae0f36b0c28776c5a5e86188c7f3f67ad63 | Add additional test case for package versions | TheBerkin/Rant | Rant.Tests/PackageVersions.cs | Rant.Tests/PackageVersions.cs | using NUnit.Framework;
using Rant.Resources;
namespace Rant.Tests
{
[TestFixture]
public class PackageVersions
{
[TestCase("1.2.5", "1.2.4", true)]
[TestCase("0.2.5", "0.2.4", true)]
[TestCase("0.0.3", "0.0.4", false)]
[TestCase("0.3.1", "0.4.0", false)]
public void VersionGreaterThan(string v1, string v2, bool expactedResult)
{
Assert.IsTrue(RantPackageVersion.Parse(v1) > RantPackageVersion.Parse(v2) == expactedResult, $"Expected {expactedResult}");
}
[TestCase("2.2.1", "2.2.4", true)]
[TestCase("3.2.1", "2.1.4", false)]
[TestCase("0.2.3", "0.2.4", true)]
[TestCase("1.3.0", "0.5.4", false)]
public void VersionLessThan(string v1, string v2, bool expectedResult)
{
Assert.IsTrue(RantPackageVersion.Parse(v1) < RantPackageVersion.Parse(v2) == expectedResult, $"Expected {expectedResult}");
}
}
} | using NUnit.Framework;
using Rant.Resources;
namespace Rant.Tests
{
[TestFixture]
public class PackageVersions
{
[TestCase("1.2.5", "1.2.4", true)]
[TestCase("0.2.5", "0.2.4", true)]
[TestCase("0.0.3", "0.0.4", false)]
[TestCase("0.3.1", "0.4.0", false)]
public void VersionGreaterThan(string v1, string v2, bool expactedResult)
{
Assert.IsTrue(RantPackageVersion.Parse(v1) > RantPackageVersion.Parse(v2) == expactedResult, $"Expected {expactedResult}");
}
[TestCase("2.2.1", "2.2.4", true)]
[TestCase("0.2.3", "0.2.4", true)]
[TestCase("1.3.0", "0.5.4", false)]
public void VersionLessThan(string v1, string v2, bool expectedResult)
{
Assert.IsTrue(RantPackageVersion.Parse(v1) < RantPackageVersion.Parse(v2) == expectedResult, $"Expected {expectedResult}");
}
}
} | mit | C# |
f32c3e507da0e04421095b6e472744c177a20a49 | FIX logger variable in PS scripts | tfsaggregator/tfsaggregator-webhooks,tfsaggregator/tfsaggregator | Aggregator.Core/Script/PsScriptEngine.cs | Aggregator.Core/Script/PsScriptEngine.cs | using System.Collections.Generic;
using System.Management.Automation.Runspaces;
using Aggregator.Core.Interfaces;
using Aggregator.Core.Monitoring;
namespace Aggregator.Core
{
/// <summary>
/// Invokes Powershell scripting engine
/// </summary>
public class PsScriptEngine : ScriptEngine
{
private readonly Dictionary<string, string> scripts = new Dictionary<string, string>();
public PsScriptEngine(IWorkItemRepository store, ILogEvents logger, bool debug)
: base(store, logger, debug)
{
}
public override bool Load(string scriptName, string script)
{
this.scripts.Add(scriptName, script);
return true;
}
public override bool LoadCompleted()
{
return true;
}
public override void Run(string scriptName, IWorkItem workItem)
{
string script = this.scripts[scriptName];
var config = RunspaceConfiguration.Create();
using (var runspace = RunspaceFactory.CreateRunspace(config))
{
runspace.Open();
runspace.SessionStateProxy.SetVariable("self", workItem);
runspace.SessionStateProxy.SetVariable("store", this.Store);
runspace.SessionStateProxy.SetVariable("logger", this.Logger);
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(script);
// execute
var results = pipeline.Invoke();
this.Logger.ResultsFromScriptRun(scriptName, results);
}
}
}
}
| using System.Collections.Generic;
using System.Management.Automation.Runspaces;
using Aggregator.Core.Interfaces;
using Aggregator.Core.Monitoring;
namespace Aggregator.Core
{
/// <summary>
/// Invokes Powershell scripting engine
/// </summary>
public class PsScriptEngine : ScriptEngine
{
private readonly Dictionary<string, string> scripts = new Dictionary<string, string>();
public PsScriptEngine(IWorkItemRepository store, ILogEvents logger, bool debug)
: base(store, logger, debug)
{
}
public override bool Load(string scriptName, string script)
{
this.scripts.Add(scriptName, script);
return true;
}
public override bool LoadCompleted()
{
return true;
}
public override void Run(string scriptName, IWorkItem workItem)
{
string script = this.scripts[scriptName];
var config = RunspaceConfiguration.Create();
using (var runspace = RunspaceFactory.CreateRunspace(config))
{
runspace.Open();
runspace.SessionStateProxy.SetVariable("self", workItem);
runspace.SessionStateProxy.SetVariable("store", this.Store);
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(script);
// execute
var results = pipeline.Invoke();
this.Logger.ResultsFromScriptRun(scriptName, results);
}
}
}
}
| apache-2.0 | C# |
24fcec73d0e652e060692a3c2e032fdc4e3cf251 | Disable cancel button when matched | bunashibu/kikan | Assets/Scripts/Matching/MatchingBoard.cs | Assets/Scripts/Matching/MatchingBoard.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Hashtable = ExitGames.Client.Photon.Hashtable;
namespace Bunashibu.Kikan {
public class MatchingBoard : Photon.PunBehaviour {
void Start() {
SetApplyMode();
}
public void SetApplyMode() {
_apply.SetActive(true);
_cancel.SetActive(false);
_nameBoard.SetActive(false);
_progressLabel.SetActive(false);
_startPanel.SetActive(false);
}
public void SetMatchWaitingMode() {
_cancel.SetActive(true);
_nameBoard.SetActive(true);
_progressLabel.SetActive(true);
_apply.SetActive(false);
}
public void SetStartBattleMode() {
_startPanel.SetActive(true);
_cancel.SetActive(false);
_nameBoard.SetActive(false);
_progressLabel.SetActive(false);
}
public void UpdateNameBoard() {
var applyType = (ApplyType)PhotonNetwork.player.CustomProperties["ApplyingTicket"];
var playerList = _mediator.ApplicantList[applyType];
for (int i=0; i<playerList.Count; ++i)
_boardNameList[i].text = playerList[i].NickName;
int matchCount = _mediator.MatchCount[applyType];
for (int i=playerList.Count; i<matchCount; ++i)
_boardNameList[i].text = "";
}
public void CleanNameBoard() {
for (int i=0; i<_mediator.MatchCount[ApplyType.VS3]; ++i)
_boardNameList[i].text = "";
}
[SerializeField] private GameObject _apply;
[SerializeField] private GameObject _cancel;
[SerializeField] private GameObject _nameBoard;
[SerializeField] private GameObject _progressLabel;
[SerializeField] private GameObject _startPanel;
[SerializeField] private List<Text> _boardNameList;
[SerializeField] private MatchingMediator _mediator;
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Hashtable = ExitGames.Client.Photon.Hashtable;
namespace Bunashibu.Kikan {
public class MatchingBoard : Photon.PunBehaviour {
void Start() {
SetApplyMode();
}
public void SetApplyMode() {
_apply.SetActive(true);
_cancel.SetActive(false);
_nameBoard.SetActive(false);
_progressLabel.SetActive(false);
_startPanel.SetActive(false);
}
public void SetMatchWaitingMode() {
_cancel.SetActive(true);
_nameBoard.SetActive(true);
_progressLabel.SetActive(true);
_apply.SetActive(false);
}
public void SetStartBattleMode() {
_startPanel.SetActive(true);
_nameBoard.SetActive(false);
_progressLabel.SetActive(false);
//_logout.SetActive(false);
}
public void UpdateNameBoard() {
var applyType = (ApplyType)PhotonNetwork.player.CustomProperties["ApplyingTicket"];
var playerList = _mediator.ApplicantList[applyType];
for (int i=0; i<playerList.Count; ++i)
_boardNameList[i].text = playerList[i].NickName;
int matchCount = _mediator.MatchCount[applyType];
for (int i=playerList.Count; i<matchCount; ++i)
_boardNameList[i].text = "";
}
public void CleanNameBoard() {
for (int i=0; i<_mediator.MatchCount[ApplyType.VS3]; ++i)
_boardNameList[i].text = "";
}
[SerializeField] private GameObject _apply;
[SerializeField] private GameObject _cancel;
[SerializeField] private GameObject _nameBoard;
[SerializeField] private GameObject _progressLabel;
[SerializeField] private GameObject _startPanel;
[SerializeField] private List<Text> _boardNameList;
[SerializeField] private MatchingMediator _mediator;
}
}
| mit | C# |
67a87e09cf617f0e8c7c4916da50c610cf3cb677 | use directx11. | jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,akrisiun/Perspex,grokys/Perspex,SuperJMN/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia | src/Avalonia.OpenGL/AngleOptions.cs | src/Avalonia.OpenGL/AngleOptions.cs | using System.Collections.Generic;
namespace Avalonia.OpenGL
{
public class AngleOptions
{
public enum PlatformApi
{
DirectX9,
DirectX11
}
public List<PlatformApi> AllowedPlatformApis = new List<PlatformApi>
{
PlatformApi.DirectX11
};
}
}
| using System.Collections.Generic;
namespace Avalonia.OpenGL
{
public class AngleOptions
{
public enum PlatformApi
{
DirectX9,
DirectX11
}
public List<PlatformApi> AllowedPlatformApis = new List<PlatformApi>
{
PlatformApi.DirectX9
};
}
}
| mit | C# |
40809bfe39b1e662a38c58728e91c72ea6abd3a8 | Remove unnecessary using statement. | boumenot/Grobid.NET | test/Grobid.Test/Extensions.cs | test/Grobid.Test/Extensions.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Grobid.Test
{
public static class Extensions
{
public static Stream ToStream(this string s)
{
var bytes = Encoding.UTF8.GetBytes(s);
return new MemoryStream(bytes);
}
public static Stream ToStream(this IEnumerable<string> xs)
{
return Extensions.ToStream(String.Join(Environment.NewLine, xs.ToArray()));
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Grobid.Test
{
public static class Extensions
{
public static Stream ToStream(this string s)
{
var bytes = Encoding.UTF8.GetBytes(s);
return new MemoryStream(bytes);
}
public static Stream ToStream(this IEnumerable<string> xs)
{
return Extensions.ToStream(String.Join(Environment.NewLine, xs.ToArray()));
}
}
}
| apache-2.0 | C# |
f982719c19368508d259447c5f87779077cf863a | remove unused files | jianghaolu/azure-powershell,bgold09/azure-powershell,jianghaolu/azure-powershell,yadavbdev/azure-powershell,yadavbdev/azure-powershell,atpham256/azure-powershell,tonytang-microsoft-com/azure-powershell,ClogenyTechnologies/azure-powershell,nemanja88/azure-powershell,haocs/azure-powershell,dominiqa/azure-powershell,yantang-msft/azure-powershell,juvchan/azure-powershell,CamSoper/azure-powershell,stankovski/azure-powershell,naveedaz/azure-powershell,yantang-msft/azure-powershell,devigned/azure-powershell,rohmano/azure-powershell,zhencui/azure-powershell,shuagarw/azure-powershell,shuagarw/azure-powershell,DeepakRajendranMsft/azure-powershell,haocs/azure-powershell,dominiqa/azure-powershell,AzureRT/azure-powershell,jasper-schneider/azure-powershell,praveennet/azure-powershell,praveennet/azure-powershell,akurmi/azure-powershell,naveedaz/azure-powershell,pelagos/azure-powershell,juvchan/azure-powershell,hungmai-msft/azure-powershell,seanbamsft/azure-powershell,devigned/azure-powershell,atpham256/azure-powershell,ClogenyTechnologies/azure-powershell,naveedaz/azure-powershell,bgold09/azure-powershell,shuagarw/azure-powershell,TaraMeyer/azure-powershell,AzureAutomationTeam/azure-powershell,mayurid/azure-powershell,hovsepm/azure-powershell,ankurchoubeymsft/azure-powershell,yadavbdev/azure-powershell,ailn/azure-powershell,zaevans/azure-powershell,hovsepm/azure-powershell,tonytang-microsoft-com/azure-powershell,rhencke/azure-powershell,atpham256/azure-powershell,chef-partners/azure-powershell,SarahRogers/azure-powershell,DeepakRajendranMsft/azure-powershell,praveennet/azure-powershell,Matt-Westphal/azure-powershell,zhencui/azure-powershell,stankovski/azure-powershell,devigned/azure-powershell,ankurchoubeymsft/azure-powershell,atpham256/azure-powershell,AzureRT/azure-powershell,akurmi/azure-powershell,yantang-msft/azure-powershell,pomortaz/azure-powershell,yoavrubin/azure-powershell,jianghaolu/azure-powershell,rohmano/azure-powershell,rohmano/azure-powershell,naveedaz/azure-powershell,mayurid/azure-powershell,yantang-msft/azure-powershell,naveedaz/azure-powershell,CamSoper/azure-powershell,pelagos/azure-powershell,ailn/azure-powershell,SarahRogers/azure-powershell,krkhan/azure-powershell,ankurchoubeymsft/azure-powershell,chef-partners/azure-powershell,krkhan/azure-powershell,jianghaolu/azure-powershell,CamSoper/azure-powershell,mayurid/azure-powershell,bgold09/azure-powershell,seanbamsft/azure-powershell,stankovski/azure-powershell,pankajsn/azure-powershell,Matt-Westphal/azure-powershell,rhencke/azure-powershell,PashaPash/azure-powershell,haocs/azure-powershell,AzureRT/azure-powershell,mayurid/azure-powershell,oaastest/azure-powershell,zhencui/azure-powershell,jasper-schneider/azure-powershell,pelagos/azure-powershell,praveennet/azure-powershell,nemanja88/azure-powershell,arcadiahlyy/azure-powershell,pomortaz/azure-powershell,seanbamsft/azure-powershell,Matt-Westphal/azure-powershell,jtlibing/azure-powershell,seanbamsft/azure-powershell,rhencke/azure-powershell,yoavrubin/azure-powershell,yadavbdev/azure-powershell,ClogenyTechnologies/azure-powershell,pomortaz/azure-powershell,praveennet/azure-powershell,zaevans/azure-powershell,jasper-schneider/azure-powershell,rohmano/azure-powershell,AzureAutomationTeam/azure-powershell,dulems/azure-powershell,devigned/azure-powershell,krkhan/azure-powershell,hungmai-msft/azure-powershell,enavro/azure-powershell,dulems/azure-powershell,jtlibing/azure-powershell,jasper-schneider/azure-powershell,ClogenyTechnologies/azure-powershell,jasper-schneider/azure-powershell,juvchan/azure-powershell,zhencui/azure-powershell,hungmai-msft/azure-powershell,ailn/azure-powershell,tonytang-microsoft-com/azure-powershell,alfantp/azure-powershell,TaraMeyer/azure-powershell,shuagarw/azure-powershell,nemanja88/azure-powershell,stankovski/azure-powershell,pelagos/azure-powershell,nemanja88/azure-powershell,alfantp/azure-powershell,pankajsn/azure-powershell,jtlibing/azure-powershell,jtlibing/azure-powershell,ankurchoubeymsft/azure-powershell,akurmi/azure-powershell,alfantp/azure-powershell,devigned/azure-powershell,akurmi/azure-powershell,enavro/azure-powershell,zaevans/azure-powershell,bgold09/azure-powershell,juvchan/azure-powershell,hovsepm/azure-powershell,TaraMeyer/azure-powershell,yoavrubin/azure-powershell,krkhan/azure-powershell,oaastest/azure-powershell,oaastest/azure-powershell,enavro/azure-powershell,jianghaolu/azure-powershell,PashaPash/azure-powershell,arcadiahlyy/azure-powershell,chef-partners/azure-powershell,shuagarw/azure-powershell,dulems/azure-powershell,Matt-Westphal/azure-powershell,zhencui/azure-powershell,TaraMeyer/azure-powershell,DeepakRajendranMsft/azure-powershell,alfantp/azure-powershell,Matt-Westphal/azure-powershell,hungmai-msft/azure-powershell,dominiqa/azure-powershell,krkhan/azure-powershell,ailn/azure-powershell,dulems/azure-powershell,SarahRogers/azure-powershell,CamSoper/azure-powershell,AzureAutomationTeam/azure-powershell,pomortaz/azure-powershell,arcadiahlyy/azure-powershell,hovsepm/azure-powershell,chef-partners/azure-powershell,hungmai-msft/azure-powershell,DeepakRajendranMsft/azure-powershell,haocs/azure-powershell,devigned/azure-powershell,bgold09/azure-powershell,rohmano/azure-powershell,SarahRogers/azure-powershell,AzureRT/azure-powershell,akurmi/azure-powershell,yantang-msft/azure-powershell,yoavrubin/azure-powershell,atpham256/azure-powershell,arcadiahlyy/azure-powershell,pankajsn/azure-powershell,chef-partners/azure-powershell,zaevans/azure-powershell,tonytang-microsoft-com/azure-powershell,stankovski/azure-powershell,tonytang-microsoft-com/azure-powershell,CamSoper/azure-powershell,AzureRT/azure-powershell,AzureRT/azure-powershell,AzureAutomationTeam/azure-powershell,rhencke/azure-powershell,mayurid/azure-powershell,hovsepm/azure-powershell,pankajsn/azure-powershell,pankajsn/azure-powershell,oaastest/azure-powershell,AzureAutomationTeam/azure-powershell,pankajsn/azure-powershell,juvchan/azure-powershell,ClogenyTechnologies/azure-powershell,ailn/azure-powershell,alfantp/azure-powershell,pelagos/azure-powershell,SarahRogers/azure-powershell,seanbamsft/azure-powershell,seanbamsft/azure-powershell,nemanja88/azure-powershell,atpham256/azure-powershell,ankurchoubeymsft/azure-powershell,TaraMeyer/azure-powershell,oaastest/azure-powershell,dulems/azure-powershell,DeepakRajendranMsft/azure-powershell,yadavbdev/azure-powershell,jtlibing/azure-powershell,arcadiahlyy/azure-powershell,yantang-msft/azure-powershell,naveedaz/azure-powershell,dominiqa/azure-powershell,rhencke/azure-powershell,rohmano/azure-powershell,krkhan/azure-powershell,pomortaz/azure-powershell,enavro/azure-powershell,enavro/azure-powershell,haocs/azure-powershell,dominiqa/azure-powershell,PashaPash/azure-powershell,yoavrubin/azure-powershell,PashaPash/azure-powershell,zhencui/azure-powershell,zaevans/azure-powershell,PashaPash/azure-powershell,AzureAutomationTeam/azure-powershell,hungmai-msft/azure-powershell | src/ResourceManager/Commerce/Commands.UsageAggregates.Test/ScenarioTests/UsageAggregatesTests.cs | src/ResourceManager/Commerce/Commands.UsageAggregates.Test/ScenarioTests/UsageAggregatesTests.cs | // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Xunit;
namespace Microsoft.Azure.Commands.UsageAggregates.Test.ScenarioTests
{
public class UsageAggregatesTests
{
[Fact]
public void TestGetUsageAggregatesWithDefaultParameters()
{
UsageAggregatesTestController.NewInstance.RunPsTest("Test-GetUsageAggregatesWithDefaultParameters");
}
}
}
| // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using System;
using Microsoft.Azure.Test;
using Microsoft.Azure.Test.HttpRecorder;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
using Xunit.Sdk;
namespace Microsoft.Azure.Commands.UsageAggregates.Test.ScenarioTests
{
public class UsageAggregatesTests
{
//[Fact(Skip = "New test/project can't get the testContext to be created. Need to come back and fix it.")]
[Fact]
public void TestGetUsageAggregatesWithDefaultParameters()
{
UsageAggregatesTestController.NewInstance.RunPsTest("Test-GetUsageAggregatesWithDefaultParameters");
}
}
}
| apache-2.0 | C# |
bb7dc1b63fd4bbc2659ec6a1d9aecbf84c5c9173 | set TinySatoException as Serializable. | karronoli/tiny-sato | TinySato/TinySatoException.cs | TinySato/TinySatoException.cs | namespace TinySato
{
using System;
using System.Runtime.Serialization;
[Serializable]
public class TinySatoException : Exception
{
public TinySatoException() { }
public TinySatoException(string message)
: base(message) { }
public TinySatoException(string message, Exception inner)
: base(message, inner) { }
protected TinySatoException(SerializationInfo info, StreamingContext context)
: base(info, context) { }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TinySato
{
public class TinySatoException : Exception
{
public TinySatoException() { }
public TinySatoException(string message)
: base(message) { }
public TinySatoException(string message, Exception inner)
: base(message, inner) { }
}
}
| apache-2.0 | C# |
eed46e6c194f69611599d12aebc0c08a430692ba | Update ArrayEntity.cs | dimmpixeye/Unity3dTools | Runtime/LibMisc/ArrayEntity.cs | Runtime/LibMisc/ArrayEntity.cs | // Project : ecs
// Contacts : Pix - ask@pixeye.games
using System;
using System.Runtime.CompilerServices;
using Unity.IL2CPP.CompilerServices;
namespace Pixeye.Framework
{
[Serializable]
public struct ArrayEntity
{
public int length;
public ent[] source;
public ref ent this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => ref source[index];
}
public ArrayEntity(int size)
{
source = new ent[size];
length = 0;
}
[Il2CppSetOption(Option.NullChecks | Option.ArrayBoundsChecks, false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Add(in ent entity)
{
if (length >= source.Length)
Array.Resize(ref source, length << 1);
source[length++] = entity;
}
[Il2CppSetOption(Option.NullChecks | Option.ArrayBoundsChecks, false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Remove(in ent entity)
{
for (int i = 0; i < length; i++)
{
var val = source[i];
if (entity.Equals(val))
{
source[i] = -1;
Array.Copy(source, i + 1, source, i, length-- - i);
break;
}
}
}
[Il2CppSetOption(Option.NullChecks | Option.ArrayBoundsChecks, false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Removed(in ent entity)
{
for (int i = 0; i < length; i++)
{
ref var val = ref source[i];
if (entity.Equals(val))
{
source[i] = -1;
Array.Copy(source, i + 1, source, i, length-- - i);
return true;
}
}
return false;
}
}
} | // Project : ecs
// Contacts : Pix - ask@pixeye.games
using System;
using System.Runtime.CompilerServices;
using Unity.IL2CPP.CompilerServices;
namespace Pixeye.Framework
{
[Serializable]
public struct ArrayEntity
{
public int length;
public ent[] source;
public ref ent this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => ref source[index];
}
public ArrayEntity(int size)
{
source = new ent[size];
length = 0;
}
[Il2CppSetOption(Option.NullChecks | Option.ArrayBoundsChecks, false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Add(in ent entity)
{
if (length >= source.Length)
Array.Resize(ref source, length << 1);
source[length++] = entity;
}
[Il2CppSetOption(Option.NullChecks | Option.ArrayBoundsChecks, false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Remove(in ent entity)
{
for (int i = 0; i < length; i++)
{
var val = source[i];
if (entity.Equals(val))
{
source[i] = -1;
Array.Copy(source, i + 1, source, i, --length - i);
break;
}
}
}
[Il2CppSetOption(Option.NullChecks | Option.ArrayBoundsChecks, false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Removed(in ent entity)
{
for (int i = 0; i < length; i++)
{
ref var val = ref source[i];
if (entity.Equals(val))
{
source[i] = -1;
Array.Copy(source, i + 1, source, i, --length - i);
return true;
}
}
return false;
}
}
} | mit | C# |
3e1057dd21953502fd99deaa117c2a8cc62cc943 | Update EnumerableExtensions.cs | keith-hall/Extensions,keith-hall/Extensions | src/EnumerableExtensions.cs | src/EnumerableExtensions.cs | public static EnumerableExtensions {
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng)
{ // http://stackoverflow.com/questions/1287567/is-using-random-and-orderby-a-good-shuffle-algorithm
T[] elements = source.ToArray();
for (int i = elements.Length - 1; i >= 0; i--) {
// Swap element "i" with a random earlier element it (or itself)
// ... except we don't really need to swap it fully, as we can
// return it immediately, and afterwards it's irrelevant.
int swapIndex = rng.Next(i + 1);
yield return elements[swapIndex];
elements[swapIndex] = elements[i];
}
}
}
public static bool CountExceeds<T> (this IEnumerable<T> enumerable, int count) {
return enumerable.Take(count + 1).Count() > count;
}
}
| public static EnumerableExtensions {
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng)
{ // http://stackoverflow.com/questions/1287567/is-using-random-and-orderby-a-good-shuffle-algorithm
T[] elements = source.ToArray();
for (int i = elements.Length - 1; i >= 0; i--) {
// Swap element "i" with a random earlier element it (or itself)
// ... except we don't really need to swap it fully, as we can
// return it immediately, and afterwards it's irrelevant.
int swapIndex = rng.Next(i + 1);
yield return elements[swapIndex];
elements[swapIndex] = elements[i];
}
}
}
}
| apache-2.0 | C# |
67bf7349ed6245c34024d56d919fde02da6e617b | Make statically typed numeric generation distinct | FreecraftCore/FreecraftCore.Serializer,FreecraftCore/FreecraftCore.Serializer | src/FreecraftCore.Serializer.Compiler/Emitters/Method/RootSerializationMethodEmitter.cs | src/FreecraftCore.Serializer.Compiler/Emitters/Method/RootSerializationMethodEmitter.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace FreecraftCore.Serializer
{
public class RootSerializationMethodBlockEmitter<TSerializableType> : IMethodBlockEmittable, INestedClassesEmittable
where TSerializableType : new()
{
public BlockSyntax CreateBlock()
{
//TODO: Figure out how we should decide which strategy to use, right now only simple and flat are supported.
//TSerializableType
return new FlatComplexTypeSerializationMethodBlockEmitter<TSerializableType>()
.CreateBlock();
}
public IEnumerable<ClassDeclarationSyntax> CreateClasses()
{
SortedSet<int> alreadyCreatedSizeClasses = new SortedSet<int>();
//Find all KnownSize types and emit classes for each one
foreach (var mi in typeof(TSerializableType)
.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
{
KnownSizeAttribute sizeAttribute = mi.GetCustomAttribute<KnownSizeAttribute>();
if (sizeAttribute == null)
continue;
if (alreadyCreatedSizeClasses.Contains(sizeAttribute.KnownSize))
continue;
alreadyCreatedSizeClasses.Add(sizeAttribute.KnownSize);
//This creates a class declaration for the int static type.
yield return new StaticlyTypedIntegerGenericTypeClassEmitter<int>(sizeAttribute.KnownSize)
.Create();
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace FreecraftCore.Serializer
{
public class RootSerializationMethodBlockEmitter<TSerializableType> : IMethodBlockEmittable, INestedClassesEmittable
where TSerializableType : new()
{
public BlockSyntax CreateBlock()
{
//TODO: Figure out how we should decide which strategy to use, right now only simple and flat are supported.
//TSerializableType
return new FlatComplexTypeSerializationMethodBlockEmitter<TSerializableType>()
.CreateBlock();
}
public IEnumerable<ClassDeclarationSyntax> CreateClasses()
{
//Find all KnownSize types and emit classes for each one
foreach (var mi in typeof(TSerializableType)
.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
{
KnownSizeAttribute sizeAttribute = mi.GetCustomAttribute<KnownSizeAttribute>();
if (sizeAttribute == null)
continue;
//This creates a class declaration for the int static type.
yield return new StaticlyTypedIntegerGenericTypeClassEmitter<int>(sizeAttribute.KnownSize)
.Create();
}
}
}
}
| agpl-3.0 | C# |
2b9b8404cd83f65c00f3068ce8396c00593d5a0e | Set version to 1.1.3.0 | da2x/EdgeDeflector | EdgeDeflector/Properties/AssemblyInfo.cs | EdgeDeflector/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EdgeDeflector")]
[assembly: AssemblyDescription("Rewrites microsoft-edge URI addresses into standard http URI addresses.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EdgeDeflector")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("64e191bc-e8ce-4190-939e-c77a75aa0e28")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Maintenance Number
// Build Number
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.3.0")]
[assembly: AssemblyFileVersion("1.1.3.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EdgeDeflector")]
[assembly: AssemblyDescription("Rewrites microsoft-edge URI addresses into standard http URI addresses.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EdgeDeflector")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("64e191bc-e8ce-4190-939e-c77a75aa0e28")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Maintenance Number
// Build Number
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
| mit | C# |
d67a701208e7c10aa86f1dd2425b08a0b78cb7bf | Revert changes to MainPageViewModel in commit a79cf096d41b784c2d989bd1b2bea736cc46cf5a, breaks data binding | tjcsl/ionapp-w10,tjcsl/ionapp-w10 | Ion10/ViewModels/MainPageViewModel.cs | Ion10/ViewModels/MainPageViewModel.cs | using Template10.Mvvm;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Threading.Tasks;
using Windows.Security.Authentication.Web;
using Windows.UI.Popups;
using Template10.Services.NavigationService;
using Windows.UI.Xaml.Navigation;
using Windows.Web.Http;
using Ion10.Services;
namespace Ion10.ViewModels {
public class MainPageViewModel : ViewModelBase {
public MainPageViewModel() {
if(Windows.ApplicationModel.DesignMode.DesignModeEnabled) {
Value = "Designtime value";
}
}
string _Value = "Gas";
public string Value { get { return _Value; } set { Set(ref _Value, value); } }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> suspensionState) {
await Task.CompletedTask;
}
public override async Task OnNavigatedFromAsync(IDictionary<string, object> suspensionState, bool suspending) {
if(suspending) {
suspensionState[nameof(Value)] = Value;
}
await Task.CompletedTask;
}
public override async Task OnNavigatingFromAsync(NavigatingEventArgs args) {
args.Cancel = false;
await Task.CompletedTask;
}
public void GotoSettings() =>
NavigationService.Navigate(typeof(Views.SettingsPage), 0);
public void GotoPrivacy() =>
NavigationService.Navigate(typeof(Views.SettingsPage), 1);
public void GotoAbout() =>
NavigationService.Navigate(typeof(Views.SettingsPage), 2);
}
}
| using Template10.Mvvm;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Threading.Tasks;
using Windows.Security.Authentication.Web;
using Windows.UI.Popups;
using Template10.Services.NavigationService;
using Windows.UI.Xaml.Navigation;
using Windows.Web.Http;
using Ion10.Services;
namespace Ion10.ViewModels {
public class MainPageViewModel : ViewModelBase {
public MainPageViewModel() {
if(Windows.ApplicationModel.DesignMode.DesignModeEnabled) {
_Value = "Designtime value";
}
}
string _Value = "Gas";
public string Value { get { return _Value; } set { Set(ref _Value, value); } }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> suspensionState) {
await Task.CompletedTask;
}
public override async Task OnNavigatedFromAsync(IDictionary<string, object> suspensionState, bool suspending) {
if(suspending) {
suspensionState[nameof(Value)] = Value;
}
await Task.CompletedTask;
}
public override async Task OnNavigatingFromAsync(NavigatingEventArgs args) {
args.Cancel = false;
await Task.CompletedTask;
}
public void GotoSettings() =>
NavigationService.Navigate(typeof(Views.SettingsPage), 0);
public void GotoPrivacy() =>
NavigationService.Navigate(typeof(Views.SettingsPage), 1);
public void GotoAbout() =>
NavigationService.Navigate(typeof(Views.SettingsPage), 2);
}
}
| mit | C# |
05e322fabdea42799633e2425f351c59cf9655dc | update diagnostic demo to get the service from the registry | killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity | Assets/MixedRealityToolkit.Examples/Demos/Diagnostics/Scripts/DiagnosticsDemoControls.cs | Assets/MixedRealityToolkit.Examples/Demos/Diagnostics/Scripts/DiagnosticsDemoControls.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Diagnostics;
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
public class DiagnosticsDemoControls : MonoBehaviour
{
private IMixedRealityDiagnosticsSystem diagnosticsSystem = null;
private IMixedRealityDiagnosticsSystem DiagnosticsSystem
{
get
{
if (diagnosticsSystem == null)
{
MixedRealityServiceRegistry.TryGetService<IMixedRealityDiagnosticsSystem>(out diagnosticsSystem);
}
return diagnosticsSystem;
}
}
private async void Start()
{
await new WaitUntil(() => DiagnosticsSystem != null);
// Ensure the diagnostic visualizations are turned on.
DiagnosticsSystem.ShowDiagnostics = true;
}
/// <summary>
/// Shows or hides all enabled diagnostics.
/// </summary>
public void OnToggleDiagnostics()
{
DiagnosticsSystem.ShowDiagnostics = !DiagnosticsSystem.ShowDiagnostics;
}
/// <summary>
/// Shows or hides the profiler display.
/// </summary>
public void OnToggleProfiler()
{
DiagnosticsSystem.ShowProfiler = !DiagnosticsSystem.ShowProfiler;
}
}
}
| // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
public class DiagnosticsDemoControls : MonoBehaviour
{
private async void Start()
{
if (!MixedRealityToolkit.Instance.ActiveProfile.IsDiagnosticsSystemEnabled)
{
Debug.LogWarning("Diagnostics system is disabled. To run this demo, it needs to be enabled. Check your configuration settings.");
return;
}
await new WaitUntil(() => MixedRealityToolkit.DiagnosticsSystem != null);
// Turn on the diagnostic visualizations for this demo.
MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = true;
}
/// <summary>
/// Shows or hides all enabled diagnostics.
/// </summary>
public void OnToggleDiagnostics()
{
MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = !MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics;
}
/// <summary>
/// Shows or hides the profiler display.
/// </summary>
public void OnToggleProfiler()
{
MixedRealityToolkit.DiagnosticsSystem.ShowProfiler = !MixedRealityToolkit.DiagnosticsSystem.ShowProfiler;
}
}
}
| mit | C# |
6103c386e64e2fb4029197075cdfa6ec0674b25e | Update SamplePacket.cs | cfairchi/MulticastUDP | packets/SamplePacket.cs | packets/SamplePacket.cs | namespace MulticastUDP.packets {
public class SamplePacket : Packet {
public double DoubleValue {get;set;}
public string StringValue {get;set;}
public DateTime DateTimeValue {get;set}
public override PACKETTYPE PacketType {get { return PACKETTYPE.SAMPLE; }}
public SamplePacket() : base() {}
public SamplePacket(bool isHeartBeat) : base(isHeartBeat) {}
public SamplePacket(byte[] theBytes) : base(theBytes){}
public SamplePackdet(SamplePacket thePacket) : base(thePacket) {
DoubleValue = thePacket.DoubleValue;
StringValue = thePacket.StringValue;
DateTimeValue = thePacket.DateTimeValue;
}
protected override void setDefaultValues() {
DoubleValue = 0;
StringValue = "Sample"
DateTimeValue = DateTime.Now();
}
}
}
| namespace MulticastUDP.packets {
public class SamplePacket : Packet {
public double DoubleValue {get;set;}
public string StringValue {get;set;}
public DateTime DateTimeValue {get;set}
public override PACKETTYPE PacketType {get { return PACKETTYPE.SAMPLE; }}
public SamplePacket() : base() {}
public SamplePacket(bool isHeartBeat) : base(isHeartBeat) {}
public SamplePacket(byte[] theBytes) : base(theBytes){}
public SamplePackdet(SamplePacket thePacket) : base(thePacket) {
DoubleValue
}
}
}
| mit | C# |
44f5f3c2456971f755a9ac9c85d5078b00099e94 | Add missing } | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/LukeMurray.cs | src/Firehose.Web/Authors/LukeMurray.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 LukeMurray : IAmACommunityMember
{
public string FirstName => "Luke";
public string LastName => "Murray";
public string ShortBioOrTagLine => "An IT Engineer with a love for all things IT including (but not limited to), Microsoft Azure, Automation and Service Management!";
public string StateOrRegion => "Waikato, New Zealand";
public string EmailAddress => "email@luke.geek.nz";
public string TwitterHandle => "lukemurraynz";
public string GitHubHandle => "lukemurraynz";
public string GravatarHash => "8ffb014d63a93e99033fca127fd14640";
public GeoPosition Position => new GeoPosition(-37.45579900000001, 175.18940450000002);
public Uri WebSite => new Uri("https://luke.geek.nz");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://luke.geek.nz/feed.category.powershell.xml"); } }
}
}
| 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 LukeMurray : IAmACommunityMember
{
public string FirstName => "Luke";
public string LastName => "Murray";
public string ShortBioOrTagLine => "An IT Engineer with a love for all things IT including (but not limited to), Microsoft Azure, Automation and Service Management!";
public string StateOrRegion => "Waikato, New Zealand";
public string EmailAddress => "email@luke.geek.nz";
public string TwitterHandle => "lukemurraynz";
public string GitHubHandle => "lukemurraynz";
public string GravatarHash => "8ffb014d63a93e99033fca127fd14640";
public GeoPosition Position => new GeoPosition(-37.45579900000001, 175.18940450000002);
public Uri WebSite => new Uri("https://luke.geek.nz");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://luke.geek.nz/feed.category.powershell.xml"); } }
}
| mit | C# |
928b9a45cfc2beaac320cdc688d75a5fbe7995ef | Update MattMcNabb.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/MattMcNabb.cs | src/Firehose.Web/Authors/MattMcNabb.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 MattMcNabb : IAmACommunityMember
{
public string FirstName => "Matt";
public string LastName => "McNabb";
public string ShortBioOrTagLine => "Systems Engineer and PowerShell enthusiast; erratic blogger";
public string StateOrRegion => "Ohio";
public string EmailAddress => "mmcnabb@outlook.com";
public string TwitterHandle => "mcnabbmh";
public string GitHubHandle => "mattmcnabb";
public GeoPosition Position => new GeoPosition(39.403986, -84.406761);
public Uri WebSite => new Uri("https://mattmcnabb.github.io");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://mattmcnabb.github.io/feed.xml"); } }
public string GravatarHash => "719f5e885b7641673038f02b79923f1a";
public string FeedLanguageCode => "en";
}
}
| 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 MattMcNabb : IAmACommunityMember
{
public string FirstName => "Matt";
public string LastName => "McNabb";
public string ShortBioOrTagLine => "Systems Engineer and PowerShell enthusiast; erratic blogger";
public string StateOrRegion => "Ohio";
public string EmailAddress => "mmcnabb@outlook.com";
public string TwitterHandle => "mcnabbmh";
public string GitHubHandle => "mattmcnabb";
public GeoPosition Position => new GeoPosition(39.403986, -84.406761);
public Uri WebSite => new Uri("https://mattmcnabb.github.io");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://mattmcnabb.github.io/feed.xml"); } }
public string GravatarHash => "";
public string FeedLanguageCode => "en";
}
}
| mit | C# |
9107232ca795c6bfd58de2f69cbdfed7974ce0ec | Use Many<> instead of IReadOnlyList<> for new events | bwatts/Totem,bwatts/Totem | src/Totem/Runtime/Timeline/FlowCall.cs | src/Totem/Runtime/Timeline/FlowCall.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading;
using Totem.Runtime.Map;
using Totem.Runtime.Map.Timeline;
namespace Totem.Runtime.Timeline
{
/// <summary>
/// A call to a Before or When method of a <see cref="Flow"/>
/// </summary>
public class FlowCall : Notion
{
public FlowCall(
FlowType flowType,
IDependencySource dependencies,
Event e,
EventType eventType,
TimelinePosition cause,
ClaimsPrincipal principal,
CancellationToken cancellationToken)
{
FlowType = flowType;
Dependencies = dependencies;
Event = e;
EventType = eventType;
Cause = cause;
Principal = principal;
CancellationToken = cancellationToken;
NewEvents = new Many<Event>();
}
public readonly FlowType FlowType;
public readonly IDependencySource Dependencies;
public readonly Event Event;
public readonly EventType EventType;
public readonly TimelinePosition Cause;
public readonly ClaimsPrincipal Principal;
public readonly CancellationToken CancellationToken;
public readonly Many<Event> NewEvents;
public bool IsDone { get; private set; }
public void Publish(Flow flow, Event e)
{
Flow.Traits.ForwardRequestId(Event, e);
NewEvents.Write.Add(e);
}
public void Publish(Flow flow, IEnumerable<Event> events)
{
foreach(var e in events)
{
Publish(flow, e);
}
}
public void Publish(Flow flow, params Event[] events)
{
Publish(flow, events as IEnumerable<Event>);
}
public void OnDone()
{
Expect(IsDone).IsFalse("Flow is already done");
IsDone = true;
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading;
using Totem.Runtime.Map;
using Totem.Runtime.Map.Timeline;
namespace Totem.Runtime.Timeline
{
/// <summary>
/// A call to a Before or When method of a <see cref="Flow"/>
/// </summary>
public class FlowCall : Notion
{
private readonly List<Event> _newEvents = new List<Event>();
public FlowCall(
FlowType flowType,
IDependencySource dependencies,
Event e,
EventType eventType,
TimelinePosition cause,
ClaimsPrincipal principal,
CancellationToken cancellationToken)
{
FlowType = flowType;
Dependencies = dependencies;
Event = e;
EventType = eventType;
Cause = cause;
Principal = principal;
CancellationToken = cancellationToken;
}
public readonly FlowType FlowType;
public readonly IDependencySource Dependencies;
public readonly Event Event;
public readonly EventType EventType;
public readonly TimelinePosition Cause;
public readonly ClaimsPrincipal Principal;
public readonly CancellationToken CancellationToken;
public IReadOnlyList<Event> NewEvents { get { return _newEvents; } }
public bool IsDone { get; private set; }
public void Publish(Flow flow, Event e)
{
Flow.Traits.ForwardRequestId(Event, e);
_newEvents.Add(e);
}
public void Publish(Flow flow, IEnumerable<Event> events)
{
foreach(var e in events)
{
Publish(flow, e);
}
}
public void Publish(Flow flow, params Event[] events)
{
Publish(flow, events as IEnumerable<Event>);
}
public void OnDone()
{
Expect(IsDone).IsFalse("Flow is already done");
IsDone = true;
}
}
} | mit | C# |
4c5fa8590ccd9bde80c8f8aa5ebc73b0522e9f67 | Switch to incremental versioning | jcmoyer/Yeena | Yeena/Properties/AssemblyInfo.cs | Yeena/Properties/AssemblyInfo.cs | // Copyright 2013 J.C. Moyer
//
// 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;
// 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("Yeena")]
[assembly: AssemblyDescription("A stash evaluator for Path of Exile")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("J.C. Moyer")]
[assembly: AssemblyProduct("Yeena")]
[assembly: AssemblyCopyright("Copyright © J.C. Moyer 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("837f71cc-14ed-47d5-b80e-9cb0876a1f69")]
// 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.*")]
//[assembly: AssemblyFileVersion("0.1.*.")]
| // Copyright 2013 J.C. Moyer
//
// 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;
// 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("Yeena")]
[assembly: AssemblyDescription("A stash evaluator for Path of Exile")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("J.C. Moyer")]
[assembly: AssemblyProduct("Yeena")]
[assembly: AssemblyCopyright("Copyright © J.C. Moyer 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("837f71cc-14ed-47d5-b80e-9cb0876a1f69")]
// 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")]
| apache-2.0 | C# |
86f221bb606c034235ef66edc302abdb60c80a68 | Use generic implementation | ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework | osu.Framework/Input/KeyEventManager.cs | osu.Framework/Input/KeyEventManager.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osuTK.Input;
namespace osu.Framework.Input
{
/// <summary>
/// Manages state events for a single key.
/// </summary>
public class KeyEventManager : ButtonEventManager<Key>
{
public KeyEventManager(Key key)
: base(key)
{
}
public void HandleRepeat(InputState state) => PropagateButtonEvent(ButtonDownInputQueue, new KeyDownEvent(state, Button, true));
protected override Drawable HandleButtonDown(InputState state, List<Drawable> targets) => PropagateButtonEvent(targets, new KeyDownEvent(state, Button));
protected override void HandleButtonUp(InputState state, List<Drawable> targets)
{
if (targets == null)
return;
PropagateButtonEvent(targets, new KeyUpEvent(state, Button));
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osuTK.Input;
namespace osu.Framework.Input
{
/// <summary>
/// Manages state events for a single key.
/// </summary>
public class KeyEventManager : ButtonEventManager
{
/// <summary>
/// The key this manager manages.
/// </summary>
public readonly Key Key;
public KeyEventManager(Key key)
{
Key = key;
}
public void HandleRepeat(InputState state) => PropagateButtonEvent(ButtonDownInputQueue, new KeyDownEvent(state, Key, true));
protected override Drawable HandleButtonDown(InputState state, List<Drawable> targets) => PropagateButtonEvent(targets, new KeyDownEvent(state, Key));
protected override void HandleButtonUp(InputState state, List<Drawable> targets)
{
if (targets == null)
return;
PropagateButtonEvent(targets, new KeyUpEvent(state, Key));
}
}
}
| mit | C# |
cf59ed120878be5e9c0c029c6d0305ac24c187a9 | Change force emulation IE10 to IE11 Изменена принудительная эмуляция IE10 на IE11 | KriBetko/KryBot | KryBot/KryBot/Program.cs | KryBot/KryBot/Program.cs | using System;
using System.IO;
using System.Windows.Forms;
using Microsoft.Win32;
namespace KryBot
{
internal static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
private static void Main()
{
Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION");
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
string programName = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
key?.SetValue(programName, (decimal)11000, RegistryValueKind.DWord);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
} | using System;
using System.IO;
using System.Windows.Forms;
using Microsoft.Win32;
namespace KryBot
{
internal static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
private static void Main()
{
Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION");
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
string programName = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
key?.SetValue(programName, 10001, RegistryValueKind.DWord);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
} | apache-2.0 | C# |
c990516f0c6063c2d92e3ed372cf46bdfc6cfcf9 | Revert "Added new property" | ravi-msi/practicegit,ravi-msi/practicegit,ravi-msi/practicegit | PracticeGit/PracticeGit/AddNewFile.cs | PracticeGit/PracticeGit/AddNewFile.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PracticeGit
{
class AddNewFile
{
public int MyProperty { get; set; }
public string Commit1 { get; set; }
public string Commit2 { get; set; }
public int Commit4 { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PracticeGit
{
class AddNewFile
{
public int MyProperty { get; set; }
public string Commit1 { get; set; }
public string Commit2 { get; set; }
public int Commit4 { get; set; }
public string NewProperty { get; set; }
}
}
| mit | C# |
86dde596b8b4c84f55b1e203db11344f585a3058 | Update Error.cshtml.cs | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Pages/Error.cshtml.cs | src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Pages/Error.cshtml.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace Company.WebApplication1.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel
{
private readonly ILogger<ErrorModel> logger;
public ErrorModel(ILogger<ErrorModel> _logger)
{
logger = _logger;
}
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Company.WebApplication1.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel
{
private readonly ILogger<ErrorModel> logger;
public ErrorModel(ILogger<ErrorModel> _logger)
{
logger = _logger;
}
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
| apache-2.0 | C# |
1f4cf62c8ba5f80bec59fa968d1fa04ccaf676d6 | add log | algolia/algoliasearch-client-csharp | Algolia.Search.Test/BaseTest.cs | Algolia.Search.Test/BaseTest.cs | using System;
using System.Collections.Generic;
namespace Algolia.Search.Test
{
public class BaseTest
{
public static string _testApplicationID = "";
public static string _testApiKey = "";
public AlgoliaClient _client;
public Index _index;
public IndexHelper<TestModel> _indexHelper;
public BaseTest()
{
_testApiKey = Environment.GetEnvironmentVariable("ALGOLIA_API_KEY");
_testApplicationID = Environment.GetEnvironmentVariable("ALGOLIA_APPLICATION_ID");
_client = new AlgoliaClient(_testApplicationID, _testApiKey);
_index = _client.InitIndex(GetSafeName("algolia-csharp"));
_indexHelper = new IndexHelper<TestModel>(_client, GetSafeName("algolia-csharp"));
}
public static string GetSafeName(string name)
{
if (Environment.GetEnvironmentVariable("APPVEYOR") == null)
{
return name;
}
//String[] id = Environment.GetEnvironmentVariable("TRAVIS_JOB_NUMBER").Split('.');
Console.WriteLine(name + "appveyor-" + Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER"));
return name + "appveyor-" + Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER");
}
public void ClearTest()
{
try
{
_index.ClearIndex();
}
catch (Exception)
{
// Index not found
}
}
public void TestCleanup()
{
_client.DeleteIndex(GetSafeName("algolia-csharp"));
_client = null;
}
public TestModel BuildTestModel()
{
return new TestModel() { Id = 5, TestModelId = 10, FirstName = "Scott", LastName = "Smith" };
}
public List<TestModel> BuildTestModelList()
{
var list = new List<TestModel>();
list.Add(new TestModel() { Id = 1, TestModelId = 5, FirstName = "Nicolas", LastName = "Dessaigne" });
list.Add(new TestModel() { Id = 2, TestModelId = 6, FirstName = "Julien", LastName = "Lemoine" });
list.Add(new TestModel() { Id = 3, TestModelId = 7, FirstName = "Kevin", LastName = "Granger" });
list.Add(new TestModel() { Id = 4, TestModelId = 8, FirstName = "Sylvain", LastName = "Utard" });
return list;
}
public List<TestModel> BuildTestModelList(int count)
{
var list = new List<TestModel>();
for (int i = 6; i < count + 6; i++)
{
list.Add(new TestModel() { Id = i, TestModelId = i + count, FirstName = "FirstName" + i, LastName = "LastName" + i });
}
return list;
}
}
public class TestModel
{
public int Id { get; set; }
public int TestModelId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
| using System;
using System.Collections.Generic;
namespace Algolia.Search.Test
{
public class BaseTest
{
public static string _testApplicationID = "";
public static string _testApiKey = "";
public AlgoliaClient _client;
public Index _index;
public IndexHelper<TestModel> _indexHelper;
public BaseTest()
{
_testApiKey = Environment.GetEnvironmentVariable("ALGOLIA_API_KEY");
_testApplicationID = Environment.GetEnvironmentVariable("ALGOLIA_APPLICATION_ID");
_client = new AlgoliaClient(_testApplicationID, _testApiKey);
_index = _client.InitIndex(GetSafeName("algolia-csharp"));
_indexHelper = new IndexHelper<TestModel>(_client, GetSafeName("algolia-csharp"));
}
public static string GetSafeName(string name)
{
if (Environment.GetEnvironmentVariable("APPVEYOR") == null)
{
return name;
}
//String[] id = Environment.GetEnvironmentVariable("TRAVIS_JOB_NUMBER").Split('.');
return name + "appveyor-" + Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER");
}
public void ClearTest()
{
try
{
_index.ClearIndex();
}
catch (Exception)
{
// Index not found
}
}
public void TestCleanup()
{
_client.DeleteIndex(GetSafeName("algolia-csharp"));
_client = null;
}
public TestModel BuildTestModel()
{
return new TestModel() { Id = 5, TestModelId = 10, FirstName = "Scott", LastName = "Smith" };
}
public List<TestModel> BuildTestModelList()
{
var list = new List<TestModel>();
list.Add(new TestModel() { Id = 1, TestModelId = 5, FirstName = "Nicolas", LastName = "Dessaigne" });
list.Add(new TestModel() { Id = 2, TestModelId = 6, FirstName = "Julien", LastName = "Lemoine" });
list.Add(new TestModel() { Id = 3, TestModelId = 7, FirstName = "Kevin", LastName = "Granger" });
list.Add(new TestModel() { Id = 4, TestModelId = 8, FirstName = "Sylvain", LastName = "Utard" });
return list;
}
public List<TestModel> BuildTestModelList(int count)
{
var list = new List<TestModel>();
for (int i = 6; i < count + 6; i++)
{
list.Add(new TestModel() { Id = i, TestModelId = i + count, FirstName = "FirstName" + i, LastName = "LastName" + i });
}
return list;
}
}
public class TestModel
{
public int Id { get; set; }
public int TestModelId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
| mit | C# |
77f4735f1698e40236846fe5ac53533ed002f240 | fix RIDER-44139 (#1657) | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-unity/src/Rider/UnitTesting/UnityUnitTestProjectArtifactResolverCollaborator.cs | resharper/resharper-unity/src/Rider/UnitTesting/UnityUnitTestProjectArtifactResolverCollaborator.cs | using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Unity.ProjectModel;
using JetBrains.ReSharper.UnitTestFramework.Exploration;
using JetBrains.Util;
using JetBrains.Util.Dotnet.TargetFrameworkIds;
namespace JetBrains.ReSharper.Plugins.Unity.Rider.UnitTesting
{
[SolutionComponent]
public class UnityUnitTestProjectArtifactResolverCollaborator : IUnitTestProjectArtifactResolverCollaborator
{
private readonly UnitySolutionTracker myUnitySolutionTracker;
public UnityUnitTestProjectArtifactResolverCollaborator(UnitySolutionTracker unitySolutionTracker)
{
myUnitySolutionTracker = unitySolutionTracker;
}
public bool CanResolveArtifact(IProject project, TargetFrameworkId targetFrameworkId)
{
return myUnitySolutionTracker.IsUnityGeneratedProject.Maybe.Value;
}
public FileSystemPath ResolveArtifact(IProject project, TargetFrameworkId targetFrameworkId)
{
var dllName = project.GetOutputFilePath(targetFrameworkId).Name;
return project.Location.Combine("Library").Combine("ScriptAssemblies").Combine(dllName);
}
}
} | using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Unity.ProjectModel;
using JetBrains.ReSharper.UnitTestFramework.Exploration;
using JetBrains.Util;
using JetBrains.Util.Dotnet.TargetFrameworkIds;
namespace JetBrains.ReSharper.Plugins.Unity.Rider.UnitTesting
{
[SolutionComponent]
public class UnityUnitTestProjectArtifactResolverCollaborator : IUnitTestProjectArtifactResolverCollaborator
{
private readonly UnitySolutionTracker myUnitySolutionTracker;
public UnityUnitTestProjectArtifactResolverCollaborator(UnitySolutionTracker unitySolutionTracker)
{
myUnitySolutionTracker = unitySolutionTracker;
}
public bool CanResolveArtifact(IProject project, TargetFrameworkId targetFrameworkId)
{
return myUnitySolutionTracker.IsUnityProject.Maybe.Value;
}
public FileSystemPath ResolveArtifact(IProject project, TargetFrameworkId targetFrameworkId)
{
var dllName = project.GetOutputFilePath(targetFrameworkId).Name;
return project.Location.Combine("Library").Combine("ScriptAssemblies").Combine(dllName);
}
}
} | apache-2.0 | C# |
a9997a243cabbda90d7dfa7ca7e5f57393f7fda7 | Update to Cake.Issues.Recipe 0.4.0 | cake-contrib/Cake.Recipe,cake-contrib/Cake.Recipe | Cake.Recipe/Content/addins.cake | Cake.Recipe/Content/addins.cake | ///////////////////////////////////////////////////////////////////////////////
// ADDINS
///////////////////////////////////////////////////////////////////////////////
#addin nuget:?package=Cake.Codecov&version=0.9.1
#addin nuget:?package=Cake.Coveralls&version=0.10.2
#addin nuget:?package=Cake.Coverlet&version=2.4.2
#addin nuget:?package=Portable.BouncyCastle&version=1.8.5
#addin nuget:?package=MimeKit&version=2.9.1
#addin nuget:?package=MailKit&version=2.8.0
#addin nuget:?package=MimeTypesMap&version=1.0.8
#addin nuget:?package=Cake.Email.Common&version=0.4.2
#addin nuget:?package=Cake.Email&version=0.10.0
#addin nuget:?package=Cake.Figlet&version=1.3.1
#addin nuget:?package=Cake.Gitter&version=0.11.1
#addin nuget:?package=Cake.Incubator&version=5.1.0
#addin nuget:?package=Cake.Kudu&version=0.10.1
#addin nuget:?package=Cake.MicrosoftTeams&version=0.9.0
#addin nuget:?package=Cake.Slack&version=0.13.0
#addin nuget:?package=Cake.Transifex&version=0.9.0
#addin nuget:?package=Cake.Twitter&version=0.10.1
#addin nuget:?package=Cake.Wyam&version=2.2.9
#load nuget:?package=Cake.Issues.Recipe&version=0.4.0
Action<string, IDictionary<string, string>> RequireAddin = (code, envVars) => {
var script = MakeAbsolute(File(string.Format("./{0}.cake", Guid.NewGuid())));
try
{
System.IO.File.WriteAllText(script.FullPath, code);
var arguments = new Dictionary<string, string>();
if (BuildParameters.CakeConfiguration.GetValue("NuGet_UseInProcessClient") != null) {
arguments.Add("nuget_useinprocessclient", BuildParameters.CakeConfiguration.GetValue("NuGet_UseInProcessClient"));
}
if (BuildParameters.CakeConfiguration.GetValue("Settings_SkipVerification") != null) {
arguments.Add("settings_skipverification", BuildParameters.CakeConfiguration.GetValue("Settings_SkipVerification"));
}
CakeExecuteScript(script,
new CakeSettings
{
EnvironmentVariables = envVars,
Arguments = arguments
});
}
finally
{
if (FileExists(script))
{
DeleteFile(script);
}
}
};
| ///////////////////////////////////////////////////////////////////////////////
// ADDINS
///////////////////////////////////////////////////////////////////////////////
#addin nuget:?package=Cake.Codecov&version=0.9.1
#addin nuget:?package=Cake.Coveralls&version=0.10.2
#addin nuget:?package=Cake.Coverlet&version=2.4.2
#addin nuget:?package=Portable.BouncyCastle&version=1.8.5
#addin nuget:?package=MimeKit&version=2.9.1
#addin nuget:?package=MailKit&version=2.8.0
#addin nuget:?package=MimeTypesMap&version=1.0.8
#addin nuget:?package=Cake.Email.Common&version=0.4.2
#addin nuget:?package=Cake.Email&version=0.10.0
#addin nuget:?package=Cake.Figlet&version=1.3.1
#addin nuget:?package=Cake.Gitter&version=0.11.1
#addin nuget:?package=Cake.Incubator&version=5.1.0
#addin nuget:?package=Cake.Kudu&version=0.10.1
#addin nuget:?package=Cake.MicrosoftTeams&version=0.9.0
#addin nuget:?package=Cake.Slack&version=0.13.0
#addin nuget:?package=Cake.Transifex&version=0.9.0
#addin nuget:?package=Cake.Twitter&version=0.10.1
#addin nuget:?package=Cake.Wyam&version=2.2.9
#load nuget:?package=Cake.Issues.Recipe&version=0.4.0-beta0001&prerelease
Action<string, IDictionary<string, string>> RequireAddin = (code, envVars) => {
var script = MakeAbsolute(File(string.Format("./{0}.cake", Guid.NewGuid())));
try
{
System.IO.File.WriteAllText(script.FullPath, code);
var arguments = new Dictionary<string, string>();
if (BuildParameters.CakeConfiguration.GetValue("NuGet_UseInProcessClient") != null) {
arguments.Add("nuget_useinprocessclient", BuildParameters.CakeConfiguration.GetValue("NuGet_UseInProcessClient"));
}
if (BuildParameters.CakeConfiguration.GetValue("Settings_SkipVerification") != null) {
arguments.Add("settings_skipverification", BuildParameters.CakeConfiguration.GetValue("Settings_SkipVerification"));
}
CakeExecuteScript(script,
new CakeSettings
{
EnvironmentVariables = envVars,
Arguments = arguments
});
}
finally
{
if (FileExists(script))
{
DeleteFile(script);
}
}
};
| mit | C# |
6425bc5f44234bc238a0c3753bcaf1bcd697266b | Make MinValue and MaxValue from BindableDouble public | ppy/osu-framework,EVAST9919/osu-framework,naoey/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,default0/osu-framework,paparony03/osu-framework,ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,Nabile-Rahmani/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,default0/osu-framework,peppy/osu-framework,RedNesto/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,paparony03/osu-framework,naoey/osu-framework | osu.Framework/Configuration/BindableDouble.cs | osu.Framework/Configuration/BindableDouble.cs | // Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Globalization;
using OpenTK;
namespace osu.Framework.Configuration
{
public class BindableDouble : Bindable<double>
{
public override bool IsDefault => Math.Abs(Value - Default) < Precision;
public double Precision = double.Epsilon;
public override double Value
{
get { return base.Value; }
set
{
double boundValue = MathHelper.Clamp(value, MinValue, MaxValue);
if (Precision > double.Epsilon)
boundValue = Math.Round(boundValue / Precision) * Precision;
base.Value = boundValue;
}
}
public double MinValue { get; set; } = double.MinValue;
public double MaxValue { get; set; } = double.MaxValue;
public BindableDouble(double value = 0)
: base(value)
{
}
public static implicit operator double(BindableDouble value) => value?.Value ?? 0;
public override string ToString() => Value.ToString("0.0###", NumberFormatInfo.InvariantInfo);
public override bool Parse(object s)
{
string str = s as string;
if (str == null) return false;
Value = double.Parse(str, NumberFormatInfo.InvariantInfo);
return true;
}
}
}
| // Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Globalization;
using OpenTK;
namespace osu.Framework.Configuration
{
public class BindableDouble : Bindable<double>
{
public override bool IsDefault => Math.Abs(Value - Default) < Precision;
public double Precision = double.Epsilon;
public override double Value
{
get { return base.Value; }
set
{
double boundValue = MathHelper.Clamp(value, MinValue, MaxValue);
if (Precision > double.Epsilon)
boundValue = Math.Round(boundValue / Precision) * Precision;
base.Value = boundValue;
}
}
internal double MinValue = double.MinValue;
internal double MaxValue = double.MaxValue;
public BindableDouble(double value = 0)
: base(value)
{
}
public static implicit operator double(BindableDouble value) => value?.Value ?? 0;
public override string ToString() => Value.ToString("0.0###", NumberFormatInfo.InvariantInfo);
public override bool Parse(object s)
{
string str = s as string;
if (str == null) return false;
Value = double.Parse(str, NumberFormatInfo.InvariantInfo);
return true;
}
}
}
| mit | C# |
082000e21f6c32ef61c5380c3e874cb686edd593 | Add to the details page too | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Analysis/Details.cshtml | Anlab.Mvc/Views/Analysis/Details.cshtml | @model AnlabMvc.Models.Analysis.AnalysisMethodViewModel
@{
ViewBag.Title = @Model.AnalysisMethod.Title;
}
<div class="col-md-8">
<h2>@Model.AnalysisMethod.Id</h2>
<h5>@Model.AnalysisMethod.Title</h5>
@Html.Raw(Model.HtmlContent)
</div>
<div class="col-md-4">
<ul>
@foreach (var method in Model.AnalysesInCategory)
{
<li><a class="internal-link" target="_self" asp-controller="Analysis" asp-action="Details" asp-route-category="@Model.AnalysisMethod.Category" asp-route-id="@method.Id">@method.Id - @method.Title</a></li>
}
</ul>
</div>
| @model AnlabMvc.Models.Analysis.AnalysisMethodViewModel
@{
ViewBag.Title = @Model.AnalysisMethod.Title;
}
<div class="col-md-8">
<h2>@Model.AnalysisMethod.Id</h2>
<h5>@Model.AnalysisMethod.Title</h5>
@Html.Raw(Model.HtmlContent)
</div>
<div class="col-md-4">
<ul>
@foreach (var method in Model.AnalysesInCategory)
{
<li><a class="internal-link" target="_self" asp-controller="Analysis" asp-action="Details" asp-route-category="@Model.AnalysisMethod.Category" asp-route-id="@method.Id">@method.Title</a></li>
}
</ul>
</div>
| mit | C# |
3cb31a5bfca1288bf7a88d330d77ee5fab09a07a | Indent with 4 spaces | msarchet/Bundler,msarchet/Bundler | BundlerMiddleware/IBundleResolver.cs | BundlerMiddleware/IBundleResolver.cs | namespace BundlerMiddleware
{
/// <summary>
/// Used for creating BundlerResolvers for injecting tags into the response
/// </summary>
public interface IBundlerResolver
{
/// <summary>
/// Get the HTML to be inserted into response
/// </summary>
/// <param name="bundleName">The name of the bundle</param>
/// <returns>An HTML string containing the Style Tags</returns>
string GetStyleTags(string bundleName);
/// <summary>
/// Get the HTML to be inserted into response
/// </summary>
/// <param name="bundleName">The name of the bundle</param>
/// <returns>An HTML string containing the Script Tags</returns>
string GetScriptTags(string bundleName);
}
}
| namespace BundlerMiddleware
{
/// <summary>
/// Used for creating BundlerResolvers for injecting tags into the response
/// </summary>
public interface IBundlerResolver
{
/// <summary>
/// Get the HTML to be inserted into response
/// </summary>
/// <param name="bundleName">The name of the bundle</param>
/// <returns>An HTML string containing the Style Tags</returns>
string GetStyleTags(string bundleName);
/// <summary>
/// Get the HTML to be inserted into response
/// </summary>
/// <param name="bundleName">The name of the bundle</param>
/// <returns>An HTML string containing the Script Tags</returns>
string GetScriptTags(string bundleName);
}
} | mit | C# |
b9863c7ee9f1a05f6196068d7d076102b577d3f8 | Update App.xaml.cs | wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D | src/Draw2D/App.xaml.cs | src/Draw2D/App.xaml.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 Avalonia;
using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
using Draw2D.Editor;
using Draw2D.Views;
namespace Draw2D
{
public class App : Application
{
[STAThread]
static void Main(string[] args)
{
BuildAvaloniaApp().Start(AppMain, args);
}
static void AppMain(Application app, string[] args)
{
var window = new MainWindow
{
DataContext = new ContainerEditor(),
};
app.Run(window);
}
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new Win32PlatformOptions { AllowEglInitialization = true })
.With(new X11PlatformOptions { UseGpu = true, UseEGL = false })
.With(new AvaloniaNativePlatformOptions { UseGpu = true })
.UseSkia()
.LogToDebug();
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| // 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 Avalonia;
using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
using Draw2D.Editor;
using Draw2D.Views;
namespace Draw2D
{
public class App : Application
{
[STAThread]
static void Main(string[] args)
{
BuildAvaloniaApp().Start(AppMain, args);
}
static void AppMain(Application app, string[] args)
{
var window = new MainWindow
{
DataContext = new ContainerEditor(),
};
app.Run(window);
}
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new Win32PlatformOptions { AllowEglInitialization = false })
.With(new X11PlatformOptions { UseGpu = true, UseEGL = false })
.With(new AvaloniaNativePlatformOptions { UseGpu = true })
.UseSkia()
.LogToDebug();
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| mit | C# |
dafef2f256959ced350b1630cdd81ca93f172a49 | Remove usings. | grantcolley/authorisationmanager,grantcolley/authorisationmanager,grantcolley/authorisationmanager,grantcolley/authorisationmanager | Service/WebAPI/App_Start/WebApiConfig.cs | Service/WebAPI/App_Start/WebApiConfig.cs | using System.Web.Http;
namespace DevelopmentInProgress.AuthorisationManager.WebAPI
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace DevelopmentInProgress.AuthorisationManager.WebAPI
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
}
}
}
| apache-2.0 | C# |
caeab53a2dd80997b797727b660bff0fc2def188 | Use correct property during ConvertValue | larsbrubaker/MatterControl,mmoening/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,jlewin/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl,jlewin/MatterControl | SlicerConfiguration/UIFields/IntField.cs | SlicerConfiguration/UIFields/IntField.cs | /*
Copyright (c) 2017, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
namespace MatterHackers.MatterControl.SlicerConfiguration
{
public class IntField : NumberField
{
private int intValue;
protected override string ConvertValue(string newValue)
{
decimal.TryParse(newValue, out decimal currentValue);
intValue = (int)currentValue;
return intValue.ToString();
}
protected override void OnValueChanged(FieldChangedEventArgs fieldChangedEventArgs)
{
numberEdit.ActuallNumberEdit.Value = intValue;
base.OnValueChanged(fieldChangedEventArgs);
}
}
}
| /*
Copyright (c) 2017, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
namespace MatterHackers.MatterControl.SlicerConfiguration
{
public class IntField : NumberField
{
private int intValue;
protected override string ConvertValue(string newValue)
{
decimal.TryParse(this.Value, out decimal currentValue);
intValue = (int)currentValue;
return intValue.ToString();
}
protected override void OnValueChanged(FieldChangedEventArgs fieldChangedEventArgs)
{
numberEdit.ActuallNumberEdit.Value = intValue;
base.OnValueChanged(fieldChangedEventArgs);
}
}
}
| bsd-2-clause | C# |
5cb3f9c2d592041b80cb2787826f07fa47260695 | Use `DistinctUntilChanged` when capturing undoable state | Weingartner/SolidworksAddinFramework | SolidworksAddinFramework/ReactiveUndo.cs | SolidworksAddinFramework/ReactiveUndo.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using ReactiveUI;
namespace SolidworksAddinFramework
{
/// <summary>
/// An undo stack for PropertyManagerPages. The
/// target object is monitored for change notifications
/// amd JSON copies are written to a stack. Undo
/// writes older versions back to the target object.
///
/// This class is IDisposable because it set's up a
/// change notification listener on the target
/// </summary>
/// <typeparam name="T"></typeparam>
public class ReactiveUndo<T> : ReactiveObject, IDisposable
where T : ReactiveObject
{
private readonly T _Target;
private readonly Stack<T> _UndoStack = new Stack<T>();
private readonly IDisposable _Disposable;
private bool _Undoing;
public ReactiveUndo(T target)
{
_Target = target;
Do();
_Disposable = _Target.Changed
.DistinctUntilChanged()
.Subscribe(_ =>
{
if(!_Undoing) Do();
});
}
private void Do()
{
if (_UndoStack.Count > 0 && Equals(_UndoStack.Peek(), _Target))
return;
_UndoStack.Push(Json.Clone(_Target));
UpdateCanUndo();
}
private bool _CanUndo;
public bool CanUndo
{
get { return _CanUndo; }
private set { this.RaiseAndSetIfChanged(ref _CanUndo, value); }
}
public void Undo()
{
if (!CanUndo)
{
return;
}
_UndoStack.Pop();
var json = _UndoStack.Peek();
_Undoing = true;
using (Disposable.Create(() => _Undoing = false))
{
Json.Copy(json, _Target);
}
UpdateCanUndo();
}
private void UpdateCanUndo()
{
CanUndo = _UndoStack.Count > 1;
}
public void Dispose()
{
_Disposable.Dispose();
}
}
} | using System;
using System.Collections.Generic;
using ReactiveUI;
namespace SolidworksAddinFramework
{
/// <summary>
/// An undo stack for PropertyManagerPages. The
/// target object is monitored for change notifications
/// amd JSON copies are written to a stack. Undo
/// writes older versions back to the target object.
///
/// This class is IDisposable because it set's up a
/// change notification listener on the target
/// </summary>
/// <typeparam name="T"></typeparam>
public class ReactiveUndo<T> : ReactiveObject, IDisposable
where T : ReactiveObject
{
public T Clone { get; }
private readonly Stack<string> _UndoStack = new Stack<string>();
private readonly IDisposable _Disposable;
private bool _Undoing;
public ReactiveUndo(T target)
{
Clone = target;
Do();
_Disposable = target.Changed.Subscribe(_ =>
{
if(!_Undoing) Do();
});
}
private void Do()
{
_UndoStack.Push(Clone.ToJson());
UpdateCanUndo();
}
bool _CanUndo;
public bool CanUndo
{
get { return _CanUndo; }
set { this.RaiseAndSetIfChanged(ref _CanUndo, value); }
}
public void Undo()
{
if (!CanUndo)
{
return;
}
_UndoStack.Pop();
var json = _UndoStack.Peek();
_Undoing = true;
Json.Copy(json, Clone);
_Undoing = false;
UpdateCanUndo();
}
private void UpdateCanUndo()
{
CanUndo = _UndoStack.Count > 1;
}
public void Dispose()
{
_Disposable.Dispose();
}
}
} | mit | C# |
dc9bb22a23603d5daf014d5e0db5302c3319fc92 | Update spacing in ScriptExecuter | jrusbatch/compilify,appharbor/ConsolR,vendettamit/compilify,appharbor/ConsolR,vendettamit/compilify,jrusbatch/compilify | Compilify/Services/ScriptExecuter.cs | Compilify/Services/ScriptExecuter.cs | using System;
using System.Collections.Generic;
using Roslyn.Compilers.CSharp;
using Roslyn.Scripting;
using Roslyn.Scripting.CSharp;
namespace Compilify.Services
{
public class ScriptExecuter : MarshalByRefObject
{
static readonly ScriptExecuter Host = new ScriptExecuter();
public string Execute(string code)
{
var engine = new ScriptEngine(new [] { "System" });
var session = Session.Create(Host);
engine.Execute("using System;", session);
try
{
if (!Validate(code))
{
return "Not implemeted";
}
var result = engine.Execute(code, session);
if(result != null)
{
return result.ToString();
}
}
catch (Exception ex)
{
return ex.ToString();
}
return null;
}
public bool Validate(string code)
{
var syntax = Syntax.ParseStatement(code);
return ScanSyntax(syntax.ChildNodes());
}
public bool ScanSyntax(IEnumerable<SyntaxNode> syntaxNodes)
{
foreach (var syntaxNode in syntaxNodes)
{
if (syntaxNode.HasChildren)
{
if (!ScanSyntax(syntaxNode.ChildNodes())) return false;
}
Console.WriteLine(syntaxNode.GetType());
if (syntaxNode is QualifiedNameSyntax || syntaxNode is InvocationExpressionSyntax && ((InvocationExpressionSyntax)syntaxNode).Expression is MemberAccessExpressionSyntax)
{
return false;
}
}
return true;
}
}
} | using System;
using System.Collections.Generic;
using Roslyn.Compilers.CSharp;
using Roslyn.Scripting;
using Roslyn.Scripting.CSharp;
namespace Compilify.Services
{
public class ScriptExecuter : MarshalByRefObject
{
static readonly ScriptExecuter Host = new ScriptExecuter();
public string Execute(string code)
{
var engine = new ScriptEngine(new [] { "System" });
var session = Session.Create(Host);
engine.Execute("using System;", session);
try
{
if (!Validate(code)) return "Not implemeted";
var result = engine.Execute(code, session);
if(result != null)
return result.ToString();
}
catch (Exception ex)
{
return ex.ToString();
}
return null;
}
public bool Validate(string code)
{
var syntax = Syntax.ParseStatement(code);
return ScanSyntax(syntax.ChildNodes());
}
public bool ScanSyntax(IEnumerable<SyntaxNode> syntaxNodes)
{
foreach (var syntaxNode in syntaxNodes)
{
if (syntaxNode.HasChildren)
{
if (!ScanSyntax(syntaxNode.ChildNodes())) return false;
}
Console.WriteLine(syntaxNode.GetType());
if (syntaxNode is QualifiedNameSyntax || syntaxNode is InvocationExpressionSyntax && ((InvocationExpressionSyntax)syntaxNode).Expression is MemberAccessExpressionSyntax) return false;
}
return true;
}
}
} | mit | C# |
d134f0aeabcf5619535e3a881a5947876f6484e6 | Update DescriptionBox.cs | a312b/SteamMaster | SteamMaster/SteamUI/DescriptionBox.cs | SteamMaster/SteamUI/DescriptionBox.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DummyClassSolution
{
public class DescriptionBox : RichTextBox
{
//// Source of idea https://social.msdn.microsoft.com/Forums/vstudio/en-US/ba339154-95b7-4e13-a2c0-32593cadb984/richtextbox-vscrollbar?forum=vbgeneral
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
private uint WM_VSCROLL = 0x115;
private const int SB_LINEUP = 0;
private const int SB_LINEDOWN = 1;
public DescriptionBox()
{
this.ScrollBars = RichTextBoxScrollBars.None;
this.MouseWheel += Me_MouseWheel;
}
private void Me_MouseWheel(object sender, MouseEventArgs e)
{
try
{
if (e.Delta < 0)
{
SendMessage(this.Handle, WM_VSCROLL, SB_LINEDOWN, 0); // Scrolls down
}
else
{
SendMessage(this.Handle, WM_VSCROLL, SB_LINEUP, 0);// Scrolls up
}
}
catch
{
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DummyClassSolution
{
public class DescriptionBox : RichTextBox
{
//// see http://social.msdn.microsoft.com/Forums/vstudio/en-US/ba339154-95b7-4e13-a2c0-32593cadb984/descriptionBox-vscrollbar?forum=vbgeneral
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
private uint WM_VSCROLL = 0x115;
private const int SB_LINEUP = 0;
private const int SB_LINEDOWN = 1;
public DescriptionBox()
{
this.ScrollBars = RichTextBoxScrollBars.None;
this.MouseWheel += Me_MouseWheel;
}
private void Me_MouseWheel(object sender, MouseEventArgs e)
{
try
{
if (e.Delta < 0)
{
SendMessage(this.Handle, WM_VSCROLL, SB_LINEDOWN, 0); // Scrolls down
}
else
{
SendMessage(this.Handle, WM_VSCROLL, SB_LINEUP, 0);// Scrolls up
}
}
catch
{
}
}
}
}
| mit | C# |
09d76bb994877ebee234fb9bf40995ea209f5d08 | add from field to notification list | ucdavis/Badges,ucdavis/Badges | Badges/Views/Notifications/Index.cshtml | Badges/Views/Notifications/Index.cshtml | @{
ViewBag.Title = "My Notifications";
}
<div class="col-md-10 mountain-view">
<span class="header-text">Your notifications</span>
</div>
<div class="recent">
<table>
<tbody>
<tr>
<th><h3>Message</h3></th>
<th><em>Recieved on</em></th>
<th><em>From</em></th>
</tr>
@foreach (var notification in Model)
{
<tr>
<td class="message-info @((notification.Pending) ? "notification-pending" : "")"><a href="@Url.Action("View", "Notifications", new {id = notification.Id})">@notification.Message</a></td>
<td><em>@string.Format("{0:d}", notification.Created)</em></td>
<td><em>@notification.From.Profile.DisplayName</em></td>
</tr>
}
</tbody>
</table>
</div>
| @{
ViewBag.Title = "My Notifications";
}
<div class="col-md-10 mountain-view">
<span class="header-text">Your notifications</span>
</div>
<div class="recent">
<table>
<tbody>
<tr>
<th><h3>Message</h3></th>
<th colspan="2"><em>Recieved on</em></th>
</tr>
@foreach (var notification in Model)
{
<tr>
<td class="message-info @((notification.Pending) ? "notification-pending" : "")"><a href="@Url.Action("View", "Notifications", new {id = notification.Id})">@notification.Message</a></td>
<td><em>@string.Format("{0:d}", notification.Created)</em></td>
</tr>
}
</tbody>
</table>
</div>
| mpl-2.0 | C# |
95223b87de05ba2e25d1b1f06747177b749110d9 | update bio tagline (#144) | planetxamarin/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin | src/Firehose.Web/Authors/GeertVanDerCruijsen.cs | src/Firehose.Web/Authors/GeertVanDerCruijsen.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web
{
public class GeertVanDerCruijsen : IAmACommunityMember, IFilterMyBlogPosts
{
public string FirstName => "Geert";
public string LastName => "van der Cruijsen";
public string EmailAddress => "";
public string TwitterHandle => "geertvdc";
public string GravatarHash => "ec02820495ff6d50e58dd027aa2b0ae3";
public string StateOrRegion => "Uden, Netherlands";
public Uri WebSite => new Uri("https://mobilefirstcloudfirst.net");
public string GitHubHandle => "geertvdc";
public string ShortBioOrTagLine => "is Xamarin University training partner and a software architect who loves mobile and cloud";
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://mobilefirstcloudfirst.net/feed"); }
}
public GeoPosition Position => new GeoPosition(51.6631070, 5.6239230);
public bool Filter(SyndicationItem item) =>
item.Title.Text.ToLowerInvariant().Contains("xamarin") ||
item.Categories.Any(category => category.Name.ToLowerInvariant().Contains("xamarin"));
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web
{
public class GeertVanDerCruijsen : IAmACommunityMember, IFilterMyBlogPosts
{
public string FirstName => "Geert";
public string LastName => "van der Cruijsen";
public string ShortBioOrTagLine => string.Empty;
public string EmailAddress => "";
public string TwitterHandle => "geertvdc";
public string GravatarHash => "ec02820495ff6d50e58dd027aa2b0ae3";
public string StateOrRegion => "Uden, Netherlands";
public Uri WebSite => new Uri("https://mobilefirstcloudfirst.net");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://mobilefirstcloudfirst.net/feed"); }
}
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(51.6631070, 5.6239230);
public bool Filter(SyndicationItem item) =>
item.Title.Text.ToLowerInvariant().Contains("xamarin") ||
item.Categories.Any(category => category.Name.ToLowerInvariant().Contains("xamarin"));
}
} | mit | C# |
76603b39dea5bc92b86c9da30855281b0cecad69 | Remove flaky test. | AlexGhiondea/OutputColorizer,AlexGhiondea/OutputColorizer | test/ConsoleWriter.Tests.cs | test/ConsoleWriter.Tests.cs | using NUnit.Framework;
using OutputColorizer;
using System;
using System.IO;
namespace UnitTests
{
public partial class ConsoleWriterTests
{
[Test]
public void TestGetForegroundColor()
{
ConsoleWriter cw = new ConsoleWriter();
Assert.AreEqual(Console.ForegroundColor, cw.ForegroundColor);
}
[Test]
public void TestWrite()
{
ConsoleWriter cw = new ConsoleWriter();
StringWriter tw = new StringWriter();
Console.SetOut(tw);
cw.Write("test");
cw.Write("bar");
Assert.AreEqual("testbar", tw.GetStringBuilder().ToString());
}
[Test]
public void TestWriteLine()
{
ConsoleWriter cw = new ConsoleWriter();
StringWriter tw = new StringWriter();
Console.SetOut(tw);
cw.WriteLine("test2");
cw.WriteLine("bar");
Assert.AreEqual($"test2{Environment.NewLine}bar{Environment.NewLine}", tw.GetStringBuilder().ToString());
}
}
}
| using NUnit.Framework;
using OutputColorizer;
using System;
using System.IO;
namespace UnitTests
{
public partial class ConsoleWriterTests
{
[Test]
public void TestGetForegroundColor()
{
ConsoleWriter cw = new ConsoleWriter();
Assert.AreEqual(Console.ForegroundColor, cw.ForegroundColor);
}
[Test]
public void TestSetForegroundColor()
{
ConsoleWriter cw = new ConsoleWriter();
ConsoleColor before = Console.ForegroundColor;
cw.ForegroundColor = ConsoleColor.Black;
Assert.AreEqual(Console.ForegroundColor, ConsoleColor.Black);
cw.ForegroundColor = before;
Assert.AreEqual(Console.ForegroundColor, before);
}
[Test]
public void TestWrite()
{
ConsoleWriter cw = new ConsoleWriter();
StringWriter tw = new StringWriter();
Console.SetOut(tw);
cw.Write("test");
cw.Write("bar");
Assert.AreEqual("testbar", tw.GetStringBuilder().ToString());
}
[Test]
public void TestWriteLine()
{
ConsoleWriter cw = new ConsoleWriter();
StringWriter tw = new StringWriter();
Console.SetOut(tw);
cw.WriteLine("test2");
cw.WriteLine("bar");
Assert.AreEqual($"test2{Environment.NewLine}bar{Environment.NewLine}", tw.GetStringBuilder().ToString());
}
}
}
| mit | C# |
db9d3d706a46da5e7575216038064612fcc71533 | allow logical OR in Search | untoldone/bloomapi.net | BloomApi/Entities/BloomApiSearchTerm.cs | BloomApi/Entities/BloomApiSearchTerm.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BloomApi.Entities
{
public enum BloomApiSearchOperation { Equals, Prefix, Fuzzy, GreaterThan, LessThan, GreaterThanEquals, LessThanEquals }
public class BloomApiSearchTerm
{
public string Key { get; set; }
public BloomApiSearchOperation Operation { get; set; }
public string Value { get; set; }
public IEnumerable<string> Values { get; set; }
public string ToParameters(int index)
{
string apiOperation = this.ApiOperationName();
string values;
if (this.Values != null && this.Values.Count() > 0)
{
IEnumerable<string> valueParameters = this.Values.Select((v) => String.Format("value{0}={1}", index, v));
values = String.Join("&", valueParameters.ToArray());
}
else
{
values = String.Format("value{0}={1}", index, this.Value);
}
return String.Format("key{0}={1}&op{0}={2}&{3}", index, this.Key, apiOperation, values);
}
string ApiOperationName()
{
switch (this.Operation)
{
case BloomApiSearchOperation.Equals: return "eq";
case BloomApiSearchOperation.Fuzzy: return "fuzzy";
case BloomApiSearchOperation.GreaterThan: return "gt";
case BloomApiSearchOperation.GreaterThanEquals: return "gte";
case BloomApiSearchOperation.LessThan: return "lt";
case BloomApiSearchOperation.LessThanEquals: return "lte";
case BloomApiSearchOperation.Prefix: return "prefix";
}
throw new ArgumentException("Unknown Operation " + this.Operation.ToString());
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BloomApi.Entities
{
public enum BloomApiSearchOperation { Equals, Prefix, Fuzzy, GreaterThan, LessThan, GreaterThanEquals, LessThanEquals }
public class BloomApiSearchTerm
{
public string Key { get; set; }
public BloomApiSearchOperation Operation { get; set; }
public string Value { get; set; }
public string ToParameters(int index)
{
string apiOperation = this.ApiOperationName();
return String.Format("key{0}={1}&op{0}={2}&value{0}={3}", index, this.Key, apiOperation, this.Value);
}
string ApiOperationName()
{
switch (this.Operation)
{
case BloomApiSearchOperation.Equals: return "eq";
case BloomApiSearchOperation.Fuzzy: return "fuzzy";
case BloomApiSearchOperation.GreaterThan: return "gt";
case BloomApiSearchOperation.GreaterThanEquals: return "gte";
case BloomApiSearchOperation.LessThan: return "lt";
case BloomApiSearchOperation.LessThanEquals: return "lte";
case BloomApiSearchOperation.Prefix: return "prefix";
}
throw new ArgumentException("Unknown Operation " + this.Operation.ToString());
}
}
}
| mit | C# |
5b105656a97180e33b1e97b1cd36a7ac4a1d0869 | Use cell.Value instead of cell.Value2 to allow for Date formatting | TNG/xtab-opener | XtabFileOpener/TableContainer/SpreadsheetTableContainer/ExcelTableContainer/ExcelTable.cs | XtabFileOpener/TableContainer/SpreadsheetTableContainer/ExcelTableContainer/ExcelTable.cs | using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;
namespace XtabFileOpener.TableContainer.SpreadsheetTableContainer.ExcelTableContainer
{
/// <summary>
/// Implementation of Table, that manages an Excel table
/// </summary>
internal class ExcelTable : Table
{
internal ExcelTable(string name, Range cells) : base(name)
{
/*
* "The only difference between this property and the Value property is that the Value2 property
* doesn’t use the Currency and Date data types. You can return values formatted with these
* data types as floating-point numbers by using the Double data type."
* */
tableArray = cells.Value;
firstRowContainsColumnNames = true;
}
}
}
| using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;
namespace XtabFileOpener.TableContainer.SpreadsheetTableContainer.ExcelTableContainer
{
/// <summary>
/// Implementation of Table, that manages an Excel table
/// </summary>
internal class ExcelTable : Table
{
internal ExcelTable(string name, Range cells) : base(name)
{
tableArray = cells.Value2;
firstRowContainsColumnNames = true;
}
}
}
| apache-2.0 | C# |
6d7073068561b94fa939360a9ea99ebaa513a856 | Use this qualifier | dirkrombauts/pickles,picklesdoc/pickles,picklesdoc/pickles,dirkrombauts/pickles,picklesdoc/pickles,magicmonty/pickles,ludwigjossieaux/pickles,ludwigjossieaux/pickles,blorgbeard/pickles,magicmonty/pickles,blorgbeard/pickles,dirkrombauts/pickles,picklesdoc/pickles,magicmonty/pickles,blorgbeard/pickles,ludwigjossieaux/pickles,blorgbeard/pickles,magicmonty/pickles,dirkrombauts/pickles | src/Pickles/Pickles.Test/ObjectModel/Factory.cs | src/Pickles/Pickles.Test/ObjectModel/Factory.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="Factory.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using System.Linq;
using PicklesDoc.Pickles.ObjectModel;
using G = Gherkin3.Ast;
namespace PicklesDoc.Pickles.Test.ObjectModel
{
public class Factory
{
private const G.Location AnyLocation = null;
internal Mapper CreateMapper()
{
var mapper = new Mapper();
return mapper;
}
internal G.TableCell CreateGherkinTableCell(string cellValue)
{
return new G.TableCell(AnyLocation, cellValue);
}
internal G.DocString CreateDocString()
{
return new G.DocString(AnyLocation, null, @"My doc string line 1
My doc string line 2");
}
internal G.TableRow CreateGherkinTableRow(params string[] cellValues)
{
return new G.TableRow(
AnyLocation,
cellValues.Select(this.CreateGherkinTableCell).ToArray());
}
internal G.DataTable CreateGherkinDataTable(IEnumerable<string[]> rows)
{
return new G.DataTable(rows.Select(this.CreateGherkinTableRow).ToArray());
}
}
} | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="Factory.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using System.Linq;
using PicklesDoc.Pickles.ObjectModel;
using G = Gherkin3.Ast;
namespace PicklesDoc.Pickles.Test.ObjectModel
{
public class Factory
{
private const G.Location AnyLocation = null;
internal Mapper CreateMapper()
{
var mapper = new Mapper();
return mapper;
}
internal G.TableCell CreateGherkinTableCell(string cellValue)
{
return new G.TableCell(AnyLocation, cellValue);
}
internal G.DocString CreateDocString()
{
return new G.DocString(AnyLocation, null, @"My doc string line 1
My doc string line 2");
}
internal G.TableRow CreateGherkinTableRow(params string[] cellValues)
{
return new G.TableRow(
AnyLocation,
cellValues.Select(CreateGherkinTableCell).ToArray());
}
internal G.DataTable CreateGherkinDataTable(IEnumerable<string[]> rows)
{
return new G.DataTable(rows.Select(this.CreateGherkinTableRow).ToArray());
}
}
} | apache-2.0 | C# |
132241424db9f438c102f2a7aeae41675c3754ed | Apply FollowPoint alpha to inner container (should not affect legacy skins) | smoogipoo/osu,2yangk23/osu,DrabWeb/osu,ppy/osu,ZLima12/osu,naoey/osu,2yangk23/osu,ppy/osu,ZLima12/osu,NeoAdonis/osu,EVAST9919/osu,UselessToucan/osu,EVAST9919/osu,peppy/osu,ppy/osu,johnneijzen/osu,peppy/osu,UselessToucan/osu,naoey/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,johnneijzen/osu,smoogipooo/osu,naoey/osu,NeoAdonis/osu,smoogipoo/osu,DrabWeb/osu,UselessToucan/osu,DrabWeb/osu,NeoAdonis/osu | osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs | osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
{
public class FollowPoint : Container
{
private const float width = 8;
public override bool RemoveWhenNotAlive => false;
public FollowPoint()
{
Origin = Anchor.Centre;
Child = new SkinnableDrawable("Play/osu/followpoint", _ => new Container
{
Masking = true,
AutoSizeAxes = Axes.Both,
CornerRadius = width / 2,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Colour = Color4.White.Opacity(0.2f),
Radius = 4,
},
Child = new Box
{
Size = new Vector2(width),
Blending = BlendingMode.Additive,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Alpha = 0.5f,
}
}, restrictSize: false);
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
{
public class FollowPoint : Container
{
private const float width = 8;
public override bool RemoveWhenNotAlive => false;
public FollowPoint()
{
Origin = Anchor.Centre;
Child = new SkinnableDrawable("Play/osu/followpoint", _ => new Container
{
Masking = true,
AutoSizeAxes = Axes.Both,
CornerRadius = width / 2,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Colour = Color4.White.Opacity(0.2f),
Radius = 4,
},
Child = new Box
{
Size = new Vector2(width),
Blending = BlendingMode.Additive,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
}
}, restrictSize: false)
{
Alpha = 0.5f,
};
}
}
}
| mit | C# |
13b5d935fa7a50ceea62fe935bc79a0f78a1024b | Add torque to launched planets | aornelas/Tiny-Planets,aornelas/Tiny-Planets | Assets/PlanetSpawner.cs | Assets/PlanetSpawner.cs | using UnityEngine;
using System.Collections;
public class PlanetSpawner : MonoBehaviour {
public GameObject camera;
public GameObject planetPrefab;
public GravityAttractor blackHole;
// public GravityAttractor blackHole1;
// public GravityAttractor blackHole2;
public float thrust = 100f;
public float torque = 25000f;
void Start()
{
}
void Update()
{
if (GvrViewer.Instance.Triggered)
{
GetComponent<AudioSource>().Play();
GameObject planet = (GameObject) Instantiate(planetPrefab, transform.position, new Quaternion());
planet.GetComponent<GravityBody>().attractor = blackHole;
// GravityAttractor[] attractors = new GravityAttractor[2];
// attractors[0] = blackHole1;
// attractors[1] = blackHole2;
// planet.GetComponent<GravityBody>().attractors = attractors;
planet.GetComponent<Rigidbody>().AddForce(camera.transform.forward * thrust, ForceMode.VelocityChange);
planet.GetComponent<Rigidbody>().AddTorque(transform.up * torque);
}
}
}
| using UnityEngine;
using System.Collections;
public class PlanetSpawner : MonoBehaviour {
public GameObject camera;
public GameObject planetPrefab;
public GravityAttractor blackHole;
// public GravityAttractor blackHole1;
// public GravityAttractor blackHole2;
public float force = 100f;
void Start()
{
}
void Update()
{
if (GvrViewer.Instance.Triggered)
{
GetComponent<AudioSource>().Play();
GameObject planet = (GameObject) Instantiate(planetPrefab, transform.position, new Quaternion());
planet.GetComponent<GravityBody>().attractor = blackHole;
// GravityAttractor[] attractors = new GravityAttractor[2];
// attractors[0] = blackHole1;
// attractors[1] = blackHole2;
// planet.GetComponent<GravityBody>().attractors = attractors;
planet.GetComponent<Rigidbody>().AddForce(camera.transform.forward * force, ForceMode.VelocityChange);
}
}
}
| mit | C# |
3c8759f0507a20cae1d0a9030e9a5f5d74b6cc5e | fix UT | ariesy/Bowling | Bowling.Tests/BowlingMachineTests.cs | Bowling.Tests/BowlingMachineTests.cs | using NUnit.Framework;
using Rhino.Mocks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sirius.Bowling.Core.Tests
{
[TestFixture]
public class BowlingMachineTests
{
[Test]
public void TestThrow()
{
var recorder = MockRepository.GenerateStub<BowlingRecorder>();
var target = new BowlingMachine(recorder);
var throw1 = target.Throw();
Assert.GreaterOrEqual(throw1, 0);
Assert.LessOrEqual(throw1, 10);
var throw2 = target.Throw();
Assert.GreaterOrEqual(throw2, 0);
if (throw1 < 10)
{
Assert.LessOrEqual( throw1 + throw2, 10);
}
var throw3 = target.Throw(3);
Assert.AreEqual(3, throw3);
var throw4 = target.Throw(1000);
Assert.LessOrEqual(throw4, 7);
var throw5 = target.Throw(-100);
Assert.LessOrEqual(throw5, 10);
Assert.GreaterOrEqual(throw5, 0);
}
}
}
| using NUnit.Framework;
using Rhino.Mocks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sirius.Bowling.Core.Tests
{
[TestFixture]
public class BowlingMachineTests
{
[Test]
public void TestThrow()
{
var recorder = MockRepository.GenerateStub<BowlingRecorder>();
var target = new BowlingMachine(recorder);
var throw1 = target.Throw();
Assert.GreaterOrEqual(throw1, 0);
Assert.LessOrEqual(throw1, 10);
var throw2 = target.Throw();
Assert.GreaterOrEqual(throw2, 0);
if (throw1 < 10)
{
Assert.LessOrEqual( throw1 + throw2, 10);
}
var throw3 = target.Throw(3);
Assert.AreEqual(3, throw3);
var throw4 = target.Throw(1000);
Assert.LessOrEqual(throw4, 7);
var throw5 = target.Throw(-100);
Assert.LessOrEqual(throw5, 10);
Assert.Greater(throw5, 0);
}
}
}
| mit | C# |
3b8b0d050125c69297f4d52e2a7713f48bd1414d | Make Tag a struct | Nezaboodka/Nevod.TextParsing,Nezaboodka/Nevod.TextParsing | Source/TextParser/Common/Tag.cs | Source/TextParser/Common/Tag.cs | namespace TextParser.Common
{
public struct Tag
{
public int TokenPosition;
public int TokenLength;
public string TagName;
}
} | namespace TextParser.Common
{
public class Tag
{
public int TokenPosition;
public int TokenLength;
public string TagName;
}
} | mit | C# |
335420283a3a26e12a5eb660ba8b5af1166bfc5e | Add stretchblt for copy and resize | mika76/mamesaver | Mamesaver/Windows/PlatformInvokeGDI32.cs | Mamesaver/Windows/PlatformInvokeGDI32.cs | using System;
using System.Runtime.InteropServices;
namespace Mamesaver.Windows
{
// This class contains the GDI32 APIs used...
public class PlatformInvokeGdi32
{
public const int SRCOPY = 13369376;
[DllImport("gdi32.dll", EntryPoint = "DeleteDC")]
public static extern IntPtr DeleteDC(IntPtr hDc);
[DllImport("gdi32.dll", EntryPoint = "DeleteObject")]
public static extern IntPtr DeleteObject(IntPtr hDc);
[DllImport("gdi32.dll", EntryPoint = "BitBlt")]
public static extern bool BitBlt(IntPtr hdcDest, int xDest, int yDest, int wDest, int hDest, IntPtr hdcSource, int xSrc, int ySrc, int RasterOp);
[DllImport("gdi32.dll", EntryPoint = "StretchBlt")]
public static extern bool StretchBlt(IntPtr hdcDest, int xDest, int yDest, int wDest, int hDest, IntPtr hdcSource, int xSrc, int ySrc, int wSrc, int hSrc, int RasterOp);
[DllImport("gdi32.dll")]
public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
[DllImport("gdi32.dll")]
public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);
[DllImport("gdi32.dll", EntryPoint = "SelectObject")]
public static extern IntPtr SelectObject(IntPtr hdc, IntPtr bmp);
}
}
| using System;
using System.Runtime.InteropServices;
namespace Mamesaver.Windows
{
// This class contains the GDI32 APIs used...
public class PlatformInvokeGdi32
{
public const int SRCOPY = 13369376;
[DllImport("gdi32.dll", EntryPoint = "DeleteDC")]
public static extern IntPtr DeleteDC(IntPtr hDc);
[DllImport("gdi32.dll", EntryPoint = "DeleteObject")]
public static extern IntPtr DeleteObject(IntPtr hDc);
[DllImport("gdi32.dll", EntryPoint = "BitBlt")]
public static extern bool BitBlt(IntPtr hdcDest, int xDest, int yDest, int wDest, int hDest, IntPtr hdcSource, int xSrc, int ySrc, int RasterOp);
[DllImport("gdi32.dll")]
public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
[DllImport("gdi32.dll")]
public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);
[DllImport("gdi32.dll", EntryPoint = "SelectObject")]
public static extern IntPtr SelectObject(IntPtr hdc, IntPtr bmp);
}
}
| mit | C# |
9ad81702ed48362a365d93117d99a477b3c35972 | Bump version | cbcrc/LinkIt.AutoMapperExtensions | RC.AutoMapper/Properties/AssemblyInfo.cs | RC.AutoMapper/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("RC.AutoMapper")]
[assembly: AssemblyDescription("AutoMapper extensions to help map Linked Sources to DTOs by convention.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Radio-Canada")]
[assembly: AssemblyProduct("RC.AutoMapper")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8c5583ca-3ea4-4c11-b786-9d5e80373c72")]
// 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")]
[assembly: AssemblyFileVersion("0.2.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("RC.AutoMapper")]
[assembly: AssemblyDescription("AutoMapper extensions to help map Linked Sources to DTOs by convention.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Radio-Canada")]
[assembly: AssemblyProduct("RC.AutoMapper")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8c5583ca-3ea4-4c11-b786-9d5e80373c72")]
// 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")]
[assembly: AssemblyFileVersion("0.1.0")]
| mit | C# |
daa2ca7db5ec2d1e99af66a144e0a72dd50adbbf | Test commit | ZyshchykMaksim/WCF.REST,ZyshchykMaksim/WCF.REST,ZyshchykMaksim/WCF.REST | Web.WebSocket/Views/Home/Index.cshtml | Web.WebSocket/Views/Home/Index.cshtml | @{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>WebSocket</title>
</head>
<body>
<h2>Push messages</h2>
<strong>Test</strong>
<div id="messages"></div>
<script src="@Url.Content("~/scripts/jquery-2.2.1.js")"></script>
<script src="@Url.Content("~/scripts/bootstrap.js")"></script>
<script type="text/javascript">
var messages = document.getElementById('messages'),
socket = new WebSocket("ws://localhost:8081/");
socket.onopen = function () {
showMessage("Соединение установлено.");
};
socket.onclose = function (event) {
if (event.wasClean) {
showMessage('Соединение закрыто чисто');
} else {
showMessage('Обрыв соединения');
}
showMessage('Код: ' + event.code + ' причина: ' + event.reason);
};
socket.onmessage = function (event) {
showMessage(event.data);
};
socket.onerror = function (error) {
showMessage("Ошибка " + error.message);
};
function showMessage(message) {
var messageElem = document.createElement('div');
messageElem.appendChild(document.createTextNode(message));
messages.appendChild(messageElem);
}
</script>
</body>
</html> | @{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>WebSocket</title>
</head>
<body>
<h2>Push messages</h2>
<div id="messages"></div>
<script src="@Url.Content("~/scripts/jquery-2.2.1.js")"></script>
<script src="@Url.Content("~/scripts/bootstrap.js")"></script>
<script type="text/javascript">
var messages = document.getElementById('messages'),
socket = new WebSocket("ws://localhost:8081/");
socket.onopen = function () {
showMessage("Соединение установлено.");
};
socket.onclose = function (event) {
if (event.wasClean) {
showMessage('Соединение закрыто чисто');
} else {
showMessage('Обрыв соединения');
}
showMessage('Код: ' + event.code + ' причина: ' + event.reason);
};
socket.onmessage = function (event) {
showMessage(event.data);
};
socket.onerror = function (error) {
showMessage("Ошибка " + error.message);
};
function showMessage(message) {
var messageElem = document.createElement('div');
messageElem.appendChild(document.createTextNode(message));
messages.appendChild(messageElem);
}
</script>
</body>
</html> | mit | C# |
30f793007e92135ca597e1caaf951cec2edaf339 | Add missing copyright | StephenHodgson/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,vladkol/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,vladkol/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,vladkol/MixedRealityToolkit-Unity | Assets/MixedRealityToolkit/_Core/Inspectors/Profiles/MixedRealityDiagnosticsSystemProfileInspector.cs | Assets/MixedRealityToolkit/_Core/Inspectors/Profiles/MixedRealityDiagnosticsSystemProfileInspector.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Core.Definitions.Diagnostics;
using Microsoft.MixedReality.Toolkit.Core.Managers;
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Inspectors.Profiles
{
[CustomEditor(typeof(MixedRealityDiagnosticsProfile))]
public class MixedRealityDiagnosticsSystemProfileInspector : MixedRealityBaseConfigurationProfileInspector
{
private SerializedProperty showCpu;
private SerializedProperty showFps;
private SerializedProperty showMemory;
private SerializedProperty visible;
private void OnEnable()
{
if (!CheckMixedRealityManager(false))
{
return;
}
showCpu = serializedObject.FindProperty("showCpu");
showFps = serializedObject.FindProperty("showFps");
showMemory = serializedObject.FindProperty("showMemory");
visible = serializedObject.FindProperty("visible");
}
public override void OnInspectorGUI()
{
RenderMixedRealityToolkitLogo();
if (!CheckMixedRealityManager())
{
return;
}
if (GUILayout.Button("Back to Configuration Profile"))
{
Selection.activeObject = MixedRealityManager.Instance.ActiveProfile;
}
EditorGUILayout.Space();
EditorGUILayout.LabelField("Boundary Visualization Options", EditorStyles.boldLabel);
EditorGUILayout.HelpBox("Boundary visualizations can help users stay oriented and comfortable in the experience.", MessageType.Info);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(visible);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(showCpu);
EditorGUILayout.PropertyField(showFps);
EditorGUILayout.PropertyField(showMemory);
}
}
}
| using Microsoft.MixedReality.Toolkit.Core.Definitions.Diagnostics;
using Microsoft.MixedReality.Toolkit.Core.Managers;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Inspectors.Profiles
{
[CustomEditor(typeof(MixedRealityDiagnosticsProfile))]
public class MixedRealityDiagnosticsSystemProfileInspector : MixedRealityBaseConfigurationProfileInspector
{
private SerializedProperty showCpu;
private SerializedProperty showFps;
private SerializedProperty showMemory;
private SerializedProperty visible;
private void OnEnable()
{
if (!CheckMixedRealityManager(false))
{
return;
}
showCpu = serializedObject.FindProperty("showCpu");
showFps = serializedObject.FindProperty("showFps");
showMemory = serializedObject.FindProperty("showMemory");
visible = serializedObject.FindProperty("visible");
}
public override void OnInspectorGUI()
{
RenderMixedRealityToolkitLogo();
if (!CheckMixedRealityManager())
{
return;
}
if (GUILayout.Button("Back to Configuration Profile"))
{
Selection.activeObject = MixedRealityManager.Instance.ActiveProfile;
}
EditorGUILayout.Space();
EditorGUILayout.LabelField("Boundary Visualization Options", EditorStyles.boldLabel);
EditorGUILayout.HelpBox("Boundary visualizations can help users stay oriented and comfortable in the experience.", MessageType.Info);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(visible);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(showCpu);
EditorGUILayout.PropertyField(showFps);
EditorGUILayout.PropertyField(showMemory);
}
}
}
| mit | C# |
b95cc798b2b8d995422bf120118dfcb56461c44f | Remove unused fallback | EVAST9919/osu,NeoAdonis/osu,naoey/osu,smoogipoo/osu,peppy/osu,naoey/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,johnneijzen/osu,EVAST9919/osu,naoey/osu,ZLima12/osu,DrabWeb/osu,smoogipoo/osu,smoogipooo/osu,UselessToucan/osu,DrabWeb/osu,peppy/osu,ZLima12/osu,peppy/osu-new,johnneijzen/osu,NeoAdonis/osu,DrabWeb/osu,2yangk23/osu,ppy/osu,ppy/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,smoogipoo/osu | osu.Game/Rulesets/Scoring/ScoreStore.cs | osu.Game/Rulesets/Scoring/ScoreStore.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.IO;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.IPC;
using osu.Game.Rulesets.Scoring.Legacy;
namespace osu.Game.Rulesets.Scoring
{
public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles
{
private readonly Storage storage;
private readonly BeatmapManager beatmaps;
private readonly RulesetStore rulesets;
private const string replay_folder = @"replays";
public event Action<Score> ScoreImported;
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
private ScoreIPCChannel ipc;
public ScoreStore(Storage storage, DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory)
{
this.storage = storage;
this.beatmaps = beatmaps;
this.rulesets = rulesets;
if (importHost != null)
ipc = new ScoreIPCChannel(importHost, this);
}
public string[] HandledExtensions => new[] { ".osr" };
public void Import(params string[] paths)
{
foreach (var path in paths)
{
var score = ReadReplayFile(path);
if (score != null)
ScoreImported?.Invoke(score);
}
}
public Score ReadReplayFile(string replayFilename)
{
if (!File.Exists(replayFilename))
{
Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error);
return null;
}
using (var stream = File.OpenRead(replayFilename))
return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream);
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.IO;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.IPC;
using osu.Game.Rulesets.Scoring.Legacy;
namespace osu.Game.Rulesets.Scoring
{
public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles
{
private readonly Storage storage;
private readonly BeatmapManager beatmaps;
private readonly RulesetStore rulesets;
private const string replay_folder = @"replays";
public event Action<Score> ScoreImported;
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
private ScoreIPCChannel ipc;
public ScoreStore(Storage storage, DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory)
{
this.storage = storage;
this.beatmaps = beatmaps;
this.rulesets = rulesets;
if (importHost != null)
ipc = new ScoreIPCChannel(importHost, this);
}
public string[] HandledExtensions => new[] { ".osr" };
public void Import(params string[] paths)
{
foreach (var path in paths)
{
var score = ReadReplayFile(path);
if (score != null)
ScoreImported?.Invoke(score);
}
}
public Score ReadReplayFile(string replayFilename)
{
Stream stream;
if (File.Exists(replayFilename))
{
// Handle replay with File since it is outside of storage
stream = File.OpenRead(replayFilename);
}
else if (storage.Exists(Path.Combine(replay_folder, replayFilename)))
{
stream = storage.GetStream(Path.Combine(replay_folder, replayFilename));
}
else
{
Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error);
return null;
}
using (stream)
return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream);
}
}
}
| mit | C# |
9862a9cadf0b3e11c6b61c35298ffb221e0af74d | Remove un-needed extension methods. | izrik/ChamberLib,izrik/ChamberLib,izrik/ChamberLib | ChamberLib/ViewportHelper.cs | ChamberLib/ViewportHelper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XMatrix = Microsoft.Xna.Framework.Matrix;
namespace ChamberLib
{
public static class ViewportHelper
{
public static Matrix GenerateSpriteBatchProjection(this Viewport viewport)
{
return
(XMatrix.CreateTranslation(-0.5f, -0.5f, 0) *
XMatrix.CreateOrthographicOffCenter(
0,
viewport.Width,
viewport.Height,
0,
0,
1)).ToChamber();
}
public static Microsoft.Xna.Framework.Graphics.Viewport ToXna(this ChamberLib.Viewport vp)
{
var vp2 = new Microsoft.Xna.Framework.Graphics.Viewport(vp.Bounds.ToXna());
vp2.MinDepth = vp.MinDepth;
vp2.MaxDepth = vp.MaxDepth;
return vp2;
}
public static ChamberLib.Viewport ToChamber(this Microsoft.Xna.Framework.Graphics.Viewport vp)
{
var vp2 = new ChamberLib.Viewport();
vp2.Bounds = vp.Bounds.ToChamber();
vp2.MinDepth = vp.MinDepth;
vp2.MaxDepth = vp.MaxDepth;
return vp2;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XMatrix = Microsoft.Xna.Framework.Matrix;
namespace ChamberLib
{
public static class ViewportHelper
{
public static RectangleI GetRectangle(this Viewport vp)
{
return new RectangleI(vp.X, vp.Y, vp.Width, vp.Height);
}
public static Vector2 GetPosition(this Viewport vp)
{
return new Vector2(vp.X, vp.Y);
}
public static Vector2 GetSize(this Viewport vp)
{
return new Vector2(vp.Width, vp.Height);
}
public static Matrix GenerateSpriteBatchProjection(this Viewport viewport)
{
return
(XMatrix.CreateTranslation(-0.5f, -0.5f, 0) *
XMatrix.CreateOrthographicOffCenter(
0,
viewport.Width,
viewport.Height,
0,
0,
1)).ToChamber();
}
public static Microsoft.Xna.Framework.Graphics.Viewport ToXna(this ChamberLib.Viewport vp)
{
var vp2 = new Microsoft.Xna.Framework.Graphics.Viewport(vp.Bounds.ToXna());
vp2.MinDepth = vp.MinDepth;
vp2.MaxDepth = vp.MaxDepth;
return vp2;
}
public static ChamberLib.Viewport ToChamber(this Microsoft.Xna.Framework.Graphics.Viewport vp)
{
var vp2 = new ChamberLib.Viewport();
vp2.Bounds = vp.Bounds.ToChamber();
vp2.MinDepth = vp.MinDepth;
vp2.MaxDepth = vp.MaxDepth;
return vp2;
}
}
}
| lgpl-2.1 | C# |
013e582e53189956aaf146739116d86efcff8174 | Add SessionId field | api-ai/api-ai-net,api-ai/api-ai-net,dialogflow/dialogflow-dotnet-client,dialogflow/dialogflow-dotnet-client | ApiAiSDK/Model/AIResponse.cs | ApiAiSDK/Model/AIResponse.cs | //
// API.AI .NET SDK - client-side libraries for API.AI
// =================================================
//
// Copyright (C) 2015 by Speaktoit, Inc. (https://www.speaktoit.com)
// https://www.api.ai
//
// ***********************************************************************************************************************
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
//
// ***********************************************************************************************************************
using System;
using System.Collections;
using Newtonsoft.Json;
namespace ApiAiSDK.Model
{
[JsonObject]
public class AIResponse
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("timestamp")]
public DateTime Timestamp{ get; set; }
[JsonProperty("result")]
public Result Result{ get; set; }
[JsonProperty("status")]
public Status Status{ get; set; }
[JsonProperty("sessionId")]
public string SessionId { get; set; }
public bool IsError
{
get
{
if (Status != null && Status.Code.HasValue && Status.Code >= 400) {
return true;
}
return false;
}
}
}
} | //
// API.AI .NET SDK - client-side libraries for API.AI
// =================================================
//
// Copyright (C) 2015 by Speaktoit, Inc. (https://www.speaktoit.com)
// https://www.api.ai
//
// ***********************************************************************************************************************
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
//
// ***********************************************************************************************************************
using System;
using System.Collections;
using Newtonsoft.Json;
namespace ApiAiSDK.Model
{
[JsonObject]
public class AIResponse
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("timestamp")]
public DateTime Timestamp{ get; set; }
[JsonProperty("result")]
public Result Result{ get; set; }
[JsonProperty("status")]
public Status Status{ get; set; }
public bool IsError
{
get
{
if (Status != null && Status.Code.HasValue && Status.Code >= 400) {
return true;
}
return false;
}
}
}
} | apache-2.0 | C# |
35747649e035e91cf19839b2717c4470d56dd5bb | Add File field to lock object as event source (#475) | box/box-windows-sdk-v2 | Box.V2/Models/BoxFileLock.cs | Box.V2/Models/BoxFileLock.cs | using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Converters;
namespace Box.V2.Models
{
/// <summary>
/// Box representation of a file
/// </summary>
public class BoxFileLock : BoxEntity
{
public const string FieldCreatedAt = "created_at";
public const string FieldCreatedBy = "created_by";
public const string FieldExpiresAt = "expires_at";
public const string FieldIsDownloadPrevented = "is_download_prevented";
public const string FieldFile = "file";
/// <summary>
/// The time the lock was created
/// </summary>
[JsonProperty(PropertyName = FieldCreatedAt)]
public DateTime? CreatedAt { get; private set; }
/// <summary>
/// The user who created this lock
/// </summary>
[JsonProperty(PropertyName = FieldCreatedBy)]
public BoxUser CreatedBy { get; private set; }
/// <summary>
/// The expiration date of this lock
/// </summary>
[JsonProperty(PropertyName = FieldExpiresAt)]
public DateTime? ExpiresAt { get; set; }
/// <summary>
/// Is download prevented for this lock?
/// </summary>
[JsonProperty(PropertyName = FieldIsDownloadPrevented)]
public bool IsDownloadPrevented { get; set; }
/// <summary>
/// The file the lock applies to; only set when the lock appears as the
/// source of an event.
/// </summary>
[JsonProperty(PropertyName = FieldFile)]
public BoxFile File { get; private set; }
}
}
| using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Converters;
namespace Box.V2.Models
{
/// <summary>
/// Box representation of a file
/// </summary>
public class BoxFileLock : BoxEntity
{
public const string FieldCreatedAt = "created_at";
public const string FieldCreatedBy = "created_by";
public const string FieldExpiresAt = "expires_at";
public const string FieldIsDownloadPrevented = "is_download_prevented";
/// <summary>
/// The time the lock was created
/// </summary>
[JsonProperty(PropertyName = FieldCreatedAt)]
public DateTime? CreatedAt { get; private set; }
/// <summary>
/// The user who created this lock
/// </summary>
[JsonProperty(PropertyName = FieldCreatedBy)]
public BoxUser CreatedBy { get; private set; }
/// <summary>
/// The expiration date of this lock
/// </summary>
[JsonProperty(PropertyName = FieldExpiresAt)]
public DateTime? ExpiresAt { get; set; }
/// <summary>
/// Is download prevented for this lock?
/// </summary>
[JsonProperty(PropertyName = FieldIsDownloadPrevented)]
public bool IsDownloadPrevented { get; set; }
}
}
| apache-2.0 | C# |
af3b27c08f484d30e9c0a7284d136d06f37e0aff | Fix wrong method used in WinForms colore->systemcolor | WolfspiritM/Colore,CoraleStudios/Colore | Corale.Colore.WinForms/Extensions.cs | Corale.Colore.WinForms/Extensions.cs | // <copyright file="Extensions.cs" company="Corale">
// Copyright © 2015 by Adam Hellberg and Brandon Scott.
//
// 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.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
namespace Corale.Colore.WinForms
{
using Corale.Colore.Annotations;
using ColoreColor = Corale.Colore.Core.Color;
using SystemColor = System.Drawing.Color;
/// <summary>
/// Extension methods for integrating Colore with WinForms.
/// </summary>
[PublicAPI]
public static class Extensions
{
/// <summary>
/// Converts a System.Drawing <see cref="SystemColor" /> to a
/// Colore <see cref="ColoreColor" />.
/// </summary>
/// <param name="source">The color to convert.</param>
/// <returns>
/// A <see cref="ColoreColor" /> representing the
/// given <see cref="SystemColor" />.
/// </returns>
public static ColoreColor ToColoreColor(this SystemColor source)
{
return new ColoreColor(source.R, source.G, source.B);
}
/// <summary>
/// Converts a Colore <see cref="ColoreColor" /> to a
/// System.Drawing <see cref="WpfColor" />
/// </summary>
/// <param name="source">The color to convert.</param>
/// <returns>
/// A <see cref="SystemColor" /> representing the
/// given <see cref="ColoreColor" />.
/// </returns>
public static SystemColor ToSystemColor(this ColoreColor source)
{
return SystemColor.FromArgb(source.R, source.G, source.B);
}
}
}
| // <copyright file="Extensions.cs" company="Corale">
// Copyright © 2015 by Adam Hellberg and Brandon Scott.
//
// 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.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
namespace Corale.Colore.WinForms
{
using Corale.Colore.Annotations;
using ColoreColor = Corale.Colore.Core.Color;
using SystemColor = System.Drawing.Color;
/// <summary>
/// Extension methods for integrating Colore with WinForms.
/// </summary>
[PublicAPI]
public static class Extensions
{
/// <summary>
/// Converts a System.Drawing <see cref="SystemColor" /> to a
/// Colore <see cref="ColoreColor" />.
/// </summary>
/// <param name="source">The color to convert.</param>
/// <returns>
/// A <see cref="ColoreColor" /> representing the
/// given <see cref="SystemColor" />.
/// </returns>
public static ColoreColor ToColoreColor(this SystemColor source)
{
return new ColoreColor(source.R, source.G, source.B);
}
/// <summary>
/// Converts a Colore <see cref="ColoreColor" /> to a
/// System.Drawing <see cref="WpfColor" />
/// </summary>
/// <param name="source">The color to convert.</param>
/// <returns>
/// A <see cref="SystemColor" /> representing the
/// given <see cref="ColoreColor" />.
/// </returns>
public static SystemColor ToSystemColor(this ColoreColor source)
{
return SystemColor.FromRgb(source.R, source.G, source.B);
}
}
}
| mit | C# |
557713fe5f3323b9919b0b2994e92acc05ae67f3 | Increase version | Tunous/EEPhysics,cap9/EEPhysics | EEPhysics/Properties/AssemblyInfo.cs | EEPhysics/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("EEPhysics")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EEPhysics")]
[assembly: AssemblyCopyright("MIT License")]
[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("80820906-c3b5-43f6-9eac-97906f07f2f4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
| 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("EEPhysics")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EEPhysics")]
[assembly: AssemblyCopyright("MIT License")]
[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("80820906-c3b5-43f6-9eac-97906f07f2f4")]
// 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.5.0")]
[assembly: AssemblyFileVersion("1.1.5.0")]
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.