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 |
---|---|---|---|---|---|---|---|---|
9a9297c89bd2a3d6984d5cc0dd189b8581116fd5
|
fix music stop on hit Sys32
|
rafi16d/lvlup2016
|
Assets/scripts/System32.cs
|
Assets/scripts/System32.cs
|
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class System32 : MonoBehaviour {
[Header("Screen")]
public GameObject rebootScreen;
public GameObject rebootText;
public GameObject userinterface;
public bool isBlueScreen = false;
public GameObject blueScreen;
public string nextlvl;
// Use this for initialization
void Start() {
}
// Update is called once per frame
void FixedUpdate() {
if (Input.anyKeyDown) {
if (Input.GetKey("escape"))
Application.Quit();
//Load next lvl
if (isBlueScreen)
SceneManager.LoadScene(nextlvl);
}
}
void OnCollisionEnter2D(Collision2D coll) {
if (coll.gameObject.tag == "Player") {
userinterface.SetActive(false);
GameObject.Find("_Manager").SendMessage("stopMusic");
GameObject.Find("Player").SendMessage("stopSound");
GameObject.Find("Player").SendMessage("sleepPlayer", Mathf.Infinity);
//GameObject.Find("_Manager").SendMessage("upgradeMusic");
AudioSource audio = GetComponent<AudioSource>();
audio.Play();
StartCoroutine(WaitForReboot());
}
}
IEnumerator WaitForReboot() {
rebootScreen.SetActive(true);
yield return new WaitForSeconds(1.5f);
rebootText.SetActive(true);
StartCoroutine(WaitForBlue());
}
IEnumerator WaitForBlue() {
yield return new WaitForSeconds(1.5f);
rebootScreen.SetActive(false);
rebootText.SetActive(false);
blueScreen.SetActive(true);
isBlueScreen = true;
}
}
|
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class System32 : MonoBehaviour {
[Header("Screen")]
public GameObject rebootScreen;
public GameObject rebootText;
public GameObject userinterface;
public bool isBlueScreen = false;
public GameObject blueScreen;
public string nextlvl;
// Use this for initialization
void Start() {
}
// Update is called once per frame
void FixedUpdate() {
if (Input.anyKeyDown) {
if (Input.GetKey("escape"))
Application.Quit();
//Load next lvl
if (isBlueScreen)
SceneManager.LoadScene(nextlvl);
}
}
void OnCollisionEnter2D(Collision2D coll) {
if (coll.gameObject.tag == "Player") {
userinterface.SetActive(false);
GameObject.Find("Player").SendMessage("stopSound");
GameObject.Find("Player").SendMessage("sleepPlayer", Mathf.Infinity);
//GameObject.Find("_Manager").SendMessage("upgradeMusic");
AudioSource audio = GetComponent<AudioSource>();
audio.Play();
StartCoroutine(WaitForReboot());
}
}
IEnumerator WaitForReboot() {
rebootScreen.SetActive(true);
yield return new WaitForSeconds(1.5f);
rebootText.SetActive(true);
StartCoroutine(WaitForBlue());
}
IEnumerator WaitForBlue() {
yield return new WaitForSeconds(1.5f);
rebootScreen.SetActive(false);
rebootText.SetActive(false);
blueScreen.SetActive(true);
isBlueScreen = true;
}
}
|
mit
|
C#
|
b3658f5110caa96ddf51cb8a6aa8ab2730b85e4d
|
Fix route
|
pecosk/football,pecosk/football
|
FootballLeague/App_Start/RouteConfig.cs
|
FootballLeague/App_Start/RouteConfig.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace FootballLeague
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace FootballLeague
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
|
mit
|
C#
|
488f3971976d085e1243ec1f84172a90c1f74192
|
Fix to avoid SA1400
|
y-iihoshi/REIMU_Plugins_V2,y-iihoshi/REIMU_Plugins_V2
|
Common/BitmapInfoHeader.cs
|
Common/BitmapInfoHeader.cs
|
//-----------------------------------------------------------------------
// <copyright file="BitmapInfoHeader.cs" company="None">
// (c) 2015 IIHOSHI Yoshinori
// </copyright>
//-----------------------------------------------------------------------
using System.Runtime.InteropServices;
namespace ReimuPlugins.Common
{
/// <summary>
/// <c>BITMAPINFOHEADER</c> structure of Win32 API.
/// <para>Contains information about the dimensions and color format of a DIB.</para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct BitmapInfoHeader
{
/// <summary>
/// The number of bytes required by the structure.
/// </summary>
public uint size;
/// <summary>
/// The width of the bitmap, in pixels.
/// </summary>
public int width;
/// <summary>
/// The height of the bitmap, in pixels.
/// </summary>
public int height;
/// <summary>
/// The number of planes for the target device.
/// </summary>
public ushort planes;
/// <summary>
/// The number of bits-per-pixel.
/// </summary>
public ushort bitCount;
/// <summary>
/// The type of compression for a compressed bottom-up bitmap (top-down DIBs cannot be compressed).
/// </summary>
public uint compression;
/// <summary>
/// The size, in bytes, of the image.
/// </summary>
public uint sizeImage;
/// <summary>
/// The horizontal resolution, in pixels-per-meter, of the target device for the bitmap.
/// </summary>
public int xPelsPerMeter;
/// <summary>
/// The vertical resolution, in pixels-per-meter, of the target device for the bitmap.
/// </summary>
public int yPelsPerMeter;
/// <summary>
/// The number of color indexes in the color table that are actually used by the bitmap.
/// </summary>
public uint clrUsed;
/// <summary>
/// The number of color indexes that are required for displaying the bitmap.
/// </summary>
public uint clrImportant;
}
}
|
//-----------------------------------------------------------------------
// <copyright file="BitmapInfoHeader.cs" company="None">
// (c) 2015 IIHOSHI Yoshinori
// </copyright>
//-----------------------------------------------------------------------
using System.Runtime.InteropServices;
namespace ReimuPlugins.Common
{
/// <summary>
/// <c>BITMAPINFOHEADER</c> structure of Win32 API.
/// <para>Contains information about the dimensions and color format of a DIB.</para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct BitmapInfoHeader
{
/// <summary>
/// The number of bytes required by the structure.
/// </summary>
uint size;
/// <summary>
/// The width of the bitmap, in pixels.
/// </summary>
int width;
/// <summary>
/// The height of the bitmap, in pixels.
/// </summary>
int height;
/// <summary>
/// The number of planes for the target device.
/// </summary>
ushort planes;
/// <summary>
/// The number of bits-per-pixel.
/// </summary>
ushort bitCount;
/// <summary>
/// The type of compression for a compressed bottom-up bitmap (top-down DIBs cannot be compressed).
/// </summary>
uint compression;
/// <summary>
/// The size, in bytes, of the image.
/// </summary>
uint sizeImage;
/// <summary>
/// The horizontal resolution, in pixels-per-meter, of the target device for the bitmap.
/// </summary>
int xPelsPerMeter;
/// <summary>
/// The vertical resolution, in pixels-per-meter, of the target device for the bitmap.
/// </summary>
int yPelsPerMeter;
/// <summary>
/// The number of color indexes in the color table that are actually used by the bitmap.
/// </summary>
uint clrUsed;
/// <summary>
/// The number of color indexes that are required for displaying the bitmap.
/// </summary>
uint clrImportant;
}
}
|
bsd-2-clause
|
C#
|
4e11edbf62eb35e553fb64ebe4b69385d8a70df7
|
Remove old method
|
EasyPeasyLemonSqueezy/MadCat
|
MadCat/NutEngine/Physics/Manifold.cs
|
MadCat/NutEngine/Physics/Manifold.cs
|
using Microsoft.Xna.Framework;
using NutEngine.Physics.Shapes;
namespace NutEngine.Physics
{
public class Manifold<FirstShapeType, SecondShapeType>
where FirstShapeType : Shape
where SecondShapeType : Shape
{
public IBody<FirstShapeType> A { get; set; }
public IBody<SecondShapeType> B { get; set; }
public float Depth { get; set; }
public Vector2 Normal { get; set; }
public Vector2 Contact { get; set; }
}
}
|
using Microsoft.Xna.Framework;
using NutEngine.Physics.Shapes;
namespace NutEngine.Physics
{
public class Manifold<FirstShapeType, SecondShapeType>
where FirstShapeType : Shape
where SecondShapeType : Shape
{
public IBody<FirstShapeType> A { get; set; }
public IBody<SecondShapeType> B { get; set; }
public float Depth { get; set; }
public Vector2 Normal { get; set; }
public Vector2 Contact { get; set; }
public void ApplyImpulse()
{
}
}
}
|
mit
|
C#
|
911362584d61a915dcc275f87a8dafd96a46debe
|
bump version
|
criteo/RabbitMQHare
|
RabbitMQHare/Properties/AssemblyInfo.cs
|
RabbitMQHare/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("RabbitMQHare")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Criteo")]
[assembly: AssemblyProduct("RabbitMQHare")]
[assembly: AssemblyCopyright("Copyright © Criteo 2012")]
[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("058763b1-7003-4abe-86f7-e7f58334b2c7")]
// 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.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RabbitMQHare")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Criteo")]
[assembly: AssemblyProduct("RabbitMQHare")]
[assembly: AssemblyCopyright("Copyright © Criteo 2012")]
[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("058763b1-7003-4abe-86f7-e7f58334b2c7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
|
apache-2.0
|
C#
|
ce96b31ad42f1ff6046bbf983e4a31751fd0074c
|
Add logic to inject NAME in ViewBag based of Identity
|
dmorosinotto/MVC_NG_TS,dmorosinotto/MVC_NG_TS
|
MvcNG/Controllers/ngAppController.cs
|
MvcNG/Controllers/ngAppController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web
using System.Web.Mvc;
namespace MvcNG.Controllers
{
public class ngAppController : BaseTSController
{
//
// GET: /ngApp/main
public ActionResult main() { //DON'T USE Index - DON'T WORK!
ViewBag.WAIT = 5000;
if (User.Identity.IsAuthenticated) {
ViewBag.NAME = User.Identity.Name;
} else {
ViewBag.NAME = "Pippo";
}
return View();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcNG.Controllers
{
public class ngAppController : BaseTSController
{
//
// GET: /ngApp/main
public ActionResult main() { //DON'T USE Index - DON'T WORK!
ViewBag.WAIT = 5000;
return View();
}
}
}
|
mit
|
C#
|
2fe49e59eba81344cb3a53101a9e8a4f83013686
|
Remove echoColor method
|
iceblade112/TrickEmu,iceblade112/TrickEmu
|
TEMethods/Methods.cs
|
TEMethods/Methods.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TrickEmu
{
public class Methods
{
public static string sep(string str, string delim)
{
int len = str.IndexOf(delim);
if (len > 0)
{
return str.Substring(0, len);
}
return "";
}
public static string getString(byte[] bytes, int i)
{
return Config.encoding.GetString(bytes);
}
public static ushort ReadUshort(byte[] bytes, int pos)
{
byte[] ba = new byte[2] { bytes[pos], bytes[pos + 1] };
return BitConverter.ToUInt16(ba.Reverse().ToArray(), 0);
}
public static string cleanString(string str)
{
return str.TrimEnd(new char[] { (char)0 }).Replace("\x00", "").Replace("\u0000", "");
}
// From http://stackoverflow.com/questions/8041343/how-to-split-a-byte
// Author: driis http://stackoverflow.com/users/13627/driis
public static IEnumerable<byte[]> Split(byte splitByte, byte[] buffer)
{
List<byte> bytes = new List<byte>();
foreach (byte b in buffer)
{
if (b != splitByte)
bytes.Add(b);
else
{
yield return bytes.ToArray();
bytes.Clear();
}
}
yield return bytes.ToArray();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TrickEmu
{
public class Methods
{
public static string sep(string str, string delim)
{
int len = str.IndexOf(delim);
if (len > 0)
{
return str.Substring(0, len);
}
return "";
}
public static string getString(byte[] bytes, int i)
{
return Config.encoding.GetString(bytes);
}
/*public static void echoColor(string from, ConsoleColor color, string write)
{
echoColor(from, color, write, new string[] { });
}
public static void echoColor(string from, ConsoleColor color, string write, string[] args)
{
Console.ForegroundColor = color;
Console.Write("[" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " | " + from + "] ");
Console.ForegroundColor = ConsoleColor.White;
for (int i = 0; i != args.Length; i++)
{
write = write.Replace("{" + i + "}", args[i]);
}
Console.WriteLine(write);
}*/
public static ushort ReadUshort(byte[] bytes, int pos)
{
byte[] ba = new byte[2] { bytes[pos], bytes[pos + 1] };
return BitConverter.ToUInt16(ba.Reverse().ToArray(), 0);
}
public static string cleanString(string str)
{
return str.TrimEnd(new char[] { (char)0 }).Replace("\x00", "").Replace("\u0000", "");
}
// From http://stackoverflow.com/questions/8041343/how-to-split-a-byte
// Author: driis http://stackoverflow.com/users/13627/driis
public static IEnumerable<byte[]> Split(byte splitByte, byte[] buffer)
{
List<byte> bytes = new List<byte>();
foreach (byte b in buffer)
{
if (b != splitByte)
bytes.Add(b);
else
{
yield return bytes.ToArray();
bytes.Clear();
}
}
yield return bytes.ToArray();
}
}
}
|
agpl-3.0
|
C#
|
9b0575eb39b5c7e49726646a784bca402afc0eb8
|
Implement non-abstract socket support
|
mono/dbus-sharp,openmedicus/dbus-sharp,arfbtwn/dbus-sharp,arfbtwn/dbus-sharp,Tragetaschen/dbus-sharp,openmedicus/dbus-sharp,Tragetaschen/dbus-sharp,mono/dbus-sharp
|
src/UnixNativeTransport.cs
|
src/UnixNativeTransport.cs
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using Mono.Unix;
using Mono.Unix.Native;
namespace NDesk.DBus
{
public class UnixSocket
{
//TODO: verify these
[DllImport ("libc")]
protected static extern int socket (int domain, int type, int protocol);
[DllImport ("libc")]
protected static extern int connect (int sockfd, byte[] serv_addr, uint addrlen);
public int Handle;
public UnixSocket ()
{
//AddressFamily family, SocketType type, ProtocolType proto
//Handle = socket ((int)AddressFamily.Unix, (int)SocketType.Stream, 0);
Handle = socket (1, (int)SocketType.Stream, 0);
}
//TODO: consider memory management
public void Connect (byte[] remote_end)
{
int ret = connect (Handle, remote_end, (uint)remote_end.Length);
//Console.Error.WriteLine ("connect ret: " + ret);
//FIXME: we need to get the errno or it will screw things up later?
}
}
public class UnixNativeTransport : Transport, IAuthenticator
{
protected UnixSocket socket;
public UnixNativeTransport (string path, bool @abstract)
{
if (@abstract)
socket = OpenAbstractUnix (path);
else
socket = OpenUnix (path);
//socket.Blocking = true;
SocketHandle = (long)socket.Handle;
Stream = new UnixStream ((int)socket.Handle);
}
public override string AuthString ()
{
long uid = UnixUserInfo.GetRealUserId ();
return uid.ToString ();
}
protected UnixSocket OpenAbstractUnix (string path)
{
byte[] p = System.Text.Encoding.Default.GetBytes (path);
byte[] sa = new byte[2 + 1 + p.Length];
//sa[0] = (byte)AddressFamily.Unix;
sa[0] = 1;
sa[1] = 0;
sa[2] = 0; //null prefix for abstract sockets, see unix(7)
for (int i = 0 ; i != p.Length ; i++)
sa[i+3] = p[i];
UnixSocket client = new UnixSocket ();
client.Connect (sa);
//Console.Error.WriteLine ("client Handle: " + client.Handle);
return client;
}
public UnixSocket OpenUnix (string path)
{
byte[] p = System.Text.Encoding.Default.GetBytes (path);
byte[] sa = new byte[2 + p.Length + 1];
//sa[0] = (byte)AddressFamily.Unix;
sa[0] = 1;
sa[1] = 0;
for (int i = 0 ; i != p.Length ; i++)
sa[i+2] = p[i];
sa[2 + p.Length] = 0; //null suffix for sockets, see unix(7)
UnixSocket client = new UnixSocket ();
client.Connect (sa);
//Console.Error.WriteLine ("client Handle: " + client.Handle);
return client;
}
}
}
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using Mono.Unix;
using Mono.Unix.Native;
namespace NDesk.DBus
{
public class UnixSocket
{
//TODO: verify these
[DllImport ("libc")]
protected static extern int socket (int domain, int type, int protocol);
[DllImport ("libc")]
protected static extern int connect (int sockfd, byte[] serv_addr, uint addrlen);
public int Handle;
public UnixSocket ()
{
//AddressFamily family, SocketType type, ProtocolType proto
//Handle = socket ((int)AddressFamily.Unix, (int)SocketType.Stream, 0);
Handle = socket (1, (int)SocketType.Stream, 0);
}
//TODO: consider memory management
public void Connect (byte[] remote_end)
{
int ret = connect (Handle, remote_end, (uint)remote_end.Length);
//Console.Error.WriteLine ("connect ret: " + ret);
//FIXME: we need to get the errno or it will screw things up later?
}
}
public class UnixNativeTransport : Transport, IAuthenticator
{
protected UnixSocket socket;
public UnixNativeTransport (string path, bool @abstract)
{
if (@abstract)
socket = OpenAbstractUnix (path);
else
socket = OpenUnix (path);
//socket.Blocking = true;
SocketHandle = (long)socket.Handle;
Stream = new UnixStream ((int)socket.Handle);
}
public override string AuthString ()
{
long uid = UnixUserInfo.GetRealUserId ();
return uid.ToString ();
}
protected UnixSocket OpenAbstractUnix (string path)
{
byte[] p = System.Text.Encoding.Default.GetBytes (path);
byte[] sa = new byte[2 + 1 + p.Length];
//sa[0] = (byte)AddressFamily.Unix;
sa[0] = 1;
sa[1] = 0;
sa[2] = 0; //null prefix for abstract sockets, see unix(7)
for (int i = 0 ; i != p.Length ; i++)
sa[i+3] = p[i];
UnixSocket client = new UnixSocket ();
client.Connect (sa);
//Console.Error.WriteLine ("client Handle: " + client.Handle);
return client;
}
public UnixSocket OpenUnix (string path)
{
//TODO
throw new Exception ("Not implemented yet");
}
}
}
|
mit
|
C#
|
98dab48b2007d753eee2358e72348a65b0c55e90
|
Replace copyright with LICENSE reference
|
GuildMasterInfinite/VulkanInfo-GUI
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("VulkanInfo GUI")]
[assembly: AssemblyDescription("Small program to obtain information from the Vulkan Runtime.")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyProduct("Graphical User Interface for VulkanInfo")]
[assembly: AssemblyCopyright("See LICENSE file")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("VulkanInfo GUI")]
[assembly: AssemblyDescription("Small program to obtain information from the Vulkan Runtime.")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyProduct("Graphical User Interface for VulkanInfo")]
[assembly: AssemblyCopyright("Copyright © 2016 - 2017")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.0.0")]
|
mit
|
C#
|
67106e743f97555ac722495a276043a57340df29
|
Disable publishing to MyGet
|
bbtsoftware/TfsUrlParser
|
setup.cake
|
setup.cake
|
#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(
context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "TfsUrlParser",
repositoryOwner: "bbtsoftwareag",
repositoryName: "TfsUrlParser",
appVeyorAccountName: "bbtsoftwareag",
shouldPublishMyGet: false);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(
context: Context,
dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/TfsUrlParser.Tests/*.cs" },
testCoverageFilter: "+[*]* -[xunit.*]* -[*.Tests]* ",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.Run();
|
#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(
context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "TfsUrlParser",
repositoryOwner: "bbtsoftwareag",
repositoryName: "TfsUrlParser",
appVeyorAccountName: "bbtsoftwareag");
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(
context: Context,
dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/TfsUrlParser.Tests/*.cs" },
testCoverageFilter: "+[*]* -[xunit.*]* -[*.Tests]* ",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.Run();
|
mit
|
C#
|
875968ac4ca3de266c6d20b748f228048de70ca2
|
Revert "定数の名前を大文字に"
|
devlights/MyHelloWorld
|
MyHelloWorld/HelloWorld.StdOut/Program.cs
|
MyHelloWorld/HelloWorld.StdOut/Program.cs
|
namespace HelloWorld.StdOut
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HelloWorld.Core;
class Program
{
static void Main(string[] args)
{
const string name = "devlights";
var manager = new HelloWorldMessageManager(name);
Console.WriteLine(manager.GetMessage());
}
}
}
|
namespace HelloWorld.StdOut
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HelloWorld.Core;
class Program
{
static void Main(string[] args)
{
const string NAME = "devlights";
var manager = new HelloWorldMessageManager(NAME);
Console.WriteLine(manager.GetMessage());
}
}
}
|
mit
|
C#
|
9d0ae143bfd717b395813167d0ef902c0b9e9350
|
Update GetAll.cs
|
ovation22/PragmaticTDD,ovation22/PragmaticTDD
|
Pragmatic.TDD.Services.Tests/HorseServiceTests/GetAll.cs
|
Pragmatic.TDD.Services.Tests/HorseServiceTests/GetAll.cs
|
using System.Collections.Generic;
using System.Linq;
using Autofac;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Pragmatic.TDD.Services.Interfaces;
using Pragmatic.TDD.Services.Tests.Factories;
namespace Pragmatic.TDD.Services.Tests.HorseServiceTests
{
[TestClass]
public class GetAll : TestBase
{
private IHorseService _horseService;
[TestInitialize]
public void Setup()
{
HorseFactory.Create(Context).WithColor().WithDam().WithSire();
_horseService = Container.Resolve<IHorseService>();
}
[TestMethod]
public void ItExists()
{
// Arrange
// Act
// Assert
Assert.IsNotNull(_horseService.GetAll());
}
[TestMethod]
public void ItReturnsCollectionOfHorses()
{
// Arrange
// Act
var horses = _horseService.GetAll();
// Assert
Assert.IsInstanceOfType(horses, typeof(IEnumerable<Dto.Horse>));
}
[TestMethod]
public void ItMapsProperties()
{
// Arrange
// Act
var horses = _horseService.GetAll();
var horse = horses.First();
// Assert
Assert.AreEqual(1, horse.Id);
Assert.AreEqual("Man o' War", horse.Name);
Assert.AreEqual("Chestnut", horse.Color);
Assert.AreEqual(2, horse.DamId);
Assert.AreEqual("Dam", horse.Dam);
Assert.AreEqual(3, horse.SireId);
Assert.AreEqual("Sire", horse.Sire);
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Autofac;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Pragmatic.TDD.Services.Interfaces;
using Pragmatic.TDD.Services.Tests.Factories;
namespace Pragmatic.TDD.Services.Tests.HorseServiceTests
{
[TestClass]
public class GetAll : TestBase
{
private IHorseService _horseService;
[TestInitialize]
public void Setup()
{
HorseFactory.Create(Context).WithColor().WithDam().WithSire();
_horseService = Container.Resolve<IHorseService>();
}
[TestMethod]
public void ItExists()
{
// Arrange
// Act
// Assert
Assert.IsNotNull(_horseService.GetAll());
}
[TestMethod]
public void ItReturnsCollectionOfHorses()
{
// Arrange
// Act
var horses = _horseService.GetAll();
// Assert
Assert.IsInstanceOfType(horses, typeof(IEnumerable<Dto.Horse>));
}
[TestMethod]
public void ItMapsProperties()
{
// Arrange
// Act
var horses = _horseService.GetAll();
var horse = horses.First();
// Assert
Assert.AreEqual(horse.Id, 1);
Assert.AreEqual(horse.Name, "Man o' War");
Assert.AreEqual(horse.Color, "Chestnut");
Assert.AreEqual(horse.DamId, 2);
Assert.AreEqual(horse.Dam, "Dam");
Assert.AreEqual(horse.SireId, 3);
Assert.AreEqual(horse.Sire, "Sire");
}
}
}
|
mit
|
C#
|
ada3d352d00080a2acdb66c30aba505391cd3fe3
|
Update WebDownloader.cs
|
milkshakesoftware/PreMailer.Net
|
PreMailer.Net/PreMailer.Net/Downloaders/WebDownloader.cs
|
PreMailer.Net/PreMailer.Net/Downloaders/WebDownloader.cs
|
using System;
using System.IO;
using System.Net;
using System.Text;
namespace PreMailer.Net.Downloaders
{
public class WebDownloader : IWebDownloader
{
private static IWebDownloader _sharedDownloader;
public static IWebDownloader SharedDownloader
{
get
{
if (_sharedDownloader == null)
{
_sharedDownloader = new WebDownloader();
}
return _sharedDownloader;
}
set
{
_sharedDownloader = value;
}
}
public string DownloadString(Uri uri)
{
var request = WebRequest.Create(uri);
using (var response = (HttpWebResponse)request.GetResponse())
{
var charset = response.CharacterSet;
var encoding = Encoding.GetEncoding(charset);
using (var stream = response.GetResponseStream())
using (var reader = new StreamReader(stream, encoding))
{
return reader.ReadToEnd();
}
}
}
}
}
|
using System;
using System.IO;
using System.Net;
using System.Text;
namespace PreMailer.Net.Downloaders
{
public class WebDownloader : IWebDownloader
{
private static IWebDownloader _sharedDownloader;
public static IWebDownloader SharedDownloader
{
get
{
if (_sharedDownloader == null)
{
_sharedDownloader = new WebDownloader();
}
return _sharedDownloader;
}
set
{
_sharedDownloader = value;
}
}
public string DownloadString(Uri uri)
{
var request = WebRequest.Create(uri);
using (var response = (HttpWebResponse)request.GetResponse()) {
string Charset = response.CharacterSet;
Encoding encoding = Encoding.GetEncoding( Charset );
using( var stream = response.GetResponseStream( ) )
using( var reader = new StreamReader( stream, encoding ) ) {
return reader.ReadToEnd( );
}
}
}
}
}
|
mit
|
C#
|
75aa9ab82dab2ae7c0f05442fa0748e5c0020630
|
Update RegionLocalizationParameters.cs
|
tiksn/TIKSN-Framework
|
TIKSN.RegionLocalization/RegionLocalizationParameters.cs
|
TIKSN.RegionLocalization/RegionLocalizationParameters.cs
|
using System.Reflection;
namespace TIKSN.Localization
{
public static class RegionLocalizationParameters
{
public static string GetDefaultCultureName() =>
typeof(RegionLocalizationParameters).GetTypeInfo().Assembly.GetName().CultureName;
}
}
|
using System.Reflection;
namespace TIKSN.Localization
{
public static class RegionLocalizationParameters
{
public static string GetDefaultCultureName()
{
return typeof(RegionLocalizationParameters).GetTypeInfo().Assembly.GetName().CultureName;
}
}
}
|
mit
|
C#
|
adea006a5dfd3fd576c751ae3ee1d70ce7d9a187
|
Remove unused labels
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/ViewModels/TestLineChartViewModel.cs
|
WalletWasabi.Fluent/ViewModels/TestLineChartViewModel.cs
|
using System.Collections.Generic;
namespace WalletWasabi.Fluent.ViewModels
{
public class TestLineChartViewModel
{
public double XAxisCurrentValue { get; set; } = 36;
public double XAxisMinValue { get; set; } = 2;
public double XAxisMaxValue { get; set; } = 864;
public List<string> XAxisLabels => new List<string>()
{
"1w",
"3d",
"1d",
"12h",
"6h",
"3h",
"1h",
"30m",
"20m",
"fastest"
};
public List<double> XAxisValues => new List<double>()
{
1008,
432,
144,
72,
36,
18,
6,
3,
2,
1,
};
public List<double> YAxisValues => new List<double>()
{
4,
4,
7,
22,
57,
97,
102,
123,
123,
185
};
}
}
|
using System.Collections.Generic;
namespace WalletWasabi.Fluent.ViewModels
{
public class TestLineChartViewModel
{
public double XAxisCurrentValue { get; set; } = 36;
public double XAxisMinValue { get; set; } = 2;
public double XAxisMaxValue { get; set; } = 864;
// public List<string> XAxisLabels => new List<string>()
// {
// "6 days",
// "4 days",
// "3 days",
// "1 day",
// "22 hours",
// "20 hours",
// "18 hours",
// "10 hours",
// "6 hours",
// "4 hours",
// "2 hours",
// "1 hour",
// "50 min",
// "30 min",
// "20 min"
// };
public List<string> XAxisLabels => new List<string>()
{
"1w",
"3d",
"1d",
"12h",
"6h",
"3h",
"1h",
"30m",
"20m",
"fastest"
};
public List<double> XAxisValues => new List<double>()
{
1008,
432,
144,
72,
36,
18,
6,
3,
2,
1,
};
public List<double> YAxisValues => new List<double>()
{
4,
4,
7,
22,
57,
97,
102,
123,
123,
185
};
}
}
|
mit
|
C#
|
d0636d056146caeba7124b6d5af4df60352f51a8
|
Build and publish nuget package
|
RockFramework/Rock.Messaging
|
Rock.Messaging/Properties/AssemblyInfo.cs
|
Rock.Messaging/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.Messaging")]
[assembly: AssemblyDescription("Rock Messaging.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Messaging")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("58c2f915-e27e-436d-bd97-b6cb117ffd6b")]
// 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.9.0.0")]
[assembly: AssemblyFileVersion("0.9.9")]
[assembly: AssemblyInformationalVersion("0.9.9")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.Messaging")]
[assembly: AssemblyDescription("Rock Messaging.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Messaging")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("58c2f915-e27e-436d-bd97-b6cb117ffd6b")]
// 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.9.0.0")]
[assembly: AssemblyFileVersion("0.9.9")]
[assembly: AssemblyInformationalVersion("0.9.9-Alpha03")]
|
mit
|
C#
|
c647d5483e5a12d9168b1e2d269cd75dc9abd7db
|
update the version
|
somdoron/AsyncIO
|
Source/AsyncIO/Properties/AssemblyInfo.cs
|
Source/AsyncIO/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("AsyncIO")]
[assembly: AssemblyDescription("Portable completion port library for .Net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("somdoron")]
[assembly: AssemblyProduct("AsyncIO")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("abd49658-af51-4138-91b1-6a500fc389d5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.18.0")]
[assembly: AssemblyFileVersion("0.1.18.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AsyncIO")]
[assembly: AssemblyDescription("Portable completion port library for .Net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("somdoron")]
[assembly: AssemblyProduct("AsyncIO")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("abd49658-af51-4138-91b1-6a500fc389d5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.17.0")]
[assembly: AssemblyFileVersion("0.1.17.0")]
|
mpl-2.0
|
C#
|
f017cef3245d3c77aba0cd4f5963aaf64d028762
|
Add Event.IsValid
|
Xeeynamo/KingdomHearts
|
OpenKh.Bbs/Event.cs
|
OpenKh.Bbs/Event.cs
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Xe.BinaryMapper;
namespace OpenKh.Bbs
{
public class Event
{
private const int MagicCode = 1;
private class Header
{
[Data] public int MagicCode { get; set; }
[Data] public int Count { get => Items.TryGetCount(); set => Items = Items.CreateOrResize(value); }
[Data] public List<Event> Items { get; set; }
static Header()
{
BinaryMapping.SetMemberLengthMapping<Header>(nameof(Items), (o, m) => o.Count);
}
}
[Data] public short Id { get; set; }
[Data] public short EventIndex { get; set; }
[Data] public byte World { get; set; }
[Data] public byte Room { get; set; }
[Data] public short Unknown06 { get; set; }
public static bool IsValid(Stream stream)
{
var prevPosition = stream.Position;
var magicCode = new BinaryReader(stream).ReadInt32();
stream.Position = prevPosition;
return magicCode == MagicCode;
}
public static List<Event> Read(Stream stream) =>
BinaryMapping.ReadObject<Header>(stream).Items;
public static void Write(Stream stream, IEnumerable<Event> events) =>
BinaryMapping.WriteObject(stream, new Header
{
MagicCode = MagicCode,
Items = events.ToList()
});
}
}
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Xe.BinaryMapper;
namespace OpenKh.Bbs
{
public class Event
{
private class Header
{
[Data] public int MagicCode { get; set; }
[Data] public int Count { get => Items.TryGetCount(); set => Items = Items.CreateOrResize(value); }
[Data] public List<Event> Items { get; set; }
static Header()
{
BinaryMapping.SetMemberLengthMapping<Header>(nameof(Items), (o, m) => o.Count);
}
}
[Data] public short Id { get; set; }
[Data] public short EventIndex { get; set; }
[Data] public byte World { get; set; }
[Data] public byte Room { get; set; }
[Data] public short Unknown06 { get; set; }
public static List<Event> Read(Stream stream) =>
BinaryMapping.ReadObject<Header>(stream).Items;
public static void Write(Stream stream, IEnumerable<Event> events) =>
BinaryMapping.WriteObject(stream, new Header
{
MagicCode = 1,
Items = events.ToList()
});
}
}
|
mit
|
C#
|
e4f32a80b882fcfdd3915ea13e90b7b003ee99e4
|
fix build
|
SergeyTeplyakov/ErrorProne.NET
|
src/ExceptionAnalyzers/ExceptionAnalyzers/Helpers.cs
|
src/ExceptionAnalyzers/ExceptionAnalyzers/Helpers.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using ErrorProne.NET.Core;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace ErrorProne.NET.Exceptions
{
internal struct ExceptionReference
{
public ExceptionReference(ISymbol symbol, IdentifierNameSyntax identifier)
{
Contract.Requires(symbol != null);
Contract.Requires(identifier != null);
Symbol = symbol;
Identifier = identifier;
}
public ISymbol Symbol { get; }
public IdentifierNameSyntax Identifier { get; }
}
internal static class Helpers
{
public static List<ExceptionReference> GetExceptionIdentifierUsages(this SemanticModel semanticModel, SyntaxNode searchRoot)
{
var usages = (searchRoot ?? semanticModel.SyntaxTree.GetRoot())
.DescendantNodes()
.OfType<IdentifierNameSyntax>()
.Select(id => new { Symbol = semanticModel.GetSymbolInfo(id).Symbol, Id = id })
.Where(x => x.Symbol != null && x.Symbol.ExceptionFromCatchBlock())
.Select(x => new ExceptionReference(x.Symbol, x.Id))
.ToList();
return usages;
}
public static bool CatchIsTooGeneric(this CatchDeclarationSyntax declaration, SemanticModel semanticModel)
{
if (declaration == null)
{
return true;
}
var symbol = semanticModel.GetSymbolInfo(declaration.Type);
if (symbol.Symbol == null)
{
return false;
}
var exception = semanticModel.Compilation.GetTypeByMetadataName(typeof(Exception).FullName);
var aggregateException = semanticModel.Compilation.GetTypeByMetadataName(typeof(AggregateException).FullName);
return symbol.Symbol.Equals(exception) || symbol.Symbol.Equals(aggregateException);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace ErrorProne.NET.Exceptions
{
internal struct ExceptionReference
{
public ExceptionReference(ISymbol symbol, IdentifierNameSyntax identifier)
{
Contract.Requires(symbol != null);
Contract.Requires(identifier != null);
Symbol = symbol;
Identifier = identifier;
}
public ISymbol Symbol { get; }
public IdentifierNameSyntax Identifier { get; }
}
internal static class Helpers
{
public static List<ExceptionReference> GetExceptionIdentifierUsages(this SemanticModel semanticModel, SyntaxNode searchRoot)
{
var usages = (searchRoot ?? semanticModel.SyntaxTree.GetRoot())
.DescendantNodes()
.OfType<IdentifierNameSyntax>()
.Select(id => new { Symbol = semanticModel.GetSymbolInfo(id).Symbol, Id = id })
.Where(x => x.Symbol != null && x.Symbol.ExceptionFromCatchBlock())
.Select(x => new ExceptionReference(x.Symbol, x.Id))
.ToList();
return usages;
}
public static bool CatchIsTooGeneric(this CatchDeclarationSyntax declaration, SemanticModel semanticModel)
{
if (declaration == null)
{
return true;
}
var symbol = semanticModel.GetSymbolInfo(declaration.Type);
if (symbol.Symbol == null)
{
return false;
}
var exception = semanticModel.Compilation.GetTypeByMetadataName(typeof(Exception).FullName);
var aggregateException = semanticModel.Compilation.GetTypeByMetadataName(typeof(AggregateException).FullName);
return symbol.Symbol.Equals(exception) || symbol.Symbol.Equals(aggregateException);
}
}
}
|
mit
|
C#
|
e3ddeec491dfc5944d4329444336ae84e8264b0e
|
Add the option of specifying a comparer.
|
IvionSauce/MeidoBot
|
IvionSoft/History.cs
|
IvionSoft/History.cs
|
using System;
using System.Collections.Generic;
namespace IvionSoft
{
public class History<T>
{
public int Length { get; private set; }
HashSet<T> hashes;
Queue<T> queue;
object _locker = new object();
public History(int length) : this(length, null)
{}
public History(int length, IEqualityComparer<T> comparer)
{
if (length < 1)
throw new ArgumentException("Must be 1 or larger", "length");
Length = length;
queue = new Queue<T>(length + 1);
if (comparer != null)
hashes = new HashSet<T>(comparer);
else
hashes = new HashSet<T>();
}
public bool Contains(T item)
{
return hashes.Contains(item);
}
public bool Add(T item)
{
bool added;
lock (_locker)
{
added = hashes.Add(item);
if (added)
{
queue.Enqueue(item);
if (queue.Count > Length)
{
T toRemove = queue.Dequeue();
hashes.Remove(toRemove);
}
}
}
return added;
}
}
}
|
using System;
using System.Collections.Generic;
namespace IvionSoft
{
public class History<T>
{
int length;
HashSet<T> hashes;
Queue<T> queue;
object _locker;
public History(int length)
{
if (length < 1)
throw new ArgumentException("Must be 1 or larger", "length");
this.length = length;
hashes = new HashSet<T>();
queue = new Queue<T>(length + 1);
_locker = new object();
}
public bool Contains(T item)
{
return hashes.Contains(item);
}
public bool Add(T item)
{
bool added;
lock (_locker)
{
added = hashes.Add(item);
if (added)
{
queue.Enqueue(item);
if (queue.Count > length)
{
T toRemove = queue.Dequeue();
hashes.Remove(toRemove);
}
}
}
return added;
}
}
}
|
bsd-2-clause
|
C#
|
883c6f1eb30f460790d4d74fbe16e96f08e866e6
|
Update colour of spotlights playlist to match new specs
|
peppy/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu
|
osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs
|
osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Rooms;
using osuTK.Graphics;
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
public class RoomSpecialCategoryPill : OnlinePlayComposite
{
private SpriteText text;
private PillContainer pill;
[Resolved]
private OsuColour colours { get; set; }
public RoomSpecialCategoryPill()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = pill = new PillContainer
{
Background =
{
Colour = colours.Pink,
Alpha = 1
},
Child = text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 12),
Colour = Color4.Black
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
Category.BindValueChanged(c =>
{
text.Text = c.NewValue.GetLocalisableDescription();
switch (c.NewValue)
{
case RoomCategory.Spotlight:
pill.Background.Colour = colours.Green2;
break;
case RoomCategory.FeaturedArtist:
pill.Background.Colour = colours.Blue2;
break;
}
}, true);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
public class RoomSpecialCategoryPill : OnlinePlayComposite
{
private SpriteText text;
public RoomSpecialCategoryPill()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
InternalChild = new PillContainer
{
Background =
{
Colour = colours.Pink,
Alpha = 1
},
Child = text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 12),
Colour = Color4.Black
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
Category.BindValueChanged(c => text.Text = c.NewValue.ToString(), true);
}
}
}
|
mit
|
C#
|
c44e4a1d1ddaf3f6d452ea54571c36e061ea11d8
|
remove TODO
|
dimaaan/pgEdit
|
PgEdit/Program.cs
|
PgEdit/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PgEdit
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// TODO table Fields: more details
// TODO navigation: clicking by foreight key cell send user to row with primary key
// TODO navigation: clicking by primary key cell opens menu with depend tables. selecting table send user to table with dependent rows filtered
// TODO navigation: forward and backward buttons, support mouse additional buttons
// TODO SQL editor
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PgEdit
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// TODO panel for quick reset, edit filters similar to EMS manager. Appers under table.
// TODO table Fields: more details
// TODO navigation: clicking by foreight key cell send user to row with primary key
// TODO navigation: clicking by primary key cell opens menu with depend tables. selecting table send user to table with dependent rows filtered
// TODO navigation: forward and backward buttons, support mouse additional buttons
// TODO SQL editor
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
}
}
|
mit
|
C#
|
70ab08b3388b3b96bdb2a2dff69fc884087bcbac
|
Put original Entity.cs back in
|
100Hackers/Plaper
|
Plaper/Plaper/Entity.cs
|
Plaper/Plaper/Entity.cs
|
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Plaper {
class Entity {
protected Texture2D Texture { get; }
protected Vector2 position;
protected int Height { get; }
protected int Width { get; }
protected static bool IsScrolling { get; private set; } = false;
static float shiftDelta;
private static ArrayList entities = new ArrayList();
public Entity(Texture2D texture, double scale, Vector2 position, bool scrollable = true) {
this.Texture = texture;
this.position = position;
this.Height = (int) (scale * texture.Height);
this.Width = (int) (scale * texture.Width);
if (scrollable) entities.Add(this);
}
public Entity(Texture2D texture, int height, int width, Vector2 position, bool scrollable = true) {
this.Texture = texture;
this.position = position;
this.Height = height;
this.Width = width;
if (scrollable) entities.Add(this);
}
public Rectangle Hitbox() {
return new Rectangle((int)position.X, (int)position.Y, Width, Height);
}
public static void ScrollInit(float shiftDelta) {
IsScrolling = true;
Entity.shiftDelta = shiftDelta;
}
public static bool ScrollDown() {
float delta = (float) (Plaper.SHIFT_SPEED * Plaper.gameTime.ElapsedGameTime.TotalSeconds);
foreach (Entity entity in entities) {
entity.position.Y += delta;
}
shiftDelta -= delta;
IsScrolling = shiftDelta > 0;
return IsScrolling;
}
}
}
|
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Plaper {
class Entity {
//Had to change some stuff in this because I don't have visual studio 2015. Once I do, it can be changed back
protected Texture2D Texture { get; set; }
protected Vector2 position;
protected int Height { get; set; }
protected int Width { get; set; }
protected static bool isScrolling = false;
protected static bool IsScrolling { get { return isScrolling; } set {isScrolling = value; } }
static float shiftDelta;
private static ArrayList entities = new ArrayList();
public Entity(Texture2D texture, double scale, Vector2 position, bool scrollable = true) {
this.Texture = texture;
this.position = position;
this.Height = (int) (scale * texture.Height);
this.Width = (int) (scale * texture.Width);
if (scrollable) entities.Add(this);
}
public Entity(Texture2D texture, int height, int width, Vector2 position, bool scrollable = true) {
this.Texture = texture;
this.position = position;
this.Height = height;
this.Width = width;
if (scrollable) entities.Add(this);
}
public Rectangle Hitbox() {
return new Rectangle((int)position.X, (int)position.Y, Width, Height);
}
public static void ScrollInit(float shiftDelta) {
IsScrolling = true;
Entity.shiftDelta = shiftDelta;
}
public static bool ScrollDown() {
float delta = (float) (Plaper.SHIFT_SPEED * Plaper.gameTime.ElapsedGameTime.TotalSeconds);
foreach (Entity entity in entities) {
entity.position.Y += delta;
}
shiftDelta -= delta;
IsScrolling = shiftDelta > 0;
return IsScrolling;
}
}
}
|
cc0-1.0
|
C#
|
adf996af27c7557a2bdec08fc70a6609476143d8
|
fix using
|
guitarrapc/AzureFunctions.Sample
|
Function1/run.csx
|
Function1/run.csx
|
#r "Function1.dll"
using System;
using System.Net;
using System.Linq;
using System.Threading.Tasks;
using System.Net.Http;
using Microsoft.Azure.WebJobs.Host;
using Function1.Function1;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
Function1.Run(req, log);
}
|
#r "Function1.dll"
using System;
using System.Net;
using System.Linq;
using System.Threading.Tasks;
using System.Net.Http;
using Microsoft.Azure.WebJobs.Host;
using Function1;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
Function1.Run(req, log);
}
|
mit
|
C#
|
557f10baa310d5e788c4613dd6729a93938e81de
|
use FakeItEasy's built-in dummy creator
|
OBeautifulCode/OBeautifulCode.AutoFakeItEasy
|
OBeautifulCode.AutoFakeItEasy/AD.cs
|
OBeautifulCode.AutoFakeItEasy/AD.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AD.cs" company="OBeautifulCode">
// Copyright (c) OBeautifulCode. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace OBeautifulCode.AutoFakeItEasy
{
using System;
/// <summary>
/// Provides methods for generating fake objects.
/// </summary>
// ReSharper disable InconsistentNaming
public static class AD
// ReSharper restore InconsistentNaming
{
#pragma warning disable SA1300
/// <summary>
/// Gets a dummy object of the specified type.
/// </summary>
/// <param name="typeOfDummy">The type of dummy to return.</param>
/// <returns>A dummy object of the specified type.</returns>
/// <exception cref="ArgumentException">Dummies of the specified type can not be created.</exception>
// ReSharper disable InconsistentNaming
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "ummy", Justification = "Attempting to get something as close to A.Dummy<T> as possible.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "ummy", Justification = "Attempting to get something as close to A.Dummy<T> as possible.")]
public static object ummy(Type typeOfDummy)
// ReSharper restore InconsistentNaming
#pragma warning restore SA1300
{
var result = FakeItEasy.Sdk.Create.Dummy(typeOfDummy);
return result;
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AD.cs" company="OBeautifulCode">
// Copyright (c) OBeautifulCode. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace OBeautifulCode.AutoFakeItEasy
{
using System;
using System.Linq;
using System.Reflection;
using FakeItEasy;
/// <summary>
/// Provides methods for generating fake objects.
/// </summary>
// ReSharper disable InconsistentNaming
public static class AD
// ReSharper restore InconsistentNaming
{
private static readonly MethodInfo FakeItEasyDummyMethod = typeof(A).GetMethods().Single(_ => _.Name == nameof(A.Dummy));
#pragma warning disable SA1300
/// <summary>
/// Gets a dummy object of the specified type.
/// </summary>
/// <param name="type">The type of dummy to return.</param>
/// <returns>A dummy object of the specified type.</returns>
/// <exception cref="ArgumentException">Dummies of the specified type can not be created.</exception>
// ReSharper disable InconsistentNaming
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "ummy", Justification = "Attempting to get something as close to A.Dummy<T> as possible.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "ummy", Justification = "Attempting to get something as close to A.Dummy<T> as possible.")]
public static object ummy(Type type)
// ReSharper restore InconsistentNaming
#pragma warning restore SA1300
{
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
var fakeItEasyGenericDummyMethod = FakeItEasyDummyMethod.MakeGenericMethod(type);
object result = fakeItEasyGenericDummyMethod.Invoke(null, null);
return result;
}
}
}
|
mit
|
C#
|
184bd46ae348a62103d7b1717239391bfad20956
|
add debugging to routing
|
greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d
|
Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTRouter.cs
|
Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTRouter.cs
|
using System.Collections.Generic;
using WebSocketSharp.Net;
namespace HappyFunTimes
{
public delegate bool RouteHandler(string path, HttpListenerRequest req, HttpListenerResponse res);
public class HFTRouter
{
public bool Route(string path, HttpListenerRequest req, HttpListenerResponse res) {
//UnityEngine.Debug.Log("routing: " + path);
for (int i = 0; i < handlers_.Count; ++i)
{
RouteHandler handler = handlers_[i];
//UnityEngine.Debug.Log("Route Checking: " + handler.Method.Name + " path: " + path);
if (handler(path, req, res))
{
//UnityEngine.Debug.Log("handled");
return true;
}
}
return false; // not handled
}
public void Add(RouteHandler handler)
{
handlers_.Add(handler);
}
private List<RouteHandler> handlers_ = new List<RouteHandler>();
}
}
|
using System.Collections.Generic;
using WebSocketSharp.Net;
namespace HappyFunTimes
{
public delegate bool RouteHandler(string path, HttpListenerRequest req, HttpListenerResponse res);
public class HFTRouter
{
public bool Route(string path, HttpListenerRequest req, HttpListenerResponse res) {
for (int i = 0; i < handlers_.Count; ++i)
{
RouteHandler handler = handlers_[i];
//UnityEngine.Debug.Log("Route Checking: " + handler.Method.Name + " path: " + path);
if (handler(path, req, res))
{
return true;
}
}
return false; // not handled
}
public void Add(RouteHandler handler)
{
handlers_.Add(handler);
}
private List<RouteHandler> handlers_ = new List<RouteHandler>();
}
}
|
bsd-3-clause
|
C#
|
a2b4f47acfdfd11073f11e5dfc22e9f61fc18c99
|
replace description with summary
|
RogueException/Discord.Net,Confruggy/Discord.Net,AntiTcb/Discord.Net,LassieME/Discord.Net
|
docs/guides/samples/module.cs
|
docs/guides/samples/module.cs
|
using Discord.Commands;
using Discord.WebSocket;
// Create a module with no prefix
[Module]
public class Info
{
// ~say hello -> hello
[Command("say"), Summary("Echos a message.")]
public async Task Say(IUserMessage msg,
[Unparsed, Summary("The text to echo")] string echo)
{
await msg.Channel.SendMessageAsync(echo);
}
}
// Create a module with the 'sample' prefix
[Module("sample")]
public class Sample
{
// ~sample square 20 ->
[Command("square"), Summary("Squares a number.")]
public async Task Square(IUserMessage msg,
[Summary("The number to square.")] int num)
{
await msg.Channel.SendMessageAsync($"{num}^2 = {Math.Pow(num, 2)}");
}
// ~sample userinfo --> foxbot#0282
// ~sample userinfo @Khionu --> Khionu#8708
// ~sample userinfo Khionu#8708 --> Khionu#8708
// ~sample userinfo Khionu --> Khionu#8708
// ~sample userinfo 96642168176807936 --> Khionu#8708
// ~sample whois 96642168176807936 --> Khionu#8708
[Command("userinfo"), Summary("Returns info about the current user, or the user parameter, if one passed.")]
[Alias("user", "whois")]
public async Task UserInfo(IUserMessage msg,
[Summary("The (optional) user to get info for")] IUser user = null)
{
var userInfo = user ?? await Program.Client.GetCurrentUserAsync();
await msg.Channel.SendMessageAsync($"{userInfo.Username}#{userInfo.Discriminator}");
}
}
|
using Discord.Commands;
using Discord.WebSocket;
// Create a module with no prefix
[Module]
public class Info
{
// ~say hello -> hello
[Command("say"), Description("Echos a message.")]
public async Task Say(IUserMessage msg,
[Unparsed, Description("The text to echo")] string echo)
{
await msg.Channel.SendMessageAsync(echo);
}
}
// Create a module with the 'sample' prefix
[Module("sample")]
public class Sample
{
// ~sample square 20 ->
[Command("square"), Description("Squares a number.")]
public async Task Square(IUserMessage msg,
[Description("The number to square.")] int num)
{
await msg.Channel.SendMessageAsync($"{num}^2 = {Math.Pow(num, 2)}");
}
// ~sample userinfo --> foxbot#0282
// ~sample userinfo @Khionu --> Khionu#8708
// ~sample userinfo Khionu#8708 --> Khionu#8708
// ~sample userinfo Khionu --> Khionu#8708
// ~sample userinfo 96642168176807936 --> Khionu#8708
// ~sample whois 96642168176807936 --> Khionu#8708
[Command("userinfo"), Description("Returns info about the current user, or the user parameter, if one passed.")]
[Alias("user", "whois")]
public async Task UserInfo(IUserMessage msg,
[Description("The (optional) user to get info for")] IUser user = null)
{
var userInfo = user ?? await Program.Client.GetCurrentUserAsync();
await msg.Channel.SendMessageAsync($"{userInfo.Username}#{userInfo.Discriminator}");
}
}
|
mit
|
C#
|
adf569e05eb99569b3e0f4aa9f3e112b1a96afcb
|
Update PlatformModule.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Framework.Core/DependencyInjection/PlatformModule.cs
|
TIKSN.Framework.Core/DependencyInjection/PlatformModule.cs
|
using Autofac;
namespace TIKSN.DependencyInjection
{
public class PlatformModule : Module
{
protected override void Load(ContainerBuilder builder)
{
}
}
}
|
using Autofac;
namespace TIKSN.DependencyInjection
{
public class PlatformModule : Module
{
protected override void Load(ContainerBuilder builder)
{
}
}
}
|
mit
|
C#
|
e68fa1a336aa0eb9e05343927f7b4dc836faf18e
|
Update Demo
|
sunkaixuan/SqlSugar
|
Src/Asp.Net/SqlServerTest/Config.cs
|
Src/Asp.Net/SqlServerTest/Config.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class Config
{
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SqlSugar4XTest";
public static string ConnectionString2 = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST";
public static string ConnectionString3 = "server=.;uid=sa;pwd=@jhl85661501;database=sqlsugar4xtest";
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class Config
{
public static string ConnectionString = "server=.;uid=sa;pwd=sasa;database=SqlSugar4XTest";
public static string ConnectionString2 = "server=.;uid=sa;pwd=sasa;database=SQLSUGAR4XTEST";
public static string ConnectionString3 = "server=.;uid=sa;pwd=sasa;database=sqlsugar4xtest";
}
}
|
apache-2.0
|
C#
|
eff88a66d1fab0189627cf758e4db321adf850bf
|
Add blocks not in order
|
ajlopez/PegSharp
|
Src/PegSharp/External/BlockChain.cs
|
Src/PegSharp/External/BlockChain.cs
|
namespace PegSharp.External
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class BlockChain
{
private List<BlockData> blocks = new List<BlockData>();
private List<BlockData> others = new List<BlockData>();
public long Height { get { return blocks.Count; } }
public BlockData BestBlock
{
get
{
return this.blocks.Last();
}
}
public bool Add(BlockData block)
{
if ((this.blocks.Count == 0 && block.Number == 0) || (this.blocks.Count > 0 && this.BestBlock.Hash.Equals(block.ParentHash)))
{
this.blocks.Add(block);
var children = this.others.Where(b => b.ParentHash.Equals(block.Hash)).ToList();
foreach (var child in children) {
this.others.Remove(child);
this.Add(child);
}
return true;
}
others.Add(block);
return false;
}
}
}
|
namespace PegSharp.External
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class BlockChain
{
private List<BlockData> blocks = new List<BlockData>();
private List<BlockData> others = new List<BlockData>();
public long Height { get { return blocks.Count; } }
public BlockData BestBlock
{
get
{
return this.blocks.Last();
}
}
public bool Add(BlockData block)
{
if ((this.blocks.Count == 0 && block.Number == 0) || (this.blocks.Count > 0 && this.BestBlock.Hash.Equals(block.ParentHash)))
{
this.blocks.Add(block);
var children = this.others.Where(b => b.ParentHash.Equals(block.Hash));
foreach (var child in children) {
this.others.Remove(child);
this.Add(child);
}
return true;
}
others.Add(block);
return false;
}
}
}
|
mit
|
C#
|
904eb5a96ea4c35df2c3c4074954e8e5687992a8
|
Change polling interval to match graphite (10 sec)
|
cloudbirdnet/StatsDPerfMon
|
StatsDPerfMon/PerfCounterService.cs
|
StatsDPerfMon/PerfCounterService.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace StatsDPerfMon
{
public class PerfCounterService : ScheduledServiceBase
{
private readonly Lazy<Dictionary<string, PerformanceCounter>> counters;
private readonly IStatsD statsD;
public PerfCounterService(Func<IEnumerable<CounterDefinition>> getDefinitions, string statsDHost, int statsDPort = 8125, string statsPrefix = null)
{
defaultTickTimeSpan = TimeSpan.FromSeconds(10);
initialDelay = TimeSpan.FromSeconds(10);
statsPrefix = statsPrefix ?? string.Format("monitor.{0}.", Environment.MachineName);
statsD = new StatsD(
host: statsDHost,
port: statsDPort,
prefix: statsPrefix
);
counters = new Lazy<Dictionary<string, PerformanceCounter>>(() => CreateCounters(getDefinitions()));
}
public override void Stop()
{
base.Stop();
// Guages in statsD retain their last value so set everything to 0 when stopping so we can see there is no data
ZeroAllStats();
}
private void ZeroAllStats()
{
foreach (var keyValuePair in counters.Value)
{
var statsName = keyValuePair.Key;
statsD.Gauge(statsName, 0);
}
}
protected override void DoWork()
{
foreach (var keyValuePair in counters.Value)
{
var counter = keyValuePair.Value;
var statsName = keyValuePair.Key;
statsD.Gauge(statsName, (long)counter.NextValue());
}
}
private Dictionary<string, PerformanceCounter> CreateCounters(IEnumerable<CounterDefinition> definitions)
{
return definitions.ToDictionary(
definition => definition.StatName,
definition => new PerformanceCounter(definition.CategoryName, definition.CounterName, definition.InstanceName));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace StatsDPerfMon
{
public class PerfCounterService : ScheduledServiceBase
{
private readonly Lazy<Dictionary<string, PerformanceCounter>> counters;
private readonly IStatsD statsD;
public PerfCounterService(Func<IEnumerable<CounterDefinition>> getDefinitions, string statsDHost, int statsDPort = 8125, string statsPrefix = null)
{
defaultTickTimeSpan = TimeSpan.FromSeconds(5);
initialDelay = TimeSpan.FromSeconds(10);
statsPrefix = statsPrefix ?? string.Format("monitor.{0}.", Environment.MachineName);
statsD = new StatsD(
host: statsDHost,
port: statsDPort,
prefix: statsPrefix
);
counters = new Lazy<Dictionary<string, PerformanceCounter>>(() => CreateCounters(getDefinitions()));
}
public override void Stop()
{
base.Stop();
// Guages in statsD retain their last value so set everything to 0 when stopping so we can see there is no data
ZeroAllStats();
}
private void ZeroAllStats()
{
foreach (var keyValuePair in counters.Value)
{
var statsName = keyValuePair.Key;
statsD.Gauge(statsName, 0);
}
}
protected override void DoWork()
{
foreach (var keyValuePair in counters.Value)
{
var counter = keyValuePair.Value;
var statsName = keyValuePair.Key;
statsD.Gauge(statsName, (long)counter.NextValue());
}
}
private Dictionary<string, PerformanceCounter> CreateCounters(IEnumerable<CounterDefinition> definitions)
{
return definitions.ToDictionary(
definition => definition.StatName,
definition => new PerformanceCounter(definition.CategoryName, definition.CounterName, definition.InstanceName));
}
}
}
|
mit
|
C#
|
39f4dc08b466da5848f5f661c6b12189f8c31ad6
|
add linq to the mix
|
jmrnilsson/efpad,jmrnilsson/efpad,jmrnilsson/efpad,jmrnilsson/efpad
|
02-sqlite/Program.cs
|
02-sqlite/Program.cs
|
using System;
using System.Linq;
namespace ConsoleApp
{
public class Program
{
public static void Main()
{
using (var db = new BloggingContext())
{
db.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/adonet" });
var count = db.SaveChanges();
Console.WriteLine("{0} records saved to database", count);
Console.WriteLine();
Console.WriteLine("All blogs in database:");
var evenBlogs =
from b in db.Blogs
where b.BlogId % 2 == 0
select b;
Console.WriteLine("Blogs with even blog_ids");
foreach (var blog in evenBlogs)
{
Console.WriteLine(String.Join(", ", blog.Url, blog.BlogId, blog.Name, blog.Posts));
}
}
}
}
}
|
using System;
namespace ConsoleApp
{
public class Program
{
public static void Main()
{
using (var db = new BloggingContext())
{
db.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/adonet" });
var count = db.SaveChanges();
Console.WriteLine("{0} records saved to database", count);
Console.WriteLine();
Console.WriteLine("All blogs in database:");
foreach (var blog in db.Blogs)
{
Console.WriteLine(String.Join(", ", blog.Url, blog.BlogId, blog.Name, blog.Posts));
}
}
}
}
}
|
mit
|
C#
|
9983dd129cd855cf8cc0040887d828844a2eb025
|
Update heading size
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
src/SFA.DAS.EmployerAccounts.Web/Views/Shared/_COVID19GuidanceBanner.cshtml
|
src/SFA.DAS.EmployerAccounts.Web/Views/Shared/_COVID19GuidanceBanner.cshtml
|
@if (ViewBag.UseCDN ?? false)
{
<div class="das-notification">
<p class="das-notification__heading govuk-!-margin-bottom-0">
Coronavirus (COVID-19): <a href="https://www.gov.uk/government/publications/coronavirus-covid-19-apprenticeship-programme-response/coronavirus-covid-19-guidance-for-apprentices-employers-training-providers-end-point-assessment-organisations-and-external-quality-assurance-pro" target="_blank" class="govuk-link">read our guidance</a> on the changes we're making to apprenticeships and <a href="https://help.apprenticeships.education.gov.uk/hc/en-gb/articles/360009509360-Pause-or-stop-an-apprenticeship" target="_blank" class="govuk-link">find out how you can pause your apprenticeships</a>.
</p>
</div>
}
else
{
<div class="info-summary">
<h2 class="heading-medium">
Coronavirus (COVID-19): <a href="https://www.gov.uk/government/publications/coronavirus-covid-19-apprenticeship-programme-response/coronavirus-covid-19-guidance-for-apprentices-employers-training-providers-end-point-assessment-organisations-and-external-quality-assurance-pro" target="_blank">read our guidance</a> on the changes we're making to apprenticeships and <a href="https://help.apprenticeships.education.gov.uk/hc/en-gb/articles/360009509360-Pause-or-stop-an-apprenticeship" target="_blank">find out how you can pause your apprenticeships</a>.
</h2>
</div>
}
|
@if (ViewBag.UseCDN ?? false)
{
<div class="das-notification">
<p class="das-notification__heading govuk-!-margin-bottom-0">
Coronavirus (COVID-19): <a href="https://www.gov.uk/government/publications/coronavirus-covid-19-apprenticeship-programme-response/coronavirus-covid-19-guidance-for-apprentices-employers-training-providers-end-point-assessment-organisations-and-external-quality-assurance-pro" target="_blank" class="govuk-link">read our guidance</a> on the changes we're making to apprenticeships and <a href="https://help.apprenticeships.education.gov.uk/hc/en-gb/articles/360009509360-Pause-or-stop-an-apprenticeship" target="_blank" class="govuk-link">find out how you can pause your apprenticeships</a>.
</p>
</div>
}
else
{
<div class="info-summary">
<h2 class="heading-small">
Coronavirus (COVID-19): <a href="https://www.gov.uk/government/publications/coronavirus-covid-19-apprenticeship-programme-response/coronavirus-covid-19-guidance-for-apprentices-employers-training-providers-end-point-assessment-organisations-and-external-quality-assurance-pro" target="_blank">read our guidance</a> on the changes we're making to apprenticeships and <a href="https://help.apprenticeships.education.gov.uk/hc/en-gb/articles/360009509360-Pause-or-stop-an-apprenticeship" target="_blank">find out how you can pause your apprenticeships</a>.
</h2>
</div>
}
|
mit
|
C#
|
5a6bd6461ae0e5f6e2b62e43c72a3979fa0bce9e
|
Use the correct GUID for SVsUserNotificationsService
|
mavasani/roslyn,dotnet/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,bartdesmet/roslyn,KevinRansom/roslyn
|
src/VisualStudio/IntegrationTest/TestSetup/IntegrationTestServicePackage.cs
|
src/VisualStudio/IntegrationTest/TestSetup/IntegrationTestServicePackage.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Task = System.Threading.Tasks.Task;
namespace Microsoft.VisualStudio.IntegrationTest.Setup
{
[Guid("D02DAC01-DDD0-4ECC-8687-79A554852B14")]
public sealed class IntegrationTestServicePackage : AsyncPackage
{
private static readonly Guid s_compilerPackage = new Guid("31C0675E-87A4-4061-A0DD-A4E510FCCF97");
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true);
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
var shell = (IVsShell)await GetServiceAsync(typeof(SVsShell));
ErrorHandler.ThrowOnFailure(shell.IsPackageInstalled(s_compilerPackage, out var installed));
if (installed != 0)
{
await ((IVsShell7)shell).LoadPackageAsync(s_compilerPackage);
}
// Workaround for deadlock loading ExtensionManagerPackage prior to
// https://devdiv.visualstudio.com/DevDiv/_git/VSExtensibility/pullrequest/381506
var svsUserNotificationsService = new Guid("153FA24E-5B64-4447-964E-FF57B2491A43");
await ((AsyncServiceProvider)AsyncServiceProvider.GlobalProvider).QueryServiceAsync(svsUserNotificationsService);
IntegrationTestServiceCommands.Initialize(this);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.UserNotifications.Interop;
using Task = System.Threading.Tasks.Task;
namespace Microsoft.VisualStudio.IntegrationTest.Setup
{
[Guid("D02DAC01-DDD0-4ECC-8687-79A554852B14")]
public sealed class IntegrationTestServicePackage : AsyncPackage
{
private static readonly Guid s_compilerPackage = new Guid("31C0675E-87A4-4061-A0DD-A4E510FCCF97");
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true);
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
var shell = (IVsShell)await GetServiceAsync(typeof(SVsShell));
ErrorHandler.ThrowOnFailure(shell.IsPackageInstalled(s_compilerPackage, out var installed));
if (installed != 0)
{
await ((IVsShell7)shell).LoadPackageAsync(s_compilerPackage);
}
#pragma warning disable CS0612 // Type or member is obsolete
// Workaround for deadlock loading ExtensionManagerPackage prior to
// https://devdiv.visualstudio.com/DevDiv/_git/VSExtensibility/pullrequest/381506
await GetServiceAsync(typeof(SVsUserNotificationsService));
#pragma warning restore CS0612 // Type or member is obsolete
IntegrationTestServiceCommands.Initialize(this);
}
}
}
|
mit
|
C#
|
37f796a84984f787d7d856f728b663f008f95dca
|
increase version number
|
gigya/microdot
|
SolutionVersion.cs
|
SolutionVersion.cs
|
#region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Gigya Inc.")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyDescription("Microdot Framework")]
[assembly: AssemblyVersion("1.2.2.0")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyInformationalVersion("1.2.2.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
|
#region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Gigya Inc.")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyDescription("Microdot Framework")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
|
apache-2.0
|
C#
|
2484e67670c7f0936bef8166aed61f4f8e9880eb
|
Fix settings for browser.
|
cube-soft/Cube.Net,cube-soft/Cube.Net,cube-soft/Cube.Net
|
Applications/Rss/Reader/App.xaml.cs
|
Applications/Rss/Reader/App.xaml.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.Reflection;
using System.Windows;
namespace Cube.Net.App.Rss.Reader
{
/* --------------------------------------------------------------------- */
///
/// App
///
/// <summary>
/// メインプログラムを表すクラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public partial class App : Application
{
/* ----------------------------------------------------------------- */
///
/// Application_Startup
///
/// <summary>
/// 起動時に実行されるハンドラです。
/// </summary>
///
/* ----------------------------------------------------------------- */
private void Application_Startup(object sender, StartupEventArgs e)
{
Cube.Log.Operations.Configure();
Cube.Log.Operations.ObserveTaskException();
Cube.Log.Operations.Info(GetType(), Assembly.GetExecutingAssembly());
System.Net.ServicePointManager.DefaultConnectionLimit = 10;
BrowserSettings.Version = BrowserVersion.Latest;
BrowserSettings.MaxConnections = 10;
BrowserSettings.NavigationSounds = false;
}
}
}
|
/* ------------------------------------------------------------------------- */
//
// 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.Reflection;
using System.Windows;
namespace Cube.Net.App.Rss.Reader
{
/* --------------------------------------------------------------------- */
///
/// App
///
/// <summary>
/// メインプログラムを表すクラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public partial class App : Application
{
/* ----------------------------------------------------------------- */
///
/// Application_Startup
///
/// <summary>
/// 起動時に実行されるハンドラです。
/// </summary>
///
/* ----------------------------------------------------------------- */
private void Application_Startup(object sender, StartupEventArgs e)
{
Cube.Log.Operations.Configure();
Cube.Log.Operations.ObserveTaskException();
Cube.Log.Operations.Info(GetType(), Assembly.GetExecutingAssembly());
System.Net.ServicePointManager.DefaultConnectionLimit = 10;
BrowserSettings.Version = BrowserVersion.Latest;
}
}
}
|
apache-2.0
|
C#
|
85689a03592b3d171c28fb689a38473135d5e9f0
|
Use lower-case names.
|
izrik/sub,izrik/sub
|
ParameterTypes.cs
|
ParameterTypes.cs
|
using System;
using NCommander;
using System.Text;
using System.Linq;
using Substrate;
namespace sub
{
public static class ParameterTypes
{
public static readonly ParameterType BlockType = new ParameterType(
name: "block_type",
convertAction: arg =>
{
arg = arg.ToLower();
if (BlockTypesByName._BlockTypesByName.ContainsKey(arg))
{
return BlockTypesByName._BlockTypesByName[arg];
}
return int.Parse(arg);
},
description: "The name or number of a kind of block, e.g., air, stone, dirt",
helpText: "The available block types are:\r\n\r\n" +
string.Join(
"\r\n",
BlockTypesByName._BlockTypesByName.Keys.Select(
name => string.Format(" {0}", name))),
outputType: typeof(int)
);
public static readonly ParameterType World = new ParameterType(
name: "world",
convertAction: AnvilWorld.Open,
description: "The path of a folder containing a world's data files",
outputType: typeof(AnvilWorld)
);
}
}
|
using System;
using NCommander;
using System.Text;
using System.Linq;
using Substrate;
namespace sub
{
public static class ParameterTypes
{
public static readonly ParameterType BlockType = new ParameterType(
name: "BlockType",
convertAction: arg =>
{
arg = arg.ToLower();
if (BlockTypesByName._BlockTypesByName.ContainsKey(arg))
{
return BlockTypesByName._BlockTypesByName[arg];
}
return int.Parse(arg);
},
description: "The name or number of a kind of block, e.g., air, stone, dirt",
helpText: "The available block types are:\r\n\r\n" +
string.Join(
"\r\n",
BlockTypesByName._BlockTypesByName.Keys.Select(
name => string.Format(" {0}", name))),
outputType: typeof(int)
);
public static readonly ParameterType World = new ParameterType(
name: "World",
convertAction: AnvilWorld.Open,
description: "The path of a folder containing a world's data files",
outputType: typeof(AnvilWorld)
);
}
}
|
mit
|
C#
|
d5487e460a25c5b4bda62ba1c8f78100443672fa
|
Fix typo.
|
izrik/sub,izrik/sub
|
ParameterTypes.cs
|
ParameterTypes.cs
|
using System;
using NCommander;
using System.Text;
using System.Linq;
using Substrate;
namespace sub
{
public static class ParameterTypes
{
public static readonly ParameterType BlockType = new ParameterType(
name: "BlockType",
convertAction: arg =>
{
arg = arg.ToLower();
if (BlockTypesByName._BlockTypesByName.ContainsKey(arg))
{
return BlockTypesByName._BlockTypesByName[arg];
}
return int.Parse(arg);
},
description: "The name or number of a kind of block, e.g., air, stone, dirt",
helpText: "The available block types are:\r\n\r\n" +
string.Join(
"\r\n",
BlockTypesByName._BlockTypesByName.Keys.Select(
name => string.Format(" {0}", name))),
outputType: typeof(int)
);
public static readonly ParameterType World = new ParameterType(
name: "World",
convertAction: AnvilWorld.Open,
description: "The path of a folder containing a world's data files",
outputType: typeof(AnvilWorld)
);
}
}
|
using System;
using NCommander;
using System.Text;
using System.Linq;
using Substrate;
namespace sub
{
public static class ParameterTypes
{
public static readonly ParameterType BlockType = new ParameterType(
name: "BlockType",
convertAction: arg =>
{
arg = arg.ToLower();
if (BlockTypesByName._BlockTypesByName.ContainsKey(arg))
{
return BlockTypesByName._BlockTypesByName[arg];
}
return int.Parse(arg);
},
description: "The name or number of a kind of block, e.g., air, stone, dirt",
helpText: "The available block types are:\r\nr\n" +
string.Join(
"\r\n",
BlockTypesByName._BlockTypesByName.Keys.Select(
name => string.Format(" {0}", name))),
outputType: typeof(int)
);
public static readonly ParameterType World = new ParameterType(
name: "World",
convertAction: AnvilWorld.Open,
description: "The path of a folder containing a world's data files",
outputType: typeof(AnvilWorld)
);
}
}
|
mit
|
C#
|
1ebc072a5815fd9761ff6d3982ab0cbb92c974c2
|
Implement singleton
|
jonstodle/mowali
|
Mowali/SettingsWrapper.cs
|
Mowali/SettingsWrapper.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
using TmdbWrapper;
using TmdbWrapper.Movies;
using System.Collections.ObjectModel;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Mowali {
public sealed class SettingsWrapper {
const string DATA_FILE_NAME = "data.mwl";
static SettingsWrapper instance;
ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
ObservableCollection<Movie> toWatchList;
ObservableCollection<Movie> watchedList;
static object lockerObject = new object();
public SettingsWrapper Instance {
get {
if(instance == null) {
lock(lockerObject) {
if(instance == null) {
instance = new SettingsWrapper();
}
}
}
return instance;
}
}
#region Class initialization
SettingsWrapper() {
LoadDataFile();
}
async void LoadDataFile() {
var dataFile = await localFolder.CreateFileAsync(DATA_FILE_NAME, CreationCollisionOption.OpenIfExists);
var json = await FileIO.ReadTextAsync(dataFile);
JObject obj = JObject.Parse(json);
toWatchList = await JsonConvert.DeserializeObjectAsync<ObservableCollection<Movie>>((string)obj["ToWatch"]);
watchedList = await JsonConvert.DeserializeObjectAsync<ObservableCollection<Movie>>((string)obj["Watched"]);
}
public async void saveDataFile(){
string dataJson = await JsonConvert.SerializeObjectAsync(new { ToWatch = toWatchList, Watched = watchedList });
var dataFile = await localFolder.CreateFileAsync(DATA_FILE_NAME, CreationCollisionOption.ReplaceExisting);
await FileIO.WriteTextAsync(dataFile, dataJson);
}
#endregion
public ObservableCollection<Movie> ToWatchList {
get {
return toWatchList;
}
}
public ObservableCollection<Movie> WatchedList {
get {
return watchedList;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
using TmdbWrapper;
using TmdbWrapper.Movies;
using System.Collections.ObjectModel;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Mowali {
public sealed class SettingsWrapper {
const string DATA_FILE_NAME = "data.mwl";
static ApplicationDataContainer roamingSettings;
static StorageFolder localFolder;
static ObservableCollection<Movie> toWatchList;
static ObservableCollection<Movie> watchedList;
#region Class initialization
static SettingsWrapper() {
roamingSettings = ApplicationData.Current.RoamingSettings;
localFolder = ApplicationData.Current.LocalFolder;
LoadDataFile();
}
async static void LoadDataFile() {
var dataFile = await localFolder.CreateFileAsync(DATA_FILE_NAME, CreationCollisionOption.OpenIfExists);
var json = await FileIO.ReadTextAsync(dataFile);
JObject obj = JObject.Parse(json);
toWatchList = await JsonConvert.DeserializeObjectAsync<ObservableCollection<Movie>>((string)obj["ToWatch"]);
watchedList = await JsonConvert.DeserializeObjectAsync<ObservableCollection<Movie>>((string)obj["Watched"]);
}
public async static void saveDataFile(){
string dataJson = await JsonConvert.SerializeObjectAsync(new { ToWatch = toWatchList, Watched = watchedList });
var dataFile = await localFolder.CreateFileAsync(DATA_FILE_NAME, CreationCollisionOption.ReplaceExisting);
await FileIO.WriteTextAsync(dataFile, dataJson);
}
#endregion
public static ObservableCollection<Movie> ToWatchList {
get {
return toWatchList;
}
}
public static ObservableCollection<Movie> WatchedList {
get {
return watchedList;
}
}
}
}
|
mit
|
C#
|
6423b7e0a090b0ee5fc1e3ff789087e4ecff8113
|
Make internal methods available to castle proxies.
|
miniter/SSH.NET,sshnet/SSH.NET,Bloomcredit/SSH.NET,GenericHero/SSH.NET
|
Renci.SshClient/Renci.SshNet.NET35/Properties/AssemblyInfo.cs
|
Renci.SshClient/Renci.SshNet.NET35/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("SSH.NET .NET 3.5")]
[assembly: Guid("a9698831-4993-469b-81f1-aed4e5379252")]
[assembly: InternalsVisibleTo("Renci.SshNet.Tests.NET35, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f9194e1eb66b7e2575aaee115ee1d27bc100920e7150e43992d6f668f9737de8b9c7ae892b62b8a36dd1d57929ff1541665d101dc476d6e02390846efae7e5186eec409710fdb596e3f83740afef0d4443055937649bc5a773175b61c57615dac0f0fd10f52b52fedf76c17474cc567b3f7a79de95dde842509fb39aaf69c6c2")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("SSH.NET .NET 3.5")]
[assembly: Guid("a9698831-4993-469b-81f1-aed4e5379252")]
[assembly: InternalsVisibleTo("Renci.SshNet.Tests.NET35, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f9194e1eb66b7e2575aaee115ee1d27bc100920e7150e43992d6f668f9737de8b9c7ae892b62b8a36dd1d57929ff1541665d101dc476d6e02390846efae7e5186eec409710fdb596e3f83740afef0d4443055937649bc5a773175b61c57615dac0f0fd10f52b52fedf76c17474cc567b3f7a79de95dde842509fb39aaf69c6c2")]
|
mit
|
C#
|
aed483c3b58a1dfc25256c99660a0e412309eae4
|
use derived list to keep the coin list in sync with the backend.
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
|
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using WalletWasabi.Gui.ViewModels;
using ReactiveUI;
using System.Collections.ObjectModel;
using WalletWasabi.Models;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinListViewModel : ViewModelBase
{
private ObservableCollection<CoinViewModel> _selectedCoins;
private IEnumerable<CoinViewModel> _coins;
public CoinListViewModel()
{
SelectedCoins = new ObservableCollection<CoinViewModel>();
Coins = Global.WalletService.Coins.CreateDerivedCollection(c => new CoinViewModel(this, c), c => !c.SpentOrCoinJoinInProcess, (first, second) => first.Amount.CompareTo(second.Amount), RxApp.MainThreadScheduler);
}
public ObservableCollection<CoinViewModel> SelectedCoins
{
get { return _selectedCoins; }
set { this.RaiseAndSetIfChanged(ref _selectedCoins, value); }
}
public IEnumerable<CoinViewModel> Coins
{
get { return _coins; }
set { this.RaiseAndSetIfChanged(ref _coins, value); }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using WalletWasabi.Gui.ViewModels;
using ReactiveUI;
using System.Collections.ObjectModel;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinListViewModel : ViewModelBase
{
private ObservableCollection<CoinViewModel> _selectedCoins;
private ObservableCollection<CoinViewModel> _coins;
public CoinListViewModel()
{
SelectedCoins = new ObservableCollection<CoinViewModel>();
Coins = new ObservableCollection<CoinViewModel>
{
new CoinViewModel(this)
{
AmountBtc = "+0.002",
Confirmed = true,
IsSelected = false,
Label = "TestLabel", PrivacyLevel = 7
},
new CoinViewModel(this)
{
AmountBtc = "+0.002",
Confirmed = true,
IsSelected = false,
Label = "TestLabel", PrivacyLevel = 7
},
new CoinViewModel(this)
{
AmountBtc = "+0.002",
Confirmed = true,
IsSelected = false,
Label = "TestLabel", PrivacyLevel = 7
},
new CoinViewModel(this)
{
AmountBtc = "+0.002",
Confirmed = true,
IsSelected = false,
Label = "TestLabel", PrivacyLevel = 7
},
new CoinViewModel(this)
{
AmountBtc = "+0.002",
Confirmed = true,
IsSelected = false,
Label = "TestLabel", PrivacyLevel = 7
},
new CoinViewModel(this)
{
AmountBtc = "+0.002",
Confirmed = true,
IsSelected = false,
Label = "TestLabel", PrivacyLevel = 7
},
};
}
public ObservableCollection<CoinViewModel> SelectedCoins
{
get { return _selectedCoins; }
set { this.RaiseAndSetIfChanged(ref _selectedCoins, value); }
}
public ObservableCollection<CoinViewModel> Coins
{
get { return _coins; }
set { this.RaiseAndSetIfChanged(ref _coins, value); }
}
}
}
|
mit
|
C#
|
0997077aa63252e211173de5de9cb34322791eec
|
Use one way function protocol for bit commitment
|
0culus/ElectronicCash
|
BitCommitment/BitCommitmentEngine.cs
|
BitCommitment/BitCommitmentEngine.cs
|
using System;
namespace BitCommitment
{
/// <summary>
/// A class to perform bit commitment. It does not care what the input is; it's just a
/// facility for exchanging bit commitment messages. Based on Bruce Schneier's one-way
/// function method for committing bits
/// </summary>
public class BitCommitmentEngine
{
public byte[] AliceRandBytes1 { get; set; }
public byte[] AliceRandBytes2 { get; set; }
public byte[] AliceMessageBytesBytes { get; set; }
public BitCommitmentEngine(byte[] one, byte[] two, byte[] messageBytes)
{
AliceRandBytes1 = one;
AliceRandBytes2 = two;
AliceMessageBytesBytes = messageBytes;
}
}
}
|
using System;
namespace BitCommitment
{
/// <summary>
/// A class to perform bit commitment. It does not care what the input is; it's just a
/// facility for exchanging bit commitment messages.
/// </summary>
public class BitCommitmentEngine
{
#region properties
public byte[] BobRandBytesR { get; set; }
public byte[] AliceEncryptedMessage { get; set; }
#endregion
}
}
|
mit
|
C#
|
81ecf5181421f2c03c8e1159d7998076697aefd7
|
Update Room.cs
|
nikola02333/WebKurs,nikola02333/WebKurs,nikola02333/WebKurs
|
BookingApp/BookingApp/Models/Room.cs
|
BookingApp/BookingApp/Models/Room.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace BookingApp.Models
{
public class Room
{
public int RoomId { get; set; }
public int bedCount { get; set; }
public string description { get; set; }
public int pricePerNight { get; set; }
public int roomNumber { get; set; }
public List<RoomReservations> l_RoomReservations { get; set; }
//
public int AccommodationId { get; set; }
public Accommodation Accommodation { get; set; }
public Room()
{
}
~Room()
{
}
}//end Room
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace BookingApp.Models
{
public class Room
{
public int RoomId { get; set; }
private int bedCount { get; set; }
private string description { get; set; }
private int pricePerNight { get; set; }
private int roomNumber { get; set; }
public List<RoomReservations> l_RoomReservations { get; set; }
//
public int AccommodationId { get; set; }
public Accommodation Accommodation { get; set; }
public Room()
{
}
~Room()
{
}
}//end Room
}
|
mit
|
C#
|
756c069a9727dcdbfba07abb53452004cb59892f
|
Clean up unused namespaces
|
davidebbo/OrganizePhotos
|
OrganizePhotos/Program.cs
|
OrganizePhotos/Program.cs
|
using System;
using System.IO;
using ExifLib;
namespace OrganizePhotos
{
class Program
{
static void Main(string[] args)
{
string folder = args.Length == 0 ? "." : args[0];
foreach (string file in Directory.EnumerateFiles(folder, "*.jpg"))
{
DateTime dateTime;
using (var reader = new ExifReader(file))
{
if (!reader.GetTagValue(ExifTags.DateTimeOriginal, out dateTime)) continue;
}
string subFolder = Path.Combine(folder, dateTime.ToString("yyyy-MM-dd"));
Directory.CreateDirectory(subFolder);
File.Move(file, Path.Combine(subFolder, Path.GetFileName(file)));
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExifLib;
namespace OrganizePhotos
{
class Program
{
static void Main(string[] args)
{
string folder = args.Length == 0 ? "." : args[0];
foreach (string file in Directory.EnumerateFiles(folder, "*.jpg"))
{
DateTime dateTime;
using (var reader = new ExifReader(file))
{
if (!reader.GetTagValue(ExifTags.DateTimeOriginal, out dateTime)) continue;
}
string subFolder = Path.Combine(folder, dateTime.ToString("yyyy-MM-dd"));
Directory.CreateDirectory(subFolder);
File.Move(file, Path.Combine(subFolder, Path.GetFileName(file)));
}
}
}
}
|
apache-2.0
|
C#
|
6f033eb60240819e4382034f6078e71bd1358b57
|
Split the list of products on the catalog into lists of the respective product sub-classes
|
tarakreddy/ADAPT,ADAPT/ADAPT
|
source/ADAPT/Catalog.cs
|
source/ADAPT/Catalog.cs
|
/*******************************************************************************
* Copyright (C) 2015 AgGateway and ADAPT Contributors
* Copyright (C) 2015 Deere and Company
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* Tarak Reddy, Tim Shearouse - initial API and implementation
* Kathleen Oneal, Joseph Ross - Added Ingredients
* Tarak Reddy - Added guidance group and Guidance Allocation
* Tarak Reddy - Moved WorkItems and WorkItemsOperations to Documents
* Tarak Reddy - Moved GuidanceAllocations to Documents
*******************************************************************************/
using System.Collections.Generic;
namespace AgGateway.ADAPT.ApplicationDataModel
{
public class Catalog
{
public List<Brand> Brands { get; set; }
public List<Connector> Connectors { get; set; }
public List<Container> Containers { get; set; }
public List<Crop> Crops { get; set; }
public List<CropZone> CropZones { get; set; }
public List<Farm> Farms { get; set; }
public List<Field> Fields { get; set; }
public List<FieldBoundary> FieldBoundaries { get; set; }
public List<Grower> Growers { get; set; }
public List<Ingredient> Ingredients { get; set; }
public List<GuidancePattern> GuidancePatterns { get; set; }
public List<GuidanceGroup> GuidanceGroups { get; set; }
public List<Implement> Implements { get; set; }
public List<ImplementModel> ImplementModels { get; set; }
public List<ImplementType> ImplementTypes { get; set; }
public List<ImplementConfiguration> ImplementConfigurations { get; set; }
public string Name { get; set; }
public List<Person> Persons { get; set; }
public List<PersonRole> PersonRoles { get; set; }
public List<CropVariety> CropVarieties { get; set; }
public List<CropProtectionProduct> CropProtectionProducts { get; set; }
public List<FertilizerProduct> FertilizerProducts { get; set; }
public List<ProductMix> ProductMixes { get; set; }
public List<ProductMixComponent> ProductMixComponents { get; set; }
public List<TimeScope> TimeScopes { get; set; }
public List<Machine> Machines { get; set; }
public List<MachineModel> MachineModels { get; set; }
public List<MachineSeries> MachineSeries { get; set; }
public List<MachineType> MachineTypes { get; set; }
public List<MachineConfiguration> MachineConfigurations { get; set; }
public List<ReferenceNote> ReferenceNotes { get; set; }
}
}
|
/*******************************************************************************
* Copyright (C) 2015 AgGateway and ADAPT Contributors
* Copyright (C) 2015 Deere and Company
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* Tarak Reddy, Tim Shearouse - initial API and implementation
* Kathleen Oneal, Joseph Ross - Added Ingredients
* Tarak Reddy - Added guidance group and Guidance Allocation
* Tarak Reddy - Moved WorkItems and WorkItemsOperations to Documents
* Tarak Reddy - Moved GuidanceAllocations to Documents
*******************************************************************************/
using System.Collections.Generic;
namespace AgGateway.ADAPT.ApplicationDataModel
{
public class Catalog
{
public List<Brand> Brands { get; set; }
public List<Connector> Connectors { get; set; }
public List<Container> Containers { get; set; }
public List<Crop> Crops { get; set; }
public List<CropZone> CropZones { get; set; }
public List<Farm> Farms { get; set; }
public List<Field> Fields { get; set; }
public List<FieldBoundary> FieldBoundaries { get; set; }
public List<Grower> Growers { get; set; }
public List<Ingredient> Ingredients { get; set; }
public List<GuidancePattern> GuidancePatterns { get; set; }
public List<GuidanceGroup> GuidanceGroups { get; set; }
public List<Implement> Implements { get; set; }
public List<ImplementModel> ImplementModels { get; set; }
public List<ImplementType> ImplementTypes { get; set; }
public List<ImplementConfiguration> ImplementConfigurations { get; set; }
public string Name { get; set; }
public List<Person> Persons { get; set; }
public List<PersonRole> PersonRoles { get; set; }
public List<Product> Products { get; set; }
public List<ProductMixComponent> ProductMixComponents { get; set; }
public List<TimeScope> TimeScopes { get; set; }
public List<Machine> Machines { get; set; }
public List<MachineModel> MachineModels { get; set; }
public List<MachineSeries> MachineSeries { get; set; }
public List<MachineType> MachineTypes { get; set; }
public List<MachineConfiguration> MachineConfigurations { get; set; }
public List<ReferenceNote> ReferenceNotes { get; set; }
}
}
|
epl-1.0
|
C#
|
0d03e4b2f2e2f447ae36721a1e3996dcb5fcba78
|
Bump version to 14.2.2.31022
|
HearthSim/HearthDb
|
HearthDb/Properties/AssemblyInfo.cs
|
HearthDb/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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("14.2.2.31022")]
[assembly: AssemblyFileVersion("14.2.2.31022")]
|
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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("14.2.0.30795")]
[assembly: AssemblyFileVersion("14.2.0.30795")]
|
mit
|
C#
|
9c01585567431924cecb663016b36e334b13f7f8
|
Make a proper view model
|
lmno/cupster,lmno/cupster,lmno/cupster
|
webstats/Modules/RootMenuModule.cs
|
webstats/Modules/RootMenuModule.cs
|
/*
* Created by SharpDevelop.
* User: Lars Magnus
* Date: 12.06.2014
* Time: 20:54
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Text;
using Nancy;
using SubmittedData;
namespace Modules
{
/// <summary>
/// Description of WebService.
/// </summary>
public class RootMenuModule : NancyModule
{
public RootMenuModule(ITournament tournament)
{
Get["/"] = _ => {
return View["groups.sshtml", new GroupsViewModel(tournament)];
};
}
}
public class GroupsViewModel
{
public string Tournament
{
get { return _tournament.GetName(); }
}
ITournament _tournament;
public GroupsViewModel(ITournament t)
{
_tournament = t;
}
private string PrintGroups()
{
StringBuilder s = new StringBuilder();
s.AppendFormat("Welcome to {0} betting scores\n", _tournament.GetName());
char gn = 'A';
foreach (object[] group in _tournament.GetGroups())
{
s.AppendLine("Group " + gn);
foreach (var team in group)
{
s.AppendLine(team.ToString());
}
gn++;
}
return s.ToString();
}
}
}
|
/*
* Created by SharpDevelop.
* User: Lars Magnus
* Date: 12.06.2014
* Time: 20:54
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Text;
using Nancy;
using SubmittedData;
namespace Modules
{
/// <summary>
/// Description of WebService.
/// </summary>
public class RootMenuModule : NancyModule
{
private ITournament _tournament;
public RootMenuModule(ITournament tournament)
{
_tournament = tournament;
var groups = new Groups() { Tournament = _tournament.GetName() };
Get["/"] = _ => {
return View["groups.sshtml", groups];
};
}
private string PrintGroups()
{
StringBuilder s = new StringBuilder();
s.AppendFormat("Welcome to {0} betting scores\n", _tournament.GetName());
char gn = 'A';
foreach (object[] group in _tournament.GetGroups())
{
s.AppendLine("Group " + gn);
foreach (var team in group)
{
s.AppendLine(team.ToString());
}
gn++;
}
return s.ToString();
}
}
class Groups
{
public string Tournament { get; set; }
}
}
|
mit
|
C#
|
1625ba3c9e209c467a8398ed97db9fcd99bb9b55
|
Handle hash hit case better (reposition on insert)
|
ronnymgm/csla-light,rockfordlhotka/csla,ronnymgm/csla-light,MarimerLLC/csla,BrettJaner/csla,jonnybee/csla,rockfordlhotka/csla,rockfordlhotka/csla,jonnybee/csla,jonnybee/csla,BrettJaner/csla,ronnymgm/csla-light,JasonBock/csla,MarimerLLC/csla,JasonBock/csla,MarimerLLC/csla,JasonBock/csla,BrettJaner/csla
|
cslacs/Csla/Core/PositionMap.cs
|
cslacs/Csla/Core/PositionMap.cs
|
using System;
using System.Collections.Generic;
namespace Csla.Core
{
internal class PositionMap<T>
where T : Core.IEditableBusinessObject
{
Dictionary<T, int> _map;
IList<T> _list;
public PositionMap(IList<T> list)
{
_list = list;
RebuildMap();
}
public void ClearMap()
{
_map = new Dictionary<T, int>(_list.Count);
}
public void AddToMap(T item)
{
if (!_map.ContainsKey(item))
_map.Add(item, _list.Count - 1);
}
public void InsertIntoMap(T item, int position)
{
if (position == _list.Count - 1)
{
AddToMap(item);
}
else
{
if (!_map.ContainsKey(item))
{
for (int i = _list.Count - 1; i > position; i--)
_map[_list[i]]++;
_map.Add(item, position);
}
}
}
public void RemoveFromMap(T item)
{
int oldPosition = PositionOf(item);
if (oldPosition == -1) return;
_map.Remove(item);
for (int i = oldPosition + 1; i < _list.Count; i++)
_map[_list[i]]--;
}
public int PositionOf(T item)
{
int result;
if (_map.TryGetValue(item, out result))
return result;
else
return -1;
}
public void RebuildMap()
{
ClearMap();
int i = 0;
foreach (T item in _list)
{
_map.Add(item, i);
i++;
}
}
}
}
|
using System;
using System.Collections.Generic;
namespace Csla.Core
{
internal class PositionMap<T>
where T : Core.IEditableBusinessObject
{
Dictionary<T, int> _map;
IList<T> _list;
public PositionMap(IList<T> list)
{
_list = list;
RebuildMap();
}
public void ClearMap()
{
_map = new Dictionary<T, int>(_list.Count);
}
public void AddToMap(T item)
{
if (!_map.ContainsKey(item))
_map.Add(item, _list.Count - 1);
}
public void InsertIntoMap(T item, int position)
{
if (position == _list.Count - 1)
{
AddToMap(item);
}
else
{
for (int i = _list.Count - 1; i > position; i--)
_map[_list[i]]++;
if (!_map.ContainsKey(item))
_map.Add(item, position);
}
}
public void RemoveFromMap(T item)
{
int oldPosition = PositionOf(item);
if (oldPosition == -1) return;
_map.Remove(item);
for (int i = oldPosition + 1; i < _list.Count; i++)
_map[_list[i]]--;
}
public int PositionOf(T item)
{
int result;
if (_map.TryGetValue(item, out result))
return result;
else
return -1;
}
public void RebuildMap()
{
ClearMap();
int i = 0;
foreach (T item in _list)
{
_map.Add(item, i);
i++;
}
}
}
}
|
mit
|
C#
|
90decccc3256c376c98b0f1a7e184ffb88c70fe1
|
Implement toast notification
|
sakapon/Samples-2016,sakapon/Samples-2016
|
WinrtSample/ToastConsole/Program.cs
|
WinrtSample/ToastConsole/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
namespace ToastConsole
{
class Program
{
static void Main(string[] args)
{
// Gets Template.
//var xml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText04);
//var text1 = (XmlElement)xml.GetElementsByTagName("text")[0];
//text1.InnerText = "The Title";
var xmlText = @"<toast><visual><binding template=""ToastText04"">
<text id=""1"">The Title</text>
<text id=""2"">This is the abstract.</text>
<text id=""3"">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</text>
</binding></visual></toast>";
var xml = new XmlDocument();
xml.LoadXml(xmlText);
var toast = new ToastNotification(xml);
var notifier = ToastNotificationManager.CreateToastNotifier("Toast Console");
notifier.Show(toast);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ToastConsole
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
mit
|
C#
|
2910177c66d163228742a14b2048ce53e97483cc
|
rework of cube rotation
|
NataliaDSmirnova/CGAdvanced2017
|
Assets/Scripts/CubeLocalRotation.cs
|
Assets/Scripts/CubeLocalRotation.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeLocalRotation : MonoBehaviour
{
float rotx = 0f;
float roty = 0f;
public readonly float rotation_speed_x = 10f;
public readonly float rotation_speed_y = 10f;
Vector3 upFromWorld;
Vector3 rightFromWorld;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButton(1))
{
rotx = Input.GetAxis("Mouse X") * rotation_speed_x;
roty = Input.GetAxis("Mouse Y") * rotation_speed_y;
upFromWorld = transform.InverseTransformVector(Vector3.up);
rightFromWorld = transform.InverseTransformVector(Vector3.right);
transform.localRotation *= Quaternion.AngleAxis(-rotx, upFromWorld) * Quaternion.AngleAxis(roty, rightFromWorld); }
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeLocalRotation : MonoBehaviour {
Quaternion originalLocalRotation;
float angle = 0f;
public readonly float rotation_speed = 15f;
// Use this for initialization
void Start () {
originalLocalRotation = transform.localRotation;
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButton(1))
{
angle -= rotation_speed * Input.GetAxis("Mouse X");
if (angle < -360f)
angle += 360f;
if (angle > 360f)
angle -= 360f;
transform.localRotation = originalLocalRotation * Quaternion.Euler(0, angle, 0);
}
}
}
|
mit
|
C#
|
c12c01721c70cb3900e5eeb6fd26d9425543d77b
|
Update Program.cs
|
koschmarche/TestRepo
|
githubTest/githubTest/Program.cs
|
githubTest/githubTest/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace githubTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hello github");
Console.WriteLine("Test1111");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace githubTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hello github");
Console.WriteLine("Test1");
}
}
}
|
mit
|
C#
|
363448ddd302bd5c322cb47cd040c99805e3dac5
|
Update FizzBuzz.cs
|
michaeljwebb/Algorithm-Practice
|
LeetCode/FizzBuzz.cs
|
LeetCode/FizzBuzz.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class FizzBuzz
{
private static void Main(string[] args)
{
for (int i = 1; i < 16; i++)
{
if (i % 3 == 0 && i % 5 == 0)
{
Console.WriteLine("FizzBuzz");
}
else if (i % 3 == 0)
{
Console.WriteLine("Fizz");
}
else if (i % 5 == 0)
{
Console.WriteLine("Buzz");
}
else
{
Console.WriteLine(i);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Services;
using System.Text;
class FizzBuzz
{
private static void Main(string[] args)
{
for (int i = 1; i < 16; i++)
{
if (i % 3 == 0 && i % 5 == 0)
{
Console.WriteLine("FizzBuzz");
}
else if (i % 3 == 0)
{
Console.WriteLine("Fizz");
}
else if (i % 5 == 0)
{
Console.WriteLine("Buzz");
}
else
{
Console.WriteLine(i);
}
}
}
}
|
mit
|
C#
|
36435598867451e368634d330c4ff9a03048f8c5
|
clean up
|
asipe/Nucs,asipe/Nucs
|
src/Nucs.Console/Program.cs
|
src/Nucs.Console/Program.cs
|
using MadCat.Core;
using Nucs.App.Main;
namespace Nucs.Console {
internal class Program {
private static void Main() {
new Runner().Start(new AppConfig());
}
}
}
|
using MadCat.Core;
using Nucs.App.Main;
namespace Nucs.Console {
internal class Program {
private static void Main(string[] args) {
new Runner().Start(new AppConfig());
}
}
}
|
mit
|
C#
|
224c37bdc3e67e0f110c3c679080dddcaa0113b6
|
Add localisation for RankingOverlay
|
ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu-new,peppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu
|
osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs
|
osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Rulesets;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users;
namespace osu.Game.Overlays.Rankings
{
public class RankingsOverlayHeader : TabControlOverlayHeader<RankingsScope>
{
public Bindable<RulesetInfo> Ruleset => rulesetSelector.Current;
public Bindable<Country> Country => countryFilter.Current;
private OverlayRulesetSelector rulesetSelector;
private CountryFilter countryFilter;
protected override OverlayTitle CreateTitle() => new RankingsTitle();
protected override Drawable CreateTitleContent() => rulesetSelector = new OverlayRulesetSelector();
protected override Drawable CreateContent() => countryFilter = new CountryFilter();
protected override Drawable CreateBackground() => new OverlayHeaderBackground("Headers/rankings");
private class RankingsTitle : OverlayTitle
{
public RankingsTitle()
{
Title = LayoutStrings.MenuRankingsDefault;
Description = "find out who's the best right now";
IconTexture = "Icons/Hexacons/rankings";
}
}
}
[LocalisableEnum(typeof(RankingsScopeEnumLocalisationMapper))]
public enum RankingsScope
{
Performance,
Spotlights,
Score,
Country
}
public class RankingsScopeEnumLocalisationMapper : EnumLocalisationMapper<RankingsScope>
{
public override LocalisableString Map(RankingsScope value)
{
switch (value)
{
case RankingsScope.Performance:
return LayoutStrings.MenuRankingsIndex;
case RankingsScope.Spotlights:
return LayoutStrings.MenuRankingsCharts;
case RankingsScope.Score:
return LayoutStrings.MenuRankingsScore;
case RankingsScope.Country:
return LayoutStrings.MenuRankingsCountry;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Bindables;
using osu.Game.Rulesets;
using osu.Game.Users;
namespace osu.Game.Overlays.Rankings
{
public class RankingsOverlayHeader : TabControlOverlayHeader<RankingsScope>
{
public Bindable<RulesetInfo> Ruleset => rulesetSelector.Current;
public Bindable<Country> Country => countryFilter.Current;
private OverlayRulesetSelector rulesetSelector;
private CountryFilter countryFilter;
protected override OverlayTitle CreateTitle() => new RankingsTitle();
protected override Drawable CreateTitleContent() => rulesetSelector = new OverlayRulesetSelector();
protected override Drawable CreateContent() => countryFilter = new CountryFilter();
protected override Drawable CreateBackground() => new OverlayHeaderBackground("Headers/rankings");
private class RankingsTitle : OverlayTitle
{
public RankingsTitle()
{
Title = "ranking";
Description = "find out who's the best right now";
IconTexture = "Icons/Hexacons/rankings";
}
}
}
public enum RankingsScope
{
Performance,
Spotlights,
Score,
Country
}
}
|
mit
|
C#
|
23755d31fbaf94b78d5c81c868cdf326809463e3
|
update TableFactory
|
nabehiro/TableIO
|
src/TableIO/TableFactory.cs
|
src/TableIO/TableFactory.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TableIO
{
public class TableFactory
{
public TableReader<TModel> CreateReader<TModel>(IRowReader rowReader,
ITypeConverterResolver typeConverterResolver = null,
IPropertyMapper propertyMapper = null,
IModelValidator modelValidator = null)
where TModel : new()
{
typeConverterResolver = typeConverterResolver ?? new DefaultTypeConverterResolver<TModel>();
propertyMapper = propertyMapper ?? new AutoIndexPropertyMapper();
modelValidator = modelValidator ?? new NullModelValidator();
var reader = new TableReader<TModel>(rowReader, typeConverterResolver, propertyMapper, modelValidator);
return reader;
}
public TableWriter<TModel> CreateWriter<TModel>(IRowWriter rowWriter,
ITypeConverterResolver typeConverterResolver = null,
IPropertyMapper propertyMapper = null)
{
typeConverterResolver = typeConverterResolver ?? new DefaultTypeConverterResolver<TModel>();
propertyMapper = propertyMapper ?? new AutoIndexPropertyMapper();
return new TableWriter<TModel>(rowWriter, typeConverterResolver, propertyMapper);
}
public TableReader<TModel> CreateCsvReader<TModel>(TextReader textReader,
bool hasHeader = false,
ITypeConverterResolver typeConverterResolver = null,
IPropertyMapper propertyMapper = null,
IModelValidator modelValidator = null)
where TModel : new()
{
var rowReader = new CsvStreamRowReader(textReader);
typeConverterResolver = typeConverterResolver ?? new DefaultTypeConverterResolver<TModel>();
propertyMapper = propertyMapper ?? new AutoIndexPropertyMapper();
modelValidator = modelValidator ?? new NullModelValidator();
var reader = new TableReader<TModel>(rowReader, typeConverterResolver, propertyMapper, modelValidator);
reader.HasHeader = hasHeader;
return reader;
}
public TableWriter<TModel> CreateCsvWriter<TModel>(TextWriter textWriter,
ITypeConverterResolver typeConverterResolver = null,
IPropertyMapper propertyMapper = null)
{
var rowWriter = new CsvRowWriter(textWriter);
typeConverterResolver = typeConverterResolver ?? new DefaultTypeConverterResolver<TModel>();
propertyMapper = propertyMapper ?? new AutoIndexPropertyMapper();
return new TableWriter<TModel>(rowWriter, typeConverterResolver, propertyMapper);
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TableIO
{
public class TableFactory
{
public TableReader<TModel> CreateCsvReader<TModel>(TextReader textReader,
bool hasHeader = false,
ITypeConverterResolver typeConverterResolver = null,
IPropertyMapper propertyMapper = null,
IModelValidator modelValidator = null)
where TModel : new()
{
var rowReader = new CsvRegexRowReader(textReader);
typeConverterResolver = typeConverterResolver ?? new DefaultTypeConverterResolver<TModel>();
propertyMapper = propertyMapper ?? new AutoIndexPropertyMapper();
modelValidator = modelValidator ?? new NullModelValidator();
var reader = new TableReader<TModel>(rowReader, typeConverterResolver, propertyMapper, modelValidator);
reader.HasHeader = hasHeader;
return reader;
}
public TableWriter<TModel> CreateCsvWriter<TModel>(TextWriter textWriter,
ITypeConverterResolver typeConverterResolver = null,
IPropertyMapper propertyMapper = null)
{
var rowReader = new CsvRowWriter(textWriter);
typeConverterResolver = typeConverterResolver ?? new DefaultTypeConverterResolver<TModel>();
propertyMapper = propertyMapper ?? new AutoIndexPropertyMapper();
return new TableWriter<TModel>(rowReader, typeConverterResolver, propertyMapper);
}
}
}
|
apache-2.0
|
C#
|
828fb19da61bc9a63c50bf1e2225cbb11bf8e1c4
|
Comment and some extra verification in the test for NH-3063.
|
ngbrown/nhibernate-core,alobakov/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,ngbrown/nhibernate-core,ManufacturingIntelligence/nhibernate-core,RogerKratz/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,livioc/nhibernate-core,nhibernate/nhibernate-core,hazzik/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,gliljas/nhibernate-core,livioc/nhibernate-core,nkreipke/nhibernate-core,RogerKratz/nhibernate-core,nhibernate/nhibernate-core,nkreipke/nhibernate-core,livioc/nhibernate-core,lnu/nhibernate-core,fredericDelaporte/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,alobakov/nhibernate-core,ManufacturingIntelligence/nhibernate-core,hazzik/nhibernate-core,alobakov/nhibernate-core
|
src/NHibernate.Test/Tools/hbm2ddl/SchemaValidator/SchemaValidateFixture.cs
|
src/NHibernate.Test/Tools/hbm2ddl/SchemaValidator/SchemaValidateFixture.cs
|
using System.Reflection;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;
namespace NHibernate.Test.Tools.hbm2ddl.SchemaValidator
{
[TestFixture]
public class SchemaValidateFixture
{
[Test]
public void ShouldVerifySameTable()
{
const string resource = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
var cfg = BuildConfiguration(resource);
new SchemaExport(cfg).Execute(true, true, false);
var validator = new Tool.hbm2ddl.SchemaValidator((cfg));
validator.Validate();
}
[Test, SetCulture("tr-TR"), SetUICulture("tr-TR")]
public void ShouldVerifySameTableTurkish()
{
//NH-3063
// Turkish have unusual casing rules for the letter 'i'. This test verifies that
// code paths executed by the SchemaValidator correctly handles case insensitive
// comparisons for this.
// Just make sure that we have an int property in the mapped class. This is
// the 'i' we rely on for the test.
var v = new Version();
Assert.That(v.Id, Is.TypeOf<int>());
const string resource = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
var cfg = BuildConfiguration(resource);
new SchemaExport(cfg).Execute(true, true, false);
var validator = new Tool.hbm2ddl.SchemaValidator(cfg);
validator.Validate();
}
[Test]
public void ShouldNotVerifyModifiedTable()
{
const string resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
var cfgV1 = BuildConfiguration(resource1);
const string resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.2_Version.hbm.xml";
var cfgV2 = BuildConfiguration(resource2);
new SchemaExport(cfgV1).Execute(true, true, false);
var validatorV2 = new Tool.hbm2ddl.SchemaValidator(cfgV2);
try
{
validatorV2.Validate();
}
catch (HibernateException e)
{
Assert.That(e.Message, Is.StringStarting("Missing column: Name"));
}
}
private static Configuration BuildConfiguration(string resource)
{
var cfg = TestConfigurationHelper.GetDefaultConfiguration();
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource))
cfg.AddInputStream(stream);
return cfg;
}
}
}
|
using System.Reflection;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;
namespace NHibernate.Test.Tools.hbm2ddl.SchemaValidator
{
[TestFixture]
public class SchemaValidateFixture
{
[Test]
public void ShouldVerifySameTable()
{
const string resource = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
var cfg = BuildConfiguration(resource);
new SchemaExport(cfg).Execute(true, true, false);
var validator = new Tool.hbm2ddl.SchemaValidator((cfg));
validator.Validate();
}
[Test, SetCulture("tr-TR"), SetUICulture("tr-TR")]
public void ShouldVerifySameTableTurkish()
{
//NH-3063
const string resource = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
var cfg = BuildConfiguration(resource);
new SchemaExport(cfg).Execute(true, true, false);
var validator = new Tool.hbm2ddl.SchemaValidator(cfg);
validator.Validate();
}
[Test]
public void ShouldNotVerifyModifiedTable()
{
const string resource1 = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.1_Version.hbm.xml";
var cfgV1 = BuildConfiguration(resource1);
const string resource2 = "NHibernate.Test.Tools.hbm2ddl.SchemaValidator.2_Version.hbm.xml";
var cfgV2 = BuildConfiguration(resource2);
new SchemaExport(cfgV1).Execute(true, true, false);
var validatorV2 = new Tool.hbm2ddl.SchemaValidator(cfgV2);
try
{
validatorV2.Validate();
}
catch (HibernateException e)
{
Assert.That(e.Message, Is.StringStarting("Missing column: Name"));
}
}
private static Configuration BuildConfiguration(string resource)
{
var cfg = TestConfigurationHelper.GetDefaultConfiguration();
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource))
cfg.AddInputStream(stream);
return cfg;
}
}
}
|
lgpl-2.1
|
C#
|
b5589b7b4ad1ac5721d995cd58a8f5a53f06bf33
|
move metadata endpoint default to /saml2/metadata
|
elerch/SAML2,alexrster/SAML2
|
src/Owin.Security.Saml/SamlAuthenticationOptions.cs
|
src/Owin.Security.Saml/SamlAuthenticationOptions.cs
|
using Microsoft.Owin.Security;
using SAML2.Config;
namespace Owin.Security.Saml
{
public class SamlAuthenticationOptions : AuthenticationOptions
{
public SamlAuthenticationOptions() : base("SAML2") {
Description = new AuthenticationDescription
{
AuthenticationType = "SAML2",
Caption = "Saml 2.0 Authentication protocol for OWIN"
};
MetadataPath = "/saml2/metadata";
}
public Saml2Configuration Configuration { get; set; }
public string MetadataPath { get; set; }
public SamlAuthenticationNotifications Notifications { get; set; }
}
}
|
using Microsoft.Owin.Security;
using SAML2.Config;
namespace Owin.Security.Saml
{
public class SamlAuthenticationOptions : AuthenticationOptions
{
public SamlAuthenticationOptions() : base("SAML2") {
Description = new AuthenticationDescription
{
AuthenticationType = "SAML2",
Caption = "Saml 2.0 Authentication protocol for OWIN"
};
MetadataPath = "/metadata";
}
public Saml2Configuration Configuration { get; set; }
public string MetadataPath { get; set; }
public SamlAuthenticationNotifications Notifications { get; set; }
}
}
|
mpl-2.0
|
C#
|
a43f8b68e7925220363f91565775cc8ed64e8d28
|
Add missing parentheses
|
smoogipooo/osu-framework,ppy/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework
|
osu.Framework/Development/ThreadSafety.cs
|
osu.Framework/Development/ThreadSafety.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Diagnostics;
using System.Threading;
using osu.Framework.Threading;
namespace osu.Framework.Development
{
internal static class ThreadSafety
{
internal static Thread SingleThreadThread;
[Conditional("DEBUG")]
internal static void EnsureUpdateThread() => Debug.Assert(IsUpdateThread);
[Conditional("DEBUG")]
internal static void EnsureNotUpdateThread() => Debug.Assert((SingleThreadThread != null && is_main_thread.Value) || !IsUpdateThread);
[Conditional("DEBUG")]
internal static void EnsureDrawThread() => Debug.Assert(IsDrawThread);
private static readonly ThreadLocal<bool> is_main_thread = new ThreadLocal<bool>(() =>
Thread.CurrentThread == SingleThreadThread);
private static readonly ThreadLocal<bool> is_update_thread = new ThreadLocal<bool>(() =>
Thread.CurrentThread.Name == GameThread.PrefixedThreadNameFor("Update"));
private static readonly ThreadLocal<bool> is_draw_thread = new ThreadLocal<bool>(() =>
Thread.CurrentThread.Name == GameThread.PrefixedThreadNameFor("Draw"));
private static readonly ThreadLocal<bool> is_audio_thread = new ThreadLocal<bool>(() =>
Thread.CurrentThread.Name == GameThread.PrefixedThreadNameFor("Audio"));
public static bool IsUpdateThread => (SingleThreadThread != null && is_main_thread.Value) || is_update_thread.Value;
public static bool IsDrawThread => (SingleThreadThread != null && is_main_thread.Value) || is_draw_thread.Value;
public static bool IsAudioThread => (SingleThreadThread != null && is_main_thread.Value) || is_audio_thread.Value;
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Diagnostics;
using System.Threading;
using osu.Framework.Threading;
namespace osu.Framework.Development
{
internal static class ThreadSafety
{
internal static Thread SingleThreadThread;
[Conditional("DEBUG")]
internal static void EnsureUpdateThread() => Debug.Assert(IsUpdateThread);
[Conditional("DEBUG")]
internal static void EnsureNotUpdateThread() => Debug.Assert(SingleThreadThread != null && is_main_thread.Value || !IsUpdateThread);
[Conditional("DEBUG")]
internal static void EnsureDrawThread() => Debug.Assert(IsDrawThread);
private static readonly ThreadLocal<bool> is_main_thread = new ThreadLocal<bool>(() =>
Thread.CurrentThread == SingleThreadThread);
private static readonly ThreadLocal<bool> is_update_thread = new ThreadLocal<bool>(() =>
Thread.CurrentThread.Name == GameThread.PrefixedThreadNameFor("Update"));
private static readonly ThreadLocal<bool> is_draw_thread = new ThreadLocal<bool>(() =>
Thread.CurrentThread.Name == GameThread.PrefixedThreadNameFor("Draw"));
private static readonly ThreadLocal<bool> is_audio_thread = new ThreadLocal<bool>(() =>
Thread.CurrentThread.Name == GameThread.PrefixedThreadNameFor("Audio"));
public static bool IsUpdateThread => (SingleThreadThread != null && is_main_thread.Value) || is_update_thread.Value;
public static bool IsDrawThread => (SingleThreadThread != null && is_main_thread.Value) || is_draw_thread.Value;
public static bool IsAudioThread => (SingleThreadThread != null && is_main_thread.Value) || is_audio_thread.Value;
}
}
|
mit
|
C#
|
141976a9fb18aaeaac854f6116957d2a635c899e
|
Change some intro settings property names
|
danielchalmers/DesktopWidgets
|
DesktopWidgets/Classes/IntroData.cs
|
DesktopWidgets/Classes/IntroData.cs
|
using System.ComponentModel;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
namespace DesktopWidgets.Classes
{
[ExpandableObject]
[DisplayName("Intro Settings")]
public class IntroData
{
[DisplayName("Duration")]
public int Duration { get; set; } = -1;
[DisplayName("Reversable")]
public bool Reversable { get; set; } = false;
[DisplayName("Activate")]
public bool Activate { get; set; } = false;
[DisplayName("Hide On End")]
public bool HideOnFinish { get; set; } = true;
[DisplayName("Trigger End Event")]
public bool ExecuteFinishAction { get; set; } = true;
}
}
|
using System.ComponentModel;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
namespace DesktopWidgets.Classes
{
[ExpandableObject]
[DisplayName("Intro Settings")]
public class IntroData
{
[DisplayName("Duration")]
public int Duration { get; set; } = -1;
[DisplayName("Reversable")]
public bool Reversable { get; set; } = false;
[DisplayName("Activate")]
public bool Activate { get; set; } = false;
[DisplayName("Hide On Finish")]
public bool HideOnFinish { get; set; } = true;
[DisplayName("Execute Finish Action")]
public bool ExecuteFinishAction { get; set; } = true;
}
}
|
apache-2.0
|
C#
|
1f1b067c096c4a3e56b3f2311c7756d46863909c
|
Test checkin
|
devedse/DeveImagePyramid
|
Devedse.DeveImagePyramid/Program.cs
|
Devedse.DeveImagePyramid/Program.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Devedse.DeveImagePyramid
{
class Program
{
static void Main(string[] args)
{
// BLAH BLAH TEST
var testImagePath = @"0_0.png";
var w = Stopwatch.StartNew();
for (int i = 0; i < 1000; i++)
{
var readImage = ImageReader.ReadImage(testImagePath);
}
w.Stop();
Console.WriteLine("Elapsed: " + w.Elapsed);
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Devedse.DeveImagePyramid
{
class Program
{
static void Main(string[] args)
{
var testImagePath = @"0_0.png";
var w = Stopwatch.StartNew();
for (int i = 0; i < 1000; i++)
{
var readImage = ImageReader.ReadImage(testImagePath);
}
w.Stop();
Console.WriteLine("Elapsed: " + w.Elapsed);
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
}
}
|
unlicense
|
C#
|
a69cb5a279b0d52ccea7a91eebb9805fd5ef5ee0
|
Update Copyright
|
dokan-dev/dokan-dotnet,dokan-dev/dokan-dotnet,magol/dokan-dotnet,dokan-dev/dokan-dotnet,viciousviper/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,magol/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,magol/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,viciousviper/dokan-dotnet,viciousviper/dokan-dotnet,jimmsta/dokan-dotnet
|
DokanNet/Properties/AssemblyInfo.cs
|
DokanNet/Properties/AssemblyInfo.cs
|
using System;
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("DokanNet")]
[assembly: AssemblyDescription(".NET wraper for dokan - user mode filesystem")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DokanNet")]
[assembly: AssemblyCopyright("Copyright (C) 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
[assembly: CLSCompliant(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("faf94eee-9bae-4ada-8f96-614ca17f7854")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
|
using System;
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("DokanNet")]
[assembly: AssemblyDescription(".NET wraper for dokan - user mode filesystem")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DokanNet")]
[assembly: AssemblyCopyright("Copyright (C) 2011")]
[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(true)]
[assembly: CLSCompliant(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("faf94eee-9bae-4ada-8f96-614ca17f7854")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
|
mit
|
C#
|
ee8e231517f7052a96812d3cd9b4c8a8ef62572d
|
Add property description
|
mattfrear/Swashbuckle.AspNetCore.Examples
|
test/WebApi2.0-Swashbuckle5/Models/PersonRequest.cs
|
test/WebApi2.0-Swashbuckle5/Models/PersonRequest.cs
|
using System.ComponentModel;
namespace WebApi.Models
{
public class PersonRequest
{
public Title Title { get; set; }
/// <summary>
/// The person's Age, in years
/// </summary>
public int Age { get; set; }
/// <summary>
/// The first name of the person
/// </summary>
public string FirstName { get; set; }
public decimal? Income { get; set; }
}
}
|
using System.ComponentModel;
namespace WebApi.Models
{
public class PersonRequest
{
public Title Title { get; set; }
public int Age { get; set; }
[Description("The first name of the person")]
public string FirstName { get; set; }
public decimal? Income { get; set; }
}
}
|
mit
|
C#
|
d9ea7878b54169f77a4b7e4b81315b214128c6bd
|
remove unused IDictionary.AddRange
|
Pondidum/Finite,Pondidum/Finite
|
Finite/Infrastructure/Extensions.cs
|
Finite/Infrastructure/Extensions.cs
|
using System;
using System.Collections.Generic;
namespace Finite.Infrastructure
{
public static class Extensions
{
public static void ForEach<T>(this IEnumerable<T> self, Action<T> action)
{
foreach (var item in self)
{
action(item);
}
}
}
}
|
using System;
using System.Collections.Generic;
namespace Finite.Infrastructure
{
public static class Extensions
{
public static void ForEach<T>(this IEnumerable<T> self, Action<T> action)
{
foreach (var item in self)
{
action(item);
}
}
public static void AddRange<TKey, TValue>(this IDictionary<TKey, TValue> self, IEnumerable<KeyValuePair<TKey, TValue>> items)
{
items.ForEach(self.Add);
}
}
}
|
lgpl-2.1
|
C#
|
e043f6587ec88aa0606f977dc25feaedd9c8725d
|
use command line arguments
|
capturePointer/inject-dll,carterjones/inject-dll,carterjones/inject-dll,capturePointer/inject-dll,capturePointer/inject-dll
|
InjectDLL/Program.cs
|
InjectDLL/Program.cs
|
namespace InjectDLL
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Nouzuru;
class Program
{
static void Main(string[] args)
{
DllInjector di = new DllInjector();
if (args.Length != 2)
{
Console.WriteLine(
"usage: " + System.AppDomain.CurrentDomain.FriendlyName +
" <process_image_name> <absolute_dll_path>");
return;
}
bool passedTests = true;
string procName = args[0];
string dllPath = args[1];
if (!di.Open(procName))
{
Console.WriteLine(
procName +
" could not be opened. Verify that it is currently running and that you have the correct " +
"permissions to open the process.");
passedTests = false;
}
if (!File.Exists(dllPath))
{
Console.WriteLine("The supplied DLL path does not exist.");
passedTests = false;
}
if (passedTests)
{
di.InjectDll(dllPath);
}
}
}
}
|
namespace InjectDLL
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nouzuru;
class Program
{
static void Main(string[] args)
{
DllInjector di = new DllInjector();
di.Open("calc");
string dllPath = @"..\hello-world-dll\hello-world-dll\x86-64\hello-world.dll";
di.InjectDll(dllPath);
Console.ReadKey();
}
}
}
|
bsd-2-clause
|
C#
|
f1441adb5749935957d1bd52cb29f24b80f3a364
|
Bump version to 14.6.0.31761
|
HearthSim/HearthDb
|
HearthDb/Properties/AssemblyInfo.cs
|
HearthDb/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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("14.6.0.31761")]
[assembly: AssemblyFileVersion("14.6.0.31761")]
|
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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("14.4.3.31532")]
[assembly: AssemblyFileVersion("14.4.3.31532")]
|
mit
|
C#
|
0306038658b2b36acabd28ba4e8fb5e40f91b10d
|
Return empty string for connectionId in some cases (#2470)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Microsoft.AspNetCore.SignalR.Client.Core/Internal/ConnectionLogScope.cs
|
src/Microsoft.AspNetCore.SignalR.Client.Core/Internal/ConnectionLogScope.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;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
namespace Microsoft.AspNetCore.SignalR.Client.Internal
{
internal class ConnectionLogScope : IReadOnlyList<KeyValuePair<string, object>>
{
// Name chosen so as not to collide with Kestrel's "ConnectionId"
private const string ClientConnectionIdKey = "ClientConnectionId";
private string _cachedToString;
private string _connectionId;
public string ConnectionId
{
get => _connectionId;
set
{
_cachedToString = null;
_connectionId = value;
}
}
public KeyValuePair<string, object> this[int index]
{
get
{
if (index == 0)
{
return new KeyValuePair<string, object>(ClientConnectionIdKey, ConnectionId);
}
throw new ArgumentOutOfRangeException(nameof(index));
}
}
public int Count => string.IsNullOrEmpty(ConnectionId) ? 0 : 1;
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
for (var i = 0; i < Count; ++i)
{
yield return this[i];
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public override string ToString()
{
if (_cachedToString == null)
{
if (!string.IsNullOrEmpty(ConnectionId))
{
_cachedToString = FormattableString.Invariant($"{ClientConnectionIdKey}:{ConnectionId}");
}
}
return _cachedToString ?? string.Empty;
}
}
}
|
// 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;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
namespace Microsoft.AspNetCore.SignalR.Client.Internal
{
internal class ConnectionLogScope : IReadOnlyList<KeyValuePair<string, object>>
{
// Name chosen so as not to collide with Kestrel's "ConnectionId"
private const string ClientConnectionIdKey = "ClientConnectionId";
private string _cachedToString;
private string _connectionId;
public string ConnectionId
{
get => _connectionId;
set
{
_cachedToString = null;
_connectionId = value;
}
}
public KeyValuePair<string, object> this[int index]
{
get
{
if (Count == 1 && index == 0)
{
return new KeyValuePair<string, object>(ClientConnectionIdKey, ConnectionId);
}
throw new ArgumentOutOfRangeException(nameof(index));
}
}
public int Count => string.IsNullOrEmpty(ConnectionId) ? 0 : 1;
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
for (var i = 0; i < Count; ++i)
{
yield return this[i];
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public override string ToString()
{
if (_cachedToString == null)
{
if (!string.IsNullOrEmpty(ConnectionId))
{
_cachedToString = FormattableString.Invariant($"{ClientConnectionIdKey}:{ConnectionId}");
}
}
return _cachedToString ?? string.Empty;
}
}
}
|
apache-2.0
|
C#
|
a856ef93cd03d19aba49344b1f76e1042e01a951
|
update Routing in admin
|
csyntax/BlogSystem
|
Source/BlogSystem.Web/Areas/Administration/AdministrationAreaRegistration.cs
|
Source/BlogSystem.Web/Areas/Administration/AdministrationAreaRegistration.cs
|
namespace BlogSystem.Web.Areas.Administration
{
using System.Web.Mvc;
public class AdministrationAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Administration";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
name: "Administration_Default",
url: "Administration/{controller}/{action}/{id}",
defaults: new
{
action = "Index",
id = UrlParameter.Optional
},
namespaces: new[]
{
"BlogSystem.Web.Areas.Administration.Controllers"
});
}
}
}
|
namespace BlogSystem.Web.Areas.Administration
{
using System.Web.Mvc;
public class AdministrationAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Administration";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
name: "Administration_Default",
url: "Administration/{controller}/{action}/{id}",
defaults: new
{
action = "Index",
controller = "Home",
id = UrlParameter.Optional
},
namespaces: new[]
{
"BlogSystem.Web.Areas.Administration.Controllers"
});
}
}
}
|
mit
|
C#
|
8bebab1f944c80be7102c1633393a4ec2e7d93be
|
Fix the XML comment for LocalizableString
|
abdllhbyrktr/aspnetboilerplate,Nongzhsh/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,zquans/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,jaq316/aspnetboilerplate,zclmoon/aspnetboilerplate,ZhaoRd/aspnetboilerplate,ShiningRush/aspnetboilerplate,Nongzhsh/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ShiningRush/aspnetboilerplate,Nongzhsh/aspnetboilerplate,virtualcca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,carldai0106/aspnetboilerplate,virtualcca/aspnetboilerplate,andmattia/aspnetboilerplate,berdankoca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,AlexGeller/aspnetboilerplate,s-takatsu/aspnetboilerplate,beratcarsi/aspnetboilerplate,beratcarsi/aspnetboilerplate,luchaoshuai/aspnetboilerplate,verdentk/aspnetboilerplate,fengyeju/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,ilyhacker/aspnetboilerplate,oceanho/aspnetboilerplate,s-takatsu/aspnetboilerplate,s-takatsu/aspnetboilerplate,yuzukwok/aspnetboilerplate,ShiningRush/aspnetboilerplate,jaq316/aspnetboilerplate,verdentk/aspnetboilerplate,zclmoon/aspnetboilerplate,andmattia/aspnetboilerplate,oceanho/aspnetboilerplate,carldai0106/aspnetboilerplate,yuzukwok/aspnetboilerplate,carldai0106/aspnetboilerplate,jaq316/aspnetboilerplate,zclmoon/aspnetboilerplate,ZhaoRd/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,AlexGeller/aspnetboilerplate,andmattia/aspnetboilerplate,zquans/aspnetboilerplate,fengyeju/aspnetboilerplate,AlexGeller/aspnetboilerplate,ZhaoRd/aspnetboilerplate,oceanho/aspnetboilerplate,yuzukwok/aspnetboilerplate,verdentk/aspnetboilerplate,fengyeju/aspnetboilerplate,ryancyq/aspnetboilerplate,beratcarsi/aspnetboilerplate,zquans/aspnetboilerplate,carldai0106/aspnetboilerplate,virtualcca/aspnetboilerplate,berdankoca/aspnetboilerplate,berdankoca/aspnetboilerplate
|
src/Abp/Localization/LocalizableString.cs
|
src/Abp/Localization/LocalizableString.cs
|
using System;
using System.Globalization;
namespace Abp.Localization
{
/// <summary>
/// Represents a string that can be localized.
/// </summary>
[Serializable]
public class LocalizableString : ILocalizableString
{
/// <summary>
/// Unique name of the localization source.
/// </summary>
public virtual string SourceName { get; private set; }
/// <summary>
/// Unique Name of the string to be localized.
/// </summary>
public virtual string Name { get; private set; }
/// <summary>
/// Needed for serialization.
/// </summary>
private LocalizableString()
{
}
/// <param name="name">Unique Name of the string to be localized</param>
/// <param name="sourceName">Unique name of the localization source</param>
public LocalizableString(string name, string sourceName)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (sourceName == null)
{
throw new ArgumentNullException("sourceName");
}
Name = name;
SourceName = sourceName;
}
public string Localize(ILocalizationContext context)
{
return context.LocalizationManager.GetString(SourceName, Name);
}
public string Localize(ILocalizationContext context, CultureInfo culture)
{
return context.LocalizationManager.GetString(SourceName, Name, culture);
}
public override string ToString()
{
return string.Format("[LocalizableString: {0}, {1}]", Name, SourceName);
}
}
}
|
using System;
using System.Globalization;
namespace Abp.Localization
{
/// <summary>
/// Represents a string that can be localized.
/// </summary>
[Serializable]
public class LocalizableString : ILocalizableString
{
/// <summary>
/// Unique name of the localization source.
/// </summary>
public virtual string SourceName { get; private set; }
/// <summary>
/// Unique Name of the string to be localized.
/// </summary>
public virtual string Name { get; private set; }
/// <summary>
/// Needed for serialization.
/// </summary>
private LocalizableString()
{
}
/// <param name="name">Unique name of the localization source</param>
/// <param name="sourceName">Unique Name of the string to be localized</param>
public LocalizableString(string name, string sourceName)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (sourceName == null)
{
throw new ArgumentNullException("sourceName");
}
Name = name;
SourceName = sourceName;
}
public string Localize(ILocalizationContext context)
{
return context.LocalizationManager.GetString(SourceName, Name);
}
public string Localize(ILocalizationContext context, CultureInfo culture)
{
return context.LocalizationManager.GetString(SourceName, Name, culture);
}
public override string ToString()
{
return string.Format("[LocalizableString: {0}, {1}]", Name, SourceName);
}
}
}
|
mit
|
C#
|
3530ba6109fc6a4c380154e04c712b6aa32d8ec1
|
Update HtmlSanitizerOptions.cs
|
mganss/HtmlSanitizer
|
src/HtmlSanitizer/HtmlSanitizerOptions.cs
|
src/HtmlSanitizer/HtmlSanitizerOptions.cs
|
using AngleSharp.Css.Dom;
using System;
using System.Collections.Generic;
namespace Ganss.XSS
{
/// <summary>
/// Provides options to be used with <see cref="HtmlSanitizer"/>.
/// </summary>
public class HtmlSanitizerOptions
{
/// <summary>
/// Gets or sets the allowed tag names such as "a" and "div".
/// </summary>
public ISet<string> AllowedTags { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed HTML attributes such as "href" and "alt".
/// </summary>
public ISet<string> AllowedAttributes { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed CSS classes.
/// </summary>
public ISet<string> AllowedCssClasses { get; set; } = new HashSet<string>();
/// <summary>
/// Gets or sets the allowed CSS properties such as "font" and "margin".
/// </summary>
public ISet<string> AllowedCssProperties { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed CSS at-rules such as "@media" and "@font-face".
/// </summary>
public ISet<CssRuleType> AllowedAtRules { get; set; } = new HashSet<CssRuleType>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed URI schemes such as "http" and "https".
/// </summary>
public ISet<string> AllowedSchemes { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the HTML attributes that can contain a URI such as "href".
/// </summary>
public ISet<string> UriAttributes { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
}
}
|
using AngleSharp.Css.Dom;
using System;
using System.Collections.Generic;
namespace Ganss.XSS
{
/// <summary>
/// Provides options to be used with <see cref="HtmlSanitizer"/>.
/// </summary>
public class HtmlSanitizerOptions
{
/// <summary>
/// Gets or sets the allowed tag names such as "a" and "div".
/// </summary>
public ISet<string> AllowedTags { get; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed HTML attributes such as "href" and "alt".
/// </summary>
public ISet<string> AllowedAttributes { get; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed CSS classes.
/// </summary>
public ISet<string> AllowedCssClasses { get; init; } = new HashSet<string>();
/// <summary>
/// Gets or sets the allowed CSS properties such as "font" and "margin".
/// </summary>
public ISet<string> AllowedCssProperties { get; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed CSS at-rules such as "@media" and "@font-face".
/// </summary>
public ISet<CssRuleType> AllowedAtRules { get; init; } = new HashSet<CssRuleType>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the allowed URI schemes such as "http" and "https".
/// </summary>
public ISet<string> AllowedSchemes { get; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets or sets the HTML attributes that can contain a URI such as "href".
/// </summary>
public ISet<string> UriAttributes { get; init; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
}
}
|
mit
|
C#
|
f6e541d616f884d0458883c8a70c716b9c69133f
|
Update permissions based on GitHub documentation (#2424)
|
octokit/octokit.net,octokit/octokit.net
|
Octokit/Models/Request/Permission.cs
|
Octokit/Models/Request/Permission.cs
|
using System.Diagnostics.CodeAnalysis;
using Octokit.Internal;
namespace Octokit
{
/// <summary>
/// Used to describe a permission level.
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
public enum Permission
{
/// <summary>
/// team members can pull, push and administer these repositories.
/// </summary>
[Parameter(Value = "admin")]
Admin,
/// <summary>
/// team members can manage the repository without access to sensitive or destructive actions. Recommended for project managers. Only applies to repositories owned by organizations.
/// </summary>
[Parameter(Value = "maintain")]
Maintain,
/// <summary>
/// team members can proactively manage issues and pull requests without write access. Recommended for contributors who triage a repository. Only applies to repositories owned by organizations.
/// </summary>
[Parameter(Value = "triage")]
Triage,
/// <summary>
/// team members can pull and push, but not administer these repositories
/// </summary>
[Parameter(Value = "push")]
Push,
/// <summary>
/// team members can pull, but not push to or administer these repositories
/// </summary>
[Parameter(Value = "pull")]
Pull
}
}
|
using System.Diagnostics.CodeAnalysis;
using Octokit.Internal;
namespace Octokit
{
/// <summary>
/// Used to describe a permission level.
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
public enum Permission
{
/// <summary>
/// team members can pull, push and administer these repositories.
/// </summary>
[Parameter(Value = "admin")]
Admin,
/// <summary>
/// team members can pull and push, but not administer these repositories
/// </summary>
[Parameter(Value = "push")]
Push,
/// <summary>
/// team members can pull, but not push to or administer these repositories
/// </summary>
[Parameter(Value = "pull")]
Pull
}
}
|
mit
|
C#
|
4d6744d48655b6063f831fc3c5e16d8f1d3296d1
|
Replace rules cache needs to be board-based since custom BBCode can vary as well as options (possibly in the future).
|
YAFNET/YAFNET,Pathfinder-Fr/YAFNET,YAFNET/YAFNET,YAFNET/YAFNET,Pathfinder-Fr/YAFNET,YAFNET/YAFNET,moorehojer/YAFNET,moorehojer/YAFNET,Pathfinder-Fr/YAFNET,mexxanit/YAFNET,mexxanit/YAFNET,moorehojer/YAFNET,mexxanit/YAFNET
|
yafsrc/YAF.Classes/YAF.Classes.UI/ReplaceRulesCreator.cs
|
yafsrc/YAF.Classes/YAF.Classes.UI/ReplaceRulesCreator.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using YAF.Classes.Data;
using YAF.Classes.Utils;
namespace YAF.Classes.UI
{
/// <summary>
/// Gets an instance of replace rules and uses
/// caching if possible.
/// </summary>
public static class ReplaceRulesCreator
{
/// <summary>
/// Gets relace rules instance for given flags.
/// </summary>
/// <param name="uniqueFlags">Flags identifying replace rules.</param>
/// <returns>ReplaceRules for given unique flags.</returns>
public static ReplaceRules GetInstance(bool[] uniqueFlags)
{
// convert flags to integer
int rulesFlags = FlagsBase.GetIntFromBoolArray(uniqueFlags);
// cache is board-specific since boards may have different custom BB Code...
string key = YafCache.GetBoardCacheKey( String.Format(Constants.Cache.ReplaceRules, rulesFlags) );
// try to get rules from the cache
ReplaceRules rules = YafCache.Current[key] as ReplaceRules;
if (rules == null)
{
// doesn't exist, create a new instance class...
rules = new ReplaceRules();
// cache this value
YafCache.Current.Add(key, rules, null, DateTime.Now.AddMinutes(YafContext.Current.BoardSettings.ReplaceRulesCacheTimeout), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Default, null);
}
return rules;
}
/// <summary>
/// Clears all ReplaceRules from the cache.
/// </summary>
public static void ClearCache()
{
// match starting part of cache key
string match = String.Format(Constants.Cache.ReplaceRules, "");
// remove it entries from cache
YafCache.Current.Remove
(
delegate(string key)
{
return key.StartsWith(match);
}
);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using YAF.Classes.Data;
using YAF.Classes.Utils;
namespace YAF.Classes.UI
{
/// <summary>
/// Gets an instance of replace rules and uses
/// caching if possible.
/// </summary>
public static class ReplaceRulesCreator
{
/// <summary>
/// Gets relace rules instance for given flags.
/// </summary>
/// <param name="uniqueFlags">Flags identifying replace rules.</param>
/// <returns>ReplaceRules for given unique flags.</returns>
public static ReplaceRules GetInstance(bool[] uniqueFlags)
{
// convert flags to integer
int rulesFlags = FlagsBase.GetIntFromBoolArray(uniqueFlags);
// not using board-specific key since this type of cached item is NOT board-specific
string key = String.Format(Constants.Cache.ReplaceRules, rulesFlags);
// try to get rules from the cache
ReplaceRules rules = YafCache.Current[key] as ReplaceRules;
if (rules == null)
{
// doesn't exist, create a new instance class...
rules = new ReplaceRules();
// cache this value
YafCache.Current.Add(key, rules, null, DateTime.Now.AddMinutes(YafContext.Current.BoardSettings.ReplaceRulesCacheTimeout), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Default, null);
}
return rules;
}
/// <summary>
/// Clears all ReplaceRules from the cache.
/// </summary>
public static void ClearCache()
{
// match starting part of cache key
string match = String.Format(Constants.Cache.ReplaceRules, "");
// remove it entries from cache
YafCache.Current.Remove
(
delegate(string key)
{
return key.StartsWith(match);
}
);
}
}
}
|
apache-2.0
|
C#
|
324b2750a9e5382a0af498138acef0ffc87d5ef1
|
Test for super class now reflect that super class methods are iterated
|
thefuntastic/Unity3d-Finite-State-Machine,thefuntastic/Unity3d-Finite-State-Machine
|
example_project/Assets/Editor/MonsterLove/Tests/TestDerivedFromSuperClass.cs
|
example_project/Assets/Editor/MonsterLove/Tests/TestDerivedFromSuperClass.cs
|
using System;
using MonsterLove.StateMachine;
using NUnit.Framework;
using UnityEngine;
using UnityEditor;
using System.Collections;
using Object = UnityEngine.Object;
[TestFixture]
[Category("State Machine Tests")]
internal class TestDerivedFromSuperClass
{
public enum States
{
One,
Two,
Three,
}
private GameObject go;
private ClassWithBasicStates behaviour;
private StateMachineRunner engine;
private StateMachine<States> fsm;
[SetUp]
public void Init()
{
go = new GameObject("stateTest");
behaviour = go.AddComponent<ClassDerivedFromSuperClass>();
engine = go.AddComponent<StateMachineRunner>();
}
[TearDown]
public void Kill()
{
Object.DestroyImmediate(go);
}
[Test]
public void InitialTransition()
{
fsm = engine.Initialize<States>(behaviour, States.One);
fsm.ChangeState(States.Two);
//Test for when we want to include superclass methods
Assert.AreEqual(1, behaviour.oneStats.enterCount);
Assert.AreEqual(0, behaviour.oneStats.updateCount);
Assert.AreEqual(0, behaviour.oneStats.lateUpdateCount);
Assert.AreEqual(1, behaviour.oneStats.exitCount);
Assert.AreEqual(1, behaviour.oneStats.finallyCount);
Assert.AreEqual(1, behaviour.twoStats.enterCount);
Assert.AreEqual(0, behaviour.twoStats.updateCount);
Assert.AreEqual(0, behaviour.twoStats.lateUpdateCount);
Assert.AreEqual(0, behaviour.twoStats.exitCount);
Assert.AreEqual(0, behaviour.twoStats.finallyCount);
}
}
|
using System;
using MonsterLove.StateMachine;
using NUnit.Framework;
using UnityEngine;
using UnityEditor;
using System.Collections;
using Object = UnityEngine.Object;
[TestFixture]
[Category("State Machine Tests")]
internal class TestDerivedFromSuperClass
{
public enum States
{
One,
Two,
Three,
}
private GameObject go;
private ClassWithBasicStates behaviour;
private StateMachineRunner engine;
private StateMachine<States> fsm;
[SetUp]
public void Init()
{
go = new GameObject("stateTest");
behaviour = go.AddComponent<ClassDerivedFromSuperClass>();
engine = go.AddComponent<StateMachineRunner>();
}
[TearDown]
public void Kill()
{
Object.DestroyImmediate(go);
}
[Test]
public void InitialTransition()
{
//This is an odd request by a user, where they wanted to use methods declared in a super class. By default we expect this to fail, but we can enable this behaivour
//by removing BindingFlags.DeclaredOnly from the reflection routine in StateMachine.cs
fsm = engine.Initialize<States>(behaviour, States.One);
fsm.ChangeState(States.Two);
//Test for when we want to include superclass methods
//Assert.AreEqual(1, behaviour.oneStats.enterCount);
//Assert.AreEqual(0, behaviour.oneStats.updateCount);
//Assert.AreEqual(0, behaviour.oneStats.lateUpdateCount);
//Assert.AreEqual(1, behaviour.oneStats.exitCount);
//Assert.AreEqual(1, behaviour.oneStats.finallyCount);
//Assert.AreEqual(1, behaviour.twoStats.enterCount);
//Assert.AreEqual(0, behaviour.twoStats.updateCount);
//Assert.AreEqual(0, behaviour.twoStats.lateUpdateCount);
//Assert.AreEqual(0, behaviour.twoStats.exitCount);
//Assert.AreEqual(0, behaviour.twoStats.finallyCount);
//Test for no superclass methods
Assert.AreEqual(0, behaviour.oneStats.enterCount);
Assert.AreEqual(0, behaviour.oneStats.updateCount);
Assert.AreEqual(0, behaviour.oneStats.lateUpdateCount);
Assert.AreEqual(0, behaviour.oneStats.exitCount);
Assert.AreEqual(0, behaviour.oneStats.finallyCount);
Assert.AreEqual(0, behaviour.twoStats.enterCount);
Assert.AreEqual(0, behaviour.twoStats.updateCount);
Assert.AreEqual(0, behaviour.twoStats.lateUpdateCount);
Assert.AreEqual(0, behaviour.twoStats.exitCount);
Assert.AreEqual(0, behaviour.twoStats.finallyCount);
}
}
|
mit
|
C#
|
f3e533f2e33469fc917cac290ae7b41d459345aa
|
Use timer rather than blocking sleep
|
wbsimms/SignalRDemo,wbsimms/SignalRDemo
|
SignalRDemo/SignalRDemo/Hubs/Chat.cs
|
SignalRDemo/SignalRDemo/Hubs/Chat.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Timers;
using System.Web;
using Microsoft.AspNet.SignalR;
using Timer = System.Timers.Timer;
namespace SignalRDemo.Hubs
{
public class Chat : Hub
{
static string messageToSend = DateTime.Now.ToString();
Timer t = new Timer(500);
public void SayHello()
{
t.Elapsed +=t_Elapsed;
t.Start();
}
private void t_Elapsed(object sender, ElapsedEventArgs e)
{
Clients.All.addMessage("Date time : " + messageToSend);
messageToSend = DateTime.Now.ToString();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using Microsoft.AspNet.SignalR;
namespace SignalRDemo.Hubs
{
public class Chat : Hub
{
public void SayHello()
{
while (true)
{
Clients.All.addMessage("Date time : "+DateTime.Now);
Thread.Sleep(500);
}
}
}
}
|
apache-2.0
|
C#
|
34954000008e8e663bde584fd7ad55608cd03436
|
Switch to not serialize the full embed object
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
Battery-Commander.Web/Controllers/API/EmbedsController.cs
|
Battery-Commander.Web/Controllers/API/EmbedsController.cs
|
using BatteryCommander.Web.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Controllers.API
{
public class EmbedsController : ApiController
{
public EmbedsController(Database db) : base(db)
{
// Nothing to do here
}
[HttpGet]
public async Task<IEnumerable<dynamic>> List()
{
return
await db
.Embeds
.Select(embed => new
{
embed.Id,
embed.UnitId,
embed.Name,
embed.Route,
embed.Source
})
.ToListAsync();
}
[HttpPost]
public async Task<IActionResult> Create([FromBody]Embed embed)
{
db.Embeds.Add(embed);
await db.SaveChangesAsync();
return Ok();
}
[HttpDelete("{id}")]
public async Task<IActionResult> Delete(int id)
{
var embed = await db.Embeds.SingleOrDefaultAsync(_ => _.Id == id);
db.Embeds.Remove(embed);
await db.SaveChangesAsync();
return Ok();
}
}
}
|
using BatteryCommander.Web.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Controllers.API
{
public class EmbedsController : ApiController
{
public EmbedsController(Database db) : base(db)
{
// Nothing to do here
}
[HttpGet]
public IEnumerable<Embed> List()
{
return db.Embeds.ToList();
}
[HttpPost]
public async Task<IActionResult> Create([FromBody]Embed embed)
{
db.Embeds.Add(embed);
await db.SaveChangesAsync();
return Ok();
}
[HttpDelete("{id}")]
public async Task<IActionResult> Delete(int id)
{
var embed = await db.Embeds.SingleOrDefaultAsync(_ => _.Id == id);
db.Embeds.Remove(embed);
await db.SaveChangesAsync();
return Ok();
}
}
}
|
mit
|
C#
|
ba4f89dee1f9501d5ea77bec6341f131c637061e
|
Add horizontal lines.
|
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
|
MitternachtWeb/Areas/Guild/Views/Shared/_GuildLayout.cshtml
|
MitternachtWeb/Areas/Guild/Views/Shared/_GuildLayout.cshtml
|
@{
Layout = "_Layout";
ViewData["Title"] = "Guild";
}
<div class="row">
<nav class="col-md-3 col-xl-2">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Stats" asp-action="Index">Statistiken</a>
</li>
@if(ViewBag.PermissionReadQuotes || ViewBag.PermissionReadVerifications) {
<li><hr /></li>
}
@if(ViewBag.PermissionReadQuotes) {
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Quotes" asp-action="Index">Quotes</a>
</li>
}
@if(ViewBag.PermissionReadVerifications) {
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Verifications" asp-action="Index">Verifications</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Verifications" asp-action="UnverifiedUsers">Nicht-verifizierte Nutzer</a>
</li>
}
@if(ViewBag.PermissionReadMutes || ViewBag.PermissionReadWarns) {
<li><hr /></li>
}
@if(ViewBag.PermissionReadMutes) {
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Mutes" asp-action="Index">Mutes</a>
</li>
}
@if(ViewBag.PermissionReadWarns) {
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Warns" asp-action="Index">Warns</a>
</li>
}
@if(ViewBag.PermissionReadGuildConfig) {
<li><hr /></li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="GuildConfig" asp-action="Index">GuildConfig</a>
</li>
}
</ul>
</nav>
<div class="col-md-9 col-xl-10 py-md-3 pl-md-5">
<div>
<h3>
Server "@ViewBag.Guild.Name" (ID @ViewBag.GuildId)
</h3>
</div>
<div>
@RenderBody()
</div>
</div>
</div>
|
@{
Layout = "_Layout";
ViewData["Title"] = "Guild";
}
<div class="row">
<nav class="col-md-3 col-xl-2">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Stats" asp-action="Index">Statistiken</a>
</li>
@if(ViewBag.PermissionReadQuotes) {
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Quotes" asp-action="Index">Quotes</a>
</li>
}
@if(ViewBag.PermissionReadVerifications) {
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Verifications" asp-action="Index">Verifications</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Verifications" asp-action="UnverifiedUsers">Nicht-verifizierte Nutzer</a>
</li>
}
@if(ViewBag.PermissionReadMutes) {
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Mutes" asp-action="Index">Mutes</a>
</li>
}
@if(ViewBag.PermissionReadWarns) {
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="Warns" asp-action="Index">Warns</a>
</li>
}
@if(ViewBag.PermissionReadGuildConfig) {
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Guild" asp-controller="GuildConfig" asp-action="Index">GuildConfig</a>
</li>
}
</ul>
</nav>
<div class="col-md-9 col-xl-10 py-md-3 pl-md-5">
<div>
<h3>
Server "@ViewBag.Guild.Name" (ID @ViewBag.GuildId)
</h3>
</div>
<div>
@RenderBody()
</div>
</div>
</div>
|
mit
|
C#
|
1d06a0ac9ae4ff123209206e83389a23650df07a
|
Add a 5% chance for attacks to be critical hits, which ignore defense.
|
pjk21/roguelikedev-does-the-complete-roguelike-tutorial
|
Roguelike/Roguelike/Entities/Components/FighterComponent.cs
|
Roguelike/Roguelike/Entities/Components/FighterComponent.cs
|
using Roguelike.UI;
using System;
namespace Roguelike.Entities.Components
{
public class FighterComponent : Component
{
public const float CriticalHitChance = 0.05f;
public int MaximumHealth { get; set; }
public int CurrentHealth { get; set; }
public int Power { get; set; }
public int Defense { get; set; }
public Action<Entity> DeathFunction { get; set; }
public void Damage(int amount)
{
CurrentHealth -= amount;
if (CurrentHealth <= 0)
{
DeathFunction?.Invoke(Entity);
}
}
public void Attack(Entity target)
{
if (target.GetComponent<FighterComponent>() == null)
{
return;
}
int damage = 0;
if (Program.Random.NextDouble() < CriticalHitChance)
{
damage = Power;
}
else
{
damage = Power - target.GetComponent<FighterComponent>().Defense;
}
if (damage > 0)
{
MessageLog.Add($"{Entity.Name} attacks {target.Name} for {damage} HP.");
target.GetComponent<FighterComponent>().Damage(damage);
}
else
{
MessageLog.Add($"{Entity.Name} attacks {target.Name} but it has no effect!");
}
}
}
}
|
using Roguelike.UI;
using System;
namespace Roguelike.Entities.Components
{
public class FighterComponent : Component
{
public int MaximumHealth { get; set; }
public int CurrentHealth { get; set; }
public int Power { get; set; }
public int Defense { get; set; }
public Action<Entity> DeathFunction { get; set; }
public void Damage(int amount)
{
CurrentHealth -= amount;
if (CurrentHealth <= 0)
{
DeathFunction?.Invoke(Entity);
}
}
public void Attack(Entity target)
{
if (target.GetComponent<FighterComponent>() == null)
{
return;
}
var damage = Power - target.GetComponent<FighterComponent>().Defense;
if (damage > 0)
{
MessageLog.Add($"{Entity.Name} attacks {target.Name} for {damage} HP.");
target.GetComponent<FighterComponent>().Damage(damage);
}
else
{
MessageLog.Add($"{Entity.Name} attacks {target.Name} but it has no effect!");
}
}
}
}
|
mit
|
C#
|
95c195b8dadd5de94ca9dcb7d90fd56d9d4f2b29
|
Bump version to 1.5.0
|
milkshakesoftware/PreMailer.Net,kendallb/PreMailer.Net
|
PreMailer.Net/GlobalAssemblyInfo.cs
|
PreMailer.Net/GlobalAssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AssemblyProduct("PreMailer.Net")]
[assembly: AssemblyCompany("Milkshake Software")]
[assembly: AssemblyCopyright("Copyright © Milkshake Software 2016")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AssemblyProduct("PreMailer.Net")]
[assembly: AssemblyCompany("Milkshake Software")]
[assembly: AssemblyCopyright("Copyright © Milkshake Software 2015")]
[assembly: AssemblyVersion("1.4.3.0")]
[assembly: AssemblyFileVersion("1.4.3.0")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
|
mit
|
C#
|
58025b2f5c514ea2925336f174a683a573d4df55
|
Change model and EF errors with schema change
|
johnproctor/EFMigrations
|
CodeFirstMigrations/Address.cs
|
CodeFirstMigrations/Address.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeFirstMigrations
{
public class Address
{
public Int32 Id { get; set; }
public Int32 HouseNumber { get; set; }
public String Street { get; set; }
public String City { get; set; }
public String Postcode { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeFirstMigrations
{
public class Address
{
public Int32 Id { get; set; }
public Int32 HouseNumber { get; set; }
public String Street { get; set; }
public String City { get; set; }
}
}
|
mit
|
C#
|
83279158ddfc52d06758a4219c8a126e0ff56a51
|
Add support for receiving a string
|
fpanettieri/unity-socket.io,fpanettieri/unity-socket.io-DEPRECATED,Joncom/unity-socket.io
|
SocketIO/Scripts/SocketIO/Parser.cs
|
SocketIO/Scripts/SocketIO/Parser.cs
|
#region License
/*
* Parser.cs
*
* The MIT License
*
* Copyright (c) 2014 Fabio Panettieri
*
* 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
using UnityEngine;
namespace SocketIO
{
public class Parser
{
public SocketIOEvent Parse(JSONObject json)
{
if (json.Count < 1 || json.Count > 2) {
throw new SocketIOException("Invalid number of parameters received: " + json.Count);
}
if (json[0].type != JSONObject.Type.STRING) {
throw new SocketIOException("Invalid parameter type. " + json[0].type + " received while expecting " + JSONObject.Type.STRING);
}
if (json.Count == 1) {
return new SocketIOEvent(json[0].str);
}
if (json[1].type == JSONObject.Type.OBJECT || json[1].type == JSONObject.Type.STRING) {
return new SocketIOEvent(json[0].str, json[1]);
} else {
throw new SocketIOException("Invalid argument type. " + json[1].type + " received");
}
}
}
}
|
#region License
/*
* Parser.cs
*
* The MIT License
*
* Copyright (c) 2014 Fabio Panettieri
*
* 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
using UnityEngine;
namespace SocketIO
{
public class Parser
{
public SocketIOEvent Parse(JSONObject json)
{
if (json.Count < 1 || json.Count > 2) {
throw new SocketIOException("Invalid number of parameters received: " + json.Count);
}
if (json[0].type != JSONObject.Type.STRING) {
throw new SocketIOException("Invalid parameter type. " + json[0].type + " received while expecting " + JSONObject.Type.STRING);
}
if (json.Count == 1) {
return new SocketIOEvent(json[0].str);
}
if (json[1].type != JSONObject.Type.OBJECT) {
throw new SocketIOException("Invalid argument type. " + json[1].type + " received while expecting " + JSONObject.Type.OBJECT);
}
return new SocketIOEvent(json[0].str, json[1]);
}
}
}
|
mit
|
C#
|
f40ba489e88a2b74afa52b148182aadac25b1c69
|
Fix for startup.cs
|
makingsensetraining/angular-webapi,makingsensetraining/angular-webapi,makingsensetraining/angular-webapi
|
Source/Hiperion/Hiperion/Startup.cs
|
Source/Hiperion/Hiperion/Startup.cs
|
#region References
using Hiperion;
using Microsoft.Owin;
#endregion
[assembly: OwinStartup(typeof (Startup))]
namespace Hiperion
{
#region References
using System;
using System.Data.Entity;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
using Castle.Windsor;
using Infrastructure.EF;
using Microsoft.Owin.Cors;
using Microsoft.Owin.Security.OAuth;
using Owin;
using Services.Interfaces;
#endregion
public class Startup
{
private static IWindsorContainer _container;
public IWindsorContainer Container
{
get { return _container; }
}
public void Configuration(IAppBuilder app)
{
_container = Bootstrapper.InitializeContainer();
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
var config = new HttpConfiguration();
ConfigureOAuth(app);
WebApiConfig.Register(config);
app.UseCors(CorsOptions.AllowAll);
app.UseWebApi(config);
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<HiperionDbContext>());
}
public void ConfigureOAuth(IAppBuilder app)
{
var userServices = _container.Resolve<IUserServices>();
var OAuthServerOptions = new OAuthAuthorizationServerOptions
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/login"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
Provider = new SimpleAuthorizationServerProvider(userServices)
};
// Token Generation
app.UseOAuthAuthorizationServer(OAuthServerOptions);
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
}
}
}
|
using Castle.Windsor;
using Hiperion.Infrastructure.EF;
using Hiperion.Services.Interfaces;
using Microsoft.Owin;
using Microsoft.Owin.Cors;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.OAuth;
using Owin;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Http;
[assembly: OwinStartup(typeof(Hiperion.Startup))]
namespace Hiperion
{
public class Startup
{
private static IWindsorContainer _container;
public IWindsorContainer Container
{
get { return _container; }
}
public void Configuration(IAppBuilder app)
{
_container = Bootstrapper.InitializeContainer();
HttpConfiguration config = new HttpConfiguration();
ConfigureOAuth(app);
WebApiConfig.Register(config);
app.UseCors(CorsOptions.AllowAll);
app.UseWebApi(config);
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<HiperionDbContext>());
}
public void ConfigureOAuth(IAppBuilder app)
{
IUserServices userServices = _container.Resolve<IUserServices>();
OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/login"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
Provider = new SimpleAuthorizationServerProvider(userServices)
};
// Token Generation
app.UseOAuthAuthorizationServer(OAuthServerOptions);
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
}
}
}
|
mit
|
C#
|
b143d6cce07dae609f6a9dccd43beb0344291ab0
|
add checks around dns stuff
|
cvent/Metrics.NET,Liwoj/Metrics.NET,ntent-ad/Metrics.NET,DeonHeyns/Metrics.NET,alhardy/Metrics.NET,mnadel/Metrics.NET,Recognos/Metrics.NET,ntent-ad/Metrics.NET,Recognos/Metrics.NET,etishor/Metrics.NET,huoxudong125/Metrics.NET,Liwoj/Metrics.NET,huoxudong125/Metrics.NET,mnadel/Metrics.NET,MetaG8/Metrics.NET,DeonHeyns/Metrics.NET,alhardy/Metrics.NET,cvent/Metrics.NET,MetaG8/Metrics.NET,etishor/Metrics.NET,MetaG8/Metrics.NET
|
Src/Metrics/Utils/AppEnvironment.cs
|
Src/Metrics/Utils/AppEnvironment.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using Metrics.MetricData;
using Metrics.Logging;
namespace Metrics.Utils
{
public static class AppEnvironment
{
private static readonly ILog log = LogProvider.GetCurrentClassLogger();
public static IEnumerable<EnvironmentEntry> Current
{
get
{
yield return new EnvironmentEntry("MachineName", Environment.MachineName);
yield return new EnvironmentEntry("DomainName", Environment.UserDomainName);
yield return new EnvironmentEntry("UserName", Environment.UserName);
yield return new EnvironmentEntry("ProcessName", SafeGetString(() => Process.GetCurrentProcess().ProcessName));
yield return new EnvironmentEntry("OSVersion", Environment.OSVersion.ToString());
yield return new EnvironmentEntry("CPUCount", Environment.ProcessorCount.ToString());
yield return new EnvironmentEntry("CommandLine", Environment.CommandLine);
yield return new EnvironmentEntry("HostName", SafeGetString(() => Dns.GetHostName()));
yield return new EnvironmentEntry("IPAddress", SafeGetString(() => GetIpAddress()));
yield return new EnvironmentEntry("LocalTime", Clock.FormatTimestamp(DateTime.Now));
}
}
private static string GetIpAddress()
{
string hostName = SafeGetString(() => Dns.GetHostName ());
try
{
var ipAddress = Dns.GetHostEntry(hostName)
.AddressList
.FirstOrDefault (ip => ip.AddressFamily == AddressFamily.InterNetwork);
if (ipAddress != null)
{
return ipAddress.ToString();
}
return string.Empty;
}
catch (SocketException x)
{
if (x.SocketErrorCode == SocketError.HostNotFound)
{
log.Warn ( () => "Unable to resolve hostname " + hostName);
return string.Empty;
}
throw;
}
}
private static string SafeGetString(Func<string> action)
{
try
{
return action();
}
catch (Exception x)
{
MetricsErrorHandler.Handle(x, "Error retrieving environment value");
return string.Empty;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using Metrics.MetricData;
namespace Metrics.Utils
{
public static class AppEnvironment
{
public static IEnumerable<EnvironmentEntry> Current
{
get
{
yield return new EnvironmentEntry("MachineName", Environment.MachineName);
yield return new EnvironmentEntry("DomainName", Environment.UserDomainName);
yield return new EnvironmentEntry("UserName", Environment.UserName);
yield return new EnvironmentEntry("ProcessName", SafeGetString(() => Process.GetCurrentProcess().ProcessName));
yield return new EnvironmentEntry("OSVersion", Environment.OSVersion.ToString());
yield return new EnvironmentEntry("CPUCount", Environment.ProcessorCount.ToString());
yield return new EnvironmentEntry("CommandLine", Environment.CommandLine);
yield return new EnvironmentEntry("HostName", SafeGetString(() => Dns.GetHostName()));
yield return new EnvironmentEntry("IPAddress", SafeGetString(() => GetIpAddress()));
yield return new EnvironmentEntry("LocalTime", Clock.FormatTimestamp(DateTime.Now));
}
}
private static string GetIpAddress()
{
var ipAddress = Dns.GetHostEntry(Dns.GetHostName())
.AddressList
.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork);
if (ipAddress != null)
{
return ipAddress.ToString();
}
return string.Empty;
}
private static string SafeGetString(Func<string> action)
{
try
{
return action();
}
catch (Exception x)
{
MetricsErrorHandler.Handle(x, "Error retrieving environment value");
return string.Empty;
}
}
}
}
|
apache-2.0
|
C#
|
fbae4b2657c1780f979c9b889bf3e9f9eed85f07
|
Change the order of the columns in CSV export
|
dodbrian/BSParser
|
BSParser/Writers/StrictCSVWriter.cs
|
BSParser/Writers/StrictCSVWriter.cs
|
using BSParser.Data;
using CsvHelper;
using System.IO;
using System.Linq;
using System.Text;
namespace BSParser.Writers
{
public class StrictCSVWriter : Writer
{
private string _fileName;
public StrictCSVWriter(string fileName)
{
_fileName = fileName;
}
public override bool Write(StatementTable data)
{
if (!data.Any()) return false;
var orderedData = data.Select(x => new
{
x.Category,
x.RefNum,
x.DocNum,
x.Amount,
x.Direction,
x.RegisteredOn,
x.Description,
x.PayerINN,
x.PayerName,
x.ReceiverINN,
x.ReceiverName
});
using (var sw = new StreamWriter(_fileName, false, Encoding.UTF8))
{
var csv = new CsvWriter(sw);
csv.Configuration.Delimiter = ";";
csv.WriteRecords(orderedData);
}
return true;
}
}
}
|
using BSParser.Data;
using CsvHelper;
using System.IO;
using System.Text;
namespace BSParser.Writers
{
public class StrictCSVWriter : Writer
{
private string _fileName;
public StrictCSVWriter(string fileName)
{
_fileName = fileName;
}
public override bool Write(StatementTable data)
{
using (var sw = new StreamWriter(_fileName, false, Encoding.UTF8))
{
var csv = new CsvWriter(sw);
csv.Configuration.Delimiter = ";";
csv.WriteRecords(data);
}
return true;
}
}
}
|
mit
|
C#
|
9c712375a3449dba29d007b5eb59087fac7a3cc1
|
Add game version to the results (for e.g. heavy rain)
|
RPCS3/discord-bot,Nicba1010/discord-bot
|
CompatBot/Utils/ResultFormatters/IrdSearchResultFormattercs.cs
|
CompatBot/Utils/ResultFormatters/IrdSearchResultFormattercs.cs
|
using CompatApiClient.Utils;
using DSharpPlus.Entities;
using IrdLibraryClient;
using IrdLibraryClient.POCOs;
namespace CompatBot.Utils.ResultFormatters
{
public static class IrdSearchResultFormattercs
{
public static DiscordEmbedBuilder AsEmbed(this SearchResult searchResult)
{
var result = new DiscordEmbedBuilder
{
//Title = "IRD Library Search Result",
Color = Config.Colors.DownloadLinks,
};
if (searchResult.Data.Count == 0)
{
result.Color = Config.Colors.LogResultFailed;
result.Description = "No matches were found";
return result;
}
foreach (var item in searchResult.Data)
{
var parts = item.Filename?.Split('-');
if (parts == null)
parts = new string[] {null, null};
else if (parts.Length == 1)
parts = new[] {null, item.Filename};
result.AddField(
$"[{parts?[0]} v{item.GameVersion}] {item.Title?.Sanitize().Trim(EmbedPager.MaxFieldTitleLength)}",
$"⏬ [`{parts[1]?.Sanitize().Trim(200)}`]({IrdClient.GetDownloadLink(item.Filename)}) ℹ [Info]({IrdClient.GetInfoLink(item.Filename)})"
);
}
return result;
}
}
}
|
using CompatApiClient.Utils;
using DSharpPlus.Entities;
using IrdLibraryClient;
using IrdLibraryClient.POCOs;
namespace CompatBot.Utils.ResultFormatters
{
public static class IrdSearchResultFormattercs
{
public static DiscordEmbedBuilder AsEmbed(this SearchResult searchResult)
{
var result = new DiscordEmbedBuilder
{
//Title = "IRD Library Search Result",
Color = Config.Colors.DownloadLinks,
};
if (searchResult.Data.Count == 0)
{
result.Color = Config.Colors.LogResultFailed;
result.Description = "No matches were found";
return result;
}
foreach (var item in searchResult.Data)
{
var parts = item.Filename?.Split('-');
if (parts == null)
parts = new string[] {null, null};
else if (parts.Length == 1)
parts = new[] {null, item.Filename};
result.AddField(
$"[{parts?[0]}] {item.Title?.Sanitize().Trim(EmbedPager.MaxFieldTitleLength)}",
$"⏬ [`{parts[1]?.Sanitize().Trim(200)}`]({IrdClient.GetDownloadLink(item.Filename)}) ℹ [Info]({IrdClient.GetInfoLink(item.Filename)})"
);
}
return result;
}
}
}
|
lgpl-2.1
|
C#
|
81cb3d58465f080dc66810f8784ffaa72d73126b
|
update the test to pass
|
ProjectSteward/StewardTRBot,ProjectSteward/StewardTRBot
|
Steward/StewardunitTest/Controllers/MessagesControllerTests.cs
|
Steward/StewardunitTest/Controllers/MessagesControllerTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steward.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Steward.Controllers.Tests
{
[TestClass()]
public class MessagesControllerTests
{
//[TestMethod()]
//public void PostTest()
//{
// Assert.Fail();
//}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steward.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Steward.Controllers.Tests
{
[TestClass()]
public class MessagesControllerTests
{
[TestMethod()]
public void PostTest()
{
Assert.Fail();
}
}
}
|
mit
|
C#
|
7b878acc5d66660fcdd66e62972cedb21f5510e4
|
Add test for ListaAutores method
|
paulodiovani/feevale-cs-livraria-2015
|
LivrariaTest/AutorTest.cs
|
LivrariaTest/AutorTest.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Livraria;
using System.Collections.Generic;
namespace LivrariaTest
{
[TestClass]
public class AutorTest
{
[TestMethod]
public void TestProperties()
{
Autor autor = new Autor();
autor.CodAutor = 999;
autor.Nome = "George R. R. Martin";
autor.Cpf = "012.345.678.90";
autor.DtNascimento = new DateTime(1948, 9, 20);
Assert.AreEqual(autor.CodAutor, 999);
Assert.AreEqual(autor.Nome, "George R. R. Martin");
Assert.AreEqual(autor.Cpf, "012.345.678.90");
Assert.AreEqual<DateTime>(autor.DtNascimento, new DateTime(1948, 9, 20));
}
[TestMethod]
public void TestListaAutores()
{
Autor autor = new Autor();
List<Autor> lstAutores = autor.ListaAutores();
foreach (var aut in lstAutores)
{
Assert.IsInstanceOfType(aut, typeof(Autor));
}
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Livraria;
namespace LivrariaTest
{
[TestClass]
public class AutorTest
{
[TestMethod]
public void TestProperties()
{
Autor autor = new Autor();
autor.CodAutor = 999;
autor.Nome = "George R. R. Martin";
autor.Cpf = "012.345.678.90";
autor.DtNascimento = new DateTime(1948, 9, 20);
Assert.AreEqual(autor.CodAutor, 999);
Assert.AreEqual(autor.Nome, "George R. R. Martin");
Assert.AreEqual(autor.Cpf, "012.345.678.90");
Assert.AreEqual<DateTime>(autor.DtNascimento, new DateTime(1948, 9, 20));
}
}
}
|
mit
|
C#
|
2e1fa87e91e497d04ee5c3509245c84d9ec83ec2
|
Bump version
|
dolly22/VersionedAssets
|
samples/SampleWebApp/Startup.cs
|
samples/SampleWebApp/Startup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using System.IO;
namespace SampleWebApp
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddLogging();
services.AddMvc();
services.AddVersionedAssets(options =>
{
options.GlobalVersion = "globalversion";
options.AlwaysPrefixGlobalVersion = true;
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
{
loggerFactory.AddConsole(LogLevel.Debug);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
// respond to version asset requests (defaults to /static/[hash])
app.UseVersionedAssets();
app.UseMvcWithDefaultRoute();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using System.IO;
namespace SampleWebApp
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddLogging();
services.AddMvc();
services.AddVersionedAssets(options =>
{
options.GlobalVersion = "globalver";
options.AlwaysPrefixGlobalVersion = true;
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
{
loggerFactory.AddConsole(LogLevel.Debug);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
// respond to version asset requests (defaults to /static/[hash])
app.UseVersionedAssets();
app.UseMvcWithDefaultRoute();
}
}
}
|
apache-2.0
|
C#
|
5f9a7ff8ee495f3d316ef7619fd5c72b2cb8ee38
|
Revert "ver"
|
Fody/Caseless
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("Caseless")]
[assembly: AssemblyProduct("Caseless")]
[assembly: AssemblyVersion("1.3.7")]
[assembly: AssemblyFileVersion("1.3.7")]
|
using System.Reflection;
[assembly: AssemblyTitle("Caseless")]
[assembly: AssemblyProduct("Caseless")]
[assembly: AssemblyVersion("1.4")]
[assembly: AssemblyFileVersion("1.4")]
|
mit
|
C#
|
2992012e045cebd52c1f01799097ec93e4ae2c9e
|
Make coding style consistent with corefx
|
benaadams/corefxlab,ericstj/corefxlab,whoisj/corefxlab,alexperovich/corefxlab,nguerrera/corefxlab,stephentoub/corefxlab,Vedin/corefxlab,ericstj/corefxlab,mafiya69/corefxlab,stephentoub/corefxlab,ericstj/corefxlab,stephentoub/corefxlab,weshaggard/corefxlab,Vedin/corefxlab,tarekgh/corefxlab,livarcocc/corefxlab,whoisj/corefxlab,KrzysztofCwalina/corefxlab,VSadov/corefxlab,ahsonkhan/corefxlab,VSadov/corefxlab,Vedin/corefxlab,dotnet/corefxlab,axxu/corefxlab,stephentoub/corefxlab,t-roblo/corefxlab,VSadov/corefxlab,Vedin/corefxlab,Vedin/corefxlab,jamesqo/corefxlab,dalbanhi/corefxlab,ravimeda/corefxlab,adamsitnik/corefxlab,ahsonkhan/corefxlab,ericstj/corefxlab,hanblee/corefxlab,VSadov/corefxlab,ericstj/corefxlab,ericstj/corefxlab,joshfree/corefxlab,VSadov/corefxlab,Vedin/corefxlab,shhsu/corefxlab,VSadov/corefxlab,benaadams/corefxlab,KrzysztofCwalina/corefxlab,hanblee/corefxlab,joshfree/corefxlab,adamsitnik/corefxlab,dotnet/corefxlab,stephentoub/corefxlab,tarekgh/corefxlab,stephentoub/corefxlab
|
demos/CoreClrConsoleApplications/HelloWorld/HelloWorld.cs
|
demos/CoreClrConsoleApplications/HelloWorld/HelloWorld.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("Hello World!");
foreach (var arg in args)
{
Console.Write("Hello ");
Console.Write(arg);
Console.WriteLine("!");
}
Console.WriteLine("Press ENTER to exit ...");
Console.ReadLine();
}
}
|
using System;
class Program {
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
foreach (var arg in args)
{
Console.Write("Hello ");
Console.Write(arg);
Console.WriteLine("!");
}
Console.WriteLine("Press ENTER to exit ...");
Console.ReadLine();
}
}
|
mit
|
C#
|
9c02fb3eb80a8cfb72fdbdd304c0e35f7a2ab962
|
Update UI v1.11
|
EmptyKeys/UI_Engines
|
GlobalAssemblyInfo.cs
|
GlobalAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("Empty Keys")]
[assembly: AssemblyCopyright("Copyright © Empty Keys, Filip Dušek 2015")]
[assembly: AssemblyTrademark("Empty Keys ™")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("1.11.0.0")]
[assembly: AssemblyFileVersion("1.11.0.0")]
|
using System.Reflection;
using System.Resources;
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("Empty Keys")]
[assembly: AssemblyCopyright("Copyright © Empty Keys, Filip Dušek 2015")]
[assembly: AssemblyTrademark("Empty Keys ™")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("1.10.0.0")]
[assembly: AssemblyFileVersion("1.10.0.0")]
|
mit
|
C#
|
0c540ee6aa6176a582eba38edd33db758968b852
|
Remove Whitespace
|
willcong/HoloToolkit-Unity,paseb/HoloToolkit-Unity,out-of-pixel/HoloToolkit-Unity,HattMarris1/HoloToolkit-Unity,paseb/MixedRealityToolkit-Unity,NeerajW/HoloToolkit-Unity
|
Assets/HoloToolkit-Examples/Input/Scripts/RotateMinMax.cs
|
Assets/HoloToolkit-Examples/Input/Scripts/RotateMinMax.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEngine;
namespace HoloToolkit.Unity.Tests
{
public class RotateMinMax : MonoBehaviour
{
[SerializeField] private float _minAngle;
[SerializeField] private float _maxAngle;
[SerializeField] private float _step;
private void Update()
{
transform.Rotate(Vector3.up, _step);
if (transform.localRotation.eulerAngles.y < _minAngle || transform.localRotation.eulerAngles.y > _maxAngle)
{
_step *= -1;
}
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEngine;
namespace HoloToolkit.Unity.Tests
{
public class RotateMinMax : MonoBehaviour
{
[SerializeField] private float _minAngle;
[SerializeField] private float _maxAngle;
[SerializeField] private float _step;
private void Update()
{
transform.Rotate(Vector3.up, _step);
if (transform.localRotation.eulerAngles.y < _minAngle || transform.localRotation.eulerAngles.y > _maxAngle)
{
_step *= -1;
}
}
}
}
|
mit
|
C#
|
4af90871e166293d31668dfeff513265f70029bb
|
Use correct TBT_LINEAR_TARGET shader feature keyword.
|
googlevr/tilt-brush-toolkit,googlevr/tilt-brush-toolkit
|
UnitySDK/Assets/TiltBrush/Scripts/Editor/GammaSettings.cs
|
UnitySDK/Assets/TiltBrush/Scripts/Editor/GammaSettings.cs
|
// Copyright 2016 Google 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 UnityEngine;
using UnityEditor;
using System.Collections;
using System.Reflection;
namespace TiltBrushToolkit {
[InitializeOnLoad]
public class GammaSettings : EditorWindow {
static ColorSpace m_LastColorSpace;
static GammaSettings() {
EditorApplication.update += OnUpdate;
SetKeywords();
m_LastColorSpace = PlayerSettings.colorSpace;
}
static void OnUpdate() {
if (m_LastColorSpace != PlayerSettings.colorSpace) {
SetKeywords();
m_LastColorSpace = PlayerSettings.colorSpace;
}
}
static void SetKeywords() {
bool linear = PlayerSettings.colorSpace == ColorSpace.Linear;
if (linear) {
Shader.EnableKeyword("TBT_LINEAR_TARGET");
} else {
Shader.DisableKeyword("TBT_LINEAR_TARGET");
}
}
}
}
|
// Copyright 2016 Google 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 UnityEngine;
using UnityEditor;
using System.Collections;
using System.Reflection;
namespace TiltBrushToolkit {
[InitializeOnLoad]
public class GammaSettings : EditorWindow {
static ColorSpace m_LastColorSpace;
static GammaSettings() {
EditorApplication.update += OnUpdate;
SetKeywords();
m_LastColorSpace = PlayerSettings.colorSpace;
}
static void OnUpdate() {
if (m_LastColorSpace != PlayerSettings.colorSpace) {
SetKeywords();
m_LastColorSpace = PlayerSettings.colorSpace;
}
}
static void SetKeywords() {
bool linear = PlayerSettings.colorSpace == ColorSpace.Linear;
if (linear) {
Shader.DisableKeyword("FORCE_SRGB");
} else {
Shader.EnableKeyword("FORCE_SRGB");
}
}
}
}
|
apache-2.0
|
C#
|
38d589a86cc49a350cece3aeee5b0230d8816460
|
rename method
|
ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework
|
osu.Framework/Graphics/Containers/Markdown/MarkdownImage.cs
|
osu.Framework/Graphics/Containers/Markdown/MarkdownImage.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Framework.Graphics.Containers.Markdown
{
/// <summary>
/// Visualises an image.
/// </summary>
/// <code>
/// 
/// </code>
public class MarkdownImage : CompositeDrawable
{
private readonly string url;
public MarkdownImage(string url)
{
this.url = url;
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = CreateContent(url);
}
protected virtual Drawable CreateContent(string url) => new DelayedLoadWrapper(CreateImageContainer(url));
protected virtual ImageContainer CreateImageContainer(string url)
{
var converter = new ImageContainer(url);
converter.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);
return converter;
}
protected class ImageContainer : CompositeDrawable
{
private readonly string url;
private readonly Sprite image;
public ImageContainer(string url)
{
this.url = url;
AutoSizeAxes = Axes.Both;
InternalChild = image = CreateImageSprite();
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
image.Texture = GetImageTexture(textures, url);
}
protected virtual Sprite CreateImageSprite() => new Sprite();
protected virtual Texture GetImageTexture(TextureStore textures, string url)
{
Texture texture = null;
if (!string.IsNullOrEmpty(url))
texture = textures.Get(url);
// Use a default texture
texture ??= GetNotFoundTexture(textures);
return texture;
}
protected virtual Texture GetNotFoundTexture(TextureStore textures) => null;
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Framework.Graphics.Containers.Markdown
{
/// <summary>
/// Visualises an image.
/// </summary>
/// <code>
/// 
/// </code>
public class MarkdownImage : CompositeDrawable
{
private readonly string url;
public MarkdownImage(string url)
{
this.url = url;
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = CreateContent(url);
}
protected virtual Drawable CreateContent(string url) => new DelayedLoadWrapper(CreateImageContainer(url));
protected virtual ImageContainer CreateImageContainer(string url)
{
var converter = new ImageContainer(url);
converter.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);
return converter;
}
protected class ImageContainer : CompositeDrawable
{
private readonly string url;
private readonly Sprite image;
public ImageContainer(string url)
{
this.url = url;
AutoSizeAxes = Axes.Both;
InternalChild = image = CreateSpriteImage();
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
image.Texture = GetImageTexture(textures, url);
}
protected virtual Sprite CreateSpriteImage() => new Sprite();
protected virtual Texture GetImageTexture(TextureStore textures, string url)
{
Texture texture = null;
if (!string.IsNullOrEmpty(url))
texture = textures.Get(url);
// Use a default texture
texture ??= GetNotFoundTexture(textures);
return texture;
}
protected virtual Texture GetNotFoundTexture(TextureStore textures) => null;
}
}
}
|
mit
|
C#
|
dd80604828b8fa2a2423a1a9e3881bde588db67c
|
clean up
|
gngrninja/NinjaBotCore
|
Modules/Wow/ApiRequestorThrottle.cs
|
Modules/Wow/ApiRequestorThrottle.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace NinjaBotCore.Modules.Wow
{
internal class ApiRequesterThrottle : WclApiRequestor
{
private readonly Semaphore _queue;
private int _rateLimitRemaining;
private DateTime _rateLimitResetRemaining;
public ApiRequesterThrottle(string apiKey) : base(apiKey)
{
_queue = new Semaphore(1, 1);
_rateLimitRemaining = 1;
_rateLimitResetRemaining = DateTime.UtcNow.AddSeconds(1);
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request)
{
try
{
_queue.WaitOne();
if (_rateLimitRemaining == 0)
{
var startTime = DateTime.UtcNow;
//var difference = _rateLimitResetRemaining - startTime;
//System.Console.WriteLine($"dif: {difference}");
await Task.Delay(1000);
_rateLimitRemaining = 1;
_rateLimitResetRemaining.AddSeconds(1);
}
var response = await base.SendAsync(request);
_rateLimitRemaining -= 1;
_rateLimitResetRemaining = _rateLimitResetRemaining.AddSeconds(-1);
//System.Console.WriteLine(_rateLimitRemaining);
return response;
}
finally
{
_queue.Release();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace NinjaBotCore.Modules.Wow
{
/// <summary>
/// Used to send throttled HTTP requests to https://api.rocketleaguestats.com.
/// Automatically detects your rate limit configuration from the headers.
/// </summary>
internal class ApiRequesterThrottle : WclApiRequestor
{
private readonly Semaphore _queue;
private int _rateLimitRemaining;
private DateTime _rateLimitResetRemaining;
public ApiRequesterThrottle(string apiKey) : base(apiKey)
{
_queue = new Semaphore(1, 1);
_rateLimitRemaining = 1;
_rateLimitResetRemaining = DateTime.UtcNow.AddSeconds(1);
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request)
{
try
{
_queue.WaitOne();
if (_rateLimitRemaining == 0)
{
var startTime = DateTime.UtcNow;
//var difference = _rateLimitResetRemaining - startTime;
//System.Console.WriteLine($"dif: {difference}");
await Task.Delay(1000);
_rateLimitRemaining = 1;
_rateLimitResetRemaining.AddSeconds(1);
}
var response = await base.SendAsync(request);
_rateLimitRemaining -= 1;
_rateLimitResetRemaining = _rateLimitResetRemaining.AddSeconds(-1);
//System.Console.WriteLine(_rateLimitRemaining);
return response;
}
finally
{
_queue.Release();
}
}
}
}
|
mit
|
C#
|
828d12e47f8cf92827f88c3f94eb05460ac17e59
|
Improve StubListener's output of nested exceptions, so that it is as descriptive as the real ConsoleListener.
|
EliotJones/fixie,bardoloi/fixie,KevM/fixie,bardoloi/fixie,fixie/fixie,Duohong/fixie,JakeGinnivan/fixie
|
src/Fixie.Tests/StubListener.cs
|
src/Fixie.Tests/StubListener.cs
|
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Remoting.Messaging;
using System.Text;
using Fixie.Execution;
using Fixie.Results;
namespace Fixie.Tests
{
public class StubListener : Listener
{
readonly List<string> log = new List<string>();
public void AssemblyStarted(Assembly assembly)
{
}
public void CaseSkipped(SkipResult result)
{
log.Add(string.Format("{0} skipped{1}", result.Name, result.Reason == null ? "." : ": " + result.Reason));
}
public void CasePassed(PassResult result)
{
log.Add(string.Format("{0} passed.", result.Name));
}
public void CaseFailed(FailResult result)
{
var entry = new StringBuilder();
var primaryException = result.Exceptions.PrimaryException;
entry.AppendFormat("{0} failed: {1}", result.Name, primaryException.Message);
var walk = primaryException;
while (walk.InnerException != null)
{
walk = walk.InnerException;
entry.AppendLine();
entry.AppendFormat(" Inner Exception: {0}", walk.Message);
}
foreach (var secondaryException in result.Exceptions.SecondaryExceptions)
{
entry.AppendLine();
entry.AppendFormat(" Secondary Failure: {0}", secondaryException.Message);
walk = secondaryException;
while (walk.InnerException != null)
{
walk = walk.InnerException;
entry.AppendLine();
entry.AppendFormat(" Inner Exception: {0}", walk.Message);
}
}
log.Add(entry.ToString());
}
public void AssemblyCompleted(Assembly assembly, AssemblyResult result)
{
}
public IEnumerable<string> Entries
{
get { return log; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Fixie.Execution;
using Fixie.Results;
namespace Fixie.Tests
{
public class StubListener : Listener
{
readonly List<string> log = new List<string>();
public void AssemblyStarted(Assembly assembly)
{
}
public void CaseSkipped(SkipResult result)
{
log.Add(string.Format("{0} skipped{1}", result.Name, result.Reason == null ? "." : ": " + result.Reason));
}
public void CasePassed(PassResult result)
{
log.Add(string.Format("{0} passed.", result.Name));
}
public void CaseFailed(FailResult result)
{
var entry = new StringBuilder();
entry.Append(string.Format("{0} failed: {1}", result.Name, result.Exceptions.PrimaryException.Message));
foreach (var exception in result.Exceptions.SecondaryExceptions)
{
entry.AppendLine();
entry.Append(string.Format(" Secondary Failure: {0}", exception.Message));
}
log.Add(entry.ToString());
}
public void AssemblyCompleted(Assembly assembly, AssemblyResult result)
{
}
public IEnumerable<string> Entries
{
get { return log; }
}
}
}
|
mit
|
C#
|
6da43a18512e752fa7d0024828e604db148cf3ea
|
Make official that 2k missing translations doesn't get you into the new system
|
icsharpcode/ResourceFirstTranslations,icsharpcode/ResourceFirstTranslations,icsharpcode/ResourceFirstTranslations
|
src/Importer.Corsavy/Program.cs
|
src/Importer.Corsavy/Program.cs
|
using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ResourcesFirstTranslations.Data;
namespace Importer.Corsavy
{
class Program
{
private const string ConnectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=LocalizeDb_DL_Corsavy.mdb;" +
@"User Id=;Password=;";
// NOTE: Languages > 2k missing are removed, statistics as of 6/6/2014
// Urdu urdu 2538
// Afrikaans af 2537
// Indonesian id 2534
// Persian fa 2492
// Thai th 2491
// Vietnamese vi 2406
// Goiserisch goisern 2393
// Belarusian be 2366
// Croatian hr 2351
// Hebrew he 2343
// Arabic ar 2254
private static readonly List<string> IgnoreOnImport = new List<string>()
{
"en", "goisern", // en isn't really in the database, goisern was a fake translation
"urdu", "af", "id", "fa", "th", "vi", "be", "hr", "he", "ar"
};
// TODO: all branches or only 5.x?
static void Main(string[] args)
{
// Note: database must be entirely empty before running this!
var importer = new Importer(ConnectionString, IgnoreOnImport);
try
{
Trace.TraceInformation("Create branches and languages...");
importer.PrepareBranchesAndLanguages();
Trace.TraceInformation("Import existing resource strings...");
importer.Import();
}
catch (Exception ex)
{
Trace.TraceError(ex.ToString());
}
Console.WriteLine("Done. Press any key to continue...");
Console.ReadLine();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ResourcesFirstTranslations.Data;
namespace Importer.Corsavy
{
class Program
{
private const string ConnectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=LocalizeDb_DL_Corsavy.mdb;" +
@"User Id=;Password=;";
// TODO: which languages do we import? (atm > 2k missing are removed)
private static readonly List<string> IgnoreOnImport = new List<string>()
{
"en", "goisern", // en isn't really in the database, goisern was a fake translation
"urdu", "af", "id", "fa", "th", "vi", "be", "hr", "he", "ar"
};
// TODO: all branches or only 5.x?
static void Main(string[] args)
{
// Note: database must be entirely empty before running this!
var importer = new Importer(ConnectionString, IgnoreOnImport);
try
{
Trace.TraceInformation("Create branches and languages...");
importer.PrepareBranchesAndLanguages();
Trace.TraceInformation("Import existing resource strings...");
importer.Import();
}
catch (Exception ex)
{
Trace.TraceError(ex.ToString());
}
Console.WriteLine("Done. Press any key to continue...");
Console.ReadLine();
}
}
}
|
mit
|
C#
|
a9e4979db93549716d38e7b19bca4797531328bc
|
Allow bass sample channels to overwrite older ones by default.
|
smoogipooo/osu-framework,ppy/osu-framework,naoey/osu-framework,paparony03/osu-framework,default0/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,RedNesto/osu-framework,default0/osu-framework,paparony03/osu-framework,ZLima12/osu-framework,Tom94/osu-framework,naoey/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,RedNesto/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework
|
osu.Framework/Audio/Sample/SampleBass.cs
|
osu.Framework/Audio/Sample/SampleBass.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using ManagedBass;
using System;
using System.Collections.Concurrent;
namespace osu.Framework.Audio.Sample
{
internal class SampleBass : Sample, IBassAudio
{
private volatile int sampleId;
public override bool IsLoaded => sampleId != 0;
public SampleBass(byte[] data, ConcurrentQueue<Action> customPendingActions = null)
{
if (customPendingActions != null)
PendingActions = customPendingActions;
PendingActions.Enqueue(() => { sampleId = Bass.SampleLoad(data, 0, data.Length, 8, BassFlags.Default | BassFlags.SampleOverrideLongestPlaying); });
}
protected override void Dispose(bool disposing)
{
Bass.SampleFree(sampleId);
base.Dispose(disposing);
}
void IBassAudio.UpdateDevice(int deviceIndex)
{
if (IsLoaded)
// counter-intuitively, this is the correct API to use to migrate a sample to a new device.
Bass.ChannelSetDevice(sampleId, deviceIndex);
}
public int CreateChannel() => Bass.SampleGetChannel(sampleId);
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using ManagedBass;
using System;
using System.Collections.Concurrent;
namespace osu.Framework.Audio.Sample
{
internal class SampleBass : Sample, IBassAudio
{
private volatile int sampleId;
public override bool IsLoaded => sampleId != 0;
public SampleBass(byte[] data, ConcurrentQueue<Action> customPendingActions = null)
{
if (customPendingActions != null)
PendingActions = customPendingActions;
PendingActions.Enqueue(() => { sampleId = Bass.SampleLoad(data, 0, data.Length, 8, BassFlags.Default); });
}
protected override void Dispose(bool disposing)
{
Bass.SampleFree(sampleId);
base.Dispose(disposing);
}
void IBassAudio.UpdateDevice(int deviceIndex)
{
if (IsLoaded)
// counter-intuitively, this is the correct API to use to migrate a sample to a new device.
Bass.ChannelSetDevice(sampleId, deviceIndex);
}
public int CreateChannel() => Bass.SampleGetChannel(sampleId);
}
}
|
mit
|
C#
|
96da74278315f6532ca8f83f57bc3ccc28e4e9b5
|
Fix CA warnings
|
JetBrains/YouTrackSharp,JetBrains/YouTrackSharp
|
src/YouTrackSharp/Connection.cs
|
src/YouTrackSharp/Connection.cs
|
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace YouTrackSharp
{
/// <summary>
/// Abstract base class that represents a connection against a YouTrack server instance and provides
/// an authenticated <see cref="T:System.Net.Http.HttpClient" />.
/// </summary>
public abstract class Connection
{
/// <summary>
/// YouTrack server instance URI that will be connected against.
/// </summary>
protected Uri ServerUri { get; }
/// <summary>
/// Creates an instance of the <see cref="Connection" /> class.
/// </summary>
/// <param name="serverUrl">YouTrack server instance URL that will be connected against.</param>
/// <exception cref="ArgumentException">
/// The <paramref name="serverUrl" /> was null, empty or did not represent a valid,
/// absolute <see cref="T:System.Uri" />.
/// </exception>
protected Connection(string serverUrl)
{
if (string.IsNullOrEmpty(serverUrl)
|| !Uri.TryCreate(EnsureTrailingSlash(serverUrl), UriKind.Absolute, out var serverUri))
{
throw new ArgumentException(Strings.ServerUrlIsInvalid, nameof(serverUrl));
}
ServerUri = serverUri;
}
/// <summary>
/// Ensures a trailing slash is present for the given string.
/// </summary>
/// <param name="url">URL represented as a <see cref="T:System.String" /></param>
/// <returns>A <see cref="T:System.String" /> with traling slash based on <paramref name="url" />.</returns>
private static string EnsureTrailingSlash(string url)
{
if (!url.EndsWith("/"))
{
return url + "/";
}
return url;
}
/// <summary>
/// Provides an authenticated <see cref="T:System.Net.Http.HttpClient" />
/// which can be used by REST API client implementations.
/// </summary>
/// <returns>An authenticated <see cref="T:System.Net.Http.HttpClient" />.</returns>
/// <exception cref="UnauthorizedConnectionException">The connection could not be authenticated.</exception>
public abstract Task<HttpClient> GetAuthenticatedHttpClient();
}
}
|
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
namespace YouTrackSharp
{
/// <summary>
/// Abstract base class that represents a connection against a YouTrack server instance and provides
/// an authenticated <see cref="T:System.Net.Http.HttpClient" />.
/// </summary>
public abstract class Connection
{
/// <summary>
/// YouTrack server instance URI that will be connected against.
/// </summary>
protected Uri ServerUri { get; }
/// <summary>
/// Creates an instance of the <see cref="Connection" /> class.
/// </summary>
/// <param name="serverUrl">YouTrack server instance URL that will be connected against.</param>
/// <exception cref="ArgumentException">
/// The <paramref name="serverUrl" /> was null, empty or did not represent a valid,
/// absolute <see cref="T:System.Uri" />.
/// </exception>
protected Connection(string serverUrl)
{
if (string.IsNullOrEmpty(serverUrl)
|| !Uri.TryCreate(EnsureTrailingSlash(serverUrl), UriKind.Absolute, out var serverUri))
{
throw new ArgumentException(Strings.ServerUrlIsInvalid, nameof(serverUrl));
}
ServerUri = serverUri;
}
/// <summary>
/// Ensures a trailing slash is present for the given string.
/// </summary>
/// <param name="url">URL represented as a <see cref="T:System.String" /></param>
/// <returns>A <see cref="T:System.String" /> with traling slash based on <paramref name="url" />.</returns>
private static string EnsureTrailingSlash(string url)
{
if (!url.EndsWith("/"))
{
return url + "/";
}
return url;
}
/// <summary>
/// Provides an authenticated <see cref="T:System.Net.Http.HttpClient" />
/// which can be used by REST API client implementations.
/// </summary>
/// <returns>An authenticated <see cref="T:System.Net.Http.HttpClient" />.</returns>
/// <exception cref="UnauthorizedConnectionException">The connection could not be authenticated.</exception>
public abstract Task<HttpClient> GetAuthenticatedHttpClient();
}
}
|
apache-2.0
|
C#
|
67124c514cb32462052335157dd67bbd953ef052
|
Add test for kabuto/kabutops
|
genius394/PogoLocationFeeder,5andr0/PogoLocationFeeder,5andr0/PogoLocationFeeder
|
PogoLocationFeederTests/Helper/PokemonParserTests.cs
|
PogoLocationFeederTests/Helper/PokemonParserTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PogoLocationFeeder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using POGOProtos.Enums;
namespace PogoLocationFeeder.Tests
{
[TestClass()]
public class PokemonParserTests
{
[TestMethod()]
public void parsePokemonTest()
{
testPokemonParsing("kadabra", PokemonId.Kadabra);
testPokemonParsing("Kadabra", PokemonId.Kadabra);
testPokemonParsing("abra", PokemonId.Abra);
testPokemonParsing("Mr Mime", PokemonId.MrMime);
testPokemonParsing("Mr.Mime", PokemonId.MrMime);
testPokemonParsing("MrMime", PokemonId.MrMime);
testPokemonParsing("farfetchd", PokemonId.Farfetchd);
testPokemonParsing("farfetch'd", PokemonId.Farfetchd);
testPokemonParsing("farfetched", PokemonId.Farfetchd);
testPokemonParsing("Blastoise", PokemonId.Blastoise);
testPokemonParsing("qsddqfsfqds", PokemonId.Missingno);
testPokemonParsing("Kabuto", PokemonId.Kabuto);
testPokemonParsing("Kabutops", PokemonId.Kabutops);
}
[TestMethod()]
public void parsePokemonFullLine()
{
testPokemonParsing("[302 seconds remaining] 70% IV - Snorlax at 37.729738754701,-97.372969967814 [ Moveset: ZenHeadbuttFast/HyperBeam ]", PokemonId.Snorlax);
testPokemonParsing("[482 seconds remaining] 73% IV - Wigglytuff at 31.934567351007,-4.4561212903872 [ Moveset: FeintAttackFast/HyperBeam ]", PokemonId.Wigglytuff);
testPokemonParsing("52,6271480914, 13,2858625127 Magneton 90", PokemonId.Magneton);
}
private void testPokemonParsing(String text, PokemonId expectedPokemonId)
{
Assert.AreEqual(expectedPokemonId, PokemonParser.parsePokemon(text));
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PogoLocationFeeder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using POGOProtos.Enums;
namespace PogoLocationFeeder.Tests
{
[TestClass()]
public class PokemonParserTests
{
[TestMethod()]
public void parsePokemonTest()
{
testPokemonParsing("kadabra", PokemonId.Kadabra);
testPokemonParsing("Kadabra", PokemonId.Kadabra);
testPokemonParsing("abra", PokemonId.Abra);
testPokemonParsing("Mr Mime", PokemonId.MrMime);
testPokemonParsing("Mr.Mime", PokemonId.MrMime);
testPokemonParsing("MrMime", PokemonId.MrMime);
testPokemonParsing("farfetchd", PokemonId.Farfetchd);
testPokemonParsing("farfetch'd", PokemonId.Farfetchd);
testPokemonParsing("farfetched", PokemonId.Farfetchd);
testPokemonParsing("Blastoise", PokemonId.Blastoise);
testPokemonParsing("qsddqfsfqds", PokemonId.Missingno);
}
[TestMethod()]
public void parsePokemonFullLine()
{
testPokemonParsing("[302 seconds remaining] 70% IV - Snorlax at 37.729738754701,-97.372969967814 [ Moveset: ZenHeadbuttFast/HyperBeam ]", PokemonId.Snorlax);
testPokemonParsing("[482 seconds remaining] 73% IV - Wigglytuff at 31.934567351007,-4.4561212903872 [ Moveset: FeintAttackFast/HyperBeam ]", PokemonId.Wigglytuff);
testPokemonParsing("52,6271480914, 13,2858625127 Magneton 90", PokemonId.Magneton);
}
private void testPokemonParsing(String text, PokemonId expectedPokemonId)
{
Assert.AreEqual(expectedPokemonId, PokemonParser.parsePokemon(text));
}
}
}
|
agpl-3.0
|
C#
|
1b4d5af8ea095cf4f15d9edf1613c8e8b3a621be
|
Allow unit testing of internal or private interfaces.
|
kf6kjg/chattel
|
Source/Chattel-AssetTools/Properties/AssemblyInfo.cs
|
Source/Chattel-AssetTools/Properties/AssemblyInfo.cs
|
// AssemblyInfo.cs
//
// Author:
// Ricky C <>
//
// Copyright (c) 2017
//
// 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.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Chattel-AssetTools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
// Allow unit testing internals
[assembly: InternalsVisibleTo("Chattel-AssetToolsTests")]
|
// AssemblyInfo.cs
//
// Author:
// Ricky C <>
//
// Copyright (c) 2017
//
// 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.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Chattel-AssetTools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
mit
|
C#
|
f26d0a84fe0a7cf35ab3f2b95ceef548ef911df5
|
Add script for client side validation
|
lostm1nd/TeamTaskboard
|
Source/TeamTaskboard.Web/Views/Shared/_Layout.cshtml
|
Source/TeamTaskboard.Web/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Team Taskboard</title>
@Styles.Render("~/Content/bootstrapcss")
@RenderSection("styles", required: false)
@Styles.Render("~/Content/mycss")
</head>
<body>
<div class="navbar navbar-inverse">
<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>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
@Html.Partial("_AuthorizedMenu")
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
</div>
<footer class="text-center sticky-footer">
<p class="no-margin">© @DateTime.Now.Year - Team Taskboard</p>
</footer>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")
@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, initial-scale=1.0">
<title>@ViewBag.Title - Team Taskboard</title>
@Styles.Render("~/Content/bootstrapcss")
@RenderSection("styles", required: false)
@Styles.Render("~/Content/mycss")
</head>
<body>
<div class="navbar navbar-inverse">
<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>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
@Html.Partial("_AuthorizedMenu")
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
</div>
<footer class="text-center sticky-footer">
<p class="no-margin">© @DateTime.Now.Year - Team Taskboard</p>
</footer>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.