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 |
|---|---|---|---|---|---|---|---|---|
b3152406a7da31664c437366baabddd770f6de45 | Remove obsolete send message method | messagebird/csharp-rest-api | MessageBird/Client.cs | MessageBird/Client.cs | using System;
using MessageBird.Objects;
using MessageBird.Resources;
using MessageBird.Net;
namespace MessageBird
{
public class Client
{
private IRestClient restClient;
private Client(IRestClient restClient)
{
this.restClient = restClient;
}
public static Client Create(IRestClient restClient)
{
return new Client(restClient);
}
public static Client CreateDefault(string accessKey)
{
return new Client(new RestClient(accessKey));
}
public Message SendMessage(string originator, string body, long[] msisdns, MessageOptionalArguments optionalArguments = null)
{
Recipients recipients = new Recipients(msisdns);
Message message = new Message(originator, body, recipients, optionalArguments);
Messages messages = new Messages(message);
Messages result = (Messages)restClient.Create(messages);
return result.Message;
}
public Message ViewMessage(string id)
{
Messages messageToView = new Messages(id);
Messages result = (Messages)restClient.Retrieve(messageToView);
return result.Message;
}
}
} | using System;
using MessageBird.Objects;
using MessageBird.Resources;
using MessageBird.Net;
namespace MessageBird
{
public class Client
{
private IRestClient restClient;
private Client(IRestClient restClient)
{
this.restClient = restClient;
}
public static Client Create(IRestClient restClient)
{
return new Client(restClient);
}
public static Client CreateDefault(string accessKey)
{
return new Client(new RestClient(accessKey));
}
public Message SendMessage(Message message)
{
Messages messageToSend = new Messages(message);
Messages result = (Messages)restClient.Create(messageToSend);
return result.Message;
}
public Message SendMessage(string originator, string body, long[] msisdns, MessageOptionalArguments optionalArguments = null)
{
Recipients recipients = new Recipients(msisdns);
Message message = new Message(originator, body, recipients, optionalArguments);
Messages messages = new Messages(message);
Messages result = (Messages)restClient.Create(messages);
return result.Message;
}
public Message ViewMessage(string id)
{
Messages messageToView = new Messages(id);
Messages result = (Messages)restClient.Retrieve(messageToView);
return result.Message;
}
}
} | isc | C# |
9277a6616782c54f3518aa597f8cf73c511385c1 | add using | dataccountzXJ9/Lynx | Lynx/Services/Help/HelpExtension.cs | Lynx/Services/Help/HelpExtension.cs | using Discord;
using Discord.Commands;
using Discord.WebSocket;
using Lynx.Database;
using Lynx.Services.Embed;
using Raven.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lynx.Services.Help
{
public static class HelpExtension
{
public static ModuleInfo GetTopLevelModule(this ModuleInfo module)
{
while (module.Parent != null)
{
module = module.Parent;
}
return module;
}
public class CommandTextEqualityComparer : IEqualityComparer<CommandInfo>
{
public bool Equals(CommandInfo x, CommandInfo y) => x.Aliases.First() == y.Aliases.First();
public int GetHashCode(CommandInfo obj) => obj.Aliases.First().GetHashCode();
}
}
}
| using Discord;
using Discord.Commands;
using Discord.WebSocket;
using Lynx.Database;
using Raven.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lynx.Services.Help
{
public static class HelpExtension
{
public static ModuleInfo GetTopLevelModule(this ModuleInfo module)
{
while (module.Parent != null)
{
module = module.Parent;
}
return module;
}
public class CommandTextEqualityComparer : IEqualityComparer<CommandInfo>
{
public bool Equals(CommandInfo x, CommandInfo y) => x.Aliases.First() == y.Aliases.First();
public int GetHashCode(CommandInfo obj) => obj.Aliases.First().GetHashCode();
}
}
}
| mit | C# |
8a7ec1adfd279ceb20eeca6a25a5eec033b49f64 | Revert "修改标题" | 18773048081zhou/netweb,18773048081zhou/netweb,18773048081zhou/netweb | MyWeb/MyWeb/Views/Home/Index.cshtml | MyWeb/MyWeb/Views/Home/Index.cshtml | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
<h2>欢迎来到我的主页</h2>
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
</div> | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
<h2>欢迎来到我的主页</h2>
<h2>欢迎来到我的主页</h2>
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
</div> | mit | C# |
bf66bd70d21f77fe1453c2cbea695398d37f165e | Refactor from RaceType to DerbyType | tmeers/Derby,tmeers/Derby,tmeers/Derby | Derby/Models/Competition.cs | Derby/Models/Competition.cs | using System;
using System.ComponentModel.DataAnnotations;
using Derby.Infrastructure;
namespace Derby.Models
{
public class Competition
{
public int Id { get; set; }
public int PackId { get; set; }
public string Title { get; set; }
public string Location { get; set; }
[Required]
[Display(Name = "Race Type")]
public DerbyType RaceType { get; set; }
[Display(Name = "Created Date")]
public DateTime CreatedDate { get; set; }
[Required]
[Display(Name = "Event Date")]
[DataType(DataType.Date)]
public DateTime EventDate { get; set; }
[Required]
[Display(Name = "Number of Lanes")]
public int LaneCount { get; set; }
public string CreatedById { get; set; }
public Pack Pack { get; set; }
public bool Completed { get; set; }
}
} | using System;
using System.ComponentModel.DataAnnotations;
using Derby.Infrastructure;
namespace Derby.Models
{
public class Competition
{
public int Id { get; set; }
public int PackId { get; set; }
public string Title { get; set; }
public string Location { get; set; }
[Required]
[Display(Name = "Race Type")]
public RaceType RaceType { get; set; }
[Display(Name = "Created Date")]
public DateTime CreatedDate { get; set; }
[Required]
[Display(Name = "Event Date")]
[DataType(DataType.Date)]
public DateTime EventDate { get; set; }
[Required]
[Display(Name = "Number of Lanes")]
public int LaneCount { get; set; }
public string CreatedById { get; set; }
public Pack Pack { get; set; }
public bool Completed { get; set; }
}
} | mit | C# |
0e3f8601ac4a27214b8fc9410b029ce10618f949 | Correct comment. | drewnoakes/boing | Boing/PointMass.cs | Boing/PointMass.cs | using System.Collections.Generic;
using System.Diagnostics;
namespace Boing
{
public sealed class PointMass
{
private Vector2f _force;
internal HashSet<ILocalForce> LocalForces { get; } = new HashSet<ILocalForce>();
public float Mass { get; set; }
public float Damping { get; set; }
public bool IsPinned { get; set; }
public object Tag { get; set; }
public Vector2f Position { get; set; }
public Vector2f Velocity { get; set; }
public PointMass(float mass = 1.0f, float damping = 0.5f, Vector2f? position = null)
{
Mass = mass;
Damping = damping;
Position = position ?? Vector2f.Random();
}
public void ApplyForce(Vector2f force)
{
Debug.Assert(!float.IsNaN(force.X) && !float.IsNaN(force.Y), "!float.IsNaN(force.X) && !float.IsNaN(force.Y)");
Debug.Assert(!float.IsInfinity(force.X) && !float.IsInfinity(force.Y), "!float.IsInfinity(force.X) && !float.IsInfinity(force.Y)");
// Accumulate force
_force += force;
}
public void Update(float dt)
{
// Update velocity
Velocity += _force/Mass*dt;
Velocity *= Damping;
// Update position
Position += Velocity*dt;
Debug.Assert(!float.IsNaN(Position.X) && !float.IsNaN(Position.Y), "!float.IsNaN(Position.X) && !float.IsNaN(Position.Y)");
Debug.Assert(!float.IsInfinity(Position.X) && !float.IsInfinity(Position.Y), "!float.IsInfinity(Position.X) && !float.IsInfinity(Position.Y)");
// Clear force
_force = Vector2f.Zero;
}
}
} | using System.Collections.Generic;
using System.Diagnostics;
namespace Boing
{
public sealed class PointMass
{
private Vector2f _force;
internal HashSet<ILocalForce> LocalForces { get; } = new HashSet<ILocalForce>();
public float Mass { get; set; }
public float Damping { get; set; }
public bool IsPinned { get; set; }
public object Tag { get; set; }
public Vector2f Position { get; set; }
public Vector2f Velocity { get; set; }
public PointMass(float mass = 1.0f, float damping = 0.5f, Vector2f? position = null)
{
Mass = mass;
Damping = damping;
Position = position ?? Vector2f.Random();
}
public void ApplyForce(Vector2f force)
{
Debug.Assert(!float.IsNaN(force.X) && !float.IsNaN(force.Y), "!float.IsNaN(force.X) && !float.IsNaN(force.Y)");
Debug.Assert(!float.IsInfinity(force.X) && !float.IsInfinity(force.Y), "!float.IsInfinity(force.X) && !float.IsInfinity(force.Y)");
// Accumulate force
_force += force;
}
public void Update(float dt)
{
// Update velocity
Velocity += _force/Mass*dt;
Velocity *= Damping;
// Update position
Position += Velocity*dt;
Debug.Assert(!float.IsNaN(Position.X) && !float.IsNaN(Position.Y), "!float.IsNaN(Position.X) && !float.IsNaN(Position.Y)");
Debug.Assert(!float.IsInfinity(Position.X) && !float.IsInfinity(Position.Y), "!float.IsInfinity(Position.X) && !float.IsInfinity(Position.Y)");
// Clear acceleration
_force = Vector2f.Zero;
}
}
} | apache-2.0 | C# |
a529d0e742a91c54d674d65ffa79f25416dc936e | Update 2019 migrating | dimmpixeye/Unity3dTools | Editor/Helpers/HelperReturnClick.cs | Editor/Helpers/HelperReturnClick.cs | /*===============================================================
Product: Cryoshock
Developer: Dimitry Pixeye - pixeye@hbrew.store
Company: Homebrew - http://hbrew.store
Date: 2/5/2018 2:42 PM
================================================================*/
using UnityEditor;
using UnityEngine;
namespace Pixeye.Framework
{
[InitializeOnLoad]
public class HelperReturnClick
{
static HelperReturnClick()
{
SceneView.duringSceneGui += SceneGUI;
}
static void SceneGUI(SceneView sceneView)
{
if (!Event.current.alt) return;
if (Event.current.button!=1) return;
var pos = SceneView.currentDrawingSceneView.camera.ScreenToWorldPoint(Event.current.mousePosition);
Debug.Log("Click position is: <b>" + pos + "</b>");
}
}
} | /*===============================================================
Product: Cryoshock
Developer: Dimitry Pixeye - pixeye@hbrew.store
Company: Homebrew - http://hbrew.store
Date: 2/5/2018 2:42 PM
================================================================*/
using UnityEditor;
using UnityEngine;
namespace Pixeye.Framework
{
[InitializeOnLoad]
public class HelperReturnClick
{
static HelperReturnClick()
{
SceneView.onSceneGUIDelegate += SceneGUI;
}
static void SceneGUI(SceneView sceneView)
{
if (!Event.current.alt) return;
if (Event.current.button!=1) return;
var pos = SceneView.currentDrawingSceneView.camera.ScreenToWorldPoint(Event.current.mousePosition);
Debug.Log("Click position is: <b>" + pos + "</b>");
}
}
} | mit | C# |
32770517dbddd1c51dde26664a0178199ae38386 | Remove unused using statments | It423/enigma-simulator,wrightg42/enigma-simulator | Enigma/EnigmaUtilities/Resources.cs | Enigma/EnigmaUtilities/Resources.cs | // Resources.cs
// <copyright file="Resources.cs"> This code is protected under the MIT License. </copyright>
using System.Linq;
namespace EnigmaUtilities
{
/// <summary>
/// A static class with commonly used functions throughout multiple classes.
/// </summary>
public static class Resources
{
/// <summary>
/// Gets the alphabet as a string.
/// </summary>
public static string Alphabet
{
get
{
return "abcdefghijklmnopqrstuvwxyz";
}
}
/// <summary>
/// Performs modulus operations on an integer.
/// </summary>
/// <param name="i"> The integer to modulus. </param>
/// <param name="j"> The integer to modulus by. </param>
/// <returns> The integer after modulus operations. </returns>
/// <remarks> Performs negative modulus python style. </remarks>
public static int Mod(int i, int j)
{
return ((i % j) + j) % j;
}
/// <summary>
/// Gets the character value of an integer.
/// </summary>
/// <param name="i"> The integer to convert to a character. </param>
/// <returns> The character value of the integer. </returns>
public static char ToChar(this int i)
{
return Alphabet[Mod(i, 26)];
}
/// <summary>
/// Gets the index in the alphabet of a character.
/// </summary>
/// <param name="c"> The character to convert to an integer. </param>
/// <returns> The integer value of the character. </returns>
/// <remarks> Will return -1 if not in the alphabet. </remarks>
public static int ToInt(this char c)
{
return Alphabet.Contains(c) ? Alphabet.IndexOf(c) : -1;
}
}
}
| // Resources.cs
// <copyright file="Resources.cs"> This code is protected under the MIT License. </copyright>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EnigmaUtilities
{
/// <summary>
/// A static class with commonly used functions throughout multiple classes.
/// </summary>
public static class Resources
{
/// <summary>
/// Gets the alphabet as a string.
/// </summary>
public static string Alphabet
{
get
{
return "abcdefghijklmnopqrstuvwxyz";
}
}
/// <summary>
/// Performs modulus operations on an integer.
/// </summary>
/// <param name="i"> The integer to modulus. </param>
/// <param name="j"> The integer to modulus by. </param>
/// <returns> The integer after modulus operations. </returns>
/// <remarks> Performs negative modulus python style. </remarks>
public static int Mod(int i, int j)
{
return ((i % j) + j) % j;
}
/// <summary>
/// Gets the character value of an integer.
/// </summary>
/// <param name="i"> The integer to convert to a character. </param>
/// <returns> The character value of the integer. </returns>
public static char ToChar(this int i)
{
return Alphabet[Mod(i, 26)];
}
/// <summary>
/// Gets the index in the alphabet of a character.
/// </summary>
/// <param name="c"> The character to convert to an integer. </param>
/// <returns> The integer value of the character. </returns>
/// <remarks> Will return -1 if not in the alphabet. </remarks>
public static int ToInt(this char c)
{
return Alphabet.Contains(c) ? Alphabet.IndexOf(c) : -1;
}
}
}
| mit | C# |
6e209a7f07581b0d6c98de9afc7129f6eee2af29 | Add global error listener. | kchen0723/ExcelAsync | ExcelAsyncWpf/ExcelAsyncWpfAddin.cs | ExcelAsyncWpf/ExcelAsyncWpfAddin.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Excel;
using ExcelDna.Integration;
using ExcelDna.ComInterop;
using ExcelAsyncWpf.ExcelOperator;
namespace ExcelAsyncWpf
{
public class ExcelAsyncWpfAddin : IExcelAddIn
{
public void AutoOpen()
{
ExcelIntegration.RegisterUnhandledExceptionHandler(globalErrorHandler);
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
ComServer.DllRegisterServer();
ExcelApp.AttachApplicationEvents();
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = e.ExceptionObject as Exception;
System.Windows.MessageBox.Show("Excel cannot recover from error: " + ex.Message);
Environment.Exit(-1);
}
public void AutoClose()
{
ComServer.DllUnregisterServer();
}
public object globalErrorHandler(object ex)
{
return ex.ToString();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Excel;
using ExcelDna.Integration;
using ExcelDna.ComInterop;
using ExcelAsyncWpf.ExcelOperator;
namespace ExcelAsyncWpf
{
public class ExcelAsyncWpfAddin : IExcelAddIn
{
public void AutoOpen()
{
ExcelIntegration.RegisterUnhandledExceptionHandler(globalErrorHandler);
ComServer.DllRegisterServer();
ExcelApp.AttachApplicationEvents();
}
public void AutoClose()
{
ComServer.DllUnregisterServer();
}
public object globalErrorHandler(object ex)
{
return ex.ToString();
}
}
}
| agpl-3.0 | C# |
621d94a30939269829303980022b1612f4f392c6 | Add Design Category for Property editors in PointLight.MaximumRadius | tainicom/Aether | Source/Core/Photons/PointLight.cs | Source/Core/Photons/PointLight.cs | #region License
// Copyright 2015 Kastellanos Nikolaos
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
#if WINDOWS
using tainicom.Aether.Design.Converters;
#endif
using System.ComponentModel;
using tainicom.Aether.Elementary.Photons;
using tainicom.Aether.Elementary.Serialization;
using Microsoft.Xna.Framework;
using tainicom.Aether.Elementary.Leptons;
namespace tainicom.Aether.Core.Photons
{
public class PointLight : ILightSource, IPosition, IAetherSerialization
{
public Vector3 Position { get; set; }
#if WINDOWS
[Category("Light"), TypeConverter(typeof(Vector3ColorWPGConverter))]
#endif
public Vector3 LightSourceColor { get; set; }
#if WINDOWS
[Category("Light")]
#endif
public float Intensity { get; set; }
#if WINDOWS
[Category("Light")]
#endif
public float MaximumRadius { get; set; }
public Vector3 PremultiplyColor { get { return this.LightSourceColor * this.Intensity; } }
public PointLight(): base()
{
LightSourceColor = Vector3.One;
Intensity = 1;
MaximumRadius = float.MaxValue;
}
#if(WINDOWS)
public virtual void Save(IAetherWriter writer)
{
writer.WriteVector3("Position", Position);
writer.WriteVector3("LightSourceColor", LightSourceColor);
writer.WriteFloat("Intensity", Intensity);
writer.WriteFloat("MaximumRadius", MaximumRadius);
}
#endif
public virtual void Load(IAetherReader reader)
{
string str; Vector3 v3; float f;
reader.ReadVector3("Position", out v3); Position = v3;
reader.ReadVector3("LightSourceColor", out v3); LightSourceColor = v3;
reader.ReadFloat("Intensity", out f); Intensity = f;
reader.ReadFloat("MaximumRadius", out f); MaximumRadius = f;
}
}
}
| #region License
// Copyright 2015 Kastellanos Nikolaos
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
#if WINDOWS
using tainicom.Aether.Design.Converters;
#endif
using System.ComponentModel;
using tainicom.Aether.Elementary.Photons;
using tainicom.Aether.Elementary.Serialization;
using Microsoft.Xna.Framework;
using tainicom.Aether.Elementary.Leptons;
namespace tainicom.Aether.Core.Photons
{
public class PointLight : ILightSource, IPosition, IAetherSerialization
{
public Vector3 Position { get; set; }
#if WINDOWS
[Category("Light"), TypeConverter(typeof(Vector3ColorWPGConverter))]
#endif
public Vector3 LightSourceColor { get; set; }
#if WINDOWS
[Category("Light")]
#endif
public float Intensity { get; set; }
public float MaximumRadius { get; set; }
public Vector3 PremultiplyColor { get { return this.LightSourceColor * this.Intensity; } }
public PointLight(): base()
{
LightSourceColor = Vector3.One;
Intensity = 1;
MaximumRadius = float.MaxValue;
}
#if(WINDOWS)
public virtual void Save(IAetherWriter writer)
{
writer.WriteVector3("Position", Position);
writer.WriteVector3("LightSourceColor", LightSourceColor);
writer.WriteFloat("Intensity", Intensity);
writer.WriteFloat("MaximumRadius", MaximumRadius);
}
#endif
public virtual void Load(IAetherReader reader)
{
string str; Vector3 v3; float f;
reader.ReadVector3("Position", out v3); Position = v3;
reader.ReadVector3("LightSourceColor", out v3); LightSourceColor = v3;
reader.ReadFloat("Intensity", out f); Intensity = f;
reader.ReadFloat("MaximumRadius", out f); MaximumRadius = f;
}
}
}
| apache-2.0 | C# |
3adea68113b3447b1ab6240db0d4b714ffb1713e | Fix resource key name PushPinTemplate | xjpeter/Xamarin.Forms,xjpeter/Xamarin.Forms,xjpeter/Xamarin.Forms,xjpeter/Xamarin.Forms,xjpeter/Xamarin.Forms,Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms | Xamarin.Forms.Maps.UWP/PushPin.cs | Xamarin.Forms.Maps.UWP/PushPin.cs | using System;
using System.ComponentModel;
using Windows.Devices.Geolocation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Maps;
using Windows.UI.Xaml.Input;
#if WINDOWS_UWP
namespace Xamarin.Forms.Maps.UWP
#else
namespace Xamarin.Forms.Maps.WinRT
#endif
{
internal class PushPin : ContentControl
{
readonly Pin _pin;
internal PushPin(Pin pin)
{
if (pin == null)
throw new ArgumentNullException();
ContentTemplate = Windows.UI.Xaml.Application.Current.Resources["PushPinTemplate"] as Windows.UI.Xaml.DataTemplate;
DataContext = Content = _pin = pin;
UpdateLocation();
Loaded += PushPinLoaded;
Unloaded += PushPinUnloaded;
Tapped += PushPinTapped;
}
void PushPinLoaded(object sender, RoutedEventArgs e)
{
_pin.PropertyChanged += PinPropertyChanged;
}
void PushPinUnloaded(object sender, RoutedEventArgs e)
{
_pin.PropertyChanged -= PinPropertyChanged;
Tapped -= PushPinTapped;
}
void PinPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == Pin.PositionProperty.PropertyName)
UpdateLocation();
}
void PushPinTapped(object sender, TappedRoutedEventArgs e)
{
_pin.SendTap();
}
void UpdateLocation()
{
var anchor = new Windows.Foundation.Point(0.65, 1);
var location = new Geopoint(new BasicGeoposition
{
Latitude = _pin.Position.Latitude,
Longitude = _pin.Position.Longitude
});
MapControl.SetLocation(this, location);
MapControl.SetNormalizedAnchorPoint(this, anchor);
}
}
} | using System;
using System.ComponentModel;
using Windows.Devices.Geolocation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Maps;
using Windows.UI.Xaml.Input;
#if WINDOWS_UWP
namespace Xamarin.Forms.Maps.UWP
#else
namespace Xamarin.Forms.Maps.WinRT
#endif
{
internal class PushPin : ContentControl
{
readonly Pin _pin;
internal PushPin(Pin pin)
{
if (pin == null)
throw new ArgumentNullException();
ContentTemplate = Windows.UI.Xaml.Application.Current.Resources["pushPinTemplate"] as Windows.UI.Xaml.DataTemplate;
DataContext = Content = _pin = pin;
UpdateLocation();
Loaded += PushPinLoaded;
Unloaded += PushPinUnloaded;
Tapped += PushPinTapped;
}
void PushPinLoaded(object sender, RoutedEventArgs e)
{
_pin.PropertyChanged += PinPropertyChanged;
}
void PushPinUnloaded(object sender, RoutedEventArgs e)
{
_pin.PropertyChanged -= PinPropertyChanged;
Tapped -= PushPinTapped;
}
void PinPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == Pin.PositionProperty.PropertyName)
UpdateLocation();
}
void PushPinTapped(object sender, TappedRoutedEventArgs e)
{
_pin.SendTap();
}
void UpdateLocation()
{
var anchor = new Windows.Foundation.Point(0.65, 1);
var location = new Geopoint(new BasicGeoposition
{
Latitude = _pin.Position.Latitude,
Longitude = _pin.Position.Longitude
});
MapControl.SetLocation(this, location);
MapControl.SetNormalizedAnchorPoint(this, anchor);
}
}
} | mit | C# |
fb1b7373bc28e6257fbcc150fb140754409ad687 | Fix System.NullReferenceException in MenuBackend.Popup. | hwthomas/xwt,mono/xwt,lytico/xwt,TheBrainTech/xwt,antmicro/xwt | Xwt.XamMac/Xwt.Mac/MenuBackend.cs | Xwt.XamMac/Xwt.Mac/MenuBackend.cs | //
// MenuBackend.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2011 Xamarin Inc
//
// 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 AppKit;
using CoreGraphics;
using Xwt.Backends;
namespace Xwt.Mac
{
public class MenuBackend: NSMenu, IMenuBackend
{
public void InitializeBackend (object frontend, ApplicationContext context)
{
AutoEnablesItems = false;
}
public void InsertItem (int index, IMenuItemBackend menuItem)
{
base.InsertItem (((MenuItemBackend)menuItem).Item, index);
}
public void RemoveItem (IMenuItemBackend menuItem)
{
RemoveItem (((MenuItemBackend)menuItem).Item);
}
public void SetMainMenuMode ()
{
for (int n=0; n<Count; n++) {
var it = ItemAt (n);
if (it.Menu != null)
it.Submenu.Title = it.Title;
}
}
public void EnableEvent (object eventId)
{
}
public void DisableEvent (object eventId)
{
}
public void Popup ()
{
var evt = NSApplication.SharedApplication.CurrentEvent;
if (evt != null)
NSMenu.PopUpContextMenu (this, evt, evt.Window.ContentView);
else if (MainWindow?.ContentView != null)
Popup (MainWindow.ContentView, MainWindow.MouseLocationOutsideOfEventStream);
}
public void Popup (IWidgetBackend widget, double x, double y)
{
Popup (((ViewBackend)widget).Widget, new CGPoint (x, y));
}
void Popup (NSView view, CGPoint point)
{
this.PopUpMenu (null, point, view);
}
NSWindow MainWindow {
get {
return NSApplication.SharedApplication.MainWindow;
}
}
object IMenuBackend.Font {
get {
return FontData.FromFont (Font);
}
set {
Font = ((FontData)value).Font;
}
}
}
}
| //
// MenuBackend.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2011 Xamarin Inc
//
// 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 AppKit;
using Xwt.Backends;
namespace Xwt.Mac
{
public class MenuBackend: NSMenu, IMenuBackend
{
public void InitializeBackend (object frontend, ApplicationContext context)
{
AutoEnablesItems = false;
}
public void InsertItem (int index, IMenuItemBackend menuItem)
{
base.InsertItem (((MenuItemBackend)menuItem).Item, index);
}
public void RemoveItem (IMenuItemBackend menuItem)
{
RemoveItem (((MenuItemBackend)menuItem).Item);
}
public void SetMainMenuMode ()
{
for (int n=0; n<Count; n++) {
var it = ItemAt (n);
if (it.Menu != null)
it.Submenu.Title = it.Title;
}
}
public void EnableEvent (object eventId)
{
}
public void DisableEvent (object eventId)
{
}
public void Popup ()
{
var evt = NSApplication.SharedApplication.CurrentEvent;
NSMenu.PopUpContextMenu (this, evt, evt.Window.ContentView);
}
public void Popup (IWidgetBackend widget, double x, double y)
{
NSMenu.PopUpContextMenu (this, NSApplication.SharedApplication.CurrentEvent, ((ViewBackend)widget).Widget);
}
object IMenuBackend.Font {
get {
return FontData.FromFont (Font);
}
set {
Font = ((FontData)value).Font;
}
}
}
}
| mit | C# |
026ffaa138c19cc9a21693b9b97f7364557b01ec | Update Const.cs | pelcointegrations/VxPDK-SimplePlugin | Plugin/Utilities/Const.cs | Plugin/Utilities/Const.cs | using CPPCli;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace PluginNs.Utilities
{
static class Const
{
public static readonly string LogFilePath = Path.Combine(Directory.GetParent(Assembly.GetCallingAssembly().Location).FullName,
"TestPlugin.txt");
public static readonly string PluginId = "__CREATE_UUID__";
public static readonly string PluginKey = "__ASK_PELCO_REPRESENTITIVE_partnerfirst@schneider-electric.com__";
public static readonly string VxSdkLogFilePath = Directory.GetParent(Assembly.GetCallingAssembly().Location).FullName;
public static readonly LogLevel.Value VxSdkLogLevel = LogLevel.Value.Debug;
public static readonly string VxSdkKey = "__GENERATE_VXSDK_KEY_FROM_External\Pelco\VxSdk-1.2\Tools\VxSdkKeyGen.exe__";
public static readonly string PersistentModel = "PersistentModel";
public static readonly string RegionMainView = "RegionMainView";
public static readonly string ILogger = "ILogger";
}
}
| using CPPCli;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace PluginNs.Utilities
{
static class Const
{
public static readonly string LogFilePath = Path.Combine(Directory.GetParent(Assembly.GetCallingAssembly().Location).FullName,
"TestPlugin.txt");
public static readonly string PluginId = "__CREATE_UUID__";
public static readonly string PluginKey = "__ASK_PELCO_REPRESENTITIVE__";
public static readonly string VxSdkLogFilePath = Directory.GetParent(Assembly.GetCallingAssembly().Location).FullName;
public static readonly LogLevel.Value VxSdkLogLevel = LogLevel.Value.Debug;
public static readonly string VxSdkKey = "__GENERATE_VXSDK_KEY_FROM_External\Pelco\VxSdk-1.2\Tools\VxSdkKeyGen.exe__";
public static readonly string PersistentModel = "PersistentModel";
public static readonly string RegionMainView = "RegionMainView";
public static readonly string ILogger = "ILogger";
}
}
| mit | C# |
6653b7d2a029ebb64d9db83f6ee192a6dcc339f7 | Remove send destroy message when clear subscribing, I will use clear subscribing function only when player disconnect or not ready, that will destroy all players characters and clear subscribing | insthync/LiteNetLibManager,insthync/LiteNetLibManager | Scripts/GameApi/LiteNetLibPlayer.cs | Scripts/GameApi/LiteNetLibPlayer.cs | using System.Collections;
using System.Collections.Generic;
using LiteNetLib;
namespace LiteNetLibHighLevel
{
public class LiteNetLibPlayer
{
public LiteNetLibGameManager Manager { get; protected set; }
public NetPeer Peer { get; protected set; }
public long ConnectId { get { return Peer.ConnectId; } }
internal bool IsReady { get; set; }
internal readonly HashSet<LiteNetLibIdentity> SubscribingObjects = new HashSet<LiteNetLibIdentity>();
internal readonly Dictionary<uint, LiteNetLibIdentity> SpawnedObjects = new Dictionary<uint, LiteNetLibIdentity>();
public LiteNetLibPlayer(LiteNetLibGameManager manager, NetPeer peer)
{
Manager = manager;
Peer = peer;
}
internal void AddSubscribing(LiteNetLibIdentity identity)
{
SubscribingObjects.Add(identity);
Manager.SendServerSpawnObjectWithData(Peer, identity);
}
internal void RemoveSubscribing(LiteNetLibIdentity identity, bool destroyObjectsOnPeer)
{
SubscribingObjects.Remove(identity);
if (destroyObjectsOnPeer)
Manager.SendServerDestroyObject(Peer, identity.ObjectId);
}
internal void ClearSubscribing()
{
// Remove this from identities subscriber list
foreach (var identity in SubscribingObjects)
{
// Don't call for remove subscribing
// because it's going to clear in this function
identity.RemoveSubscriber(this, false);
}
SubscribingObjects.Clear();
}
/// <summary>
/// Call this function to destroy all objects that spawned by this player
/// </summary>
internal void DestroyAllObjects()
{
var objectIds = new List<uint>(SpawnedObjects.Keys);
foreach (var objectId in objectIds)
Manager.Assets.NetworkDestroy(objectId);
}
}
}
| using System.Collections;
using System.Collections.Generic;
using LiteNetLib;
namespace LiteNetLibHighLevel
{
public class LiteNetLibPlayer
{
public LiteNetLibGameManager Manager { get; protected set; }
public NetPeer Peer { get; protected set; }
public long ConnectId { get { return Peer.ConnectId; } }
internal bool IsReady { get; set; }
internal readonly HashSet<LiteNetLibIdentity> SubscribingObjects = new HashSet<LiteNetLibIdentity>();
internal readonly Dictionary<uint, LiteNetLibIdentity> SpawnedObjects = new Dictionary<uint, LiteNetLibIdentity>();
public LiteNetLibPlayer(LiteNetLibGameManager manager, NetPeer peer)
{
Manager = manager;
Peer = peer;
}
internal void AddSubscribing(LiteNetLibIdentity identity)
{
SubscribingObjects.Add(identity);
Manager.SendServerSpawnObjectWithData(Peer, identity);
}
internal void RemoveSubscribing(LiteNetLibIdentity identity, bool destroyObjectsOnPeer)
{
SubscribingObjects.Remove(identity);
if (destroyObjectsOnPeer)
Manager.SendServerDestroyObject(Peer, identity.ObjectId);
}
internal void ClearSubscribing(bool destroyObjectsOnPeer)
{
// Remove this from identities subscriber list
foreach (var identity in SubscribingObjects)
{
// Don't call for remove subscribing
// because it's going to clear in this function
identity.RemoveSubscriber(this, false);
if (destroyObjectsOnPeer)
Manager.SendServerDestroyObject(Peer, identity.ObjectId);
}
SubscribingObjects.Clear();
}
/// <summary>
/// Call this function to destroy all objects that spawned by this player
/// </summary>
internal void DestroyAllObjects()
{
var objectIds = new List<uint>(SpawnedObjects.Keys);
foreach (var objectId in objectIds)
Manager.Assets.NetworkDestroy(objectId);
}
}
}
| mit | C# |
c64d82f4b81dfe17e17cf5f5d8730ae214f04c72 | add comment about token | tropo/tropo-webapi-csharp,tropo/tropo-webapi-csharp | TropoSample/TropoInboundSMS.aspx.cs | TropoSample/TropoInboundSMS.aspx.cs | using System;
using System.IO;
using Newtonsoft.Json;
using TropoCSharp.Tropo;
using System.Web.UI;
using TropoCSharp.Structs;
using System.Web;
using System.Xml;
using System.Collections.Generic;
namespace TropoSamples
{
/// <summary>
/// A simple example showing how to access properties of the Session object.
/// </summary>
public partial class TropoInboundSMS : Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (StreamReader reader = new StreamReader(Request.InputStream))
{
// Get the JSON submitted from Tropo.
string sessionJSON = TropoUtilities.parseJSON(reader);
// Create a new instance of the Tropo class.
Tropo tropo = new Tropo();
// Create a new Session object and pass in the JSON submitted from Tropo.
Session tropoSession = new Session(sessionJSON);
// Create an XML doc to hold the response from the Tropo Session API.
XmlDocument doc = new XmlDocument();
string token = "584c466166734645667651785355666c7652564c495756676c4c664e786976415655584e6741525155536b6c"; // the app's voice token (app's url is SUP3160startCall.aspx)
// A collection to hold the parameters we want to send to the Tropo Session API.
IDictionary<string, string> parameters = new Dictionary<String, String>();
// Enter a phone number to send a call or SMS message to here.
parameters.Add("numberToDial", "+8613466549249");
parameters.Add("textMessageBody", tropoSession.InitialText);
doc.Load(tropo.CreateSession(token, parameters));
}
}
}
}
| using System;
using System.IO;
using Newtonsoft.Json;
using TropoCSharp.Tropo;
using System.Web.UI;
using TropoCSharp.Structs;
using System.Web;
using System.Xml;
using System.Collections.Generic;
namespace TropoSamples
{
/// <summary>
/// A simple example showing how to access properties of the Session object.
/// </summary>
public partial class TropoInboundSMS : Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (StreamReader reader = new StreamReader(Request.InputStream))
{
// Get the JSON submitted from Tropo.
string sessionJSON = TropoUtilities.parseJSON(reader);
// Create a new instance of the Tropo class.
Tropo tropo = new Tropo();
// Create a new Session object and pass in the JSON submitted from Tropo.
Session tropoSession = new Session(sessionJSON);
// Create an XML doc to hold the response from the Tropo Session API.
XmlDocument doc = new XmlDocument();
string token = "584c466166734645667651785355666c7652564c495756676c4c664e786976415655584e6741525155536b6c";
// A collection to hold the parameters we want to send to the Tropo Session API.
IDictionary<string, string> parameters = new Dictionary<String, String>();
// Enter a phone number to send a call or SMS message to here.
parameters.Add("numberToDial", "+8613466549249");
parameters.Add("textMessageBody", tropoSession.InitialText);
doc.Load(tropo.CreateSession(token, parameters));
}
}
}
}
| mit | C# |
040f24be75ae1a5c033f0791becdb957f9cf6460 | bump version number | nickdurcholz/arguments-parser | AssemblyVersionInfo.cs | AssemblyVersionInfo.cs | using System.Reflection;
[assembly: AssemblyVersion(Constants.AssemblyVersion)]
[assembly: AssemblyFileVersion(Constants.AssemblyVersion)]
[assembly: AssemblyInformationalVersion(Constants.AssemblyVersion)]
internal class Constants
{
public const string AssemblyVersion = "1.0.1.0";
} | using System.Reflection;
[assembly: AssemblyVersion(Constants.AssemblyVersion)]
[assembly: AssemblyFileVersion(Constants.AssemblyVersion)]
[assembly: AssemblyInformationalVersion(Constants.AssemblyVersion)]
internal class Constants
{
public const string AssemblyVersion = "1.0.0.0";
} | mit | C# |
0333fbbaae104ce6c234d876286cbbd77b72765b | bump version | ulrichb/NullGuard,Fody/NullGuard,shana/NullGuard | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("NullGuard")]
[assembly: AssemblyProduct("NullGuard")]
[assembly: AssemblyVersion("0.6.0.0")]
[assembly: AssemblyFileVersion("0.6.0.0")]
| using System.Reflection;
[assembly: AssemblyTitle("NullGuard")]
[assembly: AssemblyProduct("NullGuard")]
[assembly: AssemblyVersion("0.5.1.2")]
[assembly: AssemblyFileVersion("0.5.1.2")]
| mit | C# |
f017216bd59ae5b3fb825afaf04a6fdab0ffc2d5 | bump version | 0x53A/PropertyChanged,Fody/PropertyChanged,user1568891/PropertyChanged | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("PropertyChanged")]
[assembly: AssemblyProduct("PropertyChanged")]
[assembly: AssemblyVersion("1.33.1.0")]
[assembly: AssemblyFileVersion("1.33.1.0")]
| using System.Reflection;
[assembly: AssemblyTitle("PropertyChanged")]
[assembly: AssemblyProduct("PropertyChanged")]
[assembly: AssemblyVersion("1.33.0.0")]
[assembly: AssemblyFileVersion("1.33.0.0")]
| mit | C# |
dab767beb0e5f930de8e68a2e71bc4e591f41dfc | test avec le graph | maloromano/enigmos,AurelieWasem/enigmos,misterkonik/enigmos,SteeveDroz/enigmos,Mozerskial/enigmos,OwenGombas/enigmos,AdrienPeguiron/enigmos,CPLN/enigmos,danydacosta/enigmos,Sandozor/enigmos,AnaKamelia/enigmos,DiavoloKingCrimson/enigmos,DarmangerDavid/enigmos,damienschindler/enigmos,VincentRime/enigmos | Enigmas/LabyrintheEnigmaPanel.cs | Enigmas/LabyrintheEnigmaPanel.cs | using Cpln.Enigmos.Enigmas.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Cpln.Enigmos.Enigmas
{
/// <summary>
/// Panel affichant une énigme.
/// </summary>
public class LabyrintheEnigmaPanel : EnigmaPanel
{
List<Panel> Case;
private void test()
{
Panel test = new Panel();
test.Name = "test1";
Case.Add(test);
test.Width = 50;
test.Height = 50;
test.BackColor = Color.Red;
this.Controls.Add(test);
}
public LabyrintheEnigmaPanel()
{
Graph<Panel> graph = new Graph<Panel>(new Panel());
Case = new List<Panel>();
test();
graph.Root.Element = Case[0];
graph.Root.FindNeighbor(Case[0]);
graph.Root.AddNeighbor(Case[0]);
}
}
}
| using Cpln.Enigmos.Enigmas.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Cpln.Enigmos.Enigmas
{
/// <summary>
/// Panel affichant une énigme.
/// </summary>
public class LabyrintheEnigmaPanel : EnigmaPanel
{
public LabyrintheEnigmaPanel()
{
Graph<Panel> graph = new Graph<Panel>(new Panel());
graph.Root.Element.Size = new Size (50, 50);
}
}
}
| mit | C# |
3412c598caa6b08095bc02e4a770069950c284a5 | Allow to encode/decode the registry | babelmark/babelmark-proxy | EncryptApp/Program.cs | EncryptApp/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using BabelMark;
using Newtonsoft.Json;
namespace EncryptApp
{
class Program
{
static int Main(string[] args)
{
if (args.Length != 2)
{
Console.WriteLine("Usage: passphrase decode|encode");
return 1;
}
if (!(args[1] == "decode" || args[1] == "encode"))
{
Console.WriteLine("Usage: passphrase decode|encode");
Console.WriteLine($"Invalid argument ${args[1]}");
return 1;
}
var encode = args[1] == "encode";
Environment.SetEnvironmentVariable(MarkdownRegistry.PassphraseEnv, args[0]);
var entries = MarkdownRegistry.Instance.GetEntriesAsync().Result;
foreach (var entry in entries)
{
if (encode)
{
var originalUrl = entry.Url;
entry.Url = StringCipher.Encrypt(entry.Url, args[0]);
var testDecrypt = StringCipher.Decrypt(entry.Url, args[0]);
if (originalUrl != testDecrypt)
{
Console.WriteLine("Unexpected error while encrypt/decrypt. Not matching");
return 1;
}
}
}
Console.WriteLine(JsonConvert.SerializeObject(entries, Formatting.Indented));
return 0;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using BabelMark;
using Newtonsoft.Json;
namespace EncryptApp
{
class Program
{
static int Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("Usage: passphrase");
return 1;
}
Environment.SetEnvironmentVariable(MarkdownRegistry.PassphraseEnv, args[0]);
var entries = MarkdownRegistry.Instance.GetEntriesAsync().Result;
foreach (var entry in entries)
{
if (!entry.Url.StartsWith("http"))
{
entry.Url = StringCipher.Decrypt(entry.Url, args[0]);
}
else
{
var originalUrl = entry.Url;
entry.Url = StringCipher.Encrypt(entry.Url, args[0]);
var testDecrypt = StringCipher.Decrypt(entry.Url, args[0]);
if (originalUrl != testDecrypt)
{
Console.WriteLine("Unexpected error while encrypt/decrypt. Not matching");
return 1;
}
}
}
Console.WriteLine(JsonConvert.SerializeObject(entries, Formatting.Indented));
return 0;
}
}
}
| bsd-2-clause | C# |
aa87271b713ab69ac45164ebae85cc78f772cd27 | Test de Catalogo de Forfait | avifatal/framework,avifatal/framework,signumsoftware/framework,AlejandroCano/framework,signumsoftware/framework,AlejandroCano/framework | Signum.Test/LinqProvider/Assert2.cs | Signum.Test/LinqProvider/Assert2.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Signum.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Signum.Test.Properties;
using System.Linq.Expressions;
namespace Signum.Test
{
public static class Assert2
{
public static void Throws<T>(Action action)
where T : Exception
{
try
{
action();
}
catch (T)
{
return;
}
throw new AssertFailedException(Resources.No0HasBeenThrown.Formato(typeof(T).Name));
}
public static void Throws<T>(Action action, string messageToContain)
where T : Exception
{
try
{
action();
}
catch (T ex)
{
if(!ex.Message.Contains(messageToContain))
throw new AssertFailedException(Resources.ExceptionThrownDoesNotContainMessage0.Formato(ex.Message));
return;
}
throw new AssertFailedException(Resources.No0HasBeenThrown.Formato(typeof(T).Name));
}
public static void AssertAll<T>(this IEnumerable<T> collection, Expression<Func<T, bool>> predicate)
{
foreach (var item in collection)
{
if (!predicate.Invoke(item))
Assert.Fail("'{0}' fails on '{1}'".Formato(item, predicate.NiceToString()));
}
}
public static void AssertContains<T>(this IEnumerable<T> collection, params T[] elements)
{
var hs = collection.ToHashSet();
string notFound = elements.Where(a => !hs.Contains(a)).CommaAnd();
if (notFound.HasText())
Assert.Fail("{0} not found".Formato(notFound));
}
public static void AssertExactly<T>(this IEnumerable<T> collection, params T[] elements)
{
var hs = collection.ToHashSet();
string notFound = elements.Where(a => !hs.Contains(a)).CommaAnd();
string exceeded = hs.Where(a => elements.Contains(a)).CommaAnd(); ;
if (notFound.HasText() && exceeded.HasText())
Assert.Fail("{0} not found and {1} exceeded".Formato(notFound, exceeded));
if(notFound.HasText())
Assert.Fail("{0} not found".Formato(notFound));
if (exceeded.HasText())
Assert.Fail("{0} exceeded".Formato(exceeded));
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Signum.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Signum.Test.Properties;
namespace Signum.Test
{
public static class Assert2
{
public static void Throws<T>(Action action)
where T : Exception
{
try
{
action();
}
catch (T)
{
return;
}
throw new AssertFailedException(Resources.No0HasBeenThrown.Formato(typeof(T).Name));
}
public static void Throws<T>(Action action, string messageToContain)
where T : Exception
{
try
{
action();
}
catch (T ex)
{
if(!ex.Message.Contains(messageToContain))
throw new AssertFailedException(Resources.ExceptionThrownDoesNotContainMessage0.Formato(ex.Message));
return;
}
throw new AssertFailedException(Resources.No0HasBeenThrown.Formato(typeof(T).Name));
}
}
}
| mit | C# |
ce3e887a4cd38f33d9ef78289529d35d47b65d5a | Add picker to UsageSampleMvc | billboga/stuntman,khalidabuhakmeh/stuntman,hougasian/stuntman,ritterim/stuntman,billbogaiv/stuntman,billboga/stuntman | samples/UsageSampleMvc/Views/Shared/_Layout.cshtml | samples/UsageSampleMvc/Views/Shared/_Layout.cshtml | @using RimDev.Stuntman.Core;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/Content/Site.css" />
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
@if (HttpContext.Current.IsDebuggingEnabled)
{
var stuntmanOptions = new StuntmanOptions()
.AddUser(new StuntmanUser("user-1", "User 1"));
@Html.Raw(new UserPicker(stuntmanOptions).GetHtml(User, Request.RawUrl));
}
</div>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/mvc/5.2.3/jquery.validate.unobtrusive.min.js"></script>
@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 - My ASP.NET Application</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/Content/Site.css" />
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/mvc/5.2.3/jquery.validate.unobtrusive.min.js"></script>
@RenderSection("scripts", required: false)
</body>
</html>
| mit | C# |
83bfd36498dcb30d2ad8e22184ab56504a9968d4 | Disable broken taiko hitsound fallback tests for now | peppy/osu,ppy/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,ppy/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,NeoAdonis/osu | osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoHitObjectSamples.cs | osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoHitObjectSamples.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.Reflection;
using NUnit.Framework;
using osu.Framework.IO.Stores;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Taiko.Tests
{
public class TestSceneTaikoHitObjectSamples : HitObjectSampleTest
{
protected override Ruleset CreatePlayerRuleset() => new TaikoRuleset();
protected override IResourceStore<byte[]> RulesetResources => new DllResourceStore(Assembly.GetAssembly(typeof(TestSceneTaikoHitObjectSamples)));
[TestCase("taiko-normal-hitnormal")]
[TestCase("normal-hitnormal")]
// [TestCase("hitnormal")] intentionally broken (will play classic default instead).
public void TestDefaultCustomSampleFromBeatmap(string expectedSample)
{
SetupSkins(expectedSample, expectedSample);
CreateTestWithBeatmap("taiko-hitobject-beatmap-custom-sample-bank.osu");
AssertBeatmapLookup(expectedSample);
}
[TestCase("taiko-normal-hitnormal")]
[TestCase("normal-hitnormal")]
// [TestCase("hitnormal")] intentionally broken (will play classic default instead).
public void TestDefaultCustomSampleFromUserSkinFallback(string expectedSample)
{
SetupSkins(string.Empty, expectedSample);
CreateTestWithBeatmap("taiko-hitobject-beatmap-custom-sample-bank.osu");
AssertUserLookup(expectedSample);
}
[TestCase("taiko-normal-hitnormal2")]
[TestCase("normal-hitnormal2")]
public void TestUserSkinLookupIgnoresSampleBank(string unwantedSample)
{
SetupSkins(string.Empty, unwantedSample);
CreateTestWithBeatmap("taiko-hitobject-beatmap-custom-sample-bank.osu");
AssertNoLookup(unwantedSample);
}
}
}
| // 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.Reflection;
using NUnit.Framework;
using osu.Framework.IO.Stores;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Taiko.Tests
{
public class TestSceneTaikoHitObjectSamples : HitObjectSampleTest
{
protected override Ruleset CreatePlayerRuleset() => new TaikoRuleset();
protected override IResourceStore<byte[]> RulesetResources => new DllResourceStore(Assembly.GetAssembly(typeof(TestSceneTaikoHitObjectSamples)));
[TestCase("taiko-normal-hitnormal")]
[TestCase("normal-hitnormal")]
[TestCase("hitnormal")]
public void TestDefaultCustomSampleFromBeatmap(string expectedSample)
{
SetupSkins(expectedSample, expectedSample);
CreateTestWithBeatmap("taiko-hitobject-beatmap-custom-sample-bank.osu");
AssertBeatmapLookup(expectedSample);
}
[TestCase("taiko-normal-hitnormal")]
[TestCase("normal-hitnormal")]
[TestCase("hitnormal")]
public void TestDefaultCustomSampleFromUserSkinFallback(string expectedSample)
{
SetupSkins(string.Empty, expectedSample);
CreateTestWithBeatmap("taiko-hitobject-beatmap-custom-sample-bank.osu");
AssertUserLookup(expectedSample);
}
[TestCase("taiko-normal-hitnormal2")]
[TestCase("normal-hitnormal2")]
public void TestUserSkinLookupIgnoresSampleBank(string unwantedSample)
{
SetupSkins(string.Empty, unwantedSample);
CreateTestWithBeatmap("taiko-hitobject-beatmap-custom-sample-bank.osu");
AssertNoLookup(unwantedSample);
}
}
}
| mit | C# |
e38fa94cfdfb77194102dd399a0068a85b0dc7a7 | Fix ImportCecilTest::ImportGenericMethod | gluck/cecil,joj/cecil,jbevain/cecil,furesoft/cecil,mono/cecil,saynomoo/cecil,SiliconStudio/Mono.Cecil,fnajera-rac-de/cecil,xen2/cecil,cgourlay/cecil,ttRevan/cecil,sailro/cecil,kzu/cecil | Test/Mono.Cecil.Tests/Extensions.cs | Test/Mono.Cecil.Tests/Extensions.cs | using System;
using System.Linq;
using SR = System.Reflection;
using Mono.Cecil;
namespace Mono.Cecil.Tests {
public static class Extensions {
public static MethodDefinition GetMethod (this TypeDefinition self, string name)
{
return self.Methods.Where (m => m.Name == name).First ();
}
public static FieldDefinition GetField (this TypeDefinition self, string name)
{
return self.Fields.Where (f => f.Name == name).First ();
}
public static TypeDefinition ToDefinition (this Type self)
{
var module = ModuleDefinition.ReadModule (self.Module.FullyQualifiedName);
return (TypeDefinition) TypeParser.ParseType (module, self.FullName);
}
public static MethodDefinition ToDefinition (this SR.MethodBase method)
{
var declaring_type = method.DeclaringType.ToDefinition ();
return (MethodDefinition) declaring_type.Module.LookupToken (method.MetadataToken);
}
public static FieldDefinition ToDefinition (this SR.FieldInfo field)
{
var declaring_type = field.DeclaringType.ToDefinition ();
return (FieldDefinition) declaring_type.Module.LookupToken (field.MetadataToken);
}
public static TypeReference MakeGenericType (this TypeReference self, params TypeReference [] arguments)
{
if (self.GenericParameters.Count != arguments.Length)
throw new ArgumentException ();
var instance = new GenericInstanceType (self);
foreach (var argument in arguments)
instance.GenericArguments.Add (argument);
return instance;
}
public static MethodReference MakeGenericMethod (this MethodReference self, params TypeReference [] arguments)
{
if (self.GenericParameters.Count != arguments.Length)
throw new ArgumentException ();
var instance = new GenericInstanceMethod (self);
foreach (var argument in arguments)
instance.GenericArguments.Add (argument);
return instance;
}
public static MethodReference MakeGeneric (this MethodReference self, params TypeReference [] arguments)
{
var reference = new MethodReference {
Name = self.Name,
DeclaringType = self.DeclaringType.MakeGenericType (arguments),
HasThis = self.HasThis,
ExplicitThis = self.ExplicitThis,
ReturnType = self.ReturnType,
CallingConvention = self.CallingConvention,
};
foreach (var parameter in self.Parameters)
reference.Parameters.Add (new ParameterDefinition (parameter.ParameterType));
foreach (var generic_parameter in self.GenericParameters)
reference.GenericParameters.Add (new GenericParameter (generic_parameter.Name, reference));
return reference;
}
public static FieldReference MakeGeneric (this FieldReference self, params TypeReference [] arguments)
{
return new FieldReference {
Name = self.Name,
DeclaringType = self.DeclaringType.MakeGenericType (arguments),
FieldType = self.FieldType,
};
}
}
}
| using System;
using System.Linq;
using SR = System.Reflection;
using Mono.Cecil;
namespace Mono.Cecil.Tests {
public static class Extensions {
public static MethodDefinition GetMethod (this TypeDefinition self, string name)
{
return self.Methods.Where (m => m.Name == name).First ();
}
public static FieldDefinition GetField (this TypeDefinition self, string name)
{
return self.Fields.Where (f => f.Name == name).First ();
}
public static TypeDefinition ToDefinition (this Type self)
{
var module = ModuleDefinition.ReadModule (self.Module.FullyQualifiedName);
return (TypeDefinition) TypeParser.ParseType (module, self.FullName);
}
public static MethodDefinition ToDefinition (this SR.MethodBase method)
{
var declaring_type = method.DeclaringType.ToDefinition ();
return (MethodDefinition) declaring_type.Module.LookupToken (method.MetadataToken);
}
public static FieldDefinition ToDefinition (this SR.FieldInfo field)
{
var declaring_type = field.DeclaringType.ToDefinition ();
return (FieldDefinition) declaring_type.Module.LookupToken (field.MetadataToken);
}
public static TypeReference MakeGenericType (this TypeReference self, params TypeReference [] arguments)
{
if (self.GenericParameters.Count != arguments.Length)
throw new ArgumentException ();
var instance = new GenericInstanceType (self);
foreach (var argument in arguments)
instance.GenericArguments.Add (argument);
return instance;
}
public static MethodReference MakeGenericMethod (this MethodReference self, params TypeReference [] arguments)
{
if (self.GenericParameters.Count != arguments.Length)
throw new ArgumentException ();
var instance = new GenericInstanceMethod (self);
foreach (var argument in arguments)
instance.GenericArguments.Add (argument);
return instance;
}
public static MethodReference MakeGeneric (this MethodReference self, params TypeReference [] arguments)
{
var reference = new MethodReference {
Name = self.Name,
DeclaringType = self.DeclaringType.MakeGenericType (arguments),
HasThis = self.HasThis,
ExplicitThis = self.ExplicitThis,
ReturnType = self.ReturnType,
CallingConvention = MethodCallingConvention.Generic,
};
foreach (var parameter in self.Parameters)
reference.Parameters.Add (new ParameterDefinition (parameter.ParameterType));
foreach (var generic_parameter in self.GenericParameters)
reference.GenericParameters.Add (new GenericParameter (generic_parameter.Name, reference));
return reference;
}
public static FieldReference MakeGeneric (this FieldReference self, params TypeReference [] arguments)
{
return new FieldReference {
Name = self.Name,
DeclaringType = self.DeclaringType.MakeGenericType (arguments),
FieldType = self.FieldType,
};
}
}
}
| mit | C# |
4c3e960221ffb95da3efbfdcb8162230fee58593 | Update AnnotationVisibilityType.cs (#263) | EncompassRest/EncompassRest,hfcjweinstock/EncompassREST | src/EncompassRest/Loans/Attachments/AnnotationVisibilityType.cs | src/EncompassRest/Loans/Attachments/AnnotationVisibilityType.cs | namespace EncompassRest.Loans.Attachments
{
/// <summary>
/// AnnotationVisibilityType
/// </summary>
public enum AnnotationVisibilityType
{
/// <summary>
/// Public (Default. Viewable by everyone and is sent as part of documents.)
/// </summary>
Public = 0,
/// <summary>
/// Internal (Viewable by any person with Encompass permissions to view annotations.)
/// </summary>
Internal = 1,
/// <summary>
/// Personal (Viewable by the user who added it.)
/// </summary>
Personal = 2
}
}
| namespace EncompassRest.Loans.Attachments
{
/// <summary>
/// AnnotationVisibilityType
/// </summary>
public enum AnnotationVisibilityType
{
/// <summary>
/// Public (Default. Viewable by the user who added it.)
/// </summary>
Public = 0,
/// <summary>
/// Internal (Viewable by any person with Encompass permissions to view annotations.)
/// </summary>
Internal = 1,
/// <summary>
/// Personal (Viewable by everyone and is sent as part of documents.)
/// </summary>
Personal = 2
}
} | mit | C# |
f2d3110729b052da68062e971f0d70533258dc7b | Switch to FirefoxDriver due to instability of PhantomJS headless testing. | jwaliszko/ExpressiveAnnotations,JaroslawWaliszko/ExpressiveAnnotations,JaroslawWaliszko/ExpressiveAnnotations,jwaliszko/ExpressiveAnnotations,jwaliszko/ExpressiveAnnotations,jwaliszko/ExpressiveAnnotations,JaroslawWaliszko/ExpressiveAnnotations,JaroslawWaliszko/ExpressiveAnnotations | src/ExpressiveAnnotations.MvcWebSample.UITests/DriverFixture.cs | src/ExpressiveAnnotations.MvcWebSample.UITests/DriverFixture.cs | using System;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.PhantomJS;
using OpenQA.Selenium.Remote;
namespace ExpressiveAnnotations.MvcWebSample.UITests
{
public class DriverFixture : IDisposable
{
public DriverFixture() // called before every test class
{
//var service = PhantomJSDriverService.CreateDefaultService();
//service.IgnoreSslErrors = true;
//service.WebSecurity = false;
//var options = new PhantomJSOptions();
//Driver = new PhantomJSDriver(service, options, TimeSpan.FromSeconds(15)); // headless browser testing
Driver = new FirefoxDriver();
}
public RemoteWebDriver Driver { get; private set; }
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (Driver != null)
{
Driver.Quit();
Driver = null;
}
}
}
public void Dispose() // called after every test class
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}
| using System;
using OpenQA.Selenium.PhantomJS;
using OpenQA.Selenium.Remote;
namespace ExpressiveAnnotations.MvcWebSample.UITests
{
public class DriverFixture : IDisposable
{
public DriverFixture() // called before every test class
{
var service = PhantomJSDriverService.CreateDefaultService();
service.IgnoreSslErrors = true;
service.WebSecurity = false;
var options = new PhantomJSOptions();
Driver = new PhantomJSDriver(service, options, TimeSpan.FromSeconds(15)); // headless browser testing
}
public RemoteWebDriver Driver { get; private set; }
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (Driver != null)
{
Driver.Quit();
Driver = null;
}
}
}
public void Dispose() // called after every test class
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}
| mit | C# |
7a885dc2cd5bf7842d33ba26b402e81a7b988ae1 | Update Index.cshtml | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Home/Index.cshtml | Anlab.Mvc/Views/Home/Index.cshtml | @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: September 30, 2020<br /><br />
In response to the emergency need for the analysis of wine for smoke taint,
the UC Davis Department of Viticulture and Enology is partnering with the UC Davis Analytical Lab to offer testing<br /><br />
Please click <a href="https://anlab.ucdavis.edu/media/pdf/anlab_smoke-taint_instructions.pdf" target="_blank">here for more information</a>.
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
| @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: July 10, 2020<br /><br />
We are open and receiving samples during normal business hours.<br /><br />
Please be safe!
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
| mit | C# |
ce0064bb6de10bc8d4b8efccb47a4d96f62fe9e4 | Change OSX arch names. | Chaser324/unity-build | Editor/Build/Platform/BuildOSX.cs | Editor/Build/Platform/BuildOSX.cs | using UnityEditor;
namespace SuperSystems.UnityBuild
{
[System.Serializable]
public class BuildOSX : BuildPlatform
{
#region Constants
private const string _name = "OSX";
private const string _binaryNameFormat = "{0}.app";
private const string _dataDirNameFormat = "{0}.app/Contents";
private const BuildTargetGroup _targetGroup = BuildTargetGroup.Standalone;
#endregion
public BuildOSX()
{
enabled = false;
platformName = _name;
architectures = new BuildArchitecture[] {
new BuildArchitecture(BuildTarget.StandaloneOSXUniversal, "OSX Universal", true),
new BuildArchitecture(BuildTarget.StandaloneOSXIntel, "OSX Intel", false),
new BuildArchitecture(BuildTarget.StandaloneOSXIntel64, "OSX Intel64", false)
};
}
}
} | using UnityEditor;
namespace SuperSystems.UnityBuild
{
[System.Serializable]
public class BuildOSX : BuildPlatform
{
#region Constants
private const string _name = "OSX";
private const string _binaryNameFormat = "{0}.app";
private const string _dataDirNameFormat = "{0}.app/Contents";
private const BuildTargetGroup _targetGroup = BuildTargetGroup.Standalone;
#endregion
public BuildOSX()
{
enabled = false;
platformName = _name;
architectures = new BuildArchitecture[] {
new BuildArchitecture(BuildTarget.StandaloneOSXUniversal, "OSX Universal", true),
new BuildArchitecture(BuildTarget.StandaloneOSXIntel, "OSX x86", false),
new BuildArchitecture(BuildTarget.StandaloneOSXIntel64, "OSX x64", false)
};
}
}
} | mit | C# |
55e820806f8745d850a1c05ba70100ee0d94e037 | Set the default InsensitiveBorderEndLength to 0. | PenguinF/sandra-three | Eutherion/Win/Forms/SnapHelper.cs | Eutherion/Win/Forms/SnapHelper.cs | #region License
/*********************************************************************************
* SnapHelper.cs
*
* Copyright (c) 2004-2020 Henk Nicolai
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************************/
#endregion
using System.ComponentModel;
namespace Eutherion.Win.Forms
{
/// <summary>
/// Modifies a Form's behavior, such that it snaps to other forms.
/// </summary>
public abstract class SnapHelper
{
/// <summary>
/// Gets the default value for the <see cref="MaxSnapDistance"/> property.
/// </summary>
public const int DefaultMaxSnapDistance = 4;
/// <summary>
/// Gets or sets the maximum distance between form edges within which they will be sensitive to snapping together. The default value is <see cref="DefaultMaxSnapDistance"/> (4).
/// </summary>
[DefaultValue(DefaultMaxSnapDistance)]
public int MaxSnapDistance { get; set; } = DefaultMaxSnapDistance;
/// <summary>
/// Gets the default value for the <see cref="InsensitiveBorderEndLength"/> property.
/// </summary>
public const int DefaultInsensitiveBorderEndLength = 0;
/// <summary>
/// Gets or sets the length of the ends of the borders of the form that are insensitive to snapping. The default value is <see cref="DefaultInsensitiveBorderEndLength"/> (0).
/// </summary>
[DefaultValue(DefaultInsensitiveBorderEndLength)]
public int InsensitiveBorderEndLength { get; set; } = DefaultInsensitiveBorderEndLength;
/// <summary>
/// Gets or sets if the form will snap to other forms while it's being moved. The default value is true.
/// </summary>
public bool SnapWhileMoving { get; set; } = true;
/// <summary>
/// Gets or sets if the form will snap to other forms while it's being resized. The default value is true.
/// </summary>
public bool SnapWhileResizing { get; set; } = true;
/// <summary>
/// Gets the <see cref="ConstrainedMoveResizeForm"/> with the snapping behavior.
/// </summary>
public ConstrainedMoveResizeForm Form { get; }
protected SnapHelper(ConstrainedMoveResizeForm form) => Form = form;
}
}
| #region License
/*********************************************************************************
* SnapHelper.cs
*
* Copyright (c) 2004-2020 Henk Nicolai
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************************/
#endregion
using System.ComponentModel;
namespace Eutherion.Win.Forms
{
/// <summary>
/// Modifies a Form's behavior, such that it snaps to other forms.
/// </summary>
public abstract class SnapHelper
{
/// <summary>
/// Gets the default value for the <see cref="MaxSnapDistance"/> property.
/// </summary>
public const int DefaultMaxSnapDistance = 4;
/// <summary>
/// Gets or sets the maximum distance between form edges within which they will be sensitive to snapping together. The default value is <see cref="DefaultMaxSnapDistance"/> (4).
/// </summary>
[DefaultValue(DefaultMaxSnapDistance)]
public int MaxSnapDistance { get; set; } = DefaultMaxSnapDistance;
/// <summary>
/// Gets the default value for the <see cref="InsensitiveBorderEndLength"/> property.
/// </summary>
public const int DefaultInsensitiveBorderEndLength = 16;
/// <summary>
/// Gets or sets the length of the ends of the borders of the form that are insensitive to snapping. The default value is <see cref="DefaultInsensitiveBorderEndLength"/> (16).
/// </summary>
[DefaultValue(DefaultInsensitiveBorderEndLength)]
public int InsensitiveBorderEndLength { get; set; } = DefaultInsensitiveBorderEndLength;
/// <summary>
/// Gets or sets if the form will snap to other forms while it's being moved. The default value is true.
/// </summary>
public bool SnapWhileMoving { get; set; } = true;
/// <summary>
/// Gets or sets if the form will snap to other forms while it's being resized. The default value is true.
/// </summary>
public bool SnapWhileResizing { get; set; } = true;
/// <summary>
/// Gets the <see cref="ConstrainedMoveResizeForm"/> with the snapping behavior.
/// </summary>
public ConstrainedMoveResizeForm Form { get; }
protected SnapHelper(ConstrainedMoveResizeForm form) => Form = form;
}
}
| apache-2.0 | C# |
d316e39eb8d8542a5d13ebca3fa8b47cbae732a4 | comment test. | tonyredondo/TWCore2,tonyredondo/TWCore2,tonyredondo/TWCore2,tonyredondo/TWCore2 | tools/TWCore.Diagnostics.Api/DiagnosticMessagingServiceAsync.cs | tools/TWCore.Diagnostics.Api/DiagnosticMessagingServiceAsync.cs | /*
Copyright 2015-2018 Daniel Adrian Redondo Suarez
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.Threading.Tasks;
using TWCore.Diagnostics.Api.Models;
using TWCore.Services;
// ReSharper disable UnusedMember.Global
namespace TWCore.Diagnostics.Api
{
public class DiagnosticMessagingServiceAsync : BusinessMessagesServiceAsync<DiagnosticMessagingBusinessAsync>
{
protected override void OnInit(string[] args)
{
EnableMessagesTrace = false;
base.OnInit(args);
/*
var logs = DbHandlers.Instance.Query.GetLogsAsync("Processing message", null, DateTime.MinValue, DateTime.Now).WaitAndResults();
var logs2 = DbHandlers.Instance.Query.GetLogsAsync("Processing message", null, DateTime.MinValue, DateTime.Now).WaitAndResults();
var logs3 = DbHandlers.Instance.Query.GetLogsAsync("Processing message", null, DateTime.MinValue, DateTime.Now).WaitAndResults();
Task.Delay(2000).ContinueWith(async _ =>
{
while (true)
{
Core.Log.ErrorGroup(new Exception("Test de Error"), Guid.NewGuid().ToString(), "Reporte de error.");
await Task.Delay(2000).ConfigureAwait(false);
}
});
*/
}
}
} | /*
Copyright 2015-2018 Daniel Adrian Redondo Suarez
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.Threading.Tasks;
using TWCore.Diagnostics.Api.Models;
using TWCore.Services;
// ReSharper disable UnusedMember.Global
namespace TWCore.Diagnostics.Api
{
public class DiagnosticMessagingServiceAsync : BusinessMessagesServiceAsync<DiagnosticMessagingBusinessAsync>
{
protected override void OnInit(string[] args)
{
EnableMessagesTrace = false;
base.OnInit(args);
var logs = DbHandlers.Instance.Query.GetLogsAsync("Processing message", null, DateTime.MinValue, DateTime.Now).WaitAndResults();
var logs2 = DbHandlers.Instance.Query.GetLogsAsync("Processing message", null, DateTime.MinValue, DateTime.Now).WaitAndResults();
var logs3 = DbHandlers.Instance.Query.GetLogsAsync("Processing message", null, DateTime.MinValue, DateTime.Now).WaitAndResults();
Task.Delay(2000).ContinueWith(async _ =>
{
while (true)
{
Core.Log.ErrorGroup(new Exception("Test de Error"), Guid.NewGuid().ToString(), "Reporte de error.");
await Task.Delay(2000).ConfigureAwait(false);
}
});
}
}
} | apache-2.0 | C# |
97a93a071f2df0916337fc9308c7d8a403b1d63b | Make m_oauth readonly in OAuthHttpMessageHandler. | duplicati/duplicati,duplicati/duplicati,sitofabi/duplicati,mnaiman/duplicati,sitofabi/duplicati,mnaiman/duplicati,mnaiman/duplicati,sitofabi/duplicati,sitofabi/duplicati,duplicati/duplicati,sitofabi/duplicati,duplicati/duplicati,duplicati/duplicati,mnaiman/duplicati,mnaiman/duplicati | Duplicati/Library/Backend/OAuthHelper/OAuthHttpMessageHandler.cs | Duplicati/Library/Backend/OAuthHelper/OAuthHttpMessageHandler.cs | // Copyright (C) 2018, The Duplicati Team
// http://www.duplicati.com, info@duplicati.com
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using System;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
namespace Duplicati.Library
{
public class OAuthHttpMessageHandler : HttpClientHandler
{
/// <summary>
/// Requests which contain a property with this name (in 'request.Properties') will not have the authentication header automatically added.
/// </summary>
public const string DISABLE_AUTHENTICATION_PROPERTY = "OAuthHttpMessageHandler_DisableAuthentication";
private readonly OAuthHelper m_oauth;
public OAuthHttpMessageHandler(string authid, string protocolKey)
{
this.m_oauth = new OAuthHelper(authid, protocolKey);
}
/// <summary>
/// Prevents authentication from being applied on the given request
/// </summary>
/// <param name="request">Request to not authenticate</param>
/// <returns>Request to not authenticate</returns>
public HttpRequestMessage PreventAuthentication(HttpRequestMessage request)
{
request.Properties[DISABLE_AUTHENTICATION_PROPERTY] = true;
return request;
}
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (!request.Properties.ContainsKey(DISABLE_AUTHENTICATION_PROPERTY))
{
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", this.m_oauth.AccessToken);
}
return base.SendAsync(request, cancellationToken);
}
}
}
| // Copyright (C) 2018, The Duplicati Team
// http://www.duplicati.com, info@duplicati.com
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using System;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
namespace Duplicati.Library
{
public class OAuthHttpMessageHandler : HttpClientHandler
{
/// <summary>
/// Requests which contain a property with this name (in 'request.Properties') will not have the authentication header automatically added.
/// </summary>
public const string DISABLE_AUTHENTICATION_PROPERTY = "OAuthHttpMessageHandler_DisableAuthentication";
private OAuthHelper m_oauth;
public OAuthHttpMessageHandler(string authid, string protocolKey)
{
this.m_oauth = new OAuthHelper(authid, protocolKey);
}
/// <summary>
/// Prevents authentication from being applied on the given request
/// </summary>
/// <param name="request">Request to not authenticate</param>
/// <returns>Request to not authenticate</returns>
public HttpRequestMessage PreventAuthentication(HttpRequestMessage request)
{
request.Properties[DISABLE_AUTHENTICATION_PROPERTY] = true;
return request;
}
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (!request.Properties.ContainsKey(DISABLE_AUTHENTICATION_PROPERTY))
{
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", this.m_oauth.AccessToken);
}
return base.SendAsync(request, cancellationToken);
}
}
}
| lgpl-2.1 | C# |
83b363b15b585ce3c6ecb336aecfe9be1da3035a | Update version number. | Damnae/storybrew | editor/Properties/AssemblyInfo.cs | editor/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.76.*")]
| 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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.75.*")]
| mit | C# |
fd19ef69d7659599bbab29c37e4188af8ca92395 | Add properties to OneDayTeam | fredatgithub/InterClubBadminton | InterClubBadminton/OneDayTeam.cs | InterClubBadminton/OneDayTeam.cs | /*
The MIT License(MIT)
Copyright(c) 2015 Freddy Juhel
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.Collections.Generic;
namespace InterClubBadminton
{
internal class OneDayTeam
{
public List<Player> Players { get; set; }
public Player SimpleMan1 { get; set; }
public Player SimpleMan2 { get; set; }
public Player SimpleMan3 { get; set; }
public Player SimpleWoman { get; set; }
public List<Player> SimpleDoubleMen { get; set; }
public List<Player> SimpleDoubleWomen { get; set; }
public List<Player> SimpleDoubleMixed { get; set; }
public OneDayTeam()
{
Players = new List<Player>();
}
public void Add(Player player)
{
Players.Add(player);
}
}
} | /*
The MIT License(MIT)
Copyright(c) 2015 Freddy Juhel
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.Collections.Generic;
namespace InterClubBadminton
{
internal class OneDayTeam
{
public List<Player> Players { get; set; }
public OneDayTeam()
{
Players = new List<Player>();
}
public void Add(Player player)
{
Players.Add(player);
}
}
} | mit | C# |
519df2847c993dece5190f2bf500900ad01368b0 | Improve logging with verbose and info | NicolasDorier/NBitcoin.Indexer,MetacoSA/NBitcoin.Indexer,bijakatlykkex/NBitcoin.Indexer | NBitcoin.Indexer/IndexerTrace.cs | NBitcoin.Indexer/IndexerTrace.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBitcoin.Indexer
{
class IndexerTrace
{
static TraceSource _Trace = new TraceSource("NBitcoin.Indexer");
internal static void ErrorWhileImportingBlockToAzure(uint256 id, Exception ex)
{
_Trace.TraceEvent(TraceEventType.Error, 0, "Error while importing " + id + " in azure blob : " + Utils.ExceptionToString(ex));
}
internal static void BlockAlreadyUploaded()
{
_Trace.TraceInformation("Block already uploaded");
}
internal static void BlockUploaded(TimeSpan time, int bytes)
{
if(time.TotalSeconds == 0.0)
time = TimeSpan.FromMilliseconds(10);
double speed = ((double)bytes / 1024.0) / time.TotalSeconds;
_Trace.TraceEvent(TraceEventType.Verbose, 0, "Block uploaded successfully (" + speed.ToString("0.00") + " KB/S)");
}
internal static TraceCorrelation NewCorrelation(string activityName)
{
return new TraceCorrelation(_Trace, activityName);
}
internal static void StartingImportAt(DiskBlockPos lastPosition)
{
_Trace.TraceInformation("Starting import at position " + lastPosition);
}
internal static void PositionSaved(DiskBlockPos diskBlockPos)
{
_Trace.TraceInformation("New starting import position : " + diskBlockPos.ToString());
}
internal static void BlockCount(int blockCount)
{
_Trace.TraceEvent(blockCount % 1000 == 0 ? TraceEventType.Information : TraceEventType.Verbose, 0, "Block count : " + blockCount);
}
internal static void TxCount(int txCount)
{
_Trace.TraceEvent(txCount % 100000 == 0 ? TraceEventType.Information : TraceEventType.Verbose, 0, "Transaction count : " + txCount);
}
internal static void ErrorWhileImportingTxToAzure(Exception ex)
{
_Trace.TraceEvent(TraceEventType.Error, 0, "Error while importing transactions : " + Utils.ExceptionToString(ex));
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBitcoin.Indexer
{
class IndexerTrace
{
static TraceSource _Trace = new TraceSource("NBitcoin.Indexer");
internal static void ErrorWhileImportingBlockToAzure(uint256 id, Exception ex)
{
_Trace.TraceEvent(TraceEventType.Error, 0, "Error while importing " + id + " in azure blob : " + Utils.ExceptionToString(ex));
}
internal static void BlockAlreadyUploaded()
{
_Trace.TraceInformation("Block already uploaded");
}
internal static void BlockUploaded(TimeSpan time, int bytes)
{
if(time.TotalSeconds == 0.0)
time = TimeSpan.FromMilliseconds(10);
double speed = ((double)bytes / 1024.0) / time.TotalSeconds;
_Trace.TraceInformation("Block uploaded successfully (" + speed.ToString("0.00") + " KB/S)");
}
internal static TraceCorrelation NewCorrelation(string activityName)
{
return new TraceCorrelation(_Trace, activityName);
}
internal static void StartingImportAt(DiskBlockPos lastPosition)
{
_Trace.TraceInformation("Starting import at position " + lastPosition);
}
internal static void PositionSaved(DiskBlockPos diskBlockPos)
{
_Trace.TraceInformation("New starting import position : " + diskBlockPos.ToString());
}
internal static void BlockCount(int blockCount)
{
_Trace.TraceInformation("Block count : " + blockCount);
}
internal static void TxCount(int txCount)
{
_Trace.TraceInformation("Transaction count : " + txCount);
}
internal static void ErrorWhileImportingTxToAzure(Exception ex)
{
_Trace.TraceEvent(TraceEventType.Error, 0, "Error while importing transactions : " + Utils.ExceptionToString(ex));
}
}
}
| mit | C# |
31603d8498a955d0f6b7610814ee2aa681b02b41 | Insert check user fields for null | B1naryStudio/Azimuth,B1naryStudio/Azimuth | DataAccess/Entities/User.cs | DataAccess/Entities/User.cs | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Azimuth.DataAccess.Infrastructure;
namespace Azimuth.DataAccess.Entities
{
public class User : BaseEntity
{
public virtual Name Name { get; set; }
public virtual string ScreenName { get; set; }
public virtual string Gender { get; set; }
public virtual string Birthday { get; set; }
public virtual string Photo { get; set; }
public virtual int Timezone { get; set; }
public virtual Location Location { get; set; }
public virtual string Email { get; set; }
public virtual ICollection<UserSocialNetwork> SocialNetworks { get; set; }
public virtual ICollection<User> Followers { get; set; }
public virtual ICollection<User> Following { get; set; }
public virtual ICollection<PlaylistLike> PlaylistFollowing { get; set; }
public User()
{
SocialNetworks = new List<UserSocialNetwork>();
Followers = new List<User>();
Following = new List<User>();
PlaylistFollowing = new List<PlaylistLike>();
}
public override string ToString()
{
return Name.FirstName ??
String.Empty + Name.LastName ??
String.Empty + ScreenName ??
String.Empty + Gender ??
String.Empty + Email ??
String.Empty + Birthday ??
String.Empty + Timezone ??
String.Empty + ((Location != null) ? Location.City ?? String.Empty : String.Empty) +
", " + ((Location != null) ? Location.Country ?? String.Empty : String.Empty) + Photo ?? String.Empty;
}
}
}
| using System.Collections.Generic;
using System.Collections.ObjectModel;
using Azimuth.DataAccess.Infrastructure;
namespace Azimuth.DataAccess.Entities
{
public class User : BaseEntity
{
public virtual Name Name { get; set; }
public virtual string ScreenName { get; set; }
public virtual string Gender { get; set; }
public virtual string Birthday { get; set; }
public virtual string Photo { get; set; }
public virtual int Timezone { get; set; }
public virtual Location Location { get; set; }
public virtual string Email { get; set; }
public virtual ICollection<UserSocialNetwork> SocialNetworks { get; set; }
public virtual ICollection<User> Followers { get; set; }
public virtual ICollection<User> Following { get; set; }
public virtual ICollection<PlaylistLike> PlaylistFollowing { get; set; }
public User()
{
SocialNetworks = new List<UserSocialNetwork>();
Followers = new List<User>();
Following = new List<User>();
PlaylistFollowing = new List<PlaylistLike>();
}
public override string ToString()
{
return Name.FirstName + Name.LastName + ScreenName + Gender + Email + Birthday + Timezone + Location.City +
", " + Location.Country + Photo;
}
}
}
| mit | C# |
a5fc5d045c5842156649ff3a067804e85b4d504a | fix TestGrobufUsages | homuroll/gremit | GrEmit.Tests/TestGrobufUsages.cs | GrEmit.Tests/TestGrobufUsages.cs | using System;
using System.Reflection;
using System.Reflection.Emit;
using NUnit.Framework;
namespace GrEmit.Tests
{
public class TestGrobufUsages
{
[Test]
public void DateTimeOffsetPrivateFieldsAccess()
{
var method = BuildAccessorMethod();
var @delegate = (Action<DateTimeOffset>)method.CreateDelegate(typeof(Action<DateTimeOffset>));
@delegate(dateTimeOffset);
}
private DynamicMethod BuildAccessorMethod()
{
var assertMethod = typeof(TestGrobufUsages).GetMethod("AssertDateTimeOffsetFields", BindingFlags.Static | BindingFlags.NonPublic);
var method = new DynamicMethod("Grobuf_Write_DateTimeOffset_" + Guid.NewGuid(), typeof(void), new[] {dateTimeOffsetType}, typeof(TestGrobufUsages), true);
using(var il = new GroboIL(method))
{
il.Ldarga(0); // stack: [obj]
il.Ldfld(dateTimeOffsetType.GetField(SelectName("_dateTime", "m_dateTime"), BindingFlags.Instance | BindingFlags.NonPublic)); // stack: [obj.m_dateTime]
il.Ldarga(0); // stack: [obj]
il.Ldfld(dateTimeOffsetType.GetField(SelectName("_offsetMinutes", "m_offsetMinutes"), BindingFlags.Instance | BindingFlags.NonPublic)); // stack: [obj.m_offsetMinutes]
il.Call(assertMethod); // stack: []
il.Ret();
}
return method;
}
private static void AssertDateTimeOffsetFields(DateTime dateTime, short offsetMinutes)
{
Assert.That(dateTime, Is.EqualTo(new DateTime(2018, 01, 05, 21, 19, 56, DateTimeKind.Unspecified)));
Assert.That(offsetMinutes, Is.EqualTo(15));
}
private static string SelectName(string netcoreName, string net45Name)
{
#if NETCOREAPP2_0
return netcoreName;
#else
return net45Name;
#endif
}
private readonly Type dateTimeOffsetType = typeof(DateTimeOffset);
private static readonly DateTimeOffset dateTimeOffset = new DateTimeOffset(new DateTime(2018, 01, 05, 21, 34, 56, DateTimeKind.Unspecified), TimeSpan.FromMinutes(15));
}
} | using System;
using System.Reflection;
using System.Reflection.Emit;
using NUnit.Framework;
namespace GrEmit.Tests
{
public class TestGrobufUsages
{
[Test]
#if NETCOREAPP2_0
[Ignore("Test is failing on dotnetcore: dateTimeOffsetType.GetField(\"m_dateTime\", ...) == null")]
#endif
public void DateTimeOffsetPrivateFieldsAccess()
{
var method = BuildAccessorMethod();
var @delegate = (Action<DateTimeOffset>)method.CreateDelegate(typeof(Action<DateTimeOffset>));
@delegate(dateTimeOffset);
}
private DynamicMethod BuildAccessorMethod()
{
var assertMethod = typeof(TestGrobufUsages).GetMethod("AssertDateTimeOffsetFields", BindingFlags.Static | BindingFlags.NonPublic);
var method = new DynamicMethod("Grobuf_Write_DateTimeOffset_" + Guid.NewGuid(), typeof(void), new[] {dateTimeOffsetType}, typeof(TestGrobufUsages), true);
using(var il = new GroboIL(method))
{
il.Ldarga(0); // stack: [obj]
il.Ldfld(dateTimeOffsetType.GetField("m_dateTime", BindingFlags.Instance | BindingFlags.NonPublic)); // stack: [obj.m_dateTime]
il.Ldarga(0); // stack: [obj]
il.Ldfld(dateTimeOffsetType.GetField("m_offsetMinutes", BindingFlags.Instance | BindingFlags.NonPublic)); // stack: [obj.m_offsetMinutes]
il.Call(assertMethod); // stack: []
il.Ret();
}
return method;
}
private static void AssertDateTimeOffsetFields(DateTime dateTime, short offsetMinutes)
{
Assert.That(dateTime, Is.EqualTo(new DateTime(2018, 01, 05, 21, 19, 56, DateTimeKind.Unspecified)));
Assert.That(offsetMinutes, Is.EqualTo(15));
}
private readonly Type dateTimeOffsetType = typeof(DateTimeOffset);
private static readonly DateTimeOffset dateTimeOffset = new DateTimeOffset(new DateTime(2018, 01, 05, 21, 34, 56, DateTimeKind.Unspecified), TimeSpan.FromMinutes(15));
}
} | mit | C# |
77201c9daae958125e6814af32254a2653d2bf42 | Bump version 0.12.0.0 | modulexcite/Nowin,pysco68/Nowin,lstefano71/Nowin,et1975/Nowin,Bobris/Nowin,et1975/Nowin,lstefano71/Nowin,modulexcite/Nowin,et1975/Nowin,pysco68/Nowin,Bobris/Nowin,Bobris/Nowin,pysco68/Nowin,lstefano71/Nowin,modulexcite/Nowin | Nowin/Properties/AssemblyInfo.cs | Nowin/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Nowin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Boris Letocha")]
[assembly: AssemblyProduct("Nowin")]
[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("fd085b68-3766-42af-ab6d-351b7741c685")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.12.0.0")]
[assembly: AssemblyFileVersion("0.12.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Nowin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Boris Letocha")]
[assembly: AssemblyProduct("Nowin")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fd085b68-3766-42af-ab6d-351b7741c685")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.11.0.0")]
[assembly: AssemblyFileVersion("0.11.0.0")]
| mit | C# |
e4d568b8c0173504007cb43898b2b092431288fc | Bump version for release. | Bobris/Nowin,Bobris/Nowin,Bobris/Nowin | Nowin/Properties/AssemblyInfo.cs | Nowin/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Nowin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Boris Letocha")]
[assembly: AssemblyProduct("Nowin")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fd085b68-3766-42af-ab6d-351b7741c685")]
// 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.25.0.0")]
[assembly: AssemblyFileVersion("0.25.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Nowin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Boris Letocha")]
[assembly: AssemblyProduct("Nowin")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fd085b68-3766-42af-ab6d-351b7741c685")]
// 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.24.0.0")]
[assembly: AssemblyFileVersion("0.24.0.0")]
| mit | C# |
07508646b5d42a2a5486c189f922ff5b015659d4 | Add benchmark for `GetUnboundCopy` | ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework | osu.Framework.Benchmarks/BenchmarkBindableInstantiation.cs | osu.Framework.Benchmarks/BenchmarkBindableInstantiation.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 BenchmarkDotNet.Attributes;
using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
namespace osu.Framework.Benchmarks
{
[MemoryDiagnoser]
public class BenchmarkBindableInstantiation
{
[Benchmark]
public Bindable<int> Instantiate() => new Bindable<int>();
[Benchmark]
public Bindable<int> GetBoundCopy() => new Bindable<int>().GetBoundCopy();
[Benchmark(Baseline = true)]
public Bindable<int> GetBoundCopyOld() => new BindableOld<int>().GetBoundCopy();
[Benchmark]
public Bindable<int> GetUnboundCopy() => new Bindable<int>().GetUnboundCopy();
private class BindableOld<T> : Bindable<T> where T : notnull
{
public BindableOld(T defaultValue = default!)
: base(defaultValue)
{
}
protected override Bindable<T> CreateInstance() => (BindableOld<T>)Activator.CreateInstance(GetType(), Value).AsNonNull();
}
}
}
| // 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 BenchmarkDotNet.Attributes;
using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
namespace osu.Framework.Benchmarks
{
[MemoryDiagnoser]
public class BenchmarkBindableInstantiation
{
[Benchmark]
public Bindable<int> Instantiate() => new Bindable<int>();
[Benchmark]
public Bindable<int> GetBoundCopy() => new Bindable<int>().GetBoundCopy();
[Benchmark(Baseline = true)]
public Bindable<int> GetBoundCopyOld() => new BindableOld<int>().GetBoundCopy();
private class BindableOld<T> : Bindable<T> where T : notnull
{
public BindableOld(T defaultValue = default!)
: base(defaultValue)
{
}
protected override Bindable<T> CreateInstance() => (BindableOld<T>)Activator.CreateInstance(GetType(), Value).AsNonNull();
}
}
}
| mit | C# |
09fbe59b233e9ccb80344193854335d0c08fad1a | Fix collection modified exceptions | paiden/Nett | Source/Nett.Coma/MergedConfig.cs | Source/Nett.Coma/MergedConfig.cs | namespace Nett.Coma
{
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Diagnostics.Debug;
internal class MergedConfig : IPersistableConfig
{
private const string AssertAtLeastOneConfigMsg =
"Constructor should check that there is a config and the configs should not get modified later on";
private readonly List<IPersistableConfig> configs;
public MergedConfig(IEnumerable<IPersistableConfig> configs)
{
if (configs == null) { throw new ArgumentNullException(nameof(configs)); }
if (configs.Count() <= 0) { throw new ArgumentException("There needs to be at least one config", nameof(configs)); }
this.configs = new List<IPersistableConfig>(configs);
}
public void Dispose()
{
foreach (var pc in this.configs) { pc.Dispose(); }
}
public bool EnsureExists(TomlTable content)
{
Assert(this.configs.Count > 0, AssertAtLeastOneConfigMsg);
return this.configs.First().EnsureExists(content);
}
public TomlTable Load()
{
Assert(this.configs.Count > 0, AssertAtLeastOneConfigMsg);
TomlTable merged = Toml.Create();
foreach (var c in this.configs)
{
merged.OverwriteWithValuesForLoadFrom(c.Load());
}
return merged;
}
public void Save(TomlTable content)
{
Assert(this.configs.Count > 0, AssertAtLeastOneConfigMsg);
foreach (var c in this.configs)
{
var tbl = c.Load();
tbl.OverwriteWithValuesForSaveFrom(content);
c.Save(tbl);
}
}
}
}
| namespace Nett.Coma
{
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Diagnostics.Debug;
internal class MergedConfig : IPersistableConfig
{
private const string AssertAtLeastOneConfigMsg =
"Constructor should check that there is a config and the configs should not get modified later on";
private readonly List<IPersistableConfig> configs;
public MergedConfig(IEnumerable<IPersistableConfig> configs)
{
if (configs == null) { throw new ArgumentNullException(nameof(configs)); }
if (configs.Count() <= 0) { throw new ArgumentException("There needs to be at least one config", nameof(configs)); }
this.configs = new List<IPersistableConfig>(configs);
}
public void Dispose()
{
foreach (var pc in this.configs) { pc.Dispose(); }
}
public bool EnsureExists(TomlTable content)
{
Assert(this.configs.Count > 0, AssertAtLeastOneConfigMsg);
return this.configs.First().EnsureExists(content);
}
public TomlTable Load()
{
Assert(this.configs.Count > 0, AssertAtLeastOneConfigMsg);
TomlTable merged = this.configs.First().Load();
foreach (var c in this.configs.Skip(1))
{
merged.OverwriteWithValuesForLoadFrom(c.Load());
}
return merged;
}
public void Save(TomlTable content)
{
Assert(this.configs.Count > 0, AssertAtLeastOneConfigMsg);
foreach (var c in this.configs)
{
var tbl = c.Load();
tbl.OverwriteWithValuesForSaveFrom(content);
c.Save(tbl);
}
}
}
}
| mit | C# |
8631c469fcc69eb4886caf69574c45495632e2af | add license header | Nabile-Rahmani/osu,ppy/osu,smoogipoo/osu,peppy/osu,Frontear/osuKyzer,ppy/osu,2yangk23/osu,johnneijzen/osu,peppy/osu-new,EVAST9919/osu,EVAST9919/osu,UselessToucan/osu,UselessToucan/osu,naoey/osu,naoey/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,Drezi126/osu,DrabWeb/osu,naoey/osu,johnneijzen/osu,DrabWeb/osu,ZLima12/osu,peppy/osu,smoogipoo/osu,peppy/osu,ZLima12/osu,DrabWeb/osu,smoogipoo/osu | osu.Game/Graphics/Containers/OsuHoverContainer.cs | osu.Game/Graphics/Containers/OsuHoverContainer.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input;
namespace osu.Game.Graphics.Containers
{
public class OsuHoverContainer : OsuClickableContainer
{
private Color4 hoverColour;
protected override bool OnHover(InputState state)
{
this.FadeColour(hoverColour, 500, Easing.OutQuint);
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
this.FadeColour(Color4.White, 500, Easing.OutQuint);
base.OnHoverLost(state);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
hoverColour = colours.Yellow;
}
}
}
|
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input;
namespace osu.Game.Graphics.Containers
{
public class OsuHoverContainer : OsuClickableContainer
{
private Color4 hoverColour;
protected override bool OnHover(InputState state)
{
this.FadeColour(hoverColour, 500, Easing.OutQuint);
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
this.FadeColour(Color4.White, 500, Easing.OutQuint);
base.OnHoverLost(state);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
hoverColour = colours.Yellow;
}
}
}
| mit | C# |
829c5884b3e169d779bd6aca256e021ae9ad80e5 | Fix mis-matched split string indices (username is 0, password is 1). | brendanjbaker/Bakery | src/Bakery/Security/BasicAuthenticationParser.cs | src/Bakery/Security/BasicAuthenticationParser.cs | namespace Bakery.Security
{
using System;
using System.Text;
using Text;
public class BasicAuthenticationParser
: IBasicAuthenticationParser
{
private readonly IBase64Parser base64Parser;
private readonly Encoding encoding;
public BasicAuthenticationParser(IBase64Parser base64Parser, Encoding encoding)
{
this.base64Parser = base64Parser;
this.encoding = encoding;
}
public IBasicAuthentication TryParse(String @string)
{
if (!@string.StartsWith("BASIC ", StringComparison.OrdinalIgnoreCase))
return null;
var basicAuthenticationBase64 = @string.Substring(6);
var basicAuthenticationBytes = base64Parser.TryParse(basicAuthenticationBase64);
if (basicAuthenticationBytes == null)
return null;
var basicAuthenticationText = TryGetString(basicAuthenticationBytes);
if (basicAuthenticationText == null)
return null;
var parts = basicAuthenticationText.Split(new Char[] { ':' }, 2);
if (parts.Length != 2)
return null;
return new BasicAuthentication()
{
Password = parts[1],
Username = parts[0]
};
}
private String TryGetString(Byte[] bytes)
{
try
{
return encoding.GetString(bytes);
}
catch { return null; }
}
}
}
| namespace Bakery.Security
{
using System;
using System.Text;
using Text;
public class BasicAuthenticationParser
: IBasicAuthenticationParser
{
private readonly IBase64Parser base64Parser;
private readonly Encoding encoding;
public BasicAuthenticationParser(IBase64Parser base64Parser, Encoding encoding)
{
this.base64Parser = base64Parser;
this.encoding = encoding;
}
public IBasicAuthentication TryParse(String @string)
{
if (!@string.StartsWith("BASIC ", StringComparison.OrdinalIgnoreCase))
return null;
var basicAuthenticationBase64 = @string.Substring(6);
var basicAuthenticationBytes = base64Parser.TryParse(basicAuthenticationBase64);
if (basicAuthenticationBytes == null)
return null;
var basicAuthenticationText = TryGetString(basicAuthenticationBytes);
if (basicAuthenticationText == null)
return null;
var parts = basicAuthenticationText.Split(new Char[] { ':' }, 2);
if (parts.Length != 2)
return null;
return new BasicAuthentication()
{
Password = parts[0],
Username = parts[1]
};
}
private String TryGetString(Byte[] bytes)
{
try
{
return encoding.GetString(bytes);
}
catch { return null; }
}
}
}
| mit | C# |
d4a93e07fd1a5c231fcae586430f84084d3d4088 | Update Index.cshtml | johnnyreilly/jQuery.Validation.Unobtrusive.Native,senzacionale/jQuery.Validation.Unobtrusive.Native,johnnyreilly/jQuery.Validation.Unobtrusive.Native,johnnyreilly/jQuery.Validation.Unobtrusive.Native | jVUNDemo/Views/Home/Index.cshtml | jVUNDemo/Views/Home/Index.cshtml | @section metatags{
<meta name="Description" content="Provides MVC HTML helper extensions that marry jQuery Validation's native unobtrusive support for validation driven by HTML 5 data attributes with MVC's ability to generate data attributes from Model metadata. With this in place you can use jQuery Validation as it is - you don't need jquery.validate.unobtrusive.js. Which is nice">
}
<h3>What is jQuery Validation Unobtrusive Native?</h3>
<p>jQuery Validation Unobtrusive Native is a collection of ASP.Net MVC HTML helper extensions. These make use of jQuery Validation's native support for validation driven by HTML 5 data attributes. Microsoft shipped <a href="http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html" target="_blank">jquery.validate.unobtrusive.js</a> back with MVC 3. It provided a way to apply data model validations to the client side using a combination of jQuery Validation and HTML 5 data attributes (that's the "unobtrusive" part).</p>
<p>The principal of this was and is fantastic. But since that time the jQuery Validation project has implemented its own support for driving validation unobtrusively (which shipped with <a href="http://jquery.bassistance.de/validate/changelog.txt" target="_blank">jQuery Validation 1.11.0</a>). The main advantages of using the native support over jquery.validate.unobtrusive.js are:</p>
<ol>
<li>Dynamically created form elements are parsed automatically. jquery.validate.unobtrusive.js does not support this whilst jQuery Validation does.<br />
@Html.ActionLink("See a demo", "Dynamic", "AdvancedDemo")<br /><br /></li>
<li>jquery.validate.unobtrusive.js restricts how you use jQuery Validation. If you want to use showErrors or something similar then you may find that you need to go native (or at least you may find that significantly easier than working with the jquery.validate.unobtrusive.js defaults)...<br />
@Html.ActionLink("See a demo", "Tooltip", "AdvancedDemo")<br /><br /></li>
<li>Send less code to your browser, make your browser to do less work, get a performance benefit (though in all honesty you'd probably have to be the Flash to actually notice the difference...)</li>
</ol>
<p>This project intends to be a bridge between MVC's inbuilt support for driving validation from data attributes and jQuery Validation's native support for the same. This is achieved by hooking into the MVC data attribute creation mechanism and using it to generate the data attributes used by jQuery Validation.</p>
<h4>Future Plans</h4>
<p>So far the basic set of the HtmlHelpers and their associated unobtrusive mappings have been implemented. If any have been missed then let me know. As time goes by I intend to:</p>
<ul>
<li>fill in any missing gaps there may be</li>
<li>maintain MVC 3, 4, 5 (and when the time comes 6+) versions of this on Nuget</li>
<li>get the unit test coverage to a good level and (most importantly)</li>
<li>create some really useful demos and documentation.</li>
</ul>
<p>Help is appreciated so feel free to pitch in! You can find the project on <a href="http://github.com/johnnyreilly/jQuery.Validation.Unobtrusive.Native" target="_blank">GitHub</a>...</p>
| @section metatags{
<meta name="Description" content="Provides MVC HTML helper extensions that marry jQuery Validation's native unobtrusive support for validation driven by HTML 5 data attributes with MVC's ability to generate data attributes from Model metadata. With this in place you can use jQuery Validation as it is - you don't need jquery.validate.unobtrusive.js.">
}
<h3>What is jQuery Validation Unobtrusive Native?</h3>
<p>jQuery Validation Unobtrusive Native is a collection of ASP.Net MVC HTML helper extensions. These make use of jQuery Validation's native support for validation driven by HTML 5 data attributes. Microsoft shipped <a href="http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html" target="_blank">jquery.validate.unobtrusive.js</a> back with MVC 3. It provided a way to apply data model validations to the client side using a combination of jQuery Validation and HTML 5 data attributes (that's the "unobtrusive" part).</p>
<p>The principal of this was and is fantastic. But since that time the jQuery Validation project has implemented its own support for driving validation unobtrusively (which shipped with <a href="http://jquery.bassistance.de/validate/changelog.txt" target="_blank">jQuery Validation 1.11.0</a>). The main advantages of using the native support over jquery.validate.unobtrusive.js are:</p>
<ol>
<li>Dynamically created form elements are parsed automatically. jquery.validate.unobtrusive.js does not support this whilst jQuery Validation does.<br />
@Html.ActionLink("See a demo", "Dynamic", "AdvancedDemo")<br /><br /></li>
<li>jquery.validate.unobtrusive.js restricts how you use jQuery Validation. If you want to use showErrors or something similar then you may find that you need to go native (or at least you may find that significantly easier than working with the jquery.validate.unobtrusive.js defaults)...<br />
@Html.ActionLink("See a demo", "Tooltip", "AdvancedDemo")<br /><br /></li>
<li>Send less code to your browser, make your browser to do less work, get a performance benefit (though in all honesty you'd probably have to be the Flash to actually notice the difference...)</li>
</ol>
<p>This project intends to be a bridge between MVC's inbuilt support for driving validation from data attributes and jQuery Validation's native support for the same. This is achieved by hooking into the MVC data attribute creation mechanism and using it to generate the data attributes used by jQuery Validation.</p>
<h4>Future Plans</h4>
<p>So far the basic set of the HtmlHelpers and their associated unobtrusive mappings have been implemented. If any have been missed then let me know. As time goes by I intend to:</p>
<ul>
<li>fill in any missing gaps there may be</li>
<li>maintain MVC 3, 4, 5 (and when the time comes 6+) versions of this on Nuget</li>
<li>get the unit test coverage to a good level and (most importantly)</li>
<li>create some really useful demos and documentation.</li>
</ul>
<p>Help is appreciated so feel free to pitch in! You can find the project on <a href="http://github.com/johnnyreilly/jQuery.Validation.Unobtrusive.Native" target="_blank">GitHub</a>...</p>
| mit | C# |
81296d9cdcfeabdd22e6d9949a931d20ae555a42 | add MissingMethodException | g0rdan/g0rdan.MvvmCross.Plugins | samples/MvvmCross.Plugins/iOS/Plugins/SimpleEmailPlugin.cs | samples/MvvmCross.Plugins/iOS/Plugins/SimpleEmailPlugin.cs | using System;
using MessageUI;
using UIKit;
namespace g0rdan.MvvmCross.Plugins.iOS
{
public class SimpleEmailPlugin : ISimpleEmailPlugin
{
MFMailComposeViewController _mailController;
UIViewController _vc;
public SimpleEmailPlugin()
{
}
#region ISimpleEmailPlugin implementation
public void Init(object context)
{
var vc = context as UIViewController;
if (vc == null)
throw new ArgumentException("You have to put UIViewController into context");
_vc = vc;
}
void ISimpleEmailPlugin.SendEmail(string toEmail, string subject, string message)
{
if (_vc == null)
throw new MissingMethodException("You have to call Init() method before");
if (MFMailComposeViewController.CanSendMail) {
var to = new string[]{ toEmail };
if (MFMailComposeViewController.CanSendMail) {
_mailController = new MFMailComposeViewController ();
_mailController.SetToRecipients (to);
_mailController.SetSubject (subject);
_mailController.SetMessageBody (message, false);
_mailController.Finished += (object s, MFComposeResultEventArgs args) => {
_vc.BeginInvokeOnMainThread (() => {
args.Controller.DismissViewController (true, null);
});
};
}
_vc.PresentViewController (_mailController, true, null);
} else {
new UIAlertView("Can't send email", string.Empty, null, "OK").Show();
}
}
#endregion
}
}
| using System;
using MessageUI;
using UIKit;
namespace g0rdan.MvvmCross.Plugins.iOS
{
public class SimpleEmailPlugin : ISimpleEmailPlugin
{
MFMailComposeViewController _mailController;
UIViewController _vc;
public SimpleEmailPlugin()
{
}
#region ISimpleEmailPlugin implementation
public void Init(object context)
{
var vc = context as UIViewController;
if (vc == null)
throw new ArgumentException("You have to put UIViewController into context");
_vc = vc;
}
void ISimpleEmailPlugin.SendEmail(string toEmail, string subject, string message)
{
if (MFMailComposeViewController.CanSendMail) {
var to = new string[]{ toEmail };
if (MFMailComposeViewController.CanSendMail) {
_mailController = new MFMailComposeViewController ();
_mailController.SetToRecipients (to);
_mailController.SetSubject (subject);
_mailController.SetMessageBody (message, false);
_mailController.Finished += (object s, MFComposeResultEventArgs args) => {
_vc.BeginInvokeOnMainThread (() => {
args.Controller.DismissViewController (true, null);
});
};
}
_vc.PresentViewController (_mailController, true, null);
} else {
new UIAlertView("Can't send email", string.Empty, null, "OK").Show();
}
}
#endregion
}
}
| mit | C# |
0c94445c66fa19440c156ad8a94533e8d0e96243 | change flag for nuget update | jerryhuffman/IdentityManager,nexbit/IdentityManager,alibad/IdentityManager.vNext,nexbit/IdentityManager,Ernesto99/IdentityManager,Nicholi/IdentityManager,alibad/IdentityManager.vNext,jerryhuffman/IdentityManager,jerryhuffman/IdentityManager,IdentityManager/IdentityManager,nexbit/IdentityManager,Nicholi/IdentityManager,Ernesto99/IdentityManager,Nicholi/IdentityManager,IdentityManager/IdentityManager,Ernesto99/IdentityManager,IdentityManager/IdentityManager,alibad/IdentityManager.vNext | source/MembershipReboot.Tests/TestUserAccountRepository.cs | source/MembershipReboot.Tests/TestUserAccountRepository.cs | using BrockAllen.MembershipReboot;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MembershipReboot.Tests
{
public class TestUserAccountRepository : QueryableUserAccountRepository<TestUserAccount>
{
public TestUserAccountRepository()
{
this.UseEqualsOrdinalIgnoreCaseForQueries = true;
}
public List<TestUserAccount> UserAccounts = new List<TestUserAccount>();
protected override IQueryable<TestUserAccount> Queryable
{
get { return UserAccounts.AsQueryable(); }
}
public override TestUserAccount Create()
{
return new TestUserAccount();
}
public override void Add(TestUserAccount item)
{
UserAccounts.Add(item);
}
public override void Remove(TestUserAccount item)
{
UserAccounts.Remove(item);
}
public override void Update(TestUserAccount item)
{
}
public override TestUserAccount GetByLinkedAccount(string tenant, string provider, string id)
{
var query =
from a in UserAccounts
where a.Tenant == tenant
from la in a.LinkedAccounts
where la.ProviderName == provider && la.ProviderAccountID == id
select a;
return query.SingleOrDefault();
}
public override TestUserAccount GetByCertificate(string tenant, string thumbprint)
{
var query =
from a in UserAccounts
where a.Tenant == tenant
from c in a.Certificates
where c.Thumbprint == thumbprint
select a;
return query.SingleOrDefault();
}
}
}
| using BrockAllen.MembershipReboot;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MembershipReboot.Tests
{
public class TestUserAccountRepository : QueryableUserAccountRepository<TestUserAccount>
{
public TestUserAccountRepository()
{
//this.UseEqualsOrdinalIgnoreCaseForQueries = true;
}
public List<TestUserAccount> UserAccounts = new List<TestUserAccount>();
protected override IQueryable<TestUserAccount> Queryable
{
get { return UserAccounts.AsQueryable(); }
}
public override TestUserAccount Create()
{
return new TestUserAccount();
}
public override void Add(TestUserAccount item)
{
UserAccounts.Add(item);
}
public override void Remove(TestUserAccount item)
{
UserAccounts.Remove(item);
}
public override void Update(TestUserAccount item)
{
}
public override TestUserAccount GetByLinkedAccount(string tenant, string provider, string id)
{
var query =
from a in UserAccounts
where a.Tenant == tenant
from la in a.LinkedAccounts
where la.ProviderName == provider && la.ProviderAccountID == id
select a;
return query.SingleOrDefault();
}
public override TestUserAccount GetByCertificate(string tenant, string thumbprint)
{
var query =
from a in UserAccounts
where a.Tenant == tenant
from c in a.Certificates
where c.Thumbprint == thumbprint
select a;
return query.SingleOrDefault();
}
}
}
| apache-2.0 | C# |
2d7eaebd9c35deb1db1fa7f27ff30bfc246f81a4 | Update FadeParticlesNearPoint.cs | grreuze/Utils | Scripts/FadeParticlesNearPoint.cs | Scripts/FadeParticlesNearPoint.cs | using UnityEngine;
[RequireComponent(typeof(ParticleSystem))]
public class FadeParticlesNearPoint : MonoBehaviour {
ParticleSystem ps;
[Header("Use \"Infinity\" to ignore an axis")]
[SerializeField] Vector3 point;
[SerializeField] float radius;
[SerializeField] float startFadeDistance = 3;
bool isLocal;
bool ignoreX, ignoreY, ignoreZ;
void Start() {
ps = GetComponent<ParticleSystem>();
isLocal = ps.main.simulationSpace == ParticleSystemSimulationSpace.Local;
ignoreX = point.x == Mathf.Infinity;
ignoreY = point.y == Mathf.Infinity;
ignoreZ = point.z == Mathf.Infinity;
}
void Update() {
ParticleSystem.Particle[] particles = new ParticleSystem.Particle[ps.main.maxParticles];
int count = ps.GetParticles(particles);
for (int i = 0; i < count; i++) {
ParticleSystem.Particle p = particles[i];
Vector3 pos = isLocal ? transform.TransformPoint(p.position) : p.position;
if (ignoreX) point.x = pos.x;
if (ignoreY) point.y = pos.y;
if (ignoreZ) point.z = pos.z;
float distance = Vector3.Distance(pos, point);
if (distance < startFadeDistance + radius) {
Color color = p.startColor;
color.a = Mathf.Lerp(0, 1, Mathf.Max(0, distance - radius) / (startFadeDistance + radius));
p.startColor = color;
if (distance < radius)
p.remainingLifetime = 0;
particles[i] = p;
}
}
ps.SetParticles(particles, count);
}
}
| using UnityEngine;
[RequireComponent(typeof(ParticleSystem))]
public class FadeParticlesNearPoint : MonoBehaviour {
ParticleSystem ps;
[Header("Use \"Infinity\" to ignore an axis")]
[SerializeField] Vector3 point;
[SerializeField] float radius;
[SerializeField] float startFadeDistance = 3;
bool isLocal;
void Start() {
ps = GetComponent<ParticleSystem>();
isLocal = ps.main.simulationSpace == ParticleSystemSimulationSpace.Local;
}
void Update() {
ParticleSystem.Particle[] particles = new ParticleSystem.Particle[ps.main.maxParticles];
int count = ps.GetParticles(particles);
for (int i = 0; i < count; i++) {
ParticleSystem.Particle p = particles[i];
Vector3 pos = isLocal ? transform.TransformPoint(p.position) : p.position;
if (point.x == Mathf.Infinity) point.x = pos.x;
if (point.y == Mathf.Infinity) point.y = pos.y;
if (point.z == Mathf.Infinity) point.z = pos.z;
float distance = Vector3.Distance(pos, point);
if (distance < startFadeDistance + radius) {
Color color = p.startColor;
color.a = Mathf.Lerp(0, 1, distance / startFadeDistance);
p.startColor = color;
if (distance < radius)
p.remainingLifetime = 0;
particles[i] = p;
}
}
ps.SetParticles(particles, count);
}
} | mit | C# |
5a886b195f38eaeff1ce4ebb4e609084b9198c0b | Fix EFConfigStore | Joe4evr/Discord.Addons | src/Discord.Addons.SimplePermissions.EFProvider/EFConfigStore.cs | src/Discord.Addons.SimplePermissions.EFProvider/EFConfigStore.cs | using System;
namespace Discord.Addons.SimplePermissions
{
/// <summary>
/// Implementation of an <see cref="IConfigStore{TConfig}"/> using EF as a backing store.
/// </summary>
/// <typeparam name="TContext">The database context.</typeparam>
public class EFConfigStore<TContext> : IConfigStore<TContext>
where TContext : EFConfigBase
{
private readonly TContext _db;
/// <summary>
/// Initializes a new instance of <see cref="EFConfigStore{TContext}"/>.
/// </summary>
/// <param name="db">An instance of a DB Context.</param>
public EFConfigStore(TContext db)
{
if (db == null) throw new ArgumentNullException(nameof(db));
_db = db;
}
/// <summary>
/// Loads an instance of the DB Context.
/// </summary>
public TContext Load()
{
return _db;
}
/// <summary>
///
/// </summary>
public void Save()
{
_db.SaveChanges();
}
}
}
| using System;
namespace Discord.Addons.SimplePermissions
{
/// <summary>
/// Implementation of an <see cref="IConfigStore{TConfig}"/> using EF as a backing store.
/// </summary>
/// <typeparam name="TContext">The database context.</typeparam>
public class EFConfigStore<TContext> : IConfigStore<EFConfigBase>
where TContext : EFConfigBase
{
private readonly TContext _db;
/// <summary>
/// Initializes a new instance of <see cref="EFConfigStore{TContext}"/>.
/// </summary>
/// <param name="db">A function that produces an instance of a DB Context.</param>
public EFConfigStore(TContext db)
{
if (db == null) throw new ArgumentNullException(nameof(db));
_db = db;
}
/// <summary>
/// Loads an instance of the DB Context.
/// </summary>
public EFConfigBase Load()
{
return _db;
}
/// <summary>
///
/// </summary>
public void Save()
{
_db.SaveChanges();
}
}
}
| mit | C# |
b1d710205d7f465c4fa4be1fd45b5c2c90a62b3e | Add default system actions to Tutorial 2 | l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,l8s/Eto | Tutorials/Tutorial2/Main.cs | Tutorials/Tutorial2/Main.cs | using System;
using Eto.Forms;
using Eto.Drawing;
namespace Tutorial2
{
public class MyAction : ButtonAction
{
public const string ActionID = "my_action";
public MyAction ()
{
this.ID = ActionID;
this.MenuText = "C&lick Me";
this.ToolBarText = "Click Me";
this.TooltipText = "This shows a dialog for no reason";
//this.Icon = Icon.FromResource ("MyResourceName.ico");
this.Accelerator = Application.Instance.CommonModifier | Key.M; // control+M or cmd+M
}
protected override void OnActivated (EventArgs e)
{
base.OnActivated (e);
MessageBox.Show (Application.Instance.MainForm, "You clicked me!", "Tutorial 2", MessageBoxButtons.OK);
}
}
public class MyForm : Form
{
public MyForm()
{
this.ClientSize = new Size(600, 400);
this.Title = "Menus and Toolbars";
GenerateActions();
}
void GenerateActions ()
{
var actions = new GenerateActionArgs(this);
Application.Instance.GetSystemActions (actions, true);
// define action
actions.Actions.Add (new MyAction());
// add action to toolbar
actions.ToolBar.Add (MyAction.ActionID);
// add action to file sub-menu
var file = actions.Menu.FindAddSubMenu ("&File");
file.Actions.Add (MyAction.ActionID);
// generate menu & toolbar
this.Menu = actions.Menu.GenerateMenuBar ();
this.ToolBar = actions.ToolBar.GenerateToolBar ();
}
}
class MainClass
{
[STAThread]
public static void Main (string[] args)
{
var app = new Application ();
app.Initialized += delegate {
app.MainForm = new MyForm ();
app.MainForm.Show ();
};
app.Run (args);
}
}
}
| using System;
using Eto.Forms;
using Eto.Drawing;
namespace Tutorial2
{
public class MyAction : ButtonAction
{
public const string ActionID = "my_action";
public MyAction ()
{
this.ID = ActionID;
this.MenuText = "C&lick Me";
this.ToolBarText = "Click Me";
this.TooltipText = "This shows a dialog for no reason";
this.Accelerator = Application.Instance.CommonModifier | Key.M; // control+M or cmd+M
}
protected override void OnActivated (EventArgs e)
{
base.OnActivated (e);
MessageBox.Show (Application.Instance.MainForm, "You clicked me!", "Tutorial 2", MessageBoxButtons.OK);
}
}
public class MyForm : Form
{
public MyForm()
{
this.ClientSize = new Size(600, 400);
this.Title = "Menus and Toolbars";
GenerateActions();
}
void GenerateActions ()
{
var actions = new GenerateActionArgs(this);
// define action
actions.Actions.Add (new MyAction());
// add action to toolbar
actions.ToolBar.Add (MyAction.ActionID);
// add action to file sub-menu
var file = actions.Menu.FindAddSubMenu ("&File");
file.Actions.Add (MyAction.ActionID);
// generate menu & toolbar
this.Menu = actions.Menu.GenerateMenuBar ();
this.ToolBar = actions.ToolBar.GenerateToolBar ();
}
}
class MainClass
{
[STAThread]
public static void Main (string[] args)
{
var app = new Application ();
app.Initialized += delegate {
app.MainForm = new MyForm ();
app.MainForm.Show ();
};
app.Run (args);
}
}
}
| bsd-3-clause | C# |
5e53cd467f0f0de7fd6d81f077d19b50d0845364 | Move up length check | ilkerhalil/dnlib,Arthur2e5/dnlib,yck1509/dnlib,ZixiangBoy/dnlib,0xd4d/dnlib,jorik041/dnlib,kiootic/dnlib,modulexcite/dnlib,picrap/dnlib | src/DotNet/SimpleLazyList.cs | src/DotNet/SimpleLazyList.cs | using System.Diagnostics;
namespace dot10.DotNet {
/// <summary>
/// A readonly list that gets initialized lazily
/// </summary>
/// <typeparam name="T">A <see cref="ICodedToken"/> type</typeparam>
[DebuggerDisplay("Count = {Length}")]
class SimpleLazyList<T> where T : class, IMDTokenProvider {
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
T[] elements;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
bool[] initialized;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
readonly MFunc<uint, T> readElementByRID;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
readonly uint length;
/// <summary>
/// Gets the length of this list
/// </summary>
public uint Length {
get { return length; }
}
/// <summary>
/// Access the list
/// </summary>
/// <param name="index">Index</param>
/// <returns>The element or null if <paramref name="index"/> is invalid</returns>
public T this[uint index] {
get {
if (index >= length)
return null;
if (elements == null) {
elements = new T[length];
initialized = new bool[length];
}
if (!initialized[index]) {
elements[index] = readElementByRID(index + 1);
initialized[index] = true;
}
return elements[index];
}
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="length">Length of the list</param>
/// <param name="readElementByRID">Delegate instance that lazily reads an element</param>
public SimpleLazyList(uint length, MFunc<uint, T> readElementByRID) {
this.length = length;
this.readElementByRID = readElementByRID;
}
}
}
| using System.Diagnostics;
namespace dot10.DotNet {
/// <summary>
/// A readonly list that gets initialized lazily
/// </summary>
/// <typeparam name="T">A <see cref="ICodedToken"/> type</typeparam>
[DebuggerDisplay("Count = {Length}")]
class SimpleLazyList<T> where T : class, IMDTokenProvider {
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
T[] elements;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
bool[] initialized;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
readonly MFunc<uint, T> readElementByRID;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
readonly uint length;
/// <summary>
/// Gets the length of this list
/// </summary>
public uint Length {
get { return length; }
}
/// <summary>
/// Access the list
/// </summary>
/// <param name="index">Index</param>
/// <returns>The element or null if <paramref name="index"/> is invalid</returns>
public T this[uint index] {
get {
if (elements == null) {
elements = new T[length];
initialized = new bool[length];
}
if (index >= length)
return null;
if (!initialized[index]) {
elements[index] = readElementByRID(index + 1);
initialized[index] = true;
}
return elements[index];
}
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="length">Length of the list</param>
/// <param name="readElementByRID">Delegate instance that lazily reads an element</param>
public SimpleLazyList(uint length, MFunc<uint, T> readElementByRID) {
this.length = length;
this.readElementByRID = readElementByRID;
}
}
}
| mit | C# |
edbe312cb784c497f60855ce162d53b6d78895e9 | Improve mobile friendlyness of the Room.Edit view | johanhelsing/vaskelista,johanhelsing/vaskelista | Vaskelista/Views/Room/Edit.cshtml | Vaskelista/Views/Room/Edit.cshtml | @model Vaskelista.Models.Room
@{
ViewBag.Title = "Edit";
}
<h2>Rediger rom</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.RoomId)
<div class="form-group">
@Html.LabelFor(model => model.Name, new { @class = "control-label col-md-2" })
<div class="col-md-4">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Lagre" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Tilbake til romoversikten", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
| @model Vaskelista.Models.Room
@{
ViewBag.Title = "Edit";
}
<h2>Rediger rom</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.RoomId)
<div class="form-group">
@Html.LabelFor(model => model.Name, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Lagre" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Tilbake til romoversikten", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
| mit | C# |
474e7fd2cb1ed672f905edae9473642baf2d626e | Add extension method to check eq mat dimensions | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Crypto/Extensions.cs | WalletWasabi/Crypto/Extensions.cs | using System.Collections.Generic;
using WalletWasabi.Helpers;
using WalletWasabi.Crypto.Groups;
using WalletWasabi.Crypto.ZeroKnowledge.LinearRelation;
using WalletWasabi.Crypto;
namespace System.Linq
{
public static class Extensions
{
public static GroupElement Sum(this IEnumerable<GroupElement> groupElements) =>
groupElements.Aggregate(GroupElement.Infinity, (ge, acc) => ge + acc);
public static IEnumerable<TResult> Zip<TFirst, TSecond, TThird, TResult>(this IEnumerable<TFirst> first, IEnumerable<TSecond> second, IEnumerable<TThird> third, Func<TFirst, TSecond, TThird, TResult> resultSelector)
{
Guard.NotNull(nameof(first), first);
Guard.NotNull(nameof(second), second);
Guard.NotNull(nameof(third), third);
Guard.NotNull(nameof(resultSelector), resultSelector);
using var e1 = first.GetEnumerator();
using var e2 = second.GetEnumerator();
using var e3 = third.GetEnumerator();
while (e1.MoveNext() && e2.MoveNext() && e3.MoveNext())
{
yield return resultSelector(e1.Current, e2.Current, e3.Current);
}
}
public static void CheckDimesions(this IEnumerable<Equation> equations, IEnumerable<ScalarVector> allResponses)
{
if (equations.Count() != allResponses.Count() ||
Enumerable.Zip(equations, allResponses).Any(x => x.First.Generators.Count() != x.Second.Count()))
{
throw new ArgumentException("The number of responses and the number of generators in the equations do not match.");
}
}
}
}
| using System.Collections.Generic;
using WalletWasabi.Helpers;
using WalletWasabi.Crypto.Groups;
namespace System.Linq
{
public static class Extensions
{
public static GroupElement Sum(this IEnumerable<GroupElement> groupElements) =>
groupElements.Aggregate(GroupElement.Infinity, (ge, acc) => ge + acc);
public static IEnumerable<TResult> Zip<TFirst, TSecond, TThird, TResult>(this IEnumerable<TFirst> first, IEnumerable<TSecond> second, IEnumerable<TThird> third, Func<TFirst, TSecond, TThird, TResult> resultSelector)
{
Guard.NotNull(nameof(first), first);
Guard.NotNull(nameof(second), second);
Guard.NotNull(nameof(third), third);
Guard.NotNull(nameof(resultSelector), resultSelector);
using var e1 = first.GetEnumerator();
using var e2 = second.GetEnumerator();
using var e3 = third.GetEnumerator();
while (e1.MoveNext() && e2.MoveNext() && e3.MoveNext())
{
yield return resultSelector(e1.Current, e2.Current, e3.Current);
}
}
}
}
| mit | C# |
22dbbdfe85caf82da0aca185e94970ebb4a9db88 | Disable Additional Sound Debugging | ludimation/Winter,ludimation/Winter,ludimation/Winter | Winter/Assets/PlayAmbientSound.cs | Winter/Assets/PlayAmbientSound.cs | using UnityEngine;
using System.Collections;
public class PlayAmbientSound : MonoBehaviour {
public float playChance = 0.01f;
public AudioSource source;
public AudioClip[] soundClip;
public GameObject listener;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float distance = Vector3.Distance(listener.transform.position, transform.position);
if (Random.value < playChance && distance < 35) {
// Play your sound.
int clip = (int)Random.Range(0.0f, 2.9f);
//if (!AudioSource.isPlaying) {
//Debug.Log("Sound Played");
//Debug.Log(clip);
AudioSource.PlayClipAtPoint(soundClip[clip], transform.position);
// }
}
}
}
| using UnityEngine;
using System.Collections;
public class PlayAmbientSound : MonoBehaviour {
public float playChance = 0.01f;
public AudioSource source;
public AudioClip[] soundClip;
public GameObject listener;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float distance = Vector3.Distance(listener.transform.position, transform.position);
if (Random.value < playChance && distance < 35) {
// Play your sound.
int clip = (int)Random.Range(0.0f, 2.9f);
//if (!AudioSource.isPlaying) {
Debug.Log("Sound Played");
Debug.Log(clip);
AudioSource.PlayClipAtPoint(soundClip[clip], transform.position);
// }
}
}
}
| mit | C# |
c975586b445bc2807cf6373e51dc54814872c22a | Fix filename in test/build.cake. | lewissbaker/cppcoro,lewissbaker/cppcoro,lewissbaker/cppcoro,lewissbaker/cppcoro | test/build.cake | test/build.cake | ###############################################################################
# Copyright (c) Lewis Baker
# Licenced under MIT license. See LICENSE.txt for details.
###############################################################################
import cake.path
from cake.tools import script, env, compiler, project, variant, test
script.include([
env.expand('${CPPCORO}/lib/use.cake'),
])
headers = script.cwd([
"counted.hpp",
"io_service_fixture.hpp",
])
sources = script.cwd([
'main.cpp',
'counted.cpp',
'generator_tests.cpp',
'recursive_generator_tests.cpp',
'async_generator_tests.cpp',
'async_auto_reset_event_tests.cpp',
'async_manual_reset_event_tests.cpp',
'async_mutex_tests.cpp',
'cancellation_token_tests.cpp',
'task_tests.cpp',
'shared_task_tests.cpp',
'sync_wait_tests.cpp',
'single_consumer_async_auto_reset_event_tests.cpp',
'when_all_tests.cpp',
'when_all_ready_tests.cpp',
])
if variant.platform == 'windows':
sources += script.cwd([
'scheduling_operator_tests.cpp',
'io_service_tests.cpp',
'file_tests.cpp',
])
extras = script.cwd([
'build.cake',
])
intermediateBuildDir = cake.path.join(env.expand('${CPPCORO_BUILD}'), 'test', 'obj')
compiler.addDefine('CPPCORO_RELEASE_' + variant.release.upper())
objects = compiler.objects(
targetDir=intermediateBuildDir,
sources=sources,
)
testExe = compiler.program(
target=env.expand('${CPPCORO_BUILD}/test/run'),
sources=objects,
)
test.alwaysRun = True
testResult = test.run(
program=testExe,
results=env.expand('${CPPCORO_BUILD}/test/run.results'),
)
script.addTarget('testresult', testResult)
vcproj = project.project(
target=env.expand('${CPPCORO_PROJECT}/cppcoro_tests'),
items={
'Source': sources + headers,
'': extras,
},
output=testExe,
)
script.setResult(
project=vcproj,
test=testExe,
)
| ###############################################################################
# Copyright (c) Lewis Baker
# Licenced under MIT license. See LICENSE.txt for details.
###############################################################################
import cake.path
from cake.tools import script, env, compiler, project, variant, test
script.include([
env.expand('${CPPCORO}/lib/use.cake'),
])
headers = script.cwd([
"counted.hpp",
"io_service_fixture.hpp",
])
sources = script.cwd([
'main.cpp',
'counted.cpp',
'generator_tests.cpp',
'recursive_generator_tests.cpp',
'async_generator_tests.cpp',
'async_auto_reset_event_tests.cpp',
'async_manual_reset_event_tests.cpp',
'async_mutex_tests.cpp',
'cancellation_token_tests.cpp',
'task_tests.cpp',
'shared_task_tests.cpp',
'sync_wait_tests.cpp',
'single_consumer_async_auto_reset_event.cpp',
'when_all_tests.cpp',
'when_all_ready_tests.cpp',
])
if variant.platform == 'windows':
sources += script.cwd([
'scheduling_operator_tests.cpp',
'io_service_tests.cpp',
'file_tests.cpp',
])
extras = script.cwd([
'build.cake',
])
intermediateBuildDir = cake.path.join(env.expand('${CPPCORO_BUILD}'), 'test', 'obj')
compiler.addDefine('CPPCORO_RELEASE_' + variant.release.upper())
objects = compiler.objects(
targetDir=intermediateBuildDir,
sources=sources,
)
testExe = compiler.program(
target=env.expand('${CPPCORO_BUILD}/test/run'),
sources=objects,
)
test.alwaysRun = True
testResult = test.run(
program=testExe,
results=env.expand('${CPPCORO_BUILD}/test/run.results'),
)
script.addTarget('testresult', testResult)
vcproj = project.project(
target=env.expand('${CPPCORO_PROJECT}/cppcoro_tests'),
items={
'Source': sources + headers,
'': extras,
},
output=testExe,
)
script.setResult(
project=vcproj,
test=testExe,
)
| mit | C# |
4d13bff77f47c8ff4d146f3ec15f6e676d0bbf4a | Update Issues_180.cs | SixLabors/Fonts | tests/SixLabors.Fonts.Tests/Issues/Issues_180.cs | tests/SixLabors.Fonts.Tests/Issues/Issues_180.cs | // Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
using Xunit;
namespace SixLabors.Fonts.Tests.Issues
{
public class Issues_180
{
[Fact]
public void CorrectlySetsHeightMetrics()
{
// Whitney-book has invalid hhea values.
Font font = new FontCollection().Add(TestFonts.WhitneyBookFile).CreateFont(25);
FontRectangle size = TextMeasurer.Measure("H", new RendererOptions(font));
Assert.Equal(17.6, size.Width, 1);
Assert.Equal(30.6, size.Height, 1);
}
}
}
| // Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
using Xunit;
namespace SixLabors.Fonts.Tests.Issues
{
public class Issues_180
{
[Fact]
public void CorrectlySetsHeightMetrics()
{
// Whitney-book has invalid hhea values.
Font font = new FontCollection().Add(TestFonts.WhitneyBookFile).CreateFont(25);
FontRectangle size = TextMeasurer.Measure("H", new RendererOptions(font));
Assert.Equal(17.6, size.Width, 1);
Assert.Equal(35.6, size.Height, 1);
}
}
}
| apache-2.0 | C# |
6a56f93bfb7aceb832ca3002237dbc0068b17404 | Introduce Vine. Still need a lot of work. But need to refactor block faces first. | yungtechboy1/MiNET | src/MiNET/MiNET/Blocks/Vine.cs | src/MiNET/MiNET/Blocks/Vine.cs | #region LICENSE
// The contents of this file are subject to the Common Public Attribution
// License Version 1.0. (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// https://github.com/NiclasOlofsson/MiNET/blob/master/LICENSE.
// The License is based on the Mozilla Public License Version 1.1, but Sections 14
// and 15 have been added to cover use of software over a computer network and
// provide for limited attribution for the Original Developer. In addition, Exhibit A has
// been modified to be consistent with Exhibit B.
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
// the specific language governing rights and limitations under the License.
//
// The Original Code is MiNET.
//
// The Original Developer is the Initial Developer. The Initial Developer of
// the Original Code is Niclas Olofsson.
//
// All portions of the code written by Niclas Olofsson are Copyright (c) 2014-2018 Niclas Olofsson.
// All Rights Reserved.
#endregion
using System.Numerics;
using log4net;
using MiNET.Utils;
using MiNET.Worlds;
namespace MiNET.Blocks
{
public class Vine : Block
{
private static readonly ILog Log = LogManager.GetLogger(typeof(Vine));
public Vine() : base(106)
{
IsSolid = false;
IsTransparent = false;
BlastResistance = 1;
Hardness = 0.2f;
IsFlammable = true;
IsReplacible = true;
}
public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
Block block = world.GetBlock(Coordinates);
if (block is Vine)
{
Metadata = block.Metadata;
}
Log.Debug($"Face: {face}, CurrentBlock={block}");
byte direction;
switch (face)
{
case BlockFace.East:
direction = 0x01;
break;
case BlockFace.West:
direction = 0x04;
break;
case BlockFace.North:
direction = 0x08;
break;
case BlockFace.South:
direction = 0x02;
break;
default:
return true; // Do nothing
}
if ((Metadata & direction) == direction) return true; // Already have this face covered
Metadata |= direction;
world.SetBlock(this);
return true;
}
}
} | namespace MiNET.Blocks
{
public class Vine : Block
{
public Vine() : base(106)
{
IsSolid = false;
IsTransparent = false;
BlastResistance = 1;
Hardness = 0.2f;
IsFlammable = true;
}
}
} | mpl-2.0 | C# |
0f7ed9ff3168bb90f9796fc07c95d88d876cd447 | Rename cache refresh and make public | HoloFan/HoloToolkit-Unity,NeerajW/HoloToolkit-Unity,HattMarris1/HoloToolkit-Unity,paseb/MixedRealityToolkit-Unity,willcong/HoloToolkit-Unity,out-of-pixel/HoloToolkit-Unity,dbastienMS/HoloToolkit-Unity,ForrestTrepte/HoloToolkit-Unity,paseb/HoloToolkit-Unity | Assets/HoloToolkit/Utilities/Scripts/CameraCache.cs | Assets/HoloToolkit/Utilities/Scripts/CameraCache.cs | using UnityEngine;
namespace HoloToolkit.Unity
{
public static class CameraCache
{
private static Camera cachedCamera;
/// <summary>
/// Returns a cached reference to the main camera and uses Camera.main if it hasn't been cached yet.
/// </summary>
public static Camera main
{
get
{
return cachedCamera ?? Refresh(Camera.main);
}
}
/// <summary>
/// Set the cached camera to a new reference and return it
/// </summary>
/// <param name="newMain">New main camera to cache</param>
/// <returns></returns>
public static Camera Refresh(Camera newMain)
{
return cachedCamera = newMain;
}
}
}
| using UnityEngine;
namespace HoloToolkit.Unity
{
public static class CameraCache
{
private static Camera cachedCamera;
/// <summary>
/// Returns a cached reference to the main camera and uses Camera.main if it hasn't been cached yet.
/// </summary>
public static Camera main
{
get
{
return cachedCamera ?? CacheMain(Camera.main);
}
}
/// <summary>
/// Set the cached camera to a new reference and return it
/// </summary>
/// <param name="newMain">New main camera to cache</param>
/// <returns></returns>
private static Camera CacheMain(Camera newMain)
{
return cachedCamera = newMain;
}
}
}
| mit | C# |
613360c8a72c2fd7c0e44b8747af620d38216496 | Fix logout | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | Battery-Commander.Web/Controllers/HomeController.cs | Battery-Commander.Web/Controllers/HomeController.cs | using BatteryCommander.Web.Models;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Controllers
{
[Authorize, ApiExplorerSettings(IgnoreApi = true)]
public class HomeController : Controller
{
private readonly Database db;
public HomeController(Database db)
{
this.db = db;
}
public IActionResult Index()
{
return RedirectToRoute("Units.List");
}
public IActionResult PrivacyAct()
{
return View();
}
[AllowAnonymous]
public IActionResult Login()
{
return new ChallengeResult("Auth0", new AuthenticationProperties
{
RedirectUri = Url.Action(nameof(PrivacyAct))
});
}
[Route("~/Logout")]
public async Task<IActionResult> Logout()
{
await HttpContext.SignOutAsync();
return RedirectToAction(nameof(Login));
}
public IActionResult Error()
{
return View();
}
}
} | using BatteryCommander.Web.Models;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Controllers
{
[Authorize, ApiExplorerSettings(IgnoreApi = true)]
public class HomeController : Controller
{
private readonly Database db;
public HomeController(Database db)
{
this.db = db;
}
public IActionResult Index()
{
return RedirectToRoute("Units.List");
}
public IActionResult PrivacyAct()
{
return View();
}
[AllowAnonymous]
public IActionResult Login()
{
return new ChallengeResult("Auth0", new Microsoft.AspNetCore.Authentication.AuthenticationProperties
{
RedirectUri = Url.Action(nameof(PrivacyAct))
});
}
[Route("~/Logout")]
public async Task Logout()
{
await HttpContext.Authentication.SignOutAsync("Auth0", new AuthenticationProperties
{
RedirectUri = Url.Action(nameof(Login))
});
await HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
}
public IActionResult Error()
{
return View();
}
}
} | mit | C# |
9f9cb635e259554e39ccdc42c9152be8fdf8bd65 | Add comments and the TTL and highPriority flags for android notifications | mattgwagner/CertiPay.Common | CertiPay.Common.Notifications/Notifications/AndroidNotification.cs | CertiPay.Common.Notifications/Notifications/AndroidNotification.cs | using System;
namespace CertiPay.Common.Notifications
{
/// <summary>
/// Describes a notification sent to an Android device via Google Cloud Messaging
/// </summary>
public class AndroidNotification : Notification
{
public static string QueueName { get; } = "AndroidNotifications";
/// <summary>
/// The subject line of the notification
/// </summary>
public String Title { get; set; }
/// <summary>
/// Maximum lifespan of the message, from 0 to 4 weeks, after which delivery attempts will expire.
/// Setting this to 0 seconds will prevent GCM from throttling the "now or never" message.
///
/// GCM defaults this to 4 weeks.
/// </summary>
public TimeSpan? TimeToLive { get; set; }
/// <summary>
/// Set high priority only if the message is time-critical and requires the user’s
/// immediate interaction, and beware that setting your messages to high priority contributes
/// more to battery drain compared to normal priority messages.
/// </summary>
public Boolean HighPriority { get; set; } = false;
}
} | using System;
namespace CertiPay.Common.Notifications
{
public class AndroidNotification : Notification
{
public static string QueueName { get; } = "AndroidNotifications";
// Message => Content
/// <summary>
/// The subject line of the email
/// </summary>
public String Title { get; set; }
// TODO Android specific properties? Image, Sound, Action Button, Picture, Priority
}
} | mit | C# |
2c2ca000d9fc11731c63f97cce13efc4dbf569de | Remove button. | fielddaylab/Gravity-Escape | Assets/scripts/StatsMenuEvents.cs | Assets/scripts/StatsMenuEvents.cs | using UnityEngine;
using System.Collections;
public class StatsMenuEvents : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void nextLevel()
{
SceneLoader.self.LoadNextLevel();
}
}
| using UnityEngine;
using System.Collections;
public class StatsMenuEvents : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void showLevelSelect()
{
}
public void nextLevel()
{
SceneLoader.self.LoadNextLevel();
}
}
| mit | C# |
8922cbc2cd85f32a1ecc01882a1b6f41081a8410 | fix this InternalsVisibleTo assembly type | autofac/Autofac.Extras.Moq | src/Autofac.Extras.Moq/Properties/AssemblyInfo.cs | src/Autofac.Extras.Moq/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
[assembly: AssemblyTitle("Autofac.Extras.Moq")]
[assembly: InternalsVisibleTo("Autofac.Extras.Tests.Moq, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyCompany("Autofac Project - http://autofac.org")]
[assembly: AssemblyProduct("Autofac")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright 2014 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac Configuration Support")] | using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
[assembly: AssemblyTitle("Autofac.Extras.Moq")]
[assembly: InternalsVisibleTo("Autofac.Tests.Extras.Moq, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyCompany("Autofac Project - http://autofac.org")]
[assembly: AssemblyProduct("Autofac")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright 2014 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac Configuration Support")] | mit | C# |
8bfd066fce8b500d29ee5597ea708f4ac32395d4 | add get all topics | ouraspnet/cap,dotnetcore/CAP,dotnetcore/CAP,dotnetcore/CAP | src/DotNetCore.CAP/Internal/MethodMatcherCache.cs | src/DotNetCore.CAP/Internal/MethodMatcherCache.cs | using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace DotNetCore.CAP.Internal
{
internal class MethodMatcherCache
{
private readonly IConsumerServiceSelector _selector;
private List<string> _allTopics;
public MethodMatcherCache(IConsumerServiceSelector selector)
{
_selector = selector;
Entries = new ConcurrentDictionary<string, IList<ConsumerExecutorDescriptor>>();
}
private ConcurrentDictionary<string, IList<ConsumerExecutorDescriptor>> Entries { get; }
/// <summary>
/// Get a dictionary of candidates.In the dictionary,
/// the Key is the CAPSubscribeAttribute Group, the Value for the current Group of candidates
/// </summary>
public ConcurrentDictionary<string, IList<ConsumerExecutorDescriptor>> GetCandidatesMethodsOfGroupNameGrouped()
{
if (Entries.Count != 0) return Entries;
var executorCollection = _selector.SelectCandidates();
var groupedCandidates = executorCollection.GroupBy(x => x.Attribute.Group);
foreach (var item in groupedCandidates)
Entries.TryAdd(item.Key, item.ToList());
return Entries;
}
/// <summary>
/// Get a dictionary of specify topic candidates.
/// The Key is Group name, the value is specify topic candidates.
/// </summary>
/// <param name="topicName">message topic name</param>
public IDictionary<string, IList<ConsumerExecutorDescriptor>> GetTopicExector(string topicName)
{
if (Entries == null)
throw new ArgumentNullException(nameof(Entries));
var dic = new Dictionary<string, IList<ConsumerExecutorDescriptor>>();
foreach (var item in Entries)
{
var topicCandidates = item.Value.Where(x => x.Attribute.Name == topicName);
dic.Add(item.Key, topicCandidates.ToList());
}
return dic;
}
/// <summary>
/// Get all subscribe topics name.
/// </summary>
public IEnumerable<string> GetSubscribeTopics()
{
if (_allTopics != null)
{
return _allTopics;
}
if (Entries == null)
throw new ArgumentNullException(nameof(Entries));
_allTopics = new List<string>();
foreach (var descriptors in Entries.Values)
{
_allTopics.AddRange(descriptors.Select(x => x.Attribute.Name));
}
return _allTopics;
}
}
} | using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using DotNetCore.CAP.Abstractions;
namespace DotNetCore.CAP.Internal
{
internal class MethodMatcherCache
{
private readonly IConsumerServiceSelector _selector;
public MethodMatcherCache(IConsumerServiceSelector selector)
{
_selector = selector;
Entries = new ConcurrentDictionary<string, IList<ConsumerExecutorDescriptor>>();
}
private ConcurrentDictionary<string, IList<ConsumerExecutorDescriptor>> Entries { get; }
/// <summary>
/// Get a dictionary of candidates.In the dictionary,
/// the Key is the CAPSubscribeAttribute Group, the Value for the current Group of candidates
/// </summary>
public ConcurrentDictionary<string, IList<ConsumerExecutorDescriptor>> GetCandidatesMethodsOfGroupNameGrouped()
{
if (Entries.Count != 0) return Entries;
var executorCollection = _selector.SelectCandidates();
var groupedCandidates = executorCollection.GroupBy(x => x.Attribute.Group);
foreach (var item in groupedCandidates)
Entries.TryAdd(item.Key, item.ToList());
return Entries;
}
/// <summary>
/// Get a dictionary of specify topic candidates.
/// The Key is Group name, the value is specify topic candidates.
/// </summary>
/// <param name="topicName">message topic name</param>
public IDictionary<string, IList<ConsumerExecutorDescriptor>> GetTopicExector(string topicName)
{
if (Entries == null)
throw new ArgumentNullException(nameof(Entries));
var dic = new Dictionary<string, IList<ConsumerExecutorDescriptor>>();
foreach (var item in Entries)
{
var topicCandidates = item.Value.Where(x => x.Attribute.Name == topicName);
dic.Add(item.Key, topicCandidates.ToList());
}
return dic;
}
}
} | mit | C# |
5e91c9ac234dad6b42a918b5f0b57976d4931edc | add test that verifies the sql typecast on a duplicated field is occurring based on the enum storage mechanism chosen | mysticmind/marten,JasperFx/Marten,mdissel/Marten,ericgreenmix/marten,JasperFx/Marten,mysticmind/marten,ericgreenmix/marten,mysticmind/marten,ericgreenmix/marten,mysticmind/marten,mdissel/Marten,ericgreenmix/marten,JasperFx/Marten | src/Marten.Testing/Schema/DuplicatedFieldTests.cs | src/Marten.Testing/Schema/DuplicatedFieldTests.cs | using System.Linq.Expressions;
using System.Reflection;
using Baseline.Reflection;
using Marten.Schema;
using Marten.Testing.Documents;
using NpgsqlTypes;
using Shouldly;
using Xunit;
namespace Marten.Testing.Schema
{
public class DuplicatedFieldTests
{
private DuplicatedField theField = new DuplicatedField(EnumStorage.AsInteger, new MemberInfo[] { ReflectionHelper.GetProperty<User>(x => x.FirstName)});
[Fact]
public void default_role_is_search()
{
theField
.Role.ShouldBe(DuplicatedFieldRole.Search);
}
[Fact]
public void create_table_column_for_non_indexed_search()
{
var column = theField.ToColumn();
column.Name.ShouldBe("first_name");
column.Type.ShouldBe("varchar");
}
[Fact]
public void upsert_argument_defaults()
{
theField.UpsertArgument.Arg.ShouldBe("arg_first_name");
theField.UpsertArgument.Column.ShouldBe("first_name");
theField.UpsertArgument.PostgresType.ShouldBe("varchar");
}
[Fact]
public void sql_locator_with_default_column_name()
{
theField.SqlLocator.ShouldBe("d.first_name");
}
[Fact]
public void sql_locator_with_custom_column_name()
{
theField.ColumnName = "x_first_name";
theField.SqlLocator.ShouldBe("d.x_first_name");
}
[Fact]
public void enum_field()
{
var field = DuplicatedField.For<Target>(EnumStorage.AsString, x => x.Color);
field.UpsertArgument.DbType.ShouldBe(NpgsqlDbType.Varchar);
field.UpsertArgument.PostgresType.ShouldBe("varchar");
var constant = Expression.Constant((int)Colors.Blue);
field.GetValue(constant).ShouldBe(Colors.Blue.ToString());
}
[Theory]
[InlineData(EnumStorage.AsInteger, "color = (data ->> 'Color')::int")]
[InlineData(EnumStorage.AsString, "color = data ->> 'Color'")]
public void storage_is_set_when_passed_in(EnumStorage storageMode, string expectedUpdateFragment)
{
var field = DuplicatedField.For<Target>(storageMode, x => x.Color);
field.UpdateSqlFragment().ShouldBe(expectedUpdateFragment);
}
}
}
| using System.Linq.Expressions;
using System.Reflection;
using Baseline.Reflection;
using Marten.Schema;
using Marten.Testing.Documents;
using NpgsqlTypes;
using Shouldly;
using Xunit;
namespace Marten.Testing.Schema
{
public class DuplicatedFieldTests
{
private DuplicatedField theField = new DuplicatedField(EnumStorage.AsInteger, new MemberInfo[] { ReflectionHelper.GetProperty<User>(x => x.FirstName)});
[Fact]
public void default_role_is_search()
{
theField
.Role.ShouldBe(DuplicatedFieldRole.Search);
}
[Fact]
public void create_table_column_for_non_indexed_search()
{
var column = theField.ToColumn();
column.Name.ShouldBe("first_name");
column.Type.ShouldBe("varchar");
}
[Fact]
public void upsert_argument_defaults()
{
theField.UpsertArgument.Arg.ShouldBe("arg_first_name");
theField.UpsertArgument.Column.ShouldBe("first_name");
theField.UpsertArgument.PostgresType.ShouldBe("varchar");
}
[Fact]
public void sql_locator_with_default_column_name()
{
theField.SqlLocator.ShouldBe("d.first_name");
}
[Fact]
public void sql_locator_with_custom_column_name()
{
theField.ColumnName = "x_first_name";
theField.SqlLocator.ShouldBe("d.x_first_name");
}
[Fact]
public void enum_field()
{
var field = DuplicatedField.For<Target>(EnumStorage.AsString, x => x.Color);
field.UpsertArgument.DbType.ShouldBe(NpgsqlDbType.Varchar);
field.UpsertArgument.PostgresType.ShouldBe("varchar");
var constant = Expression.Constant((int)Colors.Blue);
field.GetValue(constant).ShouldBe(Colors.Blue.ToString());
}
}
} | mit | C# |
e56d7adf237c86b649d3216f58e2812de3b4bee9 | resolve SonarQube S3433 warning to try to fix test fail in CI | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | server/tests/FilterLists.Services.Tests/Extensions/TaskExtensionsTests.cs | server/tests/FilterLists.Services.Tests/Extensions/TaskExtensionsTests.cs | using System;
using System.Threading;
using System.Threading.Tasks;
using FilterLists.Services.Extensions;
using Xunit;
namespace FilterLists.Services.Tests.Extensions
{
public class TaskExtensionsTests
{
private readonly Task sut = Task.Run(() => { Thread.Sleep(TimeSpan.FromSeconds(1)); });
[Fact]
public async Task TimeoutAfter_TimeToCompleteIsGreaterThanTimeout_ThrowsTimeoutException()
{
var oneTickTimeout = new TimeSpan(1);
var taskWithTimeout = sut.TimeoutAfter(oneTickTimeout);
await Assert.ThrowsAsync<TimeoutException>(() => taskWithTimeout);
}
[Fact]
public async Task TimeoutAfter_TimeToCompleteIsLessThanTimeout_CompletesSuccessfully()
{
var twoSecondTimeout = new TimeSpan(0, 0, 2);
await sut.TimeoutAfter(twoSecondTimeout);
Assert.True(sut.IsCompletedSuccessfully);
}
}
} | using System;
using System.Threading;
using System.Threading.Tasks;
using FilterLists.Services.Extensions;
using Xunit;
namespace FilterLists.Services.Tests.Extensions
{
public class TaskExtensionsTests
{
private readonly Task sut = Task.Run(() => { Thread.Sleep(TimeSpan.FromSeconds(1)); });
[Fact]
public async void TimeoutAfter_TimeToCompleteIsGreaterThanTimeout_ThrowsTimeoutException()
{
var oneTickTimeout = new TimeSpan(1);
var taskWithTimeout = sut.TimeoutAfter(oneTickTimeout);
await Assert.ThrowsAsync<TimeoutException>(() => taskWithTimeout);
}
[Fact]
public async void TimeoutAfter_TimeToCompleteIsLessThanTimeout_CompletesSuccessfully()
{
var twoSecondTimeout = new TimeSpan(0, 0, 2);
await sut.TimeoutAfter(twoSecondTimeout);
Assert.True(sut.IsCompletedSuccessfully);
}
}
} | mit | C# |
36d0d8fd30609dc6d5556cba278adb17f22cd1ff | use auto assembly version | leung85/Asp.Net.Identity.SQLite | AspNet.Identity.SQLite/Properties/AssemblyInfo.cs | AspNet.Identity.SQLite/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("AspNet.Identity.SQLite")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AspNet.Identity.SQLite")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("35dac40a-38d0-43bd-8dcf-34e4061f0a75")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 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("AspNet.Identity.SQLite")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AspNet.Identity.SQLite")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("35dac40a-38d0-43bd-8dcf-34e4061f0a75")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
674027689982fbc0b282aea321ea84c0a8e3d3c2 | Fix TargetReached decision | allmonty/BrokenShield,allmonty/BrokenShield | Assets/Scripts/AI/Enemy/TargetReached_Decision.cs | Assets/Scripts/AI/Enemy/TargetReached_Decision.cs | using UnityEngine;
[CreateAssetMenu (menuName = "AI/Decisions/TargetReached")]
public class TargetReached_Decision : Decision {
public bool overrideDistanceToReach;
public float distanceToReach;
public override bool Decide(StateController controller) {
return isTargetReached(controller);
}
private bool isTargetReached(StateController controller) {
var enemyControl = controller as Enemy_StateController;
enemyControl.navMeshAgent.destination = enemyControl.chaseTarget.position;
if(!overrideDistanceToReach)
distanceToReach = enemyControl.navMeshAgent.stoppingDistance;
if(enemyControl.navMeshAgent.remainingDistance <= distanceToReach && !enemyControl.navMeshAgent.pathPending) {
enemyControl.navMeshAgent.Stop();
return true;
} else {
enemyControl.navMeshAgent.Resume();
return false;
}
}
}
| using UnityEngine;
[CreateAssetMenu (menuName = "AI/Decisions/TargetReached")]
public class TargetReached_Decision : Decision {
public GameObject target;
public bool overrideDistanceToReach;
public float distanceToReach;
public override bool Decide(StateController controller) {
return isTargetReached(controller);
}
private bool isTargetReached(StateController controller) {
var enemyControl = controller as Enemy_StateController;
Debug.Log("remainingDistance: " + enemyControl.navMeshAgent.remainingDistance);
if(!overrideDistanceToReach)
distanceToReach = enemyControl.navMeshAgent.stoppingDistance;
if(enemyControl.navMeshAgent.remainingDistance <= distanceToReach && !enemyControl.navMeshAgent.pathPending) {
enemyControl.navMeshAgent.Stop();
return true;
} else {
enemyControl.navMeshAgent.Resume();
return false;
}
}
}
| apache-2.0 | C# |
676e7cedfc077c8d5ac5a1138333d7519e91fae6 | Update TTSCalloutRequest.cs | sinch/nuget-serversdk | src/Sinch.ServerSdk/Callouts/TTSCalloutRequest.cs | src/Sinch.ServerSdk/Callouts/TTSCalloutRequest.cs | using Sinch.ServerSdk.Models;
public class TTSCalloutRequest : ITTSCalloutRequest
{
public string cli { get; set; }
public IdentityModel destination { get; set; }
public string domain { get; set; }
public string custom { get; set; }
public string locale { get; set; }
public string text { get; set; }
public string prompts { get; set; }
public bool enableDice { get; set; }
public bool enableAce { get; set; }
public bool enablePie { get; set; }
public ITTSCalloutRequest AddPrompt(string promptName)
{
this.prompts += ";" + promptName;
return this;
}
public ITTSCalloutRequest AddText(string text)
{
this.prompts += ";" + text;
return this;
}
}
| using Sinch.ServerSdk.Models;
public class TTSCalloutRequest : ITTSCalloutRequest
{
public string cli { get; set; }
public IdentityModel destination { get; set; }
public string domain { get; set; }
public string custom { get; set; }
public string locale { get; set; }
public string text { get; set; }
public string prompts { get; set; }
public bool enableDice { get; set; }
public bool enableAce { get; set; }
public bool enablePie { get; set; }
public ITTSCalloutRequest Addropmpt(string promptName)
{
this.prompts += ";" + promptName;
return this;
}
public ITTSCalloutRequest AddText(string text)
{
this.prompts += ";" + text;
return this;
}
}
| mit | C# |
53ecdd4c712301e437e0e9cba91238cbaa0535bb | add razor help to highlight viewmodel's property type with color red or blue | hatelove/MyMvcHomework,hatelove/MyMvcHomework,hatelove/MyMvcHomework | MyMoney/MyMoney/Views/Accounting/ShowHistory.cshtml | MyMoney/MyMoney/Views/Accounting/ShowHistory.cshtml | @model IEnumerable<MyMoney.Models.ViewModels.AccountingViewModel>
@using MyMoney.Models.Enums;
@{
Layout = null;
}
<table class="table table-bordered table-hover">
<tr>
<th>#</th>
<th>
@Html.DisplayNameFor(model => model.Type)
</th>
<th>
@Html.DisplayNameFor(model => model.Amount)
</th>
<th>
@Html.DisplayNameFor(model => model.Date)
</th>
<th>
@Html.DisplayNameFor(model => model.Remark)
</th>
</tr>
@{ var index = 1;}
@foreach (var item in Model)
{
<tr>
<td>@(index++)</td>
<td>
@*@Html.DisplayFor(modelItem => item.Type)*@
@HighlightType(item.Type)
</td>
<td>
@Html.DisplayFor(modelItem => item.Amount)
</td>
<td>
@Html.DisplayFor(modelItem => item.Date)
</td>
<td>
@Html.DisplayFor(modelItem => item.Remark)
</td>
</tr>
}
</table>
@helper HighlightType(AccountingType type)
{
<span style="color:@(type== AccountingType.支出 ? "red" : "blue")">@(type.ToString())</span>
} | @model IEnumerable<MyMoney.Models.ViewModels.AccountingViewModel>
@{
Layout = null;
}
<table class="table table-bordered table-hover">
<tr>
<th>#</th>
<th>
@Html.DisplayNameFor(model => model.Type)
</th>
<th>
@Html.DisplayNameFor(model => model.Amount)
</th>
<th>
@Html.DisplayNameFor(model => model.Date)
</th>
<th>
@Html.DisplayNameFor(model => model.Remark)
</th>
</tr>
@{ var index = 1;}
@foreach (var item in Model)
{
<tr>
<td>@(index++)</td>
<td>
@Html.DisplayFor(modelItem => item.Type)
</td>
<td>
@Html.DisplayFor(modelItem => item.Amount)
</td>
<td>
@Html.DisplayFor(modelItem => item.Date)
</td>
<td>
@Html.DisplayFor(modelItem => item.Remark)
</td>
</tr>
}
</table> | mit | C# |
ce4ef036360c28c27fb82e5a42865726e003f8fc | Update ShortcutLinkOperation.cs | ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET | ElectronNET.API/Entities/ShortcutLinkOperation.cs | ElectronNET.API/Entities/ShortcutLinkOperation.cs | using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Defines the ShortcutLinkOperation enumeration.
/// </summary>
public enum ShortcutLinkOperation
{
/// <summary>
/// Creates a new shortcut, overwriting if necessary.
/// </summary>
[Description("create")]
Create,
/// <summary>
/// Updates specified properties only on an existing shortcut.
/// </summary>
[Description("update")]
Update,
/// <summary>
/// Overwrites an existing shortcut, fails if the shortcut doesn't exist.
/// </summary>
[Description("replace")]
Replace
}
}
| using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Defines the ThemeSourceMode enumeration.
/// </summary>
public enum ShortcutLinkOperation
{
/// <summary>
/// Creates a new shortcut, overwriting if necessary.
/// </summary>
[Description("create")]
Create,
/// <summary>
/// Updates specified properties only on an existing shortcut.
/// </summary>
[Description("update")]
Update,
/// <summary>
/// Overwrites an existing shortcut, fails if the shortcut doesn't exist.
/// </summary>
[Description("replace")]
Replace
}
} | mit | C# |
a354d96879f03146e403d8c4c219fd3cbb18d038 | Revert "Revert "Revert "Update Examples/.vs/Aspose.Email.Examples.CSharp/v15/Server/sqlite3/storage.ide-wal""" | aspose-email/Aspose.Email-for-.NET,asposeemail/Aspose_Email_NET | Examples/CSharp/Outlook/OLM/LoadAndReadOLMFile.cs | Examples/CSharp/Outlook/OLM/LoadAndReadOLMFile.cs | using System;
using Aspose.Email.Storage.Olm;
using Aspose.Email.Mapi;
namespace Aspose.Email.Examples.CSharp.Email.Outlook.OLM
{
class LoadAndReadOLMFile
{
public static void Run()
{
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
string dst = dataDir + "OutlookforMac.olm";
// ExStart:LoadAndReadOLMFile
using (OlmStorage storage = new OlmStorage(dst))
{
foreach (OlmFolder folder in storage.FolderHierarchy)
{
if (folder.HasMessages)
{
// extract messages from folder
foreach (MapiMessage msg in storage.EnumerateMessages(folder))
{
Console.WriteLine("Subject: " + msg.Subject);
}
}
// read sub-folders
if (folder.SubFolders.Count > 0)
{
foreach (OlmFolder sub_folder in folder.SubFolders)
{
Console.WriteLine("Subfolder: " + sub_folder.Name);
}
}
}
}
// ExEnd:LoadAndReadOLMFile
}
}
}
| using System;
using Aspose.Email.Storage.Olm;
using Aspose.Email.Mapi;
namespace Aspose.Email.Examples.CSharp.Email.Outlook.OLM
{
class LoadAndReadOLMFile
{
public static void Run()
{
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
string dst = dataDir + "OutlookforMac.olm";
// ExStart:LoadAndReadOLMFile
using (OlmStorage storage = new OlmStorage(dst))
{
foreach (OlmFolder folder in storage.FolderHierarchy)
{
if (folder.HasMessages)
{
// extract messages from folder
foreach (MapiMessage msg in storage.EnumerateMessages(folder))
{
Console.WriteLine("Subject: " + msg.Subject);
}
}
// read sub-folders
if (folder.SubFolders.Count > 0)
{
foreach (OlmFolder sub_folder in folder.SubFolders)
{
Console.WriteLine("Subfolder: " + sub_folder.Name);
}
}
}
}
// ExEnd:LoadAndReadOLMFile
}
}
}
| mit | C# |
45714a9616262c9a7a49cfcdcf9376f06fa5653f | Add nl to end of file | ermshiperete/libpalaso,sillsdev/libpalaso,sillsdev/libpalaso,glasseyes/libpalaso,gtryus/libpalaso,gmartin7/libpalaso,sillsdev/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,ermshiperete/libpalaso,glasseyes/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,sillsdev/libpalaso,gtryus/libpalaso,gmartin7/libpalaso,gmartin7/libpalaso,gmartin7/libpalaso | ExtractCopyright.Tests/Properties/AssemblyInfo.cs | ExtractCopyright.Tests/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("ExtractCopyright.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
// 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("085a7785-c407-4623-80c0-bffd2b0d2475")]
#if STRONG_NAME
[assembly: AssemblyKeyFileAttribute("../palaso.snk")]
#endif
| 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("ExtractCopyright.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
// 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("085a7785-c407-4623-80c0-bffd2b0d2475")]
#if STRONG_NAME
[assembly: AssemblyKeyFileAttribute("../palaso.snk")]
#endif | mit | C# |
710ca44bb359075c0a9947c641f2fbf038b61fb1 | Implement HostnameCommand | appharbor/appharbor-cli | src/AppHarbor/Commands/HostnameCommand.cs | src/AppHarbor/Commands/HostnameCommand.cs | using System.IO;
namespace AppHarbor.Commands
{
public class HostnameCommand : ICommand
{
private readonly IApplicationConfiguration _applicationConfiguration;
private readonly IAppHarborClient _appharborClient;
private readonly TextWriter _writer;
public HostnameCommand(IApplicationConfiguration applicationConfiguration, IAppHarborClient appharborClient, TextWriter writer)
{
_applicationConfiguration = applicationConfiguration;
_appharborClient = appharborClient;
_writer = writer;
}
public void Execute(string[] arguments)
{
var applicationId = _applicationConfiguration.GetApplicationId();
var hostnames = _appharborClient.GetHostnames(applicationId);
foreach (var hostname in hostnames)
{
var output = hostname.Value;
output += hostname.Canonical ? " (canonical)" : "";
_writer.WriteLine(output);
}
}
}
}
| using System;
using System.IO;
namespace AppHarbor.Commands
{
public class HostnameCommand : ICommand
{
private readonly IApplicationConfiguration _applicationConfiguration;
private readonly IAppHarborClient _appharborClient;
private readonly TextWriter _writer;
public HostnameCommand(IApplicationConfiguration applicationConfiguration, IAppHarborClient appharborClient, TextWriter writer)
{
_applicationConfiguration = applicationConfiguration;
_appharborClient = appharborClient;
_writer = writer;
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
11dee22f820dadeb5920d474d6f390183d0be5d7 | Implement `SayHelloStrict` | avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors | csharp/Hello/HelloServer/Program.cs | csharp/Hello/HelloServer/Program.cs | using System;
using System.Threading.Tasks;
using Grpc.Core;
using Hello;
namespace HelloServer
{
class HelloServerImpl : HelloService.HelloServiceBase
{
public override Task<HelloResp> SayHello(HelloReq request, ServerCallContext context)
{
return Task.FromResult(new HelloResp { Result = "Hey " + request.Name });
}
public override Task<HelloResp> SayHelloStrict(HelloReq request, ServerCallContext context)
{
if (request.Name.Length >= 10) {
const string msg = "Length of `Name` cannot be more than 10 characters";
throw new RpcException(new Status(StatusCode.InvalidArgument, msg));
}
return Task.FromResult(new HelloResp { Result = "Hey " + request.Name });
}
}
class Program
{
const int Port = 50051;
public static void Main(string[] args)
{
Server server = new Server
{
Services = { HelloService.BindService(new HelloServerImpl()) },
Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
};
server.Start();
Console.WriteLine("Hello server listening on port " + Port);
Console.WriteLine("Press any key to stop the server...");
Console.ReadKey();
server.ShutdownAsync().Wait();
}
}
}
| using System;
using System.Threading.Tasks;
using Grpc.Core;
using Hello;
namespace HelloServer
{
class HelloServerImpl : HelloService.HelloServiceBase
{
// Server side handler of the SayHello RPC
public override Task<HelloResp> SayHello(HelloReq request, ServerCallContext context)
{
return Task.FromResult(new HelloResp { Result = "Hello " + request.Name });
}
}
class Program
{
const int Port = 50051;
public static void Main(string[] args)
{
Server server = new Server
{
Services = { HelloService.BindService(new HelloServerImpl()) },
Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
};
server.Start();
Console.WriteLine("Greeter server listening on port " + Port);
Console.WriteLine("Press any key to stop the server...");
Console.ReadKey();
server.ShutdownAsync().Wait();
}
}
}
| mit | C# |
8db9205d205d4be5962eee3fd494981e98066475 | Use HTTPS for merge conflict (#337) | planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin | src/Firehose.Web/Authors/MergeConflict.cs | src/Firehose.Web/Authors/MergeConflict.cs | using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MergeConflict : IAmACommunityMember, IAmAPodcast
{
public string FirstName => "Merge";
public string LastName => "Conflict";
public string StateOrRegion => "Seattle, WA";
public string EmailAddress => "mergeconflictfm@gmail.com";
public string ShortBioOrTagLine => "is a weekly development podcast hosted by Frank Krueger and James Montemagno.";
public Uri WebSite => new Uri("http://mergeconflict.fm");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://mergeconflict.fireside.fm/rss"); }
}
public string TwitterHandle => "MergeConflictFM";
public string GravatarHash => "24527eb9b29a8adbfc4155db4044dd3c";
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(47.6062100, -122.3320710);
}
}
| using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MergeConflict : IAmACommunityMember, IAmAPodcast
{
public string FirstName => "Merge";
public string LastName => "Conflict";
public string StateOrRegion => "Seattle, WA";
public string EmailAddress => "mergeconflictfm@gmail.com";
public string ShortBioOrTagLine => "is a weekly development podcast hosted by Frank Krueger and James Montemagno.";
public Uri WebSite => new Uri("http://mergeconflict.fm");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.mergeconflict.fm/rss"); }
}
public string TwitterHandle => "MergeConflictFM";
public string GravatarHash => "24527eb9b29a8adbfc4155db4044dd3c";
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(47.6062100, -122.3320710);
}
}
| mit | C# |
4de31f3710e79d8dbd01503dc9fba79757af2ea0 | Add unit test that checks that a logger retrieved before the log manager is initialised can log correctly | Abc-Arbitrage/ZeroLog | src/ZeroLog.Tests/UninitializedLogManagerTests.cs | src/ZeroLog.Tests/UninitializedLogManagerTests.cs | using System;
using NFluent;
using NUnit.Framework;
using ZeroLog.Configuration;
namespace ZeroLog.Tests
{
[TestFixture, NonParallelizable]
public class UninitializedLogManagerTests
{
private TestAppender _testAppender;
[SetUp]
public void SetUpFixture()
{
_testAppender = new TestAppender(true);
}
[TearDown]
public void Teardown()
{
LogManager.Shutdown();
}
[Test]
public void should_log_without_initialize()
{
LogManager.GetLogger("Test").Info($"Test");
}
[Test]
public void should_log_correctly_when_logger_is_retrieved_before_log_manager_is_initialized()
{
var log = LogManager.GetLogger<LogManagerTests>();
LogManager.Initialize(new ZeroLogConfiguration
{
LogMessagePoolSize = 10,
RootLogger =
{
Appenders = { _testAppender }
}
});
var signal = _testAppender.SetMessageCountTarget(1);
log.Info("Lol");
Check.That(signal.Wait(TimeSpan.FromMilliseconds(100))).IsTrue();
}
}
}
| using NUnit.Framework;
namespace ZeroLog.Tests
{
[TestFixture]
public class UninitializedLogManagerTests
{
[TearDown]
public void Teardown()
{
LogManager.Shutdown();
}
[Test]
public void should_log_without_initialize()
{
LogManager.GetLogger("Test").Info($"Test");
}
}
}
| mit | C# |
3372a2c2f4459bb6907581df2992cb995eac2709 | Use implicit cast instead of constructor overload for pre-set result | nano-byte/common,nano-byte/common | src/Common/Future.cs | src/Common/Future.cs | /*
* Copyright 2006-2015 Bastian Eicher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Threading;
namespace NanoByte.Common
{
/// <summary>
/// Combines an <see cref="EventWaitHandle"/> with a result.
/// </summary>
/// <typeparam name="T">The type of the result.</typeparam>
public sealed class Future<T> : IDisposable
{
private T _result;
private readonly EventWaitHandle _waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
/// <summary>
/// Sets the result and signals anyone waiting for it.
/// </summary>
public void Set(T result)
{
_result = result;
_waitHandle.Set();
}
/// <summary>
/// Waits for the result and returns it when it is ready.
/// </summary>
public T Get()
{
_waitHandle.WaitOne();
return _result;
}
/// <summary>
/// Creates a future with the result already set.
/// </summary>
public static implicit operator Future<T>(T value)
{
var future = new Future<T>();
future.Set(value);
return future;
}
/// <inheritdoc/>
public void Dispose()
{
_waitHandle.Close();
}
}
}
| /*
* Copyright 2006-2015 Bastian Eicher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System;
using System.Threading;
namespace NanoByte.Common
{
/// <summary>
/// Combines an <see cref="EventWaitHandle"/> with a result.
/// </summary>
/// <typeparam name="T">The type of the result.</typeparam>
public sealed class Future<T> : IDisposable
{
private T _result;
private readonly EventWaitHandle _waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
/// <summary>
/// Creates a future waiting for a result.
/// </summary>
public Future()
{}
/// <summary>
/// Creates a future with the result already set.
/// </summary>
public Future(T result)
{
Set(result);
}
/// <summary>
/// Sets the result and signals anyone waiting for it.
/// </summary>
public void Set(T result)
{
_result = result;
_waitHandle.Set();
}
/// <summary>
/// Waits for the result and returns it when it is ready.
/// </summary>
public T Get()
{
_waitHandle.WaitOne();
return _result;
}
/// <inheritdoc/>
public void Dispose()
{
_waitHandle.Close();
}
}
}
| mit | C# |
420b715b6e2e7134a9ede19bc6c89bb1d1b270fe | Change default timeout to 30 seconds | GenericHero/SSH.NET,Bloomcredit/SSH.NET,miniter/SSH.NET,sshnet/SSH.NET | Renci.SshClient/Renci.SshClient/ConnectionInfo.cs | Renci.SshClient/Renci.SshClient/ConnectionInfo.cs | using System;
namespace Renci.SshClient
{
public class ConnectionInfo
{
public string Host { get; set; }
public int Port { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public PrivateKeyFile KeyFile { get; set; }
public TimeSpan Timeout { get; set; }
public int RetryAttempts { get; set; }
public int MaxSessions { get; set; }
public ConnectionInfo()
{
// Set default connection values
this.Port = 22;
this.Timeout = TimeSpan.FromSeconds(30);
this.RetryAttempts = 10;
this.MaxSessions = 10;
}
}
}
| using System;
namespace Renci.SshClient
{
public class ConnectionInfo
{
public string Host { get; set; }
public int Port { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public PrivateKeyFile KeyFile { get; set; }
public TimeSpan Timeout { get; set; }
public int RetryAttempts { get; set; }
public int MaxSessions { get; set; }
public ConnectionInfo()
{
// Set default connection values
this.Port = 22;
this.Timeout = TimeSpan.FromMinutes(30);
this.RetryAttempts = 10;
this.MaxSessions = 10;
}
}
}
| mit | C# |
b0ab3960ace3c9e1429a2e6f6b91cf1a1e0ba083 | Edit Copyright info in AssemblyInfo | simplyio/shortcoder | src/Shortcoder/Properties/AssemblyInfo.cs | src/Shortcoder/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("Shortcoder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Shortcoder")]
[assembly: AssemblyCopyright("Copyright © Shortcoder 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d4befc55-b036-453f-b173-d592f89a8b18")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
| 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("Shortcoder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Shortcoder")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d4befc55-b036-453f-b173-d592f89a8b18")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
| mit | C# |
322a7e7bf812e07f91fc1d2bd0dbd1b4bb9758ca | add Profile into context modified: MeetU/MeetU/Models/MuDbContext.cs | Mooophy/meetu,Mooophy/meetu,Mooophy/meetu | MeetU/MeetU/Models/MuDbContext.cs | MeetU/MeetU/Models/MuDbContext.cs | //
// The unique database context used in this project
// @Yue
//
using System;
using System.Data.Entity;
using Microsoft.AspNet.Identity.EntityFramework;
namespace MeetU.Models
{
public class MuDbContext : IdentityDbContext<ApplicationUser>, IDisposable
{
public MuDbContext()
: base("MeetUDB", throwIfV1Schema: false)
{
}
public static MuDbContext Create()
{
return new MuDbContext();
}
public virtual IDbSet<Meetup> Meetups { get; set; }
public virtual IDbSet<Join> Joins { get; set; }
public virtual IDbSet<Comment> Comments { get; set; }
public virtual IDbSet<Profile> Profiles { get; set; }
}
} | //
// The unique database context used in this project
// @Yue
//
using System;
using System.Data.Entity;
using Microsoft.AspNet.Identity.EntityFramework;
namespace MeetU.Models
{
public class MuDbContext : IdentityDbContext<ApplicationUser>, IDisposable
{
public MuDbContext()
: base("MeetUDB", throwIfV1Schema: false)
{
}
public static MuDbContext Create()
{
return new MuDbContext();
}
public virtual IDbSet<Meetup> Meetups { get; set; }
public virtual IDbSet<Join> Joins { get; set; }
public virtual IDbSet<Comment> Comments { get; set; }
}
} | mit | C# |
08405d23f42a40fa9a1cf91da39768193ad212d0 | Fix PlainBrush to use premultiplied alpha for single pixel strokes | PintaProject/Pinta,PintaProject/Pinta,PintaProject/Pinta | Pinta.Tools/Brushes/PlainBrush.cs | Pinta.Tools/Brushes/PlainBrush.cs | //
// PlainBrush.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (c) 2010 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Cairo;
using Pinta.Core;
namespace Pinta.Tools.Brushes
{
public class PlainBrush : BasePaintBrush
{
public override string Name {
get { return Mono.Unix.Catalog.GetString ("Normal"); }
}
public override int Priority {
get { return -100; }
}
protected override Gdk.Rectangle OnMouseMove (Context g, Color strokeColor, ImageSurface surface,
int x, int y, int lastX, int lastY)
{
// Cairo does not support a single-pixel-long single-pixel-wide line
if (x == lastX && y == lastY && g.LineWidth == 1 &&
PintaCore.Workspace.ActiveWorkspace.PointInCanvas (new PointD(x,y))) {
surface.Flush ();
ColorBgra source = surface.GetColorBgraUnchecked (x, y);
source = UserBlendOps.NormalBlendOp.ApplyStatic (source, strokeColor.ToColorBgra ());
surface.SetColorBgra (source.ToPremultipliedAlpha (), x, y);
surface.MarkDirty ();
return new Gdk.Rectangle (x - 1, y - 1, 3, 3);
}
g.MoveTo (lastX + 0.5, lastY + 0.5);
g.LineTo (x + 0.5, y + 0.5);
g.StrokePreserve ();
Gdk.Rectangle dirty = g.FixedStrokeExtents ().ToGdkRectangle ();
// For some reason (?!) we need to inflate the dirty
// rectangle for small brush widths in zoomed images
dirty.Inflate (1, 1);
return dirty;
}
}
}
| //
// PlainBrush.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (c) 2010 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Cairo;
using Pinta.Core;
namespace Pinta.Tools.Brushes
{
public class PlainBrush : BasePaintBrush
{
public override string Name {
get { return Mono.Unix.Catalog.GetString ("Normal"); }
}
public override int Priority {
get { return -100; }
}
protected override Gdk.Rectangle OnMouseMove (Context g, Color strokeColor, ImageSurface surface,
int x, int y, int lastX, int lastY)
{
// Cairo does not support a single-pixel-long single-pixel-wide line
if (x == lastX && y == lastY && g.LineWidth == 1 &&
PintaCore.Workspace.ActiveWorkspace.PointInCanvas (new PointD(x,y))) {
surface.Flush ();
ColorBgra source = surface.GetColorBgraUnchecked (x, y);
source = UserBlendOps.NormalBlendOp.ApplyStatic (source, strokeColor.ToColorBgra ());
surface.SetColorBgra (source, x, y);
surface.MarkDirty ();
return new Gdk.Rectangle (x - 1, y - 1, 3, 3);
}
g.MoveTo (lastX + 0.5, lastY + 0.5);
g.LineTo (x + 0.5, y + 0.5);
g.StrokePreserve ();
Gdk.Rectangle dirty = g.FixedStrokeExtents ().ToGdkRectangle ();
// For some reason (?!) we need to inflate the dirty
// rectangle for small brush widths in zoomed images
dirty.Inflate (1, 1);
return dirty;
}
}
}
| mit | C# |
ee9457ffe82c1f7be39d9f8950a1fd5b930f0698 | Update IEventTelemeter.cs | tiksn/TIKSN-Framework | TIKSN.Core/Analytics/Telemetry/IEventTelemeter.cs | TIKSN.Core/Analytics/Telemetry/IEventTelemeter.cs | using System.Collections.Generic;
using System.Threading.Tasks;
namespace TIKSN.Analytics.Telemetry
{
public interface IEventTelemeter
{
Task TrackEvent(string name);
Task TrackEvent(string name, IDictionary<string, string> properties);
}
}
| using System.Collections.Generic;
using System.Threading.Tasks;
namespace TIKSN.Analytics.Telemetry
{
public interface IEventTelemeter
{
Task TrackEvent(string name);
Task TrackEvent(string name, IDictionary<string, string> properties);
}
} | mit | C# |
27953785c524b7e53dcceba6b5e5b47f279d5839 | Update ITraceTelemeter.cs | tiksn/TIKSN-Framework | TIKSN.Core/Analytics/Telemetry/ITraceTelemeter.cs | TIKSN.Core/Analytics/Telemetry/ITraceTelemeter.cs | using System.Threading.Tasks;
namespace TIKSN.Analytics.Telemetry
{
public interface ITraceTelemeter
{
Task TrackTrace(string message);
Task TrackTrace(string message, TelemetrySeverityLevel severityLevel);
}
}
| using System.Threading.Tasks;
namespace TIKSN.Analytics.Telemetry
{
public interface ITraceTelemeter
{
Task TrackTrace(string message);
Task TrackTrace(string message, TelemetrySeverityLevel severityLevel);
}
} | mit | C# |
8232afdcdad3b60aeb77d736f5e99954eac5fbdd | Fix deserialization of ppu | xobed/RohlikAPI,notdev/RohlikAPI,xobed/RohlikAPI,xobed/RohlikAPI,xobed/RohlikAPI | RohlikAPIWeb/Models/ApiProduct.cs | RohlikAPIWeb/Models/ApiProduct.cs | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace RohlikAPIWeb.Models
{
public class ApiProduct
{
public string Name { get; }
public double Price { get; }
public double PPU { get; }
public string Unit { get; }
public string Sname { get; }
public string Href { get; }
public ApiProduct(string name, double price, double ppu, string unit, string href)
{
Name = name;
Price = price;
PPU = ppu;
Unit = unit;
Href = href;
Sname = StandardizeString(name);
}
private string StandardizeString(string str)
{
var standardizedName = str.ToLower();
standardizedName = RemoveDiacritics(standardizedName);
return standardizedName;
}
private string RemoveDiacritics(string originalString)
{
var normalizedString = originalString.Normalize(NormalizationForm.FormD);
var stringBuilder = new StringBuilder();
foreach (var character in normalizedString)
{
var unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(character);
if (unicodeCategory != UnicodeCategory.NonSpacingMark)
{
stringBuilder.Append(character);
}
}
return stringBuilder.ToString().Normalize(NormalizationForm.FormC);
}
}
} | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace RohlikAPIWeb.Models
{
public class ApiProduct
{
public string Name { get; }
public double Price { get; }
public double PPU { get; }
public string Unit { get; }
public string Sname { get; }
public string Href { get; }
public ApiProduct(string name, double price, double pricePerUnit, string unit, string href)
{
Name = name;
Price = price;
PPU = pricePerUnit;
Unit = unit;
Href = href;
Sname = StandardizeString(name);
}
private string StandardizeString(string str)
{
var standardizedName = str.ToLower();
standardizedName = RemoveDiacritics(standardizedName);
return standardizedName;
}
private string RemoveDiacritics(string originalString)
{
var normalizedString = originalString.Normalize(NormalizationForm.FormD);
var stringBuilder = new StringBuilder();
foreach (var character in normalizedString)
{
var unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(character);
if (unicodeCategory != UnicodeCategory.NonSpacingMark)
{
stringBuilder.Append(character);
}
}
return stringBuilder.ToString().Normalize(NormalizationForm.FormC);
}
}
} | mit | C# |
1be54c3c9812411a82f38047b5c919774cc67880 | set eol-style for AssemblyInfo.cs | forrestv/opende,forrestv/opende,forrestv/opende,forrestv/opende,forrestv/opende | contrib/Ode.NET/Ode/AssemblyInfo.cs | contrib/Ode.NET/Ode/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Ode.NET")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ode.NET")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("1347a35e-c32b-4ff6-8064-7d10b2cc113b")]
[assembly: AssemblyVersion("0.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
[assembly: CLSCompliantAttribute(true)]
| using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Ode.NET")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ode.NET")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("1347a35e-c32b-4ff6-8064-7d10b2cc113b")]
[assembly: AssemblyVersion("0.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
[assembly: CLSCompliantAttribute(true)]
| lgpl-2.1 | C# |
c77f54aac3f18db63e2b47d8719b44e535d66883 | Make Settings class internal. | Sharparam/Foobar2kLib | Sharparam.Foobar2kLib/Settings.cs | Sharparam.Foobar2kLib/Settings.cs | // <copyright file="Settings.cs" company="Adam Hellberg">
// Copyright © 2013 by Adam Hellberg.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
namespace Sharparam.Foobar2kLib
{
internal class Settings
{
internal const string DefaultFile = "settings.xml";
internal readonly string Format;
internal readonly string Host;
internal readonly ushort Port;
internal readonly string Separator;
internal Settings(
string host = "127.0.0.1",
ushort port = 3333,
string format = SongParser.DefaultFormat,
string separator = SongParser.DefaultSeparator)
{
Host = host;
Port = port;
Format = format;
Separator = separator;
}
}
}
| // <copyright file="Settings.cs" company="Adam Hellberg">
// Copyright © 2013 by Adam Hellberg.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
namespace Sharparam.Foobar2kLib
{
public class Settings
{
public const string DefaultFile = "settings.xml";
public readonly string Format;
public readonly string Host;
public readonly ushort Port;
public readonly string Separator;
public Settings(
string host = "127.0.0.1",
ushort port = 3333,
string format = SongParser.DefaultFormat,
string separator = SongParser.DefaultSeparator)
{
Host = host;
Port = port;
Format = format;
Separator = separator;
}
}
}
| mit | C# |
9624e83937bcee9913d7edb150dfffac57aeeefe | add CheckEnoughScrollViewListItems() in NGUIPanelHelper.cs | NDark/ndinfrastructure,NDark/ndinfrastructure | Unity/NGUIUtil/NGUIPanelHelper.cs | Unity/NGUIUtil/NGUIPanelHelper.cs | /**
MIT License
Copyright (c) 2017 - 2020 NDark
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.
*/
/**
@file NGUIUICollector.cs
@author NDark
@date 20180112 . file started.
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NGUIPanelHelper : MonoBehaviour
{
public string CloseButtonPath = string.Empty;
public UIPanel Panel { get { return m_Panel ; } }
public float PanelAlpha { get { return (null!=m_Panel) ? m_Panel.alpha : 0.0f ; } }
public UIButton CloseButton { get { return m_CloseButton ; } }
public NGUIUICollector UIs { get { return m_UIs ; } }
public void Show( bool _Show )
{
if( null == m_TweenAlpha )
{
return ;
}
if( _Show )
{
m_TweenAlpha.PlayForward();
}
else
{
m_TweenAlpha.PlayReverse() ;
}
}
void Awake()
{
SetupStructure() ;
}
protected virtual void SetupStructure()
{
m_Panel = this.gameObject.GetComponent<UIPanel>() ;
m_TweenAlpha = this.gameObject.GetComponent<TweenAlpha>() ;
if( string.Empty != this.CloseButtonPath )
{
SetupCloseButton( this.CloseButtonPath ) ;
}
m_UIs.SetupObj( this.gameObject ) ;
}
public void SetupCloseButton( string _Path )
{
m_CloseButton = UnityFind.ComponentFind<UIButton>( this.transform , _Path ) ;
}
public void CheckEnoughScrollViewListItems(
List<NGUIUICollector> inputList
, int dataCount
, GameObject parent
, GameObject prefab
)
{
for (int i = 0; i < dataCount; ++i)
{
if (i >= inputList.Count)
{
GameObject addObj = NGUITools.AddChild(parent, prefab);
if (null != addObj)
{
NGUIUICollector collector = new NGUIUICollector();
collector.SetupObj(addObj);
inputList.Add(collector);
}
}
}
}
NGUIUICollector m_UIs = new NGUIUICollector() ;
UIButton m_CloseButton = null ;
UIPanel m_Panel = null ;
TweenAlpha m_TweenAlpha = null ;
}
| /**
MIT License
Copyright (c) 2017 - 2020 NDark
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.
*/
/**
@file NGUIUICollector.cs
@author NDark
@date 20180112 . file started.
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NGUIPanelHelper : MonoBehaviour
{
public string CloseButtonPath = string.Empty;
public UIPanel Panel { get { return m_Panel ; } }
public float PanelAlpha { get { return (null!=m_Panel) ? m_Panel.alpha : 0.0f ; } }
public UIButton CloseButton { get { return m_CloseButton ; } }
public NGUIUICollector UIs { get { return m_UIs ; } }
public void Show( bool _Show )
{
if( null == m_TweenAlpha )
{
return ;
}
if( _Show )
{
m_TweenAlpha.PlayForward();
}
else
{
m_TweenAlpha.PlayReverse() ;
}
}
void Awake()
{
SetupStructure() ;
}
protected virtual void SetupStructure()
{
m_Panel = this.gameObject.GetComponent<UIPanel>() ;
m_TweenAlpha = this.gameObject.GetComponent<TweenAlpha>() ;
if( string.Empty != this.CloseButtonPath )
{
SetupCloseButton( this.CloseButtonPath ) ;
}
m_UIs.SetupObj( this.gameObject ) ;
}
public void SetupCloseButton( string _Path )
{
m_CloseButton = UnityFind.ComponentFind<UIButton>( this.transform , _Path ) ;
}
NGUIUICollector m_UIs = new NGUIUICollector() ;
UIButton m_CloseButton = null ;
UIPanel m_Panel = null ;
TweenAlpha m_TweenAlpha = null ;
}
| mit | C# |
ab4abee21356f62df5521cb4faa6bf3676cf4eae | fix InterfaceHelper | erebuswolf/LockstepFramework,yanyiyun/LockstepFramework,SnpM/Lockstep-Framework | Core/Game/Player/InterfacingHelper.cs | Core/Game/Player/InterfacingHelper.cs | using UnityEngine;
using System.Collections;
namespace Lockstep
{
public abstract class InterfacingHelper : MonoBehaviour
{
public void Initialize()
{
this.OnInitialize();
}
protected virtual void OnInitialize()
{
}
public void LateInitialize()
{
this.OnLateInitialize();
}
protected virtual void OnLateInitialize()
{
}
public void Simulate()
{
this.OnSimulate();
}
protected virtual void OnSimulate()
{
}
public void Visualize()
{
this.OnVisualize();
}
protected virtual void OnVisualize()
{
}
public void Deactivate()
{
this.OnDeactivate();
}
protected virtual void OnDeactivate()
{
}
}
} | using UnityEngine;
using System.Collections;
namespace Lockstep
{
public abstract class InterfacingHelper
{
public void Initialize()
{
this.OnInitialize();
}
protected virtual void OnInitialize()
{
}
public void LateInitialize()
{
this.OnLateInitialize();
}
protected virtual void OnLateInitialize()
{
}
public void Simulate()
{
this.OnSimulate();
}
protected virtual void OnSimulate()
{
}
public void Visualize()
{
this.OnVisualize();
}
protected virtual void OnVisualize()
{
}
public void Deactivate()
{
this.OnDeactivate();
}
protected virtual void OnDeactivate()
{
}
}
} | mit | C# |
0b7300e788d80c59ab1aedc8ba9601ce8c3d98ff | Tidy up. | DanTup/SimpleSlackBot | TestBot/Program.cs | TestBot/Program.cs | using System;
using System.Diagnostics;
using System.Threading.Tasks;
using SimpleSlackBot;
using TestBot.Handlers;
namespace TestBot
{
class Program
{
static void Main(string[] args)
{
/* REPLACE THESE VALUES WITH YOUR OWN */
var useSlackBot = false; // Set to true to use real Slack bot, rather than console.
var slackToken = Environment.GetEnvironmentVariable("SLACK_BOT", EnvironmentVariableTarget.User); // Slack bot access token.
var fbUrl = Environment.GetEnvironmentVariable("SLACK_BOT_FB_URL", EnvironmentVariableTarget.User); // FogBugz installation url.
var fbToken = Environment.GetEnvironmentVariable("SLACK_BOT_FB_TOKEN", EnvironmentVariableTarget.User); // FogBugz access token.
var handlers = new Handler[]
{
new EchoHandler(),
new CountdownHandler(),
new FogBugzCaseHandler(new Uri(fbUrl), fbToken),
new SlowEchoHandler(),
};
if (useSlackBot)
RunSlackBotAsync(slackToken, handlers).Wait();
else
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Using ConsoleBot by default. Please edit the values at the top of Program.cs to connect to a real Slack instance.");
Console.WriteLine("Type 'quit' to quit.");
Console.ResetColor();
Console.WriteLine();
RunConsoleBot(handlers);
}
}
static void RunConsoleBot(Handler[] handlers)
{
var bot = new ConsoleBot();
foreach (var handler in handlers)
bot.RegisterHandler(handler);
bot.HandleInput();
}
static async Task RunSlackBotAsync(string token, Handler[] handlers)
{
Debug.Listeners.Add(new ConsoleTraceListener());
using (var bot = await SlackBot.Connect(token))
{
foreach (var handler in handlers)
bot.RegisterHandler(handler);
Console.WriteLine("Press a key to disconnect...");
Console.ReadKey();
Console.WriteLine();
await bot.Disconnect();
}
}
}
}
| using System;
using System.Diagnostics;
using System.Threading.Tasks;
using SimpleSlackBot;
using TestBot.Handlers;
namespace TestBot
{
class Program
{
static void Main(string[] args)
{
var fbUrl = Environment.GetEnvironmentVariable("SLACK_BOT_FB_URL", EnvironmentVariableTarget.User);
var fbToken = Environment.GetEnvironmentVariable("SLACK_BOT_FB_TOKEN", EnvironmentVariableTarget.User);
var handlers = new Handler[]
{
new EchoHandler(),
new CountdownHandler(),
new FogBugzCaseHandler(new Uri(fbUrl), fbToken),
new SlowEchoHandler(),
};
//RunSlackBotAsync(handlers).Wait();
RunConsoleBot(handlers);
}
static void RunConsoleBot(Handler[] handlers)
{
var bot = new ConsoleBot();
foreach (var handler in handlers)
bot.RegisterHandler(handler);
bot.HandleInput();
}
static async Task RunSlackBotAsync(Handler[] handlers)
{
Debug.Listeners.Add(new ConsoleTraceListener());
var token = Environment.GetEnvironmentVariable("SLACK_BOT", EnvironmentVariableTarget.User);
using (var bot = await SlackBot.Connect(token))
{
foreach (var handler in handlers)
bot.RegisterHandler(handler);
Console.WriteLine("Press a key to disconnect...");
Console.ReadKey();
Console.WriteLine();
await bot.Disconnect();
}
}
}
}
| mit | C# |
3c253ca5cb379b631e0571d93445005f1cbe40c6 | Bump version to 1.11.0.0 | InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform | Files/Packaging/GlobalAssemblyInfo.cs | Files/Packaging/GlobalAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Infinnity Solutions")]
[assembly: AssemblyProduct("InfinniPlatform")]
[assembly: AssemblyCopyright("Copyright © Infinnity Solutions 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyConfiguration("")]
// TeamCity File Content Replacer: Add build number
// Look in: */Packaging/GlobalAssemblyInfo.cs
// Find what: ((AssemblyVersion|AssemblyFileVersion)\s*\(\s*@?\")(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)\.(?<build>[0-9]+)(\"\s*\))
// Replace with: $1$3.$4.$5.\%build.number%$7
[assembly: AssemblyVersion("1.11.0.0")]
[assembly: AssemblyFileVersion("1.11.0.0")]
// TeamCity File Content Replacer: Add VCS hash
// Look in: */Packaging/GlobalAssemblyInfo.cs
// Find what: (AssemblyInformationalVersion\s*\(\s*@?\").*?(\"\s*\))
// Replace with: $1\%build.vcs.number%$2
[assembly: AssemblyInformationalVersion("")] | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Infinnity Solutions")]
[assembly: AssemblyProduct("InfinniPlatform")]
[assembly: AssemblyCopyright("Copyright © Infinnity Solutions 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyConfiguration("")]
// TeamCity File Content Replacer: Add build number
// Look in: */Packaging/GlobalAssemblyInfo.cs
// Find what: ((AssemblyVersion|AssemblyFileVersion)\s*\(\s*@?\")(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)\.(?<build>[0-9]+)(\"\s*\))
// Replace with: $1$3.$4.$5.\%build.number%$7
[assembly: AssemblyVersion("1.10.0.0")]
[assembly: AssemblyFileVersion("1.10.0.0")]
// TeamCity File Content Replacer: Add VCS hash
// Look in: */Packaging/GlobalAssemblyInfo.cs
// Find what: (AssemblyInformationalVersion\s*\(\s*@?\").*?(\"\s*\))
// Replace with: $1\%build.vcs.number%$2
[assembly: AssemblyInformationalVersion("")] | agpl-3.0 | C# |
c25def86465431c1805cbaf24b987ba4c2bced04 | Make the CronFormatException class public | HangfireIO/Cronos | src/Cronos/CronFormatException.cs | src/Cronos/CronFormatException.cs | using System;
namespace Cronos
{
/// <summary>
/// Represents an exception that's thrown, when invalid Cron expression is given.
/// </summary>
public class CronFormatException : FormatException
{
/// <summary>
/// Initializes a new instance of the <see cref="CronFormatException"/> class with
/// the given message.
/// </summary>
public CronFormatException(string message) : base(message)
{
}
internal CronFormatException(CronField field, string message) : this($"{field}: {message}")
{
}
}
} | using System;
namespace Cronos
{
internal class CronFormatException : FormatException
{
public CronFormatException(CronField field, string message): base($"{field}: {message}")
{
}
public CronFormatException(string message) : base(message)
{
}
}
} | mit | C# |
c0c1b8d62014bb0c23dad2e3b924051af5467303 | Fix catcher hyper-dash afterimage is not always displayed | smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu-new,peppy/osu,UselessToucan/osu | osu.Game.Rulesets.Catch/UI/CatcherTrail.cs | osu.Game.Rulesets.Catch/UI/CatcherTrail.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.Graphics;
using osu.Framework.Graphics.Pooling;
using osu.Framework.Timing;
using osuTK;
namespace osu.Game.Rulesets.Catch.UI
{
/// <summary>
/// A trail of the catcher.
/// It also represents a hyper dash afterimage.
/// </summary>
public class CatcherTrail : PoolableDrawable
{
public CatcherAnimationState AnimationState
{
set => body.AnimationState.Value = value;
}
private readonly SkinnableCatcher body;
public CatcherTrail()
{
Size = new Vector2(CatcherArea.CATCHER_SIZE);
Origin = Anchor.TopCentre;
Blending = BlendingParameters.Additive;
InternalChild = body = new SkinnableCatcher
{
// Using a frozen clock because trails should not be animated when the skin has an animated catcher.
// TODO: The animation should be frozen at the animation frame at the time of the trail generation.
Clock = new FramedClock(new ManualClock()),
};
}
protected override void FreeAfterUse()
{
ClearTransforms();
Alpha = 1;
base.FreeAfterUse();
}
}
}
| // 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.Graphics.Pooling;
using osu.Framework.Timing;
using osuTK;
namespace osu.Game.Rulesets.Catch.UI
{
/// <summary>
/// A trail of the catcher.
/// It also represents a hyper dash afterimage.
/// </summary>
public class CatcherTrail : PoolableDrawable
{
public CatcherAnimationState AnimationState
{
set => body.AnimationState.Value = value;
}
private readonly SkinnableCatcher body;
public CatcherTrail()
{
Size = new Vector2(CatcherArea.CATCHER_SIZE);
Origin = Anchor.TopCentre;
Blending = BlendingParameters.Additive;
InternalChild = body = new SkinnableCatcher
{
// Using a frozen clock because trails should not be animated when the skin has an animated catcher.
// TODO: The animation should be frozen at the animation frame at the time of the trail generation.
Clock = new FramedClock(new ManualClock()),
};
}
protected override void FreeAfterUse()
{
ClearTransforms();
base.FreeAfterUse();
}
}
}
| mit | C# |
22c09ec893b184b6a3611eae18a5daa43b85b5a7 | Handle subdirectories during beatmap stable import | peppy/osu,peppy/osu,peppy/osu,ppy/osu,ppy/osu,ppy/osu | osu.Game/Database/LegacyBeatmapImporter.cs | osu.Game/Database/LegacyBeatmapImporter.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.IO.Stores;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.IO;
namespace osu.Game.Database
{
public class LegacyBeatmapImporter : LegacyModelImporter<BeatmapSetInfo>
{
protected override string ImportFromStablePath => ".";
protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage();
protected override IEnumerable<string> GetStableImportPaths(Storage storage)
{
foreach (string beatmapDirectory in storage.GetDirectories(string.Empty))
{
var beatmapStorage = storage.GetStorageForDirectory(beatmapDirectory);
if (!beatmapStorage.GetFiles(string.Empty).ExcludeSystemFileNames().Any())
{
// if a directory doesn't contain files, attempt looking for beatmaps inside of that directory.
// this is a special behaviour in stable for beatmaps only, see https://github.com/ppy/osu/issues/18615.
foreach (string beatmapInDirectory in GetStableImportPaths(beatmapStorage))
yield return beatmapStorage.GetFullPath(beatmapInDirectory);
}
else
yield return storage.GetFullPath(beatmapDirectory);
}
}
public LegacyBeatmapImporter(IModelImporter<BeatmapSetInfo> importer)
: base(importer)
{
}
}
}
| // 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.Platform;
using osu.Game.Beatmaps;
using osu.Game.IO;
namespace osu.Game.Database
{
public class LegacyBeatmapImporter : LegacyModelImporter<BeatmapSetInfo>
{
protected override string ImportFromStablePath => ".";
protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage();
public LegacyBeatmapImporter(IModelImporter<BeatmapSetInfo> importer)
: base(importer)
{
}
}
}
| mit | C# |
8df84e98e1d78ad6aa9554148ba2826540bf1aca | Add comment | 60071jimmy/UartOscilloscope,60071jimmy/UartOscilloscope | QueueDataGraphic/QueueDataGraphic/CSharpFiles/QueueDataGraphic.cs | QueueDataGraphic/QueueDataGraphic/CSharpFiles/QueueDataGraphic.cs | /********************************************************************
* Develop by Jimmy Hu *
* This program is licensed under the Apache License 2.0. *
* QueueDataGraphic.cs *
* 本檔案用於佇列資料繪圖功能 *
********************************************************************
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{ // namespace start, 進入命名空間
class QueueDataGraphic // QueueDataGraphic class, QueueDataGraphic類別
{ // QueueDataGraphic class start, 進入QueueDataGraphic類別
} // QueueDataGraphic class end, 結束QueueDataGraphic類別
} // namespace end, 結束命名空間
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{ // namespace start, 進入命名空間
class QueueDataGraphic // QueueDataGraphic class, QueueDataGraphic類別
{ // QueueDataGraphic class start, 進入QueueDataGraphic類別
} // QueueDataGraphic class end, 結束QueueDataGraphic類別
} // namespace end, 結束命名空間
| apache-2.0 | C# |
055072b1c086f6590808badd1c97e3daef562421 | Add more test examples. | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | csharp/ql/test/utils/model-generator/theorems/TheoremSummaries.cs | csharp/ql/test/utils/model-generator/theorems/TheoremSummaries.cs | using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
namespace Summaries;
public class Theorems1<T> {
public T Prop {
get { throw null; }
set { throw null; }
}
public Theorems1(T t) { throw null; }
public T Get() { throw null; }
public T Get(object x) { throw null; }
public T Id(T x) { throw null; }
public S Transform<S>(S x) { throw null; }
public void Set(T x) { throw null; }
public void Set(int x, T y) { throw null; }
// No summary as S is unrelated to T
public void Set<S>(S x) { throw null; }
public IList<T> GetMany() { throw null; }
public void AddMany(IEnumerable<T> xs) { throw null; }
public int Apply(Func<T, int> f) { throw null; }
public S Apply<S>(Func<T, S> f) { throw null; }
public T2 Apply<T1,T2>(T1 x, Func<T1, T2> f) { throw null; }
public S Map<S>(Func<T, S> f) { throw null; }
public Theorems1<S> MapTheorem<S>(Func<T, S> f) { throw null; }
public Theorems1<S> FlatMap<S>(Func<T, IEnumerable<S>> f) { throw null; }
public Theorems1<T> FlatMap(Func<T, IEnumerable<T>> f) { throw null; }
public Theorems1<T> Return(Func<T, Theorems1<T>> f) { throw null; }
// Examples still not working:
// public void Set(int x, Func<int, T> f) { throw null;}
}
// It is assumed that this is a collection with elements of type T.
public class CollectionTheorems1<T> : IEnumerable<T> {
IEnumerator<T> IEnumerable<T>.GetEnumerator() { throw null; }
IEnumerator IEnumerable.GetEnumerator() { throw null; }
public T First() { throw null; }
public void Add(T x) { throw null; }
public ICollection<T> GetMany() { throw null; }
public void AddMany(IEnumerable<T> x) { throw null; }
}
// It is assumed that this is NOT a collection with elements of type T.
public class CollectionTheorems2<T> : IEnumerable {
IEnumerator IEnumerable.GetEnumerator() { throw null; }
public T Get() { throw null; }
public void Set(T x) { throw null; }
} | using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
namespace Summaries;
public class Theorems1<T> {
public T Prop {
get { throw null; }
set { throw null; }
}
public Theorems1(T t) { throw null; }
public T Get() { throw null; }
public T Get(object x) { throw null; }
public T Id(T x) { throw null; }
public S Transform<S>(S x) { throw null; }
public void Set(T x) { throw null; }
public void Set(int x, T y) { throw null; }
// No summary as S is unrelated to T
public void Set<S>(S x) { throw null; }
public int Apply(Func<T, int> f) { throw null; }
public IList<T> GetMany() { throw null; }
public void AddMany(IEnumerable<T> xs) { throw null; }
}
// It is assumed that this is a collection with elements of type T.
public class CollectionTheorems1<T> : IEnumerable<T> {
IEnumerator<T> IEnumerable<T>.GetEnumerator() { throw null; }
IEnumerator IEnumerable.GetEnumerator() { throw null; }
public T First() { throw null; }
public void Add(T x) { throw null; }
public ICollection<T> GetMany() { throw null; }
public void AddMany(IEnumerable<T> x) { throw null; }
}
// It is assumed that this is NOT a collection with elements of type T.
public class CollectionTheorems2<T> : IEnumerable {
IEnumerator IEnumerable.GetEnumerator() { throw null; }
public T Get() { throw null; }
public void Set(T x) { throw null; }
} | mit | C# |
93f329f251a797b828f53de0bdc2f25492d0d742 | Remove unnecessary calls. | eightyeight/t3d-bones,eightyeight/t3d-bones | main.cs | main.cs | // Display a splash window immediately to improve app responsiveness before
// engine is initialized and main window created
displaySplashWindow("splash.bmp");
//-----------------------------------------------------------------------------
// Load up scripts to initialise subsystems.
exec("sys/main.cs");
// The canvas needs to be initialized before any gui scripts are run since
// some of the controls assume that the canvas exists at load time.
createCanvas("T3Dbones");
// Start rendering and stuff.
initRenderManager();
initLightingSystems("Basic Lighting");
// Start audio.
sfxStartup();
// Provide stubs so we don't get console errors. If you actually want to use
// any of these functions, be sure to remove the empty definition here.
function onDatablockObjectReceived() {}
function onGhostAlwaysObjectReceived() {}
function onGhostAlwaysStarted() {}
function updateTSShapeLoadProgress() {}
//-----------------------------------------------------------------------------
// Load console.
exec("lib/console/main.cs");
// Load up game code.
exec("game/main.cs");
// Called when we connect to the local game.
function GameConnection::onConnect(%this) {
%this.transmitDataBlocks(0);
}
// Called when all datablocks from above have been transmitted.
function GameConnection::onDataBlocksDone(%this) {
closeSplashWindow();
Canvas.showWindow();
// Start sending ghosts to the client.
%this.activateGhosting();
%this.onEnterGame();
}
// Create a local game server and connect to it.
new SimGroup(ServerGroup);
new GameConnection(ServerConnection);
// This calls GameConnection::onConnect.
ServerConnection.connectLocal();
// Start game-specific scripts.
onStart();
//-----------------------------------------------------------------------------
// Called when the engine is shutting down.
function onExit() {
// Clean up ghosts.
ServerConnection.delete();
// Clean up game objects and so on.
onEnd();
// Delete server-side objects and datablocks.
ServerGroup.delete();
deleteDataBlocks();
}
| // Display a splash window immediately to improve app responsiveness before
// engine is initialized and main window created
displaySplashWindow("splash.bmp");
// Console does something.
setLogMode(2);
// Disable script trace.
trace(false);
//-----------------------------------------------------------------------------
// Load up scripts to initialise subsystems.
exec("sys/main.cs");
// The canvas needs to be initialized before any gui scripts are run since
// some of the controls assume that the canvas exists at load time.
createCanvas("T3Dbones");
// Start rendering and stuff.
initRenderManager();
initLightingSystems("Basic Lighting");
// Start audio.
sfxStartup();
// Provide stubs so we don't get console errors. If you actually want to use
// any of these functions, be sure to remove the empty definition here.
function onDatablockObjectReceived() {}
function onGhostAlwaysObjectReceived() {}
function onGhostAlwaysStarted() {}
function updateTSShapeLoadProgress() {}
//-----------------------------------------------------------------------------
// Load console.
exec("lib/console/main.cs");
// Load up game code.
exec("game/main.cs");
// Called when we connect to the local game.
function GameConnection::onConnect(%this) {
%this.transmitDataBlocks(0);
}
// Called when all datablocks from above have been transmitted.
function GameConnection::onDataBlocksDone(%this) {
closeSplashWindow();
Canvas.showWindow();
// Start sending ghosts to the client.
%this.activateGhosting();
%this.onEnterGame();
}
// Create a local game server and connect to it.
new SimGroup(ServerGroup);
new GameConnection(ServerConnection);
// This calls GameConnection::onConnect.
ServerConnection.connectLocal();
// Start game-specific scripts.
onStart();
//-----------------------------------------------------------------------------
// Called when the engine is shutting down.
function onExit() {
// Clean up ghosts.
ServerConnection.delete();
// Clean up game objects and so on.
onEnd();
// Delete server-side objects and datablocks.
ServerGroup.delete();
deleteDataBlocks();
}
| mit | C# |
51bbb6326ad3b8130ff2a857dbdb9f7500cc91fc | Fix test that failed if you're east of EST | rubberduck203/GitNStats,rubberduck203/GitNStats | tests/gitnstats.core.tests/Analysis/DateFilter.cs | tests/gitnstats.core.tests/Analysis/DateFilter.cs | using System;
using GitNStats.Core.Tests;
using LibGit2Sharp;
using Xunit;
using static GitNStats.Core.Analysis;
using static GitNStats.Core.Tests.Fakes;
namespace GitNStats.Tests.Analysis
{
public class DateFilter
{
[Fact]
public void LaterThanFilter_ReturnsTrue()
{
var commit = Commit().WithAuthor(DateTimeOffset.Parse("2017-06-22 13:30 -4:00"));
var predicate = OnOrAfter(new DateTime(2017, 6, 21));
Assert.True(predicate(Diff(commit)));
}
[Fact]
public void PriorToFilter_ReturnsFalse()
{
var commit = Commit().WithAuthor(DateTimeOffset.Parse("2017-06-20 13:30 -4:00"));
var predicate = OnOrAfter(new DateTime(2017, 6, 21));
Assert.False(predicate(Diff(commit)));
}
[Fact]
public void GivenTimeInESTAndCommitWasInADT_ReturnsFalse()
{
var datetime = new DateTime(2017,6,21,13,30,0);
var adtOffset = new TimeSpan(-3,0,0);
var estOffset = new TimeSpan(-4,0,0);
var commit = Commit().WithAuthor(new DateTimeOffset(datetime, adtOffset));
var predicate = OnOrAfter(new DateTimeOffset(datetime,estOffset).LocalDateTime);
Assert.False(predicate(Diff(commit)));
}
[Fact]
public void WhenEqualTo_ReturnTrue()
{
var commit = Commit().WithAuthor(DateTimeOffset.Parse("2017-06-21 13:30 -4:00"));
var predicate = OnOrAfter(new DateTime(2017, 6, 21, 13, 30, 0, DateTimeKind.Local));
Assert.True(predicate(Diff(commit)));
}
[Fact]
public void GivenTimeInESTAndCommitWasCST_ReturnsTrue()
{
var commit = Commit().WithAuthor(DateTimeOffset.Parse("2017-06-21 13:30 -6:00"));
var predicate = OnOrAfter(new DateTime(2017, 6, 21, 13, 30, 0, DateTimeKind.Local));
Assert.True(predicate(Diff(commit)));
}
}
} | using System;
using GitNStats.Core.Tests;
using LibGit2Sharp;
using Xunit;
using static GitNStats.Core.Analysis;
using static GitNStats.Core.Tests.Fakes;
namespace GitNStats.Tests.Analysis
{
public class DateFilter
{
[Fact]
public void LaterThanFilter_ReturnsTrue()
{
var commit = Commit().WithAuthor(DateTimeOffset.Parse("2017-06-22 13:30 -4:00"));
var predicate = OnOrAfter(new DateTime(2017, 6, 21));
Assert.True(predicate(Diff(commit)));
}
[Fact]
public void PriorToFilter_ReturnsFalse()
{
var commit = Commit().WithAuthor(DateTimeOffset.Parse("2017-06-20 13:30 -4:00"));
var predicate = OnOrAfter(new DateTime(2017, 6, 21));
Assert.False(predicate(Diff(commit)));
}
[Fact] public void GivenTimeInESTAndCommitWasInADT_ReturnsFalse()
{
var commit = Commit().WithAuthor(DateTimeOffset.Parse("2017-06-21 13:30 -3:00"));
var predicate = OnOrAfter(new DateTime(2017, 6, 21, 13, 30, 0, DateTimeKind.Local));
Assert.False(predicate(Diff(commit)));
}
[Fact]
public void WhenEqualTo_ReturnTrue()
{
var commit = Commit().WithAuthor(DateTimeOffset.Parse("2017-06-21 13:30 -4:00"));
var predicate = OnOrAfter(new DateTime(2017, 6, 21, 13, 30, 0, DateTimeKind.Local));
Assert.True(predicate(Diff(commit)));
}
[Fact]
public void GivenTimeInESTAndCommitWasCST_ReturnsTrue()
{
var commit = Commit().WithAuthor(DateTimeOffset.Parse("2017-06-21 13:30 -6:00"));
var predicate = OnOrAfter(new DateTime(2017, 6, 21, 13, 30, 0, DateTimeKind.Local));
Assert.True(predicate(Diff(commit)));
}
}
} | mit | C# |
1a8ebaf77a289df7a37b5da39f9376b5bee5605f | Update tests to use newer name for 'webapi' template | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | test/Templates.Test/WebApiTemplateTest.cs | test/Templates.Test/WebApiTemplateTest.cs | using Xunit;
using Xunit.Abstractions;
namespace Templates.Test
{
public class WebApiTemplateTest : TemplateTestBase
{
public WebApiTemplateTest(ITestOutputHelper output) : base(output)
{
}
[Theory]
[InlineData(null)]
[InlineData("net461")]
public void WebApiTemplate_Works(string targetFrameworkOverride)
{
RunDotNetNew("webapi", targetFrameworkOverride);
foreach (var publish in new[] { false, true })
{
using (var aspNetProcess = StartAspNetProcess(targetFrameworkOverride, publish))
{
aspNetProcess.AssertOk("/api/values");
aspNetProcess.AssertNotFound("/");
}
}
}
}
}
| using Xunit;
using Xunit.Abstractions;
namespace Templates.Test
{
public class WebApiTemplateTest : TemplateTestBase
{
public WebApiTemplateTest(ITestOutputHelper output) : base(output)
{
}
[Theory]
[InlineData(null)]
[InlineData("net461")]
public void WebApiTemplate_Works(string targetFrameworkOverride)
{
RunDotNetNew("api", targetFrameworkOverride);
foreach (var publish in new[] { false, true })
{
using (var aspNetProcess = StartAspNetProcess(targetFrameworkOverride, publish))
{
aspNetProcess.AssertOk("/api/values");
aspNetProcess.AssertNotFound("/");
}
}
}
}
}
| apache-2.0 | C# |
bbeafa901f94d7d4dffeff2f140120c38aca0fb8 | Update program source | peterblazejewicz/mongodb-mva-vnext | CSharpEnd/Program.cs | CSharpEnd/Program.cs | using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace MongoSample
{
public class Program
{
public static void Main(string[] args)
{
MongoClient client = new MongoClient("mongodb://127.0.0.1:27017/test"); // connect to localhost
}
}
} | using System;
namespace MongoSample
{
public class Program
{
public static void Main(string[] args)
{
}
}
} | mit | C# |
1929b28c3c61e7caa7cccbd5e4ef45582c142133 | Comment out UseIISPlatformHandler. | bigfont/WebNotWar | AspNet5RC1/Startup.cs | AspNet5RC1/Startup.cs | using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
namespace AspNet5RC1
{
public class Startup
{
public Startup(IHostingEnvironment env) { }
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());
app.Run(async (context) =>
{
await context.Response.WriteAsync("head, body");
});
}
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
}
}
| using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
namespace AspNet5RC1
{
public class Startup
{
public Startup(IHostingEnvironment env) { }
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());
app.Run(async (context) =>
{
await context.Response.WriteAsync("head, body");
});
}
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
}
}
| mit | C# |
fcb74c675bff139a1be01470bc01ee91b53ee2c3 | Update credits | matteocontrini/locuspocusbot | LocusPocusBot/Handlers/HelpHandler.cs | LocusPocusBot/Handlers/HelpHandler.cs | using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types.Enums;
namespace LocusPocusBot.Handlers
{
public class HelpHandler : HandlerBase
{
private readonly IBotService bot;
public HelpHandler(IBotService botService)
{
this.bot = botService;
}
public override async Task Run()
{
StringBuilder msg = new StringBuilder();
// TODO: list commands line by line when more departments are supported
msg.AppendLine("*LocusPocus* è il bot per controllare la disponibilità delle aule presso i poli dell'Università di Trento 🎓");
msg.AppendLine();
msg.AppendLine("👉 *Scrivi* /povo, /mesiano, /psicologia *oppure* /sociologia *per ottenere la lista delle aule libere*");
msg.AppendLine();
msg.AppendLine("🤫 Il bot è sviluppato da Matteo Contrini (@matteocontrini) con la collaborazione di Emilio Molinari");
msg.AppendLine();
msg.AppendLine("👏 Un grazie speciale a Alessandro Conti per il nome del bot e a [Dario Crisafulli](https://botfactory.it/#chisiamo) per il logo!");
msg.AppendLine();
msg.AppendLine("🤓 Il bot è [open source](https://github.com/matteocontrini/locuspocusbot)");
await this.bot.Client.SendTextMessageAsync(
chatId: this.Chat.Id,
text: msg.ToString(),
parseMode: ParseMode.Markdown,
disableWebPagePreview: true
);
}
}
}
| using System.Text;
using System.Threading.Tasks;
using Telegram.Bot.Types.Enums;
namespace LocusPocusBot.Handlers
{
public class HelpHandler : HandlerBase
{
private readonly IBotService bot;
public HelpHandler(IBotService botService)
{
this.bot = botService;
}
public override async Task Run()
{
StringBuilder msg = new StringBuilder();
// TODO: list commands line by line when more departments are supported
msg.AppendLine("*LocusPocus* è il bot per controllare la disponibilità delle aule presso i poli dell'Università di Trento 🎓");
msg.AppendLine();
msg.AppendLine("*Scrivi* /povo, /mesiano, /psicologia *oppure* /sociologia *per ottenere la lista delle aule libere.*");
msg.AppendLine();
msg.AppendLine("Sviluppato da Matteo Contrini (@matteocontrini). Si ringraziano Alessandro Conti per il nome del bot e Dario Crisafulli per il logo.");
msg.AppendLine();
msg.AppendLine("Il bot è [open source](https://github.com/matteocontrini/locuspocusbot) 🤓");
await this.bot.Client.SendTextMessageAsync(
chatId: this.Chat.Id,
text: msg.ToString(),
parseMode: ParseMode.Markdown
);
}
}
}
| mit | C# |
57c12033ad063668384e93e2a71d0432cce4ed7d | Comment out methods that aren't implemented from the IPostData interface | gregmartinhtc/CefSharp,windygu/CefSharp,jamespearce2006/CefSharp,AJDev77/CefSharp,yoder/CefSharp,twxstar/CefSharp,joshvera/CefSharp,rlmcneary2/CefSharp,NumbersInternational/CefSharp,windygu/CefSharp,zhangjingpu/CefSharp,haozhouxu/CefSharp,haozhouxu/CefSharp,wangzheng888520/CefSharp,jamespearce2006/CefSharp,illfang/CefSharp,ITGlobal/CefSharp,battewr/CefSharp,VioletLife/CefSharp,dga711/CefSharp,Livit/CefSharp,rlmcneary2/CefSharp,yoder/CefSharp,battewr/CefSharp,ITGlobal/CefSharp,jamespearce2006/CefSharp,zhangjingpu/CefSharp,VioletLife/CefSharp,wangzheng888520/CefSharp,gregmartinhtc/CefSharp,Haraguroicha/CefSharp,yoder/CefSharp,twxstar/CefSharp,ruisebastiao/CefSharp,ITGlobal/CefSharp,battewr/CefSharp,dga711/CefSharp,gregmartinhtc/CefSharp,haozhouxu/CefSharp,AJDev77/CefSharp,joshvera/CefSharp,NumbersInternational/CefSharp,windygu/CefSharp,twxstar/CefSharp,windygu/CefSharp,gregmartinhtc/CefSharp,NumbersInternational/CefSharp,joshvera/CefSharp,Haraguroicha/CefSharp,Livit/CefSharp,illfang/CefSharp,zhangjingpu/CefSharp,Haraguroicha/CefSharp,Livit/CefSharp,AJDev77/CefSharp,ruisebastiao/CefSharp,wangzheng888520/CefSharp,illfang/CefSharp,haozhouxu/CefSharp,Haraguroicha/CefSharp,yoder/CefSharp,illfang/CefSharp,jamespearce2006/CefSharp,zhangjingpu/CefSharp,rlmcneary2/CefSharp,dga711/CefSharp,ruisebastiao/CefSharp,NumbersInternational/CefSharp,Livit/CefSharp,dga711/CefSharp,VioletLife/CefSharp,AJDev77/CefSharp,VioletLife/CefSharp,joshvera/CefSharp,ruisebastiao/CefSharp,twxstar/CefSharp,battewr/CefSharp,rlmcneary2/CefSharp,wangzheng888520/CefSharp,Haraguroicha/CefSharp,jamespearce2006/CefSharp,ITGlobal/CefSharp | CefSharp/IPostData.cs | CefSharp/IPostData.cs | // Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Collections.Generic;
namespace CefSharp
{
public interface IPostData : IDisposable
{
//bool AddElement(IPostDataElement element);
IList<IPostDataElement> Elements { get; }
bool IsReadOnly { get; }
//bool RemoveElement(IPostDataElement element);
void RemoveElements();
}
}
| // Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Collections.Generic;
namespace CefSharp
{
public interface IPostData : IDisposable
{
bool AddElement(IPostDataElement element);
IList<IPostDataElement> Elements { get; }
bool IsReadOnly { get; }
bool RemoveElement(IPostDataElement element);
void RemoveElements();
}
}
| bsd-3-clause | C# |
f4b7a400168a0c5875e9cd3ed212246bc34646b6 | increment patch version | sendwithus/sendwithus_csharp | Sendwithus/Properties/AssemblyInfo.cs | Sendwithus/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("SendwithusClient")]
[assembly: AssemblyDescription("Sendwithus C# Client Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("sendwithus")]
[assembly: AssemblyProduct("Sendwithus")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e63b982d-d5e3-4f46-9096-e1bd8f72afba")]
// 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.0.1.3")]
[assembly: AssemblyFileVersion("0.0.1.3")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SendwithusClient")]
[assembly: AssemblyDescription("Sendwithus C# Client Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("sendwithus")]
[assembly: AssemblyProduct("Sendwithus")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e63b982d-d5e3-4f46-9096-e1bd8f72afba")]
// 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.0.1.2")]
[assembly: AssemblyFileVersion("0.0.1.2")]
| apache-2.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.