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 |
|---|---|---|---|---|---|---|---|---|
355b439eed7347c58f128835580ef40b3fcaf8a7 | Update center header. | flubu-core/flubu.core,flubu-core/flubu.core,flubu-core/flubu.core,flubu-core/flubu.core | FlubuCore.WebApi/Views/UpdateCenter/Index.cshtml | FlubuCore.WebApi/Views/UpdateCenter/Index.cshtml | <div class="text-center">
<h1 class="display-4">Update center</h1>
<p>Update FlubuCore web api automatically from github releases.</p>
</div> | Test
| bsd-2-clause | C# |
708dce4fc956374e4b6b148524a37d617d80e5a4 | Use IE on MT to work around #3028 | haithemaraissia/Xamarin.Mobile,xamarin/Xamarin.Mobile,orand/Xamarin.Mobile,moljac/Xamarin.Mobile,xamarin/Xamarin.Mobile,nexussays/Xamarin.Mobile | MonoTouch/Xamarin.Mobile/Contacts/AddressBook.cs | MonoTouch/Xamarin.Mobile/Contacts/AddressBook.cs | using System;
using System.Linq;
using System.Linq.Expressions;
using MonoTouch.AddressBook;
using System.Collections.Generic;
namespace Xamarin.Contacts
{
public class AddressBook
: IEnumerable<Contact> //IQueryable<Contact>
{
public AddressBook()
{
this.addressBook = new ABAddressBook();
this.provider = new ContactQueryProvider (this.addressBook);
}
public bool IsReadOnly
{
get { return true; }
}
public bool SingleContactsSupported
{
get { return true; }
}
public bool AggregateContactsSupported
{
get { return false; }
}
public bool PreferContactAggregation
{
get;
set;
}
public IEnumerator<Contact> GetEnumerator()
{
return this.addressBook.GetPeople().Select (ContactHelper.GetContact).GetEnumerator();
}
public Contact Load (string id)
{
if (String.IsNullOrWhiteSpace (id))
throw new ArgumentNullException ("id");
int rowId;
if (!Int32.TryParse (id, out rowId))
throw new ArgumentException ("Not a valid contact ID", "id");
ABPerson person = this.addressBook.GetPerson (rowId);
if (person == null)
return null;
return ContactHelper.GetContact (person);
}
private readonly ABAddressBook addressBook;
private readonly IQueryProvider provider;
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
//Type IQueryable.ElementType
//{
// get { return typeof(Contact); }
//}
//Expression IQueryable.Expression
//{
// get { return Expression.Constant (this); }
//}
//IQueryProvider IQueryable.Provider
//{
// get { return this.provider; }
//}
}
} | using System;
using System.Linq;
using System.Linq.Expressions;
using MonoTouch.AddressBook;
using System.Collections.Generic;
namespace Xamarin.Contacts
{
public class AddressBook
: IQueryable<Contact>
{
public AddressBook()
{
this.addressBook = new ABAddressBook();
this.provider = new ContactQueryProvider (this.addressBook);
}
public bool IsReadOnly
{
get { return true; }
}
public bool SingleContactsSupported
{
get { return true; }
}
public bool AggregateContactsSupported
{
get { return false; }
}
public bool PreferContactAggregation
{
get;
set;
}
public IEnumerator<Contact> GetEnumerator()
{
return this.addressBook.GetPeople().Select (ContactHelper.GetContact).GetEnumerator();
}
public Contact Load (string id)
{
if (String.IsNullOrWhiteSpace (id))
throw new ArgumentNullException ("id");
int rowId;
if (!Int32.TryParse (id, out rowId))
throw new ArgumentException ("Not a valid contact ID", "id");
ABPerson person = this.addressBook.GetPerson (rowId);
if (person == null)
return null;
return ContactHelper.GetContact (person);
}
private readonly ABAddressBook addressBook;
private readonly IQueryProvider provider;
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
Type IQueryable.ElementType
{
get { return typeof(Contact); }
}
Expression IQueryable.Expression
{
get { return Expression.Constant (this); }
}
IQueryProvider IQueryable.Provider
{
get { return this.provider; }
}
}
} | apache-2.0 | C# |
f4dc604dbf5928e8142573562d18274030bbdd0f | Fix dragging tournament ladder too far causing it to disappear | peppy/osu-new,smoogipoo/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,UselessToucan/osu,EVAST9919/osu,EVAST9919/osu,NeoAdonis/osu | osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs | osu.Game.Tournament/Screens/Ladder/LadderDragContainer.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Input.Events;
using osuTK;
namespace osu.Game.Tournament.Screens.Ladder
{
public class LadderDragContainer : Container
{
protected override bool OnDragStart(DragStartEvent e) => true;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
private Vector2 target;
private float scale = 1;
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds) => false;
protected override void OnDrag(DragEvent e)
{
this.MoveTo(target += e.Delta, 1000, Easing.OutQuint);
}
private const float min_scale = 0.6f;
private const float max_scale = 1.4f;
protected override bool OnScroll(ScrollEvent e)
{
var newScale = Math.Clamp(scale + e.ScrollDelta.Y / 15 * scale, min_scale, max_scale);
this.MoveTo(target -= e.MousePosition * (newScale - scale), 2000, Easing.OutQuint);
this.ScaleTo(scale = newScale, 2000, Easing.OutQuint);
return true;
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Input.Events;
using osuTK;
namespace osu.Game.Tournament.Screens.Ladder
{
public class LadderDragContainer : Container
{
protected override bool OnDragStart(DragStartEvent e) => true;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
private Vector2 target;
private float scale = 1;
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
protected override void OnDrag(DragEvent e)
{
this.MoveTo(target += e.Delta, 1000, Easing.OutQuint);
}
private const float min_scale = 0.6f;
private const float max_scale = 1.4f;
protected override bool OnScroll(ScrollEvent e)
{
var newScale = Math.Clamp(scale + e.ScrollDelta.Y / 15 * scale, min_scale, max_scale);
this.MoveTo(target -= e.MousePosition * (newScale - scale), 2000, Easing.OutQuint);
this.ScaleTo(scale = newScale, 2000, Easing.OutQuint);
return true;
}
}
}
| mit | C# |
3b7c49d5c3dfcfcb8476a0129e1729af72a04495 | Set only just one torch | BlueBearGaming/Moria,BlueBearGaming/Moria | Assets/Scripts/Light/LightDiminuer.cs | Assets/Scripts/Light/LightDiminuer.cs | using UnityEngine;
using System.Collections;
using System;
public class LightDiminuer : MonoBehaviour {
public float intensity = 15;
public float intensityRate = 0.001F;
public float ambientIntensity = 3;
public float torchNoiseRange = 1;
public bool lightOn = false;
private GameObject player;
private Light playerLight;
private Light ambientPlayerLight;
// Use this for initialization
void Awake () {
player = GameObject.FindGameObjectWithTag ("Player");
playerLight = GameObject.FindGameObjectWithTag ("PlayerLight").GetComponent<Light>();
playerLight.intensity = 0;
playerLight.range = 15;
ambientPlayerLight = GameObject.FindGameObjectWithTag ("AmbientPlayerLight").GetComponent<Light>();
ambientPlayerLight.intensity = 0;
}
// Update is called once per frame
void Update () {
if (playerLight.intensity == 0) {
ambientPlayerLight.intensity = ambientIntensity;
} else {
playerLight.intensity -= intensityRate;
}
if (playerLight.intensity < 2F && ambientPlayerLight.intensity < ambientIntensity) {
ambientPlayerLight.intensity += intensityRate;
}
if (Input.GetKey (KeyCode.L) && !lightOn) {
lightOn = true;
playerLight.intensity = intensity;
}
}
}
| using UnityEngine;
using System.Collections;
using System;
public class LightDiminuer : MonoBehaviour {
public float intensity = 15;
public float intensityRate = 0.001F;
public float ambientIntensity = 3;
public float torchNoiseRange = 1;
private GameObject player;
private Light playerLight;
private Light ambientPlayerLight;
// Use this for initialization
void Awake () {
player = GameObject.FindGameObjectWithTag ("Player");
playerLight = GameObject.FindGameObjectWithTag ("PlayerLight").GetComponent<Light>();
playerLight.intensity = 0;
playerLight.range = 15;
ambientPlayerLight = GameObject.FindGameObjectWithTag ("AmbientPlayerLight").GetComponent<Light>();
ambientPlayerLight.intensity = 0;
}
// Update is called once per frame
void Update () {
if (playerLight.intensity == 0) {
ambientPlayerLight.intensity = ambientIntensity;
} else {
playerLight.intensity -= intensityRate;
}
if (playerLight.intensity < 2F && ambientPlayerLight.intensity < ambientIntensity) {
ambientPlayerLight.intensity += intensityRate;
}
if (Input.GetKey (KeyCode.L)) {
playerLight.intensity = intensity;
}
}
}
| unlicense | C# |
5ad57496bb71bd95effb086fbd23061d9a92ef7b | Add comment on line that is being ignored by DotCover... | edandersen/Edsoft.Hypermedia,mdsol/crichton-dotnet,edandersen/Edsoft.Hypermedia | src/Crichton.Client/HttpClientTransitionRequestHandler.cs | src/Crichton.Client/HttpClientTransitionRequestHandler.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Crichton.Representors;
using Crichton.Representors.Serializers;
using Newtonsoft.Json;
namespace Crichton.Client
{
public class HttpClientTransitionRequestHandler : ITransitionRequestHandler
{
public HttpClient HttpClient { get; private set; }
public ISerializer Serializer { get; private set; }
public HttpClientTransitionRequestHandler(HttpClient client, ISerializer serializer)
{
if (client.BaseAddress == null)
{
throw new InvalidOperationException("BaseAddress must be set on HttpClient.");
}
HttpClient = client;
Serializer = serializer;
}
private static readonly string[] ValidHttpMethods = new[] { "get", "post", "put", "options", "head", "delete", "trace" };
public async Task<CrichtonRepresentor> RequestTransitionAsync(CrichtonTransition transition, object toSerializeToJson = null)
{
var requestMessage = new HttpRequestMessage
{
RequestUri = new Uri(transition.Uri, UriKind.RelativeOrAbsolute)
};
if (toSerializeToJson != null)
{
requestMessage.Content = new StringContent(JsonConvert.SerializeObject(toSerializeToJson));
}
// select HttpMethod based on if there is data to serialize or not
requestMessage.Method = toSerializeToJson == null ? HttpMethod.Get : HttpMethod.Post;
if (transition.Methods != null && transition.Methods.Any() && ValidHttpMethods.Contains(transition.Methods.First().ToLowerInvariant()))
{
// an HttpMethod has been specified in the transition. Override it in the request.
requestMessage.Method = new HttpMethod(transition.Methods.First().ToUpperInvariant());
}
var result = await HttpClient.SendAsync(requestMessage);
var resultContentString = await result.Content.ReadAsStringAsync();
// this line is being ignored by DotCover code coverage analysis -- why..?
var builder = Serializer.DeserializeToNewBuilder(resultContentString, () => new RepresentorBuilder());
return builder.ToRepresentor();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Crichton.Representors;
using Crichton.Representors.Serializers;
using Newtonsoft.Json;
namespace Crichton.Client
{
public class HttpClientTransitionRequestHandler : ITransitionRequestHandler
{
public HttpClient HttpClient { get; private set; }
public ISerializer Serializer { get; private set; }
public HttpClientTransitionRequestHandler(HttpClient client, ISerializer serializer)
{
if (client.BaseAddress == null)
{
throw new InvalidOperationException("BaseAddress must be set on HttpClient.");
}
HttpClient = client;
Serializer = serializer;
}
private static readonly string[] ValidHttpMethods = new[] { "get", "post", "put", "options", "head", "delete", "trace" };
public async Task<CrichtonRepresentor> RequestTransitionAsync(CrichtonTransition transition, object toSerializeToJson = null)
{
var requestMessage = new HttpRequestMessage
{
RequestUri = new Uri(transition.Uri, UriKind.RelativeOrAbsolute)
};
if (toSerializeToJson != null)
{
requestMessage.Content = new StringContent(JsonConvert.SerializeObject(toSerializeToJson));
}
// select HttpMethod based on if there is data to serialize or not
requestMessage.Method = toSerializeToJson == null ? HttpMethod.Get : HttpMethod.Post;
if (transition.Methods != null && transition.Methods.Any() && ValidHttpMethods.Contains(transition.Methods.First().ToLowerInvariant()))
{
// an HttpMethod has been specified in the transition. Override it in the request.
requestMessage.Method = new HttpMethod(transition.Methods.First().ToUpperInvariant());
}
var result = await HttpClient.SendAsync(requestMessage);
var resultContentString = await result.Content.ReadAsStringAsync();
var builder = Serializer.DeserializeToNewBuilder(resultContentString, () => new RepresentorBuilder());
return builder.ToRepresentor();
}
}
}
| mit | C# |
38545cfbfb47a834d3eb1af95329eb25a7ee05fc | Update file userAuth.cpl.cs | ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate | userAuth.cpl/userAuth.cpl/userAuth.cpl.cs | userAuth.cpl/userAuth.cpl/userAuth.cpl.cs | using System;
using Xamarin.Forms;
namespace userAuth.cpl
{
public class App : Application
{
public App ()
{
// The root page of your application
MainPage = new ContentPage {
Content = new StackLayout {
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
XAlign = TextAlignment.Center,
Text = "Welcome to Xamarin Forms!"
}
}
}
};
}
protected override void OnStart ()
{
// Handle when your app starts
}
protected override void OnSleep ()
{
// Handle when your app sleeps
}
protected override void OnResume ()
{
// Handle when your app resumes
}
protected void OnClick ()
{
// Handle click send to your app
}
public class ClickRef : IViewController
{
public ClickRef ()
{
IVisualElementController = Element.ContentPage()
{
Attribute.ReferenceEquals}:(bool){
object OnClick();
object OnRelease();
}
}
}
| using System;
using Xamarin.Forms;
namespace userAuth.cpl
{
public class App : Application
{
public App ()
{
// The root page of your application
MainPage = new ContentPage {
Content = new StackLayout {
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
XAlign = TextAlignment.Center,
Text = "Welcome to Xamarin Forms!"
}
}
}
};
}
protected override void OnStart ()
{
// Handle when your app starts
}
protected override void OnSleep ()
{
// Handle when your app sleeps
}
protected override void OnResume ()
{
// Handle when your app resumes
}
protected void OnClick ()
{
// Handle click send to your app
}
}
}
| mit | C# |
0589d9511274f0a4574e1204d914ddc936accf6b | fix composition for test | IxMilia/BCad,IxMilia/BCad | BCad.Test/TestHost.cs | BCad.Test/TestHost.cs | using System;
using System.Composition;
using System.Composition.Hosting;
using System.Reflection;
using BCad.Services;
using BCad.UI;
namespace BCad.Test
{
public class TestHost : IDisposable
{
[Import]
public IWorkspace Workspace { get; set; }
[Import]
public IInputService InputService { get; set; }
private CompositionHost container;
private TestHost()
{
var configuration = new ContainerConfiguration()
.WithAssemblies(new[]
{
typeof(TestHost).GetTypeInfo().Assembly, // this assembly
typeof(App).GetTypeInfo().Assembly, // BCad.exe
typeof(Drawing).GetTypeInfo().Assembly, // BCad.Core.dll
typeof(BCadControl).GetTypeInfo().Assembly // BCad.Core.UI.dll
});
container = configuration.CreateContainer();
container.SatisfyImports(this);
Workspace.Update(drawing: new Drawing());
}
public static TestHost CreateHost()
{
return new TestHost();
}
public static TestHost CreateHost(params string[] layerNames)
{
var host = CreateHost();
foreach (string layer in layerNames)
host.Workspace.Add(new Layer(layer, IndexedColor.Auto));
return host;
}
public void Dispose()
{
if (container != null)
{
container.Dispose();
container = null;
}
}
}
}
| using System;
using System.Composition;
using System.Composition.Hosting;
using System.IO;
using System.Reflection;
using BCad.Services;
namespace BCad.Test
{
public class TestHost : IDisposable
{
[Import]
public IWorkspace Workspace { get; set; }
[Import]
public IInputService InputService { get; set; }
private CompositionHost container;
private TestHost()
{
var currentAssembly = typeof(App).GetTypeInfo().Assembly;
var assemblyDir = Path.GetDirectoryName(currentAssembly.Location);
var configuration = new ContainerConfiguration()
.WithAssemblies(new[]
{
currentAssembly,
Assembly.LoadFile(Path.Combine(assemblyDir, "BCad.exe")),
Assembly.LoadFile(Path.Combine(assemblyDir, "BCad.Core.dll")),
Assembly.LoadFile(Path.Combine(assemblyDir, "BCad.UI.dll")),
});
container = configuration.CreateContainer();
container.SatisfyImports(this);
Workspace.Update(drawing: new Drawing());
}
public static TestHost CreateHost()
{
return new TestHost();
}
public static TestHost CreateHost(params string[] layerNames)
{
var host = CreateHost();
foreach (string layer in layerNames)
host.Workspace.Add(new Layer(layer, IndexedColor.Auto));
return host;
}
public void Dispose()
{
if (container != null)
{
container.Dispose();
container = null;
}
}
}
}
| apache-2.0 | C# |
f4513e079c4cb656bec0392c19982d48ee36a5d4 | Switch to list instead of Dictionnary | DragonEyes7/ConcoursUBI17,DragonEyes7/ConcoursUBI17 | Proto/Assets/Scripts/Helpers/MultipleDelegate.cs | Proto/Assets/Scripts/Helpers/MultipleDelegate.cs | using System;
using System.Collections.Generic;
using UnityEngine;
public class MultipleDelegate
{
private readonly List<Func<int, int>> _delegates = new List<Func<int, int>>();
private Type _typeOf;
private int _pos = 0;
public int Suscribe(Func<int, int> item)
{
_delegates.Add(item);
return 0;
}
public void Empty()
{
_delegates.Clear();
}
public void Execute(int value)
{
foreach (var func in _delegates)
{
func(value);
}
}
} | using System;
using System.Collections.Generic;
public class MultipleDelegate
{
private readonly Dictionary<int, Func<int, int>> _delegates = new Dictionary<int, Func<int, int>>();
private Type _typeOf;
private int _pos = 0;
public int Suscribe(Func<int, int> item)
{
_delegates.Add(_pos, item);
return _pos++;
}
public void Unsuscribe(int key)
{
_delegates.Remove(key);
}
public void Empty()
{
_delegates.Clear();
}
public void Execute(int value)
{
foreach (var item in _delegates)
{
var func = item.Value;
func(value);
}
}
} | mit | C# |
6255b548fd031b7162abe1500bb9c507a6e70892 | Update Population.cs | sharonikechi/babaomo,sharonikechi/babaomo,sharonikechi/babaomo | BabaOmo/Population.cs | BabaOmo/Population.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BabaOmo
{
public class Population
{
public class Codes
{
public const string Sudan = "SDN";
public const string Nigeria = "NIG";
public const string BeninRepublic = "BEN";
public const string Germany = "GER";
public const string Spain = "SPN";
public const string Brazil = "BRA";
public const string China = "CHN";
public const string Japan = "JAP";
public const string Thailand = "THA";
}
public class AlleleFrequency
{
public string LocusName { get; set; }
public string PopulationCode { get; set; }
public string PopulationName { get; set; }
public decimal AlleleNo { get; set; }
public decimal Frequency { get; set; }
}
public class AlleleFrequencies: List<AlleleFrequency>
{
public AlleleFrequencies(string populationCode = null)
{
this.AddRange(getData(populationCode));
}
private List<AlleleFrequency> getData(string populationCode = null)
{
if (populationCode == null)
{
string jsonData = System.IO.File.ReadAllText("Data/All-Data.json");
return Newtonsoft.Json.JsonConvert.DeserializeObject<List<AlleleFrequency>>(jsonData);
}
else
{
string jsonData = System.IO.File.ReadAllText("Data/" + populationCode + "-Data.json");
return Newtonsoft.Json.JsonConvert.DeserializeObject<List<AlleleFrequency>>(Convert.ToString(jsonData));
}
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BabaOmo
{
public class Population
{
public class Codes
{
public const string Sudan = "SDN";
public const string Canada = "CND";
public const string Nigeria = "NIG";
public const string BeninRepublic = "BEN";
public const string Germany = "GER";
public const string Spain = "SPN";
public const string Brazil = "BRA";
public const string China = "CHN";
public const string Japan = "JAP";
public const string Thailand = "THA";
}
public class AlleleFrequency
{
public string LocusName { get; set; }
public string PopulationCode { get; set; }
public string PopulationName { get; set; }
public decimal AlleleNo { get; set; }
public decimal Frequency { get; set; }
}
public class AlleleFrequencies: List<AlleleFrequency>
{
public AlleleFrequencies(string populationCode = null)
{
this.AddRange(getData(populationCode));
}
private List<AlleleFrequency> getData(string populationCode = null)
{
if (populationCode == null)
{
string jsonData = System.IO.File.ReadAllText("Data/All-Data.json");
return Newtonsoft.Json.JsonConvert.DeserializeObject<List<AlleleFrequency>>(jsonData);
}
else
{
string jsonData = System.IO.File.ReadAllText("Data/" + populationCode + "-Data.json");
return Newtonsoft.Json.JsonConvert.DeserializeObject<List<AlleleFrequency>>(Convert.ToString(jsonData));
}
}
}
}
}
| mit | C# |
dc062e84eb6e46a33858310d1475bef1f7f3f799 | Disable warning | ZLima12/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,peppy/osu-framework | osu.Framework/Configuration/IBindableCollection.cs | osu.Framework/Configuration/IBindableCollection.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Collections;
using System.Collections.Generic;
namespace osu.Framework.Configuration
{
// ReSharper disable PossibleInterfaceMemberAmbiguity
public interface IBindableCollection : ICollection, IParseable, ICanBeDisabled, IUnbindable, IHasDescription
{
// ReSharper restore PossibleInterfaceMemberAmbiguity
/// <summary>
/// Binds self to another bindable such that we receive any values and value limitations of the bindable we bind width.
/// </summary>
/// <param name="them">The foreign bindable. This should always be the most permanent end of the bind (ie. a ConfigManager)</param>
void BindTo(IBindableCollection them);
/// <summary>
/// Retrieve a new bindable instance weakly bound to the configuration backing.
/// If you are further binding to events of a bindable retrieved using this method, ensure to hold
/// a local reference.
/// </summary>
/// <returns>A weakly bound copy of the specified bindable.</returns>
IBindableCollection GetBoundCopy();
}
/// <summary>
/// An interface which can be bound to other <see cref="IBindableCollection{T}"/>s in order to watch for (and react to) <see cref="IBindableCollection{T}.Disabled"/> and item changes.
/// </summary>
/// <typeparam name="T">The type of value encapsulated by this <see cref="IBindable{T}"/>.</typeparam>
public interface IBindableCollection<T> : ICollection<T>, IBindableCollection, IReadonlyBindableCollection<T>
{
/// <summary>
/// Adds the elements of the specified collection to this collection.
/// </summary>
/// <param name="collection">The collection whose elements should be added to this collection.</param>
void AddRange(IEnumerable<T> collection);
/// <summary>
/// Binds self to another bindable such that we receive any values and value limitations of the bindable we bind width.
/// </summary>
/// <param name="them">The foreign bindable. This should always be the most permanent end of the bind (ie. a ConfigManager)</param>
void BindTo(IBindableCollection<T> them);
/// <summary>
/// Retrieve a new bindable instance weakly bound to the configuration backing.
/// If you are further binding to events of a bindable retrieved using this method, ensure to hold
/// a local reference.
/// </summary>
/// <returns>A weakly bound copy of the specified bindable.</returns>
new IBindableCollection<T> GetBoundCopy();
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Collections;
using System.Collections.Generic;
namespace osu.Framework.Configuration
{
public interface IBindableCollection : ICollection, IParseable, ICanBeDisabled, IUnbindable, IHasDescription
{
/// <summary>
/// Binds self to another bindable such that we receive any values and value limitations of the bindable we bind width.
/// </summary>
/// <param name="them">The foreign bindable. This should always be the most permanent end of the bind (ie. a ConfigManager)</param>
void BindTo(IBindableCollection them);
/// <summary>
/// Retrieve a new bindable instance weakly bound to the configuration backing.
/// If you are further binding to events of a bindable retrieved using this method, ensure to hold
/// a local reference.
/// </summary>
/// <returns>A weakly bound copy of the specified bindable.</returns>
IBindableCollection GetBoundCopy();
}
/// <summary>
/// An interface which can be bound to other <see cref="IBindableCollection{T}"/>s in order to watch for (and react to) <see cref="IBindableCollection{T}.Disabled"/> and item changes.
/// </summary>
/// <typeparam name="T">The type of value encapsulated by this <see cref="IBindable{T}"/>.</typeparam>
public interface IBindableCollection<T> : ICollection<T>, IBindableCollection, IReadonlyBindableCollection<T>
{
/// <summary>
/// Adds the elements of the specified collection to this collection.
/// </summary>
/// <param name="collection">The collection whose elements should be added to this collection.</param>
void AddRange(IEnumerable<T> collection);
/// <summary>
/// Binds self to another bindable such that we receive any values and value limitations of the bindable we bind width.
/// </summary>
/// <param name="them">The foreign bindable. This should always be the most permanent end of the bind (ie. a ConfigManager)</param>
void BindTo(IBindableCollection<T> them);
/// <summary>
/// Retrieve a new bindable instance weakly bound to the configuration backing.
/// If you are further binding to events of a bindable retrieved using this method, ensure to hold
/// a local reference.
/// </summary>
/// <returns>A weakly bound copy of the specified bindable.</returns>
new IBindableCollection<T> GetBoundCopy();
}
}
| mit | C# |
502c8ab5c777d1b1ea17ca77c1f89acdb5c35afb | Remove unused reference | virtualcca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,andmattia/aspnetboilerplate,carldai0106/aspnetboilerplate,andmattia/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,luchaoshuai/aspnetboilerplate,beratcarsi/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,zclmoon/aspnetboilerplate,verdentk/aspnetboilerplate,verdentk/aspnetboilerplate,ilyhacker/aspnetboilerplate,andmattia/aspnetboilerplate,zclmoon/aspnetboilerplate,carldai0106/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,virtualcca/aspnetboilerplate,verdentk/aspnetboilerplate,beratcarsi/aspnetboilerplate,ryancyq/aspnetboilerplate,zclmoon/aspnetboilerplate,carldai0106/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ilyhacker/aspnetboilerplate,beratcarsi/aspnetboilerplate,virtualcca/aspnetboilerplate | test/aspnet-core-demo/AbpAspNetCoreDemo/AbpAspNetCoreDemoModule.cs | test/aspnet-core-demo/AbpAspNetCoreDemo/AbpAspNetCoreDemoModule.cs | using Abp.AspNetCore;
using Abp.AspNetCore.Configuration;
using Abp.Castle.Logging.Log4Net;
using Abp.EntityFrameworkCore;
using Abp.EntityFrameworkCore.Configuration;
using Abp.Modules;
using Abp.Reflection.Extensions;
using AbpAspNetCoreDemo.Core;
using AbpAspNetCoreDemo.Db;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
namespace AbpAspNetCoreDemo
{
[DependsOn(
typeof(AbpAspNetCoreModule),
typeof(AbpAspNetCoreDemoCoreModule),
typeof(AbpEntityFrameworkCoreModule),
typeof(AbpCastleLog4NetModule)
)]
public class AbpAspNetCoreDemoModule : AbpModule
{
public override void PreInitialize()
{
Configuration.DefaultNameOrConnectionString = IocManager.Resolve<IConfigurationRoot>().GetConnectionString("Default");
Configuration.Modules.AbpEfCore().AddDbContext<MyDbContext>(options =>
{
if (options.ExistingConnection != null)
{
options.DbContextOptions.UseSqlServer(options.ExistingConnection);
}
else
{
options.DbContextOptions.UseSqlServer(options.ConnectionString);
}
});
Configuration.Modules.AbpAspNetCore()
.CreateControllersForAppServices(
typeof(AbpAspNetCoreDemoCoreModule).GetAssembly()
);
Configuration.IocManager.Resolve<IAbpAspNetCoreConfiguration>().RouteConfiguration.Add(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(AbpAspNetCoreDemoModule).GetAssembly());
}
}
} | using System.Reflection;
using Abp.AspNetCore;
using Abp.AspNetCore.Configuration;
using Abp.Castle.Logging.Log4Net;
using Abp.EntityFrameworkCore;
using Abp.EntityFrameworkCore.Configuration;
using Abp.Modules;
using Abp.Reflection.Extensions;
using AbpAspNetCoreDemo.Core;
using AbpAspNetCoreDemo.Db;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
namespace AbpAspNetCoreDemo
{
[DependsOn(
typeof(AbpAspNetCoreModule),
typeof(AbpAspNetCoreDemoCoreModule),
typeof(AbpEntityFrameworkCoreModule),
typeof(AbpCastleLog4NetModule)
)]
public class AbpAspNetCoreDemoModule : AbpModule
{
public override void PreInitialize()
{
Configuration.DefaultNameOrConnectionString = IocManager.Resolve<IConfigurationRoot>().GetConnectionString("Default");
Configuration.Modules.AbpEfCore().AddDbContext<MyDbContext>(options =>
{
if (options.ExistingConnection != null)
{
options.DbContextOptions.UseSqlServer(options.ExistingConnection);
}
else
{
options.DbContextOptions.UseSqlServer(options.ConnectionString);
}
});
Configuration.Modules.AbpAspNetCore()
.CreateControllersForAppServices(
typeof(AbpAspNetCoreDemoCoreModule).GetAssembly()
);
Configuration.IocManager.Resolve<IAbpAspNetCoreConfiguration>().RouteConfiguration.Add(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(AbpAspNetCoreDemoModule).GetAssembly());
}
}
} | mit | C# |
1b7b8adc314d3fe27e6c4a81f6eec5306f1f758f | Update description | DotNetToscana/TranslatorService | Src/TranslatorService/Properties/AssemblyInfo.cs | Src/TranslatorService/Properties/AssemblyInfo.cs | using System.Resources;
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("TranslatorService")]
[assembly: AssemblyDescription("A lightweight library that allows to translate text using Microsoft Translator Service")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TranslatorService")]
[assembly: AssemblyCopyright("Copyright © Marco Minerva 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Resources;
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("TranslatorService")]
[assembly: AssemblyDescription("A lightweight library that allows to use Microsoft Translator Service")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TranslatorService")]
[assembly: AssemblyCopyright("Copyright © Marco Minerva 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
dfc0cc489e885690e12603f79fae488c48557d75 | Fix mapping | ucdavis/Commencement,ucdavis/Commencement,ucdavis/Commencement | Commencement.Core/Domain/HonorsReport.cs | Commencement.Core/Domain/HonorsReport.cs | using System;
using System.ComponentModel.DataAnnotations;
using Commencement.Core.Helpers;
using FluentNHibernate.Mapping;
using UCDArch.Core.DomainModel;
namespace Commencement.Core.Domain
{
public class HonorsReport : DomainObject
{
public HonorsReport()
{
DateRequested = DateTime.UtcNow.ToPacificTime();
}
public virtual byte[] Contents { get; set; }
public virtual DateTime DateRequested { get; set; }
[Required]
public virtual vUser User { get; set; }
[Required]
public virtual string TermCode { get; set; }
[Required]
public virtual College College { get; set; }
public virtual decimal Honors4590 { get; set; }
public virtual decimal? HighHonors4590 { get; set; }
public virtual decimal? HighestHonors4590 { get; set; }
public virtual decimal Honors90135 { get; set; }
public virtual decimal? HighHonors90135 { get; set; }
public virtual decimal? HighestHonors90135 { get; set; }
public virtual decimal Honors135 { get; set; }
public virtual decimal? HighHonors135 { get; set; }
public virtual decimal? HighestHonors135 { get; set; }
}
public class HonorsReportMap : ClassMap<HonorsReport>
{
public HonorsReportMap()
{
Id(x => x.Id);
Map(x => x.Contents).Length(int.MaxValue);
Map(x => x.DateRequested);
References(x => x.User).Column("UserId");
Map(x => x.TermCode);
References(x => x.College).Column("CollegeCode");
Map(x => x.Honors4590);
Map(x => x.HighHonors4590);
Map(x => x.HighestHonors4590);
Map(x => x.Honors90135);
Map(x => x.HighHonors90135);
Map(x => x.HighestHonors90135);
Map(x => x.Honors135);
Map(x => x.HighHonors135);
Map(x => x.HighestHonors135);
}
}
}
| using System;
using System.ComponentModel.DataAnnotations;
using Commencement.Core.Helpers;
using FluentNHibernate.Mapping;
using UCDArch.Core.DomainModel;
namespace Commencement.Core.Domain
{
public class HonorsReport : DomainObject
{
public HonorsReport()
{
DateRequested = DateTime.UtcNow.ToPacificTime();
}
public virtual byte[] Contents { get; set; }
public virtual DateTime DateRequested { get; set; }
[Required]
public virtual vUser User { get; set; }
[Required]
public virtual string TermCode { get; set; }
[Required]
public virtual College College { get; set; }
public virtual decimal Honors4590 { get; set; }
public virtual decimal? HighHonors4590 { get; set; }
public virtual decimal? HighestHonors4590 { get; set; }
public virtual decimal Honors90135 { get; set; }
public virtual decimal? HighHonors90135 { get; set; }
public virtual decimal? HighestHonors90135 { get; set; }
public virtual decimal Honors135 { get; set; }
public virtual decimal? HighHonors135 { get; set; }
public virtual decimal? HighestHonors135 { get; set; }
}
public class HonorsReportMap : ClassMap<HonorsReport>
{
public HonorsReportMap()
{
Id(x => x.Id);
Map(x => x.Contents);
Map(x => x.DateRequested);
References(x => x.User).Column("UserId");
Map(x => x.TermCode);
References(x => x.College).Column("CollegeCode");
Map(x => x.Honors4590);
Map(x => x.HighHonors4590);
Map(x => x.HighestHonors4590);
Map(x => x.Honors90135);
Map(x => x.HighHonors90135);
Map(x => x.HighestHonors90135);
Map(x => x.Honors135);
Map(x => x.HighHonors135);
Map(x => x.HighestHonors135);
}
}
}
| mit | C# |
33a28e4a19d1588517c45c8df70f3bf54d20bc0b | update cuckoo example | brandonprry/gray_hat_csharp_code | ch8_automating_cuckoo/Program.cs | ch8_automating_cuckoo/Program.cs | using System;
using cuckoosharp;
using Newtonsoft.Json.Linq;
namespace Example
{
class MainClass
{
public static void Main (string[] args)
{
CuckooSession session = new CuckooSession ("192.168.1.105", 8090);
JObject response = session.ExecuteCommand ("/cuckoo/status", "GET");
Console.WriteLine(response.ToString());
using (CuckooManager manager = new CuckooManager(session))
{
FileTask task = new FileTask();
task.Filepath = "/Users/bperry/Projects/metasploit-framework/data/post/bypassuac-x64.exe";
int taskID = manager.CreateTask(task);
while((task = (FileTask)manager.GetTaskDetails(taskID)).Status == "pending" || task.Status == "running")
{
Console.WriteLine("Waiting 30 seconds..."+task.Status);
System.Threading.Thread.Sleep(30000);
}
if (task.Status == "failure")
{
Console.WriteLine ("There was an error:");
foreach (var error in task.Errors)
Console.WriteLine(error);
return;
}
string report = manager.GetTaskReport(taskID).ToString();
Console.WriteLine(report);
}
}
}
}
| using System;
using cuckoosharp;
namespace Example
{
class MainClass
{
public static void Main (string[] args)
{
CuckooSession session = new CuckooSession ("127.0.0.1", 8090);
using (CuckooManager manager = new CuckooManager(session))
{
FileTask task = new FileTask();
task.Filepath = "/var/www/payload.exe";
int taskID = manager.CreateTask(task);
while((task = (FileTask)manager.GetTaskDetails(taskID)).Status == "pending" || task.Status == "processing")
{
Console.WriteLine("Waiting 30 seconds..."+task.Status);
System.Threading.Thread.Sleep(30000);
}
if (task.Status == "failure")
{
Console.WriteLine ("There was an error:");
foreach (object error in task.Errors)
Console.WriteLine(error);
return;
}
string report = manager.GetTaskReport(taskID).ToString();
Console.WriteLine(report);
}
}
}
}
| bsd-3-clause | C# |
80c7675f378fc59cfc3b68f319ca8bb877aeaa35 | Fix array out of index issue @neico | LaserHydra/Oxide,LaserHydra/Oxide,Visagalis/Oxide,Visagalis/Oxide | Extensions/Oxide.Ext.Lua/Libraries/LuaGlobal.cs | Extensions/Oxide.Ext.Lua/Libraries/LuaGlobal.cs | using Oxide.Core.Libraries;
using Oxide.Core.Logging;
namespace Oxide.Ext.Lua.Libraries
{
/// <summary>
/// A global library containing game-agnostic Lua utilities
/// </summary>
public class LuaGlobal : Library
{
/// <summary>
/// Returns if this library should be loaded into the global namespace
/// </summary>
public override bool IsGlobal => true;
/// <summary>
/// Gets the logger that this library writes to
/// </summary>
public Logger Logger { get; private set; }
/// <summary>
/// Initializes a new instance of the LuaGlobal library
/// </summary>
/// <param name="logger"></param>
public LuaGlobal(Logger logger)
{
Logger = logger;
}
/// <summary>
/// Prints a message
/// </summary>
/// <param name="args"></param>
[LibraryFunction("print")]
public void Print(params object[] args)
{
if (args.Length == 1)
{
Logger.Write(LogType.Info, args[0]?.ToString() ?? "null");
}
else
{
var message = string.Empty;
for (var i = 0; i < args.Length; ++i)
{
if (i > 0) message += "\t";
message += args[i]?.ToString() ?? "null";
}
Logger.Write(LogType.Info, message);
}
}
}
}
| using Oxide.Core.Libraries;
using Oxide.Core.Logging;
namespace Oxide.Ext.Lua.Libraries
{
/// <summary>
/// A global library containing game-agnostic Lua utilities
/// </summary>
public class LuaGlobal : Library
{
/// <summary>
/// Returns if this library should be loaded into the global namespace
/// </summary>
public override bool IsGlobal => true;
/// <summary>
/// Gets the logger that this library writes to
/// </summary>
public Logger Logger { get; private set; }
/// <summary>
/// Initializes a new instance of the LuaGlobal library
/// </summary>
/// <param name="logger"></param>
public LuaGlobal(Logger logger)
{
Logger = logger;
}
/// <summary>
/// Prints a message
/// </summary>
/// <param name="args"></param>
[LibraryFunction("print")]
public void Print(params object[] args)
{
if (args.Length == 1)
{
Logger.Write(LogType.Info, args[0]?.ToString() ?? "null");
}
else
{
var message = string.Empty;
for (var i = 0; i <= args.Length; ++i)
{
if (i > 0) message += "\t";
message += args[i]?.ToString() ?? "null";
}
Logger.Write(LogType.Info, message);
}
}
}
}
| mit | C# |
52f6cad93b7d8f677c5f0a358214b32ee3fbcda0 | Set right permissions on the deploy.sh on Linux. (#2863) | projectkudu/kudu,EricSten-MSFT/kudu,projectkudu/kudu,projectkudu/kudu,EricSten-MSFT/kudu,shibayan/kudu,shibayan/kudu,EricSten-MSFT/kudu,shibayan/kudu,EricSten-MSFT/kudu,projectkudu/kudu,shibayan/kudu,shibayan/kudu,EricSten-MSFT/kudu,projectkudu/kudu | Kudu.Core/Deployment/Generator/CustomBuilder.cs | Kudu.Core/Deployment/Generator/CustomBuilder.cs | using System;
using System.IO;
using System.Threading.Tasks;
using Kudu.Contracts.Settings;
using Kudu.Core.Helpers;
namespace Kudu.Core.Deployment.Generator
{
public class CustomBuilder : ExternalCommandBuilder
{
private readonly string _command;
public CustomBuilder(IEnvironment environment, IDeploymentSettingsManager settings, IBuildPropertyProvider propertyProvider, string repositoryPath, string command)
: base(environment, settings, propertyProvider, repositoryPath)
{
_command = command;
}
public override Task Build(DeploymentContext context)
{
string commandFullPath = _command;
var tcs = new TaskCompletionSource<object>();
context.Logger.Log("Running custom deployment command...");
try
{
if (!OSDetector.IsOnWindows())
{
if (commandFullPath.StartsWith("."))
{
string finalCommandPath = Path.GetFullPath(Path.Combine(RepositoryPath, commandFullPath));
if (File.Exists(finalCommandPath))
{
commandFullPath = finalCommandPath;
}
}
if(commandFullPath.Contains(RepositoryPath))
{
context.Logger.Log("Setting execute permissions for " + commandFullPath);
PermissionHelper.Chmod("ugo+x", commandFullPath, Environment, DeploymentSettings, context.Logger);
}
else
{
context.Logger.Log("Not setting execute permissions for " + commandFullPath);
}
}
RunCommand(context, _command, ignoreManifest: false);
tcs.SetResult(null);
}
catch (Exception ex)
{
tcs.SetException(ex);
}
return tcs.Task;
}
public override string ProjectType
{
get { return "CUSTOM DEPLOYMENT"; }
}
}
}
| using System;
using System.Threading.Tasks;
using Kudu.Contracts.Settings;
namespace Kudu.Core.Deployment.Generator
{
public class CustomBuilder : ExternalCommandBuilder
{
private readonly string _command;
public CustomBuilder(IEnvironment environment, IDeploymentSettingsManager settings, IBuildPropertyProvider propertyProvider, string repositoryPath, string command)
: base(environment, settings, propertyProvider, repositoryPath)
{
_command = command;
}
public override Task Build(DeploymentContext context)
{
var tcs = new TaskCompletionSource<object>();
context.Logger.Log("Running custom deployment command...");
try
{
RunCommand(context, _command, ignoreManifest: false);
tcs.SetResult(null);
}
catch (Exception ex)
{
tcs.SetException(ex);
}
return tcs.Task;
}
public override string ProjectType
{
get { return "CUSTOM DEPLOYMENT"; }
}
}
}
| apache-2.0 | C# |
1929f60ea8209c2482a5f018e6f727909568e07d | Update the webservices version | countrywide/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,m0wo/Umbraco-CMS,wtct/Umbraco-CMS,Tronhus/Umbraco-CMS,nvisage-gf/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,hfloyd/Umbraco-CMS,neilgaietto/Umbraco-CMS,yannisgu/Umbraco-CMS,Pyuuma/Umbraco-CMS,sargin48/Umbraco-CMS,mstodd/Umbraco-CMS,marcemarc/Umbraco-CMS,qizhiyu/Umbraco-CMS,Pyuuma/Umbraco-CMS,corsjune/Umbraco-CMS,jchurchley/Umbraco-CMS,AndyButland/Umbraco-CMS,robertjf/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,kgiszewski/Umbraco-CMS,romanlytvyn/Umbraco-CMS,DaveGreasley/Umbraco-CMS,romanlytvyn/Umbraco-CMS,kasperhhk/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,wtct/Umbraco-CMS,christopherbauer/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,VDBBjorn/Umbraco-CMS,marcemarc/Umbraco-CMS,qizhiyu/Umbraco-CMS,markoliver288/Umbraco-CMS,romanlytvyn/Umbraco-CMS,countrywide/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,VDBBjorn/Umbraco-CMS,nvisage-gf/Umbraco-CMS,mstodd/Umbraco-CMS,arvaris/HRI-Umbraco,arknu/Umbraco-CMS,jchurchley/Umbraco-CMS,arknu/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,Pyuuma/Umbraco-CMS,zidad/Umbraco-CMS,ehornbostel/Umbraco-CMS,iahdevelop/Umbraco-CMS,hfloyd/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Door3Dev/HRI-Umbraco,romanlytvyn/Umbraco-CMS,rustyswayne/Umbraco-CMS,TimoPerplex/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,AzarinSergey/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,mittonp/Umbraco-CMS,ordepdev/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,abjerner/Umbraco-CMS,engern/Umbraco-CMS,Door3Dev/HRI-Umbraco,Jeavon/Umbraco-CMS-RollbackTweak,sargin48/Umbraco-CMS,qizhiyu/Umbraco-CMS,ordepdev/Umbraco-CMS,KevinJump/Umbraco-CMS,markoliver288/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abryukhov/Umbraco-CMS,abryukhov/Umbraco-CMS,gavinfaux/Umbraco-CMS,umbraco/Umbraco-CMS,lars-erik/Umbraco-CMS,rajendra1809/Umbraco-CMS,gavinfaux/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,bjarnef/Umbraco-CMS,Khamull/Umbraco-CMS,tompipe/Umbraco-CMS,markoliver288/Umbraco-CMS,VDBBjorn/Umbraco-CMS,lingxyd/Umbraco-CMS,tcmorris/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,corsjune/Umbraco-CMS,dampee/Umbraco-CMS,Myster/Umbraco-CMS,lars-erik/Umbraco-CMS,kgiszewski/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,timothyleerussell/Umbraco-CMS,arvaris/HRI-Umbraco,markoliver288/Umbraco-CMS,umbraco/Umbraco-CMS,AzarinSergey/Umbraco-CMS,mattbrailsford/Umbraco-CMS,rajendra1809/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,aaronpowell/Umbraco-CMS,leekelleher/Umbraco-CMS,wtct/Umbraco-CMS,dawoe/Umbraco-CMS,Myster/Umbraco-CMS,TimoPerplex/Umbraco-CMS,jchurchley/Umbraco-CMS,AndyButland/Umbraco-CMS,wtct/Umbraco-CMS,Khamull/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,madsoulswe/Umbraco-CMS,rasmusfjord/Umbraco-CMS,kasperhhk/Umbraco-CMS,dawoe/Umbraco-CMS,Tronhus/Umbraco-CMS,arknu/Umbraco-CMS,rajendra1809/Umbraco-CMS,Pyuuma/Umbraco-CMS,zidad/Umbraco-CMS,dampee/Umbraco-CMS,countrywide/Umbraco-CMS,arknu/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,mstodd/Umbraco-CMS,Spijkerboer/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,dampee/Umbraco-CMS,rustyswayne/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,lingxyd/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,gkonings/Umbraco-CMS,timothyleerussell/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,iahdevelop/Umbraco-CMS,rasmusfjord/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,engern/Umbraco-CMS,AzarinSergey/Umbraco-CMS,engern/Umbraco-CMS,KevinJump/Umbraco-CMS,iahdevelop/Umbraco-CMS,qizhiyu/Umbraco-CMS,ehornbostel/Umbraco-CMS,AndyButland/Umbraco-CMS,umbraco/Umbraco-CMS,gkonings/Umbraco-CMS,bjarnef/Umbraco-CMS,Myster/Umbraco-CMS,umbraco/Umbraco-CMS,NikRimington/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,TimoPerplex/Umbraco-CMS,ordepdev/Umbraco-CMS,Phosworks/Umbraco-CMS,base33/Umbraco-CMS,markoliver288/Umbraco-CMS,qizhiyu/Umbraco-CMS,leekelleher/Umbraco-CMS,VDBBjorn/Umbraco-CMS,aaronpowell/Umbraco-CMS,mstodd/Umbraco-CMS,lars-erik/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,rasmuseeg/Umbraco-CMS,kgiszewski/Umbraco-CMS,tcmorris/Umbraco-CMS,mittonp/Umbraco-CMS,robertjf/Umbraco-CMS,TimoPerplex/Umbraco-CMS,WebCentrum/Umbraco-CMS,zidad/Umbraco-CMS,kasperhhk/Umbraco-CMS,rajendra1809/Umbraco-CMS,bjarnef/Umbraco-CMS,zidad/Umbraco-CMS,ordepdev/Umbraco-CMS,abjerner/Umbraco-CMS,gavinfaux/Umbraco-CMS,AzarinSergey/Umbraco-CMS,gregoriusxu/Umbraco-CMS,mittonp/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,Khamull/Umbraco-CMS,ehornbostel/Umbraco-CMS,lingxyd/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,gregoriusxu/Umbraco-CMS,neilgaietto/Umbraco-CMS,corsjune/Umbraco-CMS,yannisgu/Umbraco-CMS,romanlytvyn/Umbraco-CMS,abjerner/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,tompipe/Umbraco-CMS,gavinfaux/Umbraco-CMS,robertjf/Umbraco-CMS,aadfPT/Umbraco-CMS,zidad/Umbraco-CMS,sargin48/Umbraco-CMS,mattbrailsford/Umbraco-CMS,aadfPT/Umbraco-CMS,Phosworks/Umbraco-CMS,Door3Dev/HRI-Umbraco,yannisgu/Umbraco-CMS,gkonings/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,base33/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,bjarnef/Umbraco-CMS,Khamull/Umbraco-CMS,iahdevelop/Umbraco-CMS,mittonp/Umbraco-CMS,rasmuseeg/Umbraco-CMS,corsjune/Umbraco-CMS,sargin48/Umbraco-CMS,arvaris/HRI-Umbraco,AzarinSergey/Umbraco-CMS,m0wo/Umbraco-CMS,christopherbauer/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,Door3Dev/HRI-Umbraco,rasmusfjord/Umbraco-CMS,mittonp/Umbraco-CMS,AndyButland/Umbraco-CMS,neilgaietto/Umbraco-CMS,ehornbostel/Umbraco-CMS,m0wo/Umbraco-CMS,VDBBjorn/Umbraco-CMS,corsjune/Umbraco-CMS,NikRimington/Umbraco-CMS,DaveGreasley/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Phosworks/Umbraco-CMS,christopherbauer/Umbraco-CMS,timothyleerussell/Umbraco-CMS,gkonings/Umbraco-CMS,rustyswayne/Umbraco-CMS,lingxyd/Umbraco-CMS,Tronhus/Umbraco-CMS,Phosworks/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,rajendra1809/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,wtct/Umbraco-CMS,ordepdev/Umbraco-CMS,aaronpowell/Umbraco-CMS,gkonings/Umbraco-CMS,timothyleerussell/Umbraco-CMS,DaveGreasley/Umbraco-CMS,neilgaietto/Umbraco-CMS,leekelleher/Umbraco-CMS,timothyleerussell/Umbraco-CMS,base33/Umbraco-CMS,Phosworks/Umbraco-CMS,dawoe/Umbraco-CMS,Tronhus/Umbraco-CMS,marcemarc/Umbraco-CMS,Pyuuma/Umbraco-CMS,KevinJump/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,leekelleher/Umbraco-CMS,m0wo/Umbraco-CMS,Door3Dev/HRI-Umbraco,rustyswayne/Umbraco-CMS,tcmorris/Umbraco-CMS,gregoriusxu/Umbraco-CMS,kasperhhk/Umbraco-CMS,DaveGreasley/Umbraco-CMS,mstodd/Umbraco-CMS,robertjf/Umbraco-CMS,gregoriusxu/Umbraco-CMS,engern/Umbraco-CMS,engern/Umbraco-CMS,Myster/Umbraco-CMS,kasperhhk/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,gregoriusxu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,christopherbauer/Umbraco-CMS,lars-erik/Umbraco-CMS,markoliver288/Umbraco-CMS,hfloyd/Umbraco-CMS,Khamull/Umbraco-CMS,christopherbauer/Umbraco-CMS,nvisage-gf/Umbraco-CMS,ehornbostel/Umbraco-CMS,madsoulswe/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,aadfPT/Umbraco-CMS,yannisgu/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,TimoPerplex/Umbraco-CMS,dawoe/Umbraco-CMS,countrywide/Umbraco-CMS,lingxyd/Umbraco-CMS,sargin48/Umbraco-CMS,madsoulswe/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,dampee/Umbraco-CMS,leekelleher/Umbraco-CMS,m0wo/Umbraco-CMS,arvaris/HRI-Umbraco,abjerner/Umbraco-CMS,rustyswayne/Umbraco-CMS,countrywide/Umbraco-CMS,nvisage-gf/Umbraco-CMS,Spijkerboer/Umbraco-CMS,KevinJump/Umbraco-CMS,Tronhus/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,neilgaietto/Umbraco-CMS,AndyButland/Umbraco-CMS,gavinfaux/Umbraco-CMS,nvisage-gf/Umbraco-CMS,DaveGreasley/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,tompipe/Umbraco-CMS,dampee/Umbraco-CMS,marcemarc/Umbraco-CMS,lars-erik/Umbraco-CMS,NikRimington/Umbraco-CMS,yannisgu/Umbraco-CMS,tcmorris/Umbraco-CMS,WebCentrum/Umbraco-CMS,WebCentrum/Umbraco-CMS,Myster/Umbraco-CMS,iahdevelop/Umbraco-CMS | src/umbraco.webservices/maintenance/maintenanceService.cs | src/umbraco.webservices/maintenance/maintenanceService.cs | using System;
using System.ComponentModel;
using System.Web.Services;
namespace umbraco.webservices.maintenance
{
[WebService(Namespace = "http://umbraco.org/webservices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class maintenanceService : BaseWebService
{
override public Services Service
{
get
{
return Services.MaintenanceService;
}
}
[WebMethod]
public string getWebservicesVersion(string username, string password)
{
// We check if services are enabled and user has access
Authenticate(username, password);
var thisVersion = new Version(0, 10);
return Convert.ToString(thisVersion);
}
[WebMethod]
public void restartApplication(string username, string password)
{
// We check if services are enabled and user has access
Authenticate(username, password);
System.Web.HttpRuntime.UnloadAppDomain();
}
}
} | using System;
using System.ComponentModel;
using System.Web.Services;
namespace umbraco.webservices.maintenance
{
[WebService(Namespace = "http://umbraco.org/webservices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class maintenanceService : BaseWebService
{
override public Services Service
{
get
{
return Services.MaintenanceService;
}
}
[WebMethod]
public string getWebservicesVersion(string username, string password)
{
// We check if services are enabled and user has access
Authenticate(username, password);
Version thisVersion = new Version(0, 9);
return Convert.ToString(thisVersion);
}
[WebMethod]
public void restartApplication(string username, string password)
{
// We check if services are enabled and user has access
Authenticate(username, password);
System.Web.HttpRuntime.UnloadAppDomain();
}
}
} | mit | C# |
15171d957d22459073a3ee0754df81a8e0dbfd66 | Call widget "Special Event" on "Search" search | danielchalmers/DesktopWidgets | DesktopWidgets/Widgets/Search/ViewModel.cs | DesktopWidgets/Widgets/Search/ViewModel.cs | using System.Diagnostics;
using System.Windows.Input;
using DesktopWidgets.Helpers;
using DesktopWidgets.WidgetBase;
using DesktopWidgets.WidgetBase.ViewModel;
using GalaSoft.MvvmLight.Command;
namespace DesktopWidgets.Widgets.Search
{
public class ViewModel : WidgetViewModelBase
{
private string _searchText;
public ViewModel(WidgetId id) : base(id)
{
Settings = id.GetSettings() as Settings;
if (Settings == null)
return;
Go = new RelayCommand(GoExecute);
OnKeyUp = new RelayCommand<KeyEventArgs>(OnKeyUpExecute);
}
public Settings Settings { get; }
public ICommand Go { get; set; }
public ICommand OnKeyUp { get; set; }
public string SearchText
{
get { return _searchText; }
set
{
if (_searchText != value)
{
_searchText = value;
RaisePropertyChanged(nameof(SearchText));
}
}
}
private void GoExecute()
{
var searchText = SearchText;
SearchText = string.Empty;
Process.Start($"{Settings.BaseUrl}{searchText}{Settings.URLSuffix}");
OnSpecialEvent();
}
private void OnKeyUpExecute(KeyEventArgs args)
{
if (args.Key == Key.Enter)
GoExecute();
}
}
} | using System.Diagnostics;
using System.Windows.Input;
using DesktopWidgets.Helpers;
using DesktopWidgets.WidgetBase;
using DesktopWidgets.WidgetBase.ViewModel;
using GalaSoft.MvvmLight.Command;
namespace DesktopWidgets.Widgets.Search
{
public class ViewModel : WidgetViewModelBase
{
private string _searchText;
public ViewModel(WidgetId id) : base(id)
{
Settings = id.GetSettings() as Settings;
if (Settings == null)
return;
Go = new RelayCommand(GoExecute);
OnKeyUp = new RelayCommand<KeyEventArgs>(OnKeyUpExecute);
}
public Settings Settings { get; }
public ICommand Go { get; set; }
public ICommand OnKeyUp { get; set; }
public string SearchText
{
get { return _searchText; }
set
{
if (_searchText != value)
{
_searchText = value;
RaisePropertyChanged(nameof(SearchText));
}
}
}
private void GoExecute()
{
var searchText = SearchText;
SearchText = string.Empty;
Process.Start($"{Settings.BaseUrl}{searchText}{Settings.URLSuffix}");
}
private void OnKeyUpExecute(KeyEventArgs args)
{
if (args.Key == Key.Enter)
GoExecute();
}
}
} | apache-2.0 | C# |
2d0b0833bdd5967c616af14935814ed23e9d1bc0 | Update AssemblyInfo.cs | JamesStuddart/debonair | Debonair.Data/Properties/AssemblyInfo.cs | Debonair.Data/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("Debonair")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("James Studdart")]
[assembly: AssemblyProduct("Debonair")]
[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("b8c24577-fae7-4c04-ab54-8c94262c2fe2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")]
[assembly: AssemblyFileVersion("1.1.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("Debonair")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("James Studdart")]
[assembly: AssemblyProduct("Debonair")]
[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("b8c24577-fae7-4c04-ab54-8c94262c2fe2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyFileVersion("1.1.*")]
| mit | C# |
d102f166685fa62aa3d3f2e87b03b83ef43d42b7 | Update IValuesOperator.cs | Flepper/flepper,Flepper/flepper | Flepper.QueryBuilder/Operators/Values/Interfaces/IValuesOperator.cs | Flepper.QueryBuilder/Operators/Values/Interfaces/IValuesOperator.cs | namespace Flepper.QueryBuilder
{
/// <summary>
/// Values Operator Interface
/// </summary>
public interface IValuesOperator : IQueryCommand
{
/// <summary>
/// Values Operator Contract
/// </summary>
/// <param name="values">Array of values</param>
/// <returns></returns>
IValuesOperator Values(params object[] values);
}
}
| namespace Flepper.QueryBuilder
{
/// <summary>
/// Values Operator Interface
/// </summary>
public interface IValuesOperator : IQueryCommand
{
/// <summary>
/// Values Operator Contract
/// </summary>
/// <param name="values">Values</param>
/// <returns></returns>
IValuesOperator Values(params object[] values);
}
}
| mit | C# |
dd2b9b148b4831a06b08ef54edcfe8f724fc4e3a | Bump for v0.6.0 | jrick/Paymetheus,decred/Paymetheus | Paymetheus/Properties/AssemblyInfo.cs | Paymetheus/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("Paymetheus Decred Wallet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Paymetheus")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("Organization", "Decred")]
// 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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.6.0.0")]
[assembly: AssemblyFileVersion("0.6.0.0")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("Paymetheus Decred Wallet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Paymetheus")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("Organization", "Decred")]
// 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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
| isc | C# |
3e875f1d3987bdf66793775242967bd806b5fa66 | Change the Db name for the object context. | Bloyteg/RWXViewer,Bloyteg/RWXViewer,Bloyteg/RWXViewer,Bloyteg/RWXViewer | RWXViewer/Models/ObjectPathContext.cs | RWXViewer/Models/ObjectPathContext.cs | using System.Data.Entity;
namespace RWXViewer.Models
{
public class ObjectPathContext : DbContext
{
public ObjectPathContext() : base("ObjectPathDb")
{
}
public DbSet<World> Worlds { get; set; }
public DbSet<ObjectPathItem> ObjectPathItem { get; set; }
}
} | using System.Data.Entity;
namespace RWXViewer.Models
{
public class ObjectPathContext : DbContext
{
public ObjectPathContext() : base("ObjectPathContext")
{
}
public DbSet<World> Worlds { get; set; }
public DbSet<ObjectPathItem> ObjectPathItem { get; set; }
}
} | apache-2.0 | C# |
893faf86dd13abd57ad3a8b7b4054c04f80c858b | Use bower version of gfs-checkout-widget | ParcelForMe/p4m-demo-shop,ParcelForMe/p4m-demo-shop,ParcelForMe/p4m-demo-shop,ParcelForMe/p4m-demo-shop | OpenOrderFramework/Views/P4M/P4MDelivery.cshtml | OpenOrderFramework/Views/P4M/P4MDelivery.cshtml | @model OpenOrderFramework.Models.Order
@{
ViewBag.Title = "Delivery";
Layout = "";
}
<script src="/Scripts/Lib/webcomponentsjs/webcomponents.min.js"></script>
<link rel="stylesheet" href="~/Content/bootstrap.min.css">
<link rel="stylesheet" href="~/Content/Site.css">
@Scripts.Render("~/bundles/modernizr")
<link rel="stylesheet" href="/Content/card.css">
<link rel="stylesheet" href="~/Content/TestShop.css">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAMQhcXM06TZBHZ95LwJBRVGSV4CqUQMpI"></script>
<link rel="import" href="/Scripts/Lib/gfs-checkout-widget/gfs-checkout-widget.html">
<h2>GFS Checkout</h2>
<gfs-checkout gfs-data="eyJSZXF1ZXN0Ijp7IkRhdGVSYW5nZSI6eyJEYXRlRnJvbSI6IjIwMTYtMDctMTEiLCJEYXRlVG8iOiIyMDE2LTA3LTI1In0sIk9yZGVyIjp7IlRyYW5zaXQiOnsiUmVjaXBpZW50Ijp7IkxvY2F0aW9uIjp7IkNvdW50cnlDb2RlIjp7IkNvZGUiOiJHQiIsIkVuY29kaW5nIjoiY2NJU09fMzE2Nl8xX0FscGhhMiJ9LCJQb3N0Y29kZSI6IlNPNDAgN0pGIn19fSwiVmFsdWUiOnsiQ3VycmVuY3lDb2RlIjoiR0JQIiwiVmFsdWUiOjQ1Ljk5fX0sIlJlcXVlc3RlZERlbGl2ZXJ5VHlwZXMiOlsiZG1Ecm9wUG9pbnQiLCJkbVN0YW5kYXJkIl0sIlNlc3Npb24iOnsiQVBJS2V5SWQiOiJDTC02OUFFNzA0Ri1ENTkyLTRBNEEtQTU2RC1FQzVFOUYxQzI4QjIifX19"
initial-address="SE6 1EJ" xinitial-address="d, d, SO40 7JF" currency-symbol="£" use-standard="true" use-calendar="true" use-drop-points="true"></gfs-checkout>
| @model OpenOrderFramework.Models.Order
@{
ViewBag.Title = "Delivery";
Layout = "";
}
<script src="/Scripts/Lib/webcomponentsjs/webcomponents.min.js"></script>
<link rel="stylesheet" href="~/Content/bootstrap.min.css">
<link rel="stylesheet" href="~/Content/Site.css">
@Scripts.Render("~/bundles/modernizr")
<link rel="stylesheet" href="/Content/card.css">
<link rel="stylesheet" href="~/Content/TestShop.css">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAMQhcXM06TZBHZ95LwJBRVGSV4CqUQMpI"></script>
<link rel="import" href="/Scripts/widgets/gfs-checkout-widget/gfs-checkout-widget.html">
<h2>GFS Checkout</h2>
<gfs-checkout currency-symbol="£" use-standard="true" use-calendar="true" use-drop-points="true"></gfs-checkout>
| mit | C# |
389b9b098b106e23cbf1289ffc8a3ea11e3be422 | switch back to physical, possible bug in react with non-physical file systems | Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate | Sample.Host/MagistrateWebInterface.cs | Sample.Host/MagistrateWebInterface.cs | using System.Reflection;
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.StaticFiles;
using Owin;
using React.Owin;
namespace Sample.Host
{
public class MagistrateWebInterface
{
public void Configure(IAppBuilder app)
{
var fs = new PhysicalFileSystem("../../content");
//var fs = new AssemblyResourceFileSystem(Assembly.GetExecutingAssembly(), "Sample.Host.content");
app.UseBabel(new BabelFileOptions
{
StaticFileOptions = new StaticFileOptions
{
FileSystem = fs
},
Extensions = new[] { ".jsx" }
});
var fileOptions = new FileServerOptions
{
FileSystem = fs,
EnableDefaultFiles = true,
DefaultFilesOptions = { DefaultFileNames = { "app.htm" } }
};
app.UseFileServer(fileOptions);
}
}
}
| using System.Reflection;
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.StaticFiles;
using Owin;
using React.Owin;
namespace Sample.Host
{
public class MagistrateWebInterface
{
public void Configure(IAppBuilder app)
{
//var fs = new PhysicalFileSystem("../../content");
var fs = new AssemblyResourceFileSystem(Assembly.GetExecutingAssembly(), "Sample.Host.content");
app.UseBabel(new BabelFileOptions
{
StaticFileOptions = new StaticFileOptions
{
FileSystem = fs
},
Extensions = new[] { ".jsx" }
});
var fileOptions = new FileServerOptions
{
FileSystem = fs,
EnableDefaultFiles = true,
DefaultFilesOptions = { DefaultFileNames = { "app.htm" } }
};
app.UseFileServer(fileOptions);
}
}
}
| lgpl-2.1 | C# |
dd444a8b562bcea5375d9629acf70d811ff77dcc | Add xmldoc in Command | xPaw/WendySharp | Command.cs | Command.cs | using System.Text.RegularExpressions;
namespace WendySharp
{
abstract class Command
{
/// <summary>
/// Name of the command, used in command listing and usage text.
/// </summary>
public string Name { get; protected set; }
/// <summary>
/// If specified, is a regular expression string specifying how
/// to match just the command name (not the arguments). If it is not
/// specified, the cmdname string is used to match the command. It should
/// not have any capturing parenthesis since this will be concatenated with
/// the argument matching regular expression.
/// </summary>
public string Match { get; protected set; }
/// <summary>
/// This is a regular expression string that matches the arguments of
/// this command. The resulting match object is passed in to the callback.
/// If not specified, the command takes no arguments. You probably want to
/// put a $ at the end of this if given, otherwise any trailing string will
/// still match.
/// </summary>
public string ArgumentMatch { get; protected set; }
/// <summary>
/// If specified, is the usage text for the command's arguments.
/// For example, if the command takes two requried arguments and one optional
/// argument, this should be set to something like "<arg1> <arg2> [arg3]"
/// </summary>
public string Usage { get; protected set; }
/// <summary>
/// If given, is displayed after the usage in help messages as a
/// short one-line description of this command.
/// </summary>
public string HelpText { get; protected set; }
/// <summary>
/// If given, is the permission required for a user to execute this command.
/// </summary>
public string Permission { get; protected set; }
public Regex CompiledMatch { get; private set; }
/// <summary>
/// Executed when an user calls this command.
/// </summary>
public abstract void OnCommand(CommandArguments command);
public void Compile()
{
if (ArgumentMatch == null)
{
return;
}
var pattern = string.Format("(?:{0}) (?:{1})", Match ?? Name, ArgumentMatch);
Log.WriteDebug(Name, "Match with arguments: {0}", pattern);
CompiledMatch = new Regex(pattern, RegexOptions.Compiled | RegexOptions.CultureInvariant);
}
}
}
| using System.Text.RegularExpressions;
namespace WendySharp
{
abstract class Command
{
public string Name { get; protected set; }
public string Match { get; protected set; }
public string ArgumentMatch { get; protected set; }
public string Usage { get; protected set; }
public string HelpText { get; protected set; }
public string Permission { get; protected set; }
public Regex CompiledMatch { get; private set; }
public abstract void OnCommand(CommandArguments command);
public void Compile()
{
if (ArgumentMatch == null)
{
return;
}
var pattern = string.Format("(?:{0}) (?:{1})", Match ?? Name, ArgumentMatch);
Log.WriteDebug(Name, "Match with arguments: {0}", pattern);
CompiledMatch = new Regex(pattern, RegexOptions.Compiled | RegexOptions.CultureInvariant);
}
}
}
| mit | C# |
4c22914116f3a45c91682e583d8be51858a481b3 | Update InputManager with new keys | Xeeynamo/KingdomHearts | OpenKh.Game/Infrastructure/InputManager.cs | OpenKh.Game/Infrastructure/InputManager.cs | using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
namespace OpenKh.Game.Infrastructure
{
public class InputManager
{
private GamePadState pad;
private KeyboardState keyboard;
private KeyboardState prevKeyboard;
public bool IsExit => pad.Buttons.Back == ButtonState.Pressed || keyboard.IsKeyDown(Keys.Escape);
public bool IsUp => Up && !prevKeyboard.IsKeyDown(Keys.Up);
public bool IsDown => Down && !prevKeyboard.IsKeyDown(Keys.Down);
public bool IsLeft => Left && !prevKeyboard.IsKeyDown(Keys.Left);
public bool IsRight => Right && !prevKeyboard.IsKeyDown(Keys.Right);
public bool IsCircle => keyboard.IsKeyDown(Keys.K) && !prevKeyboard.IsKeyDown(Keys.K);
public bool IsCross => keyboard.IsKeyDown(Keys.L) && !prevKeyboard.IsKeyDown(Keys.L);
public bool Up => keyboard.IsKeyDown(Keys.Up);
public bool Down => keyboard.IsKeyDown(Keys.Down);
public bool Left => keyboard.IsKeyDown(Keys.Left);
public bool Right => keyboard.IsKeyDown(Keys.Right);
public bool A => keyboard.IsKeyDown(Keys.A);
public bool D => keyboard.IsKeyDown(Keys.D);
public bool S => keyboard.IsKeyDown(Keys.S);
public bool W => keyboard.IsKeyDown(Keys.W);
public void Update()
{
pad = GamePad.GetState(PlayerIndex.One);
prevKeyboard = keyboard;
keyboard = Keyboard.GetState();
}
}
}
| using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
namespace OpenKh.Game.Infrastructure
{
public class InputManager
{
private GamePadState pad;
private KeyboardState keyboard;
private KeyboardState prevKeyboard;
public bool IsExit => pad.Buttons.Back == ButtonState.Pressed || keyboard.IsKeyDown(Keys.Escape);
public bool IsDown => keyboard.IsKeyDown(Keys.Down) && !prevKeyboard.IsKeyDown(Keys.Down);
public bool IsUp => keyboard.IsKeyDown(Keys.Up) && !prevKeyboard.IsKeyDown(Keys.Up);
public bool IsCircle => keyboard.IsKeyDown(Keys.K) && !prevKeyboard.IsKeyDown(Keys.K);
public bool IsCross => keyboard.IsKeyDown(Keys.L) && !prevKeyboard.IsKeyDown(Keys.L);
public void Update()
{
pad = GamePad.GetState(PlayerIndex.One);
prevKeyboard = keyboard;
keyboard = Keyboard.GetState();
}
}
}
| mit | C# |
b226855d347c9114541d2e0b37ef780a05933f57 | Change VersionInfo string from: "OpenSimulator trunk (post 0.5.7)" to "OpenSimulator release 0.5.8" in preparation for tagging this minor release. | ft-/opensim-optimizations-wip-tests,RavenB/opensim,RavenB/opensim,M-O-S-E-S/opensim,OpenSimian/opensimulator,AlphaStaxLLC/taiga,N3X15/VoxelSim,ft-/arribasim-dev-tests,ft-/arribasim-dev-extras,rryk/omp-server,Michelle-Argus/ArribasimExtract,allquixotic/opensim-autobackup,ft-/arribasim-dev-extras,AlexRa/opensim-mods-Alex,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,zekizeki/agentservice,Michelle-Argus/ArribasimExtract,Michelle-Argus/ArribasimExtract,QuillLittlefeather/opensim-1,N3X15/VoxelSim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,QuillLittlefeather/opensim-1,TomDataworks/opensim,zekizeki/agentservice,justinccdev/opensim,TechplexEngineer/Aurora-Sim,rryk/omp-server,BogusCurry/arribasim-dev,QuillLittlefeather/opensim-1,allquixotic/opensim-autobackup,N3X15/VoxelSim,TechplexEngineer/Aurora-Sim,justinccdev/opensim,cdbean/CySim,bravelittlescientist/opensim-performance,TomDataworks/opensim,ft-/arribasim-dev-tests,cdbean/CySim,intari/OpenSimMirror,OpenSimian/opensimulator,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,BogusCurry/arribasim-dev,ft-/arribasim-dev-extras,bravelittlescientist/opensim-performance,RavenB/opensim,TechplexEngineer/Aurora-Sim,N3X15/VoxelSim,BogusCurry/arribasim-dev,QuillLittlefeather/opensim-1,zekizeki/agentservice,cdbean/CySim,M-O-S-E-S/opensim,ft-/arribasim-dev-tests,M-O-S-E-S/opensim,TomDataworks/opensim,justinccdev/opensim,N3X15/VoxelSim,N3X15/VoxelSim,TomDataworks/opensim,OpenSimian/opensimulator,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,intari/OpenSimMirror,zekizeki/agentservice,ft-/opensim-optimizations-wip,justinccdev/opensim,OpenSimian/opensimulator,cdbean/CySim,M-O-S-E-S/opensim,OpenSimian/opensimulator,RavenB/opensim,rryk/omp-server,AlexRa/opensim-mods-Alex,ft-/opensim-optimizations-wip-extras,AlexRa/opensim-mods-Alex,QuillLittlefeather/opensim-1,RavenB/opensim,AlphaStaxLLC/taiga,intari/OpenSimMirror,AlphaStaxLLC/taiga,rryk/omp-server,OpenSimian/opensimulator,TomDataworks/opensim,bravelittlescientist/opensim-performance,AlexRa/opensim-mods-Alex,ft-/arribasim-dev-extras,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip-tests,ft-/arribasim-dev-extras,allquixotic/opensim-autobackup,ft-/arribasim-dev-tests,TomDataworks/opensim,AlphaStaxLLC/taiga,zekizeki/agentservice,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,Michelle-Argus/ArribasimExtract,justinccdev/opensim,TechplexEngineer/Aurora-Sim,ft-/opensim-optimizations-wip-tests,intari/OpenSimMirror,AlphaStaxLLC/taiga,Michelle-Argus/ArribasimExtract,BogusCurry/arribasim-dev,AlphaStaxLLC/taiga,cdbean/CySim,QuillLittlefeather/opensim-1,BogusCurry/arribasim-dev,zekizeki/agentservice,intari/OpenSimMirror,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip-tests,M-O-S-E-S/opensim,rryk/omp-server,AlexRa/opensim-mods-Alex,RavenB/opensim,AlexRa/opensim-mods-Alex,rryk/omp-server,ft-/opensim-optimizations-wip-extras,ft-/opensim-optimizations-wip,ft-/opensim-optimizations-wip-tests,cdbean/CySim,TomDataworks/opensim,M-O-S-E-S/opensim,BogusCurry/arribasim-dev,justinccdev/opensim,ft-/opensim-optimizations-wip,allquixotic/opensim-autobackup,intari/OpenSimMirror,N3X15/VoxelSim,QuillLittlefeather/opensim-1,allquixotic/opensim-autobackup,OpenSimian/opensimulator,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/arribasim-dev-tests,N3X15/VoxelSim,allquixotic/opensim-autobackup,ft-/opensim-optimizations-wip-extras,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-tests,bravelittlescientist/opensim-performance,bravelittlescientist/opensim-performance,bravelittlescientist/opensim-performance,AlphaStaxLLC/taiga,ft-/opensim-optimizations-wip,AlphaStaxLLC/taiga | OpenSim/Framework/Servers/VersionInfo.cs | OpenSim/Framework/Servers/VersionInfo.cs | /*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace OpenSim
{
/// <summary>
/// This is the OpenSim version string. Change this if you are releasing a new OpenSim version.
/// </summary>
public class VersionInfo
{
public readonly static string Version = "OpenSimulator release 0.5.8)";
}
}
| /*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace OpenSim
{
/// <summary>
/// This is the OpenSim version string. Change this if you are releasing a new OpenSim version.
/// </summary>
public class VersionInfo
{
public readonly static string Version = "OpenSimulator trunk (post 0.5.7)";
}
}
| bsd-3-clause | C# |
af5857c1af19005c5b0f10420d8e0a8fab708970 | Fix Raven configuration. | alastairs/cgowebsite,alastairs/cgowebsite | src/CGO.Web/NinjectModules/RavenModule.cs | src/CGO.Web/NinjectModules/RavenModule.cs | using Ninject;
using Ninject.Modules;
using Ninject.Web.Common;
using Raven.Client;
using Raven.Client.Embedded;
namespace CGO.Web.NinjectModules
{
public class RavenModule : NinjectModule
{
public override void Load()
{
Kernel.Bind<IDocumentStore>().ToMethod(_ => InitialiseDocumentStore()).InSingletonScope();
Kernel.Bind<IDocumentSession>().ToMethod(_ => Kernel.Get<IDocumentStore>().OpenSession()).InRequestScope();
}
private static IDocumentStore InitialiseDocumentStore()
{
var documentStore = new EmbeddableDocumentStore
{
DataDirectory = "CGO.raven",
UseEmbeddedHttpServer = true,
Configuration = { Port = 28645 }
};
documentStore.Initialize();
documentStore.InitializeProfiling();
return documentStore;
}
}
} | using Ninject;
using Ninject.Modules;
using Ninject.Web.Common;
using Raven.Client;
using Raven.Client.Embedded;
namespace CGO.Web.NinjectModules
{
public class RavenModule : NinjectModule
{
public override void Load()
{
Kernel.Bind<IDocumentStore>().ToMethod(_ => InitialiseDocumentStore()).InSingletonScope();
Kernel.Bind<IDocumentSession>().ToMethod(_ => Kernel.Get<IDocumentStore>().OpenSession()).InRequestScope();
}
private static IDocumentStore InitialiseDocumentStore()
{
var documentStore = new EmbeddableDocumentStore
{
DataDirectory = "CGO.raven",
UseEmbeddedHttpServer = true,
Configuration = { Port = 28645 }
};
documentStore.InitializeProfiling();
documentStore.Initialize();
return documentStore;
}
}
} | mit | C# |
9b03b9729fa78aa7331a5275537d7f9723710052 | remove unnecessary TrimEnd | StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis | service/DotNetApis.Logic/ReferenceAssemblies.cs | service/DotNetApis.Logic/ReferenceAssemblies.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DotNetApis.Nuget;
using DotNetApis.Storage;
using Microsoft.Extensions.Logging;
namespace DotNetApis.Logic
{
/// <summary>
/// Maintains a list of all known reference assemblies, organized by target framework.
/// </summary>
public sealed class ReferenceAssemblies
{
private ReferenceAssemblies()
{
}
/// <summary>
/// The list of platforms along with their reference assemblies.
/// </summary>
public IReadOnlyList<ReferenceTarget> ReferenceTargets { get; private set; }
public static async Task<ReferenceAssemblies> CreateAsync(IReferenceStorage referenceStorage)
{
var folders = await referenceStorage.GetFoldersAsync().ConfigureAwait(false);
var targets = await Task.WhenAll(folders.Select(x => ReferenceTarget.CreateAsync(x, referenceStorage))).ConfigureAwait(false);
return new ReferenceAssemblies
{
ReferenceTargets = targets.ToList(),
};
}
/// <summary>
/// A specific patform target along with paths of all its reference assemblies.
/// </summary>
public sealed class ReferenceTarget
{
/// <summary>
/// The target these reference assemblies are for. Never <c>null</c>.
/// </summary>
public PlatformTarget Target { get; private set; }
/// <summary>
/// The paths of all files related to this target. This includes .dll and .xml files. Never <c>null</c>.
/// </summary>
public IReadOnlyList<string> Paths { get; private set; }
public static async Task<ReferenceTarget> CreateAsync(string path, IReferenceStorage referenceStorage)
{
var target = PlatformTarget.TryParse(path);
if (target == null)
throw new InvalidOperationException($"Unrecognized reference target framework {path}");
return new ReferenceTarget
{
Target = target,
Paths = await referenceStorage.GetFilesAsync(path).ConfigureAwait(false),
};
}
public override string ToString() => Target.ToString();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DotNetApis.Nuget;
using DotNetApis.Storage;
using Microsoft.Extensions.Logging;
namespace DotNetApis.Logic
{
/// <summary>
/// Maintains a list of all known reference assemblies, organized by target framework.
/// </summary>
public sealed class ReferenceAssemblies
{
private ReferenceAssemblies()
{
}
/// <summary>
/// The list of platforms along with their reference assemblies.
/// </summary>
public IReadOnlyList<ReferenceTarget> ReferenceTargets { get; private set; }
public static async Task<ReferenceAssemblies> CreateAsync(IReferenceStorage referenceStorage)
{
var folders = await referenceStorage.GetFoldersAsync().ConfigureAwait(false);
var targets = await Task.WhenAll(folders.Select(x => ReferenceTarget.CreateAsync(x, referenceStorage))).ConfigureAwait(false);
return new ReferenceAssemblies
{
ReferenceTargets = targets.ToList(),
};
}
/// <summary>
/// A specific patform target along with paths of all its reference assemblies.
/// </summary>
public sealed class ReferenceTarget
{
/// <summary>
/// The target these reference assemblies are for. Never <c>null</c>.
/// </summary>
public PlatformTarget Target { get; private set; }
/// <summary>
/// The paths of all files related to this target. This includes .dll and .xml files. Never <c>null</c>.
/// </summary>
public IReadOnlyList<string> Paths { get; private set; }
public static async Task<ReferenceTarget> CreateAsync(string path, IReferenceStorage referenceStorage)
{
var target = PlatformTarget.TryParse(path.TrimEnd('/'));
if (target == null)
throw new InvalidOperationException($"Unrecognized reference target framework {path}");
return new ReferenceTarget
{
Target = target,
Paths = await referenceStorage.GetFilesAsync(path).ConfigureAwait(false),
};
}
public override string ToString() => Target.ToString();
}
}
}
| mit | C# |
40fef4976cbc7e5396c8a441d8ce50f874e73625 | fix comment. | AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,Perspex/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,Perspex/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,grokys/Perspex,grokys/Perspex,jkoritzinsky/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia | src/Avalonia.Base/Logging/LogArea.cs | src/Avalonia.Base/Logging/LogArea.cs | namespace Avalonia.Logging
{
/// <summary>
/// Specifies the area in which a log event occurred.
/// </summary>
public static class LogArea
{
/// <summary>
/// The log event comes from the property system.
/// </summary>
public const string Property = "Property";
/// <summary>
/// The log event comes from the binding system.
/// </summary>
public const string Binding = "Binding";
/// <summary>
/// The log event comes from the animations system.
/// </summary>
public const string Animations = "Animations";
/// <summary>
/// The log event comes from the visual system.
/// </summary>
public const string Visual = "Visual";
/// <summary>
/// The log event comes from the layout system.
/// </summary>
public const string Layout = "Layout";
/// <summary>
/// The log event comes from the control system.
/// </summary>
public const string Control = "Control";
/// <summary>
/// The log event comes from Win32Platform.
/// </summary>
public const string Win32Platform = nameof(Win32Platform);
/// <summary>
/// The log event comes from X11Platform.
/// </summary>
public const string X11Platform = nameof(X11Platform);
}
}
| namespace Avalonia.Logging
{
/// <summary>
/// Specifies the area in which a log event occurred.
/// </summary>
public static class LogArea
{
/// <summary>
/// The log event comes from the property system.
/// </summary>
public const string Property = "Property";
/// <summary>
/// The log event comes from the binding system.
/// </summary>
public const string Binding = "Binding";
/// <summary>
/// The log event comes from the animations system.
/// </summary>
public const string Animations = "Animations";
/// <summary>
/// The log event comes from the visual system.
/// </summary>
public const string Visual = "Visual";
/// <summary>
/// The log event comes from the layout system.
/// </summary>
public const string Layout = "Layout";
/// <summary>
/// The log event comes from the control system.
/// </summary>
public const string Control = "Control";
/// <summary>
/// The log event comes from Win32Platform.
/// </summary>
public const string Win32Platform = nameof(Win32Platform);
/// <summary>
/// The log event comes from Win32Platform.
/// </summary>
public const string X11Platform = nameof(X11Platform);
}
}
| mit | C# |
c36a86084b582d011c28571d208175eca39a6863 | remove unused usings | onovotny/MiFare | src/MiFare.Shared.Win32/PcSc/PcscUtils.cs | src/MiFare.Shared.Win32/PcSc/PcscUtils.cs | /* Copyright (c) Microsoft Corporation
*
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
*
* See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.
*/
using System;
using System.Linq;
using System.Threading.Tasks;
using MiFare.Devices;
using MiFare.PcSc.Iso7816;
namespace MiFare.PcSc
{
public static class SmartCardConnectionExtension
{
// Hack since second time we connect cards, we need a delay
internal static volatile bool IsFirstConnection = true;
/// <summary>
/// Extension method to SmartCardConnection class similar to Transmit asyc method, however it accepts PCSC SDK
/// commands.
/// </summary>
/// <param name="apduCommand">
/// APDU command object to send to the ICC
/// </param>
/// <param name="connection">
/// SmartCardConnection object
/// </param>
/// <returns>APDU response object of type defined by the APDU command object</returns>
public static async Task<Iso7816.ApduResponse> TransceiveAsync(this SmartCardConnection connection, ApduCommand apduCommand)
{
var apduRes = (Iso7816.ApduResponse)Activator.CreateInstance(apduCommand.ApduResponseType);
if (!IsFirstConnection)
{
await Task.Delay(500);
}
var responseBuf = connection.Transceive(apduCommand.GetBuffer());
apduRes.ExtractResponse(responseBuf.ToArray());
return apduRes;
}
}
} | /* Copyright (c) Microsoft Corporation
*
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
*
* See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading;
using System.Threading.Tasks;
using MiFare.Devices;
using MiFare.PcSc.Iso7816;
namespace MiFare.PcSc
{
public static class SmartCardConnectionExtension
{
// Hack since second time we connect cards, we need a delay
internal static volatile bool IsFirstConnection = true;
/// <summary>
/// Extension method to SmartCardConnection class similar to Transmit asyc method, however it accepts PCSC SDK
/// commands.
/// </summary>
/// <param name="apduCommand">
/// APDU command object to send to the ICC
/// </param>
/// <param name="connection">
/// SmartCardConnection object
/// </param>
/// <returns>APDU response object of type defined by the APDU command object</returns>
public static async Task<Iso7816.ApduResponse> TransceiveAsync(this SmartCardConnection connection, ApduCommand apduCommand)
{
var apduRes = (Iso7816.ApduResponse)Activator.CreateInstance(apduCommand.ApduResponseType);
if (!IsFirstConnection)
{
await Task.Delay(500);
}
var responseBuf = connection.Transceive(apduCommand.GetBuffer());
apduRes.ExtractResponse(responseBuf.ToArray());
return apduRes;
}
}
} | mit | C# |
020740497ad0fab191d2fa3da4550526839ceb55 | Update copyright info in AssemblyInfo.cs | OatmealDome/SplatoonUtilities | MusicRandomizer/MusicRandomizer/Properties/AssemblyInfo.cs | MusicRandomizer/MusicRandomizer/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("MusicRandomizer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MusicRandomizer")]
[assembly: AssemblyCopyright("Copyright © OatmealDome 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("6b679e72-f65f-4d8a-a15d-7ffd4ed150d3")]
// 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("MusicRandomizer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MusicRandomizer")]
[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("6b679e72-f65f-4d8a-a15d-7ffd4ed150d3")]
// 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# |
f977a1e581124b9e10d0789e6de36aea8188576f | Add response body to SquareException | claytondus/Claytondus.Square | src/Claytondus.Square/Models/SquareException.cs | src/Claytondus.Square/Models/SquareException.cs | using System;
using System.Net;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Claytondus.Square.Models
{
public class SquareException : Exception
{
[JsonConstructor]
public SquareException(string type, string message) : base(message)
{
SquareType = type;
ResponseBody = message;
}
protected SquareException(SerializationInfo info, StreamingContext context)
{
}
public string SquareType { get; set; }
public string ResponseBody { get; set; }
public HttpStatusCode? HttpStatus { get; set; }
public string Method { get; set; }
public string Resource { get; set; }
}
}
| using System;
using System.Net;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Claytondus.Square.Models
{
public class SquareException : Exception
{
[JsonConstructor]
public SquareException(string type, string message) : base(message)
{
SquareType = type;
}
protected SquareException(SerializationInfo info, StreamingContext context)
{
}
public string SquareType { get; set; }
public HttpStatusCode? HttpStatus { get; set; }
public string Method { get; set; }
public string Resource { get; set; }
}
}
| mit | C# |
612a12d71d385c615e6fcb6b21f1bfd7e48de9a1 | Add comments | mspons/DiceApi | src/DiceApi.WebApi/Controllers/DieController.cs | src/DiceApi.WebApi/Controllers/DieController.cs | using Microsoft.AspNetCore.Mvc;
using DiceApi.Core;
namespace DiceApi.WebApi.Controllers
{
[Route("api/[controller]")]
public class DieController : Controller
{
// GET api/die
[HttpGet]
public IActionResult Get([FromQuery] int sides)
{
// If sides weren't specified, default to six
if (sides == 0)
{
sides = 6;
}
// Negative number of sides is not allowed
if (sides < 0)
{
return this.BadRequest();
}
var die = new Die(sides);
return this.Ok(die.Roll());
}
}
} | using Microsoft.AspNetCore.Mvc;
using DiceApi.Core;
namespace DiceApi.WebApi.Controllers
{
[Route("api/[controller]")]
public class DieController : Controller
{
// GET api/die
[HttpGet]
public IActionResult Get([FromQuery] int sides)
{
if (sides == 0) {
sides = 6;
}
if (sides < 0) {
return this.BadRequest();
}
var die = new Die(sides);
return this.Ok(die.Roll());
}
}
} | mit | C# |
a7a22afa1f6961d4bcf2e5006c3529221b42cee7 | Improve comment | jmarolf/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,genlu/roslyn,diryboy/roslyn,physhi/roslyn,mavasani/roslyn,agocke/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,davkean/roslyn,agocke/roslyn,tannergooding/roslyn,AmadeusW/roslyn,nguerrera/roslyn,sharwell/roslyn,reaction1989/roslyn,tmat/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,physhi/roslyn,AmadeusW/roslyn,eriawan/roslyn,heejaechang/roslyn,sharwell/roslyn,wvdd007/roslyn,diryboy/roslyn,bartdesmet/roslyn,wvdd007/roslyn,bartdesmet/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,gafter/roslyn,CyrusNajmabadi/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,abock/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,agocke/roslyn,aelij/roslyn,aelij/roslyn,weltkante/roslyn,brettfo/roslyn,eriawan/roslyn,physhi/roslyn,davkean/roslyn,KevinRansom/roslyn,brettfo/roslyn,stephentoub/roslyn,mgoertz-msft/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,mgoertz-msft/roslyn,nguerrera/roslyn,davkean/roslyn,genlu/roslyn,tannergooding/roslyn,abock/roslyn,KevinRansom/roslyn,tmat/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,bartdesmet/roslyn,weltkante/roslyn,mavasani/roslyn,KevinRansom/roslyn,stephentoub/roslyn,jasonmalinowski/roslyn,nguerrera/roslyn,ErikSchierboom/roslyn,heejaechang/roslyn,ErikSchierboom/roslyn,heejaechang/roslyn,tannergooding/roslyn,aelij/roslyn,dotnet/roslyn,abock/roslyn,panopticoncentral/roslyn,tmat/roslyn,AlekseyTs/roslyn,jmarolf/roslyn,panopticoncentral/roslyn,dotnet/roslyn,reaction1989/roslyn,AlekseyTs/roslyn,eriawan/roslyn,gafter/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,gafter/roslyn,AmadeusW/roslyn,brettfo/roslyn | src/Features/Core/Portable/Diagnostics/IBuiltInAnalyzer.cs | src/Features/Core/Portable/Diagnostics/IBuiltInAnalyzer.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.Diagnostics
{
/// <summary>
/// This interface is a marker for all the analyzers that are built in.
/// We will record non-fatal-watson if any analyzer with this interface throws an exception.
///
/// also, built in analyzer can do things that third-party analyzer (command line analyzer) can't do
/// such as reporting all diagnostic descriptors as hidden when it can return different severity on runtime.
///
/// or reporting diagnostics ID that is not reported by SupportedDiagnostics.
///
/// this interface is used by the engine to allow this special behavior over command line analyzers.
/// </summary>
internal interface IBuiltInAnalyzer
{
/// <summary>
/// This category will be used to run analyzer more efficiently by restricting scope of analysis
/// </summary>
DiagnosticAnalyzerCategory GetAnalyzerCategory();
/// <summary>
/// This indicates whether this built-in analyzer will only run on opened files.
/// </summary>
bool OpenFileOnly(Workspace workspace);
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.Diagnostics
{
/// <summary>
/// This interface is a marker for all the analyzers that are built in.
/// We will record non-fatal-watson if any analyzer with this interface throws an exception.
///
/// also, built in analyzer can do things that third-party analyzer (command line analyzer) can't do
/// such as reporting all diagnostic descriptors as hidden when it can return different severity on runtime.
///
/// or reporting diagnostics ID that is not reported by SupportedDiagnostics.
///
/// this interface is used by the engine to allow this special behavior over command line analyzers.
/// </summary>
internal interface IBuiltInAnalyzer
{
/// <summary>
/// This category will be used to run analyzer more efficiently by restricting scope of analysis
/// </summary>
DiagnosticAnalyzerCategory GetAnalyzerCategory();
/// <summary>
/// This indicates whether this builtin analyzer will only run on opened files.
/// </summary>
bool OpenFileOnly(Workspace workspace);
}
}
| mit | C# |
e332709740d0b44fe60aa5bfedf0f2d59accdb29 | Undo accidental sample change | Deadpikle/NetSparkle,Deadpikle/NetSparkle | src/NetSparkle.Samples.NetFramework.WPF/MainWindow.xaml.cs | src/NetSparkle.Samples.NetFramework.WPF/MainWindow.xaml.cs | using NetSparkleUpdater.SignatureVerifiers;
using System.Drawing;
using System.Windows;
namespace NetSparkleUpdater.Samples.NetFramework.WPF
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private SparkleUpdater _sparkle;
public MainWindow()
{
InitializeComponent();
// remove the netsparkle key from registry
try
{
Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppWPF");
}
catch { }
// set icon in project properties!
string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName;
var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName);
_sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(Enums.SecurityMode.Strict))
{
UIFactory = new NetSparkleUpdater.UI.WPF.UIFactory(NetSparkleUpdater.UI.WPF.IconUtilities.ToImageSource(icon)),
ShowsUIOnMainThread = false
//UseNotificationToast = true
};
// TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/)
_sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12;
_sparkle.StartLoop(true, true);
}
private void ManualUpdateCheck_Click(object sender, RoutedEventArgs e)
{
_sparkle.CheckForUpdatesAtUserRequest();
}
}
}
| using NetSparkleUpdater.SignatureVerifiers;
using System.Drawing;
using System.Windows;
namespace NetSparkleUpdater.Samples.NetFramework.WPF
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private SparkleUpdater _sparkle;
public MainWindow()
{
InitializeComponent();
// remove the netsparkle key from registry
try
{
Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppWPF");
}
catch { }
// set icon in project properties!
string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName;
var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName);
_sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(Enums.SecurityMode.Strict))
{
UIFactory = new NetSparkleUpdater.UI.WPF.UIFactory(NetSparkleUpdater.UI.WPF.IconUtilities.ToImageSource(icon)),
ShowsUIOnMainThread = false,
AppCastHandler = new AppCastHandlers.XMLAppCast() { SignatureFileExtension = "txt"}
//UseNotificationToast = true
};
// TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/)
_sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12;
_sparkle.StartLoop(true, true);
}
private void ManualUpdateCheck_Click(object sender, RoutedEventArgs e)
{
_sparkle.CheckForUpdatesAtUserRequest();
}
}
}
| mit | C# |
b142fbbba4eba23926956e04418ade9cf62162de | add documentation for NeedsUpdate event. | AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,grokys/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,akrisiun/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,jkoritzinsky/Perspex,wieslawsoltes/Perspex,grokys/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,Perspex/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia | src/Avalonia.Controls/NativeMenu.cs | src/Avalonia.Controls/NativeMenu.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using Avalonia.Collections;
using Avalonia.Metadata;
namespace Avalonia.Controls
{
public partial class NativeMenu : AvaloniaObject, IEnumerable<NativeMenuItemBase>, INativeMenuExporterEventsImplBridge
{
private readonly AvaloniaList<NativeMenuItemBase> _items =
new AvaloniaList<NativeMenuItemBase> { ResetBehavior = ResetBehavior.Remove };
private NativeMenuItem _parent;
[Content]
public IList<NativeMenuItemBase> Items => _items;
/// <summary>
/// Raised when the user clicks the menu and before its opened. Use this event to update the menu dynamically.
/// </summary>
public event EventHandler<EventArgs> NeedsUpdate;
public NativeMenu()
{
_items.Validate = Validator;
_items.CollectionChanged += ItemsChanged;
}
void INativeMenuExporterEventsImplBridge.RaiseNeedsUpdate ()
{
NeedsUpdate?.Invoke(this, EventArgs.Empty);
}
private void Validator(NativeMenuItemBase obj)
{
if (obj.Parent != null)
throw new InvalidOperationException("NativeMenuItem already has a parent");
}
private void ItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if(e.OldItems!=null)
foreach (NativeMenuItemBase i in e.OldItems)
i.Parent = null;
if(e.NewItems!=null)
foreach (NativeMenuItemBase i in e.NewItems)
i.Parent = this;
}
public static readonly DirectProperty<NativeMenu, NativeMenuItem> ParentProperty =
AvaloniaProperty.RegisterDirect<NativeMenu, NativeMenuItem>("Parent", o => o.Parent, (o, v) => o.Parent = v);
public NativeMenuItem Parent
{
get => _parent;
set => SetAndRaise(ParentProperty, ref _parent, value);
}
public void Add(NativeMenuItemBase item) => _items.Add(item);
public IEnumerator<NativeMenuItemBase> GetEnumerator() => _items.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using Avalonia.Collections;
using Avalonia.Metadata;
namespace Avalonia.Controls
{
public partial class NativeMenu : AvaloniaObject, IEnumerable<NativeMenuItemBase>, INativeMenuExporterEventsImplBridge
{
private readonly AvaloniaList<NativeMenuItemBase> _items =
new AvaloniaList<NativeMenuItemBase> { ResetBehavior = ResetBehavior.Remove };
private NativeMenuItem _parent;
[Content]
public IList<NativeMenuItemBase> Items => _items;
public event EventHandler<EventArgs> NeedsUpdate;
public NativeMenu()
{
_items.Validate = Validator;
_items.CollectionChanged += ItemsChanged;
}
void INativeMenuExporterEventsImplBridge.RaiseNeedsUpdate ()
{
NeedsUpdate?.Invoke(this, EventArgs.Empty);
}
private void Validator(NativeMenuItemBase obj)
{
if (obj.Parent != null)
throw new InvalidOperationException("NativeMenuItem already has a parent");
}
private void ItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if(e.OldItems!=null)
foreach (NativeMenuItemBase i in e.OldItems)
i.Parent = null;
if(e.NewItems!=null)
foreach (NativeMenuItemBase i in e.NewItems)
i.Parent = this;
}
public static readonly DirectProperty<NativeMenu, NativeMenuItem> ParentProperty =
AvaloniaProperty.RegisterDirect<NativeMenu, NativeMenuItem>("Parent", o => o.Parent, (o, v) => o.Parent = v);
public NativeMenuItem Parent
{
get => _parent;
set => SetAndRaise(ParentProperty, ref _parent, value);
}
public void Add(NativeMenuItemBase item) => _items.Add(item);
public IEnumerator<NativeMenuItemBase> GetEnumerator() => _items.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
| mit | C# |
187c201f9e2af3f570e2f2d0965630381d6e5f84 | Rename Error category to Danger | Binjaaa/BasicHtmlLogger,Binjaaa/BasicHtmlLogger,Binjaaa/BasicHtmlLogger | src/HtmlLogger/Model/LogCategory.cs | src/HtmlLogger/Model/LogCategory.cs | namespace HtmlLogger.Model
{
public enum LogCategory
{
Info,
Warning,
Danger
}
} | namespace HtmlLogger.Model
{
public enum LogCategory
{
Info,
Warning,
Error
}
} | mit | C# |
343d4fb7d4f8dafbedd70950a7f835f80237151d | Update (#218) | InPvP/MiNET,yungtechboy1/MiNET | src/MiNET/MiNET/Net/PlayerAction.cs | src/MiNET/MiNET/Net/PlayerAction.cs | namespace MiNET.Net
{
public enum PlayerAction
{
StartBreak = 0,
AbortBreak = 1,
StopBreak = 2,
ReleaseItem = 5,
StopSleeping = 6,
Respawn = 7,
Jump = 8,
StartSprint = 9,
StopSprint = 10,
StartSneak = 11,
StopSneak = 12,
DimensionChange = 13,
AbortDimensionChange = 14,
WorldImmutable = 17
}
}
| namespace MiNET.Net
{
public enum PlayerAction
{
StartBreak = 0,
AbortBreak = 1,
StopBreak = 2,
ReleaseItem = 5,
StopSleeping = 6,
Respawn = 7,
Jump = 8,
StartSprint = 9,
StopSprint = 10,
StartSneak = 11,
StopSneak = 12,
DimensionChange = 13,
AbortDimensionChange = 14,
WorldImmutable = 15
}
}
| mpl-2.0 | C# |
cec7251bc3c1c5fb5d32704e144bc55361beae86 | Update default rendering partial view | marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,leekelleher/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,NikRimington/Umbraco-CMS,arknu/Umbraco-CMS,abjerner/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,NikRimington/Umbraco-CMS,dawoe/Umbraco-CMS,madsoulswe/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,madsoulswe/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,NikRimington/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,bjarnef/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,madsoulswe/Umbraco-CMS | src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml | src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml | @inherits UmbracoViewPage<BlockListModel>
@using Umbraco.Core.Models.Blocks
@{
if (Model?.Layout == null || !Model.Layout.Any()) { return; }
}
<div class="umb-block-list">
@foreach (var layout in Model.Layout)
{
if (layout?.Udi == null) { continue; }
var data = layout.Data;
@Html.Partial("BlockList/Components/" + data.ContentType.Alias, layout)
}
</div>
| @inherits UmbracoViewPage<BlockListModel>
@using ContentModels = Umbraco.Web.PublishedModels;
@using Umbraco.Core.Models.Blocks
@{
if (Model?.Layout == null || !Model.Layout.Any()) { return; }
}
<div class="umb-block-list">
@foreach (var layout in Model.Layout)
{
if (layout?.Udi == null) { continue; }
var data = layout.Data;
@Html.Partial("BlockList/" + data.ContentType.Alias, layout)
}
</div>
| mit | C# |
6a7d43341bcbd948fecea504309b422b4008a113 | Remove unused variable | attemoi/MoistureBot | Addins/UrlInfo/UrlInfo.cs | Addins/UrlInfo/UrlInfo.cs | using System;
using Mono.Addins;
using MoistureBot;
using System.Text.RegularExpressions;
using MoistureBot.Model;
namespace MoistureBot
{
public class UrlInfo : IReceiveFriendChatMessages, IReceiveGroupChatMessages
{
IMoistureBot Bot;
IContext Context;
[Provide]
public UrlInfo(IContext context)
{
this.Context = context;
this.Bot = context.GetBot();
}
const string URL_REGEX = @"\b(?:https?://|www\.)\S+\.\S+\b";
public void MessageReceived(FriendChatMessage message)
{
var reply = CreateReply(message.Message);
if (!String.IsNullOrEmpty(reply))
Bot.SendChatMessage(reply, message.ChatterId);
}
public void MessageReceived(GroupChatMessage message)
{
var reply = CreateReply(message.Message);
if (!String.IsNullOrEmpty(reply))
Bot.SendChatRoomMessage(reply, message.ChatId);
}
public string CreateReply(string message)
{
// Check if message contains urls
MatchCollection matches = Regex.Matches(message, URL_REGEX);
if (matches == null)
return null;
foreach (Match m in matches)
{
try
{
Uri uri = new Uri(m.Value);
string response = null;
Context.InvokeAddins<IReceiveUrl>("MoistureBot/UrlInfo/IReceiveUrl", addin => response = addin.ReplyToUrl(uri));
return response;
}
catch (UriFormatException)
{
return null;
}
}
return null;
}
}
}
| using System;
using Mono.Addins;
using MoistureBot;
using System.Text.RegularExpressions;
using MoistureBot.Model;
namespace MoistureBot
{
public class UrlInfo : IReceiveFriendChatMessages, IReceiveGroupChatMessages
{
IMoistureBot Bot;
IContext Context;
[Provide]
public UrlInfo(IContext context)
{
this.Context = context;
this.Bot = context.GetBot();
}
const string URL_REGEX = @"\b(?:https?://|www\.)\S+\.\S+\b";
public void MessageReceived(FriendChatMessage message)
{
var reply = CreateReply(message.Message);
if (!String.IsNullOrEmpty(reply))
Bot.SendChatMessage(reply, message.ChatterId);
}
public void MessageReceived(GroupChatMessage message)
{
var reply = CreateReply(message.Message);
if (!String.IsNullOrEmpty(reply))
Bot.SendChatRoomMessage(reply, message.ChatId);
}
public string CreateReply(string message)
{
// Check if message contains urls
MatchCollection matches = Regex.Matches(message, URL_REGEX);
if (matches == null)
return null;
foreach (Match m in matches)
{
try
{
Uri uri = new Uri(m.Value);
string response = null;
Context.InvokeAddins<IReceiveUrl>("MoistureBot/UrlInfo/IReceiveUrl", addin => response = addin.ReplyToUrl(uri));
return response;
}
catch (UriFormatException e)
{
return null;
}
}
return null;
}
}
}
| mit | C# |
554fec1447a2e0d54f8557ea299cda75f99379c6 | Fix response helper when no content is present | rocky0904/mozu-dotnet,Mozu/mozu-dotnet,sanjaymandadi/mozu-dotnet,ezekielthao/mozu-dotnet | SDK/Mozu.Api/Utilities/ResponseHelper.cs | SDK/Mozu.Api/Utilities/ResponseHelper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Mozu.Api.Utilities
{
public class ResponseHelper
{
public static void EnsureSuccess(HttpResponseMessage response)
{
EnsureSuccess(response, null);
}
/// <summary>
/// Validate HttpResponse message, throws an Api Exception with context
/// </summary>
/// <param name="response"></param>
/// <param name="apiContext"></param>
/// <exception cref="ApiException"></exception>
public static void EnsureSuccess(HttpResponseMessage response, IApiContext apiContext)
{
if (response.IsSuccessStatusCode) return;
if (response.StatusCode == HttpStatusCode.NotModified) return;
var content = response.Content.ReadAsStringAsync().Result;
ApiException exception ;
var htmlMediaType = new MediaTypeHeaderValue("text/html");
if (response.Content.Headers.ContentType != null &&
response.Content.Headers.ContentType.MediaType == htmlMediaType.MediaType)
{
var message = String.Format("Status Code {0}, Uri - {1}", response.StatusCode,
response.RequestMessage.RequestUri.AbsoluteUri);
exception = new ApiException(message, new Exception(content));
}
else if (!String.IsNullOrEmpty(content))
exception = JsonConvert.DeserializeObject<ApiException>(content);
else
exception = new ApiException("Unknow Exception");
exception.HttpStatusCode = response.StatusCode;
exception.CorrelationId = HttpHelper.GetHeaderValue(Headers.X_VOL_CORRELATION, response.Headers);
exception.ApiContext = apiContext;
if (!MozuConfig.ThrowExceptionOn404 &&
string.Equals(exception.ErrorCode, "ITEM_NOT_FOUND", StringComparison.OrdinalIgnoreCase)
&& response.RequestMessage.Method.Method == "GET")
return;
throw exception;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Mozu.Api.Utilities
{
public class ResponseHelper
{
public static void EnsureSuccess(HttpResponseMessage response)
{
EnsureSuccess(response, null);
}
/// <summary>
/// Validate HttpResponse message, throws an Api Exception with context
/// </summary>
/// <param name="response"></param>
/// <param name="apiContext"></param>
/// <exception cref="ApiException"></exception>
public static void EnsureSuccess(HttpResponseMessage response, IApiContext apiContext)
{
if (!response.IsSuccessStatusCode)
{
if (response.StatusCode == HttpStatusCode.NotModified) return;
var content = response.Content.ReadAsStringAsync().Result;
ApiException exception ;
var htmlMediaType = new MediaTypeHeaderValue("text/html");
if (response.Content.Headers.ContentType != null &&
response.Content.Headers.ContentType.MediaType == htmlMediaType.MediaType)
{
var message = String.Format("Status Code {0}, Uri - {1}", response.StatusCode,
response.RequestMessage.RequestUri.AbsoluteUri);
exception = new ApiException(message, new Exception(content));
}
else
exception = JsonConvert.DeserializeObject<ApiException>(content);
exception.HttpStatusCode = response.StatusCode;
exception.CorrelationId = HttpHelper.GetHeaderValue(Headers.X_VOL_CORRELATION, response.Headers);
exception.ApiContext = apiContext;
if (!MozuConfig.ThrowExceptionOn404 &&
string.Equals(exception.ErrorCode, "ITEM_NOT_FOUND", StringComparison.OrdinalIgnoreCase)
&& response.RequestMessage.Method.Method == "GET")
return;
throw exception;
}
}
}
}
| mit | C# |
4ec75f3cbc7567ef0e7d000b83782150119d3477 | Repair ZOI calculation | MPrtenjak/SLOTax | SharedService/Services/ProtectiveMark.cs | SharedService/Services/ProtectiveMark.cs | // <copyright file="ProtectiveMark.cs" company="MNet">
// Copyright (c) Matjaz Prtenjak All rights reserved.
// </copyright>
// <author>Matjaz Prtenjak</author>
//-----------------------------------------------------------------------
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using MNet.SLOTaxService.Utils;
namespace MNet.SLOTaxService.Services
{
internal class ProtectiveMark
{
public string CalculateMD5Hash(byte[] input)
{
byte[] data = this.md5Hash.ComputeHash(input);
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
sBuilder.Append(data[i].ToString("x2"));
return sBuilder.ToString();
}
public string Calculate(string input, RSACryptoServiceProvider provider)
{
byte[] podatki = Encoding.ASCII.GetBytes(input);
byte[] signature = provider.SignData(podatki, CryptoConfig.MapNameToOID("SHA256"));
return this.CalculateMD5Hash(signature);
}
public string Calculate(XmlElement invoice, RSACryptoServiceProvider provider)
{
StringBuilder fullText = new StringBuilder(200);
fullText.Append(this.getNodeValue(invoice, "fu:TaxNumber"));
fullText.Append(this.getNodeValue(invoice, "fu:IssueDateTime"));
fullText.Append(this.getNodeValue(invoice, "fu:InvoiceNumber"));
fullText.Append(this.getNodeValue(invoice, "fu:BusinessPremiseID"));
fullText.Append(this.getNodeValue(invoice, "fu:ElectronicDeviceID"));
fullText.Append(this.getNodeValue(invoice, "fu:InvoiceAmount"));
return this.Calculate(fullText.ToString(), provider);
}
private string getNodeValue(XmlElement parentElement, string nodeName)
{
XmlNode node = XmlHelperFunctions.GetFirstSubNode(parentElement, nodeName);
if (node == null) return string.Empty;
return node.InnerText;
}
private MD5 md5Hash = MD5.Create();
}
} | // <copyright file="ProtectiveMark.cs" company="MNet">
// Copyright (c) Matjaz Prtenjak All rights reserved.
// </copyright>
// <author>Matjaz Prtenjak</author>
//-----------------------------------------------------------------------
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using MNet.SLOTaxService.Utils;
namespace MNet.SLOTaxService.Services
{
internal class ProtectiveMark
{
public string CalculateMD5Hash(byte[] input)
{
byte[] data = this.md5Hash.ComputeHash(input);
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
sBuilder.Append(data[i].ToString("x2"));
return sBuilder.ToString();
}
public string Calculate(string input, RSACryptoServiceProvider provider)
{
byte[] podatki = Encoding.ASCII.GetBytes(input);
byte[] signature = provider.SignData(podatki, CryptoConfig.MapNameToOID("SHA256"));
return this.CalculateMD5Hash(signature);
}
public string Calculate(XmlElement invoice, RSACryptoServiceProvider provider)
{
StringBuilder fullText = new StringBuilder(200);
fullText.Append(this.getNodeValue(invoice, "fu:TaxNumber"));
fullText.Append(this.getNodeValue(invoice, "fu:IssueDateTime"));
fullText.Append(this.getNodeValue(invoice, "fu:InvoiceNumber"));
fullText.Append(this.getNodeValue(invoice, "fu:BusinessPremiseID"));
fullText.Append(this.getNodeValue(invoice, "fu:ElectronicDeviceID"));
fullText.Append(this.getNodeValue(invoice, "fu:InvoiceAmount"));
return this.Calculate(fullText.ToString(), provider);
}
private string getNodeValue(XmlElement parentElement, string nodeName)
{
XmlNode node = XmlHelperFunctions.GetSubNode(parentElement, nodeName);
if (node == null) return string.Empty;
return node.InnerText;
}
private MD5 md5Hash = MD5.Create();
}
} | mit | C# |
9936ba256836e849682307af766a5fcce7937a41 | Set Message.Recoverable to true | shailendrabirthare/snowplow-dotnet-tracker,snowplow/snowplow-dotnet-tracker,yonglehou/snowplow-dotnet-tracker | Snowplow.Tracker/Emitters/MsmqEmitter.cs | Snowplow.Tracker/Emitters/MsmqEmitter.cs | /*
* MsmqEmitter.cs
*
* Copyright (c) 2014 Snowplow Analytics Ltd. All rights reserved.
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License
* Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
* http://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the Apache License Version 2.0 for the specific
* language governing permissions and limitations there under.
* Authors: Fred Blundun
* Copyright: Copyright (c) 2014 Snowplow Analytics Ltd
* License: Apache License Version 2.0
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Messaging;
using System.Web.Script.Serialization;
namespace Snowplow.Tracker
{
public class MsmqEmitter : IEmitter, IDisposable
{
private bool disposed = false;
private static JavaScriptSerializer jss = new JavaScriptSerializer();
public MessageQueue Queue {get; set;}
public MsmqEmitter(string path = @".\private$\SnowplowTracker")
{
MessageQueue.EnableConnectionCache = true;
this.Queue = MessageQueue.Exists(path) ? new MessageQueue(path) : MessageQueue.Create(path);
this.Queue.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
}
public void Input(Dictionary<string, string> payload)
{
var message = new Message(jss.Serialize(payload));
message.Recoverable = true;
Queue.Send(message);
}
public void Flush(bool sync = false)
{
}
public MessageEnumerator GetMessageEnumerator()
{
return Queue.GetMessageEnumerator2();
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
Queue.Dispose();
}
disposed = true;
}
}
}
}
| /*
* MsmqEmitter.cs
*
* Copyright (c) 2014 Snowplow Analytics Ltd. All rights reserved.
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License
* Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
* http://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the Apache License Version 2.0 for the specific
* language governing permissions and limitations there under.
* Authors: Fred Blundun
* Copyright: Copyright (c) 2014 Snowplow Analytics Ltd
* License: Apache License Version 2.0
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Messaging;
using System.Web.Script.Serialization;
namespace Snowplow.Tracker
{
public class MsmqEmitter : IEmitter, IDisposable
{
private bool disposed = false;
public MessageQueue Queue {get; set;}
public MsmqEmitter(string path = @".\private$\SnowplowTracker")
{
MessageQueue.EnableConnectionCache = true;
this.Queue = MessageQueue.Exists(path) ? new MessageQueue(path) : MessageQueue.Create(path);
this.Queue.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
}
public void Input(Dictionary<string, string> payload)
{
Queue.Send(new JavaScriptSerializer(null).Serialize(payload));
}
public void Flush(bool sync = false)
{
}
public MessageEnumerator GetMessageEnumerator()
{
return Queue.GetMessageEnumerator2();
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
Queue.Dispose();
}
disposed = true;
}
}
}
}
| apache-2.0 | C# |
a918ecc4a12e84318eafd6116212bc267b15afb6 | Implement the leading documentation trivia method | Rhaeo/Rhaeo.Roslyn | Sources/Rhaeo.Roslyn/RoslynExtensions.cs | Sources/Rhaeo.Roslyn/RoslynExtensions.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="RoslynExtensions.cs" company="Rhaeo.org">
// Licenced under the MIT license.
// </copyright>
// <summary>
// Defines the RoslynExtensions type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Rhaeo.Roslyn
{
/// <summary>
/// Contains extension methods for Roslyn code analysis types simplifying some common code generation tasks.
/// </summary>
public static class RoslynExtensions
{
#region Methods
/// <summary>
/// Creates a new node from this node with the leading trivia replaced with a XML documentation.
/// </summary>
/// <typeparam name="TSyntaxNode">
/// The type of the syntax node.
/// </typeparam>
/// <param name="syntaxNode">
/// The syntax node.
/// </param>
/// <param name="summary">
/// The documentation <code>summary</code> element content.
/// </param>
/// <returns>
/// The new syntax node.
/// </returns>
[
SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1008:OpeningParenthesisMustBeSpacedCorrectly", Justification = "Ignored for more tree-like fluent syntax usage."),
SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1009:ClosingParenthesisMustBeSpacedCorrectly", Justification = "Ignored for more tree-like fluent syntax usage."),
SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1110:OpeningParenthesisMustBeOnDeclarationLine", Justification = "Ignored for more tree-like fluent syntax usage."),
SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1111:ClosingParenthesisMustBeOnLineOfLastParameter", Justification = "Ignored for more tree-like fluent syntax usage."),
SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1118:ParameterMustNotSpanMultipleLines", Justification = "Ignored for more tree-like fluent syntax usage.")
]
public static TSyntaxNode WithLeadingDocumentationTrivia<TSyntaxNode>(this TSyntaxNode syntaxNode, String summary = null) where TSyntaxNode : SyntaxNode
{
// TODO: Include the summary element text content and expand the optional parameters for more elements of use auto-documenting methods instead as per #2.
return syntaxNode.WithLeadingTrivia
(
SyntaxFactory.Trivia
(
SyntaxFactory.DocumentationCommentTrivia
(
SyntaxKind.MultiLineDocumentationCommentTrivia,
new SyntaxList<XmlNodeSyntax>().Add
(
SyntaxFactory.XmlElement
(
SyntaxFactory.XmlElementStartTag
(
SyntaxFactory.XmlName("summary")
),
SyntaxFactory.XmlElementEndTag
(
SyntaxFactory.XmlName("summary")
)
).WithLeadingTrivia
(
SyntaxFactory.DocumentationCommentExterior("/// ")
)
)
)
)
);
}
#endregion
}
} | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="RoslynExtensions.cs" company="Rhaeo.org">
// Licenced under the MIT license.
// </copyright>
// <summary>
// Defines the RoslynExtensions type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
using System;
using Microsoft.CodeAnalysis;
namespace Rhaeo.Roslyn
{
/// <summary>
/// Contains extension methods for Roslyn code analysis types simplifying some common code generation tasks.
/// </summary>
public static class RoslynExtensions
{
#region Methods
/// <summary>
/// Creates a new node from this node with the leading trivia replaced with a XML documentation.
/// </summary>
/// <typeparam name="TSyntaxNode">
/// The type of the syntax node.
/// </typeparam>
/// <param name="syntaxNode">
/// The syntax node.
/// </param>
/// <param name="summary">
/// The documentation <code>summary</code> element content.
/// </param>
/// <returns>
/// The new syntax node.
/// </returns>
public static TSyntaxNode WithLeadingDocumentationTrivia<TSyntaxNode>(this TSyntaxNode syntaxNode, String summary = null) where TSyntaxNode : SyntaxNode
{
throw new NotImplementedException();
}
#endregion
}
} | mit | C# |
39c05d4a591302ceb8bb6ff65c615bf33ea3628d | Add OS and Version information to telemetry | nachmore/unBand,jehy/unBand | src/unBand/Telemetry.cs | src/unBand/Telemetry.cs | using Microsoft.ApplicationInsights;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace unBand
{
public static class Telemetry
{
public static TelemetryClient Client {get; private set;}
static Telemetry()
{
Client = new TelemetryClient();
Init();
}
private static void Init()
{
var props = Properties.Settings.Default;
if (props.Device == Guid.Empty)
{
props.Device = Guid.NewGuid();
props.Save();
Client.Context.Session.IsFirst = true;
}
Client.Context.Device.Id = props.Device.ToString();
Client.Context.Session.Id = Guid.NewGuid().ToString();
Client.Context.Device.OperatingSystem = GetOS();
Client.Context.Device.Language = System.Globalization.CultureInfo.InstalledUICulture.TwoLetterISOLanguageName;
Client.Context.Component.Version = About.Current.Version;
}
private static string GetOS()
{
return Environment.OSVersion.VersionString + "(" +
(Environment.Is64BitOperatingSystem ? "x64" : "x86") + ")";
}
/// <summary>
/// Poor mans enum -> expanded string.
///
/// Once I've been using this for a while I may change this to a pure enum if
/// spaces in names prove to be annoying for querying / sorting the data
/// </summary>
public static class Events
{
public const string AppLaunch = "Launch";
public const string DeclinedFirstRunWarning = "Declined First Run Warning";
public const string DeclinedTelemetry = "Declined Telemetry";
public const string ChangeBackground = "Change Background";
public const string ChangeThemeColor = "Change Theme Color";
}
}
}
| using Microsoft.ApplicationInsights;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace unBand
{
public static class Telemetry
{
public static TelemetryClient Client {get; private set;}
static Telemetry()
{
Client = new TelemetryClient();
Init();
}
private static void Init()
{
var props = Properties.Settings.Default;
if (props.Device == Guid.Empty)
{
props.Device = Guid.NewGuid();
props.Save();
Client.Context.Session.IsFirst = true;
}
Client.Context.Device.Id = props.Device.ToString();
Client.Context.Session.Id = Guid.NewGuid().ToString();
}
/// <summary>
/// Poor mans enum -> expanded string.
///
/// Once I've been using this for a while I may change this to a pure enum if
/// spaces in names prove to be annoying for querying / sorting the data
/// </summary>
public static class Events
{
public const string AppLaunch = "Launch";
public const string DeclinedFirstRunWarning = "Declined First Run Warning";
public const string DeclinedTelemetry = "Declined Telemetry";
public const string ChangeBackground = "Change Background";
public const string ChangeThemeColor = "Change Theme Color";
}
}
}
| mit | C# |
9d40a4b040e6b4a22a36dd8815e1aa1363733134 | Disable unused parameter | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Tests/TestableRpcService.cs | WalletWasabi.Tests/TestableRpcService.cs | using System;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Gui.Rpc;
namespace WalletWasabi.Tests
{
internal class TestableRpcService
{
public void UnpublishedProcedure()
{
}
[JsonRpcMethod("say")]
public string Echo(string text) => text;
[JsonRpcMethod("substract")]
public int Substract(int minuend, int subtrahend) => minuend - subtrahend;
[JsonRpcMethod("substractasync")]
public async Task<int> SubstractAsync(int minuend, int subtrahend) => await Task.FromResult(minuend - subtrahend);
[JsonRpcMethod("writelog")]
public void Log(string logEntry)
{
Unused(logEntry);
}
[JsonRpcMethod("fail")]
public void Failure() => throw new InvalidOperationException("the error");
[JsonRpcMethod("format")]
public async Task FormatHardDriveAsync(string unit, CancellationToken ct)
{
Unused(unit);
Unused(ct);
await Task.FromResult((JsonRpcResponse)null);
}
#pragma warning disable IDE0060 // unused parameter
private void Unused(object item)
{
}
#pragma warning restore IDE0060
}
}
| using System;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Gui.Rpc;
namespace WalletWasabi.Tests
{
internal class TestableRpcService
{
public void UnpublishedProcedure()
{
}
[JsonRpcMethod("say")]
public string Echo(string text) => text;
[JsonRpcMethod("substract")]
public int Substract(int minuend, int subtrahend) => minuend - subtrahend;
[JsonRpcMethod("substractasync")]
public async Task<int> SubstractAsync(int minuend, int subtrahend) => await Task.FromResult(minuend - subtrahend);
[JsonRpcMethod("writelog")]
public void Log(string logEntry) { }
[JsonRpcMethod("fail")]
public void Failure() => throw new InvalidOperationException("the error");
[JsonRpcMethod("format")]
public async Task FormatHardDriveAsync(string unit, CancellationToken ct)
{
await Task.FromResult((JsonRpcResponse)null);
}
}
}
| mit | C# |
c56f59b9d133df772e6977e1a4839e7209c7b5b8 | Update ServiceCollectionExtensions.cs | khellang/nancy-bootstrapper-prototype | src/Nancy.AspNet/ServiceCollectionExtensions.cs | src/Nancy.AspNet/ServiceCollectionExtensions.cs | namespace Nancy.AspNet
{
using System;
using Microsoft.Extensions.DependencyInjection;
using Nancy.Bootstrappers.AspNet;
using Nancy.Core;
using Nancy.Core.Configuration;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddNancy(this IServiceCollection services)
{
return services.AddNancy(configure: null);
}
public static IServiceCollection AddNancy(this IServiceCollection services,
Action<IApplicationConfiguration> configure)
{
return services.AddNancy(DefaultPlatformServices.Instance, configure);
}
public static IServiceCollection AddNancy(this IServiceCollection services,
IPlatformServices platformServices,
Action<IApplicationConfiguration> configure)
{
Check.NotNull(services, nameof(services));
Check.NotNull(platformServices, nameof(platformServices));
// For ASP.NET it only makes sense to use the AspNetBootstrapper since it handles container
// customization etc. Therefore we hide away the whole bootstrapper concept.
// We still need to provide a way to configure the application. This
// is done by passing a delegate to a special inline bootstrapper.
var bootstrapper = new InlineAspNetBootstrapper(configure)
.Populate(services, platformServices);
// Make sure we add the bootstrapper so it can be resolved in a call to `UseNancy`.
return services.AddInstance(bootstrapper);
}
private class InlineAspNetBootstrapper : AspNetBootstrapper
{
private readonly Action<IApplicationConfiguration<IServiceCollection>> configure;
public InlineAspNetBootstrapper(Action<IApplicationConfiguration> configure)
{
this.configure = configure;
}
protected override void ConfigureApplication(IApplicationConfiguration<IServiceCollection> app)
{
this.configure?.Invoke(app);
}
}
}
}
| namespace Nancy.AspNet
{
using System;
using Microsoft.Extensions.DependencyInjection;
using Nancy.Bootstrappers.AspNet;
using Nancy.Core;
using Nancy.Core.Configuration;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddNancy(this IServiceCollection services)
{
return services.AddNancy(configure: null);
}
public static IServiceCollection AddNancy(this IServiceCollection services,
Action<IApplicationConfiguration> configure)
{
return services.AddNancy(DefaultPlatformServices.Instance, configure);
}
public static IServiceCollection AddNancy(this IServiceCollection services,
IPlatformServices platformServices,
Action<IApplicationConfiguration> configure)
{
Check.NotNull(services, nameof(services));
Check.NotNull(platformServices, nameof(platformServices));
// For ASP.NET it only makes sense to use the AspNetBootstrapper since it handles container
// customization etc. Therefore we hide away the whole bootstrapper concept.
// We still need to provide a way to configure the application. This
// is done by passing a delegate to a special inline bootstrapper.
var bootstrapper = new InlineAspNetBootstrapper(configure).Populate(services, platformServices);
// Make sure we add the bootstrapper so it can be resolved in a call to `UseNancy`.
return services.AddInstance(bootstrapper);
}
private class InlineAspNetBootstrapper : AspNetBootstrapper
{
private readonly Action<IApplicationConfiguration<IServiceCollection>> configure;
public InlineAspNetBootstrapper(Action<IApplicationConfiguration> configure)
{
this.configure = configure;
}
protected override void ConfigureApplication(IApplicationConfiguration<IServiceCollection> app)
{
this.configure?.Invoke(app);
}
}
}
}
| apache-2.0 | C# |
78ddd2cfeb63a66349a71c9511e5871d9eaa3257 | add UnixTimeStampToUtc() method | iolevel/peachpie-concept,iolevel/peachpie,iolevel/peachpie,iolevel/peachpie,peachpiecompiler/peachpie,iolevel/peachpie-concept,peachpiecompiler/peachpie,iolevel/peachpie-concept,peachpiecompiler/peachpie | src/Peachpie.Runtime/Utilities/DateTimeUtils.cs | src/Peachpie.Runtime/Utilities/DateTimeUtils.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Pchp.Core.Utilities
{
public static class DateTimeUtils
{
/// <summary>
/// Time 0 in terms of Unix TimeStamp.
/// </summary>
public static readonly DateTime/*!*/UtcStartOfUnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// Converts <see cref="DateTime"/> representing UTC time to UNIX timestamp.
/// </summary>
/// <param name="dt">Time.</param>
/// <returns>Unix timestamp.</returns>
public static long UtcToUnixTimeStamp(DateTime dt)
{
double seconds = UtcToUnixTimeStampFloat(dt);
if (seconds < long.MinValue)
return long.MinValue;
if (seconds > long.MaxValue)
return long.MaxValue;
return (long)seconds;
}
public static double UtcToUnixTimeStampFloat(DateTime dt)
{
return (dt - UtcStartOfUnixEpoch).TotalSeconds;
}
/// <summary>
/// Converts UNIX timestamp to <see cref="DateTime"/> representing UTC time.
/// </summary>
/// <param name="ts">Unix timestamp.</param>
/// <returns>Time.</returns>
public static DateTime UnixTimeStampToUtc(long ts)
{
return ts == 0 ? DateTime.MinValue : DateTimeOffset.FromUnixTimeSeconds(ts).UtcDateTime;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Pchp.Core.Utilities
{
public static class DateTimeUtils
{
/// <summary>
/// Time 0 in terms of Unix TimeStamp.
/// </summary>
public static readonly DateTime/*!*/UtcStartOfUnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// Converts <see cref="DateTime"/> representing UTC time to UNIX timestamp.
/// </summary>
/// <param name="dt">Time.</param>
/// <returns>Unix timestamp.</returns>
public static long UtcToUnixTimeStamp(DateTime dt)
{
double seconds = UtcToUnixTimeStampFloat(dt);
if (seconds < long.MinValue)
return long.MinValue;
if (seconds > long.MaxValue)
return long.MaxValue;
return (long)seconds;
}
public static double UtcToUnixTimeStampFloat(DateTime dt)
{
return (dt - UtcStartOfUnixEpoch).TotalSeconds;
}
}
}
| apache-2.0 | C# |
61c8481d06244ff1259c5c2f0a25d9afcb6d75fd | Add X-ApiKey header to promote API. | lvermeulen/ProGet.Net | src/ProGet.Net/PackagePromotion/ProGetClient.cs | src/ProGet.Net/PackagePromotion/ProGetClient.cs | using System.Collections.Generic;
using System.Threading.Tasks;
using Flurl.Http;
using ProGet.Net.Common;
using ProGet.Net.PackagePromotion.Models;
// ReSharper disable CheckNamespace
namespace ProGet.Net
{
public partial class ProGetClient
{
private IFlurlClient GetPackagePromotionApiClient(string path, object queryParamValues = null) => GetApiClient("/api/promotions")
.AppendPathSegment(path)
.SetQueryParams(queryParamValues, Flurl.NullValueHandling.NameOnly)
.ConfigureClient(settings => settings.OnError = ErrorHandler);
public async Task<IEnumerable<Promotion>> PackagePromotion_ListPromotionsAsync(string fromFeed, string toFeed, string groupName, string packageName, string version)
{
var queryParamValues = QueryParamValues.From(
new NamedValue(nameof(fromFeed), fromFeed),
new NamedValue(nameof(toFeed), toFeed),
new NamedValue(nameof(groupName), groupName),
new NamedValue(nameof(packageName), packageName),
new NamedValue(nameof(version), version)
);
return await GetPackagePromotionApiClient("list", queryParamValues)
.GetJsonAsync<IEnumerable<Promotion>>();
}
public async Task<bool> PackagePromotion_PromotePackageAsync(PackagePromotionContents packagePromotion)
{
var response = await GetPackagePromotionApiClient("promote")
.WithHeader("X-ApiKey", _apiKey)
.PostJsonAsync(packagePromotion);
return response.IsSuccessStatusCode;
}
}
}
| using System.Collections.Generic;
using System.Threading.Tasks;
using Flurl.Http;
using ProGet.Net.Common;
using ProGet.Net.PackagePromotion.Models;
// ReSharper disable CheckNamespace
namespace ProGet.Net
{
public partial class ProGetClient
{
private IFlurlClient GetPackagePromotionApiClient(string path, object queryParamValues = null) => GetApiClient("/api/promotions")
.AppendPathSegment(path)
.SetQueryParams(queryParamValues, Flurl.NullValueHandling.NameOnly)
.ConfigureClient(settings => settings.OnError = ErrorHandler);
public async Task<IEnumerable<Promotion>> PackagePromotion_ListPromotionsAsync(string fromFeed, string toFeed, string groupName, string packageName, string version)
{
var queryParamValues = QueryParamValues.From(
new NamedValue(nameof(fromFeed), fromFeed),
new NamedValue(nameof(toFeed), toFeed),
new NamedValue(nameof(groupName), groupName),
new NamedValue(nameof(packageName), packageName),
new NamedValue(nameof(version), version)
);
return await GetPackagePromotionApiClient("list", queryParamValues)
.GetJsonAsync<IEnumerable<Promotion>>();
}
public async Task<bool> PackagePromotion_PromotePackageAsync(PackagePromotionContents packagePromotion)
{
var response = await GetPackagePromotionApiClient("promote")
.PostJsonAsync(packagePromotion);
return response.IsSuccessStatusCode;
}
}
}
| mit | C# |
514f6659fccc6ec5219c3810b3e13eaa81ec9d78 | Use TypeNameHelper instead of private method | khellang/Scrutor | src/Scrutor/MissingTypeRegistrationException.cs | src/Scrutor/MissingTypeRegistrationException.cs | using System;
using Microsoft.Extensions.Internal;
namespace Scrutor
{
public class MissingTypeRegistrationException : InvalidOperationException
{
public MissingTypeRegistrationException(Type serviceType)
: base($"Could not find any registered services for type '{TypeNameHelper.GetTypeDisplayName(serviceType)}'.")
{
ServiceType = serviceType;
}
public Type ServiceType { get; }
}
}
| using System;
using System.Linq;
using System.Reflection;
namespace Scrutor
{
public class MissingTypeRegistrationException : InvalidOperationException
{
public MissingTypeRegistrationException(Type serviceType)
: base($"Could not find any registered services for type '{GetFriendlyName(serviceType)}'.")
{
ServiceType = serviceType;
}
public Type ServiceType { get; }
private static string GetFriendlyName(Type type)
{
if (type == typeof(int)) return "int";
if (type == typeof(short)) return "short";
if (type == typeof(byte)) return "byte";
if (type == typeof(bool)) return "bool";
if (type == typeof(char)) return "char";
if (type == typeof(long)) return "long";
if (type == typeof(float)) return "float";
if (type == typeof(double)) return "double";
if (type == typeof(decimal)) return "decimal";
if (type == typeof(string)) return "string";
if (type == typeof(object)) return "object";
var typeInfo = type.GetTypeInfo();
if (typeInfo.IsGenericType) return GetGenericFriendlyName(typeInfo);
return type.Name;
}
private static string GetGenericFriendlyName(TypeInfo typeInfo)
{
var argumentNames = typeInfo.GenericTypeArguments.Select(GetFriendlyName).ToArray();
var baseName = typeInfo.Name.Split('`').First();
return $"{baseName}<{string.Join(", ", argumentNames)}>";
}
}
} | mit | C# |
fbd8884944da3f1415e101745f7e330604536472 | Fix routing tests, we DO need a database for these | Door3Dev/HRI-Umbraco,arknu/Umbraco-CMS,tompipe/Umbraco-CMS,Phosworks/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Tronhus/Umbraco-CMS,WebCentrum/Umbraco-CMS,corsjune/Umbraco-CMS,christopherbauer/Umbraco-CMS,ordepdev/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,lars-erik/Umbraco-CMS,lingxyd/Umbraco-CMS,arvaris/HRI-Umbraco,DaveGreasley/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,timothyleerussell/Umbraco-CMS,bjarnef/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,lars-erik/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,markoliver288/Umbraco-CMS,KevinJump/Umbraco-CMS,gavinfaux/Umbraco-CMS,iahdevelop/Umbraco-CMS,abryukhov/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Pyuuma/Umbraco-CMS,jchurchley/Umbraco-CMS,hfloyd/Umbraco-CMS,timothyleerussell/Umbraco-CMS,markoliver288/Umbraco-CMS,robertjf/Umbraco-CMS,mstodd/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,aaronpowell/Umbraco-CMS,yannisgu/Umbraco-CMS,tcmorris/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,lingxyd/Umbraco-CMS,zidad/Umbraco-CMS,engern/Umbraco-CMS,NikRimington/Umbraco-CMS,Door3Dev/HRI-Umbraco,rajendra1809/Umbraco-CMS,KevinJump/Umbraco-CMS,christopherbauer/Umbraco-CMS,VDBBjorn/Umbraco-CMS,gregoriusxu/Umbraco-CMS,Phosworks/Umbraco-CMS,rajendra1809/Umbraco-CMS,sargin48/Umbraco-CMS,gavinfaux/Umbraco-CMS,iahdevelop/Umbraco-CMS,abjerner/Umbraco-CMS,mittonp/Umbraco-CMS,dampee/Umbraco-CMS,gregoriusxu/Umbraco-CMS,lingxyd/Umbraco-CMS,abjerner/Umbraco-CMS,jchurchley/Umbraco-CMS,zidad/Umbraco-CMS,countrywide/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,Door3Dev/HRI-Umbraco,kasperhhk/Umbraco-CMS,AndyButland/Umbraco-CMS,dampee/Umbraco-CMS,hfloyd/Umbraco-CMS,Spijkerboer/Umbraco-CMS,yannisgu/Umbraco-CMS,sargin48/Umbraco-CMS,madsoulswe/Umbraco-CMS,yannisgu/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,corsjune/Umbraco-CMS,christopherbauer/Umbraco-CMS,NikRimington/Umbraco-CMS,romanlytvyn/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,base33/Umbraco-CMS,ordepdev/Umbraco-CMS,wtct/Umbraco-CMS,DaveGreasley/Umbraco-CMS,wtct/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,qizhiyu/Umbraco-CMS,nvisage-gf/Umbraco-CMS,robertjf/Umbraco-CMS,markoliver288/Umbraco-CMS,qizhiyu/Umbraco-CMS,ordepdev/Umbraco-CMS,engern/Umbraco-CMS,m0wo/Umbraco-CMS,AzarinSergey/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Myster/Umbraco-CMS,AndyButland/Umbraco-CMS,christopherbauer/Umbraco-CMS,tompipe/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,madsoulswe/Umbraco-CMS,Myster/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,jchurchley/Umbraco-CMS,rasmusfjord/Umbraco-CMS,rasmuseeg/Umbraco-CMS,rasmusfjord/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,countrywide/Umbraco-CMS,rustyswayne/Umbraco-CMS,Spijkerboer/Umbraco-CMS,mittonp/Umbraco-CMS,mstodd/Umbraco-CMS,Khamull/Umbraco-CMS,rustyswayne/Umbraco-CMS,sargin48/Umbraco-CMS,lars-erik/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,markoliver288/Umbraco-CMS,iahdevelop/Umbraco-CMS,nvisage-gf/Umbraco-CMS,Tronhus/Umbraco-CMS,lingxyd/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,marcemarc/Umbraco-CMS,countrywide/Umbraco-CMS,corsjune/Umbraco-CMS,madsoulswe/Umbraco-CMS,KevinJump/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,aaronpowell/Umbraco-CMS,kasperhhk/Umbraco-CMS,Tronhus/Umbraco-CMS,rajendra1809/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Phosworks/Umbraco-CMS,rasmuseeg/Umbraco-CMS,Phosworks/Umbraco-CMS,aaronpowell/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,ehornbostel/Umbraco-CMS,sargin48/Umbraco-CMS,kgiszewski/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,markoliver288/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,TimoPerplex/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,corsjune/Umbraco-CMS,timothyleerussell/Umbraco-CMS,markoliver288/Umbraco-CMS,iahdevelop/Umbraco-CMS,AndyButland/Umbraco-CMS,arvaris/HRI-Umbraco,DaveGreasley/Umbraco-CMS,Myster/Umbraco-CMS,AzarinSergey/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,nvisage-gf/Umbraco-CMS,VDBBjorn/Umbraco-CMS,AzarinSergey/Umbraco-CMS,leekelleher/Umbraco-CMS,qizhiyu/Umbraco-CMS,gavinfaux/Umbraco-CMS,ehornbostel/Umbraco-CMS,zidad/Umbraco-CMS,umbraco/Umbraco-CMS,dampee/Umbraco-CMS,romanlytvyn/Umbraco-CMS,robertjf/Umbraco-CMS,neilgaietto/Umbraco-CMS,umbraco/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,leekelleher/Umbraco-CMS,kasperhhk/Umbraco-CMS,aadfPT/Umbraco-CMS,dampee/Umbraco-CMS,AndyButland/Umbraco-CMS,wtct/Umbraco-CMS,lars-erik/Umbraco-CMS,Pyuuma/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,Door3Dev/HRI-Umbraco,mittonp/Umbraco-CMS,neilgaietto/Umbraco-CMS,arknu/Umbraco-CMS,Pyuuma/Umbraco-CMS,ehornbostel/Umbraco-CMS,m0wo/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Myster/Umbraco-CMS,Pyuuma/Umbraco-CMS,hfloyd/Umbraco-CMS,christopherbauer/Umbraco-CMS,qizhiyu/Umbraco-CMS,neilgaietto/Umbraco-CMS,timothyleerussell/Umbraco-CMS,marcemarc/Umbraco-CMS,kgiszewski/Umbraco-CMS,leekelleher/Umbraco-CMS,dawoe/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,rajendra1809/Umbraco-CMS,countrywide/Umbraco-CMS,tompipe/Umbraco-CMS,gkonings/Umbraco-CMS,rajendra1809/Umbraco-CMS,mittonp/Umbraco-CMS,timothyleerussell/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,gregoriusxu/Umbraco-CMS,arknu/Umbraco-CMS,sargin48/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,rustyswayne/Umbraco-CMS,iahdevelop/Umbraco-CMS,romanlytvyn/Umbraco-CMS,engern/Umbraco-CMS,base33/Umbraco-CMS,base33/Umbraco-CMS,gavinfaux/Umbraco-CMS,AzarinSergey/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,DaveGreasley/Umbraco-CMS,ehornbostel/Umbraco-CMS,ehornbostel/Umbraco-CMS,arvaris/HRI-Umbraco,TimoPerplex/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,Tronhus/Umbraco-CMS,TimoPerplex/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,romanlytvyn/Umbraco-CMS,Myster/Umbraco-CMS,mattbrailsford/Umbraco-CMS,m0wo/Umbraco-CMS,NikRimington/Umbraco-CMS,robertjf/Umbraco-CMS,Tronhus/Umbraco-CMS,kasperhhk/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,lars-erik/Umbraco-CMS,aadfPT/Umbraco-CMS,wtct/Umbraco-CMS,aadfPT/Umbraco-CMS,yannisgu/Umbraco-CMS,Spijkerboer/Umbraco-CMS,neilgaietto/Umbraco-CMS,dawoe/Umbraco-CMS,countrywide/Umbraco-CMS,nvisage-gf/Umbraco-CMS,rustyswayne/Umbraco-CMS,VDBBjorn/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,DaveGreasley/Umbraco-CMS,rustyswayne/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,rasmuseeg/Umbraco-CMS,WebCentrum/Umbraco-CMS,gregoriusxu/Umbraco-CMS,bjarnef/Umbraco-CMS,gavinfaux/Umbraco-CMS,neilgaietto/Umbraco-CMS,engern/Umbraco-CMS,romanlytvyn/Umbraco-CMS,Phosworks/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,Khamull/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,engern/Umbraco-CMS,corsjune/Umbraco-CMS,nvisage-gf/Umbraco-CMS,AndyButland/Umbraco-CMS,gkonings/Umbraco-CMS,arvaris/HRI-Umbraco,TimoPerplex/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,TimoPerplex/Umbraco-CMS,KevinJump/Umbraco-CMS,gregoriusxu/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,rasmusfjord/Umbraco-CMS,WebCentrum/Umbraco-CMS,AzarinSergey/Umbraco-CMS,Door3Dev/HRI-Umbraco,Khamull/Umbraco-CMS,mstodd/Umbraco-CMS,ordepdev/Umbraco-CMS,zidad/Umbraco-CMS,mstodd/Umbraco-CMS,yannisgu/Umbraco-CMS,Khamull/Umbraco-CMS,zidad/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,gkonings/Umbraco-CMS,ordepdev/Umbraco-CMS,mstodd/Umbraco-CMS,wtct/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,rasmusfjord/Umbraco-CMS,gkonings/Umbraco-CMS,dampee/Umbraco-CMS,m0wo/Umbraco-CMS,mittonp/Umbraco-CMS,arknu/Umbraco-CMS,gkonings/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Khamull/Umbraco-CMS,kgiszewski/Umbraco-CMS,Pyuuma/Umbraco-CMS,kasperhhk/Umbraco-CMS,bjarnef/Umbraco-CMS,marcemarc/Umbraco-CMS,lingxyd/Umbraco-CMS,m0wo/Umbraco-CMS,umbraco/Umbraco-CMS,qizhiyu/Umbraco-CMS | src/Umbraco.Tests/Routing/LookupByAliasTests.cs | src/Umbraco.Tests/Routing/LookupByAliasTests.cs | using NUnit.Framework;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web.Routing;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.template;
namespace Umbraco.Tests.Routing
{
[TestFixture]
public class LookupByAliasTests : BaseRoutingTest
{
public override void Initialize()
{
base.Initialize();
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
}
[TestCase("/this/is/my/alias", 1046)]
[TestCase("/anotheralias", 1046)]
[TestCase("/page2/alias", 1173)]
[TestCase("/2ndpagealias", 1173)]
[TestCase("/only/one/alias", 1174)]
[TestCase("/ONLY/one/Alias", 1174)]
public void Lookup_By_Url_Alias(string urlAsString, int nodeMatch)
{
var routingContext = GetRoutingContext(urlAsString);
var url = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url
var docRequest = new PublishedContentRequest(url, routingContext);
var lookup = new LookupByAlias();
var result = lookup.TrySetDocument(docRequest);
Assert.IsTrue(result);
Assert.AreEqual(docRequest.DocumentId, nodeMatch);
}
}
} | using NUnit.Framework;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web.Routing;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.template;
namespace Umbraco.Tests.Routing
{
[TestFixture]
public class LookupByAliasTests : BaseRoutingTest
{
public override void Initialize()
{
base.Initialize();
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
}
/// <summary>
/// We don't need a db for this test, will run faster without one
/// </summary>
protected override bool RequiresDbSetup
{
get { return false; }
}
[TestCase("/this/is/my/alias", 1046)]
[TestCase("/anotheralias", 1046)]
[TestCase("/page2/alias", 1173)]
[TestCase("/2ndpagealias", 1173)]
[TestCase("/only/one/alias", 1174)]
[TestCase("/ONLY/one/Alias", 1174)]
public void Lookup_By_Url_Alias(string urlAsString, int nodeMatch)
{
var routingContext = GetRoutingContext(urlAsString);
var url = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url
var docRequest = new PublishedContentRequest(url, routingContext);
var lookup = new LookupByAlias();
var result = lookup.TrySetDocument(docRequest);
Assert.IsTrue(result);
Assert.AreEqual(docRequest.DocumentId, nodeMatch);
}
}
} | mit | C# |
530c8bfac01026510d929f5f90d70955ce50e5be | implement ISequenced | Pondidum/Ledger,Pondidum/Ledger | Ledger/DomainEvent.cs | Ledger/DomainEvent.cs | namespace Ledger
{
public class DomainEvent : ISequenced
{
public int SequenceID { get; set; }
}
}
| namespace Ledger
{
public class DomainEvent
{
public int SequenceID { get; set; }
}
}
| lgpl-2.1 | C# |
3a9750caa1c5c7b3abe1b5719ded97cd4bfc1b14 | Remove WrapValueToClass | ufcpp/UniRx,cruwel/UniRx,endo0407/UniRx,OC-Leon/UniRx,cruwel/UniRx,OrangeCube/UniRx,ataihei/UniRx,ppcuni/UniRx,kimsama/UniRx,m-ishikawa/UniRx,cruwel/UniRx,saruiwa/UniRx,TORISOUP/UniRx,neuecc/UniRx | Assets/UniRx/Scripts/UnityEngineBridge/AotSafeExtensions.cs | Assets/UniRx/Scripts/UnityEngineBridge/AotSafeExtensions.cs | using System;
using System.Collections;
using System.Collections.Generic;
namespace UniRx
{
public static class AotSafeExtensions
{
public static IEnumerable<T> AsSafeEnumerable<T>(this IEnumerable<T> source)
{
var e = ((IEnumerable)source).GetEnumerator();
using (e as IDisposable)
{
while (e.MoveNext())
{
yield return (T)e.Current;
}
}
}
}
} | using System;
using System.Collections;
using System.Collections.Generic;
namespace UniRx
{
public static class AotSafeExtensions
{
public static IEnumerable<T> AsSafeEnumerable<T>(this IEnumerable<T> source)
{
var e = ((IEnumerable)source).GetEnumerator();
using (e as IDisposable)
{
while (e.MoveNext())
{
yield return (T)e.Current;
}
}
}
public static IObservable<Tuple<T>> WrapValueToClass<T>(this IObservable<T> source)
where T : struct
{
var dummy = 0;
return Observable.Create<Tuple<T>>(observer =>
{
return source.Subscribe(Observer.Create<T>(x =>
{
dummy.GetHashCode(); // capture outer value
var v = new Tuple<T>(x);
observer.OnNext(v);
}, observer.OnError, observer.OnCompleted));
});
}
public static IEnumerable<Tuple<T>> WrapValueToClass<T>(this IEnumerable<T> source)
where T : struct
{
var e = ((IEnumerable)source).GetEnumerator();
using (e as IDisposable)
{
while (e.MoveNext())
{
yield return new Tuple<T>((T)e.Current);
}
}
}
}
} | mit | C# |
3dce59e70b5244437511f1b3fb490ff837b438be | Load Asset from Base64 | Thundernerd/Unity3D-ExtendedEditor,Miguel-Barreiro/ExtendedEditor,Thundernerd/ExtendedEditor,Miguel-Barreiro/ExtendedEditor,Thundernerd/ExtendedEditor,Miguel-Barreiro/ExtendedEditor,Thundernerd/ExtendedEditor | ExtendedEditor/Assets/ExtendedEditor/Core/ExtendedAssets.cs | ExtendedEditor/Assets/ExtendedEditor/Core/ExtendedAssets.cs | #if UNITY_EDITOR
using System.Collections.Generic;
using System.IO;
using TNRD.Json;
using UnityEngine;
namespace TNRD.Editor.Core {
public class ExtendedAssets {
[JsonIgnore]
private Dictionary<string, Texture2D> textures;
[JsonProperty]
private string path;
public ExtendedAssets() {
textures = new Dictionary<string, Texture2D>();
}
public ExtendedAssets( string path, ExtendedWindow window ) {
if ( string.IsNullOrEmpty( path ) ) {
var type = window.Editor.GetType();
var files = Directory.GetFiles( Application.dataPath, string.Format( "*{0}.cs", type.Name ), SearchOption.AllDirectories );
if ( files.Length == 1 ) {
var f = files[0];
var fi = new FileInfo( f );
this.path = Path.Combine( fi.DirectoryName, "Assets/" );
}
} else {
this.path = path.ToLower().StartsWith( "assets" ) ? path : string.Format( "Assets/{0}", path );
}
textures = new Dictionary<string, Texture2D>();
}
public Texture2D this[string key] {
get {
if ( textures.ContainsKey( key ) ) {
return textures[key];
} else {
return Load( key );
}
}
}
public Texture2D Load( string key ) {
if ( textures.ContainsKey( key ) ) {
return textures[key];
}
var path = Path.Combine( this.path, key + ".png" );
if ( !File.Exists( path ) ) return null;
var tex = new Texture2D( 1, 1 );
tex.hideFlags = HideFlags.HideAndDontSave;
var bytes = File.ReadAllBytes( path );
tex.LoadImage( bytes );
textures.Add( key, tex );
return textures[key];
}
public Texture2D FromBase64( string key, string b64 ) {
if ( textures.ContainsKey( key ) ) {
return textures[key];
}
var tex = new Texture2D( 1, 1 );
tex.hideFlags = HideFlags.HideAndDontSave;
var bytes = System.Convert.FromBase64String( b64 );
tex.LoadImage( bytes );
textures.Add( key, tex );
return textures[key];
}
public void Destroy( ExtendedWindow window ) {
foreach ( var item in textures ) {
window.Editor.DestroyAsset( item.Value );
}
}
}
}
#endif | #if UNITY_EDITOR
using System.Collections.Generic;
using System.IO;
using TNRD.Json;
using UnityEngine;
namespace TNRD.Editor.Core {
public class ExtendedAssets {
[JsonIgnore]
private Dictionary<string, Texture2D> textures;
[JsonProperty]
private string path;
public ExtendedAssets() {
textures = new Dictionary<string, Texture2D>();
}
public ExtendedAssets( string path, ExtendedWindow window ) {
if ( string.IsNullOrEmpty( path ) ) {
var type = window.Editor.GetType();
var files = Directory.GetFiles( Application.dataPath, string.Format( "*{0}.cs", type.Name ), SearchOption.AllDirectories );
if ( files.Length == 1 ) {
var f = files[0];
var fi = new FileInfo( f );
this.path = Path.Combine( fi.DirectoryName, "Assets/" );
}
} else {
this.path = path.ToLower().StartsWith( "assets" ) ? path : string.Format( "Assets/{0}", path );
}
textures = new Dictionary<string, Texture2D>();
}
public Texture2D this[string key] {
get {
if ( textures.ContainsKey( key ) ) {
return textures[key];
} else {
return Load( key );
}
}
}
public Texture2D Load( string key ) {
if ( textures.ContainsKey( key ) ) {
return textures[key];
}
var path = Path.Combine( this.path, key + ".png" );
if ( !File.Exists( path ) ) return null;
var tex = new Texture2D( 1, 1 );
tex.hideFlags = HideFlags.HideAndDontSave;
var bytes = File.ReadAllBytes( path );
tex.LoadImage( bytes );
textures.Add( key, tex );
return textures[key];
}
public void Destroy( ExtendedWindow window ) {
foreach ( var item in textures ) {
window.Editor.DestroyAsset( item.Value );
}
}
}
}
#endif | mit | C# |
a938af39bdde0b47a0db684327359d86991b521d | Make EvaluationResult.Empty readonly. | Unity-Technologies/debugger-libs,joj/debugger-libs,joj/debugger-libs,mono/debugger-libs,Unity-Technologies/debugger-libs,mono/debugger-libs | Mono.Debugging/Mono.Debugging.Backend/IObjectValueSource.cs | Mono.Debugging/Mono.Debugging.Backend/IObjectValueSource.cs | // IObjectValueSource.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
//
// 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 Mono.Debugging.Client;
namespace Mono.Debugging.Backend
{
public interface IObjectValueSource
{
ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options);
EvaluationResult SetValue (ObjectPath path, string value, EvaluationOptions options);
ObjectValue GetValue (ObjectPath path, EvaluationOptions options);
object GetRawValue (ObjectPath path, EvaluationOptions options);
void SetRawValue (ObjectPath path, object value, EvaluationOptions options);
}
public interface IRawValue
{
object CallMethod (string name, object[] parameters, EvaluationOptions options);
object GetMemberValue (string name, EvaluationOptions options);
void SetMemberValue (string name, object value, EvaluationOptions options);
}
public interface IRawValueArray
{
object GetValue (int[] index);
void SetValue (int[] index, object value);
int[] Dimensions { get; }
Array ToArray ();
}
[Serializable]
public class EvaluationResult
{
public static readonly EvaluationResult Empty = new EvaluationResult (string.Empty);
public EvaluationResult (string value)
{
Value = value;
}
public EvaluationResult (string value, string displayValue)
{
Value = value;
DisplayValue = displayValue;
}
public string Value { get; set; }
public string DisplayValue { get; set; }
public override string ToString ()
{
return Value;
}
}
}
| // IObjectValueSource.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
//
// 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 Mono.Debugging.Client;
namespace Mono.Debugging.Backend
{
public interface IObjectValueSource
{
ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options);
EvaluationResult SetValue (ObjectPath path, string value, EvaluationOptions options);
ObjectValue GetValue (ObjectPath path, EvaluationOptions options);
object GetRawValue (ObjectPath path, EvaluationOptions options);
void SetRawValue (ObjectPath path, object value, EvaluationOptions options);
}
public interface IRawValue
{
object CallMethod (string name, object[] parameters, EvaluationOptions options);
object GetMemberValue (string name, EvaluationOptions options);
void SetMemberValue (string name, object value, EvaluationOptions options);
}
public interface IRawValueArray
{
object GetValue (int[] index);
void SetValue (int[] index, object value);
int[] Dimensions { get; }
Array ToArray ();
}
[Serializable]
public class EvaluationResult
{
public static EvaluationResult Empty = new EvaluationResult (string.Empty);
public EvaluationResult (string value)
{
Value = value;
}
public EvaluationResult (string value, string displayValue)
{
Value = value;
DisplayValue = displayValue;
}
public string Value { get; set; }
public string DisplayValue { get; set; }
public override string ToString ()
{
return Value;
}
}
}
| mit | C# |
65bf92dbee3c697397ae3535fd7b6e2a18b35d26 | Fix label/input binding in attachment form | rbaumg/trac,rbaumg/trac,rbaumg/trac,rbaumg/trac | templates/attachment.cs | templates/attachment.cs | <?cs include "header.cs" ?>
<?cs include "macros.cs" ?>
<div id="page-content">
<h3>Add Attachment to
<a href="<?cs var:file.attachment_parent_href?>"><?cs var:file.attachment_parent?></a></h3>
<div id="main">
<div id="main-content">
<fieldset>
<form action="<?cs var:cgi_location ?>" method="post"
enctype="multipart/form-data">
<input type="hidden" name="mode" value="attachment" />
<input type="hidden" name="type" value="<?cs var:attachment.type ?>" />
<input type="hidden" name="id" value="<?cs var:attachment.id ?>" />
<div style="align: right">
<label for="author" class="att-label">Author:</label>
<input type="text" id="author" name="author" class="textwidget" size="40"
value="<?cs var:trac.authname?>" />
<br />
<label for="description" class="att-label">Description:</label>
<input type="text" id="description" name="description" class="textwidget"
size="40" />
<br />
<label for="file" class="att-label">File:</label>
<input type="file" id="file" name="attachment" />
<br />
<br />
<input type="reset" value="Reset" />
<input type="submit" value="Add" />
</div>
</form>
</fieldset>
</div>
</div>
</div>
<?cs include:"footer.cs"?>
| <?cs include "header.cs" ?>
<?cs include "macros.cs" ?>
<div id="page-content">
<h3>Add Attachment to
<a href="<?cs var:file.attachment_parent_href?>"><?cs var:file.attachment_parent?></a></h3>
<div id="main">
<div id="main-content">
<fieldset>
<form action="<?cs var:cgi_location ?>" method="post"
enctype="multipart/form-data">
<input type="hidden" name="mode" value="attachment" />
<input type="hidden" name="type" value="<?cs var:attachment.type ?>" />
<input type="hidden" name="id" value="<?cs var:attachment.id ?>" />
<div style="align: right">
<label for="author" class="att-label">Author:</label>
<input type="text" name="author" class="textwidget" size="40" value="<?cs var:trac.authname?>">
<br />
<label for="description" class="att-label">Description:</label>
<input type="text" name="description" class="textwidget" size="40">
<br />
<label for="file" class="att-label">File:</label>
<input type="file" name="attachment"/>
<br />
<br />
<input type="reset" value="Reset"/>
<input type="submit" value="Add"/>
</div>
</form>
</fieldset>
</div>
</div>
</div>
<?cs include:"footer.cs"?>
| bsd-3-clause | C# |
829ed16517944bf9fdb461e582187d21eccf3c82 | Improve message. | jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr | src/HelloCoreClrApp/Health/CpuMonitor.cs | src/HelloCoreClrApp/Health/CpuMonitor.cs | using System;
using System.Diagnostics;
using Serilog;
namespace HelloCoreClrApp.Health
{
public class CpuMonitor: IMonitor
{
private static readonly ILogger Log = Serilog.Log.ForContext<CpuMonitor>();
public void LogUsage()
{
var runningTime = DateTime.Now - Process.GetCurrentProcess().StartTime;
var usage = (double)Process.GetCurrentProcess().TotalProcessorTime.Ticks / runningTime.Ticks
/ Environment.ProcessorCount;
usage = Math.Round(usage * 100, 2);
Log.Information("CPU time since application start:{0}",
$"{Environment.NewLine}{usage}% for {Process.GetCurrentProcess().ProcessName}");
}
}
} | using System;
using System.Diagnostics;
using Serilog;
namespace HelloCoreClrApp.Health
{
public class CpuMonitor: IMonitor
{
private static readonly ILogger Log = Serilog.Log.ForContext<CpuMonitor>();
public void LogUsage()
{
var runningTime = DateTime.Now - Process.GetCurrentProcess().StartTime;
var usage = (double)Process.GetCurrentProcess().TotalProcessorTime.Ticks / runningTime.Ticks
/ Environment.ProcessorCount;
usage = Math.Round(usage * 100, 2);
Log.Information("Processor usage since application start:{0}",
$"{Environment.NewLine}{usage}% for {Process.GetCurrentProcess().ProcessName}");
}
}
} | mit | C# |
737b410246af8d989b83a957f6ff0c86e83b0f2d | Fix an error with console client test | SoftuniTeamBlackOlive/SupermarketChain,SoftuniTeamBlackOlive/SupermarketChain | SupermarketChain/SupermarketChain.Client.Console/Program.cs | SupermarketChain/SupermarketChain.Client.Console/Program.cs | namespace SupermarketChain.Client.Console
{
using System;
using System.Linq;
using SupermarketChain.Data.SqlServer;
using SupermarketChain.Model;
using SupermarketChain.Data.SqlServer.Repositories;
class Program
{
static void Main(string[] args)
{
// Testing SupermarketChainDbContext
var dbContext = new SupermarketChainDbContext();
Console.WriteLine(dbContext.Vendors.FirstOrDefault(v => v.Name == "Kamenitza").Name);
Console.WriteLine(dbContext.Vendors.FirstOrDefault(v => v.Name == "Kamenitza").Name);
Console.WriteLine(dbContext.Vendors.Find(2).Name);
// Testing repository
var dbVendors = new Repository<Vendor>();
dbVendors.Add(new Vendor { Name = "Zagorka" });
dbVendors.SaveChanges();
}
}
} | namespace SupermarketChain.Client.Console
{
using System;
using System.Linq;
using SupermarketChain.Data.SqlServer;
using SupermarketChain.Model;
using SupermarketChain.Data.SqlServer.Repositories;
class Program
{
static void Main(string[] args)
{
// Testing SupermarketChainDbContext
var dbContext = new SupermarketChainDbContext();
Console.WriteLine(dbContext.Vendors.FirstOrDefault(v => v.Name == "Kamenitza").Name);
Console.WriteLine(dbContext.Vendors.FirstOrDefault(v => v.Name == "Amstel").Name);
Console.WriteLine(dbContext.Vendors.Find(2).Name); // Testing repository
var dbVendors = new Repository<Vendor>();
dbVendors.Add(new Vendor { Name = "Zagorka" });
dbVendors.SaveChanges();
}
}
} | mit | C# |
96e9da314181ca3152b3d2cc3ab0e36bec45a894 | Update Layout to Use Editable Popovers | tommcclean/PortalCMS,tommcclean/PortalCMS,tommcclean/PortalCMS | Portal.CMS.Web/Views/Shared/_Layout.cshtml | Portal.CMS.Web/Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html lang="en-gb">
<head>
<title>@SettingHelper.Get("Website Name"): @ViewBag.Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
<meta name="description" content="@SettingHelper.Get("Description Meta Tag")">
@RenderSection("Styles", false)
@Styles.Render("~/Resources/CSS/Bootstrap")
@Styles.Render("~/Resources/CSS/FontAwesome")
@Styles.Render("~/Resources/CSS/Framework")
@Styles.Render("~/Resources/CSS/Plugins/Effects")
@if (UserHelper.IsAdmin)
{
@Styles.Render("~/Resources/CSS/Framework/Administration")
}
@if (UserHelper.IsEditor)
{
@Styles.Render("~/Resources/CSS/Framework/Editor")
}
<link href="@Url.Action("Render", "Theme", new { area = "PageBuilder" })" rel="stylesheet" type="text/css" />
@Scripts.Render("~/Resources/JavaScript/JQuery")
@Scripts.Render("~/Resources/JavaScript/JQueryUI")
@Scripts.Render("~/Resources/JavaScript/Plugins/FAQ")
@if (UserHelper.IsAdmin)
{
@Scripts.Render("~/Resources/JavaScript/Framework/Administration")
@Scripts.Render("~/Resources/JavaScript/Bootstrap/Plugins/Popover/Editable")
}
@if (UserHelper.IsEditor)
{
@Scripts.Render("~/Resources/JavaScript/Framework/Editor")
}
@RenderSection("HEADScripts", false)
@Html.Partial("_Analytics")
</head>
<body class="page-builder">
@Html.Partial("_NavBar")
@RenderBody()
@Scripts.Render("~/Resources/JavaScript/Bootstrap")
@Scripts.Render("~/Resources/JavaScript/Bootstrap/Plugins/Popover")
@Scripts.Render("~/Resources/JavaScript/Framework")
@RenderSection("DOMScripts", false)
</body>
</html> | <!DOCTYPE html>
<html lang="en-gb">
<head>
<title>@SettingHelper.Get("Website Name"): @ViewBag.Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
<meta name="description" content="@SettingHelper.Get("Description Meta Tag")">
@RenderSection("Styles", false)
@Styles.Render("~/Resources/CSS/Bootstrap")
@Styles.Render("~/Resources/CSS/FontAwesome")
@Styles.Render("~/Resources/CSS/Framework")
@Styles.Render("~/Resources/CSS/Plugins/Effects")
@if (UserHelper.IsAdmin)
{
@Styles.Render("~/Resources/CSS/Framework/Administration")
}
@if (UserHelper.IsEditor)
{
@Styles.Render("~/Resources/CSS/Framework/Editor")
}
<link href="@Url.Action("Render", "Theme", new { area = "PageBuilder" })" rel="stylesheet" type="text/css" />
@Scripts.Render("~/Resources/JavaScript/JQuery")
@Scripts.Render("~/Resources/JavaScript/JQueryUI")
@Scripts.Render("~/Resources/JavaScript/Plugins/FAQ")
@if (UserHelper.IsAdmin)
{
@Scripts.Render("~/Resources/JavaScript/Framework/Administration")
}
@if (UserHelper.IsEditor)
{
@Scripts.Render("~/Resources/JavaScript/Framework/Editor")
}
@RenderSection("HEADScripts", false)
@Html.Partial("_Analytics")
</head>
<body class="page-builder">
@Html.Partial("_NavBar")
@RenderBody()
@Scripts.Render("~/Resources/JavaScript/Bootstrap")
@Scripts.Render("~/Resources/JavaScript/Bootstrap/Plugins/Popover")
@Scripts.Render("~/Resources/JavaScript/Framework")
@RenderSection("DOMScripts", false)
</body>
</html> | mit | C# |
941037985fd5fa0b801d04289e32a6c8bde39d0e | update version number | hillin/ue4launcher | ProjectLauncher/Properties/AssemblyInfo.cs | ProjectLauncher/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// 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("ProjectLauncher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProjectLauncher")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.5.2.199")]
[assembly: AssemblyFileVersion("1.5.2.199")]
| using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// 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("ProjectLauncher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProjectLauncher")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.5.1.180")]
[assembly: AssemblyFileVersion("1.5.1.180")]
| apache-2.0 | C# |
f3884d0cd323358a3a89603d251577d7a1757e55 | Use RVA instead of file offset | ZixiangBoy/dnlib,ilkerhalil/dnlib,kiootic/dnlib,modulexcite/dnlib,0xd4d/dnlib,jorik041/dnlib,yck1509/dnlib,Arthur2e5/dnlib,picrap/dnlib | dot10/dotNET/DotNetFile.cs | dot10/dotNET/DotNetFile.cs | using System;
using System.Collections.Generic;
using System.IO;
using dot10.PE;
namespace dot10.dotNET {
public class DotNetFile {
public static DotNetFile Load(string filename) {
return Load(new PEImage(filename));
}
public static DotNetFile Load(byte[] data) {
return Load(new PEImage(data));
}
public static DotNetFile Load(IntPtr addr) {
return Load(new PEImage(addr));
}
public static DotNetFile Load(IPEImage peImage) {
bool verify = true;
var dotNetDir = peImage.ImageNTHeaders.OptionalHeader.DataDirectories[14];
if (dotNetDir.VirtualAddress == RVA.Zero)
throw new BadImageFormatException(".NET data directory RVA is 0");
if (dotNetDir.Size < 0x48)
throw new BadImageFormatException(".NET data directory size < 0x48");
var cor20Header = new ImageCor20Header(peImage.CreateReader(dotNetDir.VirtualAddress, 0x48), verify);
if (cor20Header.HasNativeHeader)
throw new BadImageFormatException(".NET native header isn't supported"); //TODO: Fix this
if (cor20Header.MetaData.VirtualAddress == RVA.Zero)
throw new BadImageFormatException(".NET MetaData RVA is 0");
if (cor20Header.MetaData.Size < 16)
throw new BadImageFormatException(".NET MetaData size is too small");
var mdSize = cor20Header.MetaData.Size;
var mdRva = cor20Header.MetaData.VirtualAddress;
var mdHeader = new MetaDataHeader(peImage.CreateReader(mdRva, mdSize), verify);
if (verify) {
foreach (var sh in mdHeader.StreamHeaders) {
if (sh.Offset + sh.Size < sh.Offset || sh.Offset > mdSize || sh.Offset + sh.Size > mdSize)
throw new BadImageFormatException("Invalid stream header");
}
}
var allStreams = new List<DotNetStream>(mdHeader.StreamHeaders.Count);
StringsStream stringsStream = null;
USStream usStream = null;
BlobStream blobStream = null;
GuidStream guidStream = null;
foreach (var sh in mdHeader.StreamHeaders) {
var data = peImage.CreateStream(mdRva + sh.Offset, sh.Size);
switch (sh.Name) {
case "#Strings":
allStreams.Add(stringsStream = new StringsStream(data, sh));
break;
case "#US":
allStreams.Add(usStream = new USStream(data, sh));
break;
case "#Blob":
allStreams.Add(blobStream = new BlobStream(data, sh));
break;
case "#GUID":
allStreams.Add(guidStream = new GuidStream(data, sh));
break;
case "#~":
case "#-":
case "#Schema":
default:
allStreams.Add(new DotNetStream(data, sh));
break;
}
}
throw new NotImplementedException(); //TODO:
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using dot10.PE;
namespace dot10.dotNET {
public class DotNetFile {
public static DotNetFile Load(string filename) {
return Load(new PEImage(filename));
}
public static DotNetFile Load(byte[] data) {
return Load(new PEImage(data));
}
public static DotNetFile Load(IntPtr addr) {
return Load(new PEImage(addr));
}
public static DotNetFile Load(IPEImage peImage) {
bool verify = true;
var dotNetDir = peImage.ImageNTHeaders.OptionalHeader.DataDirectories[14];
if (dotNetDir.VirtualAddress == RVA.Zero)
throw new BadImageFormatException(".NET data directory RVA is 0");
if (dotNetDir.Size < 0x48)
throw new BadImageFormatException(".NET data directory size < 0x48");
var cor20Header = new ImageCor20Header(peImage.CreateReader(dotNetDir.VirtualAddress, 0x48), verify);
if (cor20Header.HasNativeHeader)
throw new BadImageFormatException(".NET native header isn't supported"); //TODO: Fix this
if (cor20Header.MetaData.VirtualAddress == RVA.Zero)
throw new BadImageFormatException(".NET MetaData RVA is 0");
if (cor20Header.MetaData.Size < 16)
throw new BadImageFormatException(".NET MetaData size is too small");
var mdSize = cor20Header.MetaData.Size;
var mdOffs = peImage.ToFileOffset(cor20Header.MetaData.VirtualAddress);
var mdHeader = new MetaDataHeader(peImage.CreateReader(mdOffs, mdSize), verify);
if (verify) {
foreach (var sh in mdHeader.StreamHeaders) {
if (sh.Offset + sh.Size < sh.Offset || sh.Offset > mdSize || sh.Offset + sh.Size > mdSize)
throw new BadImageFormatException("Invalid stream header");
}
}
var allStreams = new List<DotNetStream>(mdHeader.StreamHeaders.Count);
StringsStream stringsStream = null;
USStream usStream = null;
BlobStream blobStream = null;
GuidStream guidStream = null;
foreach (var sh in mdHeader.StreamHeaders) {
var data = peImage.CreateStream(mdOffs + sh.Offset, sh.Size);
switch (sh.Name) {
case "#Strings":
allStreams.Add(stringsStream = new StringsStream(data, sh));
break;
case "#US":
allStreams.Add(usStream = new USStream(data, sh));
break;
case "#Blob":
allStreams.Add(blobStream = new BlobStream(data, sh));
break;
case "#GUID":
allStreams.Add(guidStream = new GuidStream(data, sh));
break;
case "#~":
case "#-":
case "#Schema":
default:
allStreams.Add(new DotNetStream(data, sh));
break;
}
}
throw new NotImplementedException(); //TODO:
}
}
}
| mit | C# |
99ec98681b3142d21b47d64ee8d26a1b5e62fd2c | Split ctor for the future. See #14. | saidmarouf/Doccou,aloisdg/Doccou,aloisdg/CountPages | Counter/Document.cs | Counter/Document.cs | using Counter.Documents;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Counter.Documents.Archives;
namespace Counter
{
/// <summary>
/// Document is the class wrapping every other class in this library.
/// If you are an user, everything you need come from here.
/// </summary>
public class Document
{
public DocumentType ExtensionType { get; private set; }
public string Extension { get; private set; }
public string FullName { get; private set; }
public string Name { get; private set; }
public string NameWithoutExtension { get; private set; }
public uint Count { get; private set; }
private readonly Dictionary<string, DocumentType> _extensionsSupported
= new Dictionary<string, DocumentType>
{
{ ".pdf", DocumentType.Pdf },
{ ".docx", DocumentType.Docx },
{ ".odt", DocumentType.Odt }
};
public Document(string fullName)
{
FullName = fullName;
Name = Path.GetFileName(Name);
NameWithoutExtension = Path.GetFileNameWithoutExtension(Name);
Extension = Path.GetExtension(fullName);
ExtensionType = IsSupported(Extension)
? _extensionsSupported[Extension]
: DocumentType.Unknow;
}
public Document(string fullName, Stream stream)
: this(fullName)
{
Count = !ExtensionType.Equals(DocumentType.Unknow)
? BuildDocument(stream).Count
: 0;
}
public bool IsSupported(string extension)
{
return _extensionsSupported.ContainsKey(extension);
}
// replace with a static dictionary ?
private IDocument BuildDocument(Stream stream)
{
switch (ExtensionType)
{
case DocumentType.Pdf: return new Pdf(stream);
case DocumentType.Docx: return new Docx(stream);
case DocumentType.Odt: return new Odt(stream);
default: throw new NotImplementedException();
}
}
}
} | using Counter.Documents;
using System;
using System.Collections.Generic;
using System.IO;
using Counter.Documents.Archives;
namespace Counter
{
/// <summary>
/// Document is the class wrapping every other class in this library.
/// If you are an user, everything you need come from here.
/// </summary>
public class Document
{
public DocumentType ExtensionType { get; private set; }
public string Extension { get; private set; }
public string FullName { get; private set; }
public string Name { get; private set; }
public string NameWithoutExtension { get; private set; }
public uint Count { get; private set; }
private readonly Dictionary<string, DocumentType> _extensionsSupported
= new Dictionary<string, DocumentType>
{
{ ".pdf", DocumentType.Pdf },
{ ".docx", DocumentType.Docx },
{ ".odt", DocumentType.Odt }
};
public Document(string fullName, Stream stream)
{
FullName = fullName;
Name = Path.GetFileName(Name);
NameWithoutExtension = Path.GetFileNameWithoutExtension(Name);
Extension = Path.GetExtension(fullName);
ExtensionType = IsSupported(Extension)
? _extensionsSupported[Extension]
: DocumentType.Unknow;
Count = !ExtensionType.Equals(DocumentType.Unknow)
? BuildDocument(stream).Count
: 0;
}
public bool IsSupported(string extension)
{
return _extensionsSupported.ContainsKey(extension);
}
// replace with a static dictionary ?
private IDocument BuildDocument(Stream stream)
{
switch (ExtensionType)
{
case DocumentType.Pdf: return new Pdf(stream);
case DocumentType.Docx: return new Docx(stream);
case DocumentType.Odt: return new Odt(stream);
default: throw new NotImplementedException();
}
}
}
} | mit | C# |
422218898d2fb6d33e1eea582a14d23eacde8ce6 | Update Program.cs | heinrichelsigan/TwitterTestLogon | Program.cs | Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace TwitterTestLogon
{
static class Program
{
/// <summary>
/// The main entry point for every windows forms C# .NET application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TweetLogin());
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace TwitterTestLogon
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TweetLogin());
}
}
}
| apache-2.0 | C# |
cc97fabe906e0ac09361f57243fbc926e02ec2fa | Add cancellation field to progress object. | dbarowy/Depends | Depends/Progress.cs | Depends/Progress.cs | using System;
using System.Threading;
namespace Depends
{
public delegate void ProgressBarIncrementer();
public class Progress
{
private bool _cancelled = false;
private long _total = 0;
private ProgressBarIncrementer _progBarIncr;
private long _workMultiplier = 1;
public static Progress NOPProgress()
{
ProgressBarIncrementer pbi = () => { return; };
return new Progress(pbi, 1L);
}
public Progress(ProgressBarIncrementer progBarIncrement, long workMultiplier)
{
_progBarIncr = progBarIncrement;
_workMultiplier = workMultiplier;
}
public long TotalWorkUnits
{
get { return _total; }
set { _total = value; }
}
public long UpdateEvery
{
get { return Math.Max(1L, _total / 100L / _workMultiplier); }
}
public void IncrementCounter()
{
_progBarIncr();
}
public void Cancel()
{
_cancelled = true;
}
public bool IsCancelled()
{
return _cancelled;
}
}
}
| using System;
using System.Threading;
namespace Depends
{
public delegate void ProgressBarIncrementer();
public class Progress
{
private long _total = 0;
private ProgressBarIncrementer _progBarIncr;
private long _workMultiplier = 1;
public static Progress NOPProgress()
{
ProgressBarIncrementer pbi = () => { return; };
return new Progress(pbi, 1L);
}
public Progress(ProgressBarIncrementer progBarIncrement, long workMultiplier)
{
_progBarIncr = progBarIncrement;
_workMultiplier = workMultiplier;
}
public long TotalWorkUnits
{
get { return _total; }
set { _total = value; }
}
public long UpdateEvery
{
get { return Math.Max(1L, _total / 100L / _workMultiplier); }
}
public void IncrementCounter()
{
_progBarIncr();
}
}
}
| bsd-2-clause | C# |
0c25812d5ff57d339b51490430594277842e83bc | Implement TextWriterCustomization#Customize | appharbor/appharbor-cli | src/AppHarbor.Tests/TextWriterCustomization.cs | src/AppHarbor.Tests/TextWriterCustomization.cs | using System;
using System.IO;
using Ploeh.AutoFixture;
namespace AppHarbor.Tests
{
public class TextWriterCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
fixture.Customize<TextWriter>(x => x.FromFactory(() => { return Console.Out; }));
}
}
}
| using System;
using Ploeh.AutoFixture
namespace AppHarbor.Tests
{
public class TextWriterCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
44b38d9de0e8c4d0725214b5ab8f554820fed0c6 | Update DataValidationRules.cs | maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET | Examples/CSharp/Articles/DataValidationRules.cs | Examples/CSharp/Articles/DataValidationRules.cs | using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Articles
{
public class DataValidationRules
{
public static void Main()
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate the workbook from sample Excel file
Workbook workbook = new Workbook(dataDir+ "sample.xlsx");
//Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Access Cell C1
//Cell C1 has the Decimal Validation applied on it.
//It can take only the values Between 10 and 20
Cell cell = worksheet.Cells["C1"];
//Enter 3 inside this cell
//Since it is not between 10 and 20, it should fail the validation
cell.PutValue(3);
//Check if number 3 satisfies the Data Validation rule applied on this cell
Console.WriteLine("Is 3 a Valid Value for this Cell: " + cell.GetValidationValue());
//Enter 15 inside this cell
//Since it is between 10 and 20, it should succeed the validation
cell.PutValue(15);
//Check if number 15 satisfies the Data Validation rule applied on this cell
Console.WriteLine("Is 15 a Valid Value for this Cell: " + cell.GetValidationValue());
//Enter 30 inside this cell
//Since it is not between 10 and 20, it should fail the validation again
cell.PutValue(30);
//Check if number 30 satisfies the Data Validation rule applied on this cell
Console.WriteLine("Is 30 a Valid Value for this Cell: " + cell.GetValidationValue());
//ExEnd:1
}
}
}
| using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Articles
{
public class DataValidationRules
{
public static void Main()
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate the workbook from sample Excel file
Workbook workbook = new Workbook(dataDir+ "sample.xlsx");
//Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Access Cell C1
//Cell C1 has the Decimal Validation applied on it.
//It can take only the values Between 10 and 20
Cell cell = worksheet.Cells["C1"];
//Enter 3 inside this cell
//Since it is not between 10 and 20, it should fail the validation
cell.PutValue(3);
//Check if number 3 satisfies the Data Validation rule applied on this cell
Console.WriteLine("Is 3 a Valid Value for this Cell: " + cell.GetValidationValue());
//Enter 15 inside this cell
//Since it is between 10 and 20, it should succeed the validation
cell.PutValue(15);
//Check if number 15 satisfies the Data Validation rule applied on this cell
Console.WriteLine("Is 15 a Valid Value for this Cell: " + cell.GetValidationValue());
//Enter 30 inside this cell
//Since it is not between 10 and 20, it should fail the validation again
cell.PutValue(30);
//Check if number 30 satisfies the Data Validation rule applied on this cell
Console.WriteLine("Is 30 a Valid Value for this Cell: " + cell.GetValidationValue());
}
}
} | mit | C# |
317ba6469502b224bce354375f2f935ff1a99d71 | remove region | alexrster/SAML2,elerch/SAML2 | src/SAML2/Config/HttpAuthCredentialsElement.cs | src/SAML2/Config/HttpAuthCredentialsElement.cs | using System.Configuration;
namespace SAML2.Config
{
/// <summary>
/// Http Basic Authentication configuration element.
/// </summary>
public class HttpAuthCredentialsElement
{
/// <summary>
/// Gets or sets the username.
/// </summary>
/// <value>The username.</value>
public string Username { get; set; }
/// <summary>
/// Gets or sets the password.
/// </summary>
/// <value>The password.</value>
public string Password { get; set; }
}
}
| using System.Configuration;
namespace SAML2.Config
{
/// <summary>
/// Http Basic Authentication configuration element.
/// </summary>
public class HttpAuthCredentialsElement
{
#region Attributes
/// <summary>
/// Gets or sets the username.
/// </summary>
/// <value>The username.</value>
public string Username { get; set; }
/// <summary>
/// Gets or sets the password.
/// </summary>
/// <value>The password.</value>
public string Password { get; set; }
}
}
| mpl-2.0 | C# |
64089bebf6dc6bb373ccf22979fd7afa011cf829 | Fix comment | Lombiq/Orchard-Training-Demo-Module,Lombiq/Orchard-Training-Demo-Module,Lombiq/Orchard-Training-Demo-Module | Activities/ManagePersonsPermissionCheckerTask.cs | Activities/ManagePersonsPermissionCheckerTask.cs | using Lombiq.TrainingDemo.Permissions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Localization;
using OrchardCore.Users.Models;
using OrchardCore.Users.Services;
using OrchardCore.Workflows.Abstractions.Models;
using OrchardCore.Workflows.Activities;
using OrchardCore.Workflows.Models;
using OrchardCore.Workflows.Services;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Lombiq.TrainingDemo.Activities;
// A simple workflow task that accepts a username as a TextField input and checks whether the user has ManagePersons Permission or not.
public class ManagePersonsPermissionCheckerTask : TaskActivity
{
private readonly IAuthorizationService _authorizationService;
private readonly IUserService _userService;
private readonly IWorkflowExpressionEvaluator _expressionEvaluator;
private readonly IStringLocalizer S;
public ManagePersonsPermissionCheckerTask(
IAuthorizationService authorizationService,
IUserService userService,
IWorkflowExpressionEvaluator expressionEvaluator,
IStringLocalizer<ManagePersonsPermissionCheckerTask> localizer)
{
_authorizationService = authorizationService;
_userService = userService;
_expressionEvaluator = expressionEvaluator;
S = localizer;
}
// The technical name of the activity. Activities on a workflow definition reference this name.
public override string Name => nameof(ManagePersonsPermissionCheckerTask);
// The displayed name of the activity, so it can use localization.
public override LocalizedString DisplayText => S["Manage Persons Permission Checker Task"];
// The category to which this activity belongs. The activity picker groups activities by this category.
public override LocalizedString Category => S["User"];
// The username to evaluate for ManagePersons permission.
public WorkflowExpression<string> UserName
{
get => GetProperty(() => new WorkflowExpression<string>());
set => SetProperty(value);
}
// Returns the possible outcomes of this activity.
public override IEnumerable<Outcome> GetPossibleOutcomes(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
{
return Outcomes(S["HasPermission"], S["NoPermission"]);
}
// This is the heart of the activity and actually performs the work to be done.
public override async Task<ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
{
var userName = await _expressionEvaluator.EvaluateAsync(UserName, workflowContext, null);
User user = (User)await _userService.GetUserAsync(userName);
if (user != null)
{
var userClaim = await _userService.CreatePrincipalAsync(user);
if (await _authorizationService.AuthorizeAsync(userClaim, PersonPermissions.ManagePersons))
{
return Outcomes("HasPermission");
}
}
return Outcomes("NoPermission");
}
}
// NEXT STATION: ViewModels/ManagePersonsPermissionCheckerTaskViewModel.cs
| using Lombiq.TrainingDemo.Permissions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using OrchardCore.Users.Models;
using OrchardCore.Users.Services;
using OrchardCore.Workflows.Abstractions.Models;
using OrchardCore.Workflows.Activities;
using OrchardCore.Workflows.Models;
using OrchardCore.Workflows.Services;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Lombiq.TrainingDemo.Activities;
// A simple workflow task that accepts a username as a TextField input and checks whether the user has ManagePersons Permission or not.
public class ManagePersonsPermissionCheckerTask : TaskActivity
{
private readonly IAuthorizationService _authorizationService;
private readonly IUserService _userService;
private readonly IWorkflowExpressionEvaluator _expressionEvaluator;
private readonly IStringLocalizer S;
public ManagePersonsPermissionCheckerTask(
IAuthorizationService authorizationService,
IUserService userService,
IWorkflowExpressionEvaluator expressionEvaluator,
IStringLocalizer<ManagePersonsPermissionCheckerTask> localizer)
{
_authorizationService = authorizationService;
_userService = userService;
_expressionEvaluator = expressionEvaluator;
S = localizer;
}
// The technical name of the activity. Activities on a workflow definition reference this name.
public override string Name => nameof(ManagePersonsPermissionCheckerTask);
// The displayed name of the activity, so it can use localization.
public override LocalizedString DisplayText => S["Manage Persons Permission Checker Task"];
// The category to which this activity belongs. The activity picker groups activities by this category.
public override LocalizedString Category => S["User"];
// A description of this activity's purpose.
public WorkflowExpression<string> UserName
{
get => GetProperty(() => new WorkflowExpression<string>());
set => SetProperty(value);
}
// Returns the possible outcomes of this activity.
public override IEnumerable<Outcome> GetPossibleOutcomes(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
{
return Outcomes(S["HasPermission"], S["NoPermission"]);
}
// This is the heart of the activity and actually performs the work to be done.
public override async Task<ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
{
var userName = await _expressionEvaluator.EvaluateAsync(UserName, workflowContext, null);
User user = (User)await _userService.GetUserAsync(userName);
if (user != null)
{
var userClaim = await _userService.CreatePrincipalAsync(user);
if (await _authorizationService.AuthorizeAsync(userClaim, PersonPermissions.ManagePersons))
{
return Outcomes("HasPermission");
}
}
return Outcomes("NoPermission");
}
}
// NEXT STATION: ViewModels/ManagePersonsPermissionCheckerTaskViewModel.cs
| bsd-3-clause | C# |
e48df9813475da052b78dbeb78f35e92836bf653 | Update Program.cs | royalsapper/GuessNum | GuessNum/Program.cs | GuessNum/Program.cs | // GuessNum Created by Kim Ju-hwan
// jaiuer@hotmail.com
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GuessNum
{
class Program
{
static void Main(string[] args)
{
Random randint = new Random();
int i = (int)Math.Round(randint.NextDouble() * 1000, 0);
Console.WriteLine("정답: {0}\n", i); // 정답
try
{
while (true)
{
Console.Write("숫자를 입력하세요?");
string inputStr = Console.ReadLine();
int inputNum = Int32.Parse(inputStr);
if (inputNum == i)
{
Console.WriteLine("정답입니다.");
break;
}
else
{
Console.WriteLine("틀렸습니다.");
}
}
}
catch (System.FormatException)
{
Console.WriteLine("정수가 아닌 입력값으로 인하여 프로그램을 종료합니다.");
// Console.WriteLine(exception.GetType());
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GuessNum
{
class Program
{
static void Main(string[] args)
{
Random randint = new Random();
int i = (int)Math.Round(randint.NextDouble() * 1000, 0);
Console.WriteLine("정답: {0}\n", i); // 정답
try
{
while (true)
{
Console.Write("숫자를 입력하세요?");
string inputStr = Console.ReadLine();
int inputNum = Int32.Parse(inputStr);
if (inputNum == i)
{
Console.WriteLine("정답입니다.");
break;
}
else
{
Console.WriteLine("틀렸습니다.");
}
}
}
catch (System.FormatException)
{
Console.WriteLine("정수가 아닌 입력값으로 인하여 프로그램을 종료합니다.");
// Console.WriteLine(exception.GetType());
}
}
}
} | mit | C# |
af64d3c316b3e847ec4ecd0256973ec9599e1049 | Fix in SensorDataContract | Azure/connectthedots,BretStateham/connectthedots,jomolinare/connectthedots,HydAu/ConnectTheDots2,noopkat/connectthedots,BretStateham/connectthedots,ZingPow/connectthedots,HydAu/ConnectTheDots2,Azure/connectthedots,jeffwilcox/connectthedots,Azure/connectthedots,zack076/connectthedots,noopkat/connectthedots,BretStateham/connectthedots,zack076/connectthedots,jmservera/connectthedots,Azure/connectthedots,MSOpenTech/connectthedots,jmservera/connectthedots,jessejjohnson/connectthedots,HydAu/AzureConnectTheDots,jeffwilcox/connectthedots,radiojam11/connectthedots,yashchandak/connectthedots,HydAu/AzureConnectTheDots,HydAu/ConnectTheDots2,jessejjohnson/connectthedots,beeva-marianmoldovan/connectthedots,BretStateham/connectthedots,jessejjohnson/connectthedots,HydAu/ConnectTheDots2,radiojam11/connectthedots,MSOpenTech/connectthedots,beeva-marianmoldovan/connectthedots,ZingPow/connectthedots,jomolinare/connectthedots,yashchandak/connectthedots,ZingPow/connectthedots,jomolinare/connectthedots,pietrobr/connectthedots,ZingPow/connectthedots,jeffwilcox/connectthedots,radiojam11/connectthedots,beeva-marianmoldovan/connectthedots,jomolinare/connectthedots,pietrobr/connectthedots,jessejjohnson/connectthedots,jmservera/connectthedots,MSOpenTech/connectthedots,HydAu/ConnectTheDots2,yashchandak/connectthedots,pietrobr/connectthedots,jeffwilcox/connectthedots,Azure/connectthedots,noopkat/connectthedots,jomolinare/connectthedots,HydAu/AzureConnectTheDots,jmservera/connectthedots,ZingPow/connectthedots,yashchandak/connectthedots,HydAu/AzureConnectTheDots,jessejjohnson/connectthedots,yashchandak/connectthedots,jomolinare/connectthedots,beeva-marianmoldovan/connectthedots,Azure/connectthedots,jmservera/connectthedots,zack076/connectthedots,MSOpenTech/connectthedots,jmservera/connectthedots,MSOpenTech/connectthedots,HydAu/AzureConnectTheDots,MSOpenTech/connectthedots,BretStateham/connectthedots,pietrobr/connectthedots,ZingPow/connectthedots,radiojam11/connectthedots,pietrobr/connectthedots,zack076/connectthedots,zack076/connectthedots,yashchandak/connectthedots,radiojam11/connectthedots,Azure/connectthedots,HydAu/ConnectTheDots2,zack076/connectthedots,noopkat/connectthedots,HydAu/AzureConnectTheDots,noopkat/connectthedots,jeffwilcox/connectthedots,BretStateham/connectthedots,noopkat/connectthedots,radiojam11/connectthedots,BretStateham/connectthedots,jeffwilcox/connectthedots,noopkat/connectthedots,jessejjohnson/connectthedots,beeva-marianmoldovan/connectthedots,pietrobr/connectthedots,beeva-marianmoldovan/connectthedots | Devices/Gateways/GatewayService/Gateway/Models/SensorDataContract.cs | Devices/Gateways/GatewayService/Gateway/Models/SensorDataContract.cs | using System.Runtime.Serialization;
namespace Gateway.Models
{
[DataContract]
public class SensorDataContract
{
[DataMember(Name = "Value")]
public double Value { get; set; }
[DataMember(Name = "GUID")]
public int Guid { get; set; }
[DataMember(Name = "Organization")]
public string Organization { get; set; }
[DataMember(Name = "DisplayName")]
public string DisplayName { get; set; }
[DataMember(Name = "UnitOfMeasure")]
public string UnitOfMeasure { get; set; }
[DataMember(Name = "MeasureName")]
public string MeasureName { get; set; }
[DataMember(Name = "Location")]
public string Location { get; set; }
}
}
| using System.Runtime.Serialization;
namespace Gateway.Models
{
[DataContract]
public class SensorDataContract
{
[DataMember(Name = "Value")]
public double Value { get; set; }
[DataMember(Name = "GUID")]
public int Guid { get; set; }
[DataMember(Name = "Organization")]
public string Organization { get; set; }
[DataMember(Name = "DisplayName")]
public string DisplayName { get; set; }
[DataMember(Name = "UnitOfMeasure")]
public string UnitOfMeasure { get; set; }
[DataMember(Name = "MeasureName’")]
public string MeasureName { get; set; }
[DataMember(Name = "Location")]
public string Location { get; set; }
}
}
| mit | C# |
cbb1176d831a620b076725c16f3be081cd03e4aa | Fix RemoteModManager implementation | asarium/FSOLauncher | Libraries/ModInstallation/Implementations/DefaultRemoteModManager.cs | Libraries/ModInstallation/Implementations/DefaultRemoteModManager.cs | #region Usings
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ModInstallation.Interfaces;
using ModInstallation.Interfaces.Mods;
using ModInstallation.Util;
#endregion
namespace ModInstallation.Implementations
{
[Export(typeof(IRemoteModManager))]
public class DefaultRemoteModManager : PropertyChangeBase, IRemoteModManager
{
private IEnumerable<IModification> _modifications;
public DefaultRemoteModManager()
{
Repositories = new List<IModRepository>();
}
#region IRemoteModManager Members
public IEnumerable<IModification> Modifications
{
get { return _modifications; }
private set
{
if (Equals(value, _modifications))
{
return;
}
_modifications = value;
OnPropertyChanged();
}
}
public IEnumerable<IModRepository> Repositories { get; set; }
public async Task RetrieveInformationAsync(IProgress<string> progressReporter, CancellationToken token)
{
progressReporter.Report("Starting information retrieval...");
foreach (var modRepository in Repositories)
{
progressReporter.Report(string.Format("Retrieving information from repository '{0}'.", modRepository.Name));
await modRepository.RetrieveRepositoryInformationAsync(progressReporter, token);
}
Modifications =
Repositories.Where(modRepository => modRepository.Modifications != null)
.SelectMany(modRepository => modRepository.Modifications)
.ToList();
}
#endregion
}
}
| #region Usings
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ModInstallation.Interfaces;
using ModInstallation.Interfaces.Mods;
using ModInstallation.Util;
#endregion
namespace ModInstallation.Implementations
{
[Export(typeof(IRemoteModManager))]
public class DefaultRemoteModManager : PropertyChangeBase, IRemoteModManager
{
private readonly List<IModRepository> _repositories = new List<IModRepository>();
private IEnumerable<IModification> _modifications;
#region IRemoteModManager Members
public IEnumerable<IModification> Modifications
{
get { return _modifications; }
private set
{
if (Equals(value, _modifications))
{
return;
}
_modifications = value;
OnPropertyChanged();
}
}
public async Task RetrieveInformationAsync(IProgress<string> progressReporter, CancellationToken token)
{
progressReporter.Report("Starting information retrieval...");
foreach (var modRepository in _repositories)
{
progressReporter.Report(string.Format("Retrieving information from repository '{0}'.", modRepository.Name));
await modRepository.RetrieveRepositoryInformationAsync(progressReporter, token);
}
Modifications =
_repositories.Where(modRepository => modRepository.Modifications != null)
.SelectMany(modRepository => modRepository.Modifications)
.ToList();
}
public void AddModRepository(IModRepository repo)
{
if (repo == null)
{
throw new ArgumentNullException("repo");
}
_repositories.Add(repo);
}
#endregion
}
}
| mit | C# |
f44b8fdb5de03426ae42abd3915ffeea804a697a | change dbContext and ModelsFactory fields in CommandsFactory to readonly | olebg/Movie-Theater-Project | MovieTheater/MovieTheater.Framework/Core/Commands/CommandsFactory.cs | MovieTheater/MovieTheater.Framework/Core/Commands/CommandsFactory.cs | using System;
using Bytes2you.Validation;
using MovieTheater.Data;
using MovieTheater.Framework.Core.Commands.Contracts;
using MovieTheater.Models.Factory.Contracts;
namespace MovieTheater.Framework.Core.Commands
{
public class CommandsFactory : ICommandsFactory
{
private readonly MovieTheaterDbContext dbContext;
private readonly IModelsFactory factory;
public CommandsFactory(MovieTheaterDbContext dbContext, IModelsFactory factory)
{
Guard.WhenArgument(dbContext, "dbContext").IsNull().Throw();
Guard.WhenArgument(factory, "Models Factory").IsNull().Throw();
this.dbContext = dbContext;
this.factory = factory;
}
public ICommand CreateCommandFromString(string commandName)
{
string command = commandName.ToLower();
switch (command)
{
case "createtheater":
return new CreateTheaterCommand(this.dbContext, this.factory);
case "createuser":
return new CreateUserCommand(this.dbContext, this.factory);
case "createjsonreader":
return new CreateJsonReaderCommand();
default:
throw new ArgumentException("The passed command is not valid!");
}
}
}
} | using System;
using Bytes2you.Validation;
using MovieTheater.Data;
using MovieTheater.Framework.Core.Commands.Contracts;
using MovieTheater.Models.Factory.Contracts;
namespace MovieTheater.Framework.Core.Commands
{
public class CommandsFactory : ICommandsFactory
{
private MovieTheaterDbContext dbContext;
private readonly IModelsFactory factory;
public CommandsFactory(MovieTheaterDbContext dbContext, IModelsFactory factory)
{
Guard.WhenArgument(dbContext, "dbContext").IsNull().Throw();
Guard.WhenArgument(factory, "Models Factory").IsNull().Throw();
this.dbContext = dbContext;
this.factory = factory;
}
public ICommand CreateCommandFromString(string commandName)
{
string command = commandName.ToLower();
switch (command)
{
case "createtheater":
return new CreateTheaterCommand(this.dbContext, this.factory);
case "createuser":
return new CreateUserCommand(this.dbContext, this.factory);
case "createjsonreader":
return new CreateJsonReaderCommand();
default:
throw new ArgumentException("The passed command is not valid!");
}
}
}
} | mit | C# |
5d820efbe3aa637d90d635a1fdf42ab5c3da6fd3 | Fix formatting of dates when the year comes first (JP) | nwoolls/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner,IWBWbiz/MultiMiner | MultiMiner.Win/Extensions/DateTimeExtensions.cs | MultiMiner.Win/Extensions/DateTimeExtensions.cs | using System;
using System.Globalization;
namespace MultiMiner.Win.Extensions
{
public static class DateTimeExtensions
{
public static string ToReallyShortDateString(this DateTime dateTime)
{
//short date no year
string shortDateString = dateTime.ToShortDateString();
//year could be at beginning (JP) or end (EN)
string dateSeparator = CultureInfo.CurrentCulture.DateTimeFormat.DateSeparator;
string value1 = dateTime.Year + dateSeparator;
string value2 = dateSeparator + dateTime.Year;
return shortDateString.Replace(value1, String.Empty).Replace(value2, String.Empty);
}
}
}
| using System;
using System.Globalization;
namespace MultiMiner.Win.Extensions
{
static class DateTimeExtensions
{
public static string ToReallyShortDateString(this DateTime dateTime)
{
//short date no year
string shortDateValue = dateTime.ToShortDateString();
int lastIndex = shortDateValue.LastIndexOf(CultureInfo.CurrentCulture.DateTimeFormat.DateSeparator);
return shortDateValue.Remove(lastIndex);
}
}
}
| mit | C# |
8028ee5125607af7a48ac4802fa3aa005f85b9f8 | Tweak select list for eval edit | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | Battery-Commander.Web/Views/Evaluations/Edit.cshtml | Battery-Commander.Web/Views/Evaluations/Edit.cshtml | @model Evaluation
@using (Html.BeginForm("Save", "Evaluations", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.Id)
@Html.HiddenFor(model => model.Status)
@Html.ValidationSummary()
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Ratee)
@Html.DropDownListFor(model => model.RateeId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --", new { @class = "select2" })
@Html.ActionLink("Add", "New", "Soldiers")
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Rater)
@Html.DropDownListFor(model => model.RaterId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Rater --", new { @class = "select2" })
@Html.ActionLink("Add", "New", "Soldiers")
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.SeniorRater)
@Html.DropDownListFor(model => model.SeniorRaterId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Senior Rater --", new { @class = "select2" })
@Html.ActionLink("Add", "New", "Soldiers")
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Reviewer)
@Html.DropDownListFor(model => model.ReviewerId, (IEnumerable<SelectListItem>)ViewBag.Reviewers, "-- Select a Reviewer --", new { @class = "select2" })
@Html.ActionLink("Add", "New", "Soldiers")
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.EvaluationId)
@Html.EditorFor(model => model.EvaluationId)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.StartDate)
@Html.EditorFor(model => model.StartDate)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.ThruDate)
@Html.EditorFor(model => model.ThruDate)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Type)
@Html.DropDownListFor(model => model.Type, Html.GetEnumSelectList<EvaluationType>())
</div>
<button type="submit">Save</button>
}
| @model Evaluation
@using (Html.BeginForm("Save", "Evaluations", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.Id)
@Html.HiddenFor(model => model.Status)
@Html.ValidationSummary()
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Ratee)
@Html.DropDownListFor(model => model.RateeId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --", new { @class = "select2" })
@Html.ActionLink("Add", "New", "Soldiers")
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Rater)
@Html.DropDownListFor(model => model.RaterId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --", new { @class = "select2" })
@Html.ActionLink("Add", "New", "Soldiers")
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.SeniorRater)
@Html.DropDownListFor(model => model.SeniorRaterId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --", new { @class = "select2" })
@Html.ActionLink("Add", "New", "Soldiers")
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Reviewer)
@Html.DropDownListFor(model => model.ReviewerId, (IEnumerable<SelectListItem>)ViewBag.Reviewers, "-- Select a Soldier --", new { @class = "select2" })
@Html.ActionLink("Add", "New", "Soldiers")
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.EvaluationId)
@Html.EditorFor(model => model.EvaluationId)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.StartDate)
@Html.EditorFor(model => model.StartDate)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.ThruDate)
@Html.EditorFor(model => model.ThruDate)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Type)
@Html.DropDownListFor(model => model.Type, Html.GetEnumSelectList<EvaluationType>())
</div>
<button type="submit">Save</button>
}
| mit | C# |
4db8728f3b94f2c3b065fad63acdab80419de89c | Fix Build | drasticactions/AwfulForumsLibrary | AwfulForumsLibrary/Entity/ForumCategoryEntity.cs | AwfulForumsLibrary/Entity/ForumCategoryEntity.cs | using System.Collections.Generic;
using Newtonsoft.Json;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
namespace AwfulForumsLibrary.Entity
{
public class ForumCategoryEntity
{
public ForumCategoryEntity()
{
ForumList = new List<ForumEntity>();
}
public string Name { get; set; }
public string Location { get; set; }
[PrimaryKey]
public int Id { get; set; }
public int Order { get; set; }
/// <summary>
/// The forums that belong to that category (Ex. GBS, FYAD)
/// </summary>
///
[OneToMany(CascadeOperations = CascadeOperation.All)]
[JsonIgnore]
public List<ForumEntity> ForumList { get; set; }
}
}
| using System.Collections.Generic;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
namespace AwfulForumsLibrary.Entity
{
public class ForumCategoryEntity
{
public ForumCategoryEntity()
{
ForumList = new List<ForumEntity>();
}
public string Name { get; set; }
public string Location { get; set; }
[PrimaryKey]
public int Id { get; set; }
public int Order { get; set; }
/// <summary>
/// The forums that belong to that category (Ex. GBS, FYAD)
/// </summary>
///
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<ForumEntity> ForumList { get; set; }
}
}
| mit | C# |
611ca9dbae063e89f34e25378ef2f75531d6ac9f | Update Bootstrap.cs | CosmosOS/Cosmos,tgiphil/Cosmos,CosmosOS/Cosmos,fanoI/Cosmos,jp2masa/Cosmos,zarlo/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,zarlo/Cosmos,fanoI/Cosmos,fanoI/Cosmos,tgiphil/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,jp2masa/Cosmos,jp2masa/Cosmos,CosmosOS/Cosmos | source/Cosmos.HAL2/Bootstrap.cs | source/Cosmos.HAL2/Bootstrap.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmos.Core;
namespace Cosmos.HAL {
// This and Core.Bootstrap are static on purpose to prevent
// memalloc. Although kernel has already used it, in the future we should call this pre kernel alloc so we
// can better control the heap init.
public static class Bootstrap {
// The goal of init is to just "barely" get the system up
// plus the console and debug stub (its self upping). Nothing more....
// In the future it might also bring up very basic devices such as serial.
public static void Init() {
Core.Bootstrap.Init();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmos.Core;
namespace Cosmos.HAL {
// This and Core.Bootstrap are static on purpose to prevent
// memalloc. Alhtough kernel has already used it, in the future we should call this pre kernel alloc so we
// can better control the heap init.
public static class Bootstrap {
// The goal of init is to just "barely" get the system up
// plus the console and debug stub (its self upping). Nothing more....
// In the future it might also bring up very basic devices such as serial.
public static void Init() {
Core.Bootstrap.Init();
}
}
}
| bsd-3-clause | C# |
340fd88a27e90307f61a6a9affb2d96c0bad9c95 | Remove test message | ucdavis/Commencement,ucdavis/Commencement,ucdavis/Commencement | Commencement.Mvc/Views/Shared/_StudentLayout.cshtml | Commencement.Mvc/Views/Shared/_StudentLayout.cshtml | @using Commencement.Core.Domain
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Commencement</title>
<script src="https://use.typekit.net/vqy0brq.js"></script>
<script>try{Typekit.load();}catch(e){}</script>
@Styles.Render("~/Content/student-css")
@Scripts.Render("~/bundles/modernizr")
@Styles.Render("~/Content/fontawesome")
@RenderSection("AdditionalStyles", required: false)
</head>
<body>
<header>
<div class="header_contents">
<div class="logo_wrapper">
<a href="/"><img src="@Url.Content("~/Images/Media/ucdavislogo.svg")" alt=""></a>
</div>
<div class="login_contents">
@RenderSection("NavButtons", required: false)
</div>
</div>
</header>
<div class="body-content">
@RenderBody()
<footer id="footer"><div class="footer_contents">
<hr />
<p>
@Html.ActionLink("Home", "Index", "Admin", null, htmlAttributes: new { style = "color:white; text-decoration:none;" })
@if (Context.User.IsInRole(Role.Codes.Admin) || Context.User.IsInRole(Role.Codes.User))
{
<span> | </span>
<a href="https://secure.caes.ucdavis.edu/help/ticket/submit?appName=Commencement" target="_blank" style="color: white; text-decoration: none;">Questions or Comments</a> <span> | </span>
<a href="https://secure.caes.ucdavis.edu/help/Help?appName=Commencement" target="_blank" style="color: white; text-decoration: none;">FAQ</a>
}
<br />
<span id="ByLine">Developed By The College Of Agricultural And Environmental Science Dean's Office</span><br />
Copyright The Regents of the University of California, Davis campus, 2005-16. All Rights Reserved.
</p>
<p id="VersionNumber">Version: @ViewData["VersionKey"]</p>
</div>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("AdditionalScripts", required: false)
</body>
</html> | @using Commencement.Core.Domain
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Commencement</title>
<script src="https://use.typekit.net/vqy0brq.js"></script>
<script>try{Typekit.load();}catch(e){}</script>
@Styles.Render("~/Content/student-css")
@Scripts.Render("~/bundles/modernizr")
@Styles.Render("~/Content/fontawesome")
@RenderSection("AdditionalStyles", required: false)
</head>
<body>
<header>
<div style="background-color:darksalmon; text-align: center; font-size: 24px">!!!!!!!!!!!!!!!!!!!!! TEST SITE !!!!!!!!!!!!!!!!!!!!!</div>
<div class="header_contents">
<div class="logo_wrapper">
<a href="/"><img src="@Url.Content("~/Images/Media/ucdavislogo.svg")" alt=""></a>
</div>
<div class="login_contents">
@RenderSection("NavButtons", required: false)
</div>
</div>
</header>
<div class="body-content">
@RenderBody()
<footer id="footer"><div class="footer_contents">
<hr />
<p>
@Html.ActionLink("Home", "Index", "Admin", null, htmlAttributes: new { style = "color:white; text-decoration:none;" })
@if (Context.User.IsInRole(Role.Codes.Admin) || Context.User.IsInRole(Role.Codes.User))
{
<span> | </span>
<a href="https://secure.caes.ucdavis.edu/help/ticket/submit?appName=Commencement" target="_blank" style="color: white; text-decoration: none;">Questions or Comments</a> <span> | </span>
<a href="https://secure.caes.ucdavis.edu/help/Help?appName=Commencement" target="_blank" style="color: white; text-decoration: none;">FAQ</a>
}
<br />
<span id="ByLine">Developed By The College Of Agricultural And Environmental Science Dean's Office</span><br />
Copyright The Regents of the University of California, Davis campus, 2005-16. All Rights Reserved.
</p>
<p id="VersionNumber">Version: @ViewData["VersionKey"]</p>
</div>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("AdditionalScripts", required: false)
</body>
</html> | mit | C# |
65ce927eb847b0fb89df13adb0de26b6d029d656 | add comment | toannvqo/dnn_publish | GitDemo/GitDemo/Program.cs | GitDemo/GitDemo/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitDemo
{
class Program
{
static void Main(string[] args)
{
//comment
Console.WriteLine("hello world world world!");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitDemo
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hello world world world!");
}
}
}
| mit | C# |
af06fd44bcc67ecb1e496d7e97aa35e44f90636e | Fix component Loader | Marusyk/SmartVillageOnline,Marusyk/SmartVillageOnline | SV.Common/DependencyResolver/ComponentLoader.cs | SV.Common/DependencyResolver/ComponentLoader.cs | using System;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.Linq;
using System.Reflection;
using System.Text;
using DependencyResolution.Implementations;
using DependencyResolution.Interfaces;
using Microsoft.Practices.Unity;
namespace DependencyResolution
{
public class ComponentLoader
{
public static void LoaderContainer(IUnityContainer container, string path, string pattern)
{
var dirCat = new DirectoryCatalog(path, pattern);
var importDef = BuildImportDefinition();
try
{
using (var aggregateCatalog = new AggregateCatalog())
{
aggregateCatalog.Catalogs.Add(dirCat);
using (var componsitionContainer = new CompositionContainer(aggregateCatalog))
{
var exports = componsitionContainer.GetExports(importDef);
var modules =
exports.Select(export => export.Value as IComponent).Where(m => m != null);
var registerComponent = new RegisterComponent(container);
foreach (var module in modules)
{
module.SetUp(registerComponent);
}
}
}
}
catch (ReflectionTypeLoadException ex)
{
var builder = new StringBuilder();
foreach (var loaderException in ex.LoaderExceptions)
{
builder.AppendFormat("{0}\n", loaderException.Message);
}
throw new TypeLoadException(builder.ToString(), ex);
}
}
private static ImportDefinition BuildImportDefinition()
{
return new ImportDefinition(def => true, typeof (IComponent).FullName, ImportCardinality.ZeroOrMore, false, false);
}
}
}
| using System;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.Linq;
using System.Reflection;
using System.Text;
using DependencyResolution.Implementations;
using DependencyResolution.Interfaces;
using Microsoft.Practices.Unity;
namespace DependencyResolution
{
public class ComponentLoader
{
public static void LoaderContainer(IUnityContainer container, string path, string pattern)
{
var dirCat = new DirectoryCatalog(path, pattern);
var importDef = BuildImportDefinition();
try
{
using (var aggregateCatalog = new AggregateCatalog())
{
aggregateCatalog.Catalogs.Add(dirCat);
using (var componsitionContainer = new CompositionContainer(aggregateCatalog))
{
var exports = componsitionContainer.GetExports(importDef);
var modules =
exports.Select(export => export.Value as IComponent).Where(m => m != null);
var registerComponent = new RegisterComponent(container);
foreach (var module in modules)
{
module.SetUp(registerComponent);
}
}
}
}
catch (ReflectionTypeLoadException ex)
{
var builder = new StringBuilder();
foreach (var loaderException in ex.LoaderExceptions)
{
builder.AppendFormat($"{loaderException.Message}\n");
}
throw new TypeLoadException(builder.ToString(), ex);
}
}
private static ImportDefinition BuildImportDefinition() =>
new ImportDefinition(def => true, typeof(IComponent).FullName, ImportCardinality.ZeroOrMore, false, false);
}
}
| mit | C# |
85076a16c3514b2af7127f923a84d9cdd72800b7 | Make IFileInfo return our types | Haacked/Rothko | src/Infrastructure/IFileInfo.cs | src/Infrastructure/IFileInfo.cs | using System.IO;
using System.Security.AccessControl;
namespace Rothko
{
public interface IFileInfo : IFileSystemInfo
{
IDirectoryInfo Directory { get; }
string DirectoryName { get; }
bool IsReadOnly { get; set; }
long Length { get; }
StreamWriter AppendText();
IFileInfo CopyTo(string destFileName);
IFileInfo CopyTo(string destFileName, bool overwrite);
FileStream Create();
StreamWriter CreateText();
void Decrypt();
void Encrypt();
FileSecurity GetAccessControl();
FileSecurity GetAccessControl(AccessControlSections includeSections);
void MoveTo(string destFileName);
FileStream Open(FileMode mode);
FileStream Open(FileMode mode, FileAccess access);
FileStream Open(FileMode mode, FileAccess access, FileShare share);
FileStream OpenRead();
StreamReader OpenText();
FileStream OpenWrite();
IFileInfo Replace(string destinationFileName, string destinationBackupFileName);
IFileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors);
void SetAccessControl(FileSecurity fileSecurity);
}
} | using System.IO;
using System.Security.AccessControl;
namespace Rothko
{
public interface IFileInfo : IFileSystemInfo
{
DirectoryInfo Directory { get; }
string DirectoryName { get; }
bool IsReadOnly { get; set; }
long Length { get; }
StreamWriter AppendText();
FileInfo CopyTo(string destFileName);
FileInfo CopyTo(string destFileName, bool overwrite);
FileStream Create();
StreamWriter CreateText();
void Decrypt();
void Encrypt();
FileSecurity GetAccessControl();
FileSecurity GetAccessControl(AccessControlSections includeSections);
void MoveTo(string destFileName);
FileStream Open(FileMode mode);
FileStream Open(FileMode mode, FileAccess access);
FileStream Open(FileMode mode, FileAccess access, FileShare share);
FileStream OpenRead();
StreamReader OpenText();
FileStream OpenWrite();
FileInfo Replace(string destinationFileName, string destinationBackupFileName);
FileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors);
void SetAccessControl(FileSecurity fileSecurity);
}
} | mit | C# |
f5140d99331eaa8c80c166d75ad430033951cf9f | test 20180425 | DigitalPlatform/chord,DigitalPlatform/chord,renyh1013/chord,renyh1013/chord,DigitalPlatform/chord,renyh1013/chord | dp2Tools/Program.cs | dp2Tools/Program.cs | // 20180514 test2
//test juan
//test juan 20180414
//test juan 20180414 16
//test juan 20180425
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace dp2Tools
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main() //test
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form_main());
}
}
}
| // 20180514 test2
//test juan
//test juan 20180414
//test juan 20180414 16
// test jane 16:27
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace dp2Tools
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main() //test
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form_main());
}
}
}
| apache-2.0 | C# |
6af601c022eaa781e284d204f35681c44e4f61d8 | Fix issue on possible null reference. | Talagozis/Talagozis.Website,Talagozis/Talagozis.Website,Talagozis/Talagozis.Website | Talagozis.Website/Controllers/BaseController.cs | Talagozis.Website/Controllers/BaseController.cs | using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Talagozis.Website.Controllers
{
public abstract class BaseController : Controller
{
public override void OnActionExecuting(ActionExecutingContext context)
{
this.ViewBag.startTime = DateTime.Now;
this.ViewBag.AssemblyVersion = System.Reflection.Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? string.Empty;
base.OnActionExecuting(context);
}
}
} | using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Talagozis.Website.Controllers
{
public abstract class BaseController : Controller
{
public override void OnActionExecuting(ActionExecutingContext context)
{
this.ViewBag.startTime = DateTime.Now;
this.ViewBag.AssemblyVersion = System.Reflection.Assembly.GetEntryAssembly()?.GetName().Version.ToString() ?? string.Empty;
base.OnActionExecuting(context);
}
}
} | mit | C# |
65082785c8e8ab6211766150616fae327d4adfc4 | Update the background setting algorithm (#128) | ForNeVeR/wpf-math | src/WpfMath/Atoms/StyledAtom.cs | src/WpfMath/Atoms/StyledAtom.cs | using System.Windows.Media;
using WpfMath.Boxes;
namespace WpfMath.Atoms
{
// Atom specifying graphical style.
internal class StyledAtom : Atom, IRow
{
public StyledAtom(SourceSpan source, Atom atom, Brush backgroundColor, Brush foregroundColor)
: base(source)
{
this.RowAtom = new RowAtom(source, atom);
this.Background = backgroundColor;
this.Foreground = foregroundColor;
}
// RowAtom to which colors are applied.
public RowAtom RowAtom { get; }
public Brush Background { get; }
public Brush Foreground { get; }
public Atom WithPreviousAtom(DummyAtom previousAtom)
{
var rowAtom = this.RowAtom.WithPreviousAtom(previousAtom);
return new StyledAtom(this.Source, rowAtom, this.Background, this.Foreground);
}
protected override Box CreateBoxCore(TexEnvironment environment)
{
var newEnvironment = environment.Clone();
if (this.Foreground != null)
newEnvironment.Foreground = this.Foreground;
var childBox = this.RowAtom.CreateBox(newEnvironment);
if (Background != null)
childBox.Background = Background;
return childBox;
}
public override TexAtomType GetLeftType()
{
return this.RowAtom.GetLeftType();
}
public override TexAtomType GetRightType()
{
return this.RowAtom.GetRightType();
}
public StyledAtom Clone(
RowAtom rowAtom = null,
Brush background = null,
Brush foreground = null)
{
return new StyledAtom(
this.Source,
rowAtom ?? this.RowAtom,
background ?? this.Background,
foreground ?? this.Foreground);
}
}
}
| using System.Windows.Media;
using WpfMath.Boxes;
namespace WpfMath.Atoms
{
// Atom specifying graphical style.
internal class StyledAtom : Atom, IRow
{
public StyledAtom(SourceSpan source, Atom atom, Brush backgroundColor, Brush foregroundColor)
: base(source)
{
this.RowAtom = new RowAtom(source, atom);
this.Background = backgroundColor;
this.Foreground = foregroundColor;
}
// RowAtom to which colors are applied.
public RowAtom RowAtom { get; }
public Brush Background { get; }
public Brush Foreground { get; }
public Atom WithPreviousAtom(DummyAtom previousAtom)
{
var rowAtom = this.RowAtom.WithPreviousAtom(previousAtom);
return new StyledAtom(this.Source, rowAtom, this.Background, this.Foreground);
}
protected override Box CreateBoxCore(TexEnvironment environment)
{
var newEnvironment = environment.Clone();
if (this.Background != null)
newEnvironment.Background = this.Background;
if (this.Foreground != null)
newEnvironment.Foreground = this.Foreground;
return this.RowAtom.CreateBox(newEnvironment);
}
public override TexAtomType GetLeftType()
{
return this.RowAtom.GetLeftType();
}
public override TexAtomType GetRightType()
{
return this.RowAtom.GetRightType();
}
public StyledAtom Clone(
RowAtom rowAtom = null,
Brush background = null,
Brush foreground = null)
{
return new StyledAtom(
this.Source,
rowAtom ?? this.RowAtom,
background ?? this.Background,
foreground ?? this.Foreground);
}
}
}
| mit | C# |
9ad519dc8f5227aa4bcc904a04db9b874fbb2379 | Modify sample code | SIROK/growthbeat-unity,SIROK/growthbeat-unity,growthbeat/growthbeat-unity,growthbeat/growthbeat-unity | sample/Assets/GrowthbeatComponent.cs | sample/Assets/GrowthbeatComponent.cs | //
// GrowthbeatComponent.cs
// Growthbeat-unity
//
// Created by Baekwoo Chung on 2015/06/15.
// Copyright (c) 2015年 SIROK, Inc. All rights reserved.
//
using UnityEngine;
using System.Collections;
#if UNITY_IPHONE
using NotificationServices = UnityEngine.iOS.NotificationServices;
#endif
public class GrowthbeatComponent : MonoBehaviour
{
bool tokenSent = false;
void Awake ()
{
Growthbeat.GetInstance ().Initialize ("OrXmgFYkGQkqDBtT", "saWAVZs5f531VXk3ZVgJZwK1vQUzPg23", true);
GrowthPush.GetInstance ().RequestDeviceToken ();
GrowthPush.GetInstance ().RequestRegistrationId ("955057365401");
Growthbeat.GetInstance ().Start ();
GrowthAnalytics.GetInstance ().SetBasicTags ();
GrowthPush.GetInstance ().ClearBadge ();
}
void Start ()
{
}
void Update ()
{
#if UNITY_IPHONE
if (!tokenSent) {
byte[] token = NotificationServices.deviceToken;
if (token != null) {
GrowthPush.GetInstance ().SetDeviceToken(System.BitConverter.ToString(token));
tokenSent = true;
}
}
#endif
}
void OnDisable ()
{
Growthbeat.GetInstance ().Stop ();
}
}
| //
// GrowthbeatComponent.cs
// Growthbeat-unity
//
// Created by Baekwoo Chung on 2015/06/15.
// Copyright (c) 2015年 SIROK, Inc. All rights reserved.
//
using UnityEngine;
using System.Collections;
#if UNITY_IPHONE
using NotificationServices = UnityEngine.iOS.NotificationServices;
#endif
public class GrowthbeatComponent : MonoBehaviour
{
bool tokenSent = false;
void Awake ()
{
Growthbeat.GetInstance ().Initialize ("OrXmgFYkGQkqDBtT", "saWAVZs5f531VXk3ZVgJZwK1vQUzPg23", true);
GrowthPush.GetInstance ().RequestDeviceToken ();
GrowthPush.GetInstance ().RequestRegistrationId ("955057365401");
}
void Start ()
{
//GrowthBeat
Growthbeat.GetInstance ().Start ();
Growthbeat.GetInstance ().Stop ();
//GrowthAnalytics
GrowthAnalytics.GetInstance ().Open ();
GrowthAnalytics.GetInstance ().SetBasicTags ();
GrowthAnalytics.GetInstance ().Tag ("TagTest");
GrowthAnalytics.GetInstance ().Tag ("TagTest_Number", "1234");
GrowthAnalytics.GetInstance ().Track ("TrackEvent");
GrowthAnalytics.GetInstance ().Purchase (1234, "Category", "product");
GrowthAnalytics.GetInstance (). SetUserId ("UserId");
GrowthAnalytics.GetInstance ().SetName ("Name");
GrowthAnalytics.GetInstance ().SetAge (1234);
GrowthAnalytics.GetInstance ().SetGender (GrowthAnalytics.Gender.GenderFemale);
GrowthAnalytics.GetInstance ().SetLevel (1234);
GrowthAnalytics.GetInstance ().SetDevelopment (true);
GrowthAnalytics.GetInstance ().Close ();
//GrowthPush
GrowthPush.GetInstance ().ClearBadge ();
GrowthPush.GetInstance ().SetTag ("TagTest");
GrowthPush.GetInstance ().SetTag ("userId", "123");
GrowthPush.GetInstance ().TrackEvent ("Launch");
GrowthPush.GetInstance ().TrackEvent ("Purchace", "100");
GrowthPush.GetInstance ().SetDeviceTags ();
}
void Update ()
{
#if UNITY_IPHONE
if (!tokenSent) {
byte[] token = NotificationServices.deviceToken;
if (token != null) {
GrowthPush.GetInstance ().SetDeviceToken(System.BitConverter.ToString(token));
tokenSent = true;
}
}
#endif
}
}
| apache-2.0 | C# |
0bcde52d102051ab6f74549d2377fe390acdcb74 | Fix test page | svedm/SegmentedControl | Segments/TestPage.xaml.cs | Segments/TestPage.xaml.cs | using Xamarin.Forms;
namespace Segments
{
public partial class TestPage : ContentPage
{
public TestPage()
{
InitializeComponent();
segmentControl.AddSegment(new Label { Text="Green" }, new Label { Text="test", FontSize=10 });
segmentControl.AddSegment(new Label { Text="Yellow" });
segmentControl.AddSegment(new Label { Text="Yellow" });
}
private void OnSelectedSegmentChanged(object sender, int segmentIndex)
{
switch (segmentIndex)
{
case 0:
segmentControl.TintColor = Color.Green;
break;
case 1:
segmentControl.TintColor = Color.Yellow;
break;
case 2:
segmentControl.TintColor = Color.Red;
break;
}
}
}
}
| using Xamarin.Forms;
namespace Segments
{
public partial class TestPage : ContentPage
{
public TestPage()
{
InitializeComponent();
segmentControl.AddSegment("Green");
segmentControl.AddSegment("Yellow");
segmentControl.AddSegment("Red");
}
private void OnSelectedSegmentChanged(object sender, int segmentIndex)
{
switch (segmentIndex)
{
case 0:
segmentControl.TintColor = Color.Green;
break;
case 1:
segmentControl.TintColor = Color.Yellow;
break;
case 2:
segmentControl.TintColor = Color.Red;
break;
}
}
}
}
| mit | C# |
253f971a6a04dcdaa388359cf31c84e5948b109d | Update build.cake | predictive-technology-laboratory/Xamarin.Plugins,jamesmontemagno/Xamarin.Plugins | Permissions/build.cake | Permissions/build.cake | #addin "Cake.FileHelpers"
var TARGET = Argument ("target", Argument ("t", "NuGetPack"));
var version = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");
Task ("Build").Does (() =>
{
const string sln = "./Permissions.sln";
const string cfg = "Release";
NuGetRestore (sln);
if (!IsRunningOnWindows ())
DotNetBuild (sln, c => c.Configuration = cfg);
else
MSBuild (sln, c => {
c.Configuration = cfg;
c.MSBuildPlatform = MSBuildPlatform.x86;
});
});
Task ("NuGetPack")
.IsDependentOn ("Build")
.Does (() =>
{
NuGetPack ("./Permissions.Plugin.nuspec", new NuGetPackSettings {
Version = version,
Verbosity = NuGetVerbosity.Detailed,
OutputDirectory = "./",
BasePath = "./",
});
});
RunTarget (TARGET);
| #addin "Cake.FileHelpers"
var TARGET = Argument ("target", Argument ("t", "Build"));
var version = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");
Task ("Build").Does (() =>
{
const string sln = "./Permissions.sln";
const string cfg = "Release";
NuGetRestore (sln);
if (!IsRunningOnWindows ())
DotNetBuild (sln, c => c.Configuration = cfg);
else
MSBuild (sln, c => {
c.Configuration = cfg;
c.MSBuildPlatform = MSBuildPlatform.x86;
});
});
Task ("NuGetPack")
.IsDependentOn ("Build")
.Does (() =>
{
NuGetPack ("./Permissions.Plugin.nuspec", new NuGetPackSettings {
Version = version,
Verbosity = NuGetVerbosity.Detailed,
OutputDirectory = "./",
BasePath = "./",
});
});
RunTarget (TARGET); | mit | C# |
b789f6ff99cf06c4a24576df580ece6db20ba3ae | modify Notifer() | gKevinK/LearnTHU-UWP | Learn.THU/Model/Notifer.cs | Learn.THU/Model/Notifer.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
namespace LearnTHU.Model
{
static class Notifer
{
public static void Notify(NotifyEventArgs args)
{
if (args.NoticeNum + args.FileNum + args.WorkNum == 0) return;
List<string> contents = new List<string>();
if (args.NoticeNum > 0)
contents.Add($"{args.NoticeNum} 个新公告");
if (args.FileNum > 0)
contents.Add($"{args.FileNum} 个新文件");
if (args.WorkNum > 0)
contents.Add($"{args.WorkNum} 个新作业");
string content = string.Join(",", contents);
string toastXml = $@"<toast scenario='reminder'>
<visual>
<binding template='ToastGeneric'>
<text>网络学堂 - 新消息</text>
<text>{args.CourseName} 发布了 {content}.</text>
</binding>
</visual>
</toast>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(toastXml);
ToastNotification toast = new ToastNotification(doc);
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
}
class NotifyEventArgs : EventArgs
{
public string CourseName { get; set; }
public int NoticeNum { get; set; }
public int FileNum { get; set; }
public int WorkNum { get; set; }
public NotifyEventArgs(string courseName, int noticeNum, int fileNum, int workNum)
{
CourseName = courseName;
NoticeNum = noticeNum;
FileNum = fileNum;
WorkNum = workNum;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
namespace LearnTHU.Model
{
static class Notifer
{
public static void Notify(string courseName, NotifyEventArgs args)
{
if (args.NoticeNum + args.FileNum + args.WorkNum == 0) return;
List<string> contents = new List<string>();
if (args.NoticeNum > 0)
contents.Add($"{args.NoticeNum} 个新公告");
if (args.FileNum > 0)
contents.Add($"{args.FileNum} 个新文件");
if (args.WorkNum > 0)
contents.Add($"{args.WorkNum} 个新作业");
string content = string.Join(",", contents);
string toastXml = $@"<toast scenario='reminder'>
<visual>
<binding template='ToastGeneric'>
<text>网络学堂 - 新消息</text>
<text>{courseName} 发布了 {content}.</text>
</binding>
</visual>
</toast>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(toastXml);
ToastNotification toast = new ToastNotification(doc);
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
}
class NotifyEventArgs : EventArgs
{
public string CourseName { get; set; }
public int NoticeNum { get; set; }
public int FileNum { get; set; }
public int WorkNum { get; set; }
public NotifyEventArgs(string courseName, int noticeNum, int fileNum, int workNum)
{
CourseName = courseName;
NoticeNum = noticeNum;
FileNum = fileNum;
WorkNum = workNum;
}
}
}
| mit | C# |
a79c651fc72bcbc9583c28c35caab8fe58458792 | Simplify AbstractGrammarSpec by replacing deprecated helper methods with a sample Lexer implementation | plioi/rook | Parsley.Test/CharLexer.cs | Parsley.Test/CharLexer.cs | namespace Parsley
{
public sealed class CharLexer : Lexer
{
public CharLexer(string source)
: base(new Text(source), new TokenMatcher(typeof(char), @".")) { }
}
} | namespace Parsley
{
public sealed class CharLexer : Lexer
{
public CharLexer(string source)
: this(new Text(source)) { }
public CharLexer(Text text)
: base(text, new TokenMatcher(typeof(char), @".")) { }
}
} | mit | C# |
a92e1ad72409fc031fd97bbda7dee30f18ac857f | Delete unused function, use TryGetValue | rytz/MatterControl,unlimitedbacon/MatterControl,tellingmachine/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl,jlewin/MatterControl,jlewin/MatterControl,mmoening/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,mmoening/MatterControl,rytz/MatterControl,tellingmachine/MatterControl,unlimitedbacon/MatterControl,rytz/MatterControl | Utilities/WebUtilities/JsonResponseDictionary.cs | Utilities/WebUtilities/JsonResponseDictionary.cs | /*
Copyright (c) 2014, Lars Brubaker
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
namespace MatterHackers.MatterControl
{
public class JsonResponseDictionary : Dictionary<string, string>
{
public string get(string key)
{
string result;
this.TryGetValue(key, out result);
return result;
}
}
} | /*
Copyright (c) 2014, Lars Brubaker
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
namespace MatterHackers.MatterControl
{
public class JsonResponseDictionary : Dictionary<string, string>
{
public string get(string key)
{
string result;
if (this.ContainsKey(key))
{
result = this[key];
}
else
{
result = null;
}
return result;
}
public bool GetInt(string key, out int result)
{
if (this.get(key) != null)
{
bool isInt = Int32.TryParse(this.get(key), out result);
if (isInt)
{
return true;
}
else
{
return false;
}
}
else
{
result = 0;
return false;
}
}
}
} | bsd-2-clause | C# |
d3d1fc808e86da2fe712dacb450cdec904634ef6 | Update assembly description | chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using TweetDick;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TweetDeck client for Windows")]
[assembly: AssemblyDescription("TweetDeck client for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct(Program.BrandName)]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7f09373d-8beb-416f-a48d-45d8aaeb8caf")]
// 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")]
[assembly: NeutralResourcesLanguageAttribute("en")] | using System.Reflection;
using System.Runtime.InteropServices;
using TweetDick;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(Program.BrandName)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct(Program.BrandName)]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7f09373d-8beb-416f-a48d-45d8aaeb8caf")]
// 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")]
[assembly: NeutralResourcesLanguageAttribute("en")] | mit | C# |
016f2ce05ccdd7dc1a51cb029beb7ce32b9d6317 | Update Assembly Info details | mathomps/HandbrakeBatchEncoder | Properties/AssemblyInfo.cs | 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("Handbrake Batch Encoder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Handbrake Batch Encoder")]
[assembly: AssemblyCopyright("Copyright © 2009-2014 Mark Thompson")]
[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("9b47d66d-7dab-488c-bc15-54873bb1c386")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyFileVersion("1.2.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Handbrake Batch Encoder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Handbrake Batch Encoder")]
[assembly: AssemblyCopyright("Copyright © 2009-2011 Mark Thompson")]
[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("9b47d66d-7dab-488c-bc15-54873bb1c386")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyFileVersion("1.2.0.0")]
| mit | C# |
67dc7dfc363756cf4435750c507c567c57818b13 | rename refactor | Weingartner/XUnitRemote | XUnitRemote.Test/Tests.cs | XUnitRemote.Test/Tests.cs | using System.Diagnostics;
using Xunit;
using Xunit.Abstractions;
namespace XUnitRemote.Test
{
public class Tests
{
private readonly ITestOutputHelper _Output;
public Tests(ITestOutputHelper output)
{
_Output = output;
}
[SampleProcessFact]
public void OutOfProcess()
{
_Output.WriteLine("Process name: " + Process.GetCurrentProcess().ProcessName);
Assert.Equal(5, 3);
}
[Fact]
public void InProcess()
{
_Output.WriteLine("Process name: " + Process.GetCurrentProcess().ProcessName);
Assert.Equal(5, 3);
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
using XUnitRemote.Test;
namespace OutOfProcessXunitTest
{
public class Tests
{
private readonly ITestOutputHelper _Output;
public Tests(ITestOutputHelper output)
{
_Output = output;
}
[SampleProcessFact]
public void OutOfProcess()
{
_Output.WriteLine("Process name: " + Process.GetCurrentProcess().ProcessName);
Assert.Equal(5, 3);
}
[Fact]
public void InProcess()
{
_Output.WriteLine("Process name: " + Process.GetCurrentProcess().ProcessName);
Assert.Equal(5, 3);
}
}
}
| mit | C# |
57209dacac5110ac41b929d097e4ccce9778da1d | Update BradleyWyatt.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/BradleyWyatt.cs | src/Firehose.Web/Authors/BradleyWyatt.cs |
public class BradleyWyatt : IAmACommunityMember
{
public string FirstName => "Bradley";
public string LastName => "Wyatt";
public string ShortBioOrTagLine => "Finding ways to do the most work with the least effort possible";
public string StateOrRegion => "Chicago, Illinois";
public string EmailAddress => "brad@thelazyadministrator.com";
public string GravatarHash => "c4eaa00e143c7abb1362dc9a8a48da09";
public string TwitterHandle => "bwya77";
public string GitHubHandle => "bwya77";
public Uri WebSite => new Uri("https://www.thelazyadministrator.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.thelazyadministrator.com/feed/"); } }
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class BradleyWyatt : IAmACommunityMember
{
public string FirstName => "Bradley";
public string LastName => "Wyatt";
public string ShortBioOrTagLine => "Finding wayt to do the most work with the least effort possible";
public string StateOrRegion => "Chicago, Illinois";
public string EmailAddress => "brad@thelazyadministrator.com";
public string GravatarHash => "c4eaa00e143c7abb1362dc9a8a48da09";
public string TwitterHandle => "bwya77";
public string GitHubHandle => "bwya77";
public Uri WebSite => new Uri("https://www.thelazyadministrator.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.thelazyadministrator.com/feed/"); } }
}
}
| mit | C# |
e74665e55058c79becda81baa4055d1c78d5ae2b | Revert "Reacting to CLI breaking change" | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.DotNet.Watcher.Core/Internal/Implementation/Project.cs | src/Microsoft.DotNet.Watcher.Core/Internal/Implementation/Project.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.DotNet.ProjectModel.Graph;
namespace Microsoft.DotNet.Watcher.Core.Internal
{
internal class Project : IProject
{
public Project(ProjectModel.Project runtimeProject)
{
ProjectFile = runtimeProject.ProjectFilePath;
ProjectDirectory = runtimeProject.ProjectDirectory;
Files = runtimeProject.Files.SourceFiles.Concat(
runtimeProject.Files.ResourceFiles.Values.Concat(
runtimeProject.Files.PreprocessSourceFiles.Concat(
runtimeProject.Files.SharedFiles))).Concat(
new string[] { runtimeProject.ProjectFilePath })
.ToList();
var projectLockJsonPath = Path.Combine(runtimeProject.ProjectDirectory, "project.lock.json");
if (File.Exists(projectLockJsonPath))
{
var lockFile = LockFileReader.Read(projectLockJsonPath);
ProjectDependencies = lockFile.ProjectLibraries.Select(dep => GetProjectRelativeFullPath(dep.Path)).ToList();
}
else
{
ProjectDependencies = new string[0];
}
}
public IEnumerable<string> ProjectDependencies { get; private set; }
public IEnumerable<string> Files { get; private set; }
public string ProjectFile { get; private set; }
public string ProjectDirectory { get; private set; }
private string GetProjectRelativeFullPath(string path)
{
return Path.GetFullPath(Path.Combine(ProjectDirectory, path));
}
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.DotNet.ProjectModel.Graph;
namespace Microsoft.DotNet.Watcher.Core.Internal
{
internal class Project : IProject
{
public Project(ProjectModel.Project runtimeProject)
{
ProjectFile = runtimeProject.ProjectFilePath;
ProjectDirectory = runtimeProject.ProjectDirectory;
Files = runtimeProject.Files.SourceFiles.Concat(
runtimeProject.Files.ResourceFiles.Values.Concat(
runtimeProject.Files.PreprocessSourceFiles.Concat(
runtimeProject.Files.SharedFiles))).Concat(
new string[] { runtimeProject.ProjectFilePath })
.ToList();
var projectLockJsonPath = Path.Combine(runtimeProject.ProjectDirectory, "project.lock.json");
if (File.Exists(projectLockJsonPath))
{
var lockFile = LockFileReader.Read(projectLockJsonPath, designTime: false);
ProjectDependencies = lockFile.ProjectLibraries.Select(dep => GetProjectRelativeFullPath(dep.Path)).ToList();
}
else
{
ProjectDependencies = new string[0];
}
}
public IEnumerable<string> ProjectDependencies { get; private set; }
public IEnumerable<string> Files { get; private set; }
public string ProjectFile { get; private set; }
public string ProjectDirectory { get; private set; }
private string GetProjectRelativeFullPath(string path)
{
return Path.GetFullPath(Path.Combine(ProjectDirectory, path));
}
}
}
| apache-2.0 | C# |
362369a4ee75e4c52039c20e9d20eefba446cafd | add XML document to EnumerateTestCommands. | jwChung/Experimentalism,jwChung/Experimentalism | src/Experimental/TheoremAttribute.cs | src/Experimental/TheoremAttribute.cs | using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;
using Xunit.Sdk;
namespace Jwc.Experimental
{
/// <summary>
/// 테스트 메소드를 지칭하는 어트리뷰트로써, test runner에 의해 실행된다.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public sealed class TheoremAttribute : FactAttribute
{
/// <summary>
/// Enumerates the test commands represented by this test method.
/// Derived classes should override this method to return instances of
/// <see cref="ITestCommand" />, one per execution of a test method.
/// </summary>
/// <param name="method">The test method</param>
/// <returns>
/// The test commands which will execute the test runs for the given method
/// </returns>
protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
{
return !method.MethodInfo.IsDefined(typeof(DataAttribute), false)
? base.EnumerateTestCommands(method)
: new TheoryAttribute().CreateTestCommands(method);
}
}
} | using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;
using Xunit.Sdk;
namespace Jwc.Experimental
{
/// <summary>
/// 테스트 메소드를 지칭하는 어트리뷰트로써, test runner에 의해 실행된다.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public sealed class TheoremAttribute : FactAttribute
{
protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
{
return !method.MethodInfo.IsDefined(typeof(DataAttribute), false)
? base.EnumerateTestCommands(method)
: new TheoryAttribute().CreateTestCommands(method);
}
}
} | mit | C# |
fbb2fc58f507cf23e140230bd467f664374e68a6 | set default value for Value as Double in NumericControl | jpbruyere/Crow,jpbruyere/Crow | src/GraphicObjects/NumericControl.cs | src/GraphicObjects/NumericControl.cs | using System;
using System.Xml.Serialization;
using System.ComponentModel;
namespace Crow
{
public abstract class NumericControl : TemplatedControl
{
#region CTOR
public NumericControl () : base()
{
}
public NumericControl(double minimum, double maximum, double step)
: base()
{
}
#endregion
#region private fields
double _actualValue, minValue, maxValue, smallStep, bigStep;
#endregion
#region public properties
[XmlAttributeAttribute()][DefaultValue(0.0)]
public virtual double Minimum {
get { return minValue; }
set {
if (minValue == value)
return;
minValue = value;
NotifyValueChanged ("Minimum", minValue);
registerForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue(100.0)]
public virtual double Maximum
{
get { return maxValue; }
set {
if (maxValue == value)
return;
maxValue = value;
NotifyValueChanged ("Maximum", maxValue);
registerForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue(1.0)]
public virtual double SmallIncrement
{
get { return smallStep; }
set {
if (smallStep == value)
return;
smallStep = value;
NotifyValueChanged ("SmallIncrement", smallStep);
registerForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue(5.0)]
public virtual double LargeIncrement
{
get { return bigStep; }
set {
if (bigStep == value)
return;
bigStep = value;
NotifyValueChanged ("LargeIncrement", bigStep);
registerForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue(0.0)]
public double Value
{
get { return _actualValue; }
set
{
if (value == _actualValue)
return;
if (value < minValue)
_actualValue = minValue;
else if (value > maxValue)
_actualValue = maxValue;
else
_actualValue = value;
NotifyValueChanged("Value", _actualValue);
registerForGraphicUpdate();
}
}
#endregion
}
}
| using System;
using System.Xml.Serialization;
using System.ComponentModel;
namespace Crow
{
public abstract class NumericControl : TemplatedControl
{
#region CTOR
public NumericControl () : base()
{
}
public NumericControl(double minimum, double maximum, double step)
: base()
{
}
#endregion
#region private fields
double _actualValue, minValue, maxValue, smallStep, bigStep;
#endregion
#region public properties
[XmlAttributeAttribute()][DefaultValue(0.0)]
public virtual double Minimum {
get { return minValue; }
set {
if (minValue == value)
return;
minValue = value;
NotifyValueChanged ("Minimum", minValue);
registerForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue(100.0)]
public virtual double Maximum
{
get { return maxValue; }
set {
if (maxValue == value)
return;
maxValue = value;
NotifyValueChanged ("Maximum", maxValue);
registerForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue(1.0)]
public virtual double SmallIncrement
{
get { return smallStep; }
set {
if (smallStep == value)
return;
smallStep = value;
NotifyValueChanged ("SmallIncrement", smallStep);
registerForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue(5.0)]
public virtual double LargeIncrement
{
get { return bigStep; }
set {
if (bigStep == value)
return;
bigStep = value;
NotifyValueChanged ("LargeIncrement", bigStep);
registerForGraphicUpdate ();
}
}
[XmlAttributeAttribute()][DefaultValue(0)]
public double Value
{
get { return _actualValue; }
set
{
if (value == _actualValue)
return;
if (value < minValue)
_actualValue = minValue;
else if (value > maxValue)
_actualValue = maxValue;
else
_actualValue = value;
NotifyValueChanged("Value", _actualValue);
registerForGraphicUpdate();
}
}
#endregion
}
}
| mit | C# |
18ce8cb99cb43e5fee46d6a557eb81e326560b69 | Use new crypto utility to compare byte arrays | sbennett1990/signify.cs | SignifyCS/Verify.cs | SignifyCS/Verify.cs | /*
* Copyright (c) 2017 Scott Bennett <scottb@fastmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
using System;
using Sodium;
namespace SignifyCS {
public class Verify {
public static bool VerifyMessage(PubKey pub_key, Signature sig, byte[] message) {
CheckAlgorithms(pub_key, sig);
CheckKeys(pub_key, sig);
return VerifyCrypto(sig, message, pub_key);
}
public static void CheckAlgorithms(PubKey pub_key, Signature sig) {
if (!pub_key.Algorithm.Equals(BaseCryptoFile.PK_ALGORITHM)) {
throw new Exception($"unsupported public key; unexpected algorithm '{pub_key.Algorithm}'");
}
if (!sig.Algorithm.Equals(BaseCryptoFile.PK_ALGORITHM)) {
throw new Exception($"unsupported signature; unexpected algorithm '{sig.Algorithm}'");
}
}
public static void CheckKeys(PubKey pub_key, Signature sig) {
if (!CryptoBytes.ConstantTimeEquals(pub_key.KeyNum, sig.KeyNum)) {
throw new Exception("verification failed: checked against wrong key");
}
}
public static bool VerifyCrypto(Signature sig, byte[] message, PubKey pub_key) {
return PublicKeyAuth.VerifyDetached(sig.SigData, message, pub_key.PubKeyData);
}
}
}
| /*
* Copyright (c) 2017 Scott Bennett <scottb@fastmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
using System;
using System.Collections;
using Sodium;
namespace SignifyCS {
public class Verify {
public static bool VerifyMessage(PubKey pub_key, Signature sig, byte[] message) {
CheckAlgorithms(pub_key, sig);
CheckKeys(pub_key, sig);
return VerifyCrypto(sig, message, pub_key);
}
public static void CheckAlgorithms(PubKey pub_key, Signature sig) {
if (!pub_key.Algorithm.Equals(BaseCryptoFile.PK_ALGORITHM)) {
throw new Exception($"unsupported public key; unexpected algorithm '{pub_key.Algorithm}'");
}
if (!sig.Algorithm.Equals(BaseCryptoFile.PK_ALGORITHM)) {
throw new Exception($"unsupported signature; unexpected algorithm '{sig.Algorithm}'");
}
}
public static void CheckKeys(PubKey pub_key, Signature sig) {
IStructuralEquatable sig_key_num = sig.KeyNum;
if (!sig_key_num.Equals(pub_key.KeyNum, StructuralComparisons.StructuralEqualityComparer)) {
throw new Exception("verification failed: checked against wrong key");
}
}
public static bool VerifyCrypto(Signature sig, byte[] message, PubKey pub_key) {
return PublicKeyAuth.VerifyDetached(sig.SigData, message, pub_key.PubKeyData);
}
}
}
| isc | C# |
71a42feb7718cc0264ca0a1b5ad70eb0cc9a5c40 | Resolve TODO | martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site | src/LondonTravel.Site/AlexaModule.cs | src/LondonTravel.Site/AlexaModule.cs | // Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
using System.Security.Claims;
using MartinCostello.LondonTravel.Site.Services;
using Microsoft.AspNetCore.Mvc;
namespace MartinCostello.LondonTravel.Site;
public static class AlexaModule
{
public static IEndpointRouteBuilder MapAlexa(this IEndpointRouteBuilder app)
{
app.MapGet("/alexa/authorize", async (
[FromQuery(Name = "state")] string? state,
[FromQuery(Name = "client_id")] string? clientId,
[FromQuery(Name = "response_type")] string? responseType,
[FromQuery(Name = "redirect_uri")] Uri? redirectUri,
ClaimsPrincipal user,
AlexaService service) =>
{
return await service.AuthorizeSkillAsync(
state,
clientId,
responseType,
redirectUri,
user);
})
.ExcludeFromDescription()
.RequireAuthorization();
return app;
}
}
| // Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
using System.Security.Claims;
using MartinCostello.LondonTravel.Site.Services;
using Microsoft.AspNetCore.Mvc;
namespace MartinCostello.LondonTravel.Site;
public static class AlexaModule
{
public static IEndpointRouteBuilder MapAlexa(this IEndpointRouteBuilder app)
{
app.MapGet("/alexa/authorize", async (
[FromQuery(Name = "state")] string? state,
[FromQuery(Name = "client_id")] string? clientId,
[FromQuery(Name = "response_type")] string? responseType,
[FromQuery(Name = "redirect_uri")] BindableUri? redirectUri,
ClaimsPrincipal user,
AlexaService service) =>
{
return await service.AuthorizeSkillAsync(
state,
clientId,
responseType,
redirectUri,
user);
})
.ExcludeFromDescription()
.RequireAuthorization();
return app;
}
//// TODO Remove workaround for https://github.com/dotnet/aspnetcore/issues/36649 if implemented
private sealed class BindableUri : Uri
{
private BindableUri(string uriString, UriKind uriKind)
: base(uriString, uriKind)
{
}
public static bool TryParse(string value, out BindableUri? result)
{
if (TryCreate(value, UriKind.RelativeOrAbsolute, out var uri))
{
result = new BindableUri(uri.OriginalString, uri.IsAbsoluteUri ? UriKind.Absolute : UriKind.Relative);
return true;
}
result = null;
return false;
}
}
}
| apache-2.0 | C# |
ae4e7f609e06a8dd7303c0f144022fe55f609c53 | Remove code duplication | mysticfall/Alensia | Assets/Alensia/Core/UI/UIContainer.cs | Assets/Alensia/Core/UI/UIContainer.cs | using System.Collections.Generic;
using System.Linq;
using Alensia.Core.Common;
using UnityEngine;
namespace Alensia.Core.UI
{
public abstract class UIContainer : UIComponent, IContainer
{
public virtual IList<IComponent> Children => transform.GetChildren<IComponent>().ToList();
public override void Initialize(IUIContext context)
{
base.Initialize(context);
if (!Application.isPlaying) return;
foreach (var child in Children)
{
child.Initialize(Context);
}
}
}
} | using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Alensia.Core.UI
{
public abstract class UIContainer : UIComponent, IContainer
{
public virtual IList<IComponent> Children => transform.Cast<Transform>()
.Select(c => c.GetComponent<IComponent>())
.Where(c => c != null)
.ToList();
public override void Initialize(IUIContext context)
{
base.Initialize(context);
if (!Application.isPlaying) return;
foreach (var child in Children)
{
child.Initialize(Context);
}
}
}
} | apache-2.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.