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 |
|---|---|---|---|---|---|---|---|---|
a1c19c4941f8219b160afa2234afbf34f5fe1fcd | Fix fuel consumption data binding. | Azure-Samples/MyDriving,Azure-Samples/MyDriving,Azure-Samples/MyDriving | XamarinApp/MyTrips/MyTrips.iOS/Screens/Trips/TripSummaryTableViewController.cs | XamarinApp/MyTrips/MyTrips.iOS/Screens/Trips/TripSummaryTableViewController.cs | using Foundation;
using System;
using System.Collections.Generic;
using UIKit;
namespace MyTrips.iOS
{
public partial class TripSummaryTableViewController : UIViewController
{
public ViewModel.CurrentTripViewModel ViewModel { get; set; }
public TripSummaryTableViewController(IntPtr handle) : base(handle) { }
public override void ViewDidLoad()
{
base.ViewDidLoad();
var data = new List<DrivingStatistic>
{
new DrivingStatistic { Name = "Total Distance", Value = $"{ViewModel.Distance} {ViewModel.DistanceUnits.ToLower()}" },
new DrivingStatistic { Name = "Total Duration", Value = ViewModel.ElapsedTime },
new DrivingStatistic { Name = "Total Fuel Consumption", Value = $"{ViewModel.FuelConsumption} {ViewModel.FuelConsumptionUnits.ToLower()}" },
new DrivingStatistic { Name = "Average Speed", Value = "31 MPH"},
new DrivingStatistic { Name = "Hard Breaks", Value = "21"}
};
tripSummaryTableView.Source = new TripSummaryTableViewSource(data);
tripNameTextField.ReturnKeyType = UIReturnKeyType.Done;
tripNameTextField.Delegate = new TextViewDelegate();
}
async partial void DoneButton_TouchUpInside(UIButton sender)
{
await ViewModel.SaveRecordingTripAsync(tripNameTextField.Text);
NSNotificationCenter.DefaultCenter.PostNotificationName("RefreshPastTripsTable", null);
DismissViewController(true, null);
}
public class TextViewDelegate : UITextFieldDelegate
{
public override bool ShouldReturn(UITextField textField)
{
textField.ResignFirstResponder();
return true;
}
}
public class TripSummaryTableViewSource : UITableViewSource
{
const string TRIP_SUMMARY_CELL_IDENTIFIER = "TRIP_SUMMARY_CELL_IDENTIFIER";
List<DrivingStatistic> data;
public TripSummaryTableViewSource(List<DrivingStatistic> data)
{
this.data = data;
}
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
{
return 60f;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return data.Count;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell(TRIP_SUMMARY_CELL_IDENTIFIER) as TripSummaryCell;
if (cell == null)
cell = new TripSummaryCell(new NSString(TRIP_SUMMARY_CELL_IDENTIFIER));
cell.Name = data[indexPath.Row].Name;
cell.Value = data[indexPath.Row].Value;
return cell;
}
}
}
} | using Foundation;
using System;
using System.Collections.Generic;
using UIKit;
namespace MyTrips.iOS
{
public partial class TripSummaryTableViewController : UIViewController
{
public ViewModel.CurrentTripViewModel ViewModel { get; set; }
public TripSummaryTableViewController(IntPtr handle) : base(handle) { }
public override void ViewDidLoad()
{
base.ViewDidLoad();
var data = new List<DrivingStatistic>
{
new DrivingStatistic { Name = "Total Distance", Value = $"{ViewModel.Distance} {ViewModel.DistanceUnits.ToLower()}" },
new DrivingStatistic { Name = "Total Duration", Value = ViewModel.ElapsedTime },
new DrivingStatistic { Name = "Total Fuel Consumption", Value = ViewModel.FuelConsumptionUnits},
new DrivingStatistic { Name = "Average Speed", Value = "31 MPH"},
new DrivingStatistic { Name = "Hard Breaks", Value = "21"}
};
tripSummaryTableView.Source = new TripSummaryTableViewSource(data);
tripNameTextField.ReturnKeyType = UIReturnKeyType.Done;
tripNameTextField.Delegate = new TextViewDelegate();
}
async partial void DoneButton_TouchUpInside(UIButton sender)
{
await ViewModel.SaveRecordingTripAsync(tripNameTextField.Text);
NSNotificationCenter.DefaultCenter.PostNotificationName("RefreshPastTripsTable", null);
DismissViewController(true, null);
}
public class TextViewDelegate : UITextFieldDelegate
{
public override bool ShouldReturn(UITextField textField)
{
textField.ResignFirstResponder();
return true;
}
}
public class TripSummaryTableViewSource : UITableViewSource
{
const string TRIP_SUMMARY_CELL_IDENTIFIER = "TRIP_SUMMARY_CELL_IDENTIFIER";
List<DrivingStatistic> data;
public TripSummaryTableViewSource(List<DrivingStatistic> data)
{
this.data = data;
}
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
{
return 60f;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return data.Count;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell(TRIP_SUMMARY_CELL_IDENTIFIER) as TripSummaryCell;
if (cell == null)
cell = new TripSummaryCell(new NSString(TRIP_SUMMARY_CELL_IDENTIFIER));
cell.Name = data[indexPath.Row].Name;
cell.Value = data[indexPath.Row].Value;
return cell;
}
}
}
} | mit | C# |
cd6ad217ab64070acd1698755cb2e0fce846eca6 | Add link to MSDN docs on API sets. | AArnott/pinvoke,jmelosegui/pinvoke,vbfox/pinvoke,fearthecowboy/pinvoke | src/Windows.Core/ApiSets.cs | src/Windows.Core/ApiSets.cs | // Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
#pragma warning disable SA1303 // Const field names must begin with upper-case letter
namespace PInvoke
{
/// <summary>
/// Defines names of API Set dll's that may be used in P/Invoke signatures.
/// </summary>
/// <remarks>
/// The API set names and members are documented here:
/// https://msdn.microsoft.com/en-us/library/windows/desktop/hh802935(v=vs.85).aspx
/// </remarks>
public static class ApiSets
{
/// <summary>
/// The "api-ms-win-core-localization-l1-2-1.dll" constant.
/// </summary>
public const string api_ms_win_core_localization_l1_2_1 = "api-ms-win-core-localization-l1-2-1.dll";
/// <summary>
/// The "api-ms-win-core-processthreads-l1-1-2.dll" constant.
/// </summary>
public const string api_ms_win_core_processthreads_l1_1_2 = "api-ms-win-core-processthreads-l1-1-2.dll";
/// <summary>
/// The "api-ms-win-core-io-l1-1-1.dll" constant.
/// </summary>
public const string api_ms_win_core_io_l1_1_1 = "api-ms-win-core-io-l1-1-1.dll";
/// <summary>
/// The "api-ms-win-core-file-l1-2-1.dll" constant.
/// </summary>
public const string api_ms_win_core_file_l1_2_1 = "api-ms-win-core-file-l1-2-1.dll";
/// <summary>
/// The "api-ms-win-core-synch-l1-2-0.dll" constant.
/// </summary>
public const string api_ms_win_core_synch_l1_2_0 = "api-ms-win-core-synch-l1-2-0.dll";
/// <summary>
/// The "api-ms-win-core-handle-l1-1-0.dll" constant.
/// </summary>
public const string api_ms_win_core_handle_l1_1_0 = "api-ms-win-core-handle-l1-1-0.dll";
}
}
| // Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
#pragma warning disable SA1303 // Const field names must begin with upper-case letter
namespace PInvoke
{
/// <summary>
/// Defines names of API Set dll's that may be used in P/Invoke signatures.
/// </summary>
public static class ApiSets
{
/// <summary>
/// The "api-ms-win-core-localization-l1-2-1.dll" constant.
/// </summary>
public const string api_ms_win_core_localization_l1_2_1 = "api-ms-win-core-localization-l1-2-1.dll";
/// <summary>
/// The "api-ms-win-core-processthreads-l1-1-2.dll" constant.
/// </summary>
public const string api_ms_win_core_processthreads_l1_1_2 = "api-ms-win-core-processthreads-l1-1-2.dll";
/// <summary>
/// The "api-ms-win-core-io-l1-1-1.dll" constant.
/// </summary>
public const string api_ms_win_core_io_l1_1_1 = "api-ms-win-core-io-l1-1-1.dll";
/// <summary>
/// The "api-ms-win-core-file-l1-2-1.dll" constant.
/// </summary>
public const string api_ms_win_core_file_l1_2_1 = "api-ms-win-core-file-l1-2-1.dll";
/// <summary>
/// The "api-ms-win-core-synch-l1-2-0.dll" constant.
/// </summary>
public const string api_ms_win_core_synch_l1_2_0 = "api-ms-win-core-synch-l1-2-0.dll";
/// <summary>
/// The "api-ms-win-core-handle-l1-1-0.dll" constant.
/// </summary>
public const string api_ms_win_core_handle_l1_1_0 = "api-ms-win-core-handle-l1-1-0.dll";
}
}
| mit | C# |
296011d27d6af5a3727deaa2d752e79a46a4b15a | Correct the sand box to catch exception if a non-CLR dll is present. | eylvisaker/AgateLib | AgateLib/Drivers/AgateSandBoxLoader.cs | AgateLib/Drivers/AgateSandBoxLoader.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace AgateLib.Drivers
{
class AgateSandBoxLoader : MarshalByRefObject
{
public AgateDriverInfo[] ReportDrivers(string file)
{
List<AgateDriverInfo> retval = new List<AgateDriverInfo>();
Assembly ass;
try
{
ass = Assembly.LoadFrom(file);
}
catch (BadImageFormatException)
{
System.Diagnostics.Debug.Print("Could not load the file {0}. Is it a CLR assembly?", file);
return retval.ToArray();
}
foreach (Type t in ass.GetTypes())
{
if (t.IsAbstract)
continue;
if (typeof(AgateDriverReporter).IsAssignableFrom(t) == false)
continue;
AgateDriverReporter reporter = (AgateDriverReporter)Activator.CreateInstance(t);
foreach (AgateDriverInfo info in reporter.ReportDrivers())
{
info.AssemblyFile = file;
info.AssemblyName = ass.FullName;
retval.Add(info);
}
}
return retval.ToArray();
}
}
} | using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace AgateLib.Drivers
{
class AgateSandBoxLoader : MarshalByRefObject
{
public AgateDriverInfo[] ReportDrivers(string file)
{
List<AgateDriverInfo> retval = new List<AgateDriverInfo>();
Assembly ass = Assembly.LoadFrom(file);
foreach (Type t in ass.GetTypes())
{
if (t.IsAbstract)
continue;
if (typeof(AgateDriverReporter).IsAssignableFrom(t) == false)
continue;
AgateDriverReporter reporter = (AgateDriverReporter)Activator.CreateInstance(t);
foreach (AgateDriverInfo info in reporter.ReportDrivers())
{
info.AssemblyFile = file;
info.AssemblyName = ass.FullName;
retval.Add(info);
}
}
return retval.ToArray();
}
}
} | mit | C# |
d59c6c8d6f9dbd388beae6790f715224c76ab0a4 | Update 20180327.LuckWheelManager.cs | twilightspike/cuddly-disco,twilightspike/cuddly-disco | main/20180327.LuckWheelManager.cs | main/20180327.LuckWheelManager.cs | using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System;
public class LuckWheelManager: MonoBehaviour{
/*stuffset*/
private bool _beStarted;
private float[] _angleSector;
private float _angleFinal;
private float _angleBegin;
private float _lerpRotateTimeNow;
/*message_how much*/
public int PressCost = 250; //pay how much on playing
public int MoneyPrevTotal;
public int MoneyNowTotal = 1000;
/*ui_basuc*/
public Button buttonPress;
public GameObject circleWheel;
/*message_win or lose*/
public Text MoneyDeltaText;
public Text MoneyNowText;
/*action*/
private void Awake(){
MoneyPrevTotal = MoneyNowTotal;
MoneyNowText.text = MoneyNowTotal.ToString();
}
public void SpinWheel(){
if(MoneyNowTotal >= PressCost){
_lerpRotateTimeNow = 0f;
_angleSector = new float[]{
30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360
};
int circleFull = 5;
float randomAngleFinal = _angleSector [UnityEngine.Random.Range(0, _angleSector.Length)];
/*angle would rotate*/
_angleFinal = -(circleFull * 360 + randomAngleFinal);
_beStarted = true;
MoneyPrevTotal = MoneyNowTotal;
/*Whenever I play, my wallet fades*/
MoneyNowTotal = -PressCost;
/*Addict to it?!*/
MoneyDeltaText.text = PressCost + "bye!";
MoneyDeltaText.gameObject.SetActive(true);
StartCoroutine(MoneyDeltaHide());
StartCoroutine(MoneyTotalUpdate());
}
}
/*void RewardByAngle(){
switch(_angleBegin){}
}*/
void Update(){
/*The Poor is banned*/
if(_beStarted || MoneyNowTotal < PressCost){
buttonPress.interactable = false;
/*buttonPress.GetComponent<Image>.color = new Color();*/
}else{
buttonPress.interactable = true;
/*buttonPress.GetComponent<Image>.color = new Color();*/
}
if(!_beStarted){
return;
float LerpRotateTimeMax = 4f;
_lerpRotateTimeNow += Time.deltaTime;
if(_lerpRotateTimeNow > LerpRotateTimeMax || circleWheel.transform.EulerAngles.z == _angleFinal){
_lerpRotateTimeNow = LerpRotateTimeMax;
}
}
}
}
| using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System;
public class LuckWheelManager: MonoBehaviour{
/*stuffset*/
private bool _beStarted;
private float[] _angleSector;
private float _angleFinal;
private float _angleBegin;
private float _lerpRotateTimeNow;
/*message_how much*/
public int PressCost = 250; //pay how much on playing
public int MoneyPrevTotal;
public int MoneyNowTotal = 1000;
/*ui_basuc*/
public Button buttonPress;
public GameObject circleWheel;
/*message_win or lose*/
public Text MoneyDeltaText;
public Text MoneyNowText;
/*action*/
private void Awake(){
MoneyPrevTotal = MoneyNowTotal;
MoneyNowText.text = MoneyNowTotal.ToString();
}
public void SpinWheel(){
if(MoneyNowTotal >= PressCost){
_lerpRotateTimeNow = 0f;
_angleSector = new float[]{
30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360
};
int circleFull = 5;
float randomAngleFinal = _angleSector [UnityEngine.Random.Range(0, _angleSector.Length)];
/*angle would rotate*/
_angleFinal = -(circleFull * 360 + randomAngleFinal);
_beStarted = true;
MoneyPrevTotal = MoneyNowTotal;
/*Whenever I play, my wallet fades*/
MoneyNowTotal = -PressCost;
/*Addict to it?!*/
MoneyDeltaText.text = PressCost + "bye!";
MoneyDeltaText.gameObject.SetActive(true);
StartCoroutine(MoneyDeltaHide());
StartCoroutine(MoneyTotalUpdate());
}
}
/*void RewardByAngle(){
switch(_angleBegin){}
}*/
void Update(){
/*The Poor is banned*/
if(_beStarted || MoneyNowTotal < PressCost){
buttonPress.interactable = false;
/*buttonPress.GetComponent<Image>.color = new Color();*/
}else{
buttonPress.interactable = true;
/*buttonPress.GetComponent<Image>.color = new Color();*/
}
if(!_beStarted){
return;
}
}
}
| mit | C# |
d712e74678916f6b79f46812848a252db427c845 | increment version | Alex141/CalcBinding | CalcBinding/Properties/AssemblyInfo.cs | CalcBinding/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("CalcBinding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CalcBinding")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2f50352b-c0e5-4814-9e09-246cbc1c83b8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyFileVersion("2.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("CalcBinding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CalcBinding")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2f50352b-c0e5-4814-9e09-246cbc1c83b8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
| apache-2.0 | C# |
2390f96b529142a4270d9215199d0ccb3a3d8916 | Change namespace of FindByColumnIndexAttribute | atata-framework/atata,atata-framework/atata,YevgeniyShunevych/Atata,YevgeniyShunevych/Atata | src/Atata/Attributes/FindByColumnIndexAttribute.cs | src/Atata/Attributes/FindByColumnIndexAttribute.cs | namespace Atata
{
public class FindByColumnIndexAttribute : FindAttribute
{
public FindByColumnIndexAttribute(int columnIndex)
{
ColumnIndex = columnIndex;
}
public int ColumnIndex { get; private set; }
public override IComponentScopeLocateStrategy CreateStrategy(UIComponentMetadata metadata)
{
return new FindByColumnIndexStrategy(ColumnIndex);
}
}
}
| namespace Atata.Attributes
{
public class FindByColumnIndexAttribute : FindAttribute
{
public FindByColumnIndexAttribute(int columnIndex)
{
ColumnIndex = columnIndex;
}
public int ColumnIndex { get; private set; }
public override IComponentScopeLocateStrategy CreateStrategy(UIComponentMetadata metadata)
{
return new FindByColumnIndexStrategy(ColumnIndex);
}
}
}
| apache-2.0 | C# |
9bf33631ab267e6cd8a42439bc4a0cdec6655fa6 | Make base transition abstract. | AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex | src/Avalonia.Animation/AnimatorDrivenTransition.cs | src/Avalonia.Animation/AnimatorDrivenTransition.cs | using System;
using Avalonia.Animation.Animators;
namespace Avalonia.Animation
{
public abstract class AnimatorDrivenTransition<T, TAnimator> : Transition<T> where TAnimator : Animator<T>, new()
{
private static readonly TAnimator s_animator = new TAnimator();
public override IObservable<T> DoTransition(IObservable<double> progress, T oldValue, T newValue)
{
return new AnimatorTransitionObservable<T, TAnimator>(s_animator, progress, oldValue, newValue);
}
}
}
| using System;
using Avalonia.Animation.Animators;
namespace Avalonia.Animation
{
public class AnimatorDrivenTransition<T, TAnimator> : Transition<T> where TAnimator : Animator<T>, new()
{
private static readonly TAnimator s_animator = new TAnimator();
public override IObservable<T> DoTransition(IObservable<double> progress, T oldValue, T newValue)
{
return new AnimatorTransitionObservable<T, TAnimator>(s_animator, progress, oldValue, newValue);
}
}
}
| mit | C# |
fbc8c55fe969142e0a2f0493785e5631d7fe6eee | Make html template container builder public. | damiensawyer/cassette,honestegg/cassette,honestegg/cassette,andrewdavey/cassette,BluewireTechnologies/cassette,damiensawyer/cassette,damiensawyer/cassette,andrewdavey/cassette,honestegg/cassette,BluewireTechnologies/cassette,andrewdavey/cassette | src/Cassette/HtmlTemplateModuleContainerBuilder.cs | src/Cassette/HtmlTemplateModuleContainerBuilder.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.IsolatedStorage;
namespace Cassette
{
public class HtmlTemplateModuleContainerBuilder : ModuleContainerBuilder
{
readonly string applicationRoot;
public HtmlTemplateModuleContainerBuilder(IsolatedStorageFile storage, string rootDirectory, string applicationRoot)
: base(storage, rootDirectory)
{
this.applicationRoot = EnsureDirectoryEndsWithSlash(applicationRoot);
}
public override ModuleContainer Build()
{
var moduleBuilder = new UnresolveHtmlTemplateModuleBuilder(rootDirectory);
var unresolvedModules = relativeModuleDirectories.Select(x => moduleBuilder.Build(x.Item1, x.Item2));
var modules = UnresolvedModule.ResolveAll(unresolvedModules);
return new ModuleContainer(
modules,
storage,
textWriter => new HtmlTemplateModuleWriter(textWriter, rootDirectory, LoadFile)
);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.IsolatedStorage;
namespace Cassette
{
class HtmlTemplateModuleContainerBuilder : ModuleContainerBuilder
{
readonly string applicationRoot;
public HtmlTemplateModuleContainerBuilder(IsolatedStorageFile storage, string rootDirectory, string applicationRoot)
: base(storage, rootDirectory)
{
this.applicationRoot = EnsureDirectoryEndsWithSlash(applicationRoot);
}
public override ModuleContainer Build()
{
var moduleBuilder = new UnresolveHtmlTemplateModuleBuilder(rootDirectory);
var unresolvedModules = relativeModuleDirectories.Select(x => moduleBuilder.Build(x.Item1, x.Item2));
var modules = UnresolvedModule.ResolveAll(unresolvedModules);
return new ModuleContainer(
modules,
storage,
textWriter => new HtmlTemplateModuleWriter(textWriter, rootDirectory, LoadFile)
);
}
}
}
| mit | C# |
861ff7808731039178ee81df51cbc55ab9db581d | Bump version to 2.1 | mganss/IS24RestApi,enkol/IS24RestApi | IS24RestApi/Properties/AssemblyInfo.cs | IS24RestApi/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("IS24RestApi")]
[assembly: AssemblyDescription("Client for the Immobilienscout24 REST API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Michael Ganss")]
[assembly: AssemblyProduct("IS24RestApi")]
[assembly: AssemblyCopyright("Copyright © 2013-2015 IS24RestApi project contributors")]
[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("ce77545e-5fbe-4b4d-bf1f-1c5d4532070a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.*")]
| 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("IS24RestApi")]
[assembly: AssemblyDescription("Client for the Immobilienscout24 REST API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Michael Ganss")]
[assembly: AssemblyProduct("IS24RestApi")]
[assembly: AssemblyCopyright("Copyright © 2013-2014 IS24RestApi project contributors")]
[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("ce77545e-5fbe-4b4d-bf1f-1c5d4532070a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.*")]
| apache-2.0 | C# |
5073d43656e2610f390b32a6dccb13c21a5e414b | Fix Home page title | Naya-san/LifeManagement,Naya-san/LifeManagement,Naya-san/LifeManagement | LifeManagement/Views/Home/Index.cshtml | LifeManagement/Views/Home/Index.cshtml | @{
ViewBag.Title = "Life Management";
}
@using LifeManagement.Resources
<div id="content">
<h1>Life Management</h1>
<p>@ResourceScr.slogan</p>
<div class="rowLM">
<div class="LMсol-md-6">
<h2>@ResourceScr.Remarks</h2>
<p>
@ResourceScr.advRemark
</p>
</div>
<div class="LMсol-md-6">
<h2>@ResourceScr.Reminders</h2>
<p>@ResourceScr.advReminders</p>
</div>
</div>
</div> | @{
ViewBag.Title = "Home Page";
}
@using LifeManagement.Resources
<div id="content">
<h1>Life Management</h1>
<p>@ResourceScr.slogan</p>
<div class="rowLM">
<div class="LMсol-md-6">
<h2>@ResourceScr.Remarks</h2>
<p>
@ResourceScr.advRemark
</p>
</div>
<div class="LMсol-md-6">
<h2>@ResourceScr.Reminders</h2>
<p>@ResourceScr.advReminders</p>
</div>
</div>
</div> | apache-2.0 | C# |
49a26ec38e6b26a2b2be60334749daf66b407658 | fix build | WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common | src/WeihanLi.Common/Event/EventQueuePublisher.cs | src/WeihanLi.Common/Event/EventQueuePublisher.cs | #if NETSTANDARD
using Microsoft.Extensions.Options;
#endif
using System;
using System.Threading.Tasks;
namespace WeihanLi.Common.Event
{
public class EventQueuePublisher : IEventPublisher
{
private readonly IEventQueue _eventQueue;
private readonly EventQueuePublisherOptions _options;
#if NETSTANDARD
public EventQueuePublisher(IEventQueue eventQueue, IOptions<EventQueuePublisherOptions> options)
{
_eventQueue = eventQueue;
_options = options.Value;
}
#else
public EventQueuePublisher(IEventQueue eventQueue)
{
_eventQueue = eventQueue;
_options = new EventQueuePublisherOptions();
}
public void Config(Action<EventQueuePublisherOptions> configAction)
{
configAction?.Invoke(_options);
}
#endif
public virtual bool Publish<TEvent>(TEvent @event)
where TEvent : class, IEventBase
{
var queueName = _options.EventQueueNameResolver.Invoke(@event.GetType()) ?? "events";
return _eventQueue.Enqueue(queueName, @event);
}
public virtual Task<bool> PublishAsync<TEvent>(TEvent @event)
where TEvent : class, IEventBase
{
var queueName = _options.EventQueueNameResolver.Invoke(@event.GetType()) ?? "events";
return _eventQueue.EnqueueAsync(queueName, @event);
}
}
public class EventQueuePublisherOptions
{
private Func<Type, string> _eventQueueNameResolver = t => "events";
public Func<Type, string> EventQueueNameResolver
{
get => _eventQueueNameResolver;
set
{
if (null != _eventQueueNameResolver)
{
_eventQueueNameResolver = value;
}
}
}
}
}
| using Microsoft.Extensions.Options;
using System;
using System.Threading.Tasks;
namespace WeihanLi.Common.Event
{
public class EventQueuePublisher : IEventPublisher
{
private readonly IEventQueue _eventQueue;
private readonly EventQueuePublisherOptions _options;
#if NETSTANDARD
public EventQueuePublisher(IEventQueue eventQueue, IOptions<EventQueuePublisherOptions> options)
{
_eventQueue = eventQueue;
_options = options.Value;
}
#else
public EventQueuePublisher(IEventQueue eventQueue)
{
_eventQueue = eventQueue;
_options = new EventQueuePublisherOptions();
}
public void Config(Action<EventQueuePublisherOptions> configAction)
{
configAction?.Invoke(_options);
}
#endif
public virtual bool Publish<TEvent>(TEvent @event)
where TEvent : class, IEventBase
{
var queueName = _options.EventQueueNameResolver.Invoke(@event.GetType()) ?? "events";
return _eventQueue.Enqueue(queueName, @event);
}
public virtual Task<bool> PublishAsync<TEvent>(TEvent @event)
where TEvent : class, IEventBase
{
var queueName = _options.EventQueueNameResolver.Invoke(@event.GetType()) ?? "events";
return _eventQueue.EnqueueAsync(queueName, @event);
}
}
public class EventQueuePublisherOptions
{
private Func<Type, string> _eventQueueNameResolver = t => "events";
public Func<Type, string> EventQueueNameResolver
{
get => _eventQueueNameResolver;
set
{
if (null != _eventQueueNameResolver)
{
_eventQueueNameResolver = value;
}
}
}
}
}
| mit | C# |
3173071c60b252843e94af8dfbe267fc44ee10f5 | Fix null ref access when texture panel is open and you hover over a texture that failed to load. | dayo7116/open3mod,acgessler/open3mod,dayo7116/open3mod,zhukaixy/open3mod,acgessler/open3mod,zhukaixy/open3mod | open3mod/TextureDetailsDialog.cs | open3mod/TextureDetailsDialog.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Assimp;
namespace open3mod
{
public partial class TextureDetailsDialog : Form
{
private TextureThumbnailControl _tex;
public TextureDetailsDialog()
{
InitializeComponent();
}
public TextureThumbnailControl GetTexture()
{
return _tex;
}
public void SetTexture(TextureThumbnailControl tex)
{
Debug.Assert(tex != null && tex.Texture != null);
_tex = tex;
var img = tex.Texture.Image;
Text = Path.GetFileName(tex.FilePath) + " - Details";
pictureBox1.Image = img;
if (img != null)
{
labelInfo.Text = string.Format("Size: {0} x {1} px", img.Width, img.Height);
}
checkBoxHasAlpha.Checked = tex.Texture.HasAlpha == Texture.AlphaState.HasAlpha;
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Assimp;
namespace open3mod
{
public partial class TextureDetailsDialog : Form
{
private TextureThumbnailControl _tex;
public TextureDetailsDialog()
{
InitializeComponent();
}
public TextureThumbnailControl GetTexture()
{
return _tex;
}
public void SetTexture(TextureThumbnailControl tex)
{
Debug.Assert(tex != null && tex.Texture != null);
_tex = tex;
var img = tex.Texture.Image;
Text = Path.GetFileName(tex.FilePath) + " - Details";
pictureBox1.Image = img;
labelInfo.Text = string.Format("Size: {0} x {1} px", img.Width, img.Height);
checkBoxHasAlpha.Checked = tex.Texture.HasAlpha == Texture.AlphaState.HasAlpha;
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
}
}
| bsd-3-clause | C# |
4faee01dfdc2c6418f6d72197e9f3421cb2bb15a | Fix `RemoveAndDisposeImmediately()` failing for children of containers with overridden `Content` | smoogipooo/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework | osu.Framework/Graphics/DrawableExtensions.cs | osu.Framework/Graphics/DrawableExtensions.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.Development;
namespace osu.Framework.Graphics
{
/// <summary>
/// Holds extension methods for <see cref="Drawable"/>.
/// </summary>
public static class DrawableExtensions
{
/// <summary>
/// Adjusts specified properties of a <see cref="Drawable"/>.
/// </summary>
/// <param name="drawable">The <see cref="Drawable"/> whose properties should be adjusted.</param>
/// <param name="adjustment">The adjustment function.</param>
/// <returns>The given <see cref="Drawable"/>.</returns>
public static T With<T>(this T drawable, Action<T> adjustment)
where T : Drawable
{
adjustment?.Invoke(drawable);
return drawable;
}
/// <summary>
/// Forces removal of this drawable from its parent, followed by immediate synchronous disposal.
/// </summary>
/// <remarks>
/// This is intended as a temporary solution for the fact that there is no way to easily dispose
/// a component in a way that is guaranteed to be synchronously run on the update thread.
///
/// Eventually components will have a better method for unloading.
/// </remarks>
/// <param name="drawable">The <see cref="Drawable"/> to be disposed.</param>
public static void RemoveAndDisposeImmediately(this Drawable drawable)
{
ThreadSafety.EnsureUpdateThread();
drawable.Parent?.RemoveInternal(drawable);
drawable.Dispose();
}
}
}
| // 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.Development;
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Graphics
{
/// <summary>
/// Holds extension methods for <see cref="Drawable"/>.
/// </summary>
public static class DrawableExtensions
{
/// <summary>
/// Adjusts specified properties of a <see cref="Drawable"/>.
/// </summary>
/// <param name="drawable">The <see cref="Drawable"/> whose properties should be adjusted.</param>
/// <param name="adjustment">The adjustment function.</param>
/// <returns>The given <see cref="Drawable"/>.</returns>
public static T With<T>(this T drawable, Action<T> adjustment)
where T : Drawable
{
adjustment?.Invoke(drawable);
return drawable;
}
/// <summary>
/// Forces removal of this drawable from its parent, followed by immediate synchronous disposal.
/// </summary>
/// <remarks>
/// This is intended as a temporary solution for the fact that there is no way to easily dispose
/// a component in a way that is guaranteed to be synchronously run on the update thread.
///
/// Eventually components will have a better method for unloading.
/// </remarks>
/// <param name="drawable">The <see cref="Drawable"/> to be disposed.</param>
public static void RemoveAndDisposeImmediately(this Drawable drawable)
{
ThreadSafety.EnsureUpdateThread();
switch (drawable.Parent)
{
case Container cont:
cont.Remove(drawable);
break;
case CompositeDrawable comp:
comp.RemoveInternal(drawable);
break;
}
drawable.Dispose();
}
}
}
| mit | C# |
62263c81d8b60b751ec86db3f10f16bf4a09a689 | Make GlowEffect support BlendingParameters | default0/osu-framework,ppy/osu-framework,ppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,Tom94/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,default0/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework | osu.Framework/Graphics/Effects/GlowEffect.cs | osu.Framework/Graphics/Effects/GlowEffect.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Graphics.Effects
{
/// <summary>
/// Creates a glow around the drawable this effect gets applied to.
/// </summary>
public class GlowEffect : IEffect<BufferedContainer>
{
/// <summary>
/// The strength of the glow. A higher strength means that the glow fades outward slower. Default is 1.
/// </summary>
public float Strength = 1f;
/// <summary>
/// The sigma value for the blur of the glow. This controls how spread out the glow is. Default is 5 in both X and Y.
/// </summary>
public Vector2 BlurSigma = new Vector2(5);
/// <summary>
/// The color of the outline. Default is <see cref="Color4.White"/>.
/// </summary>
public ColourInfo Colour = Color4.White;
/// <summary>
/// The blending mode of the glow. Default is additive.
/// </summary>
public BlendingParameters Blending = BlendingMode.Additive;
/// <summary>
/// Whether to draw the glow <see cref="EffectPlacement.InFront"/> or <see cref="EffectPlacement.Behind"/> the glowing
/// <see cref="Drawable"/>. Default is <see cref="EffectPlacement.InFront"/>.
/// </summary>
public EffectPlacement Placement = EffectPlacement.InFront;
/// <summary>
/// Whether to automatically pad by the glow extent such that no clipping occurs at the sides of the effect. Default is false.
/// </summary>
public bool PadExtent;
/// <summary>
/// True if the effect should be cached. This is an optimization, but can cause issues if the drawable changes the way it looks without changing its size.
/// Turned off by default.
/// </summary>
public bool CacheDrawnEffect;
public BufferedContainer ApplyTo(Drawable drawable) => drawable.WithEffect(new BlurEffect
{
Strength = Strength,
Sigma = BlurSigma,
Colour = Colour,
Blending = Blending,
Placement = Placement,
PadExtent = PadExtent,
CacheDrawnEffect = CacheDrawnEffect,
DrawOriginal = true,
});
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Graphics.Effects
{
/// <summary>
/// Creates a glow around the drawable this effect gets applied to.
/// </summary>
public class GlowEffect : IEffect<BufferedContainer>
{
/// <summary>
/// The strength of the glow. A higher strength means that the glow fades outward slower. Default is 1.
/// </summary>
public float Strength = 1f;
/// <summary>
/// The sigma value for the blur of the glow. This controls how spread out the glow is. Default is 5 in both X and Y.
/// </summary>
public Vector2 BlurSigma = new Vector2(5);
/// <summary>
/// The color of the outline. Default is <see cref="Color4.White"/>.
/// </summary>
public ColourInfo Colour = Color4.White;
/// <summary>
/// The blending mode of the glow. Default is additive.
/// </summary>
public BlendingMode BlendingMode = BlendingMode.Additive;
/// <summary>
/// Whether to draw the glow <see cref="EffectPlacement.InFront"/> or <see cref="EffectPlacement.Behind"/> the glowing
/// <see cref="Drawable"/>. Default is <see cref="EffectPlacement.InFront"/>.
/// </summary>
public EffectPlacement Placement = EffectPlacement.InFront;
/// <summary>
/// Whether to automatically pad by the glow extent such that no clipping occurs at the sides of the effect. Default is false.
/// </summary>
public bool PadExtent;
/// <summary>
/// True if the effect should be cached. This is an optimization, but can cause issues if the drawable changes the way it looks without changing its size.
/// Turned off by default.
/// </summary>
public bool CacheDrawnEffect;
public BufferedContainer ApplyTo(Drawable drawable) => drawable.WithEffect(new BlurEffect
{
Strength = Strength,
Sigma = BlurSigma,
Colour = Colour,
Blending = BlendingMode,
Placement = Placement,
PadExtent = PadExtent,
CacheDrawnEffect = CacheDrawnEffect,
DrawOriginal = true,
});
}
}
| mit | C# |
6cc329ccbe1e927e34aa1738948cb33745d1355c | change message | cicorias/webjobtcpping | src/SimpleTcpServer/Program.cs | src/SimpleTcpServer/Program.cs | using SimpleTcpServer.Server;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace SimpleTcpServer
{
class Program
{
static void Main(string[] args)
{
var service = new ServerService();
if (!Environment.UserInteractive)
{
var servicesToRun = new ServiceBase[] { service };
ServiceBase.Run(servicesToRun);
return;
}
int portInt;
string port;
Config.GetSettings(out portInt, out port);
var server = new TcpServer(portInt);
Console.WriteLine("Running on tcp://localhost:" + port);
Console.WriteLine("Press <Enter> to continue...");
Console.ReadLine();
server.Dispose();
}
}
}
| using SimpleTcpServer.Server;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace SimpleTcpServer
{
class Program
{
static void Main(string[] args)
{
var service = new ServerService();
if (!Environment.UserInteractive)
{
var servicesToRun = new ServiceBase[] { service };
ServiceBase.Run(servicesToRun);
return;
}
int portInt;
string port;
Config.GetSettings(out portInt, out port);
var server = new TcpServer(portInt);
Console.WriteLine("Running on http://localhost:" + port);
Console.WriteLine("Press <Enter> to continue...");
Console.ReadLine();
server.Dispose();
}
}
}
| mit | C# |
f913bd24a33c12d8ea45855f9f3a848d5089e3cd | Fix ALgo | jefking/King.Service.Endurance,jefking/King.Service.Endurance | King.Service.Endurance/Generation/Tasks/Collector.cs | King.Service.Endurance/Generation/Tasks/Collector.cs | namespace Generation.Tasks
{
using Generation.Models;
using King.Azure.Data;
using King.Service;
using System;
public class Collector : RecurringTask
{
private readonly ITableStorage table;
private readonly int seconds = 0;
private DateTime? lastRun = null;
public Collector(int seconds, ITableStorage table)
:base(15, seconds)
{
this.seconds = seconds;
this.table = table;
}
public override void Run()
{
var now = DateTime.UtcNow;
var entity = new Datum()
{
PartitionKey = string.Format("{0}", this.seconds),
RowKey = Guid.NewGuid().ToString(),
EveryMs = (int)base.Every.TotalMilliseconds,
ServiceName = base.ServiceName,
Now = now.Ticks,
LastRun = lastRun == null ? 0 : lastRun.Value.Ticks,
};
this.table.InsertOrReplace(entity).Wait();
this.lastRun = now;
}
}
} | namespace Generation.Tasks
{
using Generation.Models;
using King.Azure.Data;
using King.Service;
using System;
public class Collector : RecurringTask
{
private readonly ITableStorage table;
private readonly int seconds = 0;
private DateTime? lastRun = null;
public Collector(int seconds, ITableStorage table)
:base(15, seconds)
{
this.seconds = seconds;
this.table = table;
}
public override void Run()
{
var now = DateTime.UtcNow;
var entity = new Datum()
{
PartitionKey = string.Format("{0}", this.seconds),
RowKey = Guid.NewGuid().ToString(),
EveryMs = (int)base.Every.TotalMilliseconds,
ServiceName = base.ServiceName,
Now = now.Ticks,
LastRun = now.Ticks,
};
this.table.InsertOrReplace(entity).Wait();
this.lastRun = now;
}
}
} | apache-2.0 | C# |
25a8b5f7f557b245874968f08f38b8810a4c8cc5 | Check for a proper exception before running WebApiActionFilter | tdiehl/raygun4net,MindscapeHQ/raygun4net,MindscapeHQ/raygun4net,tdiehl/raygun4net,nelsonsar/raygun4net,MindscapeHQ/raygun4net,ddunkin/raygun4net,articulate/raygun4net,ddunkin/raygun4net,nelsonsar/raygun4net,articulate/raygun4net | Mindscape.Raygun4Net45/WebApi/RaygunWebApiFilters.cs | Mindscape.Raygun4Net45/WebApi/RaygunWebApiFilters.cs | using System;
using System.Collections.Generic;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Filters;
namespace Mindscape.Raygun4Net.WebApi
{
public class RaygunWebApiExceptionFilter : ExceptionFilterAttribute
{
private readonly IRaygunWebApiClientProvider _clientCreator;
internal RaygunWebApiExceptionFilter(IRaygunWebApiClientProvider clientCreator)
{
_clientCreator = clientCreator;
}
public override void OnException(HttpActionExecutedContext context)
{
_clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(context.Exception);
}
#pragma warning disable 1998
public override async Task OnExceptionAsync(HttpActionExecutedContext context, CancellationToken cancellationToken)
{
_clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(context.Exception);
}
#pragma warning restore 1998
}
public class RaygunWebApiActionFilter : ActionFilterAttribute
{
private readonly IRaygunWebApiClientProvider _clientCreator;
internal RaygunWebApiActionFilter(IRaygunWebApiClientProvider clientCreator)
{
_clientCreator = clientCreator;
}
public override void OnActionExecuted(HttpActionExecutedContext context)
{
base.OnActionExecuted(context);
// Don't bother processing bad StatusCodes if there is an exception attached - it will be handled by another part of the framework.
if (context != null && context.Exception == null && context.Response != null && (int)context.Response.StatusCode >= 400)
{
try
{
throw new RaygunWebApiHttpException(
context.Response.StatusCode,
context.Response.ReasonPhrase,
string.Format("HTTP {0} returned while handling Request {2} {1}", (int)context.Response.StatusCode, context.Request.RequestUri, context.Request.Method));
}
catch (RaygunWebApiHttpException e)
{
_clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(e, null, new Dictionary<string, string> { { "ReasonCode", e.ReasonPhrase } });
}
catch (Exception e)
{
// This is here on the off chance that interacting with the context or HTTP Response throws an exception.
_clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(e);
}
}
}
}
public class RaygunWebApiHttpException : Exception
{
public HttpStatusCode StatusCode { get; set; }
public string ReasonPhrase { get; set; }
public RaygunWebApiHttpException(HttpStatusCode statusCode, string reasonPhrase, string message)
: base(message)
{
ReasonPhrase = reasonPhrase;
StatusCode = statusCode;
}
}
} | using System;
using System.Collections.Generic;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Filters;
namespace Mindscape.Raygun4Net.WebApi
{
public class RaygunWebApiExceptionFilter : ExceptionFilterAttribute
{
private readonly IRaygunWebApiClientProvider _clientCreator;
internal RaygunWebApiExceptionFilter(IRaygunWebApiClientProvider clientCreator)
{
_clientCreator = clientCreator;
}
public override void OnException(HttpActionExecutedContext context)
{
_clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(context.Exception);
}
#pragma warning disable 1998
public override async Task OnExceptionAsync(HttpActionExecutedContext context, CancellationToken cancellationToken)
{
_clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(context.Exception);
}
#pragma warning restore 1998
}
public class RaygunWebApiActionFilter : ActionFilterAttribute
{
private readonly IRaygunWebApiClientProvider _clientCreator;
internal RaygunWebApiActionFilter(IRaygunWebApiClientProvider clientCreator)
{
_clientCreator = clientCreator;
}
public override void OnActionExecuted(HttpActionExecutedContext context)
{
base.OnActionExecuted(context);
if (context != null && context.Response != null && (int)context.Response.StatusCode >= 400)
{
try
{
throw new RaygunWebApiHttpException(
context.Response.StatusCode,
context.Response.ReasonPhrase,
string.Format("HTTP {0} returned while handling Request {2} {1}", (int)context.Response.StatusCode, context.Request.RequestUri, context.Request.Method));
}
catch (RaygunWebApiHttpException e)
{
_clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(e, null, new Dictionary<string, string> { { "ReasonCode", e.ReasonPhrase } });
}
catch (Exception e)
{
// This is here on the off chance that interacting with the context or HTTP Response throws an exception.
_clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(e);
}
}
}
}
public class RaygunWebApiHttpException : Exception
{
public HttpStatusCode StatusCode { get; set; }
public string ReasonPhrase { get; set; }
public RaygunWebApiHttpException(HttpStatusCode statusCode, string reasonPhrase, string message)
: base(message)
{
ReasonPhrase = reasonPhrase;
StatusCode = statusCode;
}
}
} | mit | C# |
4ae369a74beb1890c1a16dc113dbaa425c19b9e7 | Remove LogoutForm and replace with LogoutToken | ParcelForMe/p4m-demo-shop,ParcelForMe/p4m-demo-shop,ParcelForMe/p4m-demo-shop,ParcelForMe/p4m-demo-shop | OpenOrderFramework/Views/Shared/_LoginPartial.cshtml | OpenOrderFramework/Views/Shared/_LoginPartial.cshtml | @using Microsoft.AspNet.Identity
@using OpenOrderFramework.Models
@model P4MConsts
@if (Request.IsAuthenticated)
{
using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
{
@Html.AntiForgeryToken()
<ul class="nav navbar-nav navbar-right NavBarPad">
<li class="active">@{Html.RenderAction("CartSummary", "ShoppingCart");}</li>
<!-- ***** P4M ***** -->
<li><p4m-login session-id="@P4MConsts.SessionId" host-type="@Model.AppMode" id-srv-url="@Model.BaseIdSrvUrl" client-id="@Model.ClientId" redirect-url="@Model.RedirectUrl" logout-token="@P4MConsts.LogoutToken"></p4m-login></li>
<!-- ***** P4M ***** -->
<li>
@Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
</li>
<li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li>
</ul>
}
}
else {
<ul class="nav navbar-nav navbar-right NavBarPad" style="padding-right:40px">
<li class="active">@{Html.RenderAction("CartSummary", "ShoppingCart");}</li>
<!-- ***** P4M ***** -->
<li><p4m-login session-id="@P4MConsts.SessionId" host-type="@Model.AppMode" id-srv-url="@Model.BaseIdSrvUrl" client-id="@Model.ClientId" redirect-url="@Model.RedirectUrl" logout-token="@P4MConsts.LogoutToken"></p4m-login></li>
<!-- ***** P4M ***** -->
<li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
<li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
</ul>
}
| @using Microsoft.AspNet.Identity
@using OpenOrderFramework.Models
@model P4MConsts
@if (Request.IsAuthenticated)
{
using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
{
@Html.AntiForgeryToken()
<ul class="nav navbar-nav navbar-right NavBarPad">
<li class="active">@{Html.RenderAction("CartSummary", "ShoppingCart");}</li>
<!-- ***** P4M ***** -->
<li><p4m-login session-id="@P4MConsts.SessionId" host-type="@Model.AppMode" id-srv-url="@Model.BaseIdSrvUrl" client-id="@Model.ClientId" redirect-url="@Model.RedirectUrl" logout-form="@Model.LogoutForm"></p4m-login></li>
<!-- ***** P4M ***** -->
<li>
@Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
</li>
<li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li>
</ul>
}
}
else {
<ul class="nav navbar-nav navbar-right NavBarPad" style="padding-right:40px">
<li class="active">@{Html.RenderAction("CartSummary", "ShoppingCart");}</li>
<!-- ***** P4M ***** -->
<li><p4m-login session-id="@P4MConsts.SessionId" host-type="@Model.AppMode" id-srv-url="@Model.BaseIdSrvUrl" client-id="@Model.ClientId" redirect-url="@Model.RedirectUrl" logout-form="@Model.LogoutForm"></p4m-login></li>
<!-- ***** P4M ***** -->
<li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
<li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
</ul>
}
| mit | C# |
61505e2f661813f473b805e2e64494519155ed37 | Use CurrentLocation.ProviderPath to get actual file system path | twsouthwick/poshgit2 | PoshGit2/PoshGit2/Utils/PSCurrentWorkingDirectory.cs | PoshGit2/PoshGit2/Utils/PSCurrentWorkingDirectory.cs | using System.Management.Automation;
namespace PoshGit2
{
class PSCurrentWorkingDirectory : ICurrentWorkingDirectory
{
private SessionState _sessionState;
public PSCurrentWorkingDirectory(SessionState sessionState)
{
_sessionState = sessionState;
}
public string CWD
{
get
{
return _sessionState.Path.CurrentLocation.ProviderPath;
}
}
}
} | using System.Management.Automation;
namespace PoshGit2
{
class PSCurrentWorkingDirectory : ICurrentWorkingDirectory
{
private SessionState _sessionState;
public PSCurrentWorkingDirectory(SessionState sessionState)
{
_sessionState = sessionState;
}
public string CWD
{
get
{
return _sessionState.Path.CurrentFileSystemLocation.Path;
}
}
}
} | mit | C# |
6230b9a06c03355205ac3bdf82a7dcdb4e978955 | fix indexing in the date range rule | ChristianKis/HackathonEpam2016,ChristianKis/HackathonEpam2016 | SlbHackWeek2016/HackathonApi/Models/DateRangeRule.cs | SlbHackWeek2016/HackathonApi/Models/DateRangeRule.cs | using System.Collections.Generic;
using HackathonAPI.Models;
namespace GuessChangeListAuthor.Models
{
public class DateRangeRule : IRule
{
private class DTO
{
public string Author;
public Dictionary<int, int[]> Commits;
public int AllCommits;
}
private readonly Dictionary<string, DTO> data = new Dictionary<string, DTO>();
public void GenerateData(List<ChangeList> allChangeLists)
{
foreach (var changeList in allChangeLists)
{
DTO dto;
var author = changeList.Author;
if (!data.TryGetValue(author, out dto))
{
dto = new DTO { Author = author, Commits = new Dictionary<int, int[]>() };
data.Add(author, dto);
}
var commits = dto.Commits;
int[] values;
var year = changeList.Date.Year;
if (!commits.TryGetValue(year, out values))
{
values = new int[12];
commits.Add(year, values);
}
var month = changeList.Date.Month - 1;
commits[year][month]++;
dto.AllCommits++;
}
}
public int Execute(string author, ChangeList cl)
{
DTO dto;
if (!data.TryGetValue(author, out dto))
return 0;
var year = cl.Date.Year;
int[] values;
if (!dto.Commits.TryGetValue(year, out values))
return 0;
var month = cl.Date.Month - 1;
var chance = 100 * values[month] / dto.AllCommits;
return chance;
}
}
} | using System.Collections.Generic;
using HackathonAPI.Models;
namespace GuessChangeListAuthor.Models
{
public class DateRangeRule : IRule
{
private class DTO
{
public string Author;
public Dictionary<int, int[]> Commits;
public int AllCommits;
}
private readonly Dictionary<string, DTO> data = new Dictionary<string, DTO>();
public void GenerateData(List<ChangeList> allChangeLists)
{
foreach (var changeList in allChangeLists)
{
DTO dto;
var author = changeList.Author;
if (!data.TryGetValue(author, out dto))
{
dto = new DTO { Author = author, Commits = new Dictionary<int, int[]>() };
data.Add(author, dto);
}
var commits = dto.Commits;
int[] values;
var year = changeList.Date.Year;
if (!commits.TryGetValue(year, out values))
{
values = new int[12];
commits.Add(year, values);
}
var month = changeList.Date.Month;
commits[year][month]++;
dto.AllCommits++;
}
}
public int Execute(string author, ChangeList cl)
{
DTO dto;
if (!data.TryGetValue(author, out dto))
return 0;
var year = cl.Date.Year;
int[] values;
if (!dto.Commits.TryGetValue(year, out values))
return 0;
var month = cl.Date.Hour;
var chance = 100 * values[month] / dto.AllCommits;
return chance;
}
}
} | mit | C# |
f7a7d45e87f2d44d4a5e9110ea8eb96bf82df1fe | Add FloatArray and DoubleArray Test | fanoI/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,jp2masa/Cosmos,jp2masa/Cosmos,fanoI/Cosmos,tgiphil/Cosmos,jp2masa/Cosmos,tgiphil/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,fanoI/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos | Tests/Cosmos.Compiler.Tests.Bcl/System/ArrayTests.cs | Tests/Cosmos.Compiler.Tests.Bcl/System/ArrayTests.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cosmos.TestRunner;
namespace Cosmos.Compiler.Tests.Bcl.System
{
class ArrayTests
{
public static void Execute()
{
if (true)
{
byte[] xResult = { 1, 2, 3, 4, 5, 6, 7, 8 };
byte[] xExpectedResult = { 1, 2, 3, 4, 5, 6, 7, 1 };
byte[] xSource = { 1 };
Array.Copy(xSource, 0, xResult, 7, 1);
Assert.IsTrue((xResult[7] == xExpectedResult[7]), "Array.Copy doesn't work: xResult[7] = " + (uint)xResult[7] + " != " + (uint)xExpectedResult[7]);
}
// Single[] Test
float[] xResult = { 1.25, 2.50, 3.51, 4.31, 9.28, 18.56 };
float[] xExpectedResult = { 1.25, 2.598, 5.39, 4.31, 9.28, 18.56 };
float[] xSource = { 0.49382, 1.59034, 2.598, 5.39, 7.48392, 4.2839 };
Array.Copy(xSource, 2, xResult, 1, 2);
Assert.IsTrue((xResult[1] + xResult[2]) == (xExpectedResult[1] + xExpectedResult[2]), "Array.Copy doesn't work with Singles: xResult[1] = " + (uint)xResult[1] + " != " + (uint)xExpectedResult[1] " and xResult[2] = " + (uint)xResult[2] + " != " + (uint)xExpectedResult[2]);
// Double[] Test
double[] xResult = { 0.384, 1.5823, 2.5894, 2.9328539, 3.9201, 4.295 };
double[] xExpectedResult = { 0.384, 1.5823, 2.5894, 95.32815, 3.9201, 4.295 };
double[] xSource = { 95.32815 };
Array.Copy(xSource, 0, xResult, 3, 1);
Assert.IsTrue(xResult[3] == xExpectedResult[3], "Array.Copy doesn't work with Doubles: xResult[1] = " + (uint)xResult[3] + " != " + (uint)xExpectedResult[3]);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cosmos.TestRunner;
namespace Cosmos.Compiler.Tests.Bcl.System
{
class ArrayTests
{
public static void Execute()
{
byte[] xResult = { 1, 2, 3, 4, 5, 6, 7, 8 };
byte[] xExpectedResult = { 1, 2, 3, 4, 5, 6, 7, 1 };
byte[] xSource = { 1 };
Array.Copy(xSource, 0, xResult, 7, 1);
Assert.IsTrue((xResult[7] == xExpectedResult[7]), "Array.Copy doesn't work: xResult[7] = " + (uint)xResult[7] + " != " + (uint)xExpectedResult[7]);
}
}
}
| bsd-3-clause | C# |
feb36d4fb11e879e0e22fe8e5c6867d62722dda1 | fix critical issue | CleberDSantos/UserIdentityProvider,CleberDSantos/UserIdentityProvider,CleberDSantos/UserIdentityProvider,CleberDSantos/UserIdentityProvider | UserIdentity.Api/Infrastructure/Caching/CacheKeys.cs | UserIdentity.Api/Infrastructure/Caching/CacheKeys.cs | namespace UserIdentity.WebUI.Infrastructure.Caching
{
/// <summary>
/// Cache key
/// </summary>
public static class CacheKeys
{
private static string totalNumberOfUsers = "total_number_of_users";
/// <summary>
/// Property Total numer of Users
/// </summary>
public static string TotalNumberOfUsers {
get {
return totalNumberOfUsers;
}
set {
totalNumberOfUsers = value;
}
}
}
} | namespace UserIdentity.WebUI.Infrastructure.Caching
{
public static class CacheKeys
{
public static string TotalNumberOfUsers = "total_number_of_users";
}
} | mit | C# |
978cac4d9dd2b5abba594f853df8d6dc7cac3ae2 | Remove extra type from AlterIndexTable extension (#295) | sebastienros/yessql | src/YesSql.Core/Sql/SchemaBuilderExtensions.cs | src/YesSql.Core/Sql/SchemaBuilderExtensions.cs | using System;
using System.Collections.Generic;
using System.Text;
using YesSql.Sql.Schema;
namespace YesSql.Sql
{
public static class SchemaBuilderExtensions
{
public static IEnumerable<string> CreateSql(this ICommandInterpreter builder, ISchemaCommand command)
{
return builder.CreateSql(new[] { command });
}
public static ISchemaBuilder CreateReduceIndexTable<T>(this ISchemaBuilder builder, Action<ICreateTableCommand> table, string collection = null)
{
return builder.CreateReduceIndexTable(typeof(T), table, collection);
}
public static ISchemaBuilder DropReduceIndexTable<T>(this ISchemaBuilder builder, string collection = null)
{
return builder.DropReduceIndexTable(typeof(T), collection);
}
public static ISchemaBuilder CreateMapIndexTable<T>(this ISchemaBuilder builder, Action<ICreateTableCommand> table, string collection = null)
{
return builder.CreateMapIndexTable(typeof(T), table, collection);
}
public static ISchemaBuilder DropMapIndexTable<T>(this ISchemaBuilder builder, string collection = null)
{
return builder.DropMapIndexTable(typeof(T), collection);
}
public static ISchemaBuilder AlterIndexTable<T>(this ISchemaBuilder builder, Action<IAlterTableCommand> table, string collection = null)
{
return builder.AlterIndexTable(typeof(T), table, collection);
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using YesSql.Sql.Schema;
namespace YesSql.Sql
{
public static class SchemaBuilderExtensions
{
public static IEnumerable<string> CreateSql(this ICommandInterpreter builder, ISchemaCommand command)
{
return builder.CreateSql(new[] { command });
}
public static ISchemaBuilder CreateReduceIndexTable<T>(this ISchemaBuilder builder, Action<ICreateTableCommand> table, string collection = null)
{
return builder.CreateReduceIndexTable(typeof(T), table, collection);
}
public static ISchemaBuilder DropReduceIndexTable<T>(this ISchemaBuilder builder, string collection = null)
{
return builder.DropReduceIndexTable(typeof(T), collection);
}
public static ISchemaBuilder CreateMapIndexTable<T>(this ISchemaBuilder builder, Action<ICreateTableCommand> table, string collection = null)
{
return builder.CreateMapIndexTable(typeof(T), table, collection);
}
public static ISchemaBuilder DropMapIndexTable<T>(this ISchemaBuilder builder, string collection = null)
{
return builder.DropMapIndexTable(typeof(T), collection);
}
public static ISchemaBuilder AlterIndexTable<T>(this ISchemaBuilder builder, Type indexType, Action<IAlterTableCommand> table, string collection = null)
{
return builder.AlterIndexTable(typeof(T), table, collection);
}
}
}
| mit | C# |
b90640f1fe10920d7f397eba1c8eb018eff9f37b | Update SortBinaryArray.cs | vishipayyallore/CSharp-DotNet-Core-Samples | LearningDesignPatterns/Source/Alogithms/LogicPrograms/Logics/SortBinaryArray.cs | LearningDesignPatterns/Source/Alogithms/LogicPrograms/Logics/SortBinaryArray.cs | using LogicPrograms.Interfaces;
using static System.Console;
namespace LogicPrograms.Logics
{
public class SortBinaryArray : ISortBinaryArray
{
public void SortArray(int[] arrayItems)
{
var oneCount = 0;
foreach (var item in arrayItems)
{
if (item == 1)
{
oneCount++;
continue;
}
Write($"0 ");
}
for (var counter = 0; counter < oneCount; counter++)
{
Write($"1 ");
}
}
}
}
| using LogicPrograms.Interfaces;
using static System.Console;
namespace LogicPrograms.Logics
{
public class SortBinaryArray : ISortBinaryArray
{
public void SortArray(int[] arrayItems)
{
var oneCount = 0;
foreach (var item in arrayItems)
{
if (item == 1)
{
oneCount++;
continue;
}
Write($"{item} ");
}
for (var counter = 0; counter < oneCount; counter++)
{
Write($"1 ");
}
}
}
}
| apache-2.0 | C# |
cdfc7f5e86fb06431368e2d3206c262295a8b5b9 | Fix test type name to match file. | damianh/Cedar.EventStore,SQLStreamStore/SQLStreamStore,SQLStreamStore/SQLStreamStore | src/SqlStreamStore.Tests/StreamEventTests.cs | src/SqlStreamStore.Tests/StreamEventTests.cs | namespace SqlStreamStore
{
using System;
using System.Threading.Tasks;
using Shouldly;
using SqlStreamStore.Streams;
using Xunit;
public class StreamEventTests
{
[Fact]
public async Task Can_deserialize()
{
var message = new StreamMessage(
"stream",
Guid.NewGuid(),
1,
2,
DateTime.UtcNow,
"type",
"\"meta\"", "\"data\"");
(await message.GetJsonDataAs<string>()).ShouldBe("data");
message.JsonMetadataAs<string>().ShouldBe("meta");
}
}
} | namespace SqlStreamStore
{
using System;
using System.Threading.Tasks;
using Shouldly;
using SqlStreamStore.Streams;
using Xunit;
public class messageTests
{
[Fact]
public async Task Can_deserialize()
{
var message = new StreamMessage(
"stream",
Guid.NewGuid(),
1,
2,
DateTime.UtcNow,
"type",
"\"meta\"", "\"data\"");
(await message.GetJsonDataAs<string>()).ShouldBe("data");
message.JsonMetadataAs<string>().ShouldBe("meta");
}
}
} | mit | C# |
5cc125bc79b017ec5d7632224552be090027f8e6 | Clarify a line of code | jonathanvdc/flame-llvm,jonathanvdc/flame-llvm,jonathanvdc/flame-llvm | stdlib/corlib/Runtime.InteropServices/Marshal.cs | stdlib/corlib/Runtime.InteropServices/Marshal.cs | using System.Primitives.InteropServices;
namespace System.Runtime.InteropServices
{
/// <summary>
/// Provides facilities for interacting with unmanaged code.
/// </summary>
public static class Marshal
{
/// <summary>
/// Allocates unmanaged memory.
/// </summary>
/// <param name="size">The number of bytes to allocate.</param>
public static IntPtr AllocHGlobal(int size)
{
return (IntPtr)Memory.AllocHGlobal(size);
}
/// <summary>
/// Deallocates unmanaged memory.
/// </summary>
/// <param name="ptr">The number of bytes to deallocate.</param>
public static void FreeHGlobal(IntPtr ptr)
{
Memory.FreeHGlobal((void*)ptr);
}
/// <summary>
/// Copies all characters up to the first null character from an unmanaged UTF-8 string
/// to a UTF-16 string.
/// </summary>
/// <param name="ptr">The pointer to the UTF-8 string.</param>
/// <returns>A UTF-16 string if <c>ptr</c> is not <c>IntPtr.Zero</c>; otherwise, <c>null</c>.</returns>
public static string PtrToStringAnsi(IntPtr ptr)
{
if (ptr.ToPointer() == (void*)null)
return null;
else
return String.FromCString((byte*)ptr.ToPointer());
}
/// <summary>
/// Allocates an unmanaged buffer and fills it with this string's contents,
/// re-encoded as UTF-8. The resulting buffer is terminated by the null
/// terminator character. The caller is responsible for freeing the buffer
/// when it's done using it.
/// </summary>
/// <param name="str">The UTF-16 string to convert to a UTF-8 string.</param>
/// <returns>A C-style string for which the caller is responsible.</returns>
public static IntPtr StringToHGlobalAnsi(string str)
{
if (str == null)
return new IntPtr((void*)null);
else
return new IntPtr(String.ToCString(str));
}
}
} | using System.Primitives.InteropServices;
namespace System.Runtime.InteropServices
{
/// <summary>
/// Provides facilities for interacting with unmanaged code.
/// </summary>
public static class Marshal
{
/// <summary>
/// Allocates unmanaged memory.
/// </summary>
/// <param name="size">The number of bytes to allocate.</param>
public static IntPtr AllocHGlobal(int size)
{
return (IntPtr)Memory.AllocHGlobal(size);
}
/// <summary>
/// Deallocates unmanaged memory.
/// </summary>
/// <param name="ptr">The number of bytes to deallocate.</param>
public static void FreeHGlobal(IntPtr ptr)
{
Memory.FreeHGlobal((void*)ptr);
}
/// <summary>
/// Copies all characters up to the first null character from an unmanaged UTF-8 string
/// to a UTF-16 string.
/// </summary>
/// <param name="ptr">The pointer to the UTF-8 string.</param>
/// <returns>A UTF-16 string if <c>ptr</c> is not <c>IntPtr.Zero</c>; otherwise, <c>null</c>.</returns>
public static string PtrToStringAnsi(IntPtr ptr)
{
if (ptr.ToPointer() == (void*)null)
return null;
else
return String.FromCString((byte*)(void*)ptr);
}
/// <summary>
/// Allocates an unmanaged buffer and fills it with this string's contents,
/// re-encoded as UTF-8. The resulting buffer is terminated by the null
/// terminator character. The caller is responsible for freeing the buffer
/// when it's done using it.
/// </summary>
/// <param name="str">The UTF-16 string to convert to a UTF-8 string.</param>
/// <returns>A C-style string for which the caller is responsible.</returns>
public static IntPtr StringToHGlobalAnsi(string str)
{
if (str == null)
return new IntPtr((void*)null);
else
return new IntPtr(String.ToCString(str));
}
}
} | mit | C# |
3aefd502394a1c30ff301562795abb64ddb453a3 | Fix osu! mode adding combos twice. | ppy/osu,Frontear/osuKyzer,peppy/osu-new,naoey/osu,johnneijzen/osu,2yangk23/osu,peppy/osu,NeoAdonis/osu,Drezi126/osu,EVAST9919/osu,tacchinotacchi/osu,naoey/osu,DrabWeb/osu,ZLima12/osu,2yangk23/osu,nyaamara/osu,RedNesto/osu,johnneijzen/osu,naoey/osu,Nabile-Rahmani/osu,osu-RP/osu-RP,ppy/osu,smoogipoo/osu,smoogipoo/osu,DrabWeb/osu,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,ZLima12/osu,Damnae/osu,UselessToucan/osu,EVAST9919/osu,peppy/osu,NeoAdonis/osu,DrabWeb/osu,smoogipooo/osu,peppy/osu,ppy/osu,smoogipoo/osu | osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs | osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Judgements;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Scoring;
using osu.Game.Modes.UI;
namespace osu.Game.Modes.Osu.Scoring
{
internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject, OsuJudgement>
{
public OsuScoreProcessor()
{
}
public OsuScoreProcessor(HitRenderer<OsuHitObject, OsuJudgement> hitRenderer)
: base(hitRenderer)
{
}
protected override void Reset()
{
base.Reset();
Health.Value = 1;
Accuracy.Value = 1;
}
protected override void OnNewJudgement(OsuJudgement judgement)
{
int score = 0;
int maxScore = 0;
foreach (var j in Judgements)
{
score += j.ScoreValue;
maxScore += j.MaxScoreValue;
}
TotalScore.Value = score;
Accuracy.Value = (double)score / maxScore;
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Judgements;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Scoring;
using osu.Game.Modes.UI;
namespace osu.Game.Modes.Osu.Scoring
{
internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject, OsuJudgement>
{
public OsuScoreProcessor()
{
}
public OsuScoreProcessor(HitRenderer<OsuHitObject, OsuJudgement> hitRenderer)
: base(hitRenderer)
{
}
protected override void Reset()
{
base.Reset();
Health.Value = 1;
Accuracy.Value = 1;
}
protected override void OnNewJudgement(OsuJudgement judgement)
{
if (judgement != null)
{
switch (judgement.Result)
{
case HitResult.Hit:
Combo.Value++;
Health.Value += 0.1f;
break;
case HitResult.Miss:
Combo.Value = 0;
Health.Value -= 0.2f;
break;
}
}
int score = 0;
int maxScore = 0;
foreach (var j in Judgements)
{
score += j.ScoreValue;
maxScore += j.MaxScoreValue;
}
TotalScore.Value = score;
Accuracy.Value = (double)score / maxScore;
}
}
}
| mit | C# |
79f6cc30aa02bd5b941621be5faa05422fd0b3a5 | Comment blocks support | MirekVales/FinesSE,MirekVales/FinesSE | FinesSE/FinesSE.Launcher/Formats/FitNessePSVFormat.cs | FinesSE/FinesSE.Launcher/Formats/FitNessePSVFormat.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace FinesSE.Launcher.Formats
{
public class FitNessePSVFormat : IFormatParser
{
public TableFormat Format => TableFormat.FitNessePSV;
public string Parse(string input)
=> string.Join(Environment.NewLine, GetTables(input));
private IEnumerable<string> GetTables(string pipeSeparatedFormat)
{
foreach (var tableSegment in Regex.Split(pipeSeparatedFormat, @"\n\n"))
yield return $"<table>{GetTable(tableSegment)}</table>";
}
private string GetTable(string tableSegment)
=> string.Join(
Environment.NewLine,
Regex.Split(tableSegment, @"\n")
.Select(r => r.Trim())
.Select(GetRow)
);
private string GetRow(string row)
{
var builder = new StringBuilder("<tr>");
const string RowPattern = @"((?<=\|)((\!\-)(.*?)(\-\!))|([^|]+?)(?=\|))|((?<=\|)(?=\|))";
foreach (Match match in Regex.Matches(row, RowPattern))
builder.Append($"<td>{match.Value}</td>");
builder.Append("</tr>");
builder.Replace("!-", "");
builder.Replace("-!", "");
RemoveCommentedOutLines(ref builder);
return builder.ToString();
}
private void RemoveCommentedOutLines(ref StringBuilder builder)
{
const string CommentedOutLinePattern = @"(?m)^\#.*\n";
foreach (Match match in Regex.Matches(builder.ToString(), CommentedOutLinePattern))
builder.Replace(match.Value, "");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace FinesSE.Launcher.Formats
{
public class FitNessePSVFormat : IFormatParser
{
public TableFormat Format => TableFormat.FitNessePSV;
public string Parse(string input)
=> string.Join(Environment.NewLine, GetTables(input));
private IEnumerable<string> GetTables(string pipeSeparatedFormat)
{
foreach (var tableSegment in Regex.Split(pipeSeparatedFormat, @"\n\n"))
yield return $"<table>{GetTable(tableSegment)}</table>";
}
private string GetTable(string tableSegment)
=> string.Join(
Environment.NewLine,
Regex.Split(tableSegment, @"\n")
.Select(r => r.Trim())
.Select(GetRow)
);
private string GetRow(string row)
{
var builder = new StringBuilder("<tr>");
const string RowPattern = @"((?<=\|)((\!\-)(.*?)(\-\!))|([^|]+?)(?=\|))|((?<=\|)(?=\|))";
foreach (Match match in Regex.Matches(row, RowPattern))
builder.Append($"<td>{match.Value}</td>");
builder.Append("</tr>");
builder.Replace("!-", "");
builder.Replace("-!", "");
return builder.ToString();
}
}
}
| apache-2.0 | C# |
6e42ae51e54a0b5c0b18a033bbe33f45f4ea341c | Fix warnings. | JohanLarsson/Gu.Reactive | Gu.Reactive.Benchmarks/Benchmarks/MinTrackerSimple.cs | Gu.Reactive.Benchmarks/Benchmarks/MinTrackerSimple.cs | namespace Gu.Reactive.Benchmarks
{
using System;
using System.Collections.ObjectModel;
using System.Linq;
using BenchmarkDotNet.Attributes;
[BenchmarkDotNet.Attributes.MemoryDiagnoser]
public class MinTrackerSimple
{
private readonly ObservableCollection<int> ints1 = new ObservableBatchCollection<int>();
private readonly ObservableCollection<int> ints2 = new ObservableBatchCollection<int>();
[GlobalSetup]
public void SetupData()
{
foreach (var ints in new[] { this.ints1, this.ints2 })
{
ints.Clear();
for (int i = 0; i < 1000; i++)
{
ints.Add(i);
}
}
}
[Benchmark(Baseline = true)]
public int? Linq()
{
var min = this.ints1.Min(x => x);
Update(this.ints1);
return Math.Min(min, this.ints1.Min(x => x));
}
[Benchmark]
public int? Tracker()
{
using (var tracker = this.ints2.TrackMin())
{
Update(this.ints2);
return tracker.Value;
}
}
private static void Update(ObservableCollection<int> ints)
{
if (ints.Count > 1000)
{
ints.RemoveAt(ints.Count - 1);
}
else
{
ints.Add(5);
}
}
}
}
| namespace Gu.Reactive.Benchmarks
{
using System;
using System.Collections.ObjectModel;
using System.Linq;
using BenchmarkDotNet.Attributes;
[BenchmarkDotNet.Attributes.MemoryDiagnoser]
public class MinTrackerSimple
{
private ObservableCollection<int> ints1 = new ObservableBatchCollection<int>();
private ObservableCollection<int> ints2 = new ObservableBatchCollection<int>();
[GlobalSetup]
public void SetupData()
{
foreach (var ints in new[] { this.ints1, this.ints2 })
{
ints.Clear();
for (int i = 0; i < 1000; i++)
{
ints.Add(i);
}
}
}
[Benchmark(Baseline = true)]
public int? Linq()
{
var min = this.ints1.Min(x => x);
Update(this.ints1);
return Math.Min(min, this.ints1.Min(x => x));
}
[Benchmark]
public int? Tracker()
{
using (var tracker = this.ints2.TrackMin())
{
Update(this.ints2);
return tracker.Value;
}
}
private static void Update(ObservableCollection<int> ints)
{
if (ints.Count > 1000)
{
ints.RemoveAt(ints.Count - 1);
}
else
{
ints.Add(5);
}
}
}
}
| mit | C# |
abbddeefc1eee0bc8c0e8b2b488aaaf0f681c3aa | Make the SoapFault class public | EULexNET/EULex.NET,EULexNET/EULex.NET | src/EULex/SimpleSOAPClient/Models/SoapFault.cs | src/EULex/SimpleSOAPClient/Models/SoapFault.cs | #region License
// The MIT License (MIT)
//
// Copyright (c) 2016 João Simões
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion
namespace EULex.SimpleSOAPClient.Models
{
using System.Xml.Linq;
using System.Xml.Serialization;
/// <summary>
/// Represents a SOAP Fault
/// </summary>
[XmlRoot ("Fault", Namespace = Constant.Namespace.SoapSchemasSoapEnvelope)]
public class SoapFault
{
/// <summary>
/// The fault code
/// </summary>
[XmlElement ("faultcode", Namespace = "")]
public string Code { get; set; }
/// <summary>
/// The fault string
/// </summary>
[XmlElement ("faultstring", Namespace = "")]
public string String { get; set; }
/// <summary>
/// The fault actor
/// </summary>
[XmlElement ("faultactor", Namespace = "")]
public string Actor { get; set; }
/// <summary>
/// The fault detail
/// </summary>
[XmlAnyElement ("detail", Namespace = "")]
public XElement Detail { get; set; }
}
}
| #region License
// The MIT License (MIT)
//
// Copyright (c) 2016 João Simões
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion
namespace EULex.SimpleSOAPClient.Models
{
using System.Xml.Linq;
using System.Xml.Serialization;
/// <summary>
/// Represents a SOAP Fault
/// </summary>
[XmlRoot ("Fault", Namespace = Constant.Namespace.SoapSchemasSoapEnvelope)]
internal class SoapFault
{
/// <summary>
/// The fault code
/// </summary>
[XmlElement ("faultcode", Namespace = "")]
public string Code { get; set; }
/// <summary>
/// The fault string
/// </summary>
[XmlElement ("faultstring", Namespace = "")]
public string String { get; set; }
/// <summary>
/// The fault actor
/// </summary>
[XmlElement ("faultactor", Namespace = "")]
public string Actor { get; set; }
/// <summary>
/// The fault detail
/// </summary>
[XmlAnyElement ("detail", Namespace = "")]
public XElement Detail { get; set; }
}
}
| mit | C# |
14e9569cfa28ea78a851b05c54d2f4be41d7960d | fix NullReferenceException issues with RegistryBackedDictionary | JLospinoso/beamgun | BeamgunApp/Models/RegistryBackedDictionary.cs | BeamgunApp/Models/RegistryBackedDictionary.cs | using System;
using Microsoft.Win32;
namespace BeamgunApp.Models
{
public interface IDynamicDictionary
{
Guid GetWithDefault(string key, Guid defaultValue);
bool GetWithDefault(string key, bool defaultValue);
string GetWithDefault(string key, string defaultValue);
uint GetWithDefault(string key, uint defaultValue);
double GetWithDefault(string key, double defaultValue);
void Set<T>(string key, T value);
}
public class RegistryBackedDictionary : IDynamicDictionary
{
public Action<string> BadCastReport;
public const string BeamgunBaseKey = "HKEY_CURRENT_USER\\SOFTWARE\\Beamgun";
public string GetWithDefault(string key, string defaultValue)
{
try
{
return (string)Registry.GetValue(BeamgunBaseKey, key, defaultValue);
}
catch (InvalidCastException)
{
BadCastReport($"Could not parse {BeamgunBaseKey} {key}. Using default {defaultValue}.");
return defaultValue;
}
}
public double GetWithDefault(string key, double defaultValue)
{
return double.TryParse(Registry.GetValue(BeamgunBaseKey, key, defaultValue)?.ToString(), out var result)
? result
: defaultValue;
}
public uint GetWithDefault(string key, uint defaultValue)
{
return uint.TryParse(Registry.GetValue(BeamgunBaseKey, key, defaultValue)?.ToString(), out var result)
? result
: defaultValue;
}
public Guid GetWithDefault(string key, Guid defaultValue)
{
return Guid.TryParse(Registry.GetValue(BeamgunBaseKey, key, defaultValue)?.ToString(), out var result)
? result
: defaultValue;
}
public bool GetWithDefault(string key, bool defaultValue)
{
return Registry.GetValue(BeamgunBaseKey, key, defaultValue ? "True" : "False").ToString() == "True";
}
public void Set<T>(string key, T value)
{
Registry.SetValue(BeamgunBaseKey, key, value);
}
}
}
| using System;
using Microsoft.Win32;
namespace BeamgunApp.Models
{
public interface IDynamicDictionary
{
Guid GetWithDefault(string key, Guid defaultValue);
bool GetWithDefault(string key, bool defaultValue);
string GetWithDefault(string key, string defaultValue);
uint GetWithDefault(string key, uint defaultValue);
double GetWithDefault(string key, double defaultValue);
void Set<T>(string key, T value);
}
public class RegistryBackedDictionary : IDynamicDictionary
{
public Action<string> BadCastReport;
public const string BeamgunBaseKey = "HKEY_CURRENT_USER\\SOFTWARE\\Beamgun";
public string GetWithDefault(string key, string defaultValue)
{
try
{
return (string)Registry.GetValue(BeamgunBaseKey, key, defaultValue);
}
catch (InvalidCastException)
{
BadCastReport($"Could not parse {BeamgunBaseKey} {key}. Using default {defaultValue}.");
return defaultValue;
}
}
public double GetWithDefault(string key, double defaultValue)
{
double result;
return double.TryParse(Registry.GetValue(BeamgunBaseKey, key, defaultValue).ToString(), out result)
? result
: defaultValue;
}
public uint GetWithDefault(string key, uint defaultValue)
{
uint result;
return uint.TryParse(Registry.GetValue(BeamgunBaseKey, key, defaultValue).ToString(), out result)
? result
: defaultValue;
}
public Guid GetWithDefault(string key, Guid defaultValue)
{
Guid result;
return Guid.TryParse(Registry.GetValue(BeamgunBaseKey, key, defaultValue).ToString(), out result)
? result
: defaultValue;
}
public bool GetWithDefault(string key, bool defaultValue)
{
return Registry.GetValue(BeamgunBaseKey, key, defaultValue ? "True" : "False").ToString() == "True";
}
public void Set<T>(string key, T value)
{
Registry.SetValue(BeamgunBaseKey, key, value);
}
}
}
| agpl-3.0 | C# |
b2181fc6e277ee048e9c6e5e7a6c3159425a8970 | Use expression-bodied members | EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an | A-vs-An/A-vs-An-DotNet/Internals/Ratio.cs | A-vs-An/A-vs-An-DotNet/Internals/Ratio.cs | namespace AvsAnLib.Internals {
/// <summary>
/// The ratio of a's vs. an's for a given prefix
/// </summary>
public struct Ratio {
public int Occurence, AminAnDiff;
public int aCount {
get => (Occurence + AminAnDiff) / 2;
set {
var old_anCount = anCount;
Occurence = value + old_anCount;
AminAnDiff = value - old_anCount;
}
}
public int anCount {
get => (Occurence - AminAnDiff) / 2;
set {
var old_aCount = aCount;
Occurence = old_aCount + value;
AminAnDiff = old_aCount - value;
}
}
public void IncA() {
Occurence++;
AminAnDiff++;
}
public void IncAn() {
Occurence++;
AminAnDiff--;
}
public bool isSet => Occurence != 0;
public int Quality() {
if (AminAnDiff == 0)
return 0;
return (int)(AminAnDiff * (long) AminAnDiff / Occurence);
}
}
} | namespace AvsAnLib.Internals {
/// <summary>
/// The ratio of a's vs. an's for a given prefix
/// </summary>
public struct Ratio {
public int Occurence, AminAnDiff;
public int aCount {
get { return (Occurence + AminAnDiff) / 2; }
set {
var old_anCount = anCount;
Occurence = value + old_anCount;
AminAnDiff = value - old_anCount;
}
}
public int anCount {
get { return (Occurence - AminAnDiff) / 2; }
set {
var old_aCount = aCount;
Occurence = old_aCount + value;
AminAnDiff = old_aCount - value;
}
}
public void IncA() {
Occurence++;
AminAnDiff++;
}
public void IncAn() {
Occurence++;
AminAnDiff--;
}
public bool isSet { get { return Occurence != 0; } }
public int Quality() {
if (AminAnDiff == 0)
return 0;
return (int)(AminAnDiff * (long) AminAnDiff / Occurence);
}
}
} | apache-2.0 | C# |
c2b7cfeeeefbf14d6b6da3d1ad4c5c786b652d46 | Sort usings | jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,dotnet/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,mavasani/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn | src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs | src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations
{
public class KeywordRecommenderTests : RecommenderTests
{
private static readonly Dictionary<SyntaxKind, AbstractSyntacticSingleKeywordRecommender> s_recommenderMap = new(SyntaxFacts.EqualityComparer);
protected override string KeywordText { get; }
static KeywordRecommenderTests()
{
foreach (var recommenderType in typeof(AbstractSyntacticSingleKeywordRecommender).Assembly.GetTypes())
{
if (recommenderType.IsSubclassOf(typeof(AbstractSyntacticSingleKeywordRecommender)))
{
try
{
var recommender = Activator.CreateInstance(recommenderType);
var field = recommenderType.GetField(nameof(AbstractSyntacticSingleKeywordRecommender.KeywordKind), BindingFlags.Public | BindingFlags.Instance);
var kind = (SyntaxKind)field.GetValue(recommender);
s_recommenderMap.Add(kind, (AbstractSyntacticSingleKeywordRecommender)recommender);
}
catch
{
}
}
}
}
protected KeywordRecommenderTests()
{
var name = GetType().Name;
var kindName = name[..^"RecommenderTests".Length]; // e.g. ForEachKeywordRecommenderTests -> ForEachKeyword
var field = typeof(SyntaxKind).GetField(kindName);
var kind = (SyntaxKind)field.GetValue(null);
KeywordText = SyntaxFacts.GetText(kind);
s_recommenderMap.TryGetValue(kind, out var recommender);
Assert.NotNull(recommender);
RecommendKeywordsAsync = (position, context) => Task.FromResult(recommender.GetTestAccessor().RecommendKeywords(position, context));
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders;
using System.Reflection;
using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis.CSharp;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations
{
public class KeywordRecommenderTests : RecommenderTests
{
private static readonly Dictionary<SyntaxKind, AbstractSyntacticSingleKeywordRecommender> s_recommenderMap = new(SyntaxFacts.EqualityComparer);
protected override string KeywordText { get; }
static KeywordRecommenderTests()
{
foreach (var recommenderType in typeof(AbstractSyntacticSingleKeywordRecommender).Assembly.GetTypes())
{
if (recommenderType.IsSubclassOf(typeof(AbstractSyntacticSingleKeywordRecommender)))
{
try
{
var recommender = Activator.CreateInstance(recommenderType);
var field = recommenderType.GetField(nameof(AbstractSyntacticSingleKeywordRecommender.KeywordKind), BindingFlags.Public | BindingFlags.Instance);
var kind = (SyntaxKind)field.GetValue(recommender);
s_recommenderMap.Add(kind, (AbstractSyntacticSingleKeywordRecommender)recommender);
}
catch
{
}
}
}
}
protected KeywordRecommenderTests()
{
var name = GetType().Name;
var kindName = name[..^"RecommenderTests".Length]; // e.g. ForEachKeywordRecommenderTests -> ForEachKeyword
var field = typeof(SyntaxKind).GetField(kindName);
var kind = (SyntaxKind)field.GetValue(null);
KeywordText = SyntaxFacts.GetText(kind);
s_recommenderMap.TryGetValue(kind, out var recommender);
Assert.NotNull(recommender);
RecommendKeywordsAsync = (position, context) => Task.FromResult(recommender.GetTestAccessor().RecommendKeywords(position, context));
}
}
}
| mit | C# |
47010a1cf7b4524ce919f59474aaac0a58ccea16 | Test for migrations up to date. | schemavolution/schemavolution,schemavolution/schemavolution | Mathematicians.UnitTests/SqlGeneratorTests.cs | Mathematicians.UnitTests/SqlGeneratorTests.cs | using FluentAssertions;
using MergableMigrations.EF6;
using MergableMigrations.Specification;
using MergableMigrations.Specification.Implementation;
using System;
using System.Linq;
using Xunit;
namespace Mathematicians.UnitTests
{
public class SqlGeneratorTests
{
[Fact]
public void CanGenerateSql()
{
var migrations = new Migrations();
var migrationHistory = new MigrationHistory();
var sqlGenerator = new SqlGenerator(migrations, migrationHistory);
var sql = sqlGenerator.Generate();
sql.Length.Should().Be(3);
sql[0].Should().Be("CREATE DATABASE [Mathematicians]");
sql[1].Should().Be("CREATE TABLE [Mathematicians].[dbo].[Mathematician]");
sql[2].Should().Be("CREATE TABLE [Mathematicians].[dbo].[Contribution]");
}
[Fact]
public void GeneratesNoSqlWhenUpToDate()
{
var migrations = new Migrations();
var migrationHistory = GivenCompleteMigrationHistory(migrations);
var sqlGenerator = new SqlGenerator(migrations, migrationHistory);
var sql = sqlGenerator.Generate();
sql.Length.Should().Be(0);
}
private MigrationHistory GivenCompleteMigrationHistory(Migrations migrations)
{
var model = new ModelSpecification();
migrations.AddMigrations(model);
return model.MigrationHistory;
}
}
}
| using FluentAssertions;
using MergableMigrations.EF6;
using MergableMigrations.Specification.Implementation;
using System;
using System.Linq;
using Xunit;
namespace Mathematicians.UnitTests
{
public class SqlGeneratorTests
{
[Fact]
public void CanGenerateSql()
{
var migrations = new Migrations();
var migrationHistory = new MigrationHistory();
var sqlGenerator = new SqlGenerator(migrations, migrationHistory);
var sql = sqlGenerator.Generate();
sql.Length.Should().Be(3);
sql[0].Should().Be("CREATE DATABASE [Mathematicians]");
sql[1].Should().Be("CREATE TABLE [Mathematicians].[dbo].[Mathematician]");
sql[2].Should().Be("CREATE TABLE [Mathematicians].[dbo].[Contribution]");
}
}
}
| mit | C# |
f48e1fe9c7c7ed2243fb590d6e64e3984a8a8306 | Update GateController.cs | caiRanN/SeminarCrazyLasersGame | Project/Assets/Scripts/Game/GateController.cs | Project/Assets/Scripts/Game/GateController.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HKUECT;
/// <summary>
/// Example of Isadora to Unity communication
/// Handles the opening of laser door when isadora sends a message
/// </summary>
public class GateController : MonoBehaviour {
public OSCReceiver receiver;
public bool requiresAudience = false;
[Range(0, 12)]
public int oscValue;
[Range(0, 12)]
public int audienceOscValue;
private void Update() {
GateHandler();
}
private bool ShouldOpenDoor(float value) {
return (value == 1);
return (value == 0);
}
/// <summary>
/// Check if the gate requires multiple buttons to be pressed simultaneously
/// and open door if the value returns true
/// </summary>
private void GateHandler() {
bool playerOpenGate = ShouldOpenDoor((float)receiver.GetValue(oscValue));
bool audienceOpenGate = ShouldOpenDoor((float)receiver.GetValue(audienceOscValue));
if(!requiresAudience) {
if(playerOpenGate) {
gameObject.SetActive(false);
}
} else {
if(playerOpenGate && audienceOpenGate) {
gameObject.SetActive(false);
}
}
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HKUECT;
public class GateController : MonoBehaviour {
public OSCReceiver receiver;
public bool requiresAudience = false;
[Range(0, 12)]
public int oscValue;
[Range(0, 12)]
public int audienceOscValue;
private void Update() {
GateHandler();
}
private bool ShouldOpenDoor(float value) {
return (value == 1);
return (value == 0);
}
/// <summary>
/// Check if the gate requires multiple buttons to be pressed simultaneously
/// and open door if the value returns true
/// </summary>
private void GateHandler() {
bool playerOpenGate = ShouldOpenDoor((float)receiver.GetValue(oscValue));
bool audienceOpenGate = ShouldOpenDoor((float)receiver.GetValue(audienceOscValue));
if(!requiresAudience) {
if(playerOpenGate) {
gameObject.SetActive(false);
}
} else {
if(playerOpenGate && audienceOpenGate) {
gameObject.SetActive(false);
}
}
}
}
| mit | C# |
87c6ba8a52f2183ba51a97a7a0ef92bb2f6b44fd | split IDocumentStrategy in two roles | modulexcite/lokad-cqrs | Cqrs.Portable/AtomicStorage/IDocumentStrategy.cs | Cqrs.Portable/AtomicStorage/IDocumentStrategy.cs | #region (c) 2010-2012 Lokad - CQRS- New BSD License
// Copyright (c) Lokad 2010-2012, http://www.lokad.com
// This code is released as Open Source under the terms of the New BSD Licence
#endregion
using System;
using System.IO;
namespace Lokad.Cqrs.AtomicStorage
{
public interface IDocumentStrategy :
IDocumentLocationStrategy,
IDocumentSerializationStrategy
{
}
public interface IDocumentSerializationStrategy
{
void Serialize<TEntity>(TEntity entity, Stream stream);
TEntity Deserialize<TEntity>(Stream stream);
}
public interface IDocumentLocationStrategy
{
string GetEntityBucket<TEntity>();
string GetEntityLocation(Type entity, object key);
}
} | #region (c) 2010-2012 Lokad - CQRS- New BSD License
// Copyright (c) Lokad 2010-2012, http://www.lokad.com
// This code is released as Open Source under the terms of the New BSD Licence
#endregion
using System;
using System.IO;
namespace Lokad.Cqrs.AtomicStorage
{
public interface IDocumentStrategy
{
string GetEntityBucket<TEntity>();
string GetEntityLocation(Type entity, object key);
void Serialize<TEntity>(TEntity entity, Stream stream);
TEntity Deserialize<TEntity>(Stream stream);
}
} | bsd-3-clause | C# |
b8c5b18fb61b394bfed594fc71137a17ea36015c | Change random to avoid identical seed | criteo/zipkin4net,criteo/zipkin4net | Criteo.Profiling.Tracing/Utils/RandomUtils.cs | Criteo.Profiling.Tracing/Utils/RandomUtils.cs | using System;
using System.Threading;
namespace Criteo.Profiling.Tracing.Utils
{
/// <summary>
/// Thread-safe random long generator.
///
/// See "Correct way to use Random in multithread application"
/// http://stackoverflow.com/questions/19270507/correct-way-to-use-random-in-multithread-application
/// </summary>
internal static class RandomUtils
{
private static int _seed = Guid.NewGuid().GetHashCode();
private static readonly ThreadLocal<Random> LocalRandom = new ThreadLocal<Random>(() => new Random(Interlocked.Increment(ref _seed)));
public static long NextLong()
{
var buffer = new byte[8];
LocalRandom.Value.NextBytes(buffer);
return BitConverter.ToInt64(buffer, 0);
}
}
}
| using System;
using System.Threading;
namespace Criteo.Profiling.Tracing.Utils
{
/// <summary>
/// Thread-safe random long generator.
///
/// See "Correct way to use Random in multithread application"
/// http://stackoverflow.com/questions/19270507/correct-way-to-use-random-in-multithread-application
/// </summary>
internal static class RandomUtils
{
private static int seed = Environment.TickCount;
private static readonly ThreadLocal<Random> rand = new ThreadLocal<Random>(() => new Random(Interlocked.Increment(ref seed)));
public static long NextLong()
{
return (long)((rand.Value.NextDouble() * 2.0 - 1.0) * long.MaxValue);
}
}
}
| apache-2.0 | C# |
ae66da41009860cfdc94bb97f677e1ab7de64d84 | Fix missing static declaration | evicertia/HermaFx,evicertia/HermaFx,evicertia/HermaFx | HermaFx.Rebus/SetDateOnSentMessagesExtensions.cs | HermaFx.Rebus/SetDateOnSentMessagesExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rebus;
using Rebus.Configuration;
namespace HermaFx.Rebus
{
public static class SetDateOnSentMessagesExtensions
{
public static string MessageDataHeader = "message-date";
private static void SetDateOnMessageSent(IBus bus, string destination, object message)
{
bus.AttachHeader(message, MessageDataHeader, DateTime.UtcNow.ToString("o"));
}
public static RebusConfigurer SetDateOnSentMessages(this RebusConfigurer configurer)
{
configurer.Events(e =>
{
e.MessageSent += SetDateOnMessageSent;
});
return configurer;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rebus;
using Rebus.Configuration;
namespace HermaFx.Rebus
{
public class SetDateOnSentMessagesExtensions
{
public static string MessageDataHeader = "message-date";
private static void SetDateOnMessageSent(IBus bus, string destination, object message)
{
bus.AttachHeader(message, MessageDataHeader, DateTime.UtcNow.ToString("o"));
}
public static RebusConfigurer SetDateOnSentMessages(this RebusConfigurer configurer)
{
configurer.Events(e =>
{
e.MessageSent += SetDateOnMessageSent;
});
return configurer;
}
}
}
| mit | C# |
041b94bc7f3da4df4ae2b4860244dc728df0188f | Set state to IDLE on unhandled exception | ermshiperete/LfMerge,sillsdev/LfMerge,sillsdev/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge,ermshiperete/LfMerge | src/LfMerge/Actions/Action.cs | src/LfMerge/Actions/Action.cs | // Copyright (c) 2016 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using Autofac;
using LfMerge.Logging;
using LfMerge.Settings;
using SIL.FieldWorks.FDO;
using SIL.Progress;
namespace LfMerge.Actions
{
public abstract class Action: IAction
{
protected LfMergeSettingsIni Settings { get; set; }
protected ILogger Logger { get; set; }
protected IProgress Progress { get; set; }
private FdoCache Cache { get; set; }
#region Action handling
internal static IAction GetAction(ActionNames actionName)
{
var action = MainClass.Container.ResolveKeyed<IAction>(actionName);
var actionAsAction = action as Action;
if (actionAsAction != null)
actionAsAction.Name = actionName;
return action;
}
internal static void Register(ContainerBuilder containerBuilder)
{
containerBuilder.RegisterType<CommitAction>().Keyed<IAction>(ActionNames.Commit).SingleInstance();
containerBuilder.RegisterType<EditAction>().Keyed<IAction>(ActionNames.Edit).SingleInstance();
containerBuilder.RegisterType<SynchronizeAction>().Keyed<IAction>(ActionNames.Synchronize).SingleInstance();
containerBuilder.RegisterType<UpdateFdoFromMongoDbAction>().Keyed<IAction>(ActionNames.UpdateFdoFromMongoDb).SingleInstance();
containerBuilder.RegisterType<UpdateMongoDbFromFdo>().Keyed<IAction>(ActionNames.UpdateMongoDbFromFdo).SingleInstance();
}
#endregion
public Action(LfMergeSettingsIni settings, ILogger logger)
{
Settings = settings;
Logger = logger;
Progress = MainClass.Container.Resolve<ConsoleProgress>();
}
protected abstract ProcessingState.SendReceiveStates StateForCurrentAction { get; }
protected abstract ActionNames NextActionName { get; }
protected abstract void DoRun(ILfProject project);
#region IAction implementation
public ActionNames Name { get; private set; }
public IAction NextAction
{
get
{
return NextActionName != ActionNames.None ? GetAction(NextActionName) : null;
}
}
public void Run(ILfProject project)
{
Logger.Notice("Action {0} started", Name);
if (project.State.SRState == ProcessingState.SendReceiveStates.HOLD)
{
Logger.Notice("LFMerge on hold");
return;
}
project.State.SRState = StateForCurrentAction;
try
{
DoRun(project);
}
catch (Exception)
{
if (project.State.SRState != ProcessingState.SendReceiveStates.HOLD)
project.State.SRState = ProcessingState.SendReceiveStates.IDLE;
throw;
}
Logger.Notice("Action {0} finished", Name);
}
#endregion
}
}
| // Copyright (c) 2016 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using Autofac;
using LfMerge.Logging;
using LfMerge.Settings;
using SIL.FieldWorks.FDO;
using SIL.Progress;
namespace LfMerge.Actions
{
public abstract class Action: IAction
{
protected LfMergeSettingsIni Settings { get; set; }
protected ILogger Logger { get; set; }
protected IProgress Progress { get; set; }
private FdoCache Cache { get; set; }
#region Action handling
internal static IAction GetAction(ActionNames actionName)
{
var action = MainClass.Container.ResolveKeyed<IAction>(actionName);
var actionAsAction = action as Action;
if (actionAsAction != null)
actionAsAction.Name = actionName;
return action;
}
internal static void Register(ContainerBuilder containerBuilder)
{
containerBuilder.RegisterType<CommitAction>().Keyed<IAction>(ActionNames.Commit).SingleInstance();
containerBuilder.RegisterType<EditAction>().Keyed<IAction>(ActionNames.Edit).SingleInstance();
containerBuilder.RegisterType<SynchronizeAction>().Keyed<IAction>(ActionNames.Synchronize).SingleInstance();
containerBuilder.RegisterType<UpdateFdoFromMongoDbAction>().Keyed<IAction>(ActionNames.UpdateFdoFromMongoDb).SingleInstance();
containerBuilder.RegisterType<UpdateMongoDbFromFdo>().Keyed<IAction>(ActionNames.UpdateMongoDbFromFdo).SingleInstance();
}
#endregion
public Action(LfMergeSettingsIni settings, ILogger logger)
{
Settings = settings;
Logger = logger;
Progress = MainClass.Container.Resolve<ConsoleProgress>();
}
protected abstract ProcessingState.SendReceiveStates StateForCurrentAction { get; }
protected abstract ActionNames NextActionName { get; }
protected abstract void DoRun(ILfProject project);
#region IAction implementation
public ActionNames Name { get; private set; }
public IAction NextAction
{
get
{
return NextActionName != ActionNames.None ? GetAction(NextActionName) : null;
}
}
public void Run(ILfProject project)
{
Logger.Notice("Action {0} started", Name);
if (project.State.SRState == ProcessingState.SendReceiveStates.HOLD)
{
Logger.Notice("LFMerge on hold");
return;
}
project.State.SRState = StateForCurrentAction;
try
{
DoRun(project);
}
// REVIEW: catch any exception and set state to hold?
// TODO: log exceptions
finally
{
}
Logger.Notice("Action {0} finished", Name);
}
#endregion
}
}
| mit | C# |
a6fef8e97c9cd327876cdb0f79ac494ba2090194 | update version number | CampusLabs/identity-token-cache | IdentityTokenCache/Properties/AssemblyInfo.cs | IdentityTokenCache/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("IdentityTokenCache")]
[assembly: AssemblyDescription("Windows Identity Foundation Token Caches")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Campus Labs")]
[assembly: AssemblyProduct("IdentityTokenCache")]
[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("146b1103-26cc-410c-807f-cfa4f8245540")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyFileVersion("0.1.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("IdentityTokenCache")]
[assembly: AssemblyDescription("Windows Identity Foundation Token Caches")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Campus Labs")]
[assembly: AssemblyProduct("IdentityTokenCache")]
[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("146b1103-26cc-410c-807f-cfa4f8245540")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
| mit | C# |
2f0d91148eeee68cb30ed5f13bc7b69b220edc36 | Add ReadPokemon method | NextLight/PokeBattle_Client | PokeBattle_Client/PokeBattle_Client/Server.cs | PokeBattle_Client/PokeBattle_Client/Server.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Net;
using System.Net.Sockets;
using System.Web.Script.Serialization;
namespace PokeBattle_Client
{
class Server
{
TcpClient client;
NetworkStream stream;
JavaScriptSerializer serializer;
public Server(string ip)
{
this.Ip = ip;
client = new TcpClient();
serializer = new JavaScriptSerializer();
serializer.RegisterConverters(new List<JavaScriptConverter>() { new JSTuple2Converter<int, int?>() });
}
public string Ip { get; set; }
public async Task Connect()
{
await client.ConnectAsync(IPAddress.Parse(this.Ip), 9073);
stream = client.GetStream();
}
// quite ugly tbh
public async Task<byte[]> ReadBytes(int bufferSize = 1024)
{
List<byte> res = new List<byte>();
byte[] buffer = new byte[bufferSize];
do
{
int len = await stream.ReadAsync(buffer, 0, bufferSize);
res.AddRange(buffer.Take(len));
} while (stream.DataAvailable);
return res.ToArray();
}
public async Task<byte> ReadByte()
{
return (await ReadBytes(1))[0];
}
public async Task<string> ReadString()
{
return Encoding.ASCII.GetString(await ReadBytes());
}
public async Task<Pokemon> ReadPokemon()
{
return serializer.Deserialize<Pokemon>(await ReadString());
}
public async Task<Pokemon[]> ReadPokeTeam()
{
return serializer.Deserialize<Pokemon[]>(await ReadString());
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Net;
using System.Net.Sockets;
using System.Web.Script.Serialization;
namespace PokeBattle_Client
{
class Server
{
TcpClient client;
NetworkStream stream;
public Server(string ip)
{
this.Ip = ip;
client = new TcpClient();
}
public string Ip { get; set; }
public async Task Connect()
{
await client.ConnectAsync(IPAddress.Parse(this.Ip), 9073);
stream = client.GetStream();
}
// quite ugly tbh
public async Task<byte[]> ReadBytes(int bufferSize = 1024)
{
List<byte> res = new List<byte>();
byte[] buffer = new byte[bufferSize];
do
{
int len = await stream.ReadAsync(buffer, 0, bufferSize);
res.AddRange(buffer.Take(len));
} while (stream.DataAvailable);
return res.ToArray();
}
public async Task<byte> ReadByte()
{
return (await ReadBytes(1))[0];
}
public async Task<string> ReadString()
{
return Encoding.ASCII.GetString(await ReadBytes());
}
public async Task<Pokemon[]> ReadPokeTeam()
{
var serializer = new JavaScriptSerializer();
serializer.RegisterConverters(new List<JavaScriptConverter>() { new JSTuple2Converter<int, int?>() });
return serializer.Deserialize<Pokemon[]>(await ReadString());
}
}
}
| mit | C# |
7796e7d4865bfca4e05a703881f7e01b605e847e | Test deployment. | markshark05/GForum,markshark05/GForum | GForum/GForum.Web/Views/Home/Index.cshtml | GForum/GForum.Web/Views/Home/Index.cshtml | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>GForum</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div> | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>GForum</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p>
</div>
</div> | mit | C# |
f5dda94bafd09e492eb0f56ed532a3683959d41d | Update FontStyleTypeConverter.cs | Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D/Serializer/Xaml/Converters/FontStyleTypeConverter.cs | src/Core2D/Serializer/Xaml/Converters/FontStyleTypeConverter.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.ComponentModel;
using System.Globalization;
using Core2D.Style;
namespace Core2D.Serializer.Xaml.Converters
{
/// <summary>
/// Defines <see cref="FontStyle"/> type converter.
/// </summary>
internal class FontStyleTypeConverter : TypeConverter
{
/// <inheritdoc/>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string);
}
/// <inheritdoc/>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(string);
}
/// <inheritdoc/>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
return FontStyle.Parse((string)value);
}
/// <inheritdoc/>
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
return value is FontStyle style ? style.ToString() : throw new NotSupportedException();
}
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Globalization;
using System.ComponentModel;
using Core2D.Style;
namespace Core2D.Serializer.Xaml.Converters
{
/// <summary>
/// Defines <see cref="FontStyle"/> type converter.
/// </summary>
internal class FontStyleTypeConverter : TypeConverter
{
/// <inheritdoc/>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string);
}
/// <inheritdoc/>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(string);
}
/// <inheritdoc/>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
return FontStyle.Parse((string)value);
}
/// <inheritdoc/>
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
return value is FontStyle style ? style.ToString() : throw new NotSupportedException();
}
}
}
| mit | C# |
1f6595e5307b97aab9aebb8a77ba4857907566f8 | Implement ToString in KeyValue to make testing easier | ericnewton76/gmaps-api-net | src/Google.Maps/KeyValue.cs | src/Google.Maps/KeyValue.cs | using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
namespace Google.Maps
{
[JsonObject(MemberSerialization.OptIn)]
public class ValueText
{
[JsonProperty("value")]
public string Value { get; set; }
[JsonProperty("text")]
public string Text { get; set; }
public override string ToString()
{
return String.Format("{0} ({1})", Text, Value);
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
namespace Google.Maps
{
[JsonObject(MemberSerialization.OptIn)]
public class ValueText
{
[JsonProperty("value")]
public string Value { get; set; }
[JsonProperty("text")]
public string Text { get; set; }
}
}
| apache-2.0 | C# |
cc520f6ec7a088be85dd846e4378808b1be524ee | Update last sql server versions | KankuruSQL/KMO | KVersion.cs | KVersion.cs | namespace KMO
{
public static class KVersion
{
public const int Sp2017 = 600;
public const int Cu2017 = 600;
public const int Sp2016 = 4001;
public const int Cu2016 = 4435;
public const int Sp2014 = 5000;
public const int Cu2014 = 5546;
public const int Sp2012 = 6020;
public const int Cu2012 = 6598;
public const int Sp2008R2 = 6000;
public const int Cu2008R2 = 6542;
public const int Sp2008 = 6000;
public const int Cu2008 = 6547;
public const int Sp2005 = 5000;
public const int Cu2005 = 5324;
public const string Sp2017Link = "https://www.microsoft.com/en-us/evalcenter/evaluate-sql-server-2017-ctp";
public const string Cu2017Link = "https://www.microsoft.com/en-us/evalcenter/evaluate-sql-server-2017-ctp";
public const string Sp2016Link = "https://www.microsoft.com/en-us/download/details.aspx?id=54276";
public const string Cu2016Link = "https://support.microsoft.com/en-us/help/4019916";
public const string Sp2014Link = "https://www.microsoft.com/en-us/download/details.aspx?id=53168";
public const string Cu2014Link = "https://support.microsoft.com/en-us/help/4013098";
public const string Sp2012Link = "https://www.microsoft.com/en-us/download/details.aspx?id=49996";
public const string Cu2012Link = "https://support.microsoft.com/en-us/help/4016762";
public const string Sp2008R2Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44271";
public const string Cu2008R2Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2008Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44278";
public const string Cu2008Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2005Link = "http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b953e84f-9307-405e-bceb-47bd345baece";
public const string Cu2005Link = "http://support.microsoft.com/kb/2716427";
}
}
| namespace KMO
{
public static class KVersion
{
public const int Sp2017 = 500;
public const int Cu2017 = 500;
public const int Sp2016 = 4001;
public const int Cu2016 = 4422;
public const int Sp2014 = 5000;
public const int Cu2014 = 5540;
public const int Sp2012 = 6020;
public const int Cu2012 = 6594;
public const int Sp2008R2 = 6000;
public const int Cu2008R2 = 6542;
public const int Sp2008 = 6000;
public const int Cu2008 = 6547;
public const int Sp2005 = 5000;
public const int Cu2005 = 5324;
public const string Sp2017Link = "https://www.microsoft.com/en-us/evalcenter/evaluate-sql-server-2017-ctp";
public const string Cu2017Link = "https://www.microsoft.com/en-us/evalcenter/evaluate-sql-server-2017-ctp";
public const string Sp2016Link = "https://www.microsoft.com/en-us/download/details.aspx?id=54276";
public const string Cu2016Link = "https://support.microsoft.com/en-us/help/4013106";
public const string Sp2014Link = "https://www.microsoft.com/en-us/download/details.aspx?id=53168";
public const string Cu2014Link = "https://support.microsoft.com/en-us/help/4010394";
public const string Sp2012Link = "https://www.microsoft.com/en-us/download/details.aspx?id=49996";
public const string Cu2012Link = "https://support.microsoft.com/en-us/help/4013104";
public const string Sp2008R2Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44271";
public const string Cu2008R2Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2008Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44278";
public const string Cu2008Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2005Link = "http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b953e84f-9307-405e-bceb-47bd345baece";
public const string Cu2005Link = "http://support.microsoft.com/kb/2716427";
}
}
| mit | C# |
65b31581ec89c5f5e10b6717c912c19952102a7b | Remove unused code | DMagic1/KSP_Contract_Window | Source/ContractsWindow.Unity/Unity/CW_Note.cs | Source/ContractsWindow.Unity/Unity/CW_Note.cs | using System;
using System.Collections.Generic;
using ContractsWindow.Unity.Interfaces;
using UnityEngine;
using UnityEngine.UI;
namespace ContractsWindow.Unity.Unity
{
public class CW_Note : MonoBehaviour
{
[SerializeField]
private Text NoteText = null;
public void setNote(string note)
{
if (NoteText == null)
return;
NoteText.text = note;
}
}
}
| using System;
using System.Collections.Generic;
using ContractsWindow.Unity.Interfaces;
using UnityEngine;
using UnityEngine.UI;
namespace ContractsWindow.Unity.Unity
{
public class CW_Note : MonoBehaviour
{
[SerializeField]
private Text NoteText = null;
private INote noteInterface;
public void setNote(INote note)
{
if (note == null)
return;
noteInterface = null;
if (NoteText == null)
return;
NoteText.text = note.NoteText;
}
public void Update()
{
if (noteInterface == null)
return;
if (!noteInterface.IsVisible)
return;
if (NoteText == null)
return;
noteInterface.Update();
NoteText.text = noteInterface.NoteText;
}
}
}
| mit | C# |
379c7af1a3ba9a5aa4d62229622e62276284f669 | implement emailservice | Pathfinder-Fr/PathfinderDb3,Pathfinder-Fr/PathfinderDb3,Pathfinder-Fr/PathfinderDb3 | Src/PathfinderDb.Web/Services/EmailService.cs | Src/PathfinderDb.Web/Services/EmailService.cs | // -----------------------------------------------------------------------
// <copyright file="EmailService.cs" company="Pathfinder-fr">
// Copyright (c) Pathfinder-fr. Tous droits reserves.
// </copyright>
// -----------------------------------------------------------------------
namespace PathfinderDb.Services
{
using System.Net.Mail;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
public class EmailService : IIdentityMessageService
{
public async Task SendAsync(IdentityMessage message)
{
using (var mail = new MailMessage())
{
mail.Subject = message.Subject;
mail.Body = message.Body;
mail.To.Add(message.Destination);
await this.SendAsync(mail);
}
}
public async Task SendAsync(MailMessage message)
{
using (var smtp = new SmtpClient())
{
await smtp.SendMailAsync(message);
}
}
}
} | // -----------------------------------------------------------------------
// <copyright file="EmailService.cs" company="Pathfinder-fr">
// Copyright (c) Pathfinder-fr. Tous droits reserves.
// </copyright>
// -----------------------------------------------------------------------
namespace PathfinderDb.Services
{
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
public class EmailService : IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
{
// Plug in your email service here to send an email.
return Task.FromResult(0);
}
}
} | apache-2.0 | C# |
e9996529d77e703db52e9415b040ddfa51fe8b7e | Remove unused memory stream from wasm-dump's Program.cs | jonathanvdc/cs-wasm,jonathanvdc/cs-wasm | wasm-dump/Program.cs | wasm-dump/Program.cs | using System;
using System.IO;
using Wasm.Binary;
namespace Wasm.Dump
{
public static class Program
{
private static MemoryStream ReadStdinToEnd()
{
// Based on Marc Gravell's answer to this StackOverflow question:
// https://stackoverflow.com/questions/1562417/read-binary-data-from-console-in
var memStream = new MemoryStream();
using (var stdin = Console.OpenStandardInput())
{
byte[] buffer = new byte[2048];
int bytes;
while ((bytes = stdin.Read(buffer, 0, buffer.Length)) > 0)
{
memStream.Write(buffer, 0, bytes);
}
}
memStream.Seek(0, SeekOrigin.Begin);
return memStream;
}
public static int Main(string[] args)
{
if (args.Length > 1)
{
Console.Error.WriteLine("usage: wasm-dump [file.wasm]");
return 1;
}
WasmFile file;
if (args.Length == 0)
{
using (var input = ReadStdinToEnd())
{
file = WasmFile.ReadBinary(input);
}
}
else
{
file = WasmFile.ReadBinary(args[0]);
}
file.Dump(Console.Out);
Console.WriteLine();
return 0;
}
}
}
| using System;
using System.IO;
using Wasm.Binary;
namespace Wasm.Dump
{
public static class Program
{
private static MemoryStream ReadStdinToEnd()
{
// Based on Marc Gravell's answer to this StackOverflow question:
// https://stackoverflow.com/questions/1562417/read-binary-data-from-console-in
var memStream = new MemoryStream();
using (var stdin = Console.OpenStandardInput())
{
byte[] buffer = new byte[2048];
int bytes;
while ((bytes = stdin.Read(buffer, 0, buffer.Length)) > 0)
{
memStream.Write(buffer, 0, bytes);
}
}
memStream.Seek(0, SeekOrigin.Begin);
return memStream;
}
public static int Main(string[] args)
{
if (args.Length > 1)
{
Console.Error.WriteLine("usage: wasm-dump [file.wasm]");
return 1;
}
var memStream = new MemoryStream();
WasmFile file;
if (args.Length == 0)
{
using (var input = ReadStdinToEnd())
{
file = WasmFile.ReadBinary(input);
}
}
else
{
file = WasmFile.ReadBinary(args[0]);
}
file.Dump(Console.Out);
Console.WriteLine();
return 0;
}
}
}
| mit | C# |
72b7d6290ea884cc4c77a49c8d075a6b404a2496 | Increment version to 1.15. | mjvh80/jefferson | Jefferson.Core/Properties/AssemblyInfo.cs | Jefferson.Core/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("Jefferson")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jefferson")]
[assembly: AssemblyCopyright("Copyright Marcus van Houdt © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("75992e07-f7c6-4b16-9d62-b878632ab693")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.15.0")]
[assembly: AssemblyFileVersion("0.1.15.0")]
[assembly: InternalsVisibleTo("Jefferson.Tests")] | 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("Jefferson")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jefferson")]
[assembly: AssemblyCopyright("Copyright Marcus van Houdt © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("75992e07-f7c6-4b16-9d62-b878632ab693")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.14.0")]
[assembly: AssemblyFileVersion("0.1.14.0")]
[assembly: InternalsVisibleTo("Jefferson.Tests")] | apache-2.0 | C# |
4207a7a4699e21fdad66638beaae00df6cb33d47 | Add the standard copyright header into UTF8Marshaler.cs | eyecreate/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,eyecreate/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,eyecreate/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,eyecreate/tapcfg,zhanleewo/tapcfg,eyecreate/tapcfg,juhovh/tapcfg | src/bindings/UTF8Marshaler.cs | src/bindings/UTF8Marshaler.cs | /**
* tapcfg - A cross-platform configuration utility for TAP driver
* Copyright (C) 2008 Juho Vähä-Herttua
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
using System;
using System.Text;
using System.Collections;
using System.Runtime.InteropServices;
namespace TAP {
public class UTF8Marshaler : ICustomMarshaler {
static UTF8Marshaler marshaler = new UTF8Marshaler();
private Hashtable allocated = new Hashtable();
public static ICustomMarshaler GetInstance(string cookie) {
return marshaler;
}
public void CleanUpManagedData(object ManagedObj) {
}
public void CleanUpNativeData(IntPtr pNativeData) {
/* This is a hack not to crash on mono!!! */
if (allocated.Contains(pNativeData)) {
Marshal.FreeHGlobal(pNativeData);
allocated.Remove(pNativeData);
} else {
Console.WriteLine("WARNING: Trying to free an unallocated pointer!");
Console.WriteLine(" This is most likely a bug in mono");
}
}
public int GetNativeDataSize() {
return -1;
}
public IntPtr MarshalManagedToNative(object ManagedObj) {
if (ManagedObj == null)
return IntPtr.Zero;
if (ManagedObj.GetType() != typeof(string))
throw new ArgumentException("ManagedObj", "Can only marshal type of System.string");
byte[] array = Encoding.UTF8.GetBytes((string) ManagedObj);
int size = Marshal.SizeOf(typeof(byte)) * (array.Length + 1);
IntPtr ptr = Marshal.AllocHGlobal(size);
/* This is a hack not to crash on mono!!! */
allocated.Add(ptr, null);
Marshal.Copy(array, 0, ptr, array.Length);
Marshal.WriteByte(ptr, array.Length, 0);
return ptr;
}
public object MarshalNativeToManaged(IntPtr pNativeData) {
if (pNativeData == IntPtr.Zero)
return null;
int size = 0;
while (Marshal.ReadByte(pNativeData, size) > 0)
size++;
byte[] array = new byte[size];
Marshal.Copy(pNativeData, array, 0, size);
return Encoding.UTF8.GetString(array);
}
}
}
|
using System;
using System.Text;
using System.Collections;
using System.Runtime.InteropServices;
namespace TAP {
public class UTF8Marshaler : ICustomMarshaler {
static UTF8Marshaler marshaler = new UTF8Marshaler();
private Hashtable allocated = new Hashtable();
public static ICustomMarshaler GetInstance(string cookie) {
return marshaler;
}
public void CleanUpManagedData(object ManagedObj) {
}
public void CleanUpNativeData(IntPtr pNativeData) {
/* This is a hack not to crash on mono!!! */
if (allocated.Contains(pNativeData)) {
Marshal.FreeHGlobal(pNativeData);
allocated.Remove(pNativeData);
} else {
Console.WriteLine("WARNING: Trying to free an unallocated pointer!");
Console.WriteLine(" This is most likely a bug in mono");
}
}
public int GetNativeDataSize() {
return -1;
}
public IntPtr MarshalManagedToNative(object ManagedObj) {
if (ManagedObj == null)
return IntPtr.Zero;
if (ManagedObj.GetType() != typeof(string))
throw new ArgumentException("ManagedObj", "Can only marshal type of System.string");
byte[] array = Encoding.UTF8.GetBytes((string) ManagedObj);
int size = Marshal.SizeOf(typeof(byte)) * (array.Length + 1);
IntPtr ptr = Marshal.AllocHGlobal(size);
/* This is a hack not to crash on mono!!! */
allocated.Add(ptr, null);
Marshal.Copy(array, 0, ptr, array.Length);
Marshal.WriteByte(ptr, array.Length, 0);
return ptr;
}
public object MarshalNativeToManaged(IntPtr pNativeData) {
if (pNativeData == IntPtr.Zero)
return null;
int size = 0;
while (Marshal.ReadByte(pNativeData, size) > 0)
size++;
byte[] array = new byte[size];
Marshal.Copy(pNativeData, array, 0, size);
return Encoding.UTF8.GetString(array);
}
}
}
| lgpl-2.1 | C# |
d40ef75835027fc6d7483b192a68038bf883db73 | add OpenURL() | yasokada/unity-160820-Inventory-UI | Assets/InventoryCS.cs | Assets/InventoryCS.cs | using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using NS_SampleData;
/*
* - add OpenURL()
* v0.1 2016 Aug. 21
* - add MoveColumn()
* - add MoveRow()
* - add SampleData.cs
* - add UI components (unique ID, Case No, Row, Column, About, DataSheet)
*/
public class InventoryCS : MonoBehaviour {
public InputField ID_uniqueID;
public Text T_caseNo;
public Text T_row;
public Text T_column;
public InputField IF_name;
public Text T_about;
string datasheetURL;
void Start () {
T_about.text = NS_SampleData.SampleData.GetDataOfRow (0);
}
void Update () {
}
public void MoveRow(bool next) {
if (next == false) { // previous
T_about.text = NS_SampleData.SampleData.GetDataOfRow (0);
} else {
T_about.text = NS_SampleData.SampleData.GetDataOfRow (1);
}
}
public void MoveColumn(bool next) {
if (next == false) { // previous
T_about.text = NS_SampleData.SampleData.GetDataOfColumn(0);
} else {
T_about.text = NS_SampleData.SampleData.GetDataOfColumn (1);
}
}
public void OpenURL() {
Application.OpenURL ("http://unity3d.com/");
}
} | using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using NS_SampleData;
/*
* v0.1 2016 Aug. 21
* - add MoveColumn()
* - add MoveRow()
* - add SampleData.cs
* - add UI components (unique ID, Case No, Row, Column, About, DataSheet)
*/
public class InventoryCS : MonoBehaviour {
public InputField ID_uniqueID;
public Text T_caseNo;
public Text T_row;
public Text T_column;
public InputField IF_name;
public Text T_about;
string datasheetURL;
void Start () {
T_about.text = NS_SampleData.SampleData.GetDataOfRow (0);
}
void Update () {
}
public void MoveRow(bool next) {
if (next == false) { // previous
T_about.text = NS_SampleData.SampleData.GetDataOfRow (0);
} else {
T_about.text = NS_SampleData.SampleData.GetDataOfRow (1);
}
}
public void MoveColumn(bool next) {
if (next == false) { // previous
T_about.text = NS_SampleData.SampleData.GetDataOfColumn(0);
} else {
T_about.text = NS_SampleData.SampleData.GetDataOfColumn (1);
}
}
} | mit | C# |
0f13c1aff8f4c194b9e71161635cb374cf076356 | Update version. | yojimbo87/ArangoDB-NET,kangkot/ArangoDB-NET | src/Arango/Arango.Client/API/ArangoClient.cs | src/Arango/Arango.Client/API/ArangoClient.cs | using System.Collections.Generic;
using System.Linq;
using Arango.Client.Protocol;
namespace Arango.Client
{
public static class ArangoClient
{
private static List<Connection> _connections = new List<Connection>();
public static string DriverName
{
get { return "ArangoDB-NET"; }
}
public static string DriverVersion
{
get { return "0.7.0"; }
}
public static ArangoSettings Settings { get; set; }
static ArangoClient()
{
Settings = new ArangoSettings();
}
public static void AddDatabase(string hostname, int port, bool isSecured, string userName, string password, string alias)
{
var connection = new Connection(hostname, port, isSecured, userName, password, alias);
_connections.Add(connection);
}
internal static Connection GetConnection(string alias)
{
return _connections.Where(connection => connection.Alias == alias).FirstOrDefault();
}
}
}
| using System.Collections.Generic;
using System.Linq;
using Arango.Client.Protocol;
namespace Arango.Client
{
public static class ArangoClient
{
private static List<Connection> _connections = new List<Connection>();
public static string DriverName
{
get { return "ArangoDB-NET"; }
}
public static string DriverVersion
{
get { return "0.6.1"; }
}
public static ArangoSettings Settings { get; set; }
static ArangoClient()
{
Settings = new ArangoSettings();
}
public static void AddDatabase(string hostname, int port, bool isSecured, string userName, string password, string alias)
{
var connection = new Connection(hostname, port, isSecured, userName, password, alias);
_connections.Add(connection);
}
internal static Connection GetConnection(string alias)
{
return _connections.Where(connection => connection.Alias == alias).FirstOrDefault();
}
}
}
| mit | C# |
9690d7c6f5dd6f0051cbaf38aed6199d8425514b | Update FillDrawNode.cs | wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D | src/Core2D.UI/Renderer/Nodes/FillDrawNode.cs | src/Core2D.UI/Renderer/Nodes/FillDrawNode.cs | using Core2D.Style;
using A = Avalonia;
using AM = Avalonia.Media;
namespace Core2D.UI.Renderer
{
internal class FillDrawNode : DrawNode
{
public A.Rect Rect { get; set; }
public IColor Color { get; set; }
public double X { get; set; }
public double Y { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public FillDrawNode(double x, double y, double width, double height, IColor color)
{
X = x;
Y = y;
Width = width;
Height = height;
Color = color;
UpdateGeometry();
}
public override void UpdateGeometry()
{
ScaleThickness = false;
ScaleSize = false;
Rect = new A.Rect(X, Y, Width, Height);
Center = Rect.Center;
}
public override void UpdateStyle()
{
Fill = DrawUtil.ToBrush(Color);
}
public override void Draw(AM.DrawingContext context, double dx, double dy, double zoom)
{
OnDraw(context, dx, dy, zoom);
}
public override void OnDraw(AM.DrawingContext context, double dx, double dy, double zoom)
{
context.FillRectangle(Fill, Rect);
}
}
}
| using Core2D.Style;
using A = Avalonia;
using AM = Avalonia.Media;
namespace Core2D.UI.Renderer
{
internal class FillDrawNode : DrawNode
{
public A.Rect Rect { get; set; }
public IColor Color { get; set; }
public double X { get; set; }
public double Y { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public FillDrawNode(double x, double y, double width, double height, IColor color)
{
X = x;
Y = y;
Width = width;
Height = height;
Color = color;
UpdateGeometry();
}
public override void UpdateGeometry()
{
ScaleThickness = false;
ScaleSize = false;
Rect = new A.Rect(X, Y, Width, Height);
Center = Rect.Center;
}
public override void UpdateStyle()
{
Fill = ToBrush(Color);
}
public override void Draw(AM.DrawingContext context, double dx, double dy, double zoom)
{
OnDraw(context, dx, dy, zoom);
}
public override void OnDraw(AM.DrawingContext context, double dx, double dy, double zoom)
{
context.FillRectangle(Fill, Rect);
}
}
}
| mit | C# |
3db962d78e8b24540279da04970041dfc6b3fed3 | Update MaximilianLærum.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/MaximilianLærum.cs | src/Firehose.Web/Authors/MaximilianLærum.cs | public class MaximilianLærum : IAmACommunityMember
{
public string FirstName => "Maximilian";
public string LastName => "Lærum";
public string ShortBioOrTagLine => "PowerShell enthusiast";
public string StateOrRegion => "Norway";
public string TwitterHandle => "tr4psec";
public string GravatarHash => "0e45a9759e36d29ac45cf020882cdf5c";
public string GitHubHandle => "Tr4pSec";
public GeoPosition Position => new GeoPosition(59.4172096, 10.4834299);
public Uri WebSite => new Uri("https://get-help.guru/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://get-help.guru/rss"); } }
}
| public class MaximilianLærum : IAmACommunityMember
{
public string FirstName => "Maximilian";
public string LastName => "Lærum";
public string ShortBioOrTagLine => "PowerShell enthusiast";
public string StateOrRegion => "Norway";
public string TwitterHandle => "tr4psec";
public string GravatarHash => "0e45a9759e36d29ac45cf020882cdf5c";
public string GitHubHandle => "Tr4pSec";
public Uri WebSite => new Uri("https://get-help.guru/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://get-help.guru/rss"); } }
}
| mit | C# |
f8daf4f83dc4b4e733fd9e9dce17771c64e82669 | Remove cancellationToken parameter | AMDL/amdl2maml | amdl2maml/Converter/TopicUpdater.cs | amdl2maml/Converter/TopicUpdater.cs | using CommonMark.Syntax;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Amdl.Maml.Converter
{
/// <summary>
/// AMDL topic updater.
/// </summary>
public static class TopicUpdater
{
/// <summary>
/// Updates the topics with their IDs from content layout.
/// </summary>
/// <param name="topics">The topics.</param>
/// <param name="srcPath">Source base path.</param>
/// <param name="title2id">Gets the topic ID from the topic title.</param>
/// <returns>Updated topics.</returns>
public static IEnumerable<TopicData> Update(IEnumerable<TopicData> topics, string srcPath, IDictionary<string, Guid> title2id)
{
return topics.Select(topic => Update(topic, title2id));
}
private static TopicData Update(TopicData topic, IDictionary<string, Guid> title2id)
{
var block = GetHeaderBlock(topic.ParserResult);
topic.Title = GetTitle(topic, block);
Guid id;
if (!title2id.TryGetValue(topic.Title, out id))
id = Guid.NewGuid();
topic.Id = id;
return topic;
}
private static string GetTitle(TopicData topic, Block block)
{
if (block == null || block.HeaderLevel != 1)
return topic.Name;
var title = string.Empty;
for (var inline = block.InlineContent; inline != null; inline = inline.NextSibling)
title += inline.LiteralContent;
return title;
}
private static Block GetHeaderBlock(TopicParserResult result)
{
Block block;
for (block = result.Document.FirstChild;
block != null && block.Tag != BlockTag.AtxHeader && block.Tag != BlockTag.SETextHeader;
block = block.NextSibling) ;
return block;
}
}
}
| using CommonMark.Syntax;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Amdl.Maml.Converter
{
/// <summary>
/// AMDL topic updater.
/// </summary>
public static class TopicUpdater
{
/// <summary>
/// Updates the topics with their IDs from content layout.
/// </summary>
/// <param name="topics">The topics.</param>
/// <param name="srcPath">Source base path.</param>
/// <param name="title2id">Gets the topic ID from the topic title.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Updated topics.</returns>
public static IEnumerable<TopicData> Update(IEnumerable<TopicData> topics, string srcPath, IDictionary<string, Guid> title2id, CancellationToken cancellationToken)
{
return topics.Select(topic => Update(topic, title2id));
}
private static TopicData Update(TopicData topic, IDictionary<string, Guid> title2id)
{
var block = GetHeaderBlock(topic.ParserResult);
topic.Title = GetTitle(topic, block);
Guid id;
if (!title2id.TryGetValue(topic.Title, out id))
id = Guid.NewGuid();
topic.Id = id;
return topic;
}
private static string GetTitle(TopicData topic, Block block)
{
if (block == null || block.HeaderLevel != 1)
return topic.Name;
var title = string.Empty;
for (var inline = block.InlineContent; inline != null; inline = inline.NextSibling)
title += inline.LiteralContent;
return title;
}
private static Block GetHeaderBlock(TopicParserResult result)
{
Block block;
for (block = result.Document.FirstChild;
block != null && block.Tag != BlockTag.AtxHeader && block.Tag != BlockTag.SETextHeader;
block = block.NextSibling) ;
return block;
}
}
}
| apache-2.0 | C# |
8b60af548da68814cde28002dee42f290c233d47 | Allow output directory to be specified as a second parameter. | oliver-feng/nuget,indsoft/NuGet2,xoofx/NuGet,indsoft/NuGet2,dolkensp/node.net,chocolatey/nuget-chocolatey,antiufo/NuGet2,alluran/node.net,mrward/NuGet.V2,jmezach/NuGet2,dolkensp/node.net,chocolatey/nuget-chocolatey,ctaggart/nuget,OneGet/nuget,RichiCoder1/nuget-chocolatey,themotleyfool/NuGet,ctaggart/nuget,oliver-feng/nuget,akrisiun/NuGet,xoofx/NuGet,pratikkagda/nuget,mrward/NuGet.V2,zskullz/nuget,mono/nuget,chocolatey/nuget-chocolatey,indsoft/NuGet2,mrward/nuget,rikoe/nuget,pratikkagda/nuget,pratikkagda/nuget,indsoft/NuGet2,mrward/nuget,jholovacs/NuGet,mrward/nuget,mrward/nuget,dolkensp/node.net,pratikkagda/nuget,themotleyfool/NuGet,chocolatey/nuget-chocolatey,jmezach/NuGet2,alluran/node.net,xoofx/NuGet,ctaggart/nuget,RichiCoder1/nuget-chocolatey,jmezach/NuGet2,antiufo/NuGet2,mrward/NuGet.V2,mono/nuget,indsoft/NuGet2,jmezach/NuGet2,jmezach/NuGet2,zskullz/nuget,xoofx/NuGet,atheken/nuget,akrisiun/NuGet,jholovacs/NuGet,GearedToWar/NuGet2,mrward/nuget,chester89/nugetApi,rikoe/nuget,GearedToWar/NuGet2,jmezach/NuGet2,xero-github/Nuget,zskullz/nuget,mrward/nuget,oliver-feng/nuget,mrward/NuGet.V2,xoofx/NuGet,GearedToWar/NuGet2,rikoe/nuget,mono/nuget,GearedToWar/NuGet2,RichiCoder1/nuget-chocolatey,antiufo/NuGet2,antiufo/NuGet2,antiufo/NuGet2,atheken/nuget,anurse/NuGet,GearedToWar/NuGet2,pratikkagda/nuget,jholovacs/NuGet,chocolatey/nuget-chocolatey,antiufo/NuGet2,jholovacs/NuGet,RichiCoder1/nuget-chocolatey,pratikkagda/nuget,kumavis/NuGet,dolkensp/node.net,GearedToWar/NuGet2,OneGet/nuget,OneGet/nuget,oliver-feng/nuget,oliver-feng/nuget,chester89/nugetApi,chocolatey/nuget-chocolatey,xoofx/NuGet,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,indsoft/NuGet2,mono/nuget,mrward/NuGet.V2,kumavis/NuGet,jholovacs/NuGet,jholovacs/NuGet,oliver-feng/nuget,RichiCoder1/nuget-chocolatey,OneGet/nuget,anurse/NuGet,rikoe/nuget,alluran/node.net,themotleyfool/NuGet,ctaggart/nuget,alluran/node.net,zskullz/nuget | NuPack/PackageAuthoring.cs | NuPack/PackageAuthoring.cs | using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
namespace NuPack {
public class PackageAuthoring {
private static readonly HashSet<string> _exclude = new HashSet<string>(new[] { ".nupack", ".nuspec" },
StringComparer.OrdinalIgnoreCase);
public static void Main(string[] args) {
// Review: Need to use a command-line parsing library instead of parsing it this way.
string executable = Path.GetFileName(Environment.GetCommandLineArgs().First());
string Usage = String.Format(CultureInfo.InvariantCulture,
"Usage: {0} <manifest-file>", executable);
if (!args.Any()) {
Console.Error.WriteLine(Usage);
return;
}
try {
var manifestFile = args.First();
string outputDirectory = args.Length > 1 ? args[1] : Directory.GetCurrentDirectory();
PackageBuilder builder = PackageBuilder.ReadFrom(manifestFile);
builder.Created = DateTime.Now;
builder.Modified = DateTime.Now;
var outputFile = String.Join(".", builder.Id, builder.Version, "nupack");
// Remove the output file or the package spec might try to include it (which is default behavior)
builder.Files.RemoveAll(file => _exclude.Contains(Path.GetExtension(file.Path)));
string outputPath = Path.Combine(outputDirectory, outputFile);
using (Stream stream = File.Create(outputPath)) {
builder.Save(stream);
}
Console.WriteLine("{0} created successfully", outputPath);
}
catch (Exception exception) {
Console.Error.WriteLine(exception.Message);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
namespace NuPack {
public class PackageAuthoring {
private static readonly HashSet<string> _exclude = new HashSet<string>(new[] { ".nupack", ".nuspec" },
StringComparer.OrdinalIgnoreCase);
public static void Main(string[] args) {
// Review: Need to use a command-line parsing library instead of parsing it this way.
string executable = Path.GetFileName(Environment.GetCommandLineArgs().First());
string Usage = String.Format(CultureInfo.InvariantCulture,
"Usage: {0} <manifest-file>", executable);
if (!args.Any()) {
Console.Error.WriteLine(Usage);
return;
}
try {
// Parse the arguments. The last argument is the content to be added to the package
var manifestFile = args.First();
PackageBuilder builder = PackageBuilder.ReadFrom(manifestFile);
builder.Created = DateTime.Now;
builder.Modified = DateTime.Now;
var outputFile = String.Join(".", builder.Id, builder.Version, "nupack");
// Remove the output file or the package spec might try to include it (which is default behavior)
builder.Files.RemoveAll(file => _exclude.Contains(Path.GetExtension(file.Path)));
using (Stream stream = File.Create(outputFile)) {
builder.Save(stream);
}
Console.WriteLine("{0} created successfully", outputFile);
}
catch (Exception exception) {
Console.Error.WriteLine(exception.Message);
}
}
}
}
| apache-2.0 | C# |
b7fe58f88f91f563e8625823ea61b1fd2f1aa2be | modify webapi header version info | tropo/tropo-webapi-csharp,tropo/tropo-webapi-csharp | TropoCSharp/TropoJSON.cs | TropoCSharp/TropoJSON.cs | using System.Web;
using Newtonsoft.Json;
using System;
namespace TropoCSharp.Tropo
{
/// <summary>
/// A utility class to render a Tropo object as JSON.
/// </summary>
public static class TropoJSONExtensions
{
public static void RenderJSON(this Tropo tropo, HttpResponse response)
{
tropo.Language = null;
tropo.Voice = null;
JsonSerializerSettings settings = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore };
response.AddHeader("WebAPI-Lang-Ver", "CSharp V15.11.0 SNAPSHOT");
string sorig = JsonConvert.SerializeObject(tropo, Formatting.None, settings);
string s = sorig.Replace("\\\"", "\"").Replace("\\\\", "\\").Replace("\"{", "{").Replace("}\"", "}");
response.Write(s);
}
}
} | using System.Web;
using Newtonsoft.Json;
using System;
namespace TropoCSharp.Tropo
{
/// <summary>
/// A utility class to render a Tropo object as JSON.
/// </summary>
public static class TropoJSONExtensions
{
public static void RenderJSON(this Tropo tropo, HttpResponse response)
{
tropo.Language = null;
tropo.Voice = null;
JsonSerializerSettings settings = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore };
response.AddHeader("WebAPI-Lang-Ver", "CSharp V15.9.0 SNAPSHOT");
string sorig = JsonConvert.SerializeObject(tropo, Formatting.None, settings);
string s = sorig.Replace("\\\"", "\"").Replace("\\\\", "\\").Replace("\"{", "{").Replace("}\"", "}");
response.Write(s);
}
}
} | mit | C# |
832cf40627c43210dd80495507d33d1c682d0892 | Update AssemblyInfo.cs | schloempe/devenvWebProxyAuthentication | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("devenvWebProxyAuthentication")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("devenvWebProxyAuthentication")]
[assembly: AssemblyCopyright("Copyright © Daniel Schloemp 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("207c1dca-bac4-4ab6-b9df-c8a19f52011e")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [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;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("devenvWebProxyAuthentication")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Wuerth IT GmbH")]
[assembly: AssemblyProduct("devenvWebProxyAuthentication")]
[assembly: AssemblyCopyright("Copyright © Wuerth IT GmbH 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("207c1dca-bac4-4ab6-b9df-c8a19f52011e")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
a229994fe00b442ae38bc4682a92ffa6588ab0b9 | Bump version | o11c/WebMConverter,Yuisbean/WebMConverter,nixxquality/WebMConverter | 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("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.16.3")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.16.2")]
| mit | C# |
3e890775d6a9cbbb4094530065dfade22951f5da | bump version | mstyura/Anotar,modulexcite/Anotar,distantcam/Anotar,Fody/Anotar | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("Anotar")]
[assembly: AssemblyProduct("Anotar")]
[assembly: AssemblyVersion("2.8.0")]
[assembly: AssemblyFileVersion("2.8.0")]
| using System.Reflection;
[assembly: AssemblyTitle("Anotar")]
[assembly: AssemblyProduct("Anotar")]
[assembly: AssemblyVersion("2.7.4")]
[assembly: AssemblyFileVersion("2.7.4")]
| mit | C# |
b5f8fc5168f20b17fafba982118fb294dd7525c6 | bump version | furesoft/Fody,jasonholloway/Fody,ColinDabritzViewpoint/Fody,distantcam/Fody,Fody/Fody,GeertvanHorrik/Fody,huoxudong125/Fody,PKRoma/Fody,ichengzi/Fody | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("Fody")]
[assembly: AssemblyProduct("Fody")]
[assembly: AssemblyVersion("1.19.0")]
[assembly: AssemblyFileVersion("1.19.0")]
| using System.Reflection;
[assembly: AssemblyTitle("Fody")]
[assembly: AssemblyProduct("Fody")]
[assembly: AssemblyVersion("1.18.0")]
[assembly: AssemblyFileVersion("1.18.0")]
| mit | C# |
c7ecb19aefc5cbed221417da2644db09c9d9817a | Tweak definition of IInitializable to support providing initialization data. | nikhilk/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp | src/Libraries/CoreLib/ComponentModel/IInitializable.cs | src/Libraries/CoreLib/ComponentModel/IInitializable.cs | // IInitializable.cs
// Script#/Libraries/CoreLib
// Copyright (c) Nikhil Kothari.
// Copyright (c) Microsoft Corporation.
// This source code is subject to terms and conditions of the Microsoft
// Public License. A copy of the license can be found in License.txt.
//
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace System.ComponentModel {
/// <summary>
/// Implemented by objects that supports a simple, transacted notification for batch
/// initialization.
/// </summary>
[Imported]
[ScriptNamespace("ss")]
public interface IInitializable {
/// <summary>
/// Signals the object that initialization is starting.
/// </summary>
/// <param name="options">An optional set of name/value pairs containing initialization data.</param>
void BeginInitialization(Dictionary<string, object> options);
/// <summary>
/// Signals the object that initialization is complete.
/// </summary>
void EndInitialization();
}
}
| // IInitializable.cs
// Script#/Libraries/CoreLib
// Copyright (c) Nikhil Kothari.
// Copyright (c) Microsoft Corporation.
// This source code is subject to terms and conditions of the Microsoft
// Public License. A copy of the license can be found in License.txt.
//
using System;
using System.Runtime.CompilerServices;
namespace System.ComponentModel {
/// <summary>
/// Implemented by objects that supports a simple, transacted notification for batch
/// initialization.
/// </summary>
[Imported]
[ScriptNamespace("ss")]
public interface IInitializable {
/// <summary>
/// Signals the object that initialization is starting.
/// </summary>
void BeginInitialization();
/// <summary>
/// Signals the object that initialization is complete.
/// </summary>
void EndInitialization();
}
}
| apache-2.0 | C# |
b6e6f0615fad063f339c0402fe27f3138d076b24 | Add helper method to retrieve state data on ApplicationLoadedMessage | Benrnz/ReesUserInteraction | Rees.UserInteraction.Wpf/ApplicationState/ApplicationStateLoadedMessage.cs | Rees.UserInteraction.Wpf/ApplicationState/ApplicationStateLoadedMessage.cs | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using GalaSoft.MvvmLight.Messaging;
using Rees.UserInteraction.Contracts;
namespace Rees.Wpf.ApplicationState
{
/// <summary>
/// A <see cref="MessageBase" /> message object that contains recently loaded user data to be broadcast to subscribing
/// components.
/// This message will be broadcast with the <see cref="IMessenger" /> after the <see cref="IPersistApplicationState" />
/// implementation has read the data from persistent storage.
/// </summary>
public class ApplicationStateLoadedMessage : MessageBase
{
/// <summary>
/// Initializes a new instance of the <see cref="ApplicationStateLoadedMessage" /> class.
/// </summary>
/// <param name="rehydratedModels">
/// The recently loaded user data from persistent storage that this message should carry to
/// all subscribers.
/// </param>
public ApplicationStateLoadedMessage(IEnumerable<IPersistent> rehydratedModels)
{
var removeDuplicates = rehydratedModels
.GroupBy(model => model.GetType(), model => model)
.Where(group => group.Key != null)
.Select(group => group.First());
RehydratedModels =
new ReadOnlyDictionary<Type, IPersistent>(removeDuplicates.ToDictionary(m => m.GetType(), m => m));
}
/// <summary>
/// Gets the recently loaded user data from persistent storage that this message should carry to all subscribers.
/// </summary>
public IReadOnlyDictionary<Type, IPersistent> RehydratedModels { get; private set; }
/// <summary>
/// Retrieves an element of the type <typeparamref name="T" />.
/// If no element of the requested type exists in the <see cref="RehydratedModels" /> dictionary, null is returned.
/// </summary>
/// <typeparam name="T">The concrete type that implements <see cref="IPersistent" /> to retrieve.</typeparam>
public T ElementOfType<T>() where T : class, IPersistent
{
var type = typeof (T);
if (RehydratedModels.ContainsKey(type))
{
return RehydratedModels[type] as T;
}
return null;
}
}
} | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using GalaSoft.MvvmLight.Messaging;
using Rees.UserInteraction.Contracts;
namespace Rees.Wpf.ApplicationState
{
/// <summary>
/// A <see cref="MessageBase"/> message object that contains recently loaded user data to be broadcast to subscribing components.
/// This message will be broadcast with the <see cref="IMessenger"/> after the <see cref="IPersistApplicationState"/> implementation has read the data from persistent storage.
/// </summary>
public class ApplicationStateLoadedMessage : MessageBase
{
/// <summary>
/// Initializes a new instance of the <see cref="ApplicationStateLoadedMessage"/> class.
/// </summary>
/// <param name="rehydratedModels">The recently loaded user data from persistent storage that this message should carry to all subscribers.</param>
public ApplicationStateLoadedMessage(IEnumerable<IPersistent> rehydratedModels)
{
IEnumerable<IPersistent> removeDuplicates = rehydratedModels
.GroupBy(model => model.GetType(), model => model)
.Where(group => group.Key != null)
.Select(group => group.First());
RehydratedModels =
new ReadOnlyDictionary<Type, IPersistent>(removeDuplicates.ToDictionary(m => m.GetType(), m => m));
}
/// <summary>
/// Gets the recently loaded user data from persistent storage that this message should carry to all subscribers.
/// </summary>
public IReadOnlyDictionary<Type, IPersistent> RehydratedModels { get; private set; }
}
} | mit | C# |
ab6fa057e14bdde6e8ef7c7eede176f12ef59c75 | Update ModuleWeaverTests.cs | Fody/ModuleInit | Tests/ModuleWeaverTests.cs | Tests/ModuleWeaverTests.cs | using System.Reflection;
using Fody;
using Xunit;
using Xunit.Abstractions;
// ReSharper disable PrivateFieldCanBeConvertedToLocalVariable
public class ModuleWeaverTests :
XunitLoggingBase
{
[Fact]
public void WithFields()
{
var weavingTask = new ModuleWeaver();
var testResult = weavingTask.ExecuteTestRun("AssemblyToProcess.dll", ignoreCodes: new[]
{
"0x8013129d"
});
AssertCalled(testResult, "ModuleInitializer");
AssertCalled(testResult, "Foo.ModuleInitializer");
}
static void AssertCalled(TestResult testResult, string name)
{
var type = testResult.Assembly.GetType(name);
var info = type.GetField("InitializeCalled", BindingFlags.Static | BindingFlags.Public);
Assert.True((bool)info.GetValue(null));
}
public ModuleWeaverTests(ITestOutputHelper output) :
base(output)
{
}
} | using System.Reflection;
using Fody;
using Xunit;
// ReSharper disable PrivateFieldCanBeConvertedToLocalVariable
public class ModuleWeaverTests :
XunitLoggingBase
{
[Fact]
public void WithFields()
{
var weavingTask = new ModuleWeaver();
var testResult = weavingTask.ExecuteTestRun("AssemblyToProcess.dll", ignoreCodes: new[]
{
"0x8013129d"
});
AssertCalled(testResult, "ModuleInitializer");
AssertCalled(testResult, "Foo.ModuleInitializer");
}
static void AssertCalled(TestResult testResult, string name)
{
var type = testResult.Assembly.GetType(name);
var info = type.GetField("InitializeCalled", BindingFlags.Static | BindingFlags.Public);
Assert.True((bool)info.GetValue(null));
}
} | mit | C# |
4763cb8e0ee3a086177462e3697863cc733e06cc | Reformat TicketValidationResult.cs. | icedream/NPSharp | src/client/RPC/Messages/Data/TicketValidationResult.cs | src/client/RPC/Messages/Data/TicketValidationResult.cs | using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json.Linq;
namespace NPSharp.RPC.Messages.Data
{
/// <summary>
/// Represents the outcome of a ticket validation attempt, including eventual NPv2 authentication identifiers passed by the server.
/// </summary>
public class TicketValidationResult
{
internal TicketValidationResult(Server.AuthenticateValidateTicketResultMessage message)
{
IsValid = message.Result == 0;
Identifiers = ParseIdentifierList(message.Identifiers);
}
internal IEnumerable<string> ParseIdentifierList(string serializedList)
{
// current layer1 implementation uses JSON, formatted as `[ [ <type>, <value> ]... ]` - we'll concatenate these as strings to prevent this implementation detail
// this is consistent with the external API for `profiles` in Citizen itself
JToken jsonValue;
try
{
jsonValue = JToken.Parse(serializedList);
}
catch (FileLoadException)
{
return new string[0];
}
var identifiers = new List<string>();
if (jsonValue.Type == JTokenType.Array)
{
var array = (JArray)jsonValue;
foreach (var identifierToken in array.Children())
{
if (identifierToken.Type == JTokenType.Array)
{
var identifierArray = (JArray)identifierToken;
identifiers.Add(string.Format("{0}:{1}", identifierArray[0], identifierArray[1]));
}
}
}
return identifiers;
}
/// <summary>
/// Whether the ticket is valid or not.
/// </summary>
public bool IsValid { get; private set; }
/// <summary>
/// A list of NPv2 authentication identifiers belonging to the ticket session.
/// </summary>
public IEnumerable<string> Identifiers { get; private set; }
}
} | using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json.Linq;
namespace NPSharp.RPC.Messages.Data
{
/// <summary>
/// Represents the outcome of a ticket validation attempt, including eventual NPv2 authentication identifiers passed by the server.
/// </summary>
public class TicketValidationResult
{
internal TicketValidationResult(Server.AuthenticateValidateTicketResultMessage message)
{
IsValid = message.Result == 0;
Identifiers = ParseIdentifierList(message.Identifiers);
}
internal IEnumerable<string> ParseIdentifierList(string serializedList)
{
// current layer1 implementation uses JSON, formatted as `[ [ <type>, <value> ]... ]` - we'll concatenate these as strings to prevent this implementation detail
// this is consistent with the external API for `profiles` in Citizen itself
JToken jsonValue;
try
{
jsonValue = JToken.Parse(serializedList);
}
catch (FileLoadException)
{
return new string[0];
}
var identifiers = new List<string>();
if (jsonValue.Type == JTokenType.Array)
{
var array = (JArray)jsonValue;
foreach (var identifierToken in array.Children())
{
if (identifierToken.Type == JTokenType.Array)
{
var identifierArray = (JArray)identifierToken;
identifiers.Add(string.Format("{0}:{1}", identifierArray[0], identifierArray[1]));
}
}
}
return identifiers;
}
/// <summary>
/// Whether the ticket is valid or not.
/// </summary>
public bool IsValid { get; private set; }
/// <summary>
/// A list of NPv2 authentication identifiers belonging to the ticket session.
/// </summary>
public IEnumerable<string> Identifiers { get; private set; }
}
} | mit | C# |
4ae3b333e1b41c9f01bf38254b4b2144e74a98db | Fix Plato docs link | giacomelli/BadgesSharp,giacomelli/BadgesSharp | src/BadgesSharp.WebApi/Views/Docs/Index.cshtml | src/BadgesSharp.WebApi/Views/Docs/Index.cshtml | <div class="jumbotron">
<h1>BadgesSharp</h1>
<p class="lead">BadgesSharp is a free service to generate badges that need some kind of input and processing before you can display them on GitHub repositories.</p>
<img src="/Badges/generated/total" />
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>Take a look on our <a href="Docs/GettingStarted">Getting Started</a> guide and a get your badge in a few steps.
</div>
<div class="col-md-4">
<h2>Badges</h2>
<p>Use your <a href="Docs/DupFinder">DupFinder</a>, <a href="Docs/FxCop">FxCop</a>, <a href="Docs/PlatoMaintainability">Plato</a> and <a href="Docs/StyleCop">StyleCop</a> result reports to generate badges from your CI</p>
</div>
<div class="col-md-4">
<h2>Where is the badge I want?</h2>
<p>BadgesSharp does not have the badge do you want? <a href="http://github.com/giacomelli/BadgesSharp">Fork it</a> on GitHub.</p>
</div>
</div>
| <div class="jumbotron">
<h1>BadgesSharp</h1>
<p class="lead">BadgesSharp is a free service to generate badges that need some kind of input and processing before you can display them on GitHub repositories.</p>
<img src="/Badges/generated/total" />
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>Take a look on our <a href="Docs/GettingStarted">Getting Started</a> guide and a get your badge in a few steps.
</div>
<div class="col-md-4">
<h2>Badges</h2>
<p>Use your <a href="Docs/DupFinder">DupFinder</a>, <a href="Docs/FxCop">FxCop</a>, <a href="Docs/Plato">Plato</a> and <a href="Docs/StyleCop">StyleCop</a> result reports to generate badges from your CI</p>
</div>
<div class="col-md-4">
<h2>Where is the badge I want?</h2>
<p>BadgesSharp does not have the badge do you want? <a href="http://github.com/giacomelli/BadgesSharp">Fork it</a> on GitHub.</p>
</div>
</div>
| mit | C# |
15fb0c0690bc141ec464488194a07fc6e8544e30 | Make the queue into a list | EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework | osu.Framework/Allocation/AsyncDisposalQueue.cs | osu.Framework/Allocation/AsyncDisposalQueue.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 System.Collections.Generic;
using System.Threading.Tasks;
using osu.Framework.Statistics;
namespace osu.Framework.Allocation
{
/// <summary>
/// A queue which batches object disposal on threadpool threads.
/// </summary>
internal static class AsyncDisposalQueue
{
private static readonly GlobalStatistic<string> last_disposal = GlobalStatistics.Get<string>("Drawable", "Last disposal");
private static readonly List<IDisposable> disposal_queue = new List<IDisposable>();
private static Task runTask;
public static void Enqueue(IDisposable disposable)
{
lock (disposal_queue)
disposal_queue.Add(disposable);
if (runTask?.Status < TaskStatus.Running)
return;
runTask = Task.Run(() =>
{
IDisposable[] itemsToDispose;
lock (disposal_queue)
{
itemsToDispose = disposal_queue.ToArray();
disposal_queue.Clear();
}
foreach (var item in itemsToDispose)
{
last_disposal.Value = item.ToString();
item.Dispose();
}
});
}
}
}
| // 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 System.Collections.Generic;
using System.Threading.Tasks;
using osu.Framework.Statistics;
namespace osu.Framework.Allocation
{
/// <summary>
/// A queue which batches object disposal on threadpool threads.
/// </summary>
internal static class AsyncDisposalQueue
{
private static readonly GlobalStatistic<string> last_disposal = GlobalStatistics.Get<string>("Drawable", "Last disposal");
private static readonly Queue<IDisposable> disposal_queue = new Queue<IDisposable>();
private static Task runTask;
public static void Enqueue(IDisposable disposable)
{
lock (disposal_queue)
disposal_queue.Enqueue(disposable);
if (runTask?.Status < TaskStatus.Running)
return;
runTask = Task.Run(() =>
{
IDisposable[] itemsToDispose;
lock (disposal_queue)
{
itemsToDispose = disposal_queue.ToArray();
disposal_queue.Clear();
}
foreach (var item in itemsToDispose)
{
last_disposal.Value = item.ToString();
item.Dispose();
}
});
}
}
}
| mit | C# |
0a6effd666a61e0961e28403f22fd7d41500f47a | Add comment | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewModels/AboutViewModel.cs | WalletWasabi.Fluent/ViewModels/AboutViewModel.cs | using System;
using System.IO;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
namespace WalletWasabi.Fluent.ViewModels
{
[NavigationMetaData(
Searchable = true,
Title = "About Wasabi",
Caption = "Displays all the current info about the app",
IconName = "info_regular",
Order = 4,
Category = "General",
Keywords = new [] { "About", "Software","Version", "Source", "Code", "Github", "Status", "Stats", "Tor", "Onion", "Bug", "Report", "FAQ","Questions,", "Docs","Documentation", "Link", "Links"," Help" },
NavBarPosition = NavBarPosition.None)]
public partial class AboutViewModel : RoutableViewModel
{
// TODO: for testing only
[AutoNotify]
private bool _test;
public AboutViewModel()
{
OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>(IoHelpers.OpenBrowserAsync);
// TODO: for testing only
var metadata = MetaData;
var interaction = new Interaction<Unit, Unit>();
interaction.RegisterHandler(
async x =>
x.SetOutput(
await new AboutAdvancedInfoViewModel().ShowDialogAsync()));
AboutAdvancedInfoDialogCommand = ReactiveCommand.CreateFromTask(
execute: async () => await interaction.Handle(Unit.Default).ToTask());
OpenBrowserCommand.ThrownExceptions
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex => Logger.LogError(ex));
}
public override NavigationTarget DefaultTarget => NavigationTarget.DialogScreen;
public ICommand AboutAdvancedInfoDialogCommand { get; }
public ReactiveCommand<string, Unit> OpenBrowserCommand { get; }
public Version ClientVersion => Constants.ClientVersion;
public string ClearnetLink => "https://wasabiwallet.io/";
public string TorLink => "http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion";
public string SourceCodeLink => "https://github.com/zkSNACKs/WalletWasabi/";
public string StatusPageLink => "https://stats.uptimerobot.com/YQqGyUL8A7";
public string UserSupportLink => "https://www.reddit.com/r/WasabiWallet/";
public string BugReportLink => "https://github.com/zkSNACKs/WalletWasabi/issues/";
public string FAQLink => "https://docs.wasabiwallet.io/FAQ/";
public string DocsLink => "https://docs.wasabiwallet.io/";
public string License => "https://github.com/zkSNACKs/WalletWasabi/blob/master/LICENSE.md";
}
} | using System;
using System.IO;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
namespace WalletWasabi.Fluent.ViewModels
{
[NavigationMetaData(
Searchable = true,
Title = "About Wasabi",
Caption = "Displays all the current info about the app",
IconName = "info_regular",
Order = 4,
Category = "General",
Keywords = new [] { "About", "Software","Version", "Source", "Code", "Github", "Status", "Stats", "Tor", "Onion", "Bug", "Report", "FAQ","Questions,", "Docs","Documentation", "Link", "Links"," Help" },
NavBarPosition = NavBarPosition.None)]
public partial class AboutViewModel : RoutableViewModel
{
[AutoNotify]
private bool _test;
public AboutViewModel()
{
OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>(IoHelpers.OpenBrowserAsync);
// TODO: for testing only
var metadata = MetaData;
var interaction = new Interaction<Unit, Unit>();
interaction.RegisterHandler(
async x =>
x.SetOutput(
await new AboutAdvancedInfoViewModel().ShowDialogAsync()));
AboutAdvancedInfoDialogCommand = ReactiveCommand.CreateFromTask(
execute: async () => await interaction.Handle(Unit.Default).ToTask());
OpenBrowserCommand.ThrownExceptions
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex => Logger.LogError(ex));
}
public override NavigationTarget DefaultTarget => NavigationTarget.DialogScreen;
public ICommand AboutAdvancedInfoDialogCommand { get; }
public ReactiveCommand<string, Unit> OpenBrowserCommand { get; }
public Version ClientVersion => Constants.ClientVersion;
public string ClearnetLink => "https://wasabiwallet.io/";
public string TorLink => "http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion";
public string SourceCodeLink => "https://github.com/zkSNACKs/WalletWasabi/";
public string StatusPageLink => "https://stats.uptimerobot.com/YQqGyUL8A7";
public string UserSupportLink => "https://www.reddit.com/r/WasabiWallet/";
public string BugReportLink => "https://github.com/zkSNACKs/WalletWasabi/issues/";
public string FAQLink => "https://docs.wasabiwallet.io/FAQ/";
public string DocsLink => "https://docs.wasabiwallet.io/";
public string License => "https://github.com/zkSNACKs/WalletWasabi/blob/master/LICENSE.md";
}
} | mit | C# |
eb06209aa4070db1b220e16ca15489eeda73ae3d | Fix test on Mono | sailro/cecil,fnajera-rac-de/cecil,jbevain/cecil,SiliconStudio/Mono.Cecil,mono/cecil | symbols/mdb/Test/Mono.Cecil.Tests/MdbTests.cs | symbols/mdb/Test/Mono.Cecil.Tests/MdbTests.cs |
using Mono.Cecil.Mdb;
using NUnit.Framework;
namespace Mono.Cecil.Tests {
[TestFixture]
public class MdbTests : BaseTestFixture {
[Test]
public void MdbWithJustLineInfo ()
{
TestModule ("hello.exe", module => {
var type = module.GetType ("Program");
var main = type.GetMethod ("Main");
AssertCode (@"
.locals init (System.Int32 i)
.line 6,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0000: ldc.i4.0
IL_0001: stloc.0
.line 7,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0002: br IL_0013
.line 8,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0007: ldarg.0
IL_0008: ldloc.0
IL_0009: ldelem.ref
IL_000a: call System.Void Program::Print(System.String)
.line 7,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_000f: ldloc.0
IL_0010: ldc.i4.1
IL_0011: add
IL_0012: stloc.0
IL_0013: ldloc.0
IL_0014: ldarg.0
IL_0015: ldlen
IL_0016: conv.i4
IL_0017: blt IL_0007
.line 10,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_001c: ldc.i4.0
IL_001d: ret
", main);
}, symbolReaderProvider: typeof(MdbReaderProvider), symbolWriterProvider: typeof(MdbWriterProvider));
}
[Test]
public void RoundTripCoreLib ()
{
TestModule ("mscorlib.dll", module => {
var type = module.GetType ("System.IO.__Error");
var method = type.GetMethod ("WinIOError");
Assert.IsNotNull (method.Body);
}, verify: !Platform.OnMono, symbolReaderProvider: typeof(MdbReaderProvider), symbolWriterProvider: typeof(MdbWriterProvider));
}
}
}
|
using Mono.Cecil.Mdb;
using NUnit.Framework;
namespace Mono.Cecil.Tests {
[TestFixture]
public class MdbTests : BaseTestFixture {
[Test]
public void MdbWithJustLineInfo ()
{
TestModule ("hello.exe", module => {
var type = module.GetType ("Program");
var main = type.GetMethod ("Main");
AssertCode (@"
.locals init (System.Int32 i)
.line 6,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0000: ldc.i4.0
IL_0001: stloc.0
.line 7,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0002: br IL_0013
.line 8,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0007: ldarg.0
IL_0008: ldloc.0
IL_0009: ldelem.ref
IL_000a: call System.Void Program::Print(System.String)
.line 7,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_000f: ldloc.0
IL_0010: ldc.i4.1
IL_0011: add
IL_0012: stloc.0
IL_0013: ldloc.0
IL_0014: ldarg.0
IL_0015: ldlen
IL_0016: conv.i4
IL_0017: blt IL_0007
.line 10,-1:-1,-1 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_001c: ldc.i4.0
IL_001d: ret
", main);
}, symbolReaderProvider: typeof(MdbReaderProvider), symbolWriterProvider: typeof(MdbWriterProvider));
}
[Test]
public void RoundTripCoreLib ()
{
TestModule ("mscorlib.dll", module => {
var type = module.GetType ("System.IO.__Error");
var method = type.GetMethod ("WinIOError");
Assert.IsNotNull (method.Body);
}, symbolReaderProvider: typeof(MdbReaderProvider), symbolWriterProvider: typeof(MdbWriterProvider));
}
}
}
| mit | C# |
4a1e3fbd42b1a00c07c81527e40512f2eb1c5eba | Make performance counter tests more stable | mvno/Okanshi,mvno/Okanshi,mvno/Okanshi | tests/Okanshi.Tests/PerformanceCounterTest.cs | tests/Okanshi.Tests/PerformanceCounterTest.cs | using System.Diagnostics;
using FluentAssertions;
using Xunit;
namespace Okanshi.Test
{
public class PerformanceCounterTest
{
[Fact]
public void Performance_counter_without_instance_name()
{
var performanceCounter = new PerformanceCounter("Memory", "Available Bytes");
var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"),
PerformanceCounterConfig.Build("Memory", "Available Bytes"));
monitor.GetValue()
.Should()
.BeGreaterThan(0)
.And.BeApproximately(performanceCounter.NextValue(), 1000000,
"Because memory usage can change between the two values");
}
[Fact]
public void Performance_counter_with_instance_name()
{
var performanceCounter = new PerformanceCounter("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName);
var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"),
PerformanceCounterConfig.Build("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName));
monitor.GetValue()
.Should()
.BeGreaterThan(0)
.And.BeApproximately(performanceCounter.NextValue(), 1000000,
"Because memory usage can change between the two values");
}
}
}
| using System.Diagnostics;
using FluentAssertions;
using Xunit;
namespace Okanshi.Test
{
public class PerformanceCounterTest
{
[Fact]
public void Performance_counter_without_instance_name()
{
var performanceCounter = new PerformanceCounter("Memory", "Available Bytes");
var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"),
PerformanceCounterConfig.Build("Memory", "Available Bytes"));
monitor.GetValue()
.Should()
.BeGreaterThan(0)
.And.BeApproximately(performanceCounter.NextValue(), 500000,
"Because memory usage can change between the two values");
}
[Fact]
public void Performance_counter_with_instance_name()
{
var performanceCounter = new PerformanceCounter("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName);
var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"),
PerformanceCounterConfig.Build("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName));
monitor.GetValue()
.Should()
.BeGreaterThan(0)
.And.BeApproximately(performanceCounter.NextValue(), 500000,
"Because memory usage can change between the two values");
}
}
}
| mit | C# |
77db2d7f0e64d34fa0fb0a08130771506c8445d5 | Use Dapper's Execute method in .NET 4.5. | david-mitchell/System.Data.SQLite,ddunkin/System.Data.SQLite,Faithlife/System.Data.SQLite,Faithlife/System.Data.SQLite | tests/System.Data.SQLite.Tests/TestUtility.cs | tests/System.Data.SQLite.Tests/TestUtility.cs | using System.Collections.Generic;
using System.Data.SQLite;
using System.Reflection;
using NUnit.Framework;
namespace System.Data.SQLite.Tests
{
internal static class TestUtility
{
#if !NET45
public static int Execute(this IDbConnection connection, string commandText, object parameters = null, IDbTransaction transaction = null)
{
using (var command = connection.CreateCommand())
{
SetupCommand(command, commandText, parameters, transaction);
return command.ExecuteNonQuery();
}
}
#endif
public static IDataReader ExecuteReader(this IDbConnection connection, string commandText, object parameters = null, IDbTransaction transaction = null)
{
using (var command = connection.CreateCommand())
{
SetupCommand(command, commandText, parameters, transaction);
return command.ExecuteReader();
}
}
public static IEnumerable<T> ReadAll<T>(this IDataReader reader)
{
while (reader.Read())
yield return (T) reader.GetValue(0);
}
static void SetupCommand(IDbCommand command, string commandText, object parameters, IDbTransaction transaction)
{
command.CommandText = commandText;
command.Transaction = transaction;
if (parameters != null)
{
foreach (var prop in parameters.GetType().GetTypeInfo().DeclaredProperties)
{
var param = command.CreateParameter();
param.ParameterName = prop.Name;
param.Value = prop.GetValue(parameters);
command.Parameters.Add(param);
}
}
}
}
}
| using System.Collections.Generic;
using System.Data.SQLite;
using System.Reflection;
using NUnit.Framework;
namespace System.Data.SQLite.Tests
{
internal static class TestUtility
{
public static int Execute(this IDbConnection connection, string commandText, object parameters = null, IDbTransaction transaction = null)
{
using (var command = connection.CreateCommand())
{
SetupCommand(command, commandText, parameters, transaction);
return command.ExecuteNonQuery();
}
}
public static IDataReader ExecuteReader(this IDbConnection connection, string commandText, object parameters = null, IDbTransaction transaction = null)
{
using (var command = connection.CreateCommand())
{
SetupCommand(command, commandText, parameters, transaction);
return command.ExecuteReader();
}
}
public static IEnumerable<T> ReadAll<T>(this IDataReader reader)
{
while (reader.Read())
yield return (T) reader.GetValue(0);
}
static void SetupCommand(IDbCommand command, string commandText, object parameters, IDbTransaction transaction)
{
command.CommandText = commandText;
command.Transaction = transaction;
if (parameters != null)
{
foreach (var prop in parameters.GetType().GetTypeInfo().DeclaredProperties)
{
var param = command.CreateParameter();
param.ParameterName = prop.Name;
param.Value = prop.GetValue(parameters);
command.Parameters.Add(param);
}
}
}
}
}
| mit | C# |
ab008ad20056072a0f4d9ea6ba3b6681025ef62c | remove done TODO:s | martinlindhe/Punku | punku/Math/NaturalNumber.cs | punku/Math/NaturalNumber.cs | /**
* http://en.wikipedia.org/wiki/Natural_number
*
* NOTE http://msdn.microsoft.com/en-us/library/system.numerics.biginteger%28v=vs.100%29.aspx
* System.Numerics.BigInteger also exists
*/
using System;
namespace Punku
{
/**
* Can represent a very large number
*/
public class NaturalNumber
{
public byte[] Digits;
protected uint NumberBase;
public NaturalNumber (string s, uint numberBase = 10)
{
if (numberBase != 10)
throw new NotImplementedException ("only handles base-10 input");
NumberBase = numberBase;
Digits = Parse (s);
}
/**
* Parses a base-10 number represented in a string
*/
protected static byte[] Parse (string s)
{
var res = new byte[s.Length];
int idx = 0;
foreach (char c in s) {
if (c < '0' || c > '9')
throw new FormatException ();
res [idx++] = (byte)(c - '0');
}
return res;
}
/**
* Converts a natural number to a decimal
*/
public decimal ToDecimal ()
{
decimal res = 0;
foreach (byte b in Digits)
res = (res * NumberBase) + b;
return res;
}
}
}
| /**
* http://en.wikipedia.org/wiki/Natural_number
*
* NOTE http://msdn.microsoft.com/en-us/library/system.numerics.biginteger%28v=vs.100%29.aspx
* System.Numerics.BigInteger also exists
*/
using System;
// TODO unit tests for htis class
namespace Punku
{
/**
* Can represent a very large number
*/
public class NaturalNumber
{
public byte[] Digits;
protected uint NumberBase;
public NaturalNumber (string s, uint numberBase = 10)
{
if (numberBase != 10)
throw new NotImplementedException ("only handles base-10 input");
NumberBase = numberBase;
Digits = Parse (s);
}
/**
* Parses a base-10 number represented in a string
*/
protected static byte[] Parse (string s)
{
var res = new byte[s.Length];
int idx = 0;
foreach (char c in s) {
if (c < '0' || c > '9')
throw new FormatException ();
res [idx++] = (byte)(c - '0');
}
return res;
}
/**
* Converts a natural number to a decimal
*/
public decimal ToDecimal ()
{
decimal res = 0;
// XXXX TODO throw exception if number is too large
foreach (byte b in Digits)
res = (res * NumberBase) + b;
return res;
}
}
}
| mit | C# |
95c04a04f84f108696654158c98cd25031d16e60 | Build fix 2 | AzureAD/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet | core/src/Helpers/StringWriterWithEncoding.cs | core/src/Helpers/StringWriterWithEncoding.cs | //----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// 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.Globalization;
using System.IO;
using System.Text;
namespace Microsoft.Identity.Core.Helpers
{
internal class StringWriterWithEncoding : StringWriter
{
public StringWriterWithEncoding(Encoding encoding)
: base(CultureInfo.InvariantCulture)
{
Encoding = encoding;
}
public override Encoding Encoding { get; }
}
}
| //----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// 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.IO;
using System.Text;
namespace Microsoft.Identity.Core.Helpers
{
internal class StringWriterWithEncoding : StringWriter
{
public StringWriterWithEncoding(Encoding encoding)
{
Encoding = encoding;
}
public override Encoding Encoding { get; }
}
}
| mit | C# |
2cebe22392ef3f3130f67cbab64ea34797418805 | Update GenericExtensions.cs | Insire/Maple,Insire/InsireBot-V2 | src/Maple.Core/Extensions/GenericExtensions.cs | src/Maple.Core/Extensions/GenericExtensions.cs | using System;
using System.Runtime.CompilerServices;
using Maple.Localization.Properties;
namespace Maple.Core.Extensions
{
public static class GenericExtensions
{
public static T ThrowIfNull<T>(this T obj, string objName, [CallerMemberName]string callerName = null)
{
if (obj == null)
throw new ArgumentNullException(objName, string.Format("{0} {1} {2}", objName, Resources.IsRequired, callerName));
return obj;
}
}
}
| using System;
using System.Runtime.CompilerServices;
using Maple.Localization.Properties;
namespace Maple.Core.Extensions
{
public static class GenericExtensions
{
public static T ThrowIfNull<T>(this T obj, string objName, [CallerMemberName]string callerName = null)
{
if (obj == null)
throw new ArgumentNullException(objName, string.Format("{0} {1} (2)", objName, Resources.IsRequired, callerName));
return obj;
}
}
}
| mit | C# |
736aa068ccbc58ca4a38221be9514c641f9fa754 | Make domain a property for reuse. | bigfont/sweet-water-revolver | mvcWebApp/Controllers/HomeController.cs | mvcWebApp/Controllers/HomeController.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.Web.Mvc;
namespace mvcWebApp.Controllers
{
public class HomeController : Controller
{
public string domain
{
get
{
string domain =
Request.Url.Scheme +
System.Uri.SchemeDelimiter +
Request.Url.Host +
(Request.Url.IsDefaultPort ? "" : ":" + Request.Url.Port);
return domain;
}
}
//
// GET: /Home/
public ActionResult Index()
{
// NICE-TO-HAVE Sort images by height.
string imagesDir = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "Images");
string[] files = Directory.EnumerateFiles(imagesDir).Select(p => this.domain + "/Images/" + Path.GetFileName(p)).ToArray();
ViewBag.ImageVirtualPaths = files;
return View();
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.Web.Mvc;
namespace mvcWebApp.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
string domain =
Request.Url.Scheme +
System.Uri.SchemeDelimiter +
Request.Url.Host +
(Request.Url.IsDefaultPort ? "" : ":" + Request.Url.Port);
// NICE-TO-HAVE Sort images by height.
string imagesDir = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "Images");
string[] files = Directory.EnumerateFiles(imagesDir).Select(p => domain + "/Images/" + Path.GetFileName(p)).ToArray();
ViewBag.ImageVirtualPaths = files;
return View();
}
}
}
| mit | C# |
6f4e81a0f50f0d635e99ffe2159ef8779cd904af | Add Dewey class to LibraryContext. | Programazing/Open-School-Library,Programazing/Open-School-Library | src/Open-School-Library/Data/LibraryContext.cs | src/Open-School-Library/Data/LibraryContext.cs | using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Open_School_Library.Models.DatabaseModels;
namespace Open_School_Library.Data
{
public class LibraryContext : DbContext
{
public LibraryContext(DbContextOptions<LibraryContext> options) : base(options)
{
}
public DbSet<Genre> Genres { get; set; }
public DbSet<Dewey> Deweys { get; set; }
}
}
| using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Open_School_Library.Models.DatabaseModels;
namespace Open_School_Library.Data
{
public class LibraryContext : DbContext
{
public LibraryContext(DbContextOptions<LibraryContext> options) : base(options)
{
}
public DbSet<Genre> Genres { get; set; }
}
}
| mit | C# |
0f4d92d2ab3711aef7995b7f33bbeb57c7904831 | Fix build error for missing assembly attribute AllowPartiallyTrustedCallers | evgenekov/protobuf-csharp-port,evgenekov/protobuf-csharp-port,plutoo/protobuf-csharp-port,plutoo/protobuf-csharp-port,happydpc/protobuf-csharp-port,happydpc/protobuf-csharp-port,happydpc/protobuf-csharp-port,plutoo/protobuf-csharp-port,evgenekov/protobuf-csharp-port,plutoo/protobuf-csharp-port,evgenekov/protobuf-csharp-port,happydpc/protobuf-csharp-port | src/ProtocolBuffers/Properties/AssemblyInfo.cs | src/ProtocolBuffers/Properties/AssemblyInfo.cs | // Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://github.com/jskeet/dotnet-protobufs/
// Original C++/Java/Python code:
// http://code.google.com/p/protobuf/
//
// 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 Google Inc. 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 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.
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
// 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.
using System.Security;
[assembly: AssemblyTitle("ProtocolBuffers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProtocolBuffers")]
[assembly: AssemblyCopyright("Copyright © 2008")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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("2.4.1.521")]
[assembly: AssemblyVersion("2.4.1.521")]
#if !NOFILEVERSION
[assembly: AssemblyFileVersion("2.4.1.521")]
#endif
[assembly: CLSCompliant(true)]
#if CLIENTPROFILE // ROK - not defined in SL, CF, or PL
[assembly: AllowPartiallyTrustedCallers]
#endif
| // Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://github.com/jskeet/dotnet-protobufs/
// Original C++/Java/Python code:
// http://code.google.com/p/protobuf/
//
// 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 Google Inc. 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 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.
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
// 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.
using System.Security;
[assembly: AssemblyTitle("ProtocolBuffers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProtocolBuffers")]
[assembly: AssemblyCopyright("Copyright © 2008")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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("2.4.1.521")]
[assembly: AssemblyVersion("2.4.1.521")]
#if !NOFILEVERSION
[assembly: AssemblyFileVersion("2.4.1.521")]
#endif
[assembly: CLSCompliant(true)]
[assembly: AllowPartiallyTrustedCallers] | bsd-3-clause | C# |
48e50ba37c24cc2a3125ed0853708f3ca51f13bb | Fix wrong property mapping in SearchShard | CSGOpenSource/elasticsearch-net,tkirill/elasticsearch-net,CSGOpenSource/elasticsearch-net,robertlyson/elasticsearch-net,ststeiger/elasticsearch-net,UdiBen/elasticsearch-net,faisal00813/elasticsearch-net,DavidSSL/elasticsearch-net,KodrAus/elasticsearch-net,tkirill/elasticsearch-net,tkirill/elasticsearch-net,adam-mccoy/elasticsearch-net,DavidSSL/elasticsearch-net,SeanKilleen/elasticsearch-net,adam-mccoy/elasticsearch-net,TheFireCookie/elasticsearch-net,robrich/elasticsearch-net,abibell/elasticsearch-net,junlapong/elasticsearch-net,SeanKilleen/elasticsearch-net,azubanov/elasticsearch-net,starckgates/elasticsearch-net,faisal00813/elasticsearch-net,mac2000/elasticsearch-net,KodrAus/elasticsearch-net,starckgates/elasticsearch-net,starckgates/elasticsearch-net,RossLieberman/NEST,DavidSSL/elasticsearch-net,TheFireCookie/elasticsearch-net,mac2000/elasticsearch-net,gayancc/elasticsearch-net,LeoYao/elasticsearch-net,robrich/elasticsearch-net,jonyadamit/elasticsearch-net,cstlaurent/elasticsearch-net,elastic/elasticsearch-net,robertlyson/elasticsearch-net,junlapong/elasticsearch-net,gayancc/elasticsearch-net,joehmchan/elasticsearch-net,ststeiger/elasticsearch-net,gayancc/elasticsearch-net,faisal00813/elasticsearch-net,adam-mccoy/elasticsearch-net,joehmchan/elasticsearch-net,wawrzyn/elasticsearch-net,elastic/elasticsearch-net,robrich/elasticsearch-net,jonyadamit/elasticsearch-net,CSGOpenSource/elasticsearch-net,UdiBen/elasticsearch-net,ststeiger/elasticsearch-net,abibell/elasticsearch-net,abibell/elasticsearch-net,cstlaurent/elasticsearch-net,SeanKilleen/elasticsearch-net,geofeedia/elasticsearch-net,robertlyson/elasticsearch-net,wawrzyn/elasticsearch-net,jonyadamit/elasticsearch-net,geofeedia/elasticsearch-net,joehmchan/elasticsearch-net,RossLieberman/NEST,cstlaurent/elasticsearch-net,geofeedia/elasticsearch-net,azubanov/elasticsearch-net,KodrAus/elasticsearch-net,TheFireCookie/elasticsearch-net,RossLieberman/NEST,LeoYao/elasticsearch-net,mac2000/elasticsearch-net,wawrzyn/elasticsearch-net,UdiBen/elasticsearch-net,azubanov/elasticsearch-net,junlapong/elasticsearch-net,LeoYao/elasticsearch-net | src/Nest/Domain/Responses/SearchShardsResponse.cs | src/Nest/Domain/Responses/SearchShardsResponse.cs | using Nest.Domain;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace Nest
{
[JsonObject(MemberSerialization.OptIn)]
public interface ISearchShardsResponse : IResponse
{
[JsonProperty("shards")]
IEnumerable<IEnumerable<SearchShard>> Shards { get; }
[JsonProperty("nodes")]
IDictionary<string, SearchNode> Nodes { get; }
}
public class SearchShardsResponse : BaseResponse, ISearchShardsResponse
{
public IEnumerable<IEnumerable<SearchShard>> Shards { get; internal set; }
public IDictionary<string, SearchNode> Nodes { get; internal set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class SearchNode
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("transport_address")]
public string TransportAddress { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class SearchShard
{
[JsonProperty("state")]
public string State { get; set; }
[JsonProperty("primary")]
public bool Primary { get; set; }
[JsonProperty("node")]
public string Node { get; set; }
[JsonProperty("relocating_node")]
public string RelocatingNode { get; set; }
[JsonProperty("shard")]
public int Shard { get; set; }
[JsonProperty("index")]
public string Index { get; set; }
}
} | using System.Collections.Generic;
using Nest.Domain;
using Newtonsoft.Json;
using System.Linq.Expressions;
using System;
using System.Linq;
namespace Nest
{
[JsonObject(MemberSerialization.OptIn)]
public interface ISearchShardsResponse : IResponse
{
[JsonProperty("shards")]
IEnumerable<IEnumerable<SearchShard>> Shards { get; }
[JsonProperty("nodes")]
IDictionary<string, SearchNode> Nodes { get; }
}
public class SearchShardsResponse : BaseResponse, ISearchShardsResponse
{
public IEnumerable<IEnumerable<SearchShard>> Shards { get; internal set; }
public IDictionary<string, SearchNode> Nodes { get; internal set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class SearchNode
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("transport_address")]
public string TransportAddress { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class SearchShard
{
[JsonProperty("name")]
public string State { get; set;}
[JsonProperty("primary")]
public bool Primary { get; set;}
[JsonProperty("node")]
public string Node { get; set;}
[JsonProperty("relocating_node")]
public string RelocatingNode { get; set;}
[JsonProperty("shard")]
public int Shard { get; set;}
[JsonProperty("index")]
public string Index { get; set;}
}
} | apache-2.0 | C# |
fecd3d778a6dcd5722637e092a1f3e6c6ae8c466 | Remove usage of obsolete IApplicationRegistration | csainty/Glimpse.Nancy,csainty/Glimpse.Nancy,csainty/Glimpse.Nancy | Src/Glimpse.Nancy/GlimpseRegistrations.cs | Src/Glimpse.Nancy/GlimpseRegistrations.cs | using System.Collections.Generic;
using Glimpse.Core.Extensibility;
using Nancy.Bootstrapper;
namespace Glimpse.Nancy
{
public class GlimpseRegistrations : IRegistrations
{
public GlimpseRegistrations()
{
AppDomainAssemblyTypeScanner.AddAssembliesToScan(typeof(Glimpse.Core.Tab.Timeline).Assembly);
}
public IEnumerable<CollectionTypeRegistration> CollectionTypeRegistrations
{
get
{
var tabs = AppDomainAssemblyTypeScanner.TypesOf<ITab>();
var inspectors = AppDomainAssemblyTypeScanner.TypesOf<IInspector>();
return new[] {
new CollectionTypeRegistration(typeof(ITab), tabs),
new CollectionTypeRegistration(typeof(IInspector), inspectors)
};
}
}
public IEnumerable<InstanceRegistration> InstanceRegistrations
{
get { return null; }
}
public IEnumerable<TypeRegistration> TypeRegistrations
{
get { return null; }
}
}
} | using System.Collections.Generic;
using Glimpse.Core.Extensibility;
using Nancy.Bootstrapper;
namespace Glimpse.Nancy
{
public class GlimpseRegistrations : IApplicationRegistrations
{
public GlimpseRegistrations()
{
AppDomainAssemblyTypeScanner.AddAssembliesToScan(typeof(Glimpse.Core.Tab.Timeline).Assembly);
}
public IEnumerable<CollectionTypeRegistration> CollectionTypeRegistrations
{
get
{
var tabs = AppDomainAssemblyTypeScanner.TypesOf<ITab>();
var inspectors = AppDomainAssemblyTypeScanner.TypesOf<IInspector>();
return new[] {
new CollectionTypeRegistration(typeof(ITab), tabs),
new CollectionTypeRegistration(typeof(IInspector), inspectors)
};
}
}
public IEnumerable<InstanceRegistration> InstanceRegistrations
{
get { return null; }
}
public IEnumerable<TypeRegistration> TypeRegistrations
{
get { return null; }
}
}
} | mit | C# |
3bbd54953d0ab2cb543d4a95a87b1569c4dd7ee4 | Remove unneeded parameters | richardlawley/stripe.net,stripe/stripe-dotnet | src/Stripe.net/Services/_sources/SourceCard.cs | src/Stripe.net/Services/_sources/SourceCard.cs | using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Stripe
{
public class SourceCard : INestedOptions
{
/// <summary>
/// The type of payment source. Should be "card".
/// </summary>
[JsonProperty("source[object]")]
internal string Object => "card";
/// <summary>
/// City/District/Suburb/Town/Village.
/// </summary>
[JsonProperty("source[address_city]")]
public string AddressCity { get; set; }
/// <summary>
/// Billing address country, if provided when creating card.
/// </summary>
[JsonProperty("source[address_country]")]
public string AddressCountry { get; set; }
/// <summary>
/// Address line 1 (Street address/PO Box/Company name).
/// </summary>
[JsonProperty("source[address_line1]")]
public string AddressLine1 { get; set; }
/// <summary>
/// Address line 2 (Apartment/Suite/Unit/Building).
/// </summary>
[JsonProperty("source[address_line2]")]
public string AddressLine2 { get; set; }
/// <summary>
/// State/County/Province/Region.
/// </summary>
[JsonProperty("source[address_state]")]
public string AddressState { get; set; }
/// <summary>
/// Zip/Postal Code.
/// </summary>
[JsonProperty("source[address_zip]")]
public string AddressZip { get; set; }
/// <summary>
/// USUALLY REQUIRED: Card security code. Highly recommended to always include this value, but it's only required for accounts based in European countries.
/// </summary>
[JsonProperty("source[cvc]")]
public string Cvc { get; set; }
/// <summary>
/// REQUIRED: Two digit number representing the card's expiration month.
/// </summary>
[JsonProperty("source[exp_month]")]
public int ExpirationMonth { get; set; }
/// <summary>
/// REQUIRED: Two or four digit number representing the card's expiration year.
/// </summary>
[JsonProperty("source[exp_year]")]
public int ExpirationYear { get; set; }
/// <summary>
/// A set of key/value pairs that you can attach to a card object. It can be useful for storing additional information about the card in a structured format.
/// </summary>
[JsonProperty("source[metadata]")]
public Dictionary<string, string> Metadata { get; set; }
/// <summary>
/// Cardholder's full name.
/// </summary>
[JsonProperty("source[name]")]
public string Name { get; set; }
/// <summary>
/// REQUIRED: The card number, as a string without any separators.
/// </summary>
[JsonProperty("source[number]")]
public string Number { get; set; }
}
}
| using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Stripe
{
public class SourceCard : INestedOptions
{
[JsonProperty("source[object]")]
internal string Object => "card";
[JsonProperty("source[number]")]
public string Number { get; set; }
[JsonProperty("source[exp_month]")]
public int ExpirationMonth { get; set; }
[JsonProperty("source[exp_year]")]
public int ExpirationYear { get; set; }
[JsonProperty("source[cvc]")]
public string Cvc { get; set; }
[JsonProperty("source[name]")]
public string Name { get; set; }
[JsonProperty("source[address_line1]")]
public string AddressLine1 { get; set; }
[JsonProperty("source[address_line2]")]
public string AddressLine2 { get; set; }
[JsonProperty("source[address_city]")]
public string AddressCity { get; set; }
[JsonProperty("source[address_zip]")]
public string AddressZip { get; set; }
[JsonProperty("source[address_state]")]
public string AddressState { get; set; }
[JsonProperty("source[address_country]")]
public string AddressCountry { get; set; }
[JsonProperty("source[description]")]
public string Description { get; set; }
[JsonProperty("source[metadata]")]
public Dictionary<string, string> Metadata { get; set; }
[JsonProperty("source[capture]")]
public bool? Capture { get; set; }
[JsonProperty("source[statement_descriptor]")]
public string StatementDescriptor { get; set; }
[JsonProperty("source[destination]")]
public string Destination { get; set; }
// application_fee
// shipping
}
}
| apache-2.0 | C# |
1f90b9f159b4a190c815b90e5a2057c6b5955b3d | Fix logic on 30/60/90 day buckets | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | Battery-Commander.Web/Models/EvaluationListViewModel.cs | Battery-Commander.Web/Models/EvaluationListViewModel.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace BatteryCommander.Web.Models
{
public class EvaluationListViewModel
{
public IEnumerable<Evaluation> Evaluations { get; set; } = Enumerable.Empty<Evaluation>();
[Display(Name = "Delinquent > 60 Days")]
public int Delinquent => Evaluations.Where(_ => _.IsDelinquent).Count();
public int Due => Evaluations.Where(_ => !_.IsDelinquent).Where(_ => _.ThruDate < DateTime.Today).Count();
[Display(Name = "Next 30")]
public int Next30 => Evaluations.Where(_ => !_.IsDelinquent).Where(_ => 0 <= _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 30).Count();
[Display(Name = "Next 60")]
public int Next60 => Evaluations.Where(_ => !_.IsDelinquent).Where(_ => 30 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 60).Count();
[Display(Name = "Next 90")]
public int Next90 => Evaluations.Where(_ => !_.IsDelinquent).Where(_ => 60 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 90).Count();
}
} | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace BatteryCommander.Web.Models
{
public class EvaluationListViewModel
{
public IEnumerable<Evaluation> Evaluations { get; set; } = Enumerable.Empty<Evaluation>();
[Display(Name = "Delinquent > 60 Days")]
public int Delinquent => Evaluations.Where(_ => _.IsDelinquent).Count();
public int Due => Evaluations.Where(_ => !_.IsDelinquent).Where(_ => _.ThruDate < DateTime.Today).Count();
[Display(Name = "Next 30")]
public int Next30 => Evaluations.Where(_ => _.ThruDate > DateTime.Today).Where(_ => DateTime.Today.AddDays(30) < _.ThruDate).Count();
[Display(Name = "Next 60")]
public int Next60 => Evaluations.Where(_ => _.ThruDate > DateTime.Today.AddDays(30)).Where(_ => DateTime.Today.AddDays(60) <= _.ThruDate).Count();
[Display(Name = "Next 90")]
public int Next90 => Evaluations.Where(_ => _.ThruDate > DateTime.Today.AddDays(60)).Where(_ => DateTime.Today.AddDays(90) <= _.ThruDate).Count();
}
} | mit | C# |
18e54b8bdc2e427a4929c8b7177478c3d370fd74 | Test to check tinyioc is internal | AMVSoftware/NSaga | src/Tests/NamespaceTests.cs | src/Tests/NamespaceTests.cs | using System;
using System.Linq;
using FluentAssertions;
using NSaga;
using Xunit;
namespace Tests
{
public class NamespaceTests
{
[Fact]
public void NSaga_Contains_Only_One_Namespace()
{
//Arrange
var assembly = typeof(ISagaMediator).Assembly;
// Act
var namespaces = assembly.GetTypes()
.Where(t => t.IsPublic)
.Select(t => t.Namespace)
.Distinct()
.ToList();
// Assert
var names = String.Join(", ", namespaces);
namespaces.Should().HaveCount(1, $"Should only contain 'NSaga' namespace, but found '{names}'");
}
[Fact]
public void PetaPoco_Stays_Internal()
{
//Arrange
var petapocoTypes = typeof(SqlSagaRepository).Assembly
.GetTypes()
.Where(t => !String.IsNullOrEmpty(t.Namespace))
.Where(t => t.Namespace.StartsWith("PetaPoco", StringComparison.OrdinalIgnoreCase))
.Where(t => t.IsPublic)
.ToList();
petapocoTypes.Should().BeEmpty();
}
[Fact]
public void TinyIoc_Stays_Internal()
{
typeof(TinyIoCContainer).IsPublic.Should().BeFalse();
}
}
}
| using System;
using System.Linq;
using FluentAssertions;
using NSaga;
using Xunit;
namespace Tests
{
public class NamespaceTests
{
[Fact]
public void NSaga_Contains_Only_One_Namespace()
{
//Arrange
var assembly = typeof(ISagaMediator).Assembly;
// Act
var namespaces = assembly.GetTypes()
.Where(t => t.IsPublic)
.Select(t => t.Namespace)
.Distinct()
.ToList();
// Assert
var names = String.Join(", ", namespaces);
namespaces.Should().HaveCount(1, $"Should only contain 'NSaga' namespace, but found '{names}'");
}
[Fact]
public void PetaPoco_Stays_Internal()
{
//Arrange
var petapocoTypes = typeof(SqlSagaRepository).Assembly
.GetTypes()
.Where(t => !String.IsNullOrEmpty(t.Namespace))
.Where(t => t.Namespace.StartsWith("PetaPoco", StringComparison.OrdinalIgnoreCase))
.Where(t => t.IsPublic)
.ToList();
petapocoTypes.Should().BeEmpty();
}
}
}
| mit | C# |
bbdb059b785e0df465afba6ab7718222b2312e93 | Fix non-compiling code. | AvaloniaUI/PerspexVS | src/AvaloniaVS/ViewModels/ProjectDescriptor.cs | src/AvaloniaVS/ViewModels/ProjectDescriptor.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using AvaloniaVS.Infrastructure;
using EnvDTE;
using VSLangProj;
namespace AvaloniaVS.ViewModels
{
public class ProjectDescriptor : PropertyChangedBase
{
public Project Project { get; }
public string Name { get; }
public string TargetAssembly;
public Dictionary<string, string> RunnableOutputs = new Dictionary<string, string>();
public List<Project> References { get; set; } = new List<Project>();
public ProjectDescriptor(Project project)
{
Project = project;
Name = project.Name;
var nfo = Project.GetProjectOutputInfo();
if(nfo!=null)
foreach (var o in nfo)
{
if (TargetAssembly == null)
TargetAssembly = o.TargetAssembly;
if (o.IsFullDotNet || o.IsNetCore)
{
if (o.TargetAssembly.ToLowerInvariant().EndsWith(".exe") ||
o.OutputTypeIsExecutable)
RunnableOutputs[o.TargetFramework] = o.TargetAssembly;
}
}
}
public ProjectDescriptor(string dummyName)
{
Name = dummyName;
}
public override string ToString()
{
return Name;
}
}
} | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using AvaloniaVS.Infrastructure;
using EnvDTE;
using VSLangProj;
namespace AvaloniaVS.ViewModels
{
public class ProjectDescriptor : PropertyChangedBase
{
public Project Project { get; }
public string Name { get; }
public string TargetAssembly;
public Dictionary<string, string> RunnableOutputs = new Dictionary<string, string>();
public List<Project> References { get; set; } = new List<Project>();
public ProjectDescriptor(Project project)
{
Project = project;
Name = project.Name;
var nfo = Project.GetProjectOutputInfo();
if(nfo!=null)
foreach (var o in nfo)
{
if (TargetAssembly == null)
TargetAssembly = o.TargetAssembly;
if (o.IsFullDotNet || o.IsNetCore)
{
if (o.TargetAssembly.ToLowerInvariant().EndsWith(".exe") ||
o.OutputType?.ToLowerInvariant() == "exe")
RunnableOutputs[o.TargetFramework] = o.TargetAssembly;
}
}
}
public ProjectDescriptor(string dummyName)
{
Name = dummyName;
}
public override string ToString()
{
return Name;
}
}
} | mit | C# |
ef589e15120fe367952838a23de1548f561fef47 | Set beta version | BizTalkComponents/ComponentInstrumentation | Src/ComponentInstrumentation/Properties/AssemblyInfo.cs | Src/ComponentInstrumentation/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("BizTalkComponents.Utilities.ComponentInstrumentation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BizTalkComponents.Utilities.ComponentInstrumentation")]
[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("c21a35d7-5370-423b-ae8d-cacfd52ce53e")]
// 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: AssemblyInformationalVersion("1.0.0-beta1")] | 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("BizTalkComponents.Utilities.ComponentInstrumentation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BizTalkComponents.Utilities.ComponentInstrumentation")]
[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("c21a35d7-5370-423b-ae8d-cacfd52ce53e")]
// 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# |
d23f23df202fd936bd124caede59881a7b05cc4b | remove failure test | zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,303248153/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb | ZKWeb/ZKWebStandard/Tests/Collections/HtmlStringTest.cs | ZKWeb/ZKWebStandard/Tests/Collections/HtmlStringTest.cs | using ZKWebStandard.Collection;
using ZKWebStandard.Testing;
namespace ZKWebStandard.Tests.Collections {
[Tests]
class HtmlStringTest {
public void Encode() {
Assert.Equals(HtmlString.Encode("asd'\"<>").ToString(), "asd'"<>");
}
public void Decode() {
Assert.Equals(HtmlString.Encode("asd'\"<>").Decode(), "asd'\"<>");
}
}
}
| using ZKWebStandard.Collection;
using ZKWebStandard.Testing;
namespace ZKWebStandard.Tests.Collections {
[Tests]
class HtmlStringTest {
public void Encode() {
Assert.Equals(HtmlString.Encode("asd'\"<>").ToString(), "asd'"<>");
Assert.Equals(1, 0);
}
public void Decode() {
Assert.Equals(HtmlString.Encode("asd'\"<>").Decode(), "asd'\"<>");
}
}
}
| mit | C# |
b36ddfb85b164945ae1a441cd46ab3834956f3ee | Update assembly version | ernado-x/X.PagedList,kpi-ua/X.PagedList,kpi-ua/X.PagedList,ernado-x/X.PagedList,dncuug/X.PagedList | src/X.PagedList.Mvc/Properties/AssemblyInfo.cs | src/X.PagedList.Mvc/Properties/AssemblyInfo.cs | using System;
using System.Security;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("X.PagedList")]
[assembly: AssemblyDescription("Asp.Net MVC HtmlHelper method for generating paging control for use with PagedList library.")]
[assembly: AssemblyCompany("Troy Goode, Ernado")]
[assembly: AssemblyProduct("X.PagedList")]
[assembly: AssemblyCopyright("MIT License")]
[assembly: AssemblyVersion("4.9.0.*")]
//[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: Guid("eb684fee-2094-4833-ae61-f9bfcab34abd")]
[assembly: AllowPartiallyTrustedCallers()]
[assembly: AssemblyFileVersion("4.9.0.250")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: SecurityRules(SecurityRuleSet.Level1)]
| using System;
using System.Security;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("X.PagedList")]
[assembly: AssemblyDescription("Asp.Net MVC HtmlHelper method for generating paging control for use with PagedList library.")]
[assembly: AssemblyCompany("Troy Goode, Ernado")]
[assembly: AssemblyProduct("X.PagedList")]
[assembly: AssemblyCopyright("MIT License")]
[assembly: AssemblyVersion("4.8.0.*")]
//[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: Guid("eb684fee-2094-4833-ae61-f9bfcab34abd")]
[assembly: AllowPartiallyTrustedCallers()]
[assembly: AssemblyFileVersion("4.8.0.100")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: SecurityRules(SecurityRuleSet.Level1)]
| mit | C# |
94441380f5586776b487ae70e2b8ccdc0254d982 | Add license and disclaimer to About panel | Zyrio/ictus,Zyrio/ictus | src/Yio/Views/Shared/_AboutPanelPartial.cshtml | src/Yio/Views/Shared/_AboutPanelPartial.cshtml | @{
var version = "";
var versionName = Yio.Data.Constants.VersionConstant.Codename.ToString();
if(Yio.Data.Constants.VersionConstant.Patch == 0) {
version = Yio.Data.Constants.VersionConstant.Release.ToString();
} else {
version = Yio.Data.Constants.VersionConstant.Release.ToString() + "." +
Yio.Data.Constants.VersionConstant.Patch.ToString();
}
}
<div class="panel" id="about-panel">
<div class="panel-inner">
<div class="panel-close">
<a href="#" id="about-panel-close"><i class="fa fa-fw fa-times"></i></a>
</div>
<h1>About</h1>
<p>
<strong>Curl your paw round your dick, and get clicking!</strong>
</p>
<p>
Filled with furry (and more) porn, stripped from many sources — tumblr, e621, 4chan, 8chan, etc. — Yiff.co is the never-ending full-width stream of NSFW images.
</p>
<p>
Built by <a href="https://zyr.io">Zyrio</a>. Licensed under the MIT license, with code available on <a href="https://git.zyr.io/zyrio/yio">Zyrio Git</a>. All copyrights belong to their respectful owner, and Yiff.co does not claim ownership over any of them, nor does Yiff.co generate any money.
</p>
<p>
Running on version <strong>@version '@(versionName)'</strong>
</p>
</div>
</div> | @{
var version = "";
var versionName = Yio.Data.Constants.VersionConstant.Codename.ToString();
if(Yio.Data.Constants.VersionConstant.Patch == 0) {
version = Yio.Data.Constants.VersionConstant.Release.ToString();
} else {
version = Yio.Data.Constants.VersionConstant.Release.ToString() + "." +
Yio.Data.Constants.VersionConstant.Patch.ToString();
}
}
<div class="panel" id="about-panel">
<div class="panel-inner">
<div class="panel-close">
<a href="#" id="about-panel-close"><i class="fa fa-fw fa-times"></i></a>
</div>
<h1>About</h1>
<p>
<strong>Curl your paw round your dick, and get clicking!</strong>
</p>
<p>
Filled with furry (and more) porn, stripped from many sources — tumblr, e621, 4chan, 8chan, etc. — Yiff.co is the never-ending full-width stream of NSFW images. Built by <a href="https://zyr.io">Zyrio</a>.
</p>
<p>
Running on version <strong>@version '@(versionName)'</strong>
</p>
</div>
</div> | mit | C# |
5dc9fc97fa47e304822f42d332f784dc67da9479 | Update TriggerOfT.cs | XamlBehaviors/XamlBehaviors,wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors,XamlBehaviors/XamlBehaviors | src/Avalonia.Xaml.Interactivity/TriggerOfT.cs | src/Avalonia.Xaml.Interactivity/TriggerOfT.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.ComponentModel;
namespace Avalonia.Xaml.Interactivity
{
/// <summary>
/// A base class for behaviors, implementing the basic plumbing of ITrigger
/// </summary>
/// <typeparam name="T">The object type to attach to</typeparam>
public abstract class Trigger<T> : Trigger where T : AvaloniaObject
{
/// <summary>
/// Gets the object to which this behavior is attached.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public new T AssociatedObject => base.AssociatedObject as T;
/// <summary>
/// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>.
/// </summary>
/// <remarks>
/// Override this to hook up functionality to the <see cref="Behavior.AssociatedObject"/>
/// </remarks>
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject == null)
{
string actualType = base.AssociatedObject.GetType().FullName;
string expectedType = typeof(T).FullName;
string message = string.Format("AssociatedObject is of type {0} but should be of type {1}.", actualType, expectedType);
throw new InvalidOperationException(message);
}
}
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Avalonia.Xaml.Interactivity
{
/// <summary>
/// A base class for behaviors, implementing the basic plumbing of ITrigger
/// </summary>
/// <typeparam name="T">The object type to attach to</typeparam>
public abstract class Trigger<T> : Trigger where T : AvaloniaObject
{
/// <summary>
/// Gets the object to which this behavior is attached.
/// </summary>
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public new T AssociatedObject => base.AssociatedObject as T;
/// <summary>
/// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>.
/// </summary>
/// <remarks>
/// Override this to hook up functionality to the <see cref="Behavior.AssociatedObject"/>
/// </remarks>
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject == null)
{
string actualType = base.AssociatedObject.GetType().FullName;
string expectedType = typeof(T).FullName;
string message = string.Format("AssociatedObject is of type {0} but should be of type {1}.", actualType, expectedType);
throw new InvalidOperationException(message);
}
}
}
}
| mit | C# |
8ecf111c42eb7ff77cab95715aae58ba5f87b02b | Update version | CodefoundryDE/LegacyWrapper,CodefoundryDE/LegacyWrapper | GlobalAssemblyInfo.cs | GlobalAssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyDescription("LegacyWrapper uses a wrapper process to call dlls from a process of the opposing architecture (X86 or AMD64).")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("codefoundry.de")]
[assembly: AssemblyCopyright("Copyright (c) 2019, Franz Wimmer. (MIT License)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("3.0.1.0")]
[assembly: AssemblyFileVersion("3.0.1.0")]
[assembly: InternalsVisibleTo("LegacyWrapperTest")]
[assembly: InternalsVisibleTo("LegacyWrapperTest.Integration")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // For moq | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyDescription("LegacyWrapper uses a wrapper process to call dlls from a process of the opposing architecture (X86 or AMD64).")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("codefoundry.de")]
[assembly: AssemblyCopyright("Copyright (c) 2019, Franz Wimmer. (MIT License)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: InternalsVisibleTo("LegacyWrapperTest")]
[assembly: InternalsVisibleTo("LegacyWrapperTest.Integration")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // For moq | mit | C# |
4a882cab94b30151aeec64689b0fe2ed8c859a50 | Change #1 | seyedk/Staffing | Staffing/Staffing/Program.cs | Staffing/Staffing/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Staffing
{
class Program
{
static void Main(string[] args)
{
//Change #1: DEV
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Staffing
{
class Program
{
static void Main(string[] args)
{
}
}
}
| mit | C# |
047b3f51a4a266d5f8fbce3e16c52d79b77d3f44 | add an override for ShowUri that doesn't require a timestamp, as getting the current timestamp is kinda hackish | mono/gtk-sharp-beans,mono/gtk-sharp-beans | Gtk.Sources/Global.cs | Gtk.Sources/Global.cs | // GtkBeans.Global.cs
//
// Author(s):
// Stephane Delcroix <stephane@delcroix.org>
//
// Copyright (c) 2009 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace GtkBeans {
public static class Global {
[DllImport("libgtk-win32-2.0-0.dll")]
static extern unsafe bool gtk_show_uri(IntPtr screen, IntPtr uri, uint timestamp, out IntPtr error);
public static unsafe bool ShowUri(Gdk.Screen screen, string uri, uint timestamp) {
IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
IntPtr error = IntPtr.Zero;
bool raw_ret = gtk_show_uri(screen == null ? IntPtr.Zero : screen.Handle, native_uri, timestamp, out error);
bool ret = raw_ret;
GLib.Marshaller.Free (native_uri);
if (error != IntPtr.Zero) throw new GLib.GException (error);
return ret;
}
public static bool ShowUri (Gdk.Screen screen, string uri)
{
return ShowUri (screen, uri, Gdk.EventHelper.GetTime (new Gdk.Event(IntPtr.Zero)));
}
}
}
| // GtkBeans.Global.cs
//
// Author(s):
// Stephane Delcroix <stephane@delcroix.org>
//
// Copyright (c) 2009 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace GtkBeans {
public static class Global {
[DllImport("libgtk-win32-2.0-0.dll")]
static extern unsafe bool gtk_show_uri(IntPtr screen, IntPtr uri, uint timestamp, out IntPtr error);
public static unsafe bool ShowUri(Gdk.Screen screen, string uri, uint timestamp) {
IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
IntPtr error = IntPtr.Zero;
bool raw_ret = gtk_show_uri(screen == null ? IntPtr.Zero : screen.Handle, native_uri, timestamp, out error);
bool ret = raw_ret;
GLib.Marshaller.Free (native_uri);
if (error != IntPtr.Zero) throw new GLib.GException (error);
return ret;
}
}
}
| lgpl-2.1 | C# |
0a226edf53438eaacfec50824fabeaf58358b353 | Update Main.cs | thanhitdept/Xamarin1 | ImageLocation/Main.cs | ImageLocation/Main.cs | using UIKit;
namespace ImageLocation
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
//code by thanh.itjpa
}
}
}
| using UIKit;
namespace ImageLocation
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
}
}
} | unlicense | C# |
7aa3300f86e68e04a23762cb0a6a3df472f9248a | Update BinaryGap.cs | martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms,martibayoalemany/Algorithms | src/main/cs/BinaryGap.cs | src/main/cs/BinaryGap.cs | using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
namespace cs
{
public class BinaryGap
{
public static void Main(string[] args)
{
int result = execute(654345);
Console.WriteLine($"Binary Gap: {result}");
}
public static int execute(int value) {
while(value > 0 && value % 2 == 0)
value = value / 2;
int currentGap = 0;
int maxGap = 0;
while (value > 0) {
int remainder = value % 2;
if(remainder == 0) {
currentGap ++;
} else if (currentGap != 0) {
maxGap = Math.Max(currentGap, maxGap);
currentGap = 0;
}
value = value / 2;
}
return maxGap;
}
}
}
| using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
namespace cs
{
public class BinaryGap
{
public static void Main2(string[] args)
{
int result = execute(654345);
Console.WriteLine($"Binary Gap: {result}");
}
public static int execute(int value) {
while(value > 0 && value % 2 == 0)
value = value / 2;
int currentGap = 0;
int maxGap = 0;
while (value > 0) {
int remainder = value % 2;
if(remainder == 0) {
currentGap ++;
} else if (currentGap != 0) {
maxGap = Math.Max(currentGap, maxGap);
currentGap = 0;
}
value = value / 2;
}
return maxGap;
}
}
}
| mit | C# |
2166d9982c2ea2acdb8951accb8bb565dee749a1 | fix bug in autocommand's event handler | AaronLieberman/Addle | Wpf/ViewModel/AutoCommand.cs | Wpf/ViewModel/AutoCommand.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Subjects;
using System.Windows.Input;
using Addle.Core.Linq;
using JetBrains.Annotations;
namespace Addle.Wpf.ViewModel
{
public class AutoCommand<TOwner, TParam> : IAutoCommandInternal, ICommand
{
readonly Action<TOwner, TParam> _executeCallback;
readonly BehaviorSubject<bool> _canExecute = new BehaviorSubject<bool>(true);
event EventHandler _canExecuteChanged;
object _owner;
public AutoCommand(Action<TOwner, TParam> executeCallback)
{
_executeCallback = executeCallback;
_canExecute.Subscribe(OnCanExecuteChanged);
}
public AutoCommand(Action<TOwner> executeCallback)
: this((owner, _) => executeCallback(owner))
{
}
public BehaviorSubject<bool> CanExecute { get { return _canExecute; } }
void IAutoCommandInternal.Setup(object owner, string propertyName)
{
_owner = owner;
}
void IAutoCommandInternal.Initialized()
{
}
bool ICommand.CanExecute(object parameter)
{
return _canExecute == null || _canExecute.Value;
}
void ICommand.Execute(object parameter)
{
_executeCallback((TOwner)_owner, (TParam)parameter);
}
void OnCanExecuteChanged(bool value)
{
var handler = _canExecuteChanged;
if (handler != null) handler(this, new EventArgs());
}
event EventHandler ICommand.CanExecuteChanged { add { _canExecuteChanged += value; } remove { _canExecuteChanged -= value; } }
}
public class AutoCommand<TOwner> : AutoCommand<TOwner, Unit>
{
public AutoCommand(Action<TOwner> executeCallback)
: base((owner, param) => executeCallback(owner))
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Subjects;
using System.Windows.Input;
using Addle.Core.Linq;
using JetBrains.Annotations;
namespace Addle.Wpf.ViewModel
{
public class AutoCommand<TOwner, TParam> : IAutoCommandInternal, ICommand
{
readonly Action<TOwner, TParam> _executeCallback;
readonly BehaviorSubject<bool> _canExecute = new BehaviorSubject<bool>(true);
event EventHandler _canExecuteChanged;
object _owner;
public AutoCommand(Action<TOwner, TParam> executeCallback)
{
_executeCallback = executeCallback;
_canExecute.Subscribe(OnCanExecuteChanged);
}
public AutoCommand(Action<TOwner> executeCallback)
: this((owner, _) => executeCallback(owner))
{
}
public BehaviorSubject<bool> CanExecute { get { return _canExecute; } }
void IAutoCommandInternal.Setup(object owner, string propertyName)
{
_owner = owner;
}
void IAutoCommandInternal.Initialized()
{
}
bool ICommand.CanExecute(object parameter)
{
return _canExecute == null || _canExecute.Value;
}
void ICommand.Execute(object parameter)
{
_executeCallback((TOwner)_owner, (TParam)parameter);
}
void OnCanExecuteChanged(bool value)
{
var handler = _canExecuteChanged;
if (handler != null) _canExecuteChanged(this, new EventArgs());
}
event EventHandler ICommand.CanExecuteChanged { add { _canExecuteChanged += value; } remove { _canExecuteChanged -= value; } }
}
public class AutoCommand<TOwner> : AutoCommand<TOwner, Unit>
{
public AutoCommand(Action<TOwner> executeCallback)
: base((owner, param) => executeCallback(owner))
{
}
}
}
| mit | C# |
4fc53b5fb38eb639cc806cf6c3ebee567b9a297a | fix logic that checks if worker parameters are correct | kasubram/vsts-agent,lkillgore/vsts-agent,Microsoft/vsts-agent,lkillgore/vsts-agent,vithati/vsts-agent,kasubram/vsts-agent,vithati/vsts-agent,lkillgore/vsts-agent,Microsoft/vsts-agent,kasubram/vsts-agent,Microsoft/vsts-agent,Microsoft/vsts-agent,lkillgore/vsts-agent,vithati/vsts-agent,kasubram/vsts-agent | src/Agent.Worker/Program.cs | src/Agent.Worker/Program.cs | using System;
using System.Diagnostics;
using Microsoft.VisualStudio.Services.Agent;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.Services.Agent.Worker
{
public static class Program
{
public static void Main(string[] args)
{
RunAsync(args).Wait();
}
public static async Task RunAsync(string[] args)
{
HostContext hc = new HostContext("Worker");
Console.WriteLine("Hello Worker!");
#if OS_WINDOWS
Console.WriteLine("Hello Windows");
#endif
#if OS_OSX
Console.WriteLine("Hello OSX");
#endif
#if OS_LINUX
Console.WriteLine("Hello Linux");
#endif
TraceSource m_trace = hc.Trace["WorkerProcess"];
m_trace.Info("Info Hello Worker!");
m_trace.Warning("Warning Hello Worker!");
m_trace.Error("Error Hello Worker!");
m_trace.Verbose("Verbos Hello Worker!");
//JobRunner jobRunner = new JobRunner(hc);
//jobRunner.Run();
if (null != args && 3 == args.Length && "spawnclient".Equals(args[0].ToLower()))
{
using (var client = new IPCClient())
{
JobRunner jobRunner = new JobRunner(hc, client.Transport);
await client.Start(args[1], args[2]);
await jobRunner.WaitToFinish();
await client.Stop();
}
}
hc.Dispose();
}
}
}
| using System;
using System.Diagnostics;
using Microsoft.VisualStudio.Services.Agent;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.Services.Agent.Worker
{
public static class Program
{
public static void Main(string[] args)
{
RunAsync(args).Wait();
}
public static async Task RunAsync(string[] args)
{
HostContext hc = new HostContext("Worker");
Console.WriteLine("Hello Worker!");
#if OS_WINDOWS
Console.WriteLine("Hello Windows");
#endif
#if OS_OSX
Console.WriteLine("Hello OSX");
#endif
#if OS_LINUX
Console.WriteLine("Hello Linux");
#endif
TraceSource m_trace = hc.Trace["WorkerProcess"];
m_trace.Info("Info Hello Worker!");
m_trace.Warning("Warning Hello Worker!");
m_trace.Error("Error Hello Worker!");
m_trace.Verbose("Verbos Hello Worker!");
//JobRunner jobRunner = new JobRunner(hc);
//jobRunner.Run();
if (null == args && 3 != args.Length && (!"spawnclient".Equals(args[0].ToLower())))
{
return;
}
using (var client = new IPCClient())
{
JobRunner jobRunner = new JobRunner(hc, client.Transport);
await client.Start(args[1], args[2]);
await jobRunner.WaitToFinish();
await client.Stop();
}
hc.Dispose();
}
}
}
| mit | C# |
42ac74faeb1ae97aab29dece6b0535f205d3b201 | Load credentials from file | FetzenRndy/Creative,FetzenRndy/Creative,FetzenRndy/Creative,FetzenRndy/Creative,FetzenRndy/Creative | c#/TwitchBot/StatoBot.UI/Views/Pages/Statistics.xaml.cs | c#/TwitchBot/StatoBot.UI/Views/Pages/Statistics.xaml.cs | using System;
using System.Threading.Tasks;
using System.Windows.Controls;
using StatoBot.Analytics;
using StatoBot.Core;
using StatoBot.Reports;
namespace StatoBot.UI.Views.Pages
{
public partial class Statistics : UserControl
{
private AnalyzerBot bot;
private DateTime lastUpdate;
public Statistics(string channelName)
{
InitializeComponent();
NameDisplay.Content = channelName;
var credentials = Credentials.FromFile("./twitch_credentials.json");
bot = new AnalyzerBot(credentials, channelName);
bot.Analyzer.OnStatisticsChanged += (e) => UpdateDisplay(e.Statistics);
Task.Run(bot.SetupAndListenAsync);
}
public void UpdateDisplay(ChatStatistics statistics)
{
if (lastUpdate.Subtract(TimeSpan.FromSeconds(-2)) > DateTime.Now)
{
return;
}
lastUpdate = DateTime.Now;
Dispatcher.InvokeAsync(() =>
{
var report = new Report(new ReportInput(bot.Analyzer.Statistics, BotInfo.FromBot(bot)));
WordsStatisticsGrid.ItemsSource = report.Statistics.WordsSortedByUsage;
LetterStatisticsGrid.ItemsSource = report.Statistics.LettersSortedByUsage;
UserStatisticsGrid.ItemsSource = report.Statistics.UsersSortedByMessagesSent;
});
}
}
}
| using System;
using System.Threading.Tasks;
using System.Windows.Controls;
using StatoBot.Analytics;
using StatoBot.Reports;
namespace StatoBot.UI.Views.Pages
{
public partial class Statistics : UserControl
{
private AnalyzerBot bot;
private DateTime lastUpdate;
public Statistics(string channelName)
{
InitializeComponent();
NameDisplay.Content = channelName;
bot = new AnalyzerBot(new Core.Credentials("fetzenrndy", "oauth:mffnpsgm58j1il3ibj016dva1guh13"), channelName);
bot.Analyzer.OnStatisticsChanged += (e) => UpdateDisplay(e.Statistics);
Task.Run(bot.SetupAndListenAsync);
}
public void UpdateDisplay(ChatStatistics statistics)
{
if (lastUpdate.Subtract(TimeSpan.FromSeconds(-2)) > DateTime.Now)
{
return;
}
lastUpdate = DateTime.Now;
Dispatcher.InvokeAsync(() =>
{
var report = new Report(new ReportInput(bot.Analyzer.Statistics, BotInfo.FromBot(bot)));
WordsStatisticsGrid.ItemsSource = report.Statistics.WordsSortedByUsage;
LetterStatisticsGrid.ItemsSource = report.Statistics.LettersSortedByUsage;
UserStatisticsGrid.ItemsSource = report.Statistics.UsersSortedByMessagesSent;
});
}
}
}
| mit | C# |
3455f65e8450a568cdaa55034efcc5fe3b1e7d30 | Use the correct message handler type in unit tests | Elders/Cronus,Elders/Cronus | src/Elders.Cronus.Tests/MessageStreaming/When_message_handler_implements__IDisposable__.cs | src/Elders.Cronus.Tests/MessageStreaming/When_message_handler_implements__IDisposable__.cs | using System;
using System.Collections.Generic;
using Elders.Cronus.DomainModeling;
using Elders.Cronus.MessageProcessing;
using Elders.Cronus.Tests.TestModel;
using Machine.Specifications;
namespace Elders.Cronus.Tests.MessageStreaming
{
[Subject("")]
public class When_message_handler_implements__IDisposable__
{
Establish context = () =>
{
handlerFacotry = new DisposableHandlerFactory();
messageStream = new MessageProcessor("test");
var subscription = new TestSubscription(typeof(CalculatorNumber1), handlerFacotry);
messages = new List<TransportMessage>();
messages.Add(new TransportMessage(new Message(new CalculatorNumber1(1))));
messageStream.Subscribe(subscription);
};
Because of = () =>
{
feedResult = messageStream.Feed(messages);
};
It should_dispose_handler_resources_if_possible = () => (handlerFacotry.State.Current as DisposableHandlerFactory.DisposableHandler).IsDisposed.ShouldBeTrue();
static IFeedResult feedResult;
static MessageProcessor messageStream;
static List<TransportMessage> messages;
static DisposableHandlerFactory handlerFacotry;
}
public class DisposableHandlerFactory : IHandlerFactory
{
public Type MessageHandlerType { get { return typeof(DisposableHandler); } }
public IHandlerInstance State { get; set; }
public IHandlerInstance Create()
{
State = new DefaultHandlerInstance(new DisposableHandler());
return State;
}
public class DisposableHandler : IDisposable
{
public bool IsDisposed { get; set; }
public void Handle(CalculatorNumber1 @event) { }
public void Dispose() { IsDisposed = true; }
}
}
}
| using System;
using System.Collections.Generic;
using Elders.Cronus.DomainModeling;
using Elders.Cronus.MessageProcessing;
using Elders.Cronus.Tests.TestModel;
using Machine.Specifications;
namespace Elders.Cronus.Tests.MessageStreaming
{
[Subject("")]
public class When_message_handler_implements__IDisposable__
{
Establish context = () =>
{
handlerFacotry = new DisposableHandlerFactory();
messageStream = new MessageProcessor("test");
var subscription = new TestSubscription(typeof(CalculatorNumber1), handlerFacotry);
messages = new List<TransportMessage>();
messages.Add(new TransportMessage(new Message(new CalculatorNumber1(1))));
messageStream.Subscribe(subscription);
};
Because of = () =>
{
feedResult = messageStream.Feed(messages);
};
It should_dispose_handler_resources_if_possible = () => (handlerFacotry.State.Current as DisposableHandlerFactory.DisposableHandler).IsDisposed.ShouldBeTrue();
static IFeedResult feedResult;
static MessageProcessor messageStream;
static List<TransportMessage> messages;
static DisposableHandlerFactory handlerFacotry;
}
public class DisposableHandlerFactory : IHandlerFactory
{
public Type MessageHandlerType { get { return typeof(StandardCalculatorAddHandler); } }
public IHandlerInstance State { get; set; }
public IHandlerInstance Create()
{
State = new DefaultHandlerInstance(new DisposableHandler());
return State;
}
public class DisposableHandler : IDisposable
{
public bool IsDisposed { get; set; }
public void Handle(CalculatorNumber1 @event) { }
public void Dispose() { IsDisposed = true; }
}
}
}
| apache-2.0 | C# |
7ee8f0cca2fee7ee576bb40995d07c03d0746c29 | Fix data collection cmdlets to not require login | zhencui/azure-powershell,naveedaz/azure-powershell,alfantp/azure-powershell,yantang-msft/azure-powershell,pomortaz/azure-powershell,devigned/azure-powershell,zhencui/azure-powershell,zhencui/azure-powershell,dulems/azure-powershell,yoavrubin/azure-powershell,dominiqa/azure-powershell,akurmi/azure-powershell,atpham256/azure-powershell,alfantp/azure-powershell,krkhan/azure-powershell,Matt-Westphal/azure-powershell,naveedaz/azure-powershell,devigned/azure-powershell,jtlibing/azure-powershell,nemanja88/azure-powershell,arcadiahlyy/azure-powershell,DeepakRajendranMsft/azure-powershell,juvchan/azure-powershell,yoavrubin/azure-powershell,alfantp/azure-powershell,haocs/azure-powershell,haocs/azure-powershell,stankovski/azure-powershell,naveedaz/azure-powershell,juvchan/azure-powershell,krkhan/azure-powershell,yantang-msft/azure-powershell,ankurchoubeymsft/azure-powershell,AzureAutomationTeam/azure-powershell,alfantp/azure-powershell,yoavrubin/azure-powershell,pankajsn/azure-powershell,naveedaz/azure-powershell,naveedaz/azure-powershell,pankajsn/azure-powershell,devigned/azure-powershell,jtlibing/azure-powershell,shuagarw/azure-powershell,dominiqa/azure-powershell,hungmai-msft/azure-powershell,hungmai-msft/azure-powershell,CamSoper/azure-powershell,dominiqa/azure-powershell,CamSoper/azure-powershell,seanbamsft/azure-powershell,naveedaz/azure-powershell,CamSoper/azure-powershell,alfantp/azure-powershell,shuagarw/azure-powershell,stankovski/azure-powershell,zhencui/azure-powershell,ClogenyTechnologies/azure-powershell,juvchan/azure-powershell,DeepakRajendranMsft/azure-powershell,akurmi/azure-powershell,jtlibing/azure-powershell,ClogenyTechnologies/azure-powershell,jtlibing/azure-powershell,seanbamsft/azure-powershell,jasper-schneider/azure-powershell,AzureAutomationTeam/azure-powershell,akurmi/azure-powershell,rohmano/azure-powershell,TaraMeyer/azure-powershell,jasper-schneider/azure-powershell,krkhan/azure-powershell,nemanja88/azure-powershell,AzureAutomationTeam/azure-powershell,dominiqa/azure-powershell,seanbamsft/azure-powershell,atpham256/azure-powershell,krkhan/azure-powershell,AzureAutomationTeam/azure-powershell,hovsepm/azure-powershell,pomortaz/azure-powershell,yantang-msft/azure-powershell,dulems/azure-powershell,stankovski/azure-powershell,ankurchoubeymsft/azure-powershell,TaraMeyer/azure-powershell,jasper-schneider/azure-powershell,DeepakRajendranMsft/azure-powershell,rohmano/azure-powershell,krkhan/azure-powershell,ClogenyTechnologies/azure-powershell,AzureRT/azure-powershell,haocs/azure-powershell,AzureRT/azure-powershell,jtlibing/azure-powershell,rohmano/azure-powershell,ankurchoubeymsft/azure-powershell,atpham256/azure-powershell,devigned/azure-powershell,Matt-Westphal/azure-powershell,nemanja88/azure-powershell,hungmai-msft/azure-powershell,juvchan/azure-powershell,hungmai-msft/azure-powershell,dulems/azure-powershell,hovsepm/azure-powershell,AzureAutomationTeam/azure-powershell,CamSoper/azure-powershell,akurmi/azure-powershell,zhencui/azure-powershell,atpham256/azure-powershell,hovsepm/azure-powershell,AzureRT/azure-powershell,jasper-schneider/azure-powershell,hungmai-msft/azure-powershell,haocs/azure-powershell,CamSoper/azure-powershell,devigned/azure-powershell,rohmano/azure-powershell,pomortaz/azure-powershell,hovsepm/azure-powershell,shuagarw/azure-powershell,pankajsn/azure-powershell,yantang-msft/azure-powershell,AzureRT/azure-powershell,stankovski/azure-powershell,hovsepm/azure-powershell,krkhan/azure-powershell,pomortaz/azure-powershell,seanbamsft/azure-powershell,DeepakRajendranMsft/azure-powershell,yoavrubin/azure-powershell,seanbamsft/azure-powershell,haocs/azure-powershell,seanbamsft/azure-powershell,arcadiahlyy/azure-powershell,nemanja88/azure-powershell,yantang-msft/azure-powershell,AzureAutomationTeam/azure-powershell,AzureRT/azure-powershell,ClogenyTechnologies/azure-powershell,rohmano/azure-powershell,ankurchoubeymsft/azure-powershell,DeepakRajendranMsft/azure-powershell,Matt-Westphal/azure-powershell,hungmai-msft/azure-powershell,jasper-schneider/azure-powershell,pankajsn/azure-powershell,ankurchoubeymsft/azure-powershell,dominiqa/azure-powershell,pankajsn/azure-powershell,TaraMeyer/azure-powershell,yoavrubin/azure-powershell,Matt-Westphal/azure-powershell,pomortaz/azure-powershell,akurmi/azure-powershell,devigned/azure-powershell,TaraMeyer/azure-powershell,arcadiahlyy/azure-powershell,zhencui/azure-powershell,atpham256/azure-powershell,stankovski/azure-powershell,pankajsn/azure-powershell,arcadiahlyy/azure-powershell,AzureRT/azure-powershell,dulems/azure-powershell,ClogenyTechnologies/azure-powershell,yantang-msft/azure-powershell,rohmano/azure-powershell,shuagarw/azure-powershell,Matt-Westphal/azure-powershell,nemanja88/azure-powershell,TaraMeyer/azure-powershell,dulems/azure-powershell,arcadiahlyy/azure-powershell,juvchan/azure-powershell,atpham256/azure-powershell,shuagarw/azure-powershell | src/ResourceManager/Profile/Commands.Profile/DataCollection/EnableAzureRMDataCollection.cs | src/ResourceManager/Profile/Commands.Profile/DataCollection/EnableAzureRMDataCollection.cs | // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using System.Management.Automation;
using Microsoft.Azure.Commands.Profile.Models;
using Microsoft.Azure.Commands.ResourceManager.Common;
using System.Security.Permissions;
namespace Microsoft.Azure.Commands.Profile
{
[Cmdlet(VerbsLifecycle.Enable, "AzureRmDataCollection")]
[Alias("Enable-AzureDataCollection")]
public class EnableAzureRmDataCollectionCommand : AzureRMCmdlet
{
protected override void BeginProcessing()
{
// do not call begin processing there is no context needed for this cmdlet
}
protected override void ProcessRecord()
{
SetDataCollectionProfile(true);
}
protected void SetDataCollectionProfile(bool enable)
{
var profile = GetDataCollectionProfile();
profile.EnableAzureDataCollection = enable;
SaveDataCollectionProfile();
}
}
}
| // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using System.Management.Automation;
using Microsoft.Azure.Commands.Profile.Models;
using Microsoft.Azure.Commands.ResourceManager.Common;
using System.Security.Permissions;
namespace Microsoft.Azure.Commands.Profile
{
[Cmdlet(VerbsLifecycle.Enable, "AzureRmDataCollection")]
[Alias("Enable-AzureDataCollection")]
public class EnableAzureRmDataCollectionCommand : AzureRMCmdlet
{
protected override void ProcessRecord()
{
SetDataCollectionProfile(true);
}
protected void SetDataCollectionProfile(bool enable)
{
var profile = GetDataCollectionProfile();
profile.EnableAzureDataCollection = enable;
SaveDataCollectionProfile();
}
}
}
| apache-2.0 | C# |
b93b6ba2ca215fac5a66e224695a908ff57925e9 | Change "single tap" mod acronym to not conflict with "strict tracking" | ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu | osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.cs | osu.Game.Rulesets.Osu/Mods/OsuModSingleTap.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 System.Linq;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModSingleTap : InputBlockingMod
{
public override string Name => @"Single Tap";
public override string Acronym => @"SG";
public override string Description => @"You must only use one key!";
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAlternate) }).ToArray();
protected override bool CheckValidNewAction(OsuAction action) => LastAcceptedAction == null || LastAcceptedAction == action;
}
}
| // 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 System.Linq;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModSingleTap : InputBlockingMod
{
public override string Name => @"Single Tap";
public override string Acronym => @"ST";
public override string Description => @"You must only use one key!";
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAlternate) }).ToArray();
protected override bool CheckValidNewAction(OsuAction action) => LastAcceptedAction == null || LastAcceptedAction == action;
}
}
| mit | C# |
c1c0e1ff7a2bb8979165f242db87bc40bfc40b62 | Fix incorrect method call | peppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework | osu.Framework.Android/AndroidGameActivity.cs | osu.Framework.Android/AndroidGameActivity.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 Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
namespace osu.Framework.Android
{
public abstract class AndroidGameActivity : Activity
{
protected abstract Game CreateGame();
private AndroidGameView gameView;
public override void OnTrimMemory([GeneratedEnum] TrimMemory level)
{
base.OnTrimMemory(level);
gameView.Host?.Collect();
}
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(gameView = new AndroidGameView(this, CreateGame()));
}
protected override void OnPause() {
base.OnPause();
// Because Android is not playing nice with Background - we just kill it
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
}
}
| // 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 Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
namespace osu.Framework.Android
{
public abstract class AndroidGameActivity : Activity
{
protected abstract Game CreateGame();
private AndroidGameView gameView;
public override void OnTrimMemory([GeneratedEnum] TrimMemory level)
{
base.OnTrimMemory(level);
gameView.Host?.PurgeCaches();
}
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(gameView = new AndroidGameView(this, CreateGame()));
}
protected override void OnPause() {
base.OnPause();
// Because Android is not playing nice with Background - we just kill it
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.