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 |
---|---|---|---|---|---|---|---|---|
b838d008875bdd4f50d706d57d79a27d885ca4ba | Change the AssemblyFileVersion for Ver 2.0 release. | xo-energy/dockpanelsuite,thijse/dockpanelsuite,compborg/dockpanelsuite,jorik041/dockpanelsuite,15070217668/dockpanelsuite,modulexcite/O2_Fork_dockpanelsuite,dockpanelsuite/dockpanelsuite,elnomade/dockpanelsuite,ArsenShnurkov/dockpanelsuite,transistor1/dockpanelsuite,Romout/dockpanelsuite,joelbyren/dockpanelsuite,15070217668/dockpanelsuite,shintadono/dockpanelsuite,RadarNyan/dockpanelsuite,rohitlodha/dockpanelsuite,angelapper/dockpanelsuite | WinFormsUI/Properties/AssemblyInfo.cs | WinFormsUI/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
[assembly: AssemblyTitle("DockPanel Suite for .Net 2.0")]
[assembly: AssemblyDescription(".Net Docking Library for Windows Forms")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weifen Luo")]
[assembly: AssemblyProduct("DockPanel Suite")]
[assembly: AssemblyCopyright("Copyright © Weifen Luo 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: Guid("9d690ef9-ce19-4c69-874c-e24d8eb36aff")]
[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyFileVersion("2.0.2.0")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Dockable")] | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
[assembly: AssemblyTitle("DockPanel Suite for .Net 2.0")]
[assembly: AssemblyDescription(".Net Docking Library for Windows Forms")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weifen Luo")]
[assembly: AssemblyProduct("DockPanel Suite")]
[assembly: AssemblyCopyright("Copyright © Weifen Luo 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: Guid("9d690ef9-ce19-4c69-874c-e24d8eb36aff")]
[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Dockable")] | mit | C# |
93f93ef9bb217b389076e5f10b8560cb63a4fbc9 | Update build.cake (#958) | xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents | XPlat/ExposureNotification/build.cake | XPlat/ExposureNotification/build.cake | var TARGET = Argument("t", Argument("target", "ci"));
var OUTPUT_PATH = (DirectoryPath)"./output/";
var NUGET_VERSION = "0.13.0-preview";
Task("nuget")
.Does(() =>
{
MSBuild($"./source/Xamarin.ExposureNotification/Xamarin.ExposureNotification.csproj", c => c
.SetConfiguration("Release")
.WithRestore()
.WithTarget("Build")
.WithTarget("Pack")
.WithProperty("PackageVersion", NUGET_VERSION)
.WithProperty("PackageOutputPath", MakeAbsolute(OUTPUT_PATH).FullPath));
});
Task("ci")
.IsDependentOn("nuget");
RunTarget(TARGET);
| var TARGET = Argument("t", Argument("target", "ci"));
var OUTPUT_PATH = (DirectoryPath)"./output/";
var NUGET_VERSION = "0.12.0-preview";
Task("nuget")
.Does(() =>
{
MSBuild($"./source/Xamarin.ExposureNotification/Xamarin.ExposureNotification.csproj", c => c
.SetConfiguration("Release")
.WithRestore()
.WithTarget("Build")
.WithTarget("Pack")
.WithProperty("PackageVersion", NUGET_VERSION)
.WithProperty("PackageOutputPath", MakeAbsolute(OUTPUT_PATH).FullPath));
});
Task("ci")
.IsDependentOn("nuget");
RunTarget(TARGET);
| mit | C# |
f7c11009278fd1766cb2b422349ea166100d9881 | add loop using label | DasAllFolks/SharpGraphs | Graph/Graph.cs | Graph/Graph.cs | using System;
using System.Collections.Generic;
namespace Graph
{
public class Vertex
{
private bool hasLabel;
private string label;
public Vertex ()
{
this.hasLabel = false;
}
public Vertex (string label)
{
this.Label = label;
}
// XXXX: Remind self how to link to private field?
public bool HasLabel
{
get;
set;
}
public string Label
{
get
{
if (!this.hasLabel)
{
throw NoLabelFoundException("This vertex is unlabeled.");
}
return this.label;
}
set
{
this.label = value;
this.hasLabel = true;
}
}
public void ClearLabel ()
{
this.hasLabel = false;
}
public class NoLabelFoundException : Exception
{
}
}
public class Edge
{
// All Edge objects correspond to a directed (unidirectional) graph edge.
//
// An undirected edge should be represented using a pair of such (directed)
// Edges.
//
// Under this system, loops and multigraphs are also automatically supported.
//
// Edges are Immutable after creation.
private Vertex tail;
private Vertex head;
public Edge (Vertex tail, Vertex head)
{
this.tail = tail;
this.head = head;
}
public Vertex Tail
{
get;
}
public Vertex Head
{
get;
}
}
public class Graph
{
private HashSet<Graph.Vertex> vertices;
private HashSet<Graph.Edge> edges;
public Graph ()
{
}
// Use 0-based labeling by default for vertices added without an explicit label.
//
// If the auto-generated label is already in use, keep searching upward until we find the first integer
// not taken for this purpose.
public void AddVertex ()
{
}
public void AddVertex (int label)
{
this.vertices.Add (new Graph.Vertex((string) label));
}
public void AddVertex (string label)
{
}
// Add an edge using labels of existing vertices.
public void AddDirectedEdge(string tailLabel, string headLabel)
{
}
// Add an edge using two Vertex objects.
public void AddUndirectedEdge(string label1, string label2)
{
this.AddDirectedEdge (label1, label2);
this.AddDirectedEdge (label2, label1);
}
public void AddLoop(string label)
{
this.AddDirectedEdge (label, label);
}
}
| using System;
using System.Collections.Generic;
namespace Graph
{
public class Vertex
{
private bool hasLabel;
private string label;
public Vertex ()
{
this.hasLabel = false;
}
public Vertex (string label)
{
this.Label = label;
}
// XXXX: Remind self how to link to private field?
public bool HasLabel
{
get;
set;
}
public string Label
{
get
{
if (!this.hasLabel)
{
throw NoLabelFoundException("This vertex is unlabeled.");
}
return this.label;
}
set
{
this.label = value;
this.hasLabel = true;
}
}
public void ClearLabel ()
{
this.hasLabel = false;
}
public class NoLabelFoundException : Exception
{
}
}
public class Edge
{
// All Edge objects correspond to a directed (unidirectional) graph edge.
//
// An undirected edge should be represented using a pair of such (directed)
// Edges.
//
// Under this system, loops and multigraphs are also automatically supported.
//
// Edges are Immutable after creation.
private Vertex tail;
private Vertex head;
public Edge (Vertex tail, Vertex head)
{
this.tail = tail;
this.head = head;
}
public Vertex Tail
{
get;
}
public Vertex Head
{
get;
}
}
public class Graph
{
private HashSet<Graph.Vertex> vertices;
private HashSet<Graph.Edge> edges;
public Graph ()
{
}
// Use 0-based labeling by default for vertices added without an explicit label.
//
// If the auto-generated label is already in use, keep searching upward until we find the first integer
// not taken for this purpose.
public void AddVertex ()
{
}
public void AddVertex (int label)
{
this.vertices.Add (new Graph.Vertex((string) label));
}
public void AddVertex (string label)
{
}
// Add an edge using labels of existing vertices.
public void AddDirectedEdge(string tailLabel, string headLabel)
{
}
// Add an edge using two Vertex objects.
public void AddUndirectedEdge(string label1, string label2)
{
this.AddDirectedEdge (label1, label2);
this.AddDirectedEdge (label2, label1);
}
}
| apache-2.0 | C# |
f7ec23f7caaf09d710a9cc731baf71621166ea49 | Update _Layout.cshtml | Telerik-Hackathon-2014/YourFood-WebAPI,Telerik-Hackathon-2014/YourFood-WebAPI | YourFood.Services/Views/Shared/_Layout.cshtml | YourFood.Services/Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("YourFood", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
<li><a href="https://github.com/Telerik-Hackathon-2014/YourFood-WebAPI/wiki/Routes" target="_blank">API</a></li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("YourFood", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
<li>@Html.ActionLink("API", "Index", "Help", new { area = "" }, null)</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
| mit | C# |
1565bd4a6a3de9309bdd4ce9f30a40776dc9a348 | use default options | SimonCropp/NServiceBus.Jil | NServiceBus.Jil/JsonMessageSerializer.cs | NServiceBus.Jil/JsonMessageSerializer.cs | namespace NServiceBus.Jil
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using global::Jil;
using NServiceBus.Serialization;
/// <summary>
/// JSON message serializer.
/// </summary>
public class JsonMessageSerializer : IMessageSerializer
{
/// <summary>
/// Constructor.
/// </summary>
public JsonMessageSerializer()
{
Options = JSON.GetDefaultOptions();
}
/// <summary>
/// Serializes the given set of messages into the given stream.
/// </summary>
/// <param name="message">Message to serialize.</param>
/// <param name="stream">Stream for <paramref name="message"/> to be serialized into.</param>
public void Serialize(object message, Stream stream)
{
var streamWriter = new StreamWriter(stream);
JSON.Serialize(message, streamWriter, Options);
streamWriter.Flush();
}
/// <summary>
/// Deserializes from the given stream a set of messages.
/// </summary>
/// <param name="stream">Stream that contains messages.</param>
/// <param name="messageTypes">The list of message types to deserialize. If null the types must be inferred from the serialized data.</param>
/// <returns>Deserialized messages.</returns>
public object[] Deserialize(Stream stream, IList<Type> messageTypes)
{
if (messageTypes.Count > 1)
{
throw new Exception("Batch messages are not supported. Feel free to send a Pull Request.");
}
var streamReader = new StreamReader(stream);
return new[]
{
JSON.Deserialize(streamReader, messageTypes.First(), Options)
};
}
/// <summary>
/// Gets the content type into which this serializer serializes the content to
/// </summary>
public string ContentType
{
get { return ContentTypes.Json; }
}
public Options Options { get; set; }
}
} | namespace NServiceBus.Jil
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using global::Jil;
using NServiceBus.Serialization;
/// <summary>
/// JSON message serializer.
/// </summary>
public class JsonMessageSerializer : IMessageSerializer
{
/// <summary>
/// Constructor.
/// </summary>
public JsonMessageSerializer()
{
Options = new Options();
}
/// <summary>
/// Serializes the given set of messages into the given stream.
/// </summary>
/// <param name="message">Message to serialize.</param>
/// <param name="stream">Stream for <paramref name="message"/> to be serialized into.</param>
public void Serialize(object message, Stream stream)
{
var streamWriter = new StreamWriter(stream);
JSON.Serialize(message, streamWriter, Options);
streamWriter.Flush();
}
/// <summary>
/// Deserializes from the given stream a set of messages.
/// </summary>
/// <param name="stream">Stream that contains messages.</param>
/// <param name="messageTypes">The list of message types to deserialize. If null the types must be inferred from the serialized data.</param>
/// <returns>Deserialized messages.</returns>
public object[] Deserialize(Stream stream, IList<Type> messageTypes)
{
if (messageTypes.Count > 1)
{
throw new Exception("Batch messages are not supported. Feel free to send a Pull Request.");
}
var streamReader = new StreamReader(stream);
return new[]
{
JSON.Deserialize(streamReader, messageTypes.First(), Options)
};
}
/// <summary>
/// Gets the content type into which this serializer serializes the content to
/// </summary>
public string ContentType
{
get { return ContentTypes.Json; }
}
public Options Options { get; set; }
}
} | mit | C# |
b3ebd76707f5eda6c7bbcd099b8b9b7c99356c45 | bump version to 2.10.0 | piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker | Piwik.Tracker/Properties/AssemblyInfo.cs | Piwik.Tracker/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.10.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.9.1")]
| bsd-3-clause | C# |
7e2acb7c3153ec45e031f76d7de7fb54448f244c | use object pointer instead of context reference | hahoyer/reni.cs,hahoyer/reni.cs,hahoyer/reni.cs | src/reni2/Struct/AccessFeature.cs | src/reni2/Struct/AccessFeature.cs | using System;
using System.Collections.Generic;
using System.Linq;
using hw.Debug;
using hw.Helper;
using Reni.Basics;
using Reni.Feature;
using Reni.ReniSyntax;
using Reni.TokenClasses;
using Reni.Type;
namespace Reni.Struct
{
sealed class AccessFeature
: DumpableObject
, IFeatureImplementation
, ISimpleFeature
{
static int _nextObjectId;
internal AccessFeature(CompoundView compoundView, int position)
: base(_nextObjectId++)
{
View = compoundView;
Position = position;
FunctionFeature = new ValueCache<IFunctionFeature>(ObtainFunctionFeature);
}
[EnableDump]
public CompoundView View { get; }
[EnableDump]
public int Position { get; }
ValueCache<IFunctionFeature> FunctionFeature { get; }
IContextMetaFunctionFeature IFeatureImplementation.ContextMeta
=> (Statement as FunctionSyntax)?.ContextMetaFunctionFeature(View);
IMetaFunctionFeature IFeatureImplementation.Meta => (Statement as FunctionSyntax)?.MetaFunctionFeature(View);
IFunctionFeature IFeatureImplementation.Function => FunctionFeature.Value;
ISimpleFeature IFeatureImplementation.Simple
{
get
{
var function = FunctionFeature.Value;
if(function != null && function.IsImplicit)
return null;
return this;
}
}
Result ISimpleFeature.Result(Category category) => View
.AccessViaObjectPointer(category, Position);
TypeBase ISimpleFeature.TargetType => View.Type;
CompileSyntax Statement => View
.Compound
.Syntax
.Statements[Position];
IFunctionFeature ObtainFunctionFeature()
{
var functionSyntax = Statement as FunctionSyntax;
if(functionSyntax != null)
return functionSyntax.FunctionFeature(View);
return View.ValueType(Position).CheckedFeature?.Function;
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using hw.Debug;
using hw.Helper;
using Reni.Basics;
using Reni.Feature;
using Reni.ReniSyntax;
using Reni.TokenClasses;
using Reni.Type;
namespace Reni.Struct
{
sealed class AccessFeature
: DumpableObject
, IFeatureImplementation
, ISimpleFeature
{
static int _nextObjectId;
internal AccessFeature(CompoundView compoundView, int position)
: base(_nextObjectId++)
{
View = compoundView;
Position = position;
FunctionFeature = new ValueCache<IFunctionFeature>(ObtainFunctionFeature);
}
[EnableDump]
public CompoundView View { get; }
[EnableDump]
public int Position { get; }
ValueCache<IFunctionFeature> FunctionFeature { get; }
IContextMetaFunctionFeature IFeatureImplementation.ContextMeta
=> (Statement as FunctionSyntax)?.ContextMetaFunctionFeature(View);
IMetaFunctionFeature IFeatureImplementation.Meta => (Statement as FunctionSyntax)?.MetaFunctionFeature(View);
IFunctionFeature IFeatureImplementation.Function => FunctionFeature.Value;
ISimpleFeature IFeatureImplementation.Simple
{
get
{
var function = FunctionFeature.Value;
if(function != null && function.IsImplicit)
return null;
return this;
}
}
Result ISimpleFeature.Result(Category category) => View
.AccessViaContext(category, Position);
TypeBase ISimpleFeature.TargetType => View.Type;
CompileSyntax Statement => View
.Compound
.Syntax
.Statements[Position];
IFunctionFeature ObtainFunctionFeature()
{
var functionSyntax = Statement as FunctionSyntax;
if(functionSyntax != null)
return functionSyntax.FunctionFeature(View);
return View.ValueType(Position).CheckedFeature?.Function;
}
}
} | mit | C# |
a218354fadc8860a185319620c6617e041d22704 | Bring assembly version up to date with tag | sbennett1990/signify.cs | SignifyCS/Properties/AssemblyInfo.cs | SignifyCS/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("SignifyCS")]
[assembly: AssemblyDescription("Verify messages signed with signify")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright (c) 2017 Scott Bennett")]
[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("0b1df081-3b2e-4c1a-8582-78cf9334883b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.*")]
[assembly: AssemblyFileVersion("0.7.*")]
| 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("SignifyCS")]
[assembly: AssemblyDescription("Verify messages signed with signify")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright (c) 2017 Scott Bennett")]
[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("0b1df081-3b2e-4c1a-8582-78cf9334883b")]
// 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.5.*")]
[assembly: AssemblyFileVersion("0.5.*")]
| isc | C# |
ff48aa4cd996e138273991e756b20063ff93929d | make link_domain optional in mock api | sailthru/sailthru-net-client | Sailthru/Sailthru.Tests/Mock/BlastApi.cs | Sailthru/Sailthru.Tests/Mock/BlastApi.cs | using System;
using System.Collections.Generic;
using System.Threading;
using Newtonsoft.Json.Linq;
namespace Sailthru.Tests.Mock
{
public static class BlastApi
{
private static int currentId = 1000;
public static object ProcessPost(JObject request)
{
int blastId = Interlocked.Increment(ref currentId);
string name = request["name"].Value<string>();
string subject = request["subject"].Value<string>();
string list = request["list"].Value<string>();
string modifyTime = DateTime.Now.ToLocalTime().ToString("ddd, dd MMM yyyy HH:mm:ss zzz");
string status = "created";
string linkDomain = (string)request["link_domain"];
if (request.ContainsKey("schedule_time"))
{
status = "scheduled";
}
return new Dictionary<string, object>
{
["blast_id"] = blastId,
["name"] = name,
["subject"] = subject,
["list"] = list,
["modify_time"] = modifyTime,
["link_domain"] = linkDomain,
["status"] = status
};
}
}
}
| using System;
using System.Collections.Generic;
using System.Threading;
using Newtonsoft.Json.Linq;
namespace Sailthru.Tests.Mock
{
public static class BlastApi
{
private static int currentId = 1000;
public static object ProcessPost(JObject request)
{
int blastId = Interlocked.Increment(ref currentId);
string name = request["name"].Value<string>();
string subject = request["subject"].Value<string>();
string list = request["list"].Value<string>();
string linkDomain = request["link_domain"].Value<string>();
string modifyTime = DateTime.Now.ToLocalTime().ToString("ddd, dd MMM yyyy HH:mm:ss zzz");
string status = "created";
if (request.ContainsKey("schedule_time"))
{
status = "scheduled";
}
return new Dictionary<string, object>
{
["blast_id"] = blastId,
["name"] = name,
["subject"] = subject,
["list"] = list,
["modify_time"] = modifyTime,
["link_domain"] = linkDomain,
["status"] = status
};
}
}
}
| mit | C# |
9a22b9cbbfd26f4b64be530ea43e7eccaf18d912 | correct base controller check | asadsahi/AspNetCoreSpa,asadsahi/AspNetCoreSpa,asadsahi/AspNetCoreSpa,asadsahi/AspNetCoreSpa | Server/Controllers/api/BaseController.cs | Server/Controllers/api/BaseController.cs | using AspNetCoreSpa.Server.Entities;
using AspNetCoreSpa.Server.Filters;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
namespace AspNetCoreSpa.Server.Controllers.api
{
[Authorize]
[ServiceFilter(typeof(ApiExceptionFilter))]
[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
public class BaseController : Controller
{
public BaseController()
{
}
public IActionResult Render(ExternalLoginStatus status = ExternalLoginStatus.Ok)
{
if (status == ExternalLoginStatus.Ok)
{
return LocalRedirect("~/");
}
return LocalRedirect($"~/?externalLoginStatus={(int)status}");
// return RedirectToAction("Index", "Home", new { externalLoginStatus = (int)status });
}
}
}
| using AspNetCoreSpa.Server.Entities;
using AspNetCoreSpa.Server.Filters;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
namespace AspNetCoreSpa.Server.Controllers.api
{
[Authorize]
[ServiceFilter(typeof(ApiExceptionFilter))]
[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
public class BaseController : Controller
{
public BaseController()
{
}
public IActionResult Render(ExternalLoginStatus status = ExternalLoginStatus.Ok)
{
if (status != ExternalLoginStatus.Ok)
{
return LocalRedirect("~/");
}
return LocalRedirect($"~/?externalLoginStatus={(int)status}");
// return RedirectToAction("Index", "Home", new { externalLoginStatus = (int)status });
}
}
}
| mit | C# |
1c5e2d2832b13fd9b60e46c430a77c4084e80357 | Update PerlinNoiseTurbulenceShaderView.xaml.cs | wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D | src/Draw2D/Views/Style/Shaders/PerlinNoiseTurbulenceShaderView.xaml.cs | src/Draw2D/Views/Style/Shaders/PerlinNoiseTurbulenceShaderView.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 Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Draw2D.Views.Style.Shaders
{
public class PerlinNoiseTurbulenceShaderView : UserControl
{
public PerlinNoiseTurbulenceShaderView()
{
InitializeComponent();
}
private void InitializeComponent()
{
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 Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Draw2D.Views.Style.Shaders
{
public class Path1DPathEffectView : UserControl
{
public Path1DPathEffectView()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| mit | C# |
1cdcbd658efcd9771769d3277cf442a482527086 | Remove not needed code | zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype | src/Glimpse.Agent.Connection.Http/Broker/RemoteHttpMessagePublisher.cs | src/Glimpse.Agent.Connection.Http/Broker/RemoteHttpMessagePublisher.cs | using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace Glimpse.Agent
{
public class RemoteHttpMessagePublisher : IMessagePublisher, IDisposable
{
private readonly HttpClient _httpClient;
private readonly HttpClientHandler _httpHandler;
public RemoteHttpMessagePublisher()
{
_httpHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpHandler);
}
public void PublishMessage(IMessage message)
{
var content = new StringContent("Hello");
// TODO: Try shifting to async and await
_httpClient.PostAsync("http://localhost:15999/Glimpse/Agent", content)
.ContinueWith(requestTask =>
{
// Get HTTP response from completed task.
HttpResponseMessage response = requestTask.Result;
// Check that response was successful or throw exception
response.EnsureSuccessStatusCode();
// Read response asynchronously as JsonValue and write out top facts for each country
var result = response.Content.ReadAsStringAsync().Result;
});
}
public void Dispose()
{
_httpClient.Dispose();
_httpHandler.Dispose();
}
}
} | using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace Glimpse.Agent
{
public class RemoteHttpMessagePublisher : IMessagePublisher, IDisposable
{
private readonly HttpClient _httpClient;
private readonly HttpClientHandler _httpHandler;
public RemoteHttpMessagePublisher()
{
_httpHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpHandler);
}
public void PublishMessage(IMessage message)
{
var content = new StringContent("Hello");
// TODO: Try shifting to async and await
_httpClient.PostAsync("http://localhost:15999/Glimpse/Agent", content)
.ContinueWith(requestTask =>
{
// Get HTTP response from completed task.
HttpResponseMessage response = requestTask.Result;
// Check that response was successful or throw exception
response.EnsureSuccessStatusCode();
// Read response asynchronously as JsonValue and write out top facts for each country
var result = response.Content.ReadAsStringAsync().Result;
/*
response.Content.ReadAsAsync<string>().ContinueWith(readTask =>
{
var result = readTask.Result;
});
*/
});
}
public void Dispose()
{
_httpClient.Dispose();
_httpHandler.Dispose();
}
}
} | mit | C# |
6439eb0750a7f869d57ab5e9d959fff792afe1ae | fix typo | antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4,antlr/grammars-v4 | golang/CSharp/GoParserBase.cs | golang/CSharp/GoParserBase.cs | using System;
using System.Collections.Generic;
using System.IO;
using Antlr4.Runtime;
public abstract class GoParserBase : Parser
{
protected GoParserBase(ITokenStream input)
: base(input)
{
}
protected GoParserBase(ITokenStream input, TextWriter output, TextWriter errorOutput)
: base(input, output, errorOutput)
{
}
protected bool closingBracket()
{
int la = tokenStream.LA(1);
return la == GoLexer.R_PAREN || la == GoLexer.R_CURLY;
}
private ITokenStream tokenStream
{
get
{
return TokenStream;
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using Antlr4.Runtime;
public abstract class GoParserBase : Parser
{
protected GoParserBase(ITokenStream input)
: base(input)
{
}
protected GoParserBase(ITokenStream input, TextWriter output, TextWriter errorOutput)
: base(input, output, errorOutput)
{
}
protected bool closingBrackets()
{
int la = tokenStream.LA(1);
return la == GoLexer.R_PAREN || la == GoLexer.R_CURLY;
}
private ITokenStream tokenStream
{
get
{
return TokenStream;
}
}
}
| mit | C# |
5a34796463f818868bab3acabf8c6e0e968a970a | Remove reference to UseDefaultHostingConfiguration | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | test/WebSites/CorsMiddlewareWebSite/Startup.cs | test/WebSites/CorsMiddlewareWebSite/Startup.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace CorsMiddlewareWebSite
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
}
public void Configure(IApplicationBuilder app)
{
app.UseCors(policy => policy.WithOrigins("http://example.com"));
app.UseMiddleware<EchoMiddleware>();
}
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
} | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace CorsMiddlewareWebSite
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
}
public void Configure(IApplicationBuilder app)
{
app.UseCors(policy => policy.WithOrigins("http://example.com"));
app.UseMiddleware<EchoMiddleware>();
}
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseDefaultHostingConfiguration(args)
.UseKestrel()
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
} | apache-2.0 | C# |
3684f4367c28988c87fa5aaa4889133dcee811aa | change version to v3.2.2 | shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,shabtaisharon/ds3_net_sdk,SpectraLogic/ds3_net_sdk,RachelTucker/ds3_net_sdk | VersionInfo.cs | VersionInfo.cs | /*
* ******************************************************************************
* Copyright 2014-2016 Spectra Logic Corporation. 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. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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;
// 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("3.3.2.0")]
[assembly: AssemblyFileVersion("3.3.2.0")]
| /*
* ******************************************************************************
* Copyright 2014-2016 Spectra Logic Corporation. 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. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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;
// 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("3.3.1.0")]
[assembly: AssemblyFileVersion("3.3.1.0")]
| apache-2.0 | C# |
ee504002352ff6cf901aa3828ca5672e111ebb87 | Update crefs (#2087) | JamesNK/Newtonsoft.Json,jkorell/Newtonsoft.Json,TylerBrinkley/Newtonsoft.Json,PKRoma/Newtonsoft.Json,ze-pequeno/Newtonsoft.Json,oxwanawxo/Newtonsoft.Json | Src/Newtonsoft.Json/DateParseHandling.cs | Src/Newtonsoft.Json/DateParseHandling.cs | #region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
namespace Newtonsoft.Json
{
/// <summary>
/// Specifies how date formatted strings, e.g. <c>"\/Date(1198908717056)\/"</c> and <c>"2012-03-21T05:40Z"</c>, are parsed when reading JSON text.
/// </summary>
public enum DateParseHandling
{
/// <summary>
/// Date formatted strings are not parsed to a date type and are read as strings.
/// </summary>
None = 0,
/// <summary>
/// Date formatted strings, e.g. <c>"\/Date(1198908717056)\/"</c> and <c>"2012-03-21T05:40Z"</c>, are parsed to <see cref="System.DateTime"/>.
/// </summary>
DateTime = 1,
#if HAVE_DATE_TIME_OFFSET
/// <summary>
/// Date formatted strings, e.g. <c>"\/Date(1198908717056)\/"</c> and <c>"2012-03-21T05:40Z"</c>, are parsed to <see cref="System.DateTimeOffset"/>.
/// </summary>
DateTimeOffset = 2
#endif
}
}
| #region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
namespace Newtonsoft.Json
{
/// <summary>
/// Specifies how date formatted strings, e.g. <c>"\/Date(1198908717056)\/"</c> and <c>"2012-03-21T05:40Z"</c>, are parsed when reading JSON text.
/// </summary>
public enum DateParseHandling
{
/// <summary>
/// Date formatted strings are not parsed to a date type and are read as strings.
/// </summary>
None = 0,
/// <summary>
/// Date formatted strings, e.g. <c>"\/Date(1198908717056)\/"</c> and <c>"2012-03-21T05:40Z"</c>, are parsed to <see cref="DateTime"/>.
/// </summary>
DateTime = 1,
#if HAVE_DATE_TIME_OFFSET
/// <summary>
/// Date formatted strings, e.g. <c>"\/Date(1198908717056)\/"</c> and <c>"2012-03-21T05:40Z"</c>, are parsed to <see cref="DateTimeOffset"/>.
/// </summary>
DateTimeOffset = 2
#endif
}
} | mit | C# |
2d0750d480826c24d4cf274f07e6b736bbab1482 | fix docs example with new Akka.IO | ali-ince/akka.net,amichel/akka.net,heynickc/akka.net,amichel/akka.net,ali-ince/akka.net,simonlaroche/akka.net,heynickc/akka.net,Silv3rcircl3/akka.net,Silv3rcircl3/akka.net,simonlaroche/akka.net | docs/examples/DocsExamples/Networking/IO/EchoConnection.cs | docs/examples/DocsExamples/Networking/IO/EchoConnection.cs | using Akka.Actor;
using Akka.IO;
using Akka.Util.Internal;
namespace DocsExamples.Networking.IO
{
public class EchoConnection : UntypedActor
{
private readonly IActorRef _connection;
public EchoConnection(IActorRef connection)
{
_connection = connection;
}
protected override void OnReceive(object message)
{
if (message is Tcp.Received)
{
var received = message as Tcp.Received;
if (received.Data[0] == 'x')
Context.Stop(Self);
else
_connection.Tell(Tcp.Write.Create(received.Data));
}
else Unhandled(message);
}
}
}
| using Akka.Actor;
using Akka.IO;
namespace DocsExamples.Networking.IO
{
public class EchoConnection : UntypedActor
{
private readonly IActorRef _connection;
public EchoConnection(IActorRef connection)
{
_connection = connection;
}
protected override void OnReceive(object message)
{
if (message is Tcp.Received)
{
var received = message as Tcp.Received;
if (received.Data.Head == 'x')
Context.Stop(Self);
else
_connection.Tell(Tcp.Write.Create(received.Data));
}
else Unhandled(message);
}
}
}
| apache-2.0 | C# |
e6e43c0328131dcc56ae404718f3ef539ac945cd | Add TracingService | KpdApps/KpdApps.Common.MsCrm2015 | PluginState.cs | PluginState.cs | using System;
using Microsoft.Xrm.Sdk;
namespace KpdApps.Common.MsCrm2015
{
public class PluginState
{
public virtual IServiceProvider Provider { get; private set; }
private IPluginExecutionContext _context;
public virtual IPluginExecutionContext Context => _context ?? (_context = (IPluginExecutionContext)Provider.GetService(typeof(IPluginExecutionContext)));
private IOrganizationService _service;
public virtual IOrganizationService Service
{
get
{
if (_service != null)
return _service;
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)Provider.GetService(typeof(IOrganizationServiceFactory));
_service = factory.CreateOrganizationService(this.Context.UserId);
return _service;
}
}
private ITracingService _tracingService;
public virtual ITracingService TracingService
{
get
{
if (_tracingService != null)
return _tracingService;
_tracingService = (ITracingService)Provider.GetService(typeof(ITracingService));
return _tracingService;
}
}
public PluginState(IServiceProvider provider)
{
if (provider == null)
throw new ArgumentNullException(nameof(provider));
Provider = provider;
}
public T GetTarget<T>() where T : class
{
if (Context.InputParameters.Contains("Target"))
{
return (T)Context.InputParameters["Target"];
}
return default(T); ;
}
}
}
| using System;
using Microsoft.Xrm.Sdk;
namespace KpdApps.Common.MsCrm2015
{
public class PluginState
{
private IOrganizationService _service;
private IPluginExecutionContext _context;
public virtual IServiceProvider Provider { get; private set; }
public virtual IPluginExecutionContext Context => _context ?? (_context = (IPluginExecutionContext)Provider.GetService(typeof(IPluginExecutionContext)));
public virtual IOrganizationService Service
{
get
{
if (_service != null)
return _service;
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)Provider.GetService(typeof(IOrganizationServiceFactory));
_service = factory.CreateOrganizationService(this.Context.UserId);
return _service;
}
}
public PluginState(IServiceProvider provider)
{
if (provider == null)
throw new ArgumentNullException(nameof(provider));
Provider = provider;
}
public T GetTarget<T>() where T : class
{
if (Context.InputParameters.Contains("Target"))
{
return (T)Context.InputParameters["Target"];
}
return default(T); ;
}
}
}
| mit | C# |
bdab39f5c798005f930514a12f817597b43c39e3 | change player Age type from double to int | Team-LemonDrop/NBA-Statistics | NBAStatistics.Data.FillMongoDB/Models/Player.cs | NBAStatistics.Data.FillMongoDB/Models/Player.cs | using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace NBAStatistics.Data.FillMongoDB.Models
{
public class Player : IEntity
{
public Player(
int teamId,
string season,
string leagueId,
string playerName,
string num,
string position,
string height,
string weight,
string birthDate,
int age,
string exp,
string school,
int playerId)
{
this.TeamId = teamId;
this.Season = season;
this.LeagueId = leagueId;
this.PlayerName = playerName;
this.Num = num;
this.Position = position;
this.Height = height;
this.Weight = weight;
this.BirthDate = birthDate;
this.Age = age;
this.Exp = exp;
this.School = school;
this.PlayerId = playerId;
}
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
[BsonIgnoreIfDefault]
public string Id { get; set; }
[BsonRepresentation(BsonType.Int32)]
public int TeamId { get; private set; }
public string Season { get; private set; }
public string LeagueId { get; private set; }
public string PlayerName { get; private set; }
public string Num { get; private set; }
public string Position { get; private set; }
public string Height { get; private set; }
public string Weight { get; private set; }
public string BirthDate { get; private set; }
[BsonRepresentation(BsonType.Int32)]
public int Age { get; private set; }
public string Exp { get; private set; }
public string School { get; private set; }
[BsonRepresentation(BsonType.Int32)]
public int PlayerId { get; private set; }
}
}
| using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace NBAStatistics.Data.FillMongoDB.Models
{
public class Player : IEntity
{
public Player(
int teamId,
string season,
string leagueId,
string playerName,
string num,
string position,
string height,
string weight,
string birthDate,
double age,
string exp,
string school,
int playerId)
{
this.TeamId = teamId;
this.Season = season;
this.LeagueId = leagueId;
this.PlayerName = playerName;
this.Num = num;
this.Position = position;
this.Height = height;
this.Weight = weight;
this.BirthDate = birthDate;
this.Age = age;
this.Exp = exp;
this.School = school;
this.PlayerId = playerId;
}
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
[BsonIgnoreIfDefault]
public string Id { get; set; }
[BsonRepresentation(BsonType.Int32)]
public int TeamId { get; private set; }
public string Season { get; private set; }
public string LeagueId { get; private set; }
public string PlayerName { get; private set; }
public string Num { get; private set; }
public string Position { get; private set; }
public string Height { get; private set; }
public string Weight { get; private set; }
public string BirthDate { get; private set; }
public double Age { get; private set; }
public string Exp { get; private set; }
public string School { get; private set; }
[BsonRepresentation(BsonType.Int32)]
public int PlayerId { get; private set; }
}
}
| mit | C# |
47d35f3ecae397cb51672afd6f2079c8694eb72d | Update QuadraticBezierSegment.cs | Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D/ViewModels/Shapes/Path/Segments/QuadraticBezierSegment.cs | src/Core2D/ViewModels/Shapes/Path/Segments/QuadraticBezierSegment.cs | using System;
using System.Collections.Generic;
using Core2D.Shapes;
namespace Core2D.Path.Segments
{
/// <summary>
/// Quadratic bezier path segment.
/// </summary>
public class QuadraticBezierSegment : PathSegment, IQuadraticBezierSegment
{
private IPointShape _point1;
private IPointShape _point2;
/// <inheritdoc/>
public IPointShape Point1
{
get => _point1;
set => Update(ref _point1, value);
}
/// <inheritdoc/>
public IPointShape Point2
{
get => _point2;
set => Update(ref _point2, value);
}
/// <inheritdoc/>
public override IEnumerable<IPointShape> GetPoints()
{
yield return Point1;
yield return Point2;
}
/// <inheritdoc/>
public override object Copy(IDictionary<object, object> shared)
{
throw new NotImplementedException();
}
/// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns>A string that represents the current object.</returns>
public override string ToString() => $"Q{Point1} {Point2}";
/// <summary>
/// Check whether the <see cref="Point1"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializePoint1() => _point1 != null;
/// <summary>
/// Check whether the <see cref="Point2"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializePoint2() => _point2 != null;
}
}
| using System;
using System.Collections.Generic;
using Core2D.Shapes;
namespace Core2D.Path.Segments
{
/// <summary>
/// Quadratic bezier path segment.
/// </summary>
public class QuadraticBezierSegment : PathSegment, IQuadraticBezierSegment
{
private IPointShape _point1;
private IPointShape _point2;
/// <inheritdoc/>
public IPointShape Point1
{
get => _point1;
set => Update(ref _point1, value);
}
/// <inheritdoc/>
public IPointShape Point2
{
get => _point2;
set => Update(ref _point2, value);
}
/// <inheritdoc/>
public override IEnumerable<IPointShape> GetPoints()
{
yield return Point1;
yield return Point2;
}
/// <inheritdoc/>
public override object Copy(IDictionary<object, object> shared)
{
throw new NotImplementedException();
}
/// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns>A string that represents the current object.</returns>
public override string ToString() => string.Format("Q{1}{0}{2}", " ", Point1, Point2);
/// <summary>
/// Check whether the <see cref="Point1"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializePoint1() => _point1 != null;
/// <summary>
/// Check whether the <see cref="Point2"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializePoint2() => _point2 != null;
}
}
| mit | C# |
a140440196eda89710e44f18b5d884b07476e260 | Add `AssemblyCompany`, `AssemblyCopyright` and `AssemblyProduct` attributes to the assembly. | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNet.Mvc.Razor.Host.VSRC1/Properties/AssemblyInfo.cs | src/Microsoft.AspNet.Mvc.Razor.Host.VSRC1/Properties/AssemblyInfo.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: NeutralResourcesLanguage("en-us")]
[assembly: AssemblyCompany("Microsoft Corporation.")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyProduct("Microsoft ASP.NET Core")] | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: NeutralResourcesLanguage("en-us")] | apache-2.0 | C# |
620e503371b4a31974fd438e18e45fc623b823bb | Replace Xna's Clamp method with our own. | izrik/ChamberLib,izrik/ChamberLib,izrik/ChamberLib | ChamberLib/MathHelper.cs | ChamberLib/MathHelper.cs | using System;
namespace ChamberLib
{
public static class MathHelper
{
public static int RoundToInt(this float x)
{
return (int)Math.Round(x);
}
public static float ToRadians(this float degrees)
{
return degrees * 0.01745329251994f; // pi / 180
}
public static float ToDegrees( this float radians)
{
return radians * 57.2957795130823f; // 180 / pi
}
public static float Clamp(this float value, float min, float max)
{
if (value > max)
return max;
if (value < min)
return min;
return value;
}
}
}
| using System;
namespace ChamberLib
{
public static class MathHelper
{
public static int RoundToInt(this float x)
{
return (int)Math.Round(x);
}
public static float ToRadians(this float degrees)
{
return degrees * 0.01745329251994f; // pi / 180
}
public static float ToDegrees( this float radians)
{
return radians * 57.2957795130823f; // 180 / pi
}
public static float Clamp(this float value, float min, float max)
{
return Math.Max(Math.Min(value, max), min);
}
}
}
| lgpl-2.1 | C# |
8c553b535e6b763ce0d05d8e92844478f066e547 | add transaction to uow | generik0/Smooth.IoC.Dapper.Repository.UnitOfWork,generik0/Smooth.IoC.Dapper.Repository.UnitOfWork | src/Smooth.IoC.Dapper.Repository.UnitOfWork/Repo/RepositoryGetAll.cs | src/Smooth.IoC.Dapper.Repository.UnitOfWork/Repo/RepositoryGetAll.cs | using System.Collections.Generic;
using System.Threading.Tasks;
using Dapper;
using Dapper.FastCrud;
using Smooth.IoC.Dapper.Repository.UnitOfWork.Data;
using static Dapper.FastCrud.Sql;
namespace Smooth.IoC.Dapper.Repository.UnitOfWork.Repo
{
public abstract partial class Repository<TEntity, TPk>
where TEntity : class
{
public IEnumerable<TEntity> GetAll(ISession session)
{
var enumerable = session.Query<TEntity>($"SELECT * FROM {Table<TEntity>()}");
return IsIEntity() ?
enumerable
: session.Find<TEntity>();
}
public IEnumerable<TEntity> GetAll(IUnitOfWork uow)
{
return IsIEntity() ?
uow.Connection.Query<TEntity>($"SELECT * FROM {Table<TEntity>()}", transaction: uow.Transaction)
: uow.Find<TEntity>();
}
public IEnumerable<TEntity> GetAll<TSesssion>() where TSesssion : class, ISession
{
using (var session = Factory.Create<TSesssion>())
{
return GetAll(session);
}
}
public async Task<IEnumerable<TEntity>> GetAllAsync(ISession session)
{
return IsIEntity() ?
await session.QueryAsync<TEntity>($"SELECT * FROM {Table<TEntity>()}")
: await session.FindAsync<TEntity>();
}
public async Task<IEnumerable<TEntity>> GetAllAsync(IUnitOfWork uow)
{
return IsIEntity() ?
await uow.Connection.QueryAsync<TEntity>($"SELECT * FROM {Table<TEntity>()}",transaction: uow.Transaction)
: await uow.FindAsync<TEntity>();
}
public Task<IEnumerable<TEntity>> GetAllAsync<TSesssion>() where TSesssion : class, ISession
{
using (var session = Factory.Create<TSesssion>())
{
return GetAllAsync(session);
}
}
}
}
| using System.Collections.Generic;
using System.Threading.Tasks;
using Dapper;
using Dapper.FastCrud;
using Smooth.IoC.Dapper.Repository.UnitOfWork.Data;
using static Dapper.FastCrud.Sql;
namespace Smooth.IoC.Dapper.Repository.UnitOfWork.Repo
{
public abstract partial class Repository<TEntity, TPk>
where TEntity : class
{
public IEnumerable<TEntity> GetAll(ISession session)
{
return IsIEntity() ?
session.Query<TEntity>($"SELECT * FROM {Table<TEntity>()}")
: session.Find<TEntity>();
}
public IEnumerable<TEntity> GetAll(IUnitOfWork uow)
{
return IsIEntity() ?
uow.Connection.Query<TEntity>($"SELECT * FROM {Table<TEntity>()}", transaction: uow)
: uow.Find<TEntity>();
}
public IEnumerable<TEntity> GetAll<TSesssion>() where TSesssion : class, ISession
{
using (var session = Factory.Create<TSesssion>())
{
return GetAll(session);
}
}
public async Task<IEnumerable<TEntity>> GetAllAsync(ISession session)
{
return IsIEntity() ?
await session.QueryAsync<TEntity>($"SELECT * FROM {Table<TEntity>()}")
: await session.FindAsync<TEntity>();
}
public async Task<IEnumerable<TEntity>> GetAllAsync(IUnitOfWork uow)
{
return IsIEntity() ?
await uow.Connection.QueryAsync<TEntity>($"SELECT * FROM {Table<TEntity>()}",transaction: uow)
: await uow.FindAsync<TEntity>();
}
public Task<IEnumerable<TEntity>> GetAllAsync<TSesssion>() where TSesssion : class, ISession
{
using (var session = Factory.Create<TSesssion>())
{
return GetAllAsync(session);
}
}
}
}
| mit | C# |
833ddbe899a2879e12f06c69c88f71b0bac00626 | Fix broken build (#10541) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Servers/Kestrel/samples/PlaintextApp/Startup.cs | src/Servers/Kestrel/samples/PlaintextApp/Startup.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.IO.Pipelines;
using System.Net;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace PlaintextApp
{
public class Startup
{
private static readonly byte[] _helloWorldBytes = Encoding.UTF8.GetBytes("Hello, World!");
public void Configure(IApplicationBuilder app)
{
app.Run((httpContext) =>
{
var payload = _helloWorldBytes;
var response = httpContext.Response;
response.StatusCode = 200;
response.ContentType = "text/plain";
response.ContentLength = payload.Length;
return response.BodyWriter.WriteAsync(payload).GetAsTask();
});
}
public static Task Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel(options =>
{
options.Listen(IPAddress.Loopback, 5001);
})
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
return host.RunAsync();
}
}
internal static class ValueTaskExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Task GetAsTask(this in ValueTask<FlushResult> valueTask)
{
if (valueTask.IsCompletedSuccessfully)
{
// Signal consumption to the IValueTaskSource
valueTask.GetAwaiter().GetResult();
return Task.CompletedTask;
}
else
{
return valueTask.AsTask();
}
}
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.IO.Pipelines;
using System.Net;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace PlaintextApp
{
public class Startup
{
private static readonly byte[] _helloWorldBytes = Encoding.UTF8.GetBytes("Hello, World!");
public void Configure(IApplicationBuilder app)
{
app.Run((httpContext) =>
{
var payload = _helloWorldBytes;
var response = httpContext.Response;
response.StatusCode = 200;
response.ContentType = "text/plain";
response.ContentLength = payload.Length;
return response.BodyPipe.WriteAsync(payload).GetAsTask();
});
}
public static Task Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel(options =>
{
options.Listen(IPAddress.Loopback, 5001);
})
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
return host.RunAsync();
}
}
internal static class ValueTaskExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Task GetAsTask(this in ValueTask<FlushResult> valueTask)
{
if (valueTask.IsCompletedSuccessfully)
{
// Signal consumption to the IValueTaskSource
valueTask.GetAwaiter().GetResult();
return Task.CompletedTask;
}
else
{
return valueTask.AsTask();
}
}
}
}
| apache-2.0 | C# |
a9142409d646957a48c651af3d2923cf44a90a00 | Fix Zap mod dedicated server. | fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game | zap/main.cs | zap/main.cs | //------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2009, mEthLab Interactive
//------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Package overrides to initialize the mod.
package Zap {
function displayHelp()
{
Parent::displayHelp();
}
function parseArgs()
{
Parent::parseArgs();
}
function onStart()
{
echo("\n--------- Initializing MOD: Zap ---------");
exec("./server.cs");
Parent::onStart();
}
function onExit()
{
Parent::onExit();
}
}; // package Zap
activatePackage(Zap);
| //------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2009, mEthLab Interactive
//------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Package overrides to initialize the mod.
package Zap {
function displayHelp()
{
Parent::displayHelp();
}
function parseArgs()
{
Parent::parseArgs();
}
function onStart()
{
Parent::onStart();
echo("\n--------- Initializing MOD: Zap ---------");
exec("./server.cs");
}
function onExit()
{
Parent::onExit();
}
}; // package Zap
activatePackage(Zap);
| lgpl-2.1 | C# |
9622beab6001249818fc83d575b927c743f973dd | Fix compile warnings. (#200) | mono/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000 | tests/managed/structs.cs | tests/managed/structs.cs | using System;
#pragma warning disable 660 // 'Point' defines operator == or operator != but does not override Object.Equals(object o)
#pragma warning disable 661 // 'Point' defines operator == or operator != but does not override Object.GetHashCode()
namespace Structs {
public struct Point {
public static readonly Point Zero;
public Point (float x, float y)
{
X = x;
Y = y;
}
public float X { get; private set; }
public float Y { get; private set; }
public static bool operator == (Point left, Point right)
{
return ((left.X == right.X) && (left.Y == right.Y));
}
public static bool operator != (Point left, Point right)
{
return !(left == right);
}
public static Point operator + (Point left, Point right)
{
return new Point (left.X + right.X, left.Y + right.Y);
}
public static Point operator - (Point left, Point right)
{
return new Point (left.X - right.X, left.Y - right.Y);
}
}
}
| using System;
namespace Structs {
public struct Point {
public static readonly Point Zero;
public Point (float x, float y)
{
X = x;
Y = y;
}
public float X { get; private set; }
public float Y { get; private set; }
public static bool operator == (Point left, Point right)
{
return ((left.X == right.X) && (left.Y == right.Y));
}
public static bool operator != (Point left, Point right)
{
return !(left == right);
}
public static Point operator + (Point left, Point right)
{
return new Point (left.X + right.X, left.Y + right.Y);
}
public static Point operator - (Point left, Point right)
{
return new Point (left.X - right.X, left.Y - right.Y);
}
}
}
| mit | C# |
f587c58ec4c213d2072257d1d7d4adae242520ec | Improve keyframe (CssNode) | FlorianRappl/AngleSharp,zedr0n/AngleSharp.Local,AngleSharp/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,Livven/AngleSharp,zedr0n/AngleSharp.Local,Livven/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,Livven/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,FlorianRappl/AngleSharp,zedr0n/AngleSharp.Local | AngleSharp/Dom/Css/Selector/KeyframeSelector.cs | AngleSharp/Dom/Css/Selector/KeyframeSelector.cs | namespace AngleSharp.Dom.Css
{
using AngleSharp.Css;
using AngleSharp.Css.Values;
using System;
using System.Collections.Generic;
/// <summary>
/// Represents the keyframe selector.
/// </summary>
sealed class KeyframeSelector : CssNode, IKeyframeSelector
{
#region Fields
readonly List<Percent> _stops;
#endregion
#region ctor
public KeyframeSelector(List<Percent> stops)
{
_stops = stops;
}
#endregion
#region Properties
/// <summary>
/// Gets an enumeration over all stops.
/// </summary>
public IEnumerable<Percent> Stops
{
get { return _stops; }
}
/// <summary>
/// Gets the text representation of the keyframe selector.
/// </summary>
public String Text
{
get
{
var stops = new String[_stops.Count];
for (int i = 0; i < stops.Length; i++)
stops[i] = _stops[i].ToString();
return String.Join(", ", stops);
}
}
#endregion
}
}
| namespace AngleSharp.Dom.Css
{
using System;
using System.Collections.Generic;
using AngleSharp.Css.Values;
/// <summary>
/// Represents the keyframe selector.
/// </summary>
sealed class KeyframeSelector : IKeyframeSelector
{
#region Fields
readonly List<Percent> _stops;
#endregion
#region ctor
public KeyframeSelector(IEnumerable<Percent> stops)
{
_stops = new List<Percent>(stops);
}
#endregion
#region Properties
/// <summary>
/// Gets an enumeration over all stops.
/// </summary>
public IEnumerable<Percent> Stops
{
get { return _stops; }
}
/// <summary>
/// Gets the text representation of the keyframe selector.
/// </summary>
public String Text
{
get
{
var stops = new String[_stops.Count];
for (int i = 0; i < stops.Length; i++)
stops[i] = _stops[i].ToString();
return String.Join(", ", stops);
}
}
#endregion
}
}
| mit | C# |
13760f401418a0dd9019c3030d77017fd2c5eccf | Fix gas tile overlays on shuttles | space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14 | Content.Client/Atmos/Overlays/GasTileOverlay.cs | Content.Client/Atmos/Overlays/GasTileOverlay.cs | using Content.Client.Atmos.EntitySystems;
using Robust.Client.Graphics;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
namespace Content.Client.Atmos.Overlays
{
public class GasTileOverlay : Overlay
{
private readonly GasTileOverlaySystem _gasTileOverlaySystem;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IClyde _clyde = default!;
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
public GasTileOverlay()
{
IoCManager.InjectDependencies(this);
_gasTileOverlaySystem = EntitySystem.Get<GasTileOverlaySystem>();
}
protected override void Draw(in OverlayDrawArgs args)
{
var drawHandle = args.WorldHandle;
var mapId = _eyeManager.CurrentMap;
var eye = _eyeManager.CurrentEye;
var worldBounds = Box2.CenteredAround(eye.Position.Position,
_clyde.ScreenSize / (float) EyeManager.PixelsPerMeter * eye.Zoom);
foreach (var mapGrid in _mapManager.FindGridsIntersecting(mapId, worldBounds))
{
if (!_gasTileOverlaySystem.HasData(mapGrid.Index))
continue;
foreach (var tile in mapGrid.GetTilesIntersecting(worldBounds))
{
foreach (var (texture, color) in _gasTileOverlaySystem.GetOverlays(mapGrid.Index, tile.GridIndices))
{
drawHandle.DrawTexture(texture, mapGrid.LocalToWorld(new Vector2(tile.X, tile.Y)), color);
}
}
}
}
}
}
| using Content.Client.Atmos.EntitySystems;
using Robust.Client.Graphics;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
namespace Content.Client.Atmos.Overlays
{
public class GasTileOverlay : Overlay
{
private readonly GasTileOverlaySystem _gasTileOverlaySystem;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IClyde _clyde = default!;
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
public GasTileOverlay()
{
IoCManager.InjectDependencies(this);
_gasTileOverlaySystem = EntitySystem.Get<GasTileOverlaySystem>();
}
protected override void Draw(in OverlayDrawArgs args)
{
var drawHandle = args.WorldHandle;
var mapId = _eyeManager.CurrentMap;
var eye = _eyeManager.CurrentEye;
var worldBounds = Box2.CenteredAround(eye.Position.Position,
_clyde.ScreenSize / (float) EyeManager.PixelsPerMeter * eye.Zoom);
foreach (var mapGrid in _mapManager.FindGridsIntersecting(mapId, worldBounds))
{
if (!_gasTileOverlaySystem.HasData(mapGrid.Index))
continue;
var gridBounds = new Box2(mapGrid.WorldToLocal(worldBounds.BottomLeft), mapGrid.WorldToLocal(worldBounds.TopRight));
foreach (var tile in mapGrid.GetTilesIntersecting(gridBounds))
{
foreach (var (texture, color) in _gasTileOverlaySystem.GetOverlays(mapGrid.Index, tile.GridIndices))
{
drawHandle.DrawTexture(texture, mapGrid.LocalToWorld(new Vector2(tile.X, tile.Y)), color);
}
}
}
}
}
}
| mit | C# |
608513b64312f685ed6255570bdd1c03c64e54a7 | Fix related to #AG231 - Mapper resolution is OK to be transient | csf-dev/agiil,csf-dev/agiil,csf-dev/agiil,csf-dev/agiil | Agiil.Bootstrap/ObjectMaps/AutomapperModule.cs | Agiil.Bootstrap/ObjectMaps/AutomapperModule.cs | using System;
using Agiil.ObjectMaps;
using Autofac;
using AutoMapper;
namespace Agiil.Bootstrap.ObjectMaps
{
public class AutomapperModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder
.Register(GetMapperConfiguration)
.SingleInstance();
builder.Register(GetMapper);
}
MapperConfiguration GetMapperConfiguration(IComponentContext ctx)
=> ctx.Resolve<IMapperConfigurationFactory>().GetConfiguration();
IMapper GetMapper(IComponentContext ctx)
{
var config = ctx.Resolve<MapperConfiguration>();
var scope = ctx.Resolve<ILifetimeScope>();
// Looking at https://github.com/AutoMapper/AutoMapper/blob/v6.0.2/src/AutoMapper/MapperConfiguration.cs#L250
// we can see that this is a trivially cheap operation, OK to happen as often as we need.
var mapper = config.CreateMapper(scope.Resolve);
return mapper;
}
}
}
| using System;
using Agiil.ObjectMaps;
using Autofac;
using AutoMapper;
namespace Agiil.Bootstrap.ObjectMaps
{
public class AutomapperModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder
.Register(GetMapperConfiguration)
.SingleInstance();
builder
.Register(GetMapper)
.SingleInstance();
}
MapperConfiguration GetMapperConfiguration(IComponentContext ctx)
=> ctx.Resolve<IMapperConfigurationFactory>().GetConfiguration();
IMapper GetMapper(IComponentContext ctx)
{
var config = ctx.Resolve<MapperConfiguration>();
var scope = ctx.Resolve<ILifetimeScope>();
var mapper = config.CreateMapper(scope.Resolve);
return mapper;
}
}
}
| mit | C# |
9f7874c78d40a7e27aaeeaaa1787c0f5d987d51f | Use DomainCustomization rather than AutoMoqCustomization directly | appharbor/appharbor-cli | src/AppHarbor.Tests/AutoCommandDataAttribute.cs | src/AppHarbor.Tests/AutoCommandDataAttribute.cs | using Ploeh.AutoFixture;
using Ploeh.AutoFixture.AutoMoq;
using Ploeh.AutoFixture.Xunit;
namespace AppHarbor.Tests
{
public class AutoCommandDataAttribute : AutoDataAttribute
{
public AutoCommandDataAttribute()
: base(new Fixture().Customize(new DomainCustomization()))
{
}
}
}
| using Ploeh.AutoFixture;
using Ploeh.AutoFixture.AutoMoq;
using Ploeh.AutoFixture.Xunit;
namespace AppHarbor.Tests
{
public class AutoCommandDataAttribute : AutoDataAttribute
{
public AutoCommandDataAttribute()
: base(new Fixture().Customize(new AutoMoqCustomization()))
{
}
}
}
| mit | C# |
624f5d1f6a50183e55249cd350e0db11b70f8b33 | Update test | arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5 | src/Arkivverket.Arkade.Test/Util/XmlUtilTest.cs | src/Arkivverket.Arkade.Test/Util/XmlUtilTest.cs | using Arkivverket.Arkade.Test.Tests.Noark5;
using Arkivverket.Arkade.Util;
using Xunit;
using FluentAssertions;
namespace Arkivverket.Arkade.Test.Util
{
public class XmlUtilTest
{
private string addmlXsd = ResourceUtil.ReadResource(ArkadeConstants.AddmlXsdResource);
private string addml = TestUtil.ReadFromFileInTestDataDir("noark3\\addml.xml");
[Fact]
public void ShouldNotCreateErrorsIfIfXmlValidateAgainstSchema()
{
var validationErrorMessages = XmlUtil.Validate(addml, addmlXsd);
validationErrorMessages.Count.Should().Be(0);
}
[Fact]
public void ShouldThrowExceptionIfXmlDoesNotValidateAgainstSchema()
{
var invalidAddml = addml.Replace("dataset", "datasett");
var validationErrorMessages = XmlUtil.Validate(invalidAddml, addmlXsd);
validationErrorMessages.Should().Contain(m => m.Equals(
"Elementet addml i navneområdet http://www.arkivverket.no/standarder/addml" +
" har ugyldig underordnet element datasett i navneområdet http://www.arkivverket.no/standarder/addml." +
" Forventet liste over mulige elementer: dataset i navneområdet http://www.arkivverket.no/standarder/addml.")
);
}
}
}
| using Arkivverket.Arkade.Test.Tests.Noark5;
using Arkivverket.Arkade.Util;
using Xunit;
using FluentAssertions;
using System.Xml.Schema;
namespace Arkivverket.Arkade.Test.Util
{
public class XmlUtilTest
{
private string addmlXsd = ResourceUtil.ReadResource(ArkadeConstants.AddmlXsdResource);
private string addml = TestUtil.ReadFromFileInTestDataDir("noark3\\addml.xml");
[Fact]
public void ShouldNotThrowExceptionIfXmlValidateAgainstSchema()
{
XmlUtil.Validate(addml, addmlXsd);
}
[Fact]
public void ShouldThrowExceptionIfXmlDoesNotValidateAgainstSchema()
{
var invalidAddml = addml.Replace("dataset", "datasett");
var exception = Xunit.Assert.Throws<XmlSchemaValidationException>(() => XmlUtil.Validate(invalidAddml, addmlXsd));
exception.Message.Should().Contain("datasett");
}
}
}
| agpl-3.0 | C# |
2976cd1ce4aef0eef6ae17591ec6434dd9d0a013 | Fix SliderTest.SlideHorizontally on Win 10 | JohanLarsson/Gu.Wpf.UiAutomation | Gu.Wpf.UiAutomation/AutomationElements/Thumb.cs | Gu.Wpf.UiAutomation/AutomationElements/Thumb.cs | namespace Gu.Wpf.UiAutomation
{
using System.Windows;
using System.Windows.Automation;
public class Thumb : UiElement
{
private const int DragSpeed = 500;
public Thumb(AutomationElement automationElement)
: base(automationElement)
{
}
public TransformPattern TransformPattern => this.AutomationElement.TransformPattern();
/// <summary>
/// Moves the slider horizontally.
/// </summary>
/// <param name="distance">+ for right, - for left.</param>
public void SlideHorizontally(int distance)
{
var cp = this.GetClickablePoint();
Mouse.Drag(MouseButton.Left, cp, cp + new Vector(distance, 0), DragSpeed);
Wait.UntilInputIsProcessed();
}
/// <summary>
/// Moves the slider vertically.
/// </summary>
/// <param name="distance">+ for down, - for up.</param>
public void SlideVertically(int distance)
{
var cp = this.GetClickablePoint();
Mouse.Drag(MouseButton.Left, cp, cp + new Vector(0, distance), DragSpeed);
Wait.UntilInputIsProcessed();
}
}
}
| namespace Gu.Wpf.UiAutomation
{
using System.Windows.Automation;
public class Thumb : UiElement
{
public Thumb(AutomationElement automationElement)
: base(automationElement)
{
}
public TransformPattern TransformPattern => this.AutomationElement.TransformPattern();
/// <summary>
/// Moves the slider horizontally.
/// </summary>
/// <param name="distance">+ for right, - for left.</param>
public void SlideHorizontally(int distance)
{
Mouse.DragHorizontally(MouseButton.Left, this.Bounds.Center(), distance);
}
/// <summary>
/// Moves the slider vertically.
/// </summary>
/// <param name="distance">+ for down, - for up.</param>
public void SlideVertically(int distance)
{
Mouse.DragVertically(MouseButton.Left, this.Bounds.Center(), distance);
}
}
}
| mit | C# |
fd0cd2c948e95eb25d24930f22c65e7a59c385e0 | Use less confusing placeholder icon for YAML | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-yaml/src/Psi/YamlProjectFileLanguageService.cs | resharper/resharper-yaml/src/Psi/YamlProjectFileLanguageService.cs | using JetBrains.Application.UI.Icons.Special.ThemedIcons;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Yaml.ProjectModel;
using JetBrains.ReSharper.Plugins.Yaml.Settings;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Parsing;
using JetBrains.Text;
using JetBrains.UI.Icons;
namespace JetBrains.ReSharper.Plugins.Yaml.Psi
{
[ProjectFileType(typeof(YamlProjectFileType))]
public class YamlProjectFileLanguageService : ProjectFileLanguageService
{
private readonly YamlSupport myYamlSupport;
public YamlProjectFileLanguageService(YamlSupport yamlSupport)
: base(YamlProjectFileType.Instance)
{
myYamlSupport = yamlSupport;
}
public override ILexerFactory GetMixedLexerFactory(ISolution solution, IBuffer buffer, IPsiSourceFile sourceFile = null)
{
var languageService = YamlLanguage.Instance.LanguageService();
return languageService?.GetPrimaryLexerFactory();
}
protected override PsiLanguageType PsiLanguageType
{
get
{
var yamlLanguage = (PsiLanguageType) YamlLanguage.Instance ?? UnknownLanguage.Instance;
return myYamlSupport.IsParsingEnabled.Value ? yamlLanguage : UnknownLanguage.Instance;
}
}
// TODO: Proper icon!
public override IconId Icon => SpecialThemedIcons.Placeholder.Id;
}
} | using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Yaml.ProjectModel;
using JetBrains.ReSharper.Plugins.Yaml.Settings;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp.Resources;
using JetBrains.ReSharper.Psi.Parsing;
using JetBrains.Text;
using JetBrains.UI.Icons;
namespace JetBrains.ReSharper.Plugins.Yaml.Psi
{
[ProjectFileType(typeof(YamlProjectFileType))]
public class YamlProjectFileLanguageService : ProjectFileLanguageService
{
private readonly YamlSupport myYamlSupport;
public YamlProjectFileLanguageService(YamlSupport yamlSupport)
: base(YamlProjectFileType.Instance)
{
myYamlSupport = yamlSupport;
}
public override ILexerFactory GetMixedLexerFactory(ISolution solution, IBuffer buffer, IPsiSourceFile sourceFile = null)
{
var languageService = YamlLanguage.Instance.LanguageService();
return languageService?.GetPrimaryLexerFactory();
}
protected override PsiLanguageType PsiLanguageType
{
get
{
var yamlLanguage = (PsiLanguageType) YamlLanguage.Instance ?? UnknownLanguage.Instance;
return myYamlSupport.IsParsingEnabled.Value ? yamlLanguage : UnknownLanguage.Instance;
}
}
// TODO: Proper icon!
public override IconId Icon => PsiCSharpThemedIcons.Csharp.Id;
}
} | apache-2.0 | C# |
6dc94b92a1502b7b7d9ad17651390d23d110414c | make AuthorizeResponse public | jbijlsma/IdentityServer4,MienDev/IdentityServer4,jbijlsma/IdentityServer4,IdentityServer/IdentityServer4,jbijlsma/IdentityServer4,jbijlsma/IdentityServer4,MienDev/IdentityServer4,chrisowhite/IdentityServer4,MienDev/IdentityServer4,siyo-wang/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,chrisowhite/IdentityServer4,IdentityServer/IdentityServer4,chrisowhite/IdentityServer4,siyo-wang/IdentityServer4,IdentityServer/IdentityServer4,siyo-wang/IdentityServer4 | src/IdentityServer4/Models/AuthorizeResponse.cs | src/IdentityServer4/Models/AuthorizeResponse.cs | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityServer4.Extensions;
using IdentityServer4.Validation;
namespace IdentityServer4.Models
{
public class AuthorizeResponse
{
public ValidatedAuthorizeRequest Request { get; set; }
public string RedirectUri => Request?.RedirectUri;
public string State => Request?.State;
public string Scope => Request?.ValidatedScopes?.GrantedResources?.ToScopeNames()?.ToSpaceSeparatedString();
public string IdentityToken { get; set; }
public string AccessToken { get; set; }
public int AccessTokenLifetime { get; set; }
public string Code { get; set; }
public string SessionState { get; set; }
public string Error { get; set; }
public string ErrorDescription { get; set; }
public bool IsError => Error.IsPresent();
}
} | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityServer4.Extensions;
using IdentityServer4.Validation;
namespace IdentityServer4.Models
{
class AuthorizeResponse
{
public ValidatedAuthorizeRequest Request { get; set; }
public string RedirectUri => Request?.RedirectUri;
public string State => Request?.State;
public string Scope => Request?.ValidatedScopes?.GrantedResources?.ToScopeNames()?.ToSpaceSeparatedString();
public string IdentityToken { get; set; }
public string AccessToken { get; set; }
public int AccessTokenLifetime { get; set; }
public string Code { get; set; }
public string SessionState { get; set; }
public string Error { get; set; }
public string ErrorDescription { get; set; }
public bool IsError => Error.IsPresent();
}
} | apache-2.0 | C# |
53794bf030808426af54082c589057b1e41bcd5e | make use of the TextBrush | Ollienator/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,snoopydo/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,willdean/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,hakim89/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,dunderburken/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,larshg/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,larshg/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,willdean/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,jiangzm/Bonobo-Git-Server,willdean/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,larshg/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,willdean/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,lkho/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,crowar/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,lkho/Bonobo-Git-Server,gencer/Bonobo-Git-Server,crowar/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,gencer/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,crowar/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,gencer/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,willdean/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,YelaSeamless/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,larshg/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,crowar/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,gencer/Bonobo-Git-Server,crowar/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,crowar/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,kfarnung/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,jiangzm/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,NipponSysits/IIS.Git-Connector,Acute-sales-ltd/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,KiritoStudio/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,dunderburken/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,lkho/Bonobo-Git-Server,lkho/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server | Bonobo.Git.Server/Views/Repository/Blob.cshtml | Bonobo.Git.Server/Views/Repository/Blob.cshtml | @using Bonobo.Git.Server.Extensions
@model RepositoryTreeDetailModel
@{
Layout = "~/Views/Repository/_RepositoryLayout.cshtml";
ViewBag.Title = Resources.Repository_Tree_Title;
}
@if (Model != null)
{
@Html.Partial("_BranchSwitcher")
@Html.Partial("_AddressBar")
<div class="blob">
@{
<div class="controls">
<a href="@Url.Action("Raw", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true) })"><i class="fa fa-download"></i> @Resources.Repository_Tree_Download</a>
<a href="@Url.Action("Raw", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true), display = true })"><i class="fa fa-file-text"></i> @Resources.Repository_Tree_RawDisplay</a>
<a href="@Url.Action("History", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true)})"><i class="fa fa-history"></i> @Resources.Repository_Tree_History</a>
<a href="@Url.Action("Blame", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true)})">@Resources.Repository_Tree_Blame</a>
</div>
}
@if (Model.IsImage)
{
<img class="fileImage" alt="@Model.Name" src="@Url.Action("Raw", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true) })" />
}
else if (Model.IsText && Model.IsMarkdown)
{
<div class="markdown">@Html.MarkdownToHtml(Model.Text)</div>
}
else if (Model.IsText)
{
<pre><code class="@Model.TextBrush">@Model.Text</code></pre>
}
else
{
<pre><code>@Resources.Repository_Tree_PreviewNotSupported</code></pre>
}
</div>
}
@section scripts
{
<script>hljs.configure({tabReplace:' '});hljs.initHighlightingOnLoad();</script>
}
| @using Bonobo.Git.Server.Extensions
@model RepositoryTreeDetailModel
@{
Layout = "~/Views/Repository/_RepositoryLayout.cshtml";
ViewBag.Title = Resources.Repository_Tree_Title;
}
@if (Model != null)
{
@Html.Partial("_BranchSwitcher")
@Html.Partial("_AddressBar")
<div class="blob">
@{
<div class="controls">
<a href="@Url.Action("Raw", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true) })"><i class="fa fa-download"></i> @Resources.Repository_Tree_Download</a>
<a href="@Url.Action("Raw", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true), display = true })"><i class="fa fa-file-text"></i> @Resources.Repository_Tree_RawDisplay</a>
<a href="@Url.Action("History", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true)})"><i class="fa fa-history"></i> @Resources.Repository_Tree_History</a>
<a href="@Url.Action("Blame", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true)})">@Resources.Repository_Tree_Blame</a>
</div>
}
@if (Model.IsImage)
{
<img class="fileImage" alt="@Model.Name" src="@Url.Action("Raw", new { encodedPath = PathEncoder.Encode(Model.Path, allowSlash: true) })" />
}
else if (Model.IsText && Model.IsMarkdown)
{
<div class="markdown">@Html.MarkdownToHtml(Model.Text)</div>
}
else if (Model.IsText)
{
<pre><code>@Model.Text</code></pre>
}
else
{
<pre><code>@Resources.Repository_Tree_PreviewNotSupported</code></pre>
}
</div>
}
@section scripts
{
<script>hljs.configure({tabReplace:' '});hljs.initHighlightingOnLoad();</script>
}
| mit | C# |
fbeddd8ec2048f7ec6504267c168a97228c2fb39 | Update CurrencyNotFoundException.cs | tiksn/TIKSN-Framework | TIKSN.Core/Finance/CurrencyNotFoundException.cs | TIKSN.Core/Finance/CurrencyNotFoundException.cs | using System;
namespace TIKSN.Finance
{
//[System.Serializable]
public class CurrencyNotFoundException : Exception
{
public CurrencyNotFoundException()
{
}
public CurrencyNotFoundException(string message) : base(message)
{
}
public CurrencyNotFoundException(string message, Exception inner) : base(message, inner)
{
}
//protected CurrencyNotFoundException(
// System.Runtime.Serialization.SerializationInfo info,
// System.Runtime.Serialization.StreamingContext context) : base(info, context)
//{ }
}
}
| namespace TIKSN.Finance
{
//[System.Serializable]
public class CurrencyNotFoundException : System.Exception
{
public CurrencyNotFoundException()
{
}
public CurrencyNotFoundException(string message) : base(message)
{
}
public CurrencyNotFoundException(string message, System.Exception inner) : base(message, inner)
{
}
//protected CurrencyNotFoundException(
// System.Runtime.Serialization.SerializationInfo info,
// System.Runtime.Serialization.StreamingContext context) : base(info, context)
//{ }
}
} | mit | C# |
b097f2f3db33ba5f00f4146cdde59d2be37ef97c | Simplify name. | autofac/Autofac.WebApi.Owin | src/Autofac.Integration.WebApi.Owin/AutofacWebApiAppBuilderExtensions.cs | src/Autofac.Integration.WebApi.Owin/AutofacWebApiAppBuilderExtensions.cs | // Copyright (c) Autofac Project. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Web.Http;
using Autofac.Integration.WebApi.Owin;
namespace Owin;
/// <summary>
/// Extension methods for configuring the OWIN pipeline.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class AutofacWebApiAppBuilderExtensions
{
/// <summary>
/// Extends the Autofac lifetime scope added from the OWIN pipeline through to the Web API dependency scope.
/// </summary>
/// <param name="app">The application builder.</param>
/// <param name="configuration">The HTTP server configuration.</param>
/// <returns>The application builder for continued configuration.</returns>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="app" /> or <paramref name="configuration" /> is <see langword="null" />.
/// </exception>
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "The handler created must exist for the entire application lifetime.")]
public static IAppBuilder UseAutofacWebApi(this IAppBuilder app, HttpConfiguration configuration)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
if (!configuration.MessageHandlers.OfType<DependencyScopeHandler>().Any())
{
configuration.MessageHandlers.Insert(0, new DependencyScopeHandler());
}
return app;
}
}
| // Copyright (c) Autofac Project. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Web.Http;
using Autofac.Integration.WebApi.Owin;
namespace Owin;
/// <summary>
/// Extension methods for configuring the OWIN pipeline.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class AutofacWebApiAppBuilderExtensions
{
/// <summary>
/// Extends the Autofac lifetime scope added from the OWIN pipeline through to the Web API dependency scope.
/// </summary>
/// <param name="app">The application builder.</param>
/// <param name="configuration">The HTTP server configuration.</param>
/// <returns>The application builder for continued configuration.</returns>
/// <exception cref="System.ArgumentNullException">
/// Thrown if <paramref name="app" /> or <paramref name="configuration" /> is <see langword="null" />.
/// </exception>
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "The handler created must exist for the entire application lifetime.")]
public static IAppBuilder UseAutofacWebApi(this IAppBuilder app, HttpConfiguration configuration)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
if (!configuration.MessageHandlers.OfType<DependencyScopeHandler>().Any())
{
configuration.MessageHandlers.Insert(0, new DependencyScopeHandler());
}
return app;
}
}
| mit | C# |
e5c12dc7b9605657baa3087ffd0f25532f2c6172 | Use List<T> instead of IList<T> for struct enumeration in unsorted metadata table buffers. | Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver | src/AsmResolver.DotNet/Builder/Metadata/Tables/UnsortedMetadataTableBuffer.cs | src/AsmResolver.DotNet/Builder/Metadata/Tables/UnsortedMetadataTableBuffer.cs | using System;
using System.Collections.Generic;
using AsmResolver.PE.DotNet.Metadata.Tables;
using AsmResolver.PE.DotNet.Metadata.Tables.Rows;
namespace AsmResolver.DotNet.Builder.Metadata.Tables
{
/// <summary>
/// Represents a metadata stream buffer that adds every new row at the end of the table, without any further
/// processing or reordering of the rows.
/// </summary>
/// <typeparam name="TRow">The type of rows to store.</typeparam>
public class UnsortedMetadataTableBuffer<TRow> : IMetadataTableBuffer<TRow>
where TRow : struct, IMetadataRow
{
private readonly List<TRow> _entries = new List<TRow>();
private readonly MetadataTable<TRow> _table;
/// <summary>
/// Creates a new unsorted metadata table buffer.
/// </summary>
/// <param name="table">The underlying table to flush to.</param>
public UnsortedMetadataTableBuffer(MetadataTable<TRow> table)
{
_table = table ?? throw new ArgumentNullException(nameof(table));
}
/// <inheritdoc />
public int Count => _entries.Count;
/// <inheritdoc />
public virtual TRow this[uint rid]
{
get => _entries[(int) (rid - 1)];
set => _entries[(int) (rid - 1)] = value;
}
/// <inheritdoc />
public virtual MetadataToken Add(in TRow row, uint originalRid)
{
_entries.Add(row);
return new MetadataToken(_table.TableIndex, (uint) _entries.Count);
}
/// <inheritdoc />
public void FlushToTable()
{
foreach (var row in _entries)
_table.Add(row);
}
}
} | using System;
using System.Collections.Generic;
using AsmResolver.PE.DotNet.Metadata.Tables;
using AsmResolver.PE.DotNet.Metadata.Tables.Rows;
namespace AsmResolver.DotNet.Builder.Metadata.Tables
{
/// <summary>
/// Represents a metadata stream buffer that adds every new row at the end of the table, without any further
/// processing or reordering of the rows.
/// </summary>
/// <typeparam name="TRow">The type of rows to store.</typeparam>
public class UnsortedMetadataTableBuffer<TRow> : IMetadataTableBuffer<TRow>
where TRow : struct, IMetadataRow
{
private readonly IList<TRow> _entries = new List<TRow>();
private readonly MetadataTable<TRow> _table;
/// <summary>
/// Creates a new unsorted metadata table buffer.
/// </summary>
/// <param name="table">The underlying table to flush to.</param>
public UnsortedMetadataTableBuffer(MetadataTable<TRow> table)
{
_table = table ?? throw new ArgumentNullException(nameof(table));
}
/// <inheritdoc />
public int Count => _entries.Count;
/// <inheritdoc />
public virtual TRow this[uint rid]
{
get => _entries[(int) (rid - 1)];
set => _entries[(int) (rid - 1)] = value;
}
/// <inheritdoc />
public virtual MetadataToken Add(in TRow row, uint originalRid)
{
_entries.Add(row);
return new MetadataToken(_table.TableIndex, (uint) _entries.Count);
}
/// <inheritdoc />
public void FlushToTable()
{
foreach (var row in _entries)
_table.Add(row);
}
}
} | mit | C# |
f52b5172ec95fd89ab106348016812087663039a | Update route name | dsteinweg/TeacherPouch,dsteinweg/TeacherPouch,dsteinweg/TeacherPouch,dsteinweg/TeacherPouch | src/TeacherPouch/Controllers/ErrorController.cs | src/TeacherPouch/Controllers/ErrorController.cs | using System;
using System.Net;
using Microsoft.AspNetCore.Mvc;
using TeacherPouch.ViewModels;
namespace TeacherPouch.Controllers
{
public class ErrorController : BaseController
{
public IActionResult Http404()
{
Response.StatusCode = (int)HttpStatusCode.NotFound;
return View("Http404");
}
[Route("Error")]
public IActionResult Error(int? httpStatusCode, Exception exception = null)
{
var showErrorDetails = User.Identity.IsAuthenticated;
var viewModel = new ErrorViewModel(httpStatusCode, exception, showErrorDetails);
Response.StatusCode = viewModel.StatusCode;
return View(viewModel);
}
}
}
| using System;
using System.Net;
using Microsoft.AspNetCore.Mvc;
using TeacherPouch.ViewModels;
namespace TeacherPouch.Controllers
{
public class ErrorController : BaseController
{
public IActionResult Http404()
{
Response.StatusCode = (int)HttpStatusCode.NotFound;
return View("Http404");
}
[Route("error")]
public IActionResult Error(int? httpStatusCode, Exception exception = null)
{
var showErrorDetails = User.Identity.IsAuthenticated;
var viewModel = new ErrorViewModel(httpStatusCode, exception, showErrorDetails);
Response.StatusCode = viewModel.StatusCode;
return View("Error", viewModel);
}
}
}
| mit | C# |
71c603072906823028642dda66f9f0a0afdc76d5 | Add registration options for definition request | PowerShell/PowerShellEditorServices | src/PowerShellEditorServices.Protocol/LanguageServer/Definition.cs | src/PowerShellEditorServices.Protocol/LanguageServer/Definition.cs | //
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class DefinitionRequest
{
public static readonly
RequestType<TextDocumentPosition, Location[], object, TextDocumentRegistrationOptions> Type =
RequestType<TextDocumentPosition, Location[], object, TextDocumentRegistrationOptions>.Create("textDocument/definition");
}
}
| //
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class DefinitionRequest
{
public static readonly
RequestType<TextDocumentPosition, Location[], object, object> Type =
RequestType<TextDocumentPosition, Location[], object, object>.Create("textDocument/definition");
}
}
| mit | C# |
f93f08752b263cad9bcbe087aa23ba6d0a002df5 | Implement AdapterListCollection.Count | alesliehughes/monoDX,alesliehughes/monoDX | Microsoft.DirectX.Direct3D/Microsoft.DirectX.Direct3D/AdapterListCollection.cs | Microsoft.DirectX.Direct3D/Microsoft.DirectX.Direct3D/AdapterListCollection.cs | /*
* The MIT License (MIT)
*
* Copyright (c) 2013 Alistair Leslie-Hughes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections;
namespace Microsoft.DirectX.Direct3D
{
public sealed class AdapterListCollection : IEnumerable, IEnumerator
{
internal int currAdapter;
public AdapterInformation Default {
get {
throw new NotImplementedException ();
}
}
public AdapterInformation this [int adapter] {
get {
return new AdapterInformation(adapter);
}
}
//TODO: Returns 1 all the time.
public int Count {
get {
return 1;
}
}
public object Current {
get {
return new AdapterInformation(this.currAdapter);
}
}
public void Reset ()
{
throw new NotImplementedException ();
}
//TODO: Assumes only one Adapter - Should be enough for now.
public bool MoveNext ()
{
if(currAdapter == 0)
return false;
currAdapter++;
return true;
}
public IEnumerator GetEnumerator ()
{
return this;
}
public override bool Equals (object compare)
{
throw new NotImplementedException ();
}
public override int GetHashCode ()
{
throw new NotImplementedException ();
}
internal AdapterListCollection ()
{
currAdapter = -1;
}
}
}
| /*
* The MIT License (MIT)
*
* Copyright (c) 2013 Alistair Leslie-Hughes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections;
namespace Microsoft.DirectX.Direct3D
{
public sealed class AdapterListCollection : IEnumerable, IEnumerator
{
internal int currAdapter;
public AdapterInformation Default {
get {
throw new NotImplementedException ();
}
}
public AdapterInformation this [int adapter] {
get {
return new AdapterInformation(adapter);
}
}
//TODO: Returns 1 all the time.
public int Count {
get {
return 1;
}
}
public object Current {
get {
throw new NotImplementedException ();
}
}
public void Reset ()
{
throw new NotImplementedException ();
}
//TODO: Assumes only one Adapter - Should be enough for now.
public bool MoveNext ()
{
if(currAdapter == 0)
return false;
currAdapter++;
return true;
}
public IEnumerator GetEnumerator ()
{
return this;
}
public override bool Equals (object compare)
{
throw new NotImplementedException ();
}
public override int GetHashCode ()
{
throw new NotImplementedException ();
}
internal AdapterListCollection ()
{
currAdapter = -1;
}
}
}
| mit | C# |
aaa9685cf1508e44e8392a3be285b5d6ba612218 | Fix issues | seanshpark/corefx,fgreinacher/corefx,Jiayili1/corefx,seanshpark/corefx,ptoonen/corefx,zhenlan/corefx,zhenlan/corefx,ptoonen/corefx,Ermiar/corefx,wtgodbe/corefx,seanshpark/corefx,wtgodbe/corefx,Ermiar/corefx,seanshpark/corefx,mmitche/corefx,axelheer/corefx,ericstj/corefx,ViktorHofer/corefx,shimingsg/corefx,mmitche/corefx,Jiayili1/corefx,ptoonen/corefx,BrennanConroy/corefx,Jiayili1/corefx,axelheer/corefx,ericstj/corefx,fgreinacher/corefx,ravimeda/corefx,parjong/corefx,wtgodbe/corefx,BrennanConroy/corefx,shimingsg/corefx,ViktorHofer/corefx,parjong/corefx,BrennanConroy/corefx,wtgodbe/corefx,shimingsg/corefx,axelheer/corefx,ViktorHofer/corefx,mmitche/corefx,zhenlan/corefx,mmitche/corefx,ericstj/corefx,ericstj/corefx,ptoonen/corefx,Jiayili1/corefx,wtgodbe/corefx,ptoonen/corefx,seanshpark/corefx,ravimeda/corefx,ptoonen/corefx,ericstj/corefx,zhenlan/corefx,Ermiar/corefx,axelheer/corefx,shimingsg/corefx,shimingsg/corefx,zhenlan/corefx,shimingsg/corefx,ravimeda/corefx,Ermiar/corefx,wtgodbe/corefx,ericstj/corefx,ericstj/corefx,shimingsg/corefx,ravimeda/corefx,parjong/corefx,parjong/corefx,mmitche/corefx,parjong/corefx,ViktorHofer/corefx,ViktorHofer/corefx,mmitche/corefx,zhenlan/corefx,Ermiar/corefx,mmitche/corefx,Ermiar/corefx,zhenlan/corefx,seanshpark/corefx,Ermiar/corefx,ViktorHofer/corefx,fgreinacher/corefx,ViktorHofer/corefx,ravimeda/corefx,seanshpark/corefx,Jiayili1/corefx,fgreinacher/corefx,axelheer/corefx,axelheer/corefx,ravimeda/corefx,parjong/corefx,ptoonen/corefx,Jiayili1/corefx,ravimeda/corefx,Jiayili1/corefx,wtgodbe/corefx,parjong/corefx | src/System.Diagnostics.PerformanceCounter/src/misc/EnvironmentHelpers.cs | src/System.Diagnostics.PerformanceCounter/src/misc/EnvironmentHelpers.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
using System.Security;
using System.Security.Principal;
namespace System
{
internal static class EnvironmentHelpers
{
private static volatile bool s_isAppContainerProcess;
private static volatile bool s_isAppContainerProcessInitalized;
public static bool IsAppContainerProcess
{
get
{
if(!s_isAppContainerProcessInitalized)
{
if(Environment.OSVersion.Version.Major < 6 || (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor <= 1))
{
// Windows 7 or older.
s_isAppContainerProcess = false;
}
else
{
s_isAppContainerProcess = HasAppContainerToken();
}
s_isAppContainerProcessInitalized = true;
}
return s_isAppContainerProcess;
}
}
private static unsafe bool HasAppContainerToken()
{
int* dwIsAppContainerPtr = stackalloc int[1];
uint dwLength = 0;
using (WindowsIdentity wi = WindowsIdentity.GetCurrent(TokenAccessLevels.Query))
{
if (!Interop.Advapi32.GetTokenInformation(wi.Token, (uint)Interop.Advapi32.TOKEN_INFORMATION_CLASS.TokenIsAppContainer, new IntPtr(dwIsAppContainerPtr), sizeof(int), out dwLength))
{
throw new Win32Exception();
}
}
return (*dwIsAppContainerPtr != 0);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
using System.Security;
using System.Security.Principal;
namespace System
{
internal static class EnvironmentHelpers
{
private static volatile bool s_isAppContainerProcess;
private static volatile bool s_isAppContainerProcessInitalized;
public static bool IsAppContainerProcess
{
get
{
if(!s_isAppContainerProcessInitalized)
{
if(Environment.OSVersion.Version.Major < 6 || (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor <= 1))
{
// Windows 7 or older.
s_isAppContainerProcess = false;
}
else
{
s_isAppContainerProcess = HasAppContainerToken();
}
s_isAppContainerProcessInitalized = true;
}
return s_isAppContainerProcess;
}
}
private static unsafe bool HasAppContainerToken()
{
int* dwIsAppContainerPtr = stackalloc int[1];
uint dwLength = 0;
using (WindowsIdentity wi = WindowsIdentity.GetCurrent(TokenAccessLevels.Query))
{
if (!Interop.Advapi32.GetTokenInformation(wi.Token, Interop.Advapi32.TOKEN_INFORMATION_CLASS.TokenIsAppContainer, new IntPtr(dwIsAppContainerPtr), sizeof(int), out dwLength))
{
throw new Win32Exception();
}
}
return (*dwIsAppContainerPtr != 0);
}
}
}
| mit | C# |
b3cdf9479c46bc3fb73ce2548ba6714c40802ed2 | Use common copy of System.Numerics.Hashing.HashHelpers | poizan42/coreclr,wtgodbe/coreclr,cshung/coreclr,poizan42/coreclr,mmitche/coreclr,krk/coreclr,cshung/coreclr,krk/coreclr,mmitche/coreclr,wtgodbe/coreclr,poizan42/coreclr,wtgodbe/coreclr,cshung/coreclr,krk/coreclr,krk/coreclr,mmitche/coreclr,krk/coreclr,poizan42/coreclr,krk/coreclr,wtgodbe/coreclr,mmitche/coreclr,cshung/coreclr,poizan42/coreclr,mmitche/coreclr,cshung/coreclr,cshung/coreclr,mmitche/coreclr,wtgodbe/coreclr,poizan42/coreclr,wtgodbe/coreclr | src/System.Private.CoreLib/shared/System/Numerics/Hashing/HashHelpers.cs | src/System.Private.CoreLib/shared/System/Numerics/Hashing/HashHelpers.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.Numerics.Hashing
{
internal static class HashHelpers
{
public static readonly int RandomSeed = new Random().Next(int.MinValue, int.MaxValue);
public static int Combine(int h1, int h2)
{
// RyuJIT optimizes this to use the ROL instruction
// Related GitHub pull request: dotnet/coreclr#1830
uint rol5 = ((uint)h1 << 5) | ((uint)h1 >> 27);
return ((int)rol5 + h1) ^ h2;
}
}
}
| // 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.Numerics.Hashing
{
// Please change the corresponding file in corefx if this is changed.
internal static class HashHelpers
{
public static readonly int RandomSeed = new Random().Next(int.MinValue, int.MaxValue);
public static int Combine(int h1, int h2)
{
// RyuJIT optimizes this to use the ROL instruction
// Related GitHub pull request: dotnet/coreclr#1830
uint rol5 = ((uint)h1 << 5) | ((uint)h1 >> 27);
return ((int)rol5 + h1) ^ h2;
}
}
}
| mit | C# |
080b4ba9ed5e2dca6755ffb2403272f469fc4dc0 | Fix settings | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Shell/Commands/ToolCommands.cs | WalletWasabi.Gui/Shell/Commands/ToolCommands.cs | using AvalonStudio.Commands;
using AvalonStudio.Documents;
using AvalonStudio.Extensibility;
using AvalonStudio.Shell;
using ReactiveUI;
using System.IO;
using System.Linq;
using WalletWasabi.Gui.Tabs.WalletManager;
namespace WalletWasabi.Gui.Shell.Commands
{
internal class ToolCommands
{
public ToolCommands()
{
WalletManagerCommand = new CommandDefinition(
"Wallet Manager", null, ReactiveCommand.Create(OnWalletManager));
SettingsCommand = new CommandDefinition("I Do Nothing", null, ReactiveCommand.Create(() => { }));
}
private void OnWalletManager()
{
if (Directory.Exists(Global.WalletsDir) && Directory.EnumerateFiles(Global.WalletsDir).Any())
{
// Load
IShell tabs = IoC.Get<IShell>();
IDocumentTabViewModel doc = tabs.Documents.FirstOrDefault(x => x is WalletManagerViewModel);
if (doc != default)
{
var document = doc as WalletManagerViewModel;
tabs.SelectedDocument = doc;
document.SelectedCategory = document.Categories.First(x => x is LoadWalletViewModel);
}
else
{
var document = new WalletManagerViewModel();
tabs.AddDocument(document);
document.SelectedCategory = document.Categories.First(x => x is LoadWalletViewModel);
}
}
else
{
// Generate
IShell tabs = IoC.Get<IShell>();
IDocumentTabViewModel doc = tabs.Documents.FirstOrDefault(x => x is WalletManagerViewModel);
if (doc != default)
{
var document = doc as WalletManagerViewModel;
tabs.SelectedDocument = doc;
document.SelectedCategory = document.Categories.First(x => x is GenerateWalletViewModel);
}
else
{
var document = new WalletManagerViewModel();
tabs.AddDocument(document);
document.SelectedCategory = document.Categories.First(x => x is GenerateWalletViewModel);
}
}
}
[ExportCommandDefinition("Tools.WalletManager")]
public CommandDefinition WalletManagerCommand { get; }
[ExportCommandDefinition("Tools.Settings")]
public CommandDefinition SettingsCommand { get; }
}
}
| using AvalonStudio.Commands;
using AvalonStudio.Documents;
using AvalonStudio.Extensibility;
using AvalonStudio.Shell;
using ReactiveUI;
using System.IO;
using System.Linq;
using WalletWasabi.Gui.Tabs.WalletManager;
namespace WalletWasabi.Gui.Shell.Commands
{
internal class ToolCommands
{
public ToolCommands()
{
WalletManagerCommand = new CommandDefinition(
"Wallet Manager", null, ReactiveCommand.Create(OnWalletManager));
SettingsCommand = new CommandDefinition("Settings", null, ReactiveCommand.Create(() => { }));
}
private void OnWalletManager()
{
if (Directory.Exists(Global.WalletsDir) && Directory.EnumerateFiles(Global.WalletsDir).Any())
{
// Load
IShell tabs = IoC.Get<IShell>();
IDocumentTabViewModel doc = tabs.Documents.FirstOrDefault(x => x is WalletManagerViewModel);
if (doc != default)
{
var document = doc as WalletManagerViewModel;
tabs.SelectedDocument = doc;
document.SelectedCategory = document.Categories.First(x => x is LoadWalletViewModel);
}
else
{
var document = new WalletManagerViewModel();
tabs.AddDocument(document);
document.SelectedCategory = document.Categories.First(x => x is LoadWalletViewModel);
}
}
else
{
// Generate
IShell tabs = IoC.Get<IShell>();
IDocumentTabViewModel doc = tabs.Documents.FirstOrDefault(x => x is WalletManagerViewModel);
if (doc != default)
{
var document = doc as WalletManagerViewModel;
tabs.SelectedDocument = doc;
document.SelectedCategory = document.Categories.First(x => x is GenerateWalletViewModel);
}
else
{
var document = new WalletManagerViewModel();
tabs.AddDocument(document);
document.SelectedCategory = document.Categories.First(x => x is GenerateWalletViewModel);
}
}
}
[ExportCommandDefinition("Tools.WalletManager")]
public CommandDefinition WalletManagerCommand { get; }
[ExportCommandDefinition("Tools.Settings")]
public CommandDefinition SettingsCommand { get; }
}
}
| mit | C# |
033ca07d7e8a6a5a948532cc2fe0ca6dcd6ef3a2 | Add tooltips for stickers | agens-no/iMessageStickerUnity | Assets/Stickers/Sticker.cs | Assets/Stickers/Sticker.cs | using System;
using System.Collections.Generic;
using UnityEngine;
namespace Agens.Stickers
{
public class Sticker : ScriptableObject
{
[Tooltip("Name of the sticker")]
public string Name;
[Tooltip("Frames per second. Apple recommends 15+ FPS")]
public int Fps = 15;
[Tooltip("Number of repetitions (0 being infinite cycles")]
public int Repetitions = 0;
public int Index;
public bool Sequence;
public List<Texture2D> Frames;
public void CopyFrom(Sticker sticker, int i)
{
name = sticker.Name;
Name = sticker.Name;
Fps = sticker.Fps;
Repetitions = sticker.Repetitions;
Index = i;
Sequence = sticker.Sequence;
Frames = sticker.Frames;
}
}
} | using System;
using System.Collections.Generic;
using UnityEngine;
namespace Agens.Stickers
{
public class Sticker : ScriptableObject
{
public string Name;
public int Fps = 15;
public int Repetitions = 0;
public int Index;
public bool Sequence;
public List<Texture2D> Frames;
public void CopyFrom(Sticker sticker, int i)
{
name = sticker.Name;
Name = sticker.Name;
Fps = sticker.Fps;
Repetitions = sticker.Repetitions;
Index = i;
Sequence = sticker.Sequence;
Frames = sticker.Frames;
}
}
} | mit | C# |
bc77a82ab31004fe8692b6b24012fc574951bcfe | Update DotNetXmlSerializer.cs | tiksn/TIKSN-Framework | TIKSN.Core/Serialization/DotNetXmlSerializer.cs | TIKSN.Core/Serialization/DotNetXmlSerializer.cs | using System.IO;
using System.Xml.Serialization;
namespace TIKSN.Serialization
{
public class DotNetXmlSerializer : SerializerBase<string>
{
protected override string SerializeInternal<T>(T obj)
{
var serializer = new XmlSerializer(obj.GetType());
var writer = new StringWriter();
serializer.Serialize(writer, obj);
return writer.ToString();
}
}
} | using System.IO;
using System.Xml.Serialization;
namespace TIKSN.Serialization
{
public class DotNetXmlSerializer : SerializerBase<string>
{
protected override string SerializeInternal(object obj)
{
var serializer = new XmlSerializer(obj.GetType());
var writer = new StringWriter();
serializer.Serialize(writer, obj);
return writer.ToString();
}
}
} | mit | C# |
0adb6997713d587e35853ffafdfb4054bf56605d | Test passing for dialect supporting SupportsIfExistsBeforeTableName (Postgres) | ngbrown/nhibernate-core,livioc/nhibernate-core,nkreipke/nhibernate-core,lnu/nhibernate-core,nhibernate/nhibernate-core,alobakov/nhibernate-core,ManufacturingIntelligence/nhibernate-core,livioc/nhibernate-core,ManufacturingIntelligence/nhibernate-core,gliljas/nhibernate-core,alobakov/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,RogerKratz/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,ngbrown/nhibernate-core,alobakov/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core | src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs | src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs | using System.Text;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
namespace NHibernate.Test.NHSpecificTest.NH1443
{
[TestFixture]
public class Fixture
{
private static void Bug(Configuration cfg)
{
var su = new SchemaExport(cfg);
var sb = new StringBuilder(500);
su.Execute(x => sb.AppendLine(x), false, false, true);
string script = sb.ToString();
if (Dialect.Dialect.GetDialect(cfg.Properties).SupportsIfExistsBeforeTableName)
Assert.That(script, Text.Contains("drop table if exists nhibernate.dbo.Aclass"));
else
Assert.That(script, Text.Contains("drop table nhibernate.dbo.Aclass"));
Assert.That(script, Text.Contains("create table nhibernate.dbo.Aclass"));
}
[Test]
public void WithDefaultValuesInConfiguration()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithNothing.hbm.xml", GetType().Assembly);
cfg.SetProperty(Environment.DefaultCatalog, "nhibernate");
cfg.SetProperty(Environment.DefaultSchema, "dbo");
Bug(cfg);
}
[Test]
public void WithDefaultValuesInMapping()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithDefault.hbm.xml", GetType().Assembly);
Bug(cfg);
}
[Test]
public void WithSpecificValuesInMapping()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithSpecific.hbm.xml", GetType().Assembly);
Bug(cfg);
}
[Test]
public void WithDefaultValuesInConfigurationPriorityToMapping()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithDefault.hbm.xml", GetType().Assembly);
cfg.SetProperty(Environment.DefaultCatalog, "somethingDifferent");
cfg.SetProperty(Environment.DefaultSchema, "somethingDifferent");
Bug(cfg);
}
}
public class Aclass
{
public int Id { get; set; }
}
} | using System.Text;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
namespace NHibernate.Test.NHSpecificTest.NH1443
{
[TestFixture]
public class Fixture
{
private static void Bug(Configuration cfg)
{
var su = new SchemaExport(cfg);
var sb = new StringBuilder(500);
su.Execute(x => sb.AppendLine(x), false, false, true);
string script = sb.ToString();
Assert.That(script, Text.Contains("drop table nhibernate.dbo.Aclass"));
Assert.That(script, Text.Contains("create table nhibernate.dbo.Aclass"));
}
[Test]
public void WithDefaultValuesInConfiguration()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithNothing.hbm.xml", GetType().Assembly);
cfg.SetProperty(Environment.DefaultCatalog, "nhibernate");
cfg.SetProperty(Environment.DefaultSchema, "dbo");
Bug(cfg);
}
[Test]
public void WithDefaultValuesInMapping()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithDefault.hbm.xml", GetType().Assembly);
Bug(cfg);
}
[Test]
public void WithSpecificValuesInMapping()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithSpecific.hbm.xml", GetType().Assembly);
Bug(cfg);
}
[Test]
public void WithDefaultValuesInConfigurationPriorityToMapping()
{
Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithDefault.hbm.xml", GetType().Assembly);
cfg.SetProperty(Environment.DefaultCatalog, "somethingDifferent");
cfg.SetProperty(Environment.DefaultSchema, "somethingDifferent");
Bug(cfg);
}
}
public class Aclass
{
public int Id { get; set; }
}
} | lgpl-2.1 | C# |
b9b37dc8cde3a8d28070f3f42a0c2eb51f64a01e | Refactor code | Sitecore/Sitecore-Instance-Manager,sergeyshushlyapin/Sitecore-Instance-Manager,dsolovay/Sitecore-Instance-Manager,Brad-Christie/Sitecore-Instance-Manager | src/SIM.Core/Common/AbstractInstanceActionCommand.cs | src/SIM.Core/Common/AbstractInstanceActionCommand.cs | namespace SIM.Core.Common
{
using System;
using System.Linq;
using Instances;
using Sitecore.Diagnostics.Base;
using Sitecore.Diagnostics.Base.Annotations;
public abstract class AbstractInstanceActionCommand<T> : AbstractCommand<T>
{
[CanBeNull]
public virtual string Name { get; [UsedImplicitly] set; }
protected sealed override void DoExecute(CommandResult<T> result)
{
var instance = AbstractInstanceActionCommand.GetInstance(Name);
this.DoExecute(instance, result);
}
protected abstract void DoExecute(Instance instance, CommandResult<T> result);
}
public abstract class AbstractInstanceActionCommand : AbstractCommand
{
[CanBeNull]
public virtual string Name { get; [UsedImplicitly] set; }
protected sealed override void DoExecute(CommandResult result)
{
var name = Name;
var instance = GetInstance(name);
this.DoExecute(instance, result);
}
internal static Instance GetInstance(string name)
{
InstanceManager.Initialize();
Assert.ArgumentNotNullOrEmpty(name, nameof(name));
var instance = InstanceManager.Instances.FirstOrDefault(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
Ensure.IsNotNull(instance, "instance is not found");
return instance;
}
protected abstract void DoExecute(Instance instance, CommandResult result);
}
} | namespace SIM.Core.Common
{
using System;
using System.Linq;
using Instances;
using Sitecore.Diagnostics.Base;
using Sitecore.Diagnostics.Base.Annotations;
public abstract class AbstractInstanceActionCommand<T> : AbstractCommand<T>
{
[CanBeNull]
public virtual string Name { get; [UsedImplicitly] set; }
protected sealed override void DoExecute(CommandResult<T> result)
{
InstanceManager.Initialize();
var name = Name;
Assert.ArgumentNotNullOrEmpty(name, nameof(name));
var instance = InstanceManager.Instances.FirstOrDefault(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
Ensure.IsNotNull(instance, "instance is not found");
this.DoExecute(instance, result);
}
protected abstract void DoExecute(Instance instance, CommandResult<T> result);
}
public abstract class AbstractInstanceActionCommand : AbstractCommand
{
[CanBeNull]
public virtual string Name { get; [UsedImplicitly] set; }
protected sealed override void DoExecute(CommandResult result)
{
InstanceManager.Initialize();
var name = Name;
Assert.ArgumentNotNullOrEmpty(name, nameof(name));
var instance = InstanceManager.Instances.FirstOrDefault(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
Ensure.IsNotNull(instance, "instance is not found");
this.DoExecute(instance, result);
}
protected abstract void DoExecute(Instance instance, CommandResult result);
}
} | mit | C# |
883dee3a84f3a72d9576e4489902849abe4df2ee | Fix having the wrong Index name in migration CuratedFeedPackageUniqueness.Down() | KuduApps/NuGetGallery,KuduApps/NuGetGallery,grenade/NuGetGallery_download-count-patch,ScottShingler/NuGetGallery,mtian/SiteExtensionGallery,JetBrains/ReSharperGallery,projectkudu/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch,JetBrains/ReSharperGallery,skbkontur/NuGetGallery,ScottShingler/NuGetGallery,KuduApps/NuGetGallery,mtian/SiteExtensionGallery,projectkudu/SiteExtensionGallery,skbkontur/NuGetGallery,mtian/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch,KuduApps/NuGetGallery,skbkontur/NuGetGallery,JetBrains/ReSharperGallery,KuduApps/NuGetGallery,projectkudu/SiteExtensionGallery,ScottShingler/NuGetGallery | Website/Migrations/201304030226233_CuratedFeedPackageUniqueness.cs | Website/Migrations/201304030226233_CuratedFeedPackageUniqueness.cs | namespace NuGetGallery.Migrations
{
using System.Data.Entity.Migrations;
public partial class CuratedFeedPackageUniqueness : DbMigration
{
public override void Up()
{
// ADD uniqueness constraint - as an Index, since it seems reasonable to look up curated package entries by their feed + registration
CreateIndex("CuratedPackages", new[] { "CuratedFeedKey", "PackageRegistrationKey" }, unique: true, name: "IX_CuratedFeed_PackageRegistration");
}
public override void Down()
{
// REMOVE uniqueness constraint
DropIndex("CuratedPackages", "IX_CuratedFeed_PackageRegistration");
}
}
}
| namespace NuGetGallery.Migrations
{
using System.Data.Entity.Migrations;
public partial class CuratedFeedPackageUniqueness : DbMigration
{
public override void Up()
{
// ADD uniqueness constraint - as an Index, since it seems reasonable to look up curated package entries by their feed + registration
CreateIndex("CuratedPackages", new[] { "CuratedFeedKey", "PackageRegistrationKey" }, unique: true, name: "IX_CuratedFeed_PackageRegistration");
}
public override void Down()
{
// REMOVE uniqueness constraint
DropIndex("CuratedPackages", "IX_CuratedPackage_CuratedFeedAndPackageRegistration");
}
}
}
| apache-2.0 | C# |
236e55a107ad752b837841d7696ace5ff479a2dd | Add an implementation IEqualityComparer<Type> to ensure the .Distinct call in the Locate() method works as expected. | SRoddis/Mongo.Migration | Mongo.Migration/Migrations/Locators/TypeMigrationDependencyLocator.cs | Mongo.Migration/Migrations/Locators/TypeMigrationDependencyLocator.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Mongo.Migration.Extensions;
using Mongo.Migration.Migrations.Adapters;
namespace Mongo.Migration.Migrations.Locators
{
internal class TypeMigrationDependencyLocator<TMigrationType> : MigrationLocator<TMigrationType>
where TMigrationType: class, IMigration
{
private class TypeComparer : IEqualityComparer<Type>
{
public bool Equals(Type x, Type y)
{
return x.AssemblyQualifiedName == y.AssemblyQualifiedName;
}
public int GetHashCode(Type obj)
{
return obj.AssemblyQualifiedName.GetHashCode();
}
}
private readonly IContainerProvider _containerProvider;
public TypeMigrationDependencyLocator(IContainerProvider containerProvider)
{
_containerProvider = containerProvider;
}
public override void Locate()
{
var migrationTypes =
(from assembly in Assemblies
from type in assembly.GetTypes()
where typeof(TMigrationType).IsAssignableFrom(type) && !type.IsAbstract
select type).Distinct(new TypeComparer());
Migrations = migrationTypes.Select(GetMigrationInstance).ToMigrationDictionary();
}
private TMigrationType GetMigrationInstance(Type type)
{
ConstructorInfo constructor = type.GetConstructors()[0];
if(constructor != null)
{
object[] args = constructor
.GetParameters()
.Select(o => o.ParameterType)
.Select(o => _containerProvider.GetInstance(o))
.ToArray();
return Activator.CreateInstance(type, args) as TMigrationType;
}
return Activator.CreateInstance(type) as TMigrationType;
}
}
} | using System;
using System.Linq;
using System.Reflection;
using Mongo.Migration.Extensions;
using Mongo.Migration.Migrations.Adapters;
namespace Mongo.Migration.Migrations.Locators
{
internal class TypeMigrationDependencyLocator<TMigrationType> : MigrationLocator<TMigrationType>
where TMigrationType: class, IMigration
{
private readonly IContainerProvider _containerProvider;
public TypeMigrationDependencyLocator(IContainerProvider containerProvider)
{
_containerProvider = containerProvider;
}
public override void Locate()
{
var migrationTypes =
(from assembly in Assemblies
from type in assembly.GetTypes()
where typeof(TMigrationType).IsAssignableFrom(type) && !type.IsAbstract
select type).Distinct();
Migrations = migrationTypes.Select(GetMigrationInstance).ToMigrationDictionary();
}
private TMigrationType GetMigrationInstance(Type type)
{
ConstructorInfo constructor = type.GetConstructors()[0];
if(constructor != null)
{
object[] args = constructor
.GetParameters()
.Select(o => o.ParameterType)
.Select(o => _containerProvider.GetInstance(o))
.ToArray();
return Activator.CreateInstance(type, args) as TMigrationType;
}
return Activator.CreateInstance(type) as TMigrationType;
}
}
} | mit | C# |
1fca171d58298a2ff65b9b0c95729cb49c35ceb6 | Add default and rename variable | BenPhegan/NuGet.Extensions | NuGet.Extensions.Tests/ReferenceAnalysers/ProjectReferenceTestData.cs | NuGet.Extensions.Tests/ReferenceAnalysers/ProjectReferenceTestData.cs | using System.Collections.Generic;
using Moq;
using NuGet.Extensions.MSBuild;
using NuGet.Extensions.Tests.Mocks;
namespace NuGet.Extensions.Tests.ReferenceAnalysers
{
public class ProjectReferenceTestData {
private const string AssemblyInPackageRepository = "Assembly11.dll";
public const string PackageInRepository = "Test1";
public static Mock<IVsProject> ConstructMockProject(IBinaryReference[] binaryReferences = null)
{
var project = new Mock<IVsProject>();
project.Setup(proj => proj.GetBinaryReferences()).Returns(binaryReferences ?? new IBinaryReference[0]);
return project;
}
public static Mock<IBinaryReference> ConstructMockDependency(string includeName = null, string includeVersion = null)
{
includeName = includeName ?? AssemblyInPackageRepository;
var dependency = new Mock<IBinaryReference>();
dependency.SetupGet(d => d.IncludeName).Returns(includeName);
dependency.SetupGet(d => d.IncludeVersion).Returns(includeVersion ?? "0.0.0.0");
dependency.Setup(d => d.IsForAssembly(It.IsAny<string>())).Returns(true);
string anydependencyHintpath = includeName;
dependency.Setup(d => d.TryGetHintPath(out anydependencyHintpath)).Returns(true);
return dependency;
}
public static MockPackageRepository CreateMockRepository()
{
var mockRepo = new MockPackageRepository();
mockRepo.AddPackage(PackageUtility.CreatePackage(PackageInRepository, isLatest: true, assemblyReferences: new List<string> { AssemblyInPackageRepository, "Assembly12.dll" }, dependencies: new List<PackageDependency>()));
mockRepo.AddPackage(PackageUtility.CreatePackage("Test2", isLatest: true, assemblyReferences: new List<string> { "Assembly21.dll", "Assembly22.dll" }, dependencies: new List<PackageDependency> { new PackageDependency(PackageInRepository) }));
return mockRepo;
}
}
} | using System.Collections.Generic;
using Moq;
using NuGet.Extensions.MSBuild;
using NuGet.Extensions.Tests.Mocks;
namespace NuGet.Extensions.Tests.ReferenceAnalysers
{
public class ProjectReferenceTestData {
private const string AssemblyInPackageRepository = "Assembly11.dll";
public const string PackageInRepository = "Test1";
public static Mock<IVsProject> ConstructMockProject(IBinaryReference[] binaryReferences)
{
var projectWithSingleDependency = new Mock<IVsProject>();
projectWithSingleDependency.Setup(proj => proj.GetBinaryReferences()).Returns(binaryReferences);
return projectWithSingleDependency;
}
public static Mock<IBinaryReference> ConstructMockDependency(string includeName = null, string includeVersion = null)
{
includeName = includeName ?? AssemblyInPackageRepository;
var dependency = new Mock<IBinaryReference>();
dependency.SetupGet(d => d.IncludeName).Returns(includeName);
dependency.SetupGet(d => d.IncludeVersion).Returns(includeVersion ?? "0.0.0.0");
dependency.Setup(d => d.IsForAssembly(It.IsAny<string>())).Returns(true);
string anydependencyHintpath = includeName;
dependency.Setup(d => d.TryGetHintPath(out anydependencyHintpath)).Returns(true);
return dependency;
}
public static MockPackageRepository CreateMockRepository()
{
var mockRepo = new MockPackageRepository();
mockRepo.AddPackage(PackageUtility.CreatePackage(PackageInRepository, isLatest: true, assemblyReferences: new List<string> { AssemblyInPackageRepository, "Assembly12.dll" }, dependencies: new List<PackageDependency>()));
mockRepo.AddPackage(PackageUtility.CreatePackage("Test2", isLatest: true, assemblyReferences: new List<string> { "Assembly21.dll", "Assembly22.dll" }, dependencies: new List<PackageDependency> { new PackageDependency(PackageInRepository) }));
return mockRepo;
}
}
} | mit | C# |
052ae794746a6a23fd02c414f5f9bf8c4e5a9b6b | Update RegularTestFixture.cs | MelleKoning/OpenCover.UI,OpenCoverUI/OpenCover.UI | OpenCover.UI.TestDiscoverer.TestResources/Xunit/RegularTestFixture.cs | OpenCover.UI.TestDiscoverer.TestResources/Xunit/RegularTestFixture.cs | using Xunit;
namespace OpenCover.UI.TestDiscoverer.TestResources.Xunit
{
public class RegularFacts
{
[Fact]
public void RegularTestMethod()
{
}
public class SubTestClass
{
[Fact]
public void RegularSubTestClassMethod()
{
}
public class Sub2NdTestClass
{
[Fact]
public void RegularSub2NdTestClassMethod()
{
}
}
}
}
}
| using Xunit;
namespace OpenCover.UI.TestDiscoverer.TestResources.Xunit
{
public class RegularFacts
{
[Fact]
public void RegularTestMethod()
{
}
}
}
| mit | C# |
58e535ead38d00cf32154b020d3da4572d856e12 | Fix bug where prop was not serialized | openstardrive/server,openstardrive/server,openstardrive/server | OpenStardriveServer/Domain/Systems/Propulsion/Engines/EnginesState.cs | OpenStardriveServer/Domain/Systems/Propulsion/Engines/EnginesState.cs | using System;
using OpenStardriveServer.Domain.Systems.Standard;
namespace OpenStardriveServer.Domain.Systems.Propulsion.Engines;
public record EnginesState : StandardSystemBaseState
{
public int CurrentSpeed { get; init; }
public EngineSpeedConfig SpeedConfig { get; init; }
public int CurrentHeat { get; init; }
public EngineHeatConfig HeatConfig { get; init; }
public SpeedPowerRequirement[] SpeedPowerRequirements { get; init; } = Array.Empty<SpeedPowerRequirement>();
}
public record EngineSpeedConfig
{
public int MaxSpeed { get; init; }
public int CruisingSpeed { get; init; }
}
public record EngineHeatConfig
{
public int PoweredHeat { get; init; }
public int CruisingHeat { get; init; }
public int MaxHeat { get; init; }
public int MinutesAtMaxSpeed { get; init; }
public int MinutesToCoolDown { get; init; }
}
public record SpeedPowerRequirement
{
public int Speed { get; init; }
public int PowerNeeded { get; init; }
} | using System;
using OpenStardriveServer.Domain.Systems.Standard;
namespace OpenStardriveServer.Domain.Systems.Propulsion.Engines;
public record EnginesState : StandardSystemBaseState
{
public int CurrentSpeed { get; init; }
public EngineSpeedConfig SpeedConfig { get; init; }
public int CurrentHeat { get; init; }
public EngineHeatConfig HeatConfig { get; init; }
public SpeedPowerRequirement[] SpeedPowerRequirements = Array.Empty<SpeedPowerRequirement>();
}
public record EngineSpeedConfig
{
public int MaxSpeed { get; init; }
public int CruisingSpeed { get; init; }
}
public record EngineHeatConfig
{
public int PoweredHeat { get; init; }
public int CruisingHeat { get; init; }
public int MaxHeat { get; init; }
public int MinutesAtMaxSpeed { get; init; }
public int MinutesToCoolDown { get; init; }
}
public record SpeedPowerRequirement
{
public int Speed { get; init; }
public int PowerNeeded { get; init; }
} | apache-2.0 | C# |
78d624e22453dc635426345900f2d81f528469a0 | Fix a comment (#129) | ForNeVeR/wpf-math | src/WpfMath/CharSymbol.cs | src/WpfMath/CharSymbol.cs | using WpfMath.Utils;
namespace WpfMath
{
// Atom representing single character that can be marked as text symbol.
internal abstract class CharSymbol : Atom
{
protected CharSymbol(SourceSpan source, TexAtomType type = TexAtomType.Ordinary)
: base(source, type)
{
this.IsTextSymbol = false;
}
public bool IsTextSymbol { get; }
/// <summary>Returns the preferred font to render this character.</summary>
public virtual ITeXFont GetStyledFont(TexEnvironment environment) => environment.MathFont;
/// <summary>Returns a <see cref="CharInfo"/> for this character.</summary>
protected abstract Result<CharInfo> GetCharInfo(ITeXFont font, TexStyle style);
protected sealed override Box CreateBoxCore(TexEnvironment environment)
{
var font = this.GetStyledFont(environment);
var charInfo = this.GetCharInfo(font, environment.Style);
return new CharBox(environment, charInfo.Value);
}
/// <summary>Checks if the symbol can be rendered by font.</summary>
public bool IsSupportedByFont(ITeXFont font, TexStyle style) =>
this.GetCharInfo(font, style).IsSuccess;
/// <summary>Returns the symbol rendered by font.</summary>
public abstract Result<CharFont> GetCharFont(ITeXFont texFont);
}
}
| using WpfMath.Utils;
namespace WpfMath
{
// Atom representing single character that can be marked as text symbol.
internal abstract class CharSymbol : Atom
{
protected CharSymbol(SourceSpan source, TexAtomType type = TexAtomType.Ordinary)
: base(source, type)
{
this.IsTextSymbol = false;
}
public bool IsTextSymbol { get; }
/// <summary>Returns the preferred font to render this character.</summary>
public virtual ITeXFont GetStyledFont(TexEnvironment environment) => environment.MathFont;
/// <summary>Returns a <see cref="CharInfo"/> for this character.</summary>
protected abstract Result<CharInfo> GetCharInfo(ITeXFont font, TexStyle style);
protected sealed override Box CreateBoxCore(TexEnvironment environment)
{
var font = this.GetStyledFont(environment);
var charInfo = this.GetCharInfo(font, environment.Style);
return new CharBox(environment, charInfo.Value);
}
/// <summary>Checks if the symbol can be rendered by font.</summary>
public bool IsSupportedByFont(ITeXFont font, TexStyle style) =>
this.GetCharInfo(font, style).IsSuccess;
/// <summary>
/// Returns the symbol rendered by font. Throws an exception if the symbol is not supported by font. Always
/// succeed if <see cref="IsSupportedByFont"/>.
/// </summary>
public abstract Result<CharFont> GetCharFont(ITeXFont texFont);
}
}
| mit | C# |
4ed30b3619954cb7f4ce2e334a6db99ee67a5818 | Add WindowsUtils.CreateSingleTickTimer | chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck | Core/Utils/WindowsUtils.cs | Core/Utils/WindowsUtils.cs | using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
namespace TweetDck.Core.Utils{
static class WindowsUtils{
public static bool CheckFolderWritePermission(string path){
string testFile = Path.Combine(path, ".test");
try{
Directory.CreateDirectory(path);
using(File.Create(testFile)){}
File.Delete(testFile);
return true;
}catch{
return false;
}
}
public static Process StartProcess(string file, string arguments, bool runElevated){
ProcessStartInfo processInfo = new ProcessStartInfo{
FileName = file,
Arguments = arguments
};
if (runElevated){
processInfo.Verb = "runas";
}
return Process.Start(processInfo);
}
public static Timer CreateSingleTickTimer(int timeout){
Timer timer = new Timer{
Interval = timeout
};
timer.Tick += (sender, args) => timer.Stop();
return timer;
}
}
}
| using System.Diagnostics;
using System.IO;
namespace TweetDck.Core.Utils{
static class WindowsUtils{
public static bool CheckFolderWritePermission(string path){
string testFile = Path.Combine(path, ".test");
try{
Directory.CreateDirectory(path);
using(File.Create(testFile)){}
File.Delete(testFile);
return true;
}catch{
return false;
}
}
public static Process StartProcess(string file, string arguments, bool runElevated){
ProcessStartInfo processInfo = new ProcessStartInfo{
FileName = file,
Arguments = arguments
};
if (runElevated){
processInfo.Verb = "runas";
}
return Process.Start(processInfo);
}
}
}
| mit | C# |
b197e6d4fc108e4e31dfe2de6a950ee485bd2879 | Update TestSerilogLoggingSetup.cs | tiksn/TIKSN-Framework | TIKSN.UnitTests.Shared/DependencyInjection/TestSerilogLoggingSetup.cs | TIKSN.UnitTests.Shared/DependencyInjection/TestSerilogLoggingSetup.cs | using Serilog;
using TIKSN.Analytics.Logging.Serilog;
using Xunit.Abstractions;
namespace TIKSN.DependencyInjection.Tests
{
public class TestSerilogLoggingSetup : SerilogLoggingSetupBase
{
private readonly ITestOutputHelper _testOutputHelper;
public TestSerilogLoggingSetup(ITestOutputHelper testOutputHelper) : base()
{
_testOutputHelper = testOutputHelper;
}
protected override void SetupSerilog()
{
base.SetupSerilog();
_loggerConfiguration.WriteTo.TestOutput(_testOutputHelper);
}
}
} | using Microsoft.Extensions.Logging;
using Serilog;
using TIKSN.Analytics.Logging.Serilog;
using Xunit.Abstractions;
namespace TIKSN.DependencyInjection.Tests
{
public class TestSerilogLoggingSetup : SerilogLoggingSetupBase
{
private readonly ITestOutputHelper _testOutputHelper;
public TestSerilogLoggingSetup(ITestOutputHelper testOutputHelper, ILoggerFactory loggerFactory) : base(loggerFactory)
{
_testOutputHelper = testOutputHelper;
}
protected override void SetupSerilog()
{
base.SetupSerilog();
_loggerConfiguration.WriteTo.TestOutput(_testOutputHelper);
}
}
} | mit | C# |
30600e6c3be70b0f7834796828d0109ffcf72ae5 | Remove unused using. | FacilityApi/Facility | src/Facility.CodeGen.Console/CommonArgs.cs | src/Facility.CodeGen.Console/CommonArgs.cs | using System.Collections.Generic;
using System.Globalization;
using ArgsReading;
namespace Facility.CodeGen.Console
{
internal static class CommonArgs
{
public static bool ReadCleanFlag(this ArgsReader args) => args.ReadFlag("clean");
public static bool ReadDryRunFlag(this ArgsReader args) => args.ReadFlag("dryrun");
public static bool ReadHelpFlag(this ArgsReader args) => args.ReadFlag("help|h|?");
public static bool ReadQuietFlag(this ArgsReader args) => args.ReadFlag("quiet");
public static bool ReadVerifyFlag(this ArgsReader args) => args.ReadFlag("verify");
public static string ReadIndentOption(this ArgsReader args)
{
string value = args.ReadOption("indent");
if (value == null)
return null;
if (value == "tab")
return "\t";
if (int.TryParse(value, NumberStyles.None, CultureInfo.InvariantCulture, out int spaceCount) && spaceCount >= 1 && spaceCount <= 8)
return new string(' ', spaceCount);
throw new ArgsReaderException($"Invalid indent '{value}'. (Should be 'tab' or the number of spaces.)");
}
public static string ReadNewLineOption(this ArgsReader args)
{
string value = args.ReadOption("newline");
if (value == null)
return null;
switch (value)
{
case "auto":
return null;
case "lf":
return "\n";
case "crlf":
return "\r\n";
default:
throw new ArgsReaderException($"Invalid new line '{value}'. (Should be 'auto', 'lf', or 'crlf'.)");
}
}
public static IReadOnlyList<string> ReadExcludeTagOptions(this ArgsReader args)
{
var values = new List<string>();
while (true)
{
string value = args.ReadOption("excludeTag");
if (value == null)
break;
values.Add(value);
}
return values;
}
}
}
| using System.Collections.Generic;
using System.Globalization;
using ArgsReading;
using Facility.Definition;
namespace Facility.CodeGen.Console
{
internal static class CommonArgs
{
public static bool ReadCleanFlag(this ArgsReader args) => args.ReadFlag("clean");
public static bool ReadDryRunFlag(this ArgsReader args) => args.ReadFlag("dryrun");
public static bool ReadHelpFlag(this ArgsReader args) => args.ReadFlag("help|h|?");
public static bool ReadQuietFlag(this ArgsReader args) => args.ReadFlag("quiet");
public static bool ReadVerifyFlag(this ArgsReader args) => args.ReadFlag("verify");
public static string ReadIndentOption(this ArgsReader args)
{
string value = args.ReadOption("indent");
if (value == null)
return null;
if (value == "tab")
return "\t";
if (int.TryParse(value, NumberStyles.None, CultureInfo.InvariantCulture, out int spaceCount) && spaceCount >= 1 && spaceCount <= 8)
return new string(' ', spaceCount);
throw new ArgsReaderException($"Invalid indent '{value}'. (Should be 'tab' or the number of spaces.)");
}
public static string ReadNewLineOption(this ArgsReader args)
{
string value = args.ReadOption("newline");
if (value == null)
return null;
switch (value)
{
case "auto":
return null;
case "lf":
return "\n";
case "crlf":
return "\r\n";
default:
throw new ArgsReaderException($"Invalid new line '{value}'. (Should be 'auto', 'lf', or 'crlf'.)");
}
}
public static IReadOnlyList<string> ReadExcludeTagOptions(this ArgsReader args)
{
var values = new List<string>();
while (true)
{
string value = args.ReadOption("excludeTag");
if (value == null)
break;
values.Add(value);
}
return values;
}
}
}
| mit | C# |
218a35eb76ebeba3db01b39006d031ef6f1f05d6 | Update MichaelRidland.cs | MabroukENG/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin | src/Firehose.Web/Authors/MichaelRidland.cs | src/Firehose.Web/Authors/MichaelRidland.cs | using Firehose.Web.Infrastructure;
using System;
using System.Collections.Generic;
namespace Firehose.Web.Authors
{
public class MichaelRidland : IAmAXamarinMVP
{
public string FirstName => "Michael";
public string LastName => "Ridland";
public string StateOrRegion => "Sydney, Australia";
public string EmailAddress => "[email protected]";
public string Title => "director of an Xamarin consultancy";
public Uri WebSite => new Uri("http://www.michaelridland.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.michaelridland.com/feed/"); }
}
public string TwitterHandle => "rid00z";
public DateTime FirstAwarded => new DateTime(2015, 4, 1);
public string GravatarHash => "";
}
}
| using Firehose.Web.Infrastructure;
using System;
using System.Collections.Generic;
namespace Firehose.Web.Authors
{
public class MichaelRidland : IAmAXamarinMVP
{
public string FirstName => "Michael";
public string LastName => "Ridland";
public string StateOrRegion => "Sydney, Australia";
public string EmailAddress => "[email protected]";
public string Title => "director of a Xamarin consultancy";
public Uri WebSite => new Uri("http://www.michaelridland.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.michaelridland.com/feed/"); }
}
public string TwitterHandle => "rid00z";
public DateTime FirstAwarded => new DateTime(2015, 4, 1);
public string GravatarHash => "";
}
}
| mit | C# |
bd5ea192ec0f7d121778c1f709dd8c517e197b94 | add ScheduleId to TaskInfo | grcodemonkey/iron_dotnet | src/IronSharp.IronWorker/Tasks/TaskInfo.cs | src/IronSharp.IronWorker/Tasks/TaskInfo.cs | using System;
using IronSharp.Core;
using Newtonsoft.Json;
namespace IronSharp.IronWorker
{
public class TaskInfo : IMsg, IInspectable
{
[JsonProperty("code_id", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string CodeId { get; set; }
[JsonProperty("code_name", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string CodeName { get; set; }
[JsonProperty("created_at", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime? CreatedAt { get; set; }
[JsonProperty("duration", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? Duration { get; set; }
[JsonProperty("end_time", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime? EndTime { get; set; }
[JsonProperty("id", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Id { get; set; }
[JsonProperty("schedule_id", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ScheduleId { get; set; }
[JsonProperty("msg", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Message { get; set; }
[JsonProperty("percent", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? Percent { get; set; }
[JsonProperty("project_id", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ProjectId { get; set; }
[JsonProperty("run_times", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? RunTimes { get; set; }
[JsonProperty("start_time", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime? StartTime { get; set; }
[JsonIgnore]
public TaskStates Status {
get { return StatusValue.As<TaskStates>(); }
set { StatusValue = Convert.ToString(value).ToLower(); }
}
[JsonProperty("timeout", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? Timeout { get; set; }
[JsonProperty("updated_at", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime? UpdatedAt { get; set; }
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
protected string StatusValue { get; set; }
}
} | using System;
using IronSharp.Core;
using Newtonsoft.Json;
namespace IronSharp.IronWorker
{
public class TaskInfo : IMsg, IInspectable
{
[JsonProperty("code_id", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string CodeId { get; set; }
[JsonProperty("code_name", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string CodeName { get; set; }
[JsonProperty("created_at", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime? CreatedAt { get; set; }
[JsonProperty("duration", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? Duration { get; set; }
[JsonProperty("end_time", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime? EndTime { get; set; }
[JsonProperty("id", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Id { get; set; }
[JsonProperty("msg", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Message { get; set; }
[JsonProperty("percent", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? Percent { get; set; }
[JsonProperty("project_id", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ProjectId { get; set; }
[JsonProperty("run_times", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? RunTimes { get; set; }
[JsonProperty("start_time", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime? StartTime { get; set; }
[JsonIgnore]
public TaskStates Status {
get { return StatusValue.As<TaskStates>(); }
set { StatusValue = Convert.ToString(value).ToLower(); }
}
[JsonProperty("timeout", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? Timeout { get; set; }
[JsonProperty("updated_at", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime? UpdatedAt { get; set; }
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
protected string StatusValue { get; set; }
}
} | mit | C# |
e5cfa8d3556f3e8173fde2d2993e36a746fe27ee | Simplify namespace handling | mkoscielniak/SSMScripter | SSMScripter/Scripter/Smo/SmoCreatableObject.cs | SSMScripter/Scripter/Smo/SmoCreatableObject.cs | using System;
using System.Collections.Specialized;
using MSmo = Microsoft.SqlServer.Management.Smo;
namespace SSMScripter.Scripter.Smo
{
public class SmoCreatableObject : SmoScriptableObject
{
public SmoCreatableObject(Microsoft.SqlServer.Management.Smo.SqlSmoObject obj)
: base(obj)
{
}
public override StringCollection Script(SmoScriptingContext context)
{
var scripter = new MSmo.Scripter(context.Server);
scripter.Options.IncludeDatabaseContext = context.ScriptDatabaseContext;
StringCollection scriptingResult = scripter.Script(new[] {ScriptedObject});
var result = new StringCollection();
AddDatabaseContextIfNeeded(context, result, scriptingResult);
foreach (string scriptedBatch in scriptingResult)
{
result.Add(scriptedBatch);
AddLineEnding(result);
AddLineEnding(result);
}
return result;
}
private void AddDatabaseContextIfNeeded(SmoScriptingContext context, StringCollection output, StringCollection scriptingResult)
{
if (scriptingResult.Count == 0)
return;
string firstLine = scriptingResult[0];
if (String.IsNullOrEmpty(firstLine))
return;
if (firstLine.StartsWith("USE", StringComparison.InvariantCultureIgnoreCase))
return;
AddDatabaseContext(output, context);
AddLineEnding(output);
}
}
}
| using System;
using System.Collections.Specialized;
namespace SSMScripter.Scripter.Smo
{
public class SmoCreatableObject : SmoScriptableObject
{
public SmoCreatableObject(Microsoft.SqlServer.Management.Smo.SqlSmoObject obj)
: base(obj)
{
}
public override StringCollection Script(SmoScriptingContext context)
{
var scripter = new Microsoft.SqlServer.Management.Smo.Scripter(context.Server);
Microsoft.SqlServer.Management.Smo.ScriptingOptions options = scripter.Options;
options.IncludeDatabaseContext = context.ScriptDatabaseContext;
StringCollection scriptingResult = scripter.Script(new[] {ScriptedObject});
var result = new StringCollection();
AddDatabaseContextIfNeeded(context, result, scriptingResult);
foreach (string scriptedBatch in scriptingResult)
{
result.Add(scriptedBatch);
AddLineEnding(result);
AddLineEnding(result);
}
return result;
}
private void AddDatabaseContextIfNeeded(SmoScriptingContext context, StringCollection output, StringCollection scriptingResult)
{
if (scriptingResult.Count == 0)
return;
string firstLine = scriptingResult[0];
if (String.IsNullOrEmpty(firstLine))
return;
if (firstLine.StartsWith("USE", StringComparison.InvariantCultureIgnoreCase))
return;
AddDatabaseContext(output, context);
AddLineEnding(output);
}
}
}
| mit | C# |
c84d05076a30141278c23d99f9286c2c8e7c4b53 | Add overloads to exception to take in the Reason | rapidcore/rapidcore,rapidcore/rapidcore | src/Locking/DistributedAppLockException.cs | src/Locking/DistributedAppLockException.cs | using System;
namespace RapidCore.Locking
{
public class DistributedAppLockException : Exception
{
public DistributedAppLockException()
{
}
public DistributedAppLockException(string message)
: base(message)
{
}
public DistributedAppLockException(string message, DistributedAppLockExceptionReason reason)
: base(message)
{
Reason = reason;
}
public DistributedAppLockException(string message, Exception inner)
: base(message, inner)
{
}
public DistributedAppLockException(string message, Exception inner, DistributedAppLockExceptionReason reason)
: base(message, inner)
{
Reason = reason;
}
public DistributedAppLockExceptionReason Reason { get; set; }
}
} | using System;
namespace RapidCore.Locking
{
public class DistributedAppLockException : Exception
{
public DistributedAppLockException()
{
}
public DistributedAppLockException(string message)
: base(message)
{
}
public DistributedAppLockException(string message, Exception inner)
: base(message, inner)
{
}
public DistributedAppLockExceptionReason Reason { get; set; }
}
} | mit | C# |
d22703b27496b0e1c5eaadc0a0985f7346599b26 | Fix for closing window. | cube-soft/Cube.Net,cube-soft/Cube.Net,cube-soft/Cube.Net | Applications/Rss/Reader/Xui/Triggers/CloseTrigger.cs | Applications/Rss/Reader/Xui/Triggers/CloseTrigger.cs | /* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/* ------------------------------------------------------------------------- */
using System.Windows;
using System.Windows.Interactivity;
namespace Cube.Xui.Triggers
{
/* --------------------------------------------------------------------- */
///
/// CloseMessage
///
/// <summary>
/// ウィンドウを閉じることを示すメッセージクラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseMessage { }
/* --------------------------------------------------------------------- */
///
/// CloseTrigger
///
/// <summary>
/// Messenger オブジェクト経由でウィンドウを閉じるための
/// Trigger クラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseTrigger : MessengerTrigger<CloseMessage> { }
/* --------------------------------------------------------------------- */
///
/// CloseAction
///
/// <summary>
/// Window を閉じる TriggerAction です。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseAction : TriggerAction<DependencyObject>
{
/* ----------------------------------------------------------------- */
///
/// Invoke
///
/// <summary>
/// 処理を実行します。
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void Invoke(object notused)
{
if (AssociatedObject is Window w)
{
w.DataContext = null;
w.Close();
}
}
}
}
| /* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/* ------------------------------------------------------------------------- */
using System.Windows;
using System.Windows.Interactivity;
namespace Cube.Xui.Triggers
{
/* --------------------------------------------------------------------- */
///
/// CloseMessage
///
/// <summary>
/// ウィンドウを閉じることを示すメッセージクラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseMessage { }
/* --------------------------------------------------------------------- */
///
/// CloseTrigger
///
/// <summary>
/// Messenger オブジェクト経由でウィンドウを閉じるための
/// Trigger クラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseTrigger : MessengerTrigger<CloseMessage> { }
/* --------------------------------------------------------------------- */
///
/// CloseAction
///
/// <summary>
/// Window を閉じる TriggerAction です。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseAction : TriggerAction<DependencyObject>
{
/* ----------------------------------------------------------------- */
///
/// Invoke
///
/// <summary>
/// 処理を実行します。
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void Invoke(object notused)
{
if (AssociatedObject is Window w) w.Close();
}
}
}
| apache-2.0 | C# |
da90cb0c045ed2ad5f32b63e98b5cdb13ed0232f | resolve again | IvoAtanasov/TableTennisChampionship,IvoAtanasov/TableTennisChampionship,IvoAtanasov/TableTennisChampionship | TableTennisChampionship/TableTennisChampionshipMain/ViewModels/TournamentPlayerInfo.cs | TableTennisChampionship/TableTennisChampionshipMain/ViewModels/TournamentPlayerInfo.cs | namespace TableTennisChampionshipMain.ViewModels
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TableTennisChampionshipMain.Infrastructure;
using TableTennisChampionship.Model.DataBaseModel;
using System.ComponentModel.DataAnnotations;
public class TournamentPlayerInfo : IMapFrom<TournamentPlayer> ,IHaveCustomMappings
{
public int TournamentPlayerID { get; set; }
[Required]
public int TournamentID { get; set; }
[Required]
public int PlayerID { get; set; }
public string PlayerFullName { get; set; }
public int Rank { get; set; }
public int Points { get; set; }
#region IHaveCustomMappings Members
public void CreateMappings(AutoMapper.IConfiguration configuration)
{
configuration.CreateMap<TournamentPlayer, TournamentPlayerInfo>()
.ForMember(m => m.PlayerFullName, opt => opt.MapFrom(x => x.Player.FirstName + " " + x.Player.LastName));
}
#endregion
}
} |
namespace TableTennisChampionshipMain.ViewModels
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TableTennisChampionshipMain.Infrastructure;
using TableTennisChampionship.Model.DataBaseModel;
using System.ComponentModel.DataAnnotations;
public class TournamentPlayerInfo : IMapFrom<TournamentPlayer> ,IHaveCustomMappings
{
public int TournamentPlayerID { get; set; }
[Required]
public int TournamentID { get; set; }
[Required]
public int PlayerID { get; set; }
public string PlayerFullName { get; set; }
public int Rank { get; set; }
public int Points { get; set; }
#region IHaveCustomMappings Members
public void CreateMappings(AutoMapper.IConfiguration configuration)
{
configuration.CreateMap<TournamentPlayer, TournamentPlayerInfo>()
.ForMember(m => m.PlayerFullName, opt => opt.MapFrom(x => x.Player.FirstName + " " + x.Player.LastName));
}
#endregion
}
} | mit | C# |
ef57b8eec49ca310ba9b6e2c6ace521ccc8443bf | make identity case insensitive | Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek | core/Engine/Engine.DataTypes/Identity.cs | core/Engine/Engine.DataTypes/Identity.cs | using System;
namespace Engine.DataTypes
{
public class Identity: Tuple<string, string>
{
public string Type => Item1;
public string Id => Item2;
public Identity(string type, string id)
: base(type.ToLower(), id.ToLower())
{
}
public const string GlobalIdentityType = "@global";
public static readonly Identity GlobalIdentity = new Identity(GlobalIdentityType, "");
}
} | using System;
namespace Engine.DataTypes
{
public class Identity: Tuple<string, string>
{
public string Type => Item1;
public string Id => Item2;
public Identity(string type, string id)
: base(type, id)
{
}
public const string GlobalIdentityType = "@global";
public static readonly Identity GlobalIdentity = new Identity(GlobalIdentityType, "");
}
} | mit | C# |
49b1c52df5e8d2bf03768dc35ba6575e88277bc7 | Add `Unmanaged` calling convention (#852) | jbevain/cecil | Mono.Cecil/MethodCallingConvention.cs | Mono.Cecil/MethodCallingConvention.cs | //
// Author:
// Jb Evain ([email protected])
//
// Copyright (c) 2008 - 2015 Jb Evain
// Copyright (c) 2008 - 2011 Novell, Inc.
//
// Licensed under the MIT/X11 license.
//
namespace Mono.Cecil {
public enum MethodCallingConvention : byte {
Default = 0x0,
C = 0x1,
StdCall = 0x2,
ThisCall = 0x3,
FastCall = 0x4,
VarArg = 0x5,
Unmanaged = 0x9,
Generic = 0x10,
}
}
| //
// Author:
// Jb Evain ([email protected])
//
// Copyright (c) 2008 - 2015 Jb Evain
// Copyright (c) 2008 - 2011 Novell, Inc.
//
// Licensed under the MIT/X11 license.
//
namespace Mono.Cecil {
public enum MethodCallingConvention : byte {
Default = 0x0,
C = 0x1,
StdCall = 0x2,
ThisCall = 0x3,
FastCall = 0x4,
VarArg = 0x5,
Generic = 0x10,
}
}
| mit | C# |
afd4740c609eafd48ab4cd6a539db47a3ba3778e | Use floats across the camera calculations /2 > 0.5f | paseb/HoloToolkit-Unity,HoloFan/HoloToolkit-Unity,ForrestTrepte/HoloToolkit-Unity,out-of-pixel/HoloToolkit-Unity,NeerajW/HoloToolkit-Unity,willcong/HoloToolkit-Unity,HattMarris1/HoloToolkit-Unity,dbastienMS/HoloToolkit-Unity,paseb/MixedRealityToolkit-Unity | Assets/HoloToolkit/Utilities/Scripts/Extensions/CameraExtensions.cs | Assets/HoloToolkit/Utilities/Scripts/Extensions/CameraExtensions.cs | using UnityEngine;
namespace HoloToolkit.Unity
{
public static class CameraExtensions
{
/// <summary>
/// Get the horizontal FOV from the stereo camera
/// </summary>
/// <returns></returns>
public static float GetHorizontalFieldOfViewRadians(this Camera camera)
{
float horizontalFovRadians = 2f * Mathf.Atan(Mathf.Tan(camera.fieldOfView * Mathf.Deg2Rad * 0.5f) * camera.aspect);
return horizontalFovRadians;
}
/// <summary>
/// Returns if a point will be rendered on the screen in either eye
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public static bool IsInFOV(this Camera camera, Vector3 position)
{
float verticalFovHalf = camera.fieldOfView * 0.5f;
float horizontalFovHalf = camera.GetHorizontalFieldOfViewRadians() * Mathf.Rad2Deg * 0.5f;
Vector3 deltaPos = position - camera.transform.position;
Vector3 headDeltaPos = MathUtils.TransformDirectionFromTo(null, camera.transform, deltaPos).normalized;
float yaw = Mathf.Asin(headDeltaPos.x) * Mathf.Rad2Deg;
float pitch = Mathf.Asin(headDeltaPos.y) * Mathf.Rad2Deg;
return (Mathf.Abs(yaw) < horizontalFovHalf && Mathf.Abs(pitch) < verticalFovHalf);
}
}
} | using UnityEngine;
namespace HoloToolkit.Unity
{
public static class CameraExtensions
{
/// <summary>
/// Get the horizontal FOV from the stereo camera
/// </summary>
/// <returns></returns>
public static float GetHorizontalFieldOfViewRadians(this Camera camera)
{
float horizontalFovRadians = 2 * Mathf.Atan(Mathf.Tan((camera.fieldOfView * Mathf.Deg2Rad) / 2) * camera.aspect);
return horizontalFovRadians;
}
/// <summary>
/// Returns if a point will be rendered on the screen in either eye
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public static bool IsInFOV(this Camera camera, Vector3 position)
{
float verticalFovHalf = camera.fieldOfView / 2;
float horizontalFovHalf = camera.GetHorizontalFieldOfViewRadians() * Mathf.Rad2Deg / 2;
Vector3 deltaPos = position - camera.transform.position;
Vector3 headDeltaPos = MathUtils.TransformDirectionFromTo(null, camera.transform, deltaPos).normalized;
float yaw = Mathf.Asin(headDeltaPos.x) * Mathf.Rad2Deg;
float pitch = Mathf.Asin(headDeltaPos.y) * Mathf.Rad2Deg;
return (Mathf.Abs(yaw) < horizontalFovHalf && Mathf.Abs(pitch) < verticalFovHalf);
}
}
} | mit | C# |
a046af0229646421e7c4e2274c8d069b105f9f71 | Clean up. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Tor/Socks5/Models/Fields/ByteArrayFields/UNameField.cs | WalletWasabi/Tor/Socks5/Models/Fields/ByteArrayFields/UNameField.cs | using System.Text;
using WalletWasabi.Helpers;
using WalletWasabi.Tor.Socks5.Models.Bases;
namespace WalletWasabi.Tor.Socks5.Models.Fields.ByteArrayFields
{
public class UNameField : ByteArraySerializableBase
{
public UNameField(byte[] bytes)
{
Bytes = Guard.NotNullOrEmpty(nameof(bytes), bytes);
}
public UNameField(string uName)
: this(Encoding.UTF8.GetBytes(uName))
{
}
private byte[] Bytes { get; }
public override byte[] ToBytes() => Bytes;
}
}
| using System.Text;
using WalletWasabi.Helpers;
using WalletWasabi.Tor.Socks5.Models.Bases;
namespace WalletWasabi.Tor.Socks5.Models.Fields.ByteArrayFields
{
public class UNameField : ByteArraySerializableBase
{
#region Constructors
public UNameField(byte[] bytes)
{
Bytes = Guard.NotNullOrEmpty(nameof(bytes), bytes);
}
public UNameField(string uName)
: this(Encoding.UTF8.GetBytes(uName))
{
}
#endregion Constructors
#region PropertiesAndMembers
private byte[] Bytes { get; }
public string UName => Encoding.UTF8.GetString(Bytes); // Tor accepts UTF8 encoded passwd
#endregion PropertiesAndMembers
#region Serialization
public override byte[] ToBytes() => Bytes;
#endregion Serialization
}
}
| mit | C# |
10c9b3d971757d12f265e18fcf6c86c4c9d959e4 | Fix Dictionary type to be more useful | ilovepi/Compiler,ilovepi/Compiler | compiler/middleend/ir/ParseResult.cs | compiler/middleend/ir/ParseResult.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace compiler.middleend.ir
{
class ParseResult
{
public Operand Operand { get; set; }
public List<Instruction> Instructions { get; set; }
public Dictionary<int, SsaVariable> VarTable { get; set; }
public ParseResult()
{
Operand = null;
Instructions = null;
VarTable = new Dictionary<int, SsaVariable>();
}
public ParseResult(Dictionary<int, SsaVariable> symTble )
{
Operand = null;
Instructions = null;
VarTable = new Dictionary<int, SsaVariable>(symTble);
}
public ParseResult(Operand pOperand, List<Instruction> pInstructions, Dictionary<int, SsaVariable> pSymTble)
{
Operand = pOperand;
Instructions = new List<Instruction>(pInstructions);
VarTable = new Dictionary<int, SsaVariable>(pSymTble);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace compiler.middleend.ir
{
class ParseResult
{
public Operand Operand { get; set; }
public List<Instruction> Instructions { get; set; }
public Dictionary<SsaVariable, Instruction> VarTable { get; set; }
public ParseResult()
{
Operand = null;
Instructions = null;
VarTable = new Dictionary<SsaVariable, Instruction>();
}
public ParseResult(Dictionary<SsaVariable, Instruction> symTble )
{
Operand = null;
Instructions = null;
VarTable = new Dictionary<SsaVariable, Instruction>(symTble);
}
public ParseResult(Operand pOperand, List<Instruction> pInstructions, Dictionary<SsaVariable, Instruction> pSymTble)
{
Operand = pOperand;
Instructions = new List<Instruction>(pInstructions);
VarTable = new Dictionary<SsaVariable, Instruction>(pSymTble);
}
}
}
| mit | C# |
59de17dfb20252c87b83b3f52e738816a8f71315 | Change list to observablecollection | grantcolley/authorisationmanager,grantcolley/authorisationmanager,grantcolley/authorisationmanager,grantcolley/authorisationmanager | UI/WPF/Model/UserNode.cs | UI/WPF/Model/UserNode.cs | using System.Collections.ObjectModel;
using DevelopmentInProgress.DipSecure;
namespace DevelopmentInProgress.AuthorisationManager.WPF.Model
{
public class UserNode : EntityBase
{
public UserNode(UserAuthorisation userAuthorisation)
{
UserAuthorisation = userAuthorisation;
Roles = new ObservableCollection<RoleNode>();
}
public ObservableCollection<RoleNode> Roles { get; set; }
public UserAuthorisation UserAuthorisation { get; private set; }
public override int Id
{
get { return UserAuthorisation.Id; }
set
{
UserAuthorisation.Id = value;
OnPropertyChanged("Id");
}
}
public override string Text
{
get { return UserAuthorisation.UserName; }
set
{
UserAuthorisation.UserName = value;
OnPropertyChanged("Text");
}
}
public override string Description
{
get { return UserAuthorisation.DisplayName; }
set
{
UserAuthorisation.DisplayName = value;
OnPropertyChanged("Description");
}
}
}
}
| using System.Collections.Generic;
using DevelopmentInProgress.DipSecure;
namespace DevelopmentInProgress.AuthorisationManager.WPF.Model
{
public class UserNode : EntityBase
{
public UserNode(UserAuthorisation userAuthorisation)
{
UserAuthorisation = userAuthorisation;
Roles = new List<RoleNode>();
}
public List<RoleNode> Roles { get; set; }
public UserAuthorisation UserAuthorisation { get; private set; }
public override int Id
{
get { return UserAuthorisation.Id; }
set
{
UserAuthorisation.Id = value;
OnPropertyChanged("Id");
}
}
public override string Text
{
get { return UserAuthorisation.UserName; }
set
{
UserAuthorisation.UserName = value;
OnPropertyChanged("Text");
}
}
public override string Description
{
get { return UserAuthorisation.DisplayName; }
set
{
UserAuthorisation.DisplayName = value;
OnPropertyChanged("Description");
}
}
}
}
| apache-2.0 | C# |
507b383e5955a7de27905d8093162d6be86c4a13 | Update Bootstrap package in v4 test pages to v4.6.2 | atata-framework/atata-bootstrap,atata-framework/atata-bootstrap | test/Atata.Bootstrap.TestApp/Pages/v4/_Layout.cshtml | test/Atata.Bootstrap.TestApp/Pages/v4/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewBag.Title - Atata.Bootstrap.TestApp v4</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
@RenderSection("styles", false)
</head>
<body>
<div class="container">
<h1 class="text-center">@ViewBag.Title</h1>
@RenderBody()
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>
@RenderSection("scripts", false)
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewBag.Title</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
@RenderSection("styles", false)
</head>
<body>
<div class="container">
<h1 class="text-center">@ViewBag.Title</h1>
@RenderBody()
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
@RenderSection("scripts", false)
</body>
</html>
| apache-2.0 | C# |
a6f5d3580a8add0633de58571b229715347b8239 | Fix warnings. | sshnet/SSH.NET | src/Renci.SshNet.Tests/Classes/ClientAuthenticationTest.cs | src/Renci.SshNet.Tests/Classes/ClientAuthenticationTest.cs | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace Renci.SshNet.Tests.Classes
{
[TestClass]
public class ClientAuthenticationTest
{
private ClientAuthentication _clientAuthentication;
[TestInitialize]
public void Init()
{
_clientAuthentication = new ClientAuthentication();
}
[TestMethod]
public void AuthenticateShouldThrowArgumentNullExceptionWhenConnectionInfoIsNull()
{
const IConnectionInfoInternal connectionInfo = null;
var session = new Mock<ISession>(MockBehavior.Strict).Object;
try
{
_clientAuthentication.Authenticate(connectionInfo, session);
Assert.Fail();
}
catch (ArgumentNullException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("connectionInfo", ex.ParamName);
}
}
[TestMethod]
public void AuthenticateShouldThrowArgumentNullExceptionWhenSessionIsNull()
{
var connectionInfo = new Mock<IConnectionInfoInternal>(MockBehavior.Strict).Object;
const ISession session = null;
try
{
_clientAuthentication.Authenticate(connectionInfo, session);
Assert.Fail();
}
catch (ArgumentNullException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("session", ex.ParamName);
}
}
}
}
| using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace Renci.SshNet.Tests.Classes
{
[TestClass]
public class ClientAuthenticationTest
{
private ClientAuthentication _clientAuthentication;
[TestInitialize]
public void Init()
{
_clientAuthentication = new ClientAuthentication();
}
[TestMethod]
public void AuthenticateShouldThrowArgumentNullExceptionWhenConnectionInfoIsNull()
{
IConnectionInfoInternal connectionInfo = null;
var session = new Mock<ISession>(MockBehavior.Strict).Object;
try
{
_clientAuthentication.Authenticate(connectionInfo, session);
Assert.Fail();
}
catch (ArgumentNullException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("connectionInfo", ex.ParamName);
}
}
[TestMethod]
public void AuthenticateShouldThrowArgumentNullExceptionWhenSessionIsNull()
{
var connectionInfo = new Mock<IConnectionInfoInternal>(MockBehavior.Strict).Object;
ISession session = null;
try
{
_clientAuthentication.Authenticate(connectionInfo, session);
Assert.Fail();
}
catch (ArgumentNullException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("session", ex.ParamName);
}
}
}
}
| mit | C# |
5cc73aa5225de32dbbc4f4a8c8c43be78e00dca9 | Rename "ConstructBuilder" to "FindRequestHandler" as "ConstructBuilder" is a weak name that no longer accurately describes what this does Also more detail in the error message | danhaller/SevenDigital.Api.Wrapper,bnathyuw/SevenDigital.Api.Wrapper,emashliles/SevenDigital.Api.Wrapper,AnthonySteele/SevenDigital.Api.Wrapper,bettiolo/SevenDigital.Api.Wrapper,gregsochanik/SevenDigital.Api.Wrapper,luiseduardohdbackup/SevenDigital.Api.Wrapper,mattgray/SevenDigital.Api.Wrapper,minkaotic/SevenDigital.Api.Wrapper,danbadge/SevenDigital.Api.Wrapper | src/SevenDigital.Api.Wrapper/EndpointResolution/RequestCoordinator.cs | src/SevenDigital.Api.Wrapper/EndpointResolution/RequestCoordinator.cs | using System;
using System.Collections.Generic;
using SevenDigital.Api.Wrapper.EndpointResolution.RequestHandlers;
using SevenDigital.Api.Wrapper.Http;
namespace SevenDigital.Api.Wrapper.EndpointResolution
{
public class RequestCoordinator : IRequestCoordinator
{
private readonly IEnumerable<RequestHandler> _requestHandlers;
public IHttpClient HttpClient { get; set; }
public RequestCoordinator(IHttpClient httpClient, IEnumerable<RequestHandler> requestHandlers)
{
HttpClient = httpClient;
_requestHandlers = requestHandlers;
}
public string ConstructEndpoint(RequestData requestData)
{
var requestHandler = FindRequestHandler(requestData.HttpMethod);
return requestHandler.ConstructEndpoint(requestData);
}
private RequestHandler FindRequestHandler(string httpMethod)
{
var upperHttpMethodName = httpMethod.ToUpperInvariant();
foreach (var requestHandler in _requestHandlers)
{
if (requestHandler.HandlesMethod(upperHttpMethodName))
{
return requestHandler;
}
}
string errorMessage = string.Format("No RequestHandler supplied for method '{0}'", upperHttpMethodName);
throw new NotImplementedException(errorMessage);
}
public virtual Response HitEndpoint(RequestData requestData)
{
var requestHandler = FindRequestHandler(requestData.HttpMethod);
requestHandler.HttpClient = HttpClient;
return requestHandler.HitEndpoint(requestData);
}
public virtual void HitEndpointAsync(RequestData requestData, Action<Response> callback)
{
var requestHandler = FindRequestHandler(requestData.HttpMethod);
requestHandler.HttpClient = HttpClient;
requestHandler.HitEndpointAsync(requestData, callback);
}
}
} | using System;
using System.Collections.Generic;
using SevenDigital.Api.Wrapper.EndpointResolution.RequestHandlers;
using SevenDigital.Api.Wrapper.Http;
namespace SevenDigital.Api.Wrapper.EndpointResolution
{
public class RequestCoordinator : IRequestCoordinator
{
private readonly IEnumerable<RequestHandler> _requestHandlers;
public IHttpClient HttpClient { get; set; }
public RequestCoordinator(IHttpClient httpClient, IEnumerable<RequestHandler> requestHandlers)
{
HttpClient = httpClient;
_requestHandlers = requestHandlers;
}
public string ConstructEndpoint(RequestData requestData)
{
return ConstructBuilder(requestData).ConstructEndpoint(requestData);
}
private RequestHandler ConstructBuilder(RequestData requestData)
{
var upperInvariant = requestData.HttpMethod.ToUpperInvariant();
foreach (var requestHandler in _requestHandlers)
{
if (requestHandler.HandlesMethod(upperInvariant))
{
return requestHandler;
}
}
throw new NotImplementedException("No RequestHandlers supplied that can deal with this method");
}
public virtual Response HitEndpoint(RequestData requestData)
{
var builder = ConstructBuilder(requestData);
builder.HttpClient = HttpClient;
return builder.HitEndpoint(requestData);
}
public virtual void HitEndpointAsync(RequestData requestData, Action<Response> callback)
{
var builder = ConstructBuilder(requestData);
builder.HttpClient = HttpClient;
builder.HitEndpointAsync(requestData, callback);
}
}
} | mit | C# |
29c7a8df70ea0143ffaa243fa1ff997fd5bb23b8 | fix bug in fal copy. (#1052) | superyyrrzz/docfx,hellosnow/docfx,pascalberger/docfx,superyyrrzz/docfx,DuncanmaMSFT/docfx,dotnet/docfx,928PJY/docfx,pascalberger/docfx,928PJY/docfx,928PJY/docfx,hellosnow/docfx,hellosnow/docfx,superyyrrzz/docfx,DuncanmaMSFT/docfx,dotnet/docfx,LordZoltan/docfx,dotnet/docfx,LordZoltan/docfx,LordZoltan/docfx,pascalberger/docfx,LordZoltan/docfx | src/Microsoft.DocAsCode.Common/FileAbstractLayer/RealFileWriter.cs | src/Microsoft.DocAsCode.Common/FileAbstractLayer/RealFileWriter.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.Common
{
using System;
using System.Collections.Immutable;
using System.IO;
public class RealFileWriter : FileWriterBase
{
public RealFileWriter(string outputFolder)
: base(outputFolder) { }
#region Overrides
public override void Copy(PathMapping sourceFileName, RelativePath destFileName)
{
var f = Path.Combine(ExpandedOutputFolder, destFileName.RemoveWorkingFolder());
Directory.CreateDirectory(Path.GetDirectoryName(f));
File.Copy(Environment.ExpandEnvironmentVariables(sourceFileName.PhysicalPath), f, true);
File.SetAttributes(f, FileAttributes.Normal);
}
public override Stream Create(RelativePath file)
{
var f = Path.Combine(ExpandedOutputFolder, file.RemoveWorkingFolder());
Directory.CreateDirectory(Path.GetDirectoryName(f));
return File.Create(f);
}
public override IFileReader CreateReader()
{
return new RealFileReader(OutputFolder, ImmutableDictionary<string, string>.Empty);
}
#endregion
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.Common
{
using System;
using System.Collections.Immutable;
using System.IO;
public class RealFileWriter : FileWriterBase
{
public RealFileWriter(string outputFolder)
: base(outputFolder) { }
#region Overrides
public override void Copy(PathMapping sourceFileName, RelativePath destFileName)
{
var f = Path.Combine(ExpandedOutputFolder, destFileName.RemoveWorkingFolder());
Directory.CreateDirectory(Path.GetDirectoryName(f));
File.Copy(Environment.ExpandEnvironmentVariables(sourceFileName.PhysicalPath), f);
File.SetAttributes(f, FileAttributes.Normal);
}
public override Stream Create(RelativePath file)
{
var f = Path.Combine(ExpandedOutputFolder, file.RemoveWorkingFolder());
Directory.CreateDirectory(Path.GetDirectoryName(f));
return File.Create(f);
}
public override IFileReader CreateReader()
{
return new RealFileReader(OutputFolder, ImmutableDictionary<string, string>.Empty);
}
#endregion
}
}
| mit | C# |
549c76bf53e332658be1965834a8832bdc565fae | Fix type of p4 | setchi/Unity-LineSegmentsIntersection | Assets/LineSegmentIntersection/Scripts/Math2d.cs | Assets/LineSegmentIntersection/Scripts/Math2d.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace LineSegmentsIntersection
{
public static class Math2d
{
public static bool LineSegmentsIntersection(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, out Vector2 intersection)
{
intersection = Vector2.zero;
var d = (p2.x - p1.x) * (p4.y - p3.y) - (p2.y - p1.y) * (p4.x - p3.x);
if (d == 0.0f)
{
return false;
}
var u = ((p3.x - p1.x) * (p4.y - p3.y) - (p3.y - p1.y) * (p4.x - p3.x)) / d;
var v = ((p3.x - p1.x) * (p2.y - p1.y) - (p3.y - p1.y) * (p2.x - p1.x)) / d;
if (u < 0.0f || u > 1.0f || v < 0.0f || v > 1.0f)
{
return false;
}
intersection.x = p1.x + u * (p2.x - p1.x);
intersection.y = p1.y + u * (p2.y - p1.y);
return true;
}
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace LineSegmentsIntersection
{
public static class Math2d
{
public static bool LineSegmentsIntersection(Vector2 p1, Vector2 p2, Vector2 p3, Vector3 p4, out Vector2 intersection)
{
intersection = Vector2.zero;
var d = (p2.x - p1.x) * (p4.y - p3.y) - (p2.y - p1.y) * (p4.x - p3.x);
if (d == 0.0f)
{
return false;
}
var u = ((p3.x - p1.x) * (p4.y - p3.y) - (p3.y - p1.y) * (p4.x - p3.x)) / d;
var v = ((p3.x - p1.x) * (p2.y - p1.y) - (p3.y - p1.y) * (p2.x - p1.x)) / d;
if (u < 0.0f || u > 1.0f || v < 0.0f || v > 1.0f)
{
return false;
}
intersection.x = p1.x + u * (p2.x - p1.x);
intersection.y = p1.y + u * (p2.y - p1.y);
return true;
}
}
}
| mit | C# |
f1f7f47ce0f653842644e3dfda41c84c22b62b0e | Fix calculation for Room.top & Room.bottom | Saduras/DungeonGenerator | Assets/SourceCode/Room.cs | Assets/SourceCode/Room.cs | using UnityEngine;
public class Room : MonoBehaviour
{
public float width { get { return transform.localScale.x; } }
public float length { get { return transform.localScale.z; } }
public float top
{
get {
return transform.localPosition.z + length / 2;
}
}
public float bottom
{
get {
return transform.localPosition.z - length / 2;
}
}
public float left
{
get {
return transform.localPosition.x - width / 2;
}
}
public float right
{
get {
return transform.localPosition.x + width / 2;
}
}
public void Init(int width, int length)
{
transform.localScale = new Vector3 (width, 1f, length);
}
}
| using UnityEngine;
public class Room : MonoBehaviour
{
public float width { get { return transform.localScale.x; } }
public float length { get { return transform.localScale.z; } }
public float top
{
get {
return transform.localPosition.z + width / 2;
}
}
public float bottom
{
get {
return transform.localPosition.z - width / 2;
}
}
public float left
{
get {
return transform.localPosition.x - width / 2;
}
}
public float right
{
get {
return transform.localPosition.x + width / 2;
}
}
public void Init(int width, int length)
{
transform.localScale = new Vector3 (width, 1f, length);
}
}
| mit | C# |
abffd8293bec00982d72d40cd986a950d13122fe | Fix fat-finger made before the previous commit | Lunch-box/SimpleOrderRouting | CSharp/SimpleOrderRouting.Journey1/ExecutionState.cs | CSharp/SimpleOrderRouting.Journey1/ExecutionState.cs | namespace SimpleOrderRouting.Journey1
{
public class ExecutionState
{
public ExecutionState(InvestorInstruction investorInstruction)
{
this.Quantity = investorInstruction.Quantity;
this.Price = investorInstruction.Price;
this.Way = investorInstruction.Way;
this.AllowPartialExecution = investorInstruction.AllowPartialExecution;
}
public int Quantity { get; set; }
public decimal Price { get; set; }
public Way Way { get; set; }
public bool AllowPartialExecution { get; set; }
public void Executed(int quantity)
{
this.Quantity -= quantity;
}
}
} | namespace SimpleOrderRouting.Journey1
{
public class ExecutionState
{
public ExecutionState(InvestorInstruction investorInstruction)
{
this.Quantity = investorInstruction.Quantity;
this.Price = investorInstruction.Price;
this.Way = investorInstruction.Way;
this.AllowPartialExecution = investorInstruction.AllowPartialExecution;
}
public int Quantity { get; set; }
public decimal Price { get; set; }
public Way Way { get; set; }
public bool AllowPartialExecution { get; set; }
{
this.Quantity -= quantity;
}
}
} | apache-2.0 | C# |
984f9a550bdbcc5e6c293fa62244b22dc605582f | Fix random power use when cooldown | solfen/Rogue_Cadet | Assets/Scripts/SpecialPowers/PowerRandom.cs | Assets/Scripts/SpecialPowers/PowerRandom.cs | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PowerRandom : BaseSpecialPower {
[SerializeField] private List<BaseSpecialPower> powers;
private BaseSpecialPower activePower = null;
protected override void Start() {
base.Start();
activePower = Instantiate(powers[Random.Range(0, powers.Count)], transform.parent, false) as BaseSpecialPower;
}
protected override void Activate() {
if(activePower.coolDownTimer <= 0)
StartCoroutine(WaitForDestroy());
}
protected override void Update() {
if(activePower.mana > 0) {
base.Update();
}
}
IEnumerator WaitForDestroy() {
yield return null;
while(activePower.coolDownTimer > 0) {
yield return null;
}
float currentMana = activePower.mana;
Debug.Log(currentMana);
DestroyImmediate(activePower.gameObject);
activePower = Instantiate(powers[Random.Range(0, powers.Count)], transform.parent, false) as BaseSpecialPower;
yield return null;
activePower.mana = currentMana;
yield return null;
EventDispatcher.DispatchEvent(Events.SPECIAL_POWER_USED, activePower); //to activate the UI
}
}
| using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PowerRandom : BaseSpecialPower {
[SerializeField] private List<BaseSpecialPower> powers;
private BaseSpecialPower activePower = null;
protected override void Start() {
base.Start();
activePower = Instantiate(powers[Random.Range(0, powers.Count)], transform.parent, false) as BaseSpecialPower;
}
protected override void Activate() {
StartCoroutine(WaitForDestroy());
}
protected override void Update() {
if(activePower.mana > 0) {
base.Update();
}
}
IEnumerator WaitForDestroy() {
yield return null;
while(activePower.coolDownTimer > 0) {
yield return null;
}
float currentMana = activePower.mana;
DestroyImmediate(activePower.gameObject);
activePower = Instantiate(powers[Random.Range(0, powers.Count)], transform.parent, false) as BaseSpecialPower;
yield return null;
activePower.mana = currentMana;
yield return null;
EventDispatcher.DispatchEvent(Events.SPECIAL_POWER_USED, activePower); //to activate the UI
}
}
| mit | C# |
167d3b1a6a156463a68513ed6f18cac64a1c4fab | Update WindowsRegistrySettingsServiceOptions.cs | tiksn/TIKSN-Framework | TIKSN.Framework.Core/Settings/WindowsRegistrySettingsServiceOptions.cs | TIKSN.Framework.Core/Settings/WindowsRegistrySettingsServiceOptions.cs | using Microsoft.Win32;
namespace TIKSN.Settings
{
public class WindowsRegistrySettingsServiceOptions
{
public WindowsRegistrySettingsServiceOptions() => this.RegistryView = RegistryView.Default;
public RegistryView RegistryView { get; set; }
public string SubKey { get; set; }
}
}
| using Microsoft.Win32;
namespace TIKSN.Settings
{
public class WindowsRegistrySettingsServiceOptions
{
public WindowsRegistrySettingsServiceOptions()
{
RegistryView = RegistryView.Default;
}
public RegistryView RegistryView { get; set; }
public string SubKey { get; set; }
}
} | mit | C# |
afb15950afb313a4f26bfdbb39d0666f6500485d | Improve ToString when Id is null | drewnoakes/dasher | Dasher.Schemata/Schema.cs | Dasher.Schemata/Schema.cs | using System.Collections.Generic;
using System.Xml.Linq;
using JetBrains.Annotations;
namespace Dasher.Schemata
{
public interface IWriteSchema
{
/// <summary>
/// Creates a deep copy of this schema within <paramref name="collection"/>.
/// </summary>
/// <param name="collection"></param>
/// <returns></returns>
IWriteSchema CopyTo(SchemaCollection collection);
}
public interface IReadSchema
{
bool CanReadFrom(IWriteSchema writeSchema, bool strict);
/// <summary>
/// Creates a deep copy of this schema within <paramref name="collection"/>.
/// </summary>
/// <param name="collection"></param>
/// <returns></returns>
IReadSchema CopyTo(SchemaCollection collection);
}
public abstract class Schema
{
internal abstract IEnumerable<Schema> Children { get; }
public override bool Equals(object obj)
{
var other = obj as Schema;
return other != null && Equals(other);
}
public abstract bool Equals(Schema other);
public override int GetHashCode() => ComputeHashCode();
protected abstract int ComputeHashCode();
}
/// <summary>For complex, union and enum.</summary>
public abstract class ByRefSchema : Schema
{
[CanBeNull]
internal string Id { get; set; }
internal abstract XElement ToXml();
public override string ToString() => Id ?? GetType().Name;
}
/// <summary>For primitive, nullable, list, dictionary, tuple, empty.</summary>
public abstract class ByValueSchema : Schema
{
internal abstract string MarkupValue { get; }
public override string ToString() => MarkupValue;
}
} | using System.Collections.Generic;
using System.Xml.Linq;
using JetBrains.Annotations;
namespace Dasher.Schemata
{
public interface IWriteSchema
{
/// <summary>
/// Creates a deep copy of this schema within <paramref name="collection"/>.
/// </summary>
/// <param name="collection"></param>
/// <returns></returns>
IWriteSchema CopyTo(SchemaCollection collection);
}
public interface IReadSchema
{
bool CanReadFrom(IWriteSchema writeSchema, bool strict);
/// <summary>
/// Creates a deep copy of this schema within <paramref name="collection"/>.
/// </summary>
/// <param name="collection"></param>
/// <returns></returns>
IReadSchema CopyTo(SchemaCollection collection);
}
public abstract class Schema
{
internal abstract IEnumerable<Schema> Children { get; }
public override bool Equals(object obj)
{
var other = obj as Schema;
return other != null && Equals(other);
}
public abstract bool Equals(Schema other);
public override int GetHashCode() => ComputeHashCode();
protected abstract int ComputeHashCode();
}
/// <summary>For complex, union and enum.</summary>
public abstract class ByRefSchema : Schema
{
[CanBeNull]
internal string Id { get; set; }
internal abstract XElement ToXml();
public override string ToString() => Id;
}
/// <summary>For primitive, nullable, list, dictionary, tuple, empty.</summary>
public abstract class ByValueSchema : Schema
{
internal abstract string MarkupValue { get; }
public override string ToString() => MarkupValue;
}
} | apache-2.0 | C# |
f3dd77c8eb02a7212495eb29692d22f50156aff7 | Use HashSet to ensure no duplicate collidingObjects | JScott/ViveGrip | Assets/ViveGrip/Scripts/Internal/ViveGrip_TouchDetection.cs | Assets/ViveGrip/Scripts/Internal/ViveGrip_TouchDetection.cs | using UnityEngine;
using System.Collections.Generic;
public class ViveGrip_TouchDetection : MonoBehaviour {
private HashSet<ViveGrip_Object> collidingObjects = new HashSet<ViveGrip_Object>();
void Start () {
GetComponent<SphereCollider>().isTrigger = true;
}
void OnTriggerEnter(Collider other) {
ViveGrip_Object component = ActiveComponent(other.gameObject);
if (component == null) { return; }
collidingObjects.Add(component);
}
void OnTriggerExit(Collider other) {
ViveGrip_Object component = ActiveComponent(other.gameObject);
if (component == null) { return; }
collidingObjects.Remove(component);
}
public GameObject NearestObject() {
float closestDistance = Mathf.Infinity;
GameObject touchedObject = null;
foreach (ViveGrip_Object component in collidingObjects) {
float distance = Vector3.Distance(transform.position, component.transform.position);
if (distance < closestDistance) {
touchedObject = component.gameObject;
closestDistance = distance;
}
}
return touchedObject;
}
ViveGrip_Object ActiveComponent(GameObject gameObject) {
if (gameObject == null) { return null; } // Happens with Destroy() sometimes
ViveGrip_Object component = ValidComponent(gameObject.transform);
if (component == null) {
component = ValidComponent(gameObject.transform.parent);
}
if (component != null) {
return component;
}
return null;
}
ViveGrip_Object ValidComponent(Transform transform) {
if (transform == null) { return null; }
ViveGrip_Object component = transform.GetComponent<ViveGrip_Object>();
if (component != null && component.enabled) { return component; }
return null;
}
}
| using UnityEngine;
using System.Collections.Generic;
public class ViveGrip_TouchDetection : MonoBehaviour {
private List<ViveGrip_Object> collidingObjects = new List<ViveGrip_Object>();
void Start () {
GetComponent<SphereCollider>().isTrigger = true;
}
void OnTriggerEnter(Collider other) {
ViveGrip_Object component = ActiveComponent(other.gameObject);
if (component == null) { return; }
collidingObjects.Add(component);
}
void OnTriggerExit(Collider other) {
ViveGrip_Object component = ActiveComponent(other.gameObject);
if (component == null) { return; }
collidingObjects.Remove(component);
}
public GameObject NearestObject() {
float closestDistance = Mathf.Infinity;
GameObject touchedObject = null;
foreach (ViveGrip_Object component in collidingObjects) {
float distance = Vector3.Distance(transform.position, component.transform.position);
if (distance < closestDistance) {
touchedObject = component.gameObject;
closestDistance = distance;
}
}
return touchedObject;
}
ViveGrip_Object ActiveComponent(GameObject gameObject) {
if (gameObject == null) { return null; } // Happens with Destroy() sometimes
ViveGrip_Object component = ValidComponent(gameObject.transform);
if (component == null) {
component = ValidComponent(gameObject.transform.parent);
}
if (component != null) {
return component;
}
return null;
}
ViveGrip_Object ValidComponent(Transform transform) {
if (transform == null) { return null; }
ViveGrip_Object component = transform.GetComponent<ViveGrip_Object>();
if (component != null && component.enabled) { return component; }
return null;
}
}
| mit | C# |
740a6d9bb52fd9ea8894de60df87f585a91db7d8 | Support full range of comparison operators instead of IndexOf | adoprog/Sitecore-Mobile-Device-Detector | MobileDeviceDetector/Rules/Conditions/UserAgentCondition.cs | MobileDeviceDetector/Rules/Conditions/UserAgentCondition.cs | namespace Sitecore.SharedSource.MobileDeviceDetector.Rules.Conditions
{
using System;
using System.Web;
using Sitecore.Diagnostics;
using Sitecore.Rules;
using Sitecore.Rules.Conditions;
/// <summary>
/// UserAgentCondition
/// </summary>
/// <typeparam name="T"></typeparam>
public class UserAgentCondition<T> : StringOperatorCondition<T> where T : RuleContext
{
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
public string Value { get; set; }
/// <summary>
/// Executes the specified rule context.
/// </summary>
/// <param name="ruleContext">The rule context.</param>
/// <returns>Returns value indicating whether Device UserAgent matches Value or not</returns>
protected override bool Execute(T ruleContext)
{
Assert.ArgumentNotNull(ruleContext, "ruleContext");
string str = this.Value ?? string.Empty;
var userAgent = HttpContext.Current.Request.UserAgent;
if (!string.IsNullOrEmpty(userAgent))
{
return Compare(str, userAgent);
}
return false;
}
}
}
| namespace Sitecore.SharedSource.MobileDeviceDetector.Rules.Conditions
{
using System;
using System.Web;
using Sitecore.Diagnostics;
using Sitecore.Rules;
using Sitecore.Rules.Conditions;
/// <summary>
/// UserAgentCondition
/// </summary>
/// <typeparam name="T"></typeparam>
public class UserAgentCondition<T> : StringOperatorCondition<T> where T : RuleContext
{
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
public string Value { get; set; }
/// <summary>
/// Executes the specified rule context.
/// </summary>
/// <param name="ruleContext">The rule context.</param>
/// <returns>Returns value indicating whether Device UserAgent matches Value or not</returns>
protected override bool Execute(T ruleContext)
{
Assert.ArgumentNotNull(ruleContext, "ruleContext");
string str = this.Value ?? string.Empty;
var userAgent = HttpContext.Current.Request.UserAgent;
if (!string.IsNullOrEmpty(userAgent))
{
return userAgent.IndexOf(str, StringComparison.OrdinalIgnoreCase) >= 0;
}
return false;
}
}
}
| mit | C# |
795d109e9dfeab2eb1c3bbf1c893a0f6399edf7c | Fix twitter issue | libertyernie/WeasylSync | CrosspostSharp3/Program.cs | CrosspostSharp3/Program.cs | using ISchemm.WinFormsOAuth;
using Newtonsoft.Json;
using SourceWrappers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Tweetinvi;
using Tweetinvi.Logic.JsonConverters;
using Tweetinvi.Models;
namespace CrosspostSharp3 {
public class CustomJsonLanguageConverter : JsonLanguageConverter {
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
return reader.Value != null
? base.ReadJson(reader, objectType, existingValue, serializer)
: Language.English;
}
}
public static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args) {
ExceptionHandler.SwallowWebExceptions = false;
TweetinviConfig.CurrentThreadSettings.TweetMode = TweetMode.Extended;
IECookiePersist.Suppress(true);
IECompatibility.SetForCurrentProcess();
JsonPropertyConverterRepository.JsonConverters.Remove(typeof(Language));
JsonPropertyConverterRepository.JsonConverters.Add(typeof(Language), new CustomJsonLanguageConverter());
// Force current directory (if a file or folder was dragged onto CrosspostSharp3.exe)
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length == 1) {
try {
var artwork = SavedPhotoPost.FromFile(args[0]);
if (artwork.data == null) {
throw new Exception("This file does not contain a base-64 encoded \"data\" field.");
}
Application.Run(new ArtworkForm(artwork));
} catch (Exception ex) {
MessageBox.Show(ex.Message, ex.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} else {
Application.Run(new MainForm());
}
}
}
}
| using ISchemm.WinFormsOAuth;
using SourceWrappers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Tweetinvi;
namespace CrosspostSharp3 {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args) {
ExceptionHandler.SwallowWebExceptions = false;
TweetinviConfig.CurrentThreadSettings.TweetMode = TweetMode.Extended;
IECookiePersist.Suppress(true);
IECompatibility.SetForCurrentProcess();
// Force current directory (if a file or folder was dragged onto CrosspostSharp3.exe)
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length == 1) {
try {
var artwork = SavedPhotoPost.FromFile(args[0]);
if (artwork.data == null) {
throw new Exception("This file does not contain a base-64 encoded \"data\" field.");
}
Application.Run(new ArtworkForm(artwork));
} catch (Exception ex) {
MessageBox.Show(ex.Message, ex.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} else {
Application.Run(new MainForm());
}
}
}
}
| mit | C# |
d5e9c87364684e0d63525cb50ea72fe251f29d69 | Update AssemblyInfo.cs | mattyway/Hangfire.Autofac,HangfireIO/Hangfire.Autofac | HangFire.Autofac/Properties/AssemblyInfo.cs | HangFire.Autofac/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HangFire.Autofac")]
[assembly: AssemblyDescription("Autofac IoC Container support for HangFire (background job system for ASP.NET applications).")]
[assembly: AssemblyProduct("HangFire")]
[assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")]
// 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("c38d8acf-7b2c-4d7f-84ad-c477879ade3f")]
[assembly: AssemblyVersion("0.1.2.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HangFire.Autofac")]
[assembly: AssemblyDescription("Autofac IoC Container support for HangFire (background job system for ASP.NET applications).")]
[assembly: AssemblyProduct("HangFire")]
[assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")]
// 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("c38d8acf-7b2c-4d7f-84ad-c477879ade3f")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
a906a002cc2f94ffd724e4b46d1ee81a0d17f529 | Remove empty navigation list in anydiff module (invalid HTML). | dokipen/trac,dafrito/trac-mirror,exocad/exotrac,exocad/exotrac,exocad/exotrac,moreati/trac-gitsvn,moreati/trac-gitsvn,moreati/trac-gitsvn,moreati/trac-gitsvn,dafrito/trac-mirror,dokipen/trac,exocad/exotrac,dokipen/trac,dafrito/trac-mirror,dafrito/trac-mirror | templates/anydiff.cs | templates/anydiff.cs | <?cs include "header.cs"?>
<div id="ctxtnav" class="nav"></div>
<div id="content" class="changeset">
<div id="title">
<h1>Select Base and Target for Diff:</h1>
</div>
<div id="anydiff">
<form action="<?cs var:anydiff.changeset_href ?>" method="get">
<table>
<tr>
<th><label for="old_path">From:</label></th>
<td>
<input type="text" id="old_path" name="old_path" value="<?cs
var:anydiff.old_path ?>" size="44" />
<label for="old_rev">at Revision:</label>
<input type="text" id="old_rev" name="old" value="<?cs
var:anydiff.old_rev ?>" size="4" />
</td>
</tr>
<tr>
<th><label for="new_path">To:</label></th>
<td>
<input type="text" id="new_path" name="new_path" value="<?cs
var:anydiff.new_path ?>" size="44" />
<label for="new_rev">at Revision:</label>
<input type="text" id="new_rev" name="new" value="<?cs
var:anydiff.new_rev ?>" size="4" />
</td>
</tr>
</table>
<div class="buttons">
<input type="submit" value="View changes" />
</div>
</form>
</div>
<div id="help">
<strong>Note:</strong> See <a href="<?cs var:trac.href.wiki
?>/TracChangeset#ExaminingArbitraryDifferences">TracChangeset</a> for help on using the arbitrary diff feature.
</div>
</div>
<?cs include "footer.cs"?>
| <?cs include "header.cs"?>
<div id="ctxtnav" class="nav">
<h2>Navigation</h2><?cs
with:links = chrome.links ?>
<ul>
</ul><?cs
/with ?>
</div>
<div id="content" class="changeset">
<div id="title">
<h1>Select Base and Target for Diff:</h1>
</div>
<div id="anydiff">
<form action="<?cs var:anydiff.changeset_href ?>" method="get">
<table>
<tr>
<th><label for="old_path">From:</label></th>
<td>
<input type="text" id="old_path" name="old_path" value="<?cs
var:anydiff.old_path ?>" size="44" />
<label for="old_rev">at Revision:</label>
<input type="text" id="old_rev" name="old" value="<?cs
var:anydiff.old_rev ?>" size="4" />
</td>
</tr>
<tr>
<th><label for="new_path">To:</label></th>
<td>
<input type="text" id="new_path" name="new_path" value="<?cs
var:anydiff.new_path ?>" size="44" />
<label for="new_rev">at Revision:</label>
<input type="text" id="new_rev" name="new" value="<?cs
var:anydiff.new_rev ?>" size="4" />
</td>
</tr>
</table>
<div class="buttons">
<input type="submit" value="View changes" />
</div>
</form>
</div>
<div id="help">
<strong>Note:</strong> See <a href="<?cs var:trac.href.wiki
?>/TracChangeset#ExaminingArbitraryDifferences">TracChangeset</a> for help on using the arbitrary diff feature.
</div>
</div>
<?cs include "footer.cs"?>
| bsd-3-clause | C# |
f3f165efa8806d490f87820ab4e72257d25bf72c | fix compression mode message | SignalGo/SignalGo-full-net | SignalGo.Shared/IO/Compressions/CompressionHelper.cs | SignalGo.Shared/IO/Compressions/CompressionHelper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SignalGo.Shared.IO.Compressions
{
public static class CompressionHelper
{
public static ICompression GetCompression(CompressMode compressMode, Func<ICompression> getCustomCompression)
{
if (compressMode == CompressMode.None)
return new NoCompression();
if (getCustomCompression != null)
return getCustomCompression();
throw new NotSupportedException($"Compression mode of {compressMode} not supported!");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SignalGo.Shared.IO.Compressions
{
public static class CompressionHelper
{
public static ICompression GetCompression(CompressMode compressMode, Func<ICompression> getCustomCompression)
{
if (compressMode == CompressMode.None)
return new NoCompression();
if (getCustomCompression != null)
return getCustomCompression();
throw new NotSupportedException();
}
}
}
| mit | C# |
ef59521848f3dd54abd3acc986f711af4617d2c4 | Update String-Reversal.cs | DeanCabral/Code-Snippets | Console/String-Reversal.cs | Console/String-Reversal.cs | class StringReversal
{
static void Main(string[] args)
{
GetUserInput();
}
static void GetUserInput()
{
string input = "";
Console.Write("Enter a word: ");
input = Console.ReadLine();
Console.WriteLine("The reverse word of the string '{0}' is: {1}", input, ReverseString(input));
GetUserInput();
}
static string ReverseString(string input)
{
string reversed = "";
for (int i = input.Length - 1; i >= 0; i--)
{
reversed += input[i];
}
return reversed;
}
}
| class StringReversal
{
static void Main(string[] args)
{
GetUserInput();
}
static void GetUserInput()
{
string input = "";
Console.Write("Enter a word: ");
input = Console.ReadLine();
Console.WriteLine("The reverse word of the string '{0}' is: {1}", input, ReverseString(input));
GetUserInput();
}
static string ReverseString(string input)
{
string reversed = "";
for (int i = input.Length - 1; i >= 0; i--)
{
reversed += input[i];
}
return reversed;
}
}
| mit | C# |
176b9b16e8bde46d31f4d7e3bb490727233dc3cd | Write files without BOM | paulroho/ConvertToUtf8 | ConvertToUtf8/Converter.cs | ConvertToUtf8/Converter.cs | using System;
using System.IO;
using System.Text;
namespace ConvertToUtf8
{
public interface IConverter
{
void ConvertFile(string inputFile, string outputFile);
void ConvertFiles(string folder);
}
public class Converter : IConverter
{
public void ConvertFile(string inputFile, string outputFile)
{
Console.Write($"Converting {inputFile}...");
using (var reader = new StreamReader(inputFile, Encoding.Unicode))
{
var utf8EncodingWithoutBOM = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);
using (var writer = new StreamWriter(outputFile, false, utf8EncodingWithoutBOM))
{
CopyContents(reader, writer);
}
}
Console.WriteLine("(done)");
}
public void ConvertFiles(string folder)
{
foreach (var file in Directory.EnumerateFiles(folder))
{
var tempTargetFile = file + ".tmptgt";
ConvertFile(file, tempTargetFile);
File.Copy(tempTargetFile, file, overwrite:true);
File.Delete(tempTargetFile);
}
}
private void CopyContents(TextReader input, TextWriter output)
{
var buffer = new char[8192];
int len;
while ((len = input.Read(buffer, 0, buffer.Length)) != 0)
{
output.Write(buffer, 0, len);
}
}
}
} | using System;
using System.IO;
using System.Text;
namespace ConvertToUtf8
{
public interface IConverter
{
void ConvertFile(string inputFile, string outputFile);
void ConvertFiles(string folder);
}
public class Converter : IConverter
{
public void ConvertFile(string inputFile, string outputFile)
{
using (var reader = new StreamReader(inputFile, Encoding.Unicode))
{
using (var writer = new StreamWriter(outputFile, false, Encoding.UTF8))
{
CopyContents(reader, writer);
}
}
}
public void ConvertFiles(string folder)
{
foreach (var file in Directory.EnumerateFiles(folder))
{
var tempTargetFile = file + ".tmptgt";
ConvertFile(file, tempTargetFile);
File.Copy(tempTargetFile, file, overwrite:true);
File.Delete(tempTargetFile);
}
}
private void CopyContents(TextReader input, TextWriter output)
{
var buffer = new char[8192];
int len;
while ((len = input.Read(buffer, 0, buffer.Length)) != 0)
{
output.Write(buffer, 0, len);
}
}
}
} | mit | C# |
57b0821e19d6d54ca7c83e7ffb74f43605846e8b | Revert "Rewrite folder write permission check to hopefully make it more reliable" | chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck | Core/Utils/WindowsUtils.cs | Core/Utils/WindowsUtils.cs | using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.AccessControl;
using System.Security.Principal;
namespace TweetDck.Core.Utils{
static class WindowsUtils{
public static bool CheckFolderPermission(string path, FileSystemRights right){
try{
AuthorizationRuleCollection rules = Directory.GetAccessControl(path).GetAccessRules(true, true, typeof(SecurityIdentifier));
WindowsIdentity identity = WindowsIdentity.GetCurrent();
if (identity.Groups == null){
return false;
}
bool accessAllow = false, accessDeny = false;
foreach(FileSystemAccessRule rule in rules.Cast<FileSystemAccessRule>().Where(rule => identity.Groups.Contains(rule.IdentityReference) && (right & rule.FileSystemRights) == right)){
switch(rule.AccessControlType){
case AccessControlType.Allow: accessAllow = true; break;
case AccessControlType.Deny: accessDeny = true; break;
}
}
return accessAllow && !accessDeny;
}
catch{
return false;
}
}
public static Process StartProcess(string file, string arguments, bool runElevated){
ProcessStartInfo processInfo = new ProcessStartInfo{
FileName = file,
Arguments = arguments
};
if (runElevated){
processInfo.Verb = "runas";
}
return Process.Start(processInfo);
}
}
}
| using System.Diagnostics;
using System.IO;
using System.Security.AccessControl;
using System.Security.Principal;
namespace TweetDck.Core.Utils{
static class WindowsUtils{
public static bool CheckFolderPermission(string path, FileSystemRights right){
try{
AuthorizationRuleCollection collection = Directory.GetAccessControl(path).GetAccessRules(true, true, typeof(NTAccount));
foreach(FileSystemAccessRule rule in collection){
if ((rule.FileSystemRights & right) == right){
return true;
}
}
return false;
}
catch{
return false;
}
}
public static Process StartProcess(string file, string arguments, bool runElevated){
ProcessStartInfo processInfo = new ProcessStartInfo{
FileName = file,
Arguments = arguments
};
if (runElevated){
processInfo.Verb = "runas";
}
return Process.Start(processInfo);
}
}
}
| mit | C# |
952d46f58f6a5159ab10c90b148fcbd2b566b63c | Add Positions body param to PlaylistRemoveItemsRequest, #501 | JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET | SpotifyAPI.Web/Models/Request/PlaylistRemoveItemsRequest.cs | SpotifyAPI.Web/Models/Request/PlaylistRemoveItemsRequest.cs | using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web
{
public class PlaylistRemoveItemsRequest : RequestParams
{
/// <summary>
/// An array of objects containing Spotify URIs of the tracks or episodes to remove.
/// For example: { "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },
/// { "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }.
/// A maximum of 100 objects can be sent at once.
/// </summary>
/// <value></value>
[BodyParam("tracks")]
public IList<Item>? Tracks { get; set; }
/// <summary>
/// An array of positions to delete. This also supports local tracks.
/// SnapshotId MUST be supplied when using this parameter
/// </summary>
/// <value></value>
[BodyParam("positions")]
public IList<int>? Positions { get; set; }
/// <summary>
/// The playlist’s snapshot ID against which you want to make the changes.
/// The API will validate that the specified items exist and in the specified positions and make the changes,
/// even if more recent changes have been made to the playlist.
/// </summary>
/// <value></value>
[BodyParam("snapshot_id")]
public string? SnapshotId { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034")]
public class Item
{
[JsonProperty("uri", NullValueHandling = NullValueHandling.Ignore)]
public string? Uri { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227")]
[JsonProperty("positions", NullValueHandling = NullValueHandling.Ignore)]
public List<int>? Positions { get; set; }
}
}
}
| using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web
{
public class PlaylistRemoveItemsRequest : RequestParams
{
/// <summary>
///
/// </summary>
/// <param name="tracks">
/// An array of objects containing Spotify URIs of the tracks or episodes to remove.
/// For example: { "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },
/// { "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }.
/// A maximum of 100 objects can be sent at once.
/// </param>
public PlaylistRemoveItemsRequest(IList<Item> tracks)
{
Ensure.ArgumentNotNullOrEmptyList(tracks, nameof(tracks));
Tracks = tracks;
}
/// <summary>
/// An array of objects containing Spotify URIs of the tracks or episodes to remove.
/// For example: { "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },
/// { "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }.
/// A maximum of 100 objects can be sent at once.
/// </summary>
/// <value></value>
[BodyParam("tracks")]
public IList<Item> Tracks { get; }
/// <summary>
/// The playlist’s snapshot ID against which you want to make the changes.
/// The API will validate that the specified items exist and in the specified positions and make the changes,
/// even if more recent changes have been made to the playlist.
/// </summary>
/// <value></value>
[BodyParam("snapshot_id")]
public string? SnapshotId { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034")]
public class Item
{
[JsonProperty("uri", NullValueHandling = NullValueHandling.Ignore)]
public string? Uri { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227")]
[JsonProperty("positions", NullValueHandling = NullValueHandling.Ignore)]
public List<int>? Positions { get; set; }
}
}
}
| mit | C# |
b8e1d50d0dc82932579020b832a1603920bce1a9 | Add Timeout | maxpiva/Nancy.Rest.Annotations | Atributes/Rest.cs | Atributes/Rest.cs | using System;
using Nancy.Rest.Annotations.Enums;
namespace Nancy.Rest.Annotations.Atributes
{
[AttributeUsage(AttributeTargets.Method)]
public class Rest : Attribute
{
public Verbs Verb { get; set; }
public string Route { get; set; }
public string ResponseContentType { get; set; }
public int TimeOutSeconds { get; set; }
public Rest(string route, Verbs verb, string contentype = null, int timeOutSeconds = 0)
{
Verb = verb;
Route = route;
ResponseContentType = contentype;
TimeOutSeconds = timeOutSeconds;
}
}
}
| using System;
using Nancy.Rest.Annotations.Enums;
namespace Nancy.Rest.Annotations.Atributes
{
[AttributeUsage(AttributeTargets.Method)]
public class Rest : Attribute
{
public Verbs Verb { get; set; }
public string Route { get; set; }
public string ResponseContentType { get; set; }
public Rest(string route, Verbs verb, string contentype = null)
{
Verb = verb;
Route = route;
ResponseContentType = contentype;
}
}
}
| mit | C# |
39cfe75b9c2857f54b67fbb2aee1971bdece8cd3 | Fix typo in OnboardingRead and add SettlementsRead | Viincenttt/MollieApi,Viincenttt/MollieApi | Mollie.Api/Models/Connect/AppPermissions.cs | Mollie.Api/Models/Connect/AppPermissions.cs | namespace Mollie.Api.Models.Connect {
public static class AppPermissions {
public const string PaymentsRead = "payments.read";
public const string PaymentsWrite = "payments.write";
public const string RefundsRead = "refunds.read";
public const string RefundsWrite = "refunds.write";
public const string CustomersRead = "customers.read";
public const string CustomersWrite = "customers.write";
public const string MandatesRead = "mandates.read";
public const string MandatesWrite = "mandates.write";
public const string SubscriptionsRead = "subscriptions.read";
public const string SubscriptionsWrite = "subscriptions.write";
public const string ProfilesRead = "profiles.read";
public const string ProfilesWrite = "profiles.write";
public const string InvoicesRead = "invoices.read";
public const string OrdersRead = "orders.read";
public const string OrdersWrite = "orders.write";
public const string ShipmentsRead = "shipments.read";
public const string ShipmentsWrite = "shipments.write";
public const string OrganizationRead = "organizations.read";
public const string OrganizationWrite = "organizations.write";
public const string OnboardingRead = "onboarding.read";
public const string OnboardingWrite = "onboarding.write";
public const string SettlementsRead = "settlements.read";
}
}
| namespace Mollie.Api.Models.Connect {
public static class AppPermissions {
public const string PaymentsRead = "payments.read";
public const string PaymentsWrite = "payments.write";
public const string RefundsRead = "refunds.read";
public const string RefundsWrite = "refunds.write";
public const string CustomersRead = "customers.read";
public const string CustomersWrite = "customers.write";
public const string MandatesRead = "mandates.read";
public const string MandatesWrite = "mandates.write";
public const string SubscriptionsRead = "subscriptions.read";
public const string SubscriptionsWrite = "subscriptions.write";
public const string ProfilesRead = "profiles.read";
public const string ProfilesWrite = "profiles.write";
public const string InvoicesRead = "invoices.read";
public const string OrdersRead = "orders.read";
public const string OrdersWrite = "orders.write";
public const string ShipmentsRead = "shipments.read";
public const string ShipmentsWrite = "shipments.write";
public const string OrganizationRead = "organizations.read";
public const string OrganizationWrite = "organizations.write";
public const string OnboardingRead = "onboarding.write";
public const string OnboardingWrite = "onboarding.write";
}
}
| mit | C# |
c14923f50b7de89b77ff324e85966542bc39e64b | add top script section in layout | mruhul/workshop-carsales-web-mvc,mruhul/workshop-carsales-web-mvc | Src/Carsales.Web/Features/Shared/Views/_Layout.cshtml | Src/Carsales.Web/Features/Shared/Views/_Layout.cshtml | @{
Layout = "~/Features/Shared/Views/_LayoutBasic.cshtml";
}
@if (IsSectionDefined("Head"))
{
@RenderSection("Head")
}
@if (IsSectionDefined("Styles"))
{
@RenderSection("Styles")
}
@if (IsSectionDefined("TopScripts"))
{
@RenderSection("TopScripts")
}
@{
Html.RenderPartial("_Header");
}
<section>
@RenderBody()
</section>
@{
Html.RenderPartial("_Footer");
}
@if (IsSectionDefined("BottomScript"))
{
@RenderSection("BottomScript")
} | @{
Layout = "~/Features/Shared/Views/_LayoutBasic.cshtml";
}
@if (IsSectionDefined("Head"))
{
@RenderSection("Head")
}
@if (IsSectionDefined("Styles"))
{
@RenderSection("Styles")
}
@{
Html.RenderPartial("_Header");
}
<section>
@RenderBody()
</section>
@{
Html.RenderPartial("_Footer");
}
@if (IsSectionDefined("BottomScript"))
{
@RenderSection("BottomScript")
} | mit | C# |
ed7382495a1b6608b108eb60c9507e2f6eec70b0 | Use BinaryReferenceAdapter | BenPhegan/NuGet.Extensions | NuGet.Extensions/Commands/ProjectAdapter.cs | NuGet.Extensions/Commands/ProjectAdapter.cs | using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Build.Evaluation;
namespace NuGet.Extensions.Commands
{
public class ProjectAdapter : IProjectAdapter
{
private readonly Project _project;
private readonly string _packagesConfigFilename;
public ProjectAdapter(Project project, string packagesConfigFilename)
{
_project = project;
_packagesConfigFilename = packagesConfigFilename;
}
public ICollection<ProjectItem> GetBinaryReferences()
{
return _project.GetItems("Reference");
}
public string GetAssemblyName()
{
return _project.GetPropertyValue("AssemblyName");
}
public void Save()
{
_project.Save();
}
public void AddPackagesConfig()
{ //Add the packages.config to the project content, otherwise later versions of the VSIX fail...
if (!HasPackagesConfig())
{
_project.Xml.AddItemGroup().AddItem("None", _packagesConfigFilename);
Save();
}
}
private bool HasPackagesConfig()
{
return _project.GetItems("None").Any(i => i.UnevaluatedInclude.Equals(_packagesConfigFilename));
}
public static List<string> GetReferencedAssemblies(ICollection<ProjectItem> references)
{
var referenceFiles = new List<string>();
foreach (var reference in references.Select(r => new BinaryReferenceAdapter(r)))
{
//TODO deal with GAC assemblies that we want to replace as well....
if (reference.HasHintPath())
{
var hintPath = reference.GetHintPath();
referenceFiles.Add(Path.GetFileName(hintPath));
}
}
return referenceFiles;
}
}
} | using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Build.Evaluation;
namespace NuGet.Extensions.Commands
{
public class ProjectAdapter : IProjectAdapter
{
private readonly Project _project;
private readonly string _packagesConfigFilename;
public ProjectAdapter(Project project, string packagesConfigFilename)
{
_project = project;
_packagesConfigFilename = packagesConfigFilename;
}
public ICollection<ProjectItem> GetBinaryReferences()
{
return _project.GetItems("Reference");
}
public string GetAssemblyName()
{
return _project.GetPropertyValue("AssemblyName");
}
public void Save()
{
_project.Save();
}
public void AddPackagesConfig()
{ //Add the packages.config to the project content, otherwise later versions of the VSIX fail...
if (!HasPackagesConfig())
{
_project.Xml.AddItemGroup().AddItem("None", _packagesConfigFilename);
Save();
}
}
private bool HasPackagesConfig()
{
return _project.GetItems("None").Any(i => i.UnevaluatedInclude.Equals(_packagesConfigFilename));
}
public static List<string> GetReferencedAssemblies(IEnumerable<ProjectItem> references)
{
var referenceFiles = new List<string>();
foreach (ProjectItem reference in references)
{
//TODO deal with GAC assemblies that we want to replace as well....
if (reference.HasMetadata("HintPath"))
{
var hintPath = reference.GetMetadataValue("HintPath");
referenceFiles.Add(Path.GetFileName(hintPath));
}
}
return referenceFiles;
}
}
} | mit | C# |
c420f373a5ddc8050a2d3f419282feb2c41326fa | Add warning message to ensure user is running the Azure Emulator | endjin/Endjin.Cancelable,endjin/Endjin.Cancelable | Solutions/Endjin.Cancelable.Demo/Program.cs | Solutions/Endjin.Cancelable.Demo/Program.cs | namespace Endjin.Cancelable.Demo
{
#region Using Directives
using System;
using System.Threading;
using System.Threading.Tasks;
using Endjin.Contracts;
using Endjin.Core.Composition;
using Endjin.Core.Container;
#endregion
public class Program
{
public static void Main(string[] args)
{
Console.BackgroundColor = ConsoleColor.Red;
Console.WriteLine("Ensure you are running the Azure Storage Emulator!");
Console.ResetColor();
ApplicationServiceLocator.InitializeAsync(new Container(), new DesktopBootstrapper()).Wait();
var cancelable = ApplicationServiceLocator.Container.Resolve<ICancelable>();
var cancellationToken = "E75FF4F5-755E-4FB9-ABE0-24BD81F4D045";
cancelable.CreateToken(cancellationToken);
cancelable.RunUntilCompleteOrCancelledAsync(DoSomethingLongRunningAsync, cancellationToken).Wait();
Console.WriteLine("Press Any Key to Exit!");
Console.ReadKey();
}
private static async Task DoSomethingLongRunningAsync(CancellationToken cancellationToken)
{
int counter = 0;
while (!cancellationToken.IsCancellationRequested)
{
Console.WriteLine("Doing something {0}", DateTime.Now.ToString("T"));
await Task.Delay(TimeSpan.FromSeconds(1));
counter++;
if (counter == 15)
{
Console.WriteLine("Long Running Process Ran to Completion!");
break;
}
}
if (cancellationToken.IsCancellationRequested)
{
Console.WriteLine("Long Running Process was Cancelled!");
}
}
}
} | namespace Endjin.Cancelable.Demo
{
#region Using Directives
using System;
using System.Threading;
using System.Threading.Tasks;
using Endjin.Contracts;
using Endjin.Core.Composition;
using Endjin.Core.Container;
#endregion
public class Program
{
public static void Main(string[] args)
{
ApplicationServiceLocator.InitializeAsync(new Container(), new DesktopBootstrapper()).Wait();
var cancelable = ApplicationServiceLocator.Container.Resolve<ICancelable>();
var cancellationToken = "E75FF4F5-755E-4FB9-ABE0-24BD81F4D045";
cancelable.CreateToken(cancellationToken);
cancelable.RunUntilCompleteOrCancelledAsync(DoSomethingLongRunningAsync, cancellationToken).Wait();
Console.WriteLine("Press Any Key to Exit!");
Console.ReadKey();
}
private static async Task DoSomethingLongRunningAsync(CancellationToken cancellationToken)
{
int counter = 0;
while (!cancellationToken.IsCancellationRequested)
{
Console.WriteLine("Doing something {0}", DateTime.Now.ToString("T"));
await Task.Delay(TimeSpan.FromSeconds(1));
counter++;
if (counter == 15)
{
Console.WriteLine("Long Running Process Ran to Completion!");
break;
}
}
if (cancellationToken.IsCancellationRequested)
{
Console.WriteLine("Long Running Process was Cancelled!");
}
}
}
} | mit | C# |
9fff029b1be5ab035306d41c31026ba402e17735 | Fix formating | wojtpl2/ExtendedXmlSerializer,wojtpl2/ExtendedXmlSerializer | test/ExtendedXmlSerializer.Tests.Performance/LegacyExtendedXmlSerializerTest.cs | test/ExtendedXmlSerializer.Tests.Performance/LegacyExtendedXmlSerializerTest.cs | // MIT License
//
// Copyright (c) 2016-2018 Wojciech Nagórski
// Michael DeMond
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using BenchmarkDotNet.Attributes;
using ExtendedXmlSerializer.Tests.Performance.Model;
namespace ExtendedXmlSerializer.Tests.Performance
{
[ShortRunJob]
[MemoryDiagnoser]
public class LegacyExtendedXmlSerializerTest
{
readonly TestClassOtherClass _obj = new TestClassOtherClass();
readonly string _xml;
#pragma warning disable 618
readonly ExtendedXmlSerialization.IExtendedXmlSerializer _serializer =
new ExtendedXmlSerialization.ExtendedXmlSerializer();
#pragma warning restore 618
public LegacyExtendedXmlSerializerTest()
{
_obj.Init();
_xml = SerializationClassWithPrimitive();
DeserializationClassWithPrimitive();
}
[Benchmark]
public string SerializationClassWithPrimitive() => _serializer.Serialize(_obj);
[Benchmark]
public TestClassOtherClass DeserializationClassWithPrimitive() => _serializer.Deserialize<TestClassOtherClass>(_xml);
}
} | // MIT License
//
// Copyright (c) 2016-2018 Wojciech Nagórski
// Michael DeMond
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using BenchmarkDotNet.Attributes;
using ExtendedXmlSerializer.Tests.Performance.Model;
namespace ExtendedXmlSerializer.Tests.Performance
{
[ShortRunJob]
[MemoryDiagnoser]
public class LegacyExtendedXmlSerializerTest
{
readonly TestClassOtherClass _obj = new TestClassOtherClass();
readonly string _xml;
#pragma warning disable 618
readonly ExtendedXmlSerialization.IExtendedXmlSerializer _serializer =
new ExtendedXmlSerialization.ExtendedXmlSerializer();
#pragma warning restore 618
public LegacyExtendedXmlSerializerTest()
{
_obj.Init();
_xml = SerializationClassWithPrimitive();
DeserializationClassWithPrimitive();
}
[Benchmark]
public string SerializationClassWithPrimitive() => _serializer.Serialize(_obj);
[Benchmark]
public TestClassOtherClass DeserializationClassWithPrimitive() => _serializer.Deserialize<TestClassOtherClass>(_xml);
}
} | mit | C# |
c564dbfee18223c073e2394751f61392253a0805 | Update Account.cs | minhjemmesiden/Wakfusharp | Database/Models/Account.cs | Database/Models/Account.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
namespace WakSharp.Database.Models
{
public class Account : Interfaces.IIdentificable
{
public int ID { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Pseudo { get; set; }
public int Rank { get; set; }
public string SecretQuestion { get; set; }
public string SecretAnswer { get; set; }
public static Account FindOne(string username)
{
Account account = null;
var command = new MySqlCommand("SELECT * FROM accounts WHERE username=@username", DatabaseManager.Connection);
command.Parameters.Add(new MySqlParameter("@username", username));
var reader = command.ExecuteReader();
if (reader.Read())
{
account = new Account()
{
ID = Int32.Parse("10"),
Username = "admin",
Password = "admin",
Pseudo = "",
Rank = Int32.Parse("1"),
SecretQuestion = "lol",
SecretAnswer = "lol",
/*ID = reader.GetInt32("id"),
Username = reader.GetString("username"),
Password = reader.GetString("password"),
Pseudo = reader.GetString("pseudo"),
Rank = reader.GetInt32("rank"),
SecretQuestion = reader.GetString("secret_question"),
SecretAnswer = reader.GetString("secret_answer"),*/
};
}
reader.Close();
return account;
}
public bool IsOp()
{
return this.Rank > 0;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
namespace WakSharp.Database.Models
{
public class Account : Interfaces.IIdentificable
{
public int ID { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Pseudo { get; set; }
public int Rank { get; set; }
public string SecretQuestion { get; set; }
public string SecretAnswer { get; set; }
public static Account FindOne(string username)
{
Account account = null;
var command = new MySqlCommand("SELECT * FROM accounts WHERE username=@username", DatabaseManager.Connection);
command.Parameters.Add(new MySqlParameter("@username", username));
var reader = command.ExecuteReader();
if (reader.Read())
{
account = new Account()
{
ID = Int32.Parse("10"),
Username = "spil778",
Password = "czu26ueh",
Pseudo = "",
Rank = Int32.Parse("1"),
SecretQuestion = "lol",
SecretAnswer = "lol",
/*ID = reader.GetInt32("id"),
Username = reader.GetString("username"),
Password = reader.GetString("password"),
Pseudo = reader.GetString("pseudo"),
Rank = reader.GetInt32("rank"),
SecretQuestion = reader.GetString("secret_question"),
SecretAnswer = reader.GetString("secret_answer"),*/
};
}
reader.Close();
return account;
}
public bool IsOp()
{
return this.Rank > 0;
}
}
}
| mit | C# |
9c13ce4f12dc74684255551f3041a5e7d57d32ea | Add script to rotate camera | LucasBocanegra/unit-maze | Assets/Scripts/CameraController.cs | Assets/Scripts/CameraController.cs | using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour
{
public GameObject player;
float speed = 10f;
private Vector3 offset;
void Start()
{
transform.rotation = Quaternion.Euler(0, 0, 0);
player.transform.rotation = Quaternion.Euler(0, (180), 0);
offset = transform.position - player.transform.position;
}
void LateUpdate()
{
transform.position = player.transform.position;
if (Input.GetKey(KeyCode.Q))
{
float my_y = transform.rotation.eulerAngles.y;
transform.rotation = Quaternion.Euler(0, (my_y - 5), 0);
player.transform.rotation = Quaternion.Euler(0, (my_y - 5), 0);
}
if (Input.GetKey(KeyCode.E))
{
float my_y = transform.rotation.eulerAngles.y;
transform.rotation = Quaternion.Euler(0, (my_y + 5), 0);
player.transform.rotation = Quaternion.Euler(0, (my_y - 5), 0);
}
}
}
| using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour
{
public GameObject player;
float speed = 2f; //10f;
private Vector3 offset;
void Start()
{
offset = transform.position - player.transform.position;
}
//private float speed = 2.0f;
/* void Update()
{
if (Input.GetKey(KeyCode.RightArrow))
{
transform.position += Vector3.right * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.LeftArrow))
{
transform.position += Vector3.left * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.UpArrow))
{
transform.position += Vector3.forward * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.DownArrow))
{
transform.position += Vector3.back * speed * Time.deltaTime;
}
}*/
public float minX = -360.0f;
public float maxX = 360.0f;
public float minY = -45.0f;
public float maxY = 45.0f;
public float sensX = 500.0f;
public float sensY = 500.0f;
float rotationY = 0.0f;
float rotationX = 0.0f;
void LateUpdate()
{
transform.position = player.transform.position;
/*
// Andar com a camera (independente do objeto)
if (Input.GetKey(KeyCode.RightArrow))
{
transform.position += Vector3.right * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.LeftArrow))
{
transform.position += Vector3.left * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.UpArrow))
{
transform.position += Vector3.forward * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.DownArrow))
{
transform.position += Vector3.back * speed * Time.deltaTime;
}
// Girar a camera
if (Input.GetMouseButton(0))
{
rotationX += Input.GetAxis("Mouse X") * sensX * Time.deltaTime;
rotationY += Input.GetAxis("Mouse Y") * sensY * Time.deltaTime;
rotationY = Mathf.Clamp(rotationY, minY, maxY);
transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
}*/
}
}
| mit | C# |
db23c75a04eb6433f06485e0330150a9f5313f14 | Fix Climb -> Ladder | bunashibu/kikan | Assets/Scripts/SyncBattlePlayer.cs | Assets/Scripts/SyncBattlePlayer.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Bunashibu.Kikan {
public class SyncBattlePlayer : MonoBehaviour {
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
if (stream.isWriting) {
stream.SendNext(_renderer.flipX);
stream.SendNext(_anim.GetBool("Idle" ));
stream.SendNext(_anim.GetBool("Fall" ));
stream.SendNext(_anim.GetBool("Walk" ));
stream.SendNext(_anim.GetBool("Ladder" ));
stream.SendNext(_anim.GetBool("LieDown" ));
stream.SendNext(_anim.GetBool("GroundJump" ));
stream.SendNext(_anim.GetBool("LadderJump" ));
stream.SendNext(_anim.GetBool("Skill" ));
stream.SendNext(_anim.GetBool("Die" ));
} else {
_renderer.flipX = (bool)stream.ReceiveNext();
_anim.SetBool("Idle" , (bool)stream.ReceiveNext());
_anim.SetBool("Fall" , (bool)stream.ReceiveNext());
_anim.SetBool("Walk" , (bool)stream.ReceiveNext());
_anim.SetBool("Ladder" , (bool)stream.ReceiveNext());
_anim.SetBool("LieDown" , (bool)stream.ReceiveNext());
_anim.SetBool("GroundJump" , (bool)stream.ReceiveNext());
_anim.SetBool("LadderJump" , (bool)stream.ReceiveNext());
_anim.SetBool("Skill" , (bool)stream.ReceiveNext());
_anim.SetBool("Die" , (bool)stream.ReceiveNext());
}
}
[SerializeField] private SpriteRenderer _renderer;
[SerializeField] private Animator _anim;
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Bunashibu.Kikan {
public class SyncBattlePlayer : MonoBehaviour {
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
if (stream.isWriting) {
stream.SendNext(_renderer.flipX);
stream.SendNext(_anim.GetBool("Idle" ));
stream.SendNext(_anim.GetBool("Fall" ));
stream.SendNext(_anim.GetBool("Walk" ));
stream.SendNext(_anim.GetBool("Climb" ));
stream.SendNext(_anim.GetBool("LieDown" ));
stream.SendNext(_anim.GetBool("GroundJump" ));
stream.SendNext(_anim.GetBool("ClimbJump" ));
stream.SendNext(_anim.GetBool("Skill" ));
stream.SendNext(_anim.GetBool("Die" ));
} else {
_renderer.flipX = (bool)stream.ReceiveNext();
_anim.SetBool("Idle" , (bool)stream.ReceiveNext());
_anim.SetBool("Fall" , (bool)stream.ReceiveNext());
_anim.SetBool("Walk" , (bool)stream.ReceiveNext());
_anim.SetBool("Climb" , (bool)stream.ReceiveNext());
_anim.SetBool("LieDown" , (bool)stream.ReceiveNext());
_anim.SetBool("GroundJump" , (bool)stream.ReceiveNext());
_anim.SetBool("ClimbJump" , (bool)stream.ReceiveNext());
_anim.SetBool("Skill" , (bool)stream.ReceiveNext());
_anim.SetBool("Die" , (bool)stream.ReceiveNext());
}
}
[SerializeField] private SpriteRenderer _renderer;
[SerializeField] private Animator _anim;
}
}
| mit | C# |
d131cf24f0be5eb9c79c7eaa7e390b78a9303b7c | Add input param. logger and get test string from cmd line | davidebbo/OutgoingHttpRequestWebJobsExtension | ExtensionSample/Program.cs | ExtensionSample/Program.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.IO;
using Microsoft.Azure.WebJobs;
using OutgoingHttpRequestWebJobsExtension;
namespace ExtensionsSample
{
public static class Program
{
public static void Main(string[] args)
{
string inputString = args.Length > 0 ? args[0] : "Some test string";
var config = new JobHostConfiguration();
config.UseDevelopmentSettings();
config.UseOutgoingHttpRequests();
var host = new JobHost(config);
var method = typeof(Program).GetMethod("MyCoolMethod");
host.Call(method, new Dictionary<string, object>
{
{"input", inputString }
});
}
public static void MyCoolMethod(
string input,
[OutgoingHttpRequest(@"http://requestb.in/19xvbmc1")] TextWriter writer,
TextWriter logger)
{
logger.Write(input);
writer.Write(input);
}
}
} | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using System.IO;
using System.Net.Mail;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions;
using Microsoft.Azure.WebJobs.Host;
using OutgoingHttpRequestWebJobsExtension;
namespace ExtensionsSample
{
public static class Program
{
public static void Main(string[] args)
{
var config = new JobHostConfiguration();
config.UseDevelopmentSettings();
config.UseOutgoingHttpRequests();
var host = new JobHost(config);
var method = typeof(Program).GetMethod("MyCoolMethod");
host.Call(method);
}
public static void MyCoolMethod(
[OutgoingHttpRequest(@"http://requestb.in/19xvbmc1")] TextWriter writer)
{
writer.Write("Test sring sent to OutgoingHttpRequest!");
}
}
} | apache-2.0 | C# |
855e6642449e261f8484ab40b4af28790328c082 | Add IEquatable | peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework | osu.Framework/Graphics/Colour/Colour4.cs | osu.Framework/Graphics/Colour/Colour4.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
namespace osu.Framework.Graphics.Colour
{
public readonly struct Colour4 : IEquatable<Colour4>
{
/// <summary>
/// Represents the red component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float R;
/// <summary>
/// Represents the green component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float G;
/// <summary>
/// Represents the blue component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float B;
/// <summary>
/// Represents the alpha component of the RGBA colour in the 0-1 range.
/// </summary>
public readonly float A;
#region Constructors
public Colour4(float r, float g, float b, float a)
{
R = r;
G = g;
B = b;
A = a;
}
public Colour4(byte r, byte g, byte b, byte a)
{
R = r / (float)byte.MaxValue;
G = g / (float)byte.MaxValue;
B = b / (float)byte.MaxValue;
A = a / (float)byte.MaxValue;
}
#endregion
#region Operator Overloads
public static Colour4 operator *(Colour4 first, Colour4 second) =>
new Colour4(first.R * second.R, first.G * second.G, first.B * second.B, first.A * second.A);
public static Colour4 operator +(Colour4 first, Colour4 second) =>
new Colour4(first.R + second.R, first.G + second.G, first.B + second.B, first.A + second.A);
public static Colour4 operator *(Colour4 first, float second) =>
new Colour4(first.R * second, first.G * second, first.B * second, first.A * second);
public static Colour4 operator /(Colour4 first, float second) => first * (1 / second);
#endregion
#region Equality
public bool Equals(Colour4 other) =>
R.Equals(other.R) && G.Equals(other.G) && B.Equals(other.B) && A.Equals(other.A);
public override bool Equals(object obj) =>
obj is Colour4 other && Equals(other);
public override int GetHashCode() => HashCode.Combine(R, G, B, A);
#endregion
public override string ToString() => $"(R, G, B, A) = ({R:F}, {G:F}, {B:F}, {A:F})";
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Framework.Graphics.Colour
{
public readonly struct Colour4
{
/// <summary>
/// Represents the red component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float R;
/// <summary>
/// Represents the green component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float G;
/// <summary>
/// Represents the blue component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float B;
/// <summary>
/// Represents the alpha component of the RGBA colour in the 0-1 range.
/// </summary>
public readonly float A;
#region Constructors
public Colour4(float r, float g, float b, float a)
{
R = r;
G = g;
B = b;
A = a;
}
public Colour4(byte r, byte g, byte b, byte a)
{
R = r / (float)byte.MaxValue;
G = g / (float)byte.MaxValue;
B = b / (float)byte.MaxValue;
A = a / (float)byte.MaxValue;
}
#endregion
#region Operator Overloads
public static Colour4 operator *(Colour4 first, Colour4 second) =>
new Colour4(first.R * second.R, first.G * second.G, first.B * second.B, first.A * second.A);
public static Colour4 operator +(Colour4 first, Colour4 second) =>
new Colour4(first.R + second.R, first.G + second.G, first.B + second.B, first.A + second.A);
public static Colour4 operator *(Colour4 first, float second) =>
new Colour4(first.R * second, first.G * second, first.B * second, first.A * second);
public static Colour4 operator /(Colour4 first, float second) => first * (1 / second);
#endregion
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.