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 |
---|---|---|---|---|---|---|---|---|
2176c0a2bfd28f3daf78be8b04537a86d09de2b6 | Remove redundant specification of public in interface | jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode | Drums/VDrumExplorer.Data/Fields/IField.cs | Drums/VDrumExplorer.Data/Fields/IField.cs | // Copyright 2019 Jon Skeet. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
namespace VDrumExplorer.Data.Fields
{
public interface IField
{
string Description { get; }
FieldPath Path { get; }
ModuleAddress Address { get; }
int Size { get; }
FieldCondition? Condition { get; }
}
}
| // Copyright 2019 Jon Skeet. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
namespace VDrumExplorer.Data.Fields
{
public interface IField
{
string Description { get; }
FieldPath Path { get; }
ModuleAddress Address { get; }
int Size { get; }
public FieldCondition? Condition { get; }
}
}
| apache-2.0 | C# |
05b44b876f68a23e1e6902f1b771b241fd416606 | Update annotations for implementations of ILabelSymbol | jasonmalinowski/roslyn,weltkante/roslyn,physhi/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,davkean/roslyn,tmat/roslyn,wvdd007/roslyn,dotnet/roslyn,abock/roslyn,tmat/roslyn,stephentoub/roslyn,tannergooding/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,agocke/roslyn,agocke/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,brettfo/roslyn,abock/roslyn,tannergooding/roslyn,dotnet/roslyn,genlu/roslyn,CyrusNajmabadi/roslyn,AlekseyTs/roslyn,weltkante/roslyn,physhi/roslyn,AmadeusW/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,davkean/roslyn,stephentoub/roslyn,wvdd007/roslyn,brettfo/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,eriawan/roslyn,genlu/roslyn,physhi/roslyn,gafter/roslyn,diryboy/roslyn,aelij/roslyn,panopticoncentral/roslyn,agocke/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,reaction1989/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,brettfo/roslyn,davkean/roslyn,stephentoub/roslyn,abock/roslyn,mavasani/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,jmarolf/roslyn,jmarolf/roslyn,sharwell/roslyn,KirillOsenkov/roslyn,bartdesmet/roslyn,diryboy/roslyn,gafter/roslyn,weltkante/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,gafter/roslyn,tannergooding/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,reaction1989/roslyn,ErikSchierboom/roslyn,aelij/roslyn,tmat/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,mgoertz-msft/roslyn,eriawan/roslyn,aelij/roslyn,heejaechang/roslyn,KevinRansom/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,genlu/roslyn,eriawan/roslyn,reaction1989/roslyn | src/Compilers/CSharp/Portable/Symbols/PublicModel/LabelSymbol.cs | src/Compilers/CSharp/Portable/Symbols/PublicModel/LabelSymbol.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable enable
using System.Diagnostics.CodeAnalysis;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel
{
internal sealed class LabelSymbol : Symbol, ILabelSymbol
{
private readonly Symbols.LabelSymbol _underlying;
public LabelSymbol(Symbols.LabelSymbol underlying)
{
RoslynDebug.Assert(underlying is object);
_underlying = underlying;
}
internal override CSharp.Symbol UnderlyingSymbol => _underlying;
IMethodSymbol ILabelSymbol.ContainingMethod
{
get
{
return _underlying.ContainingMethod.GetPublicSymbol();
}
}
#region ISymbol Members
protected override void Accept(SymbolVisitor visitor)
{
visitor.VisitLabel(this);
}
[return: MaybeNull]
protected override TResult Accept<TResult>(SymbolVisitor<TResult> visitor)
{
return visitor.VisitLabel(this);
}
#endregion
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel
{
internal sealed class LabelSymbol : Symbol, ILabelSymbol
{
private readonly Symbols.LabelSymbol _underlying;
public LabelSymbol(Symbols.LabelSymbol underlying)
{
Debug.Assert(underlying is object);
_underlying = underlying;
}
internal override CSharp.Symbol UnderlyingSymbol => _underlying;
IMethodSymbol ILabelSymbol.ContainingMethod
{
get
{
return _underlying.ContainingMethod.GetPublicSymbol();
}
}
#region ISymbol Members
protected override void Accept(SymbolVisitor visitor)
{
visitor.VisitLabel(this);
}
protected override TResult Accept<TResult>(SymbolVisitor<TResult> visitor)
{
return visitor.VisitLabel(this);
}
#endregion
}
}
| mit | C# |
5b5efdd8ed1b4d80c8b64952c2102c5c9c8f00d9 | Use customName as dictionary key, because we could have multiple pivot table values with same source. | igitur/ClosedXML,clinchergt/ClosedXML,JavierJJJ/ClosedXML,jongleur1983/ClosedXML,vbjay/ClosedXML,ClosedXML/ClosedXML,b0bi79/ClosedXML | ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs | ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClosedXML.Excel
{
internal class XLPivotValues: IXLPivotValues
{
private readonly Dictionary<String, IXLPivotValue> _pivotValues = new Dictionary<string, IXLPivotValue>();
private readonly IXLPivotTable _pivotTable;
internal XLPivotValues(IXLPivotTable pivotTable)
{
this._pivotTable = pivotTable;
}
public IEnumerator<IXLPivotValue> GetEnumerator()
{
return _pivotValues.Values.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public IXLPivotValue Add(String sourceName)
{
return Add(sourceName, sourceName);
}
public IXLPivotValue Add(String sourceName, String customName)
{
var pivotValue = new XLPivotValue(sourceName) { CustomName = customName };
_pivotValues.Add(customName, pivotValue);
if (_pivotValues.Count > 1 && !this._pivotTable.ColumnLabels.Any(cl => cl.SourceName == XLConstants.PivotTableValuesSentinalLabel) && !this._pivotTable.RowLabels.Any(rl => rl.SourceName == XLConstants.PivotTableValuesSentinalLabel))
_pivotTable.ColumnLabels.Add(XLConstants.PivotTableValuesSentinalLabel);
return pivotValue;
}
public void Clear()
{
_pivotValues.Clear();
}
public void Remove(String sourceName)
{
_pivotValues.Remove(sourceName);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClosedXML.Excel
{
internal class XLPivotValues: IXLPivotValues
{
private readonly Dictionary<String, IXLPivotValue> _pivotValues = new Dictionary<string, IXLPivotValue>();
private readonly IXLPivotTable _pivotTable;
internal XLPivotValues(IXLPivotTable pivotTable)
{
this._pivotTable = pivotTable;
}
public IEnumerator<IXLPivotValue> GetEnumerator()
{
return _pivotValues.Values.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public IXLPivotValue Add(String sourceName)
{
return Add(sourceName, sourceName);
}
public IXLPivotValue Add(String sourceName, String customName)
{
var pivotValue = new XLPivotValue(sourceName) { CustomName = customName };
_pivotValues.Add(sourceName, pivotValue);
if (_pivotValues.Count > 1 && !this._pivotTable.ColumnLabels.Any(cl => cl.SourceName == XLConstants.PivotTableValuesSentinalLabel) && !this._pivotTable.RowLabels.Any(rl => rl.SourceName == XLConstants.PivotTableValuesSentinalLabel))
_pivotTable.ColumnLabels.Add(XLConstants.PivotTableValuesSentinalLabel);
return pivotValue;
}
public void Clear()
{
_pivotValues.Clear();
}
public void Remove(String sourceName)
{
_pivotValues.Remove(sourceName);
}
}
}
| mit | C# |
b6fdce0cd9bc88eff2a3a9a63ee8a500a8332889 | Fix admin menu window size (#11534) | space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14 | Content.Client/Administration/UI/AdminMenuWindow.xaml.cs | Content.Client/Administration/UI/AdminMenuWindow.xaml.cs | using Content.Client.Administration.UI.Tabs;
using Content.Client.HUD;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Client.Administration.UI
{
[GenerateTypedNameReferences]
public sealed partial class AdminMenuWindow : DefaultWindow
{
[Dependency] private readonly IGameHud? _gameHud = default!;
public AdminMenuWindow()
{
MinSize = (500, 250);
Title = Loc.GetString("admin-menu-title");
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
MasterTabContainer.SetTabTitle(0, Loc.GetString("admin-menu-admin-tab"));
MasterTabContainer.SetTabTitle(1, Loc.GetString("admin-menu-adminbus-tab"));
MasterTabContainer.SetTabTitle(2, Loc.GetString("admin-menu-atmos-tab"));
MasterTabContainer.SetTabTitle(3, Loc.GetString("admin-menu-round-tab"));
MasterTabContainer.SetTabTitle(4, Loc.GetString("admin-menu-server-tab"));
MasterTabContainer.SetTabTitle(5, Loc.GetString("admin-menu-players-tab"));
MasterTabContainer.SetTabTitle(6, Loc.GetString("admin-menu-objects-tab"));
}
protected override void EnteredTree()
{
base.EnteredTree();
if (_gameHud != null)
_gameHud.AdminButtonDown = true;
}
protected override void ExitedTree()
{
base.ExitedTree();
if (_gameHud != null)
_gameHud.AdminButtonDown = false;
}
}
}
| using Content.Client.Administration.UI.Tabs;
using Content.Client.HUD;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Client.Administration.UI
{
[GenerateTypedNameReferences]
public sealed partial class AdminMenuWindow : DefaultWindow
{
[Dependency] private readonly IGameHud? _gameHud = default!;
public AdminMenuWindow()
{
MinSize = SetSize = (500, 250);
Title = Loc.GetString("admin-menu-title");
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
MasterTabContainer.SetTabTitle(0, Loc.GetString("admin-menu-admin-tab"));
MasterTabContainer.SetTabTitle(1, Loc.GetString("admin-menu-adminbus-tab"));
MasterTabContainer.SetTabTitle(2, Loc.GetString("admin-menu-atmos-tab"));
MasterTabContainer.SetTabTitle(3, Loc.GetString("admin-menu-round-tab"));
MasterTabContainer.SetTabTitle(4, Loc.GetString("admin-menu-server-tab"));
MasterTabContainer.SetTabTitle(5, Loc.GetString("admin-menu-players-tab"));
MasterTabContainer.SetTabTitle(6, Loc.GetString("admin-menu-objects-tab"));
}
protected override void EnteredTree()
{
base.EnteredTree();
if (_gameHud != null)
_gameHud.AdminButtonDown = true;
}
protected override void ExitedTree()
{
base.ExitedTree();
if (_gameHud != null)
_gameHud.AdminButtonDown = false;
}
}
}
| mit | C# |
dcdf017a90a63c5afc82a6cd6596aa94ce527937 | Add missing brace | genlu/roslyn,AlekseyTs/roslyn,tmat/roslyn,mavasani/roslyn,mattscheffer/roslyn,TyOverby/roslyn,tmeschter/roslyn,sharwell/roslyn,mgoertz-msft/roslyn,dpoeschl/roslyn,jasonmalinowski/roslyn,dpoeschl/roslyn,weltkante/roslyn,davkean/roslyn,tvand7093/roslyn,brettfo/roslyn,yeaicc/roslyn,nguerrera/roslyn,genlu/roslyn,xasx/roslyn,drognanar/roslyn,Giftednewt/roslyn,dotnet/roslyn,amcasey/roslyn,nguerrera/roslyn,xasx/roslyn,heejaechang/roslyn,stephentoub/roslyn,jkotas/roslyn,panopticoncentral/roslyn,MichalStrehovsky/roslyn,mattwar/roslyn,pdelvo/roslyn,srivatsn/roslyn,Hosch250/roslyn,robinsedlaczek/roslyn,jcouv/roslyn,jmarolf/roslyn,sharwell/roslyn,dotnet/roslyn,paulvanbrenk/roslyn,khyperia/roslyn,ErikSchierboom/roslyn,jeffanders/roslyn,paulvanbrenk/roslyn,amcasey/roslyn,diryboy/roslyn,akrisiun/roslyn,zooba/roslyn,akrisiun/roslyn,Giftednewt/roslyn,orthoxerox/roslyn,agocke/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,AnthonyDGreen/roslyn,sharwell/roslyn,pdelvo/roslyn,zooba/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,eriawan/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,robinsedlaczek/roslyn,heejaechang/roslyn,mmitche/roslyn,bbarry/roslyn,srivatsn/roslyn,tvand7093/roslyn,Giftednewt/roslyn,xasx/roslyn,panopticoncentral/roslyn,kelltrick/roslyn,jamesqo/roslyn,jkotas/roslyn,weltkante/roslyn,orthoxerox/roslyn,diryboy/roslyn,mgoertz-msft/roslyn,KevinRansom/roslyn,OmarTawfik/roslyn,mmitche/roslyn,MichalStrehovsky/roslyn,KirillOsenkov/roslyn,jamesqo/roslyn,bkoelman/roslyn,swaroop-sridhar/roslyn,pdelvo/roslyn,DustinCampbell/roslyn,heejaechang/roslyn,robinsedlaczek/roslyn,khyperia/roslyn,amcasey/roslyn,CaptainHayashi/roslyn,MattWindsor91/roslyn,gafter/roslyn,davkean/roslyn,CaptainHayashi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mattscheffer/roslyn,jmarolf/roslyn,orthoxerox/roslyn,jmarolf/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,CaptainHayashi/roslyn,mattscheffer/roslyn,cston/roslyn,kelltrick/roslyn,tannergooding/roslyn,bkoelman/roslyn,mattwar/roslyn,diryboy/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,brettfo/roslyn,yeaicc/roslyn,nguerrera/roslyn,yeaicc/roslyn,jeffanders/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,abock/roslyn,tannergooding/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,Hosch250/roslyn,bbarry/roslyn,reaction1989/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,MattWindsor91/roslyn,mavasani/roslyn,eriawan/roslyn,gafter/roslyn,cston/roslyn,lorcanmooney/roslyn,davkean/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,swaroop-sridhar/roslyn,AmadeusW/roslyn,AnthonyDGreen/roslyn,MichalStrehovsky/roslyn,tmeschter/roslyn,kelltrick/roslyn,AnthonyDGreen/roslyn,VSadov/roslyn,tmat/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,jcouv/roslyn,OmarTawfik/roslyn,jkotas/roslyn,CyrusNajmabadi/roslyn,tvand7093/roslyn,physhi/roslyn,genlu/roslyn,stephentoub/roslyn,jcouv/roslyn,brettfo/roslyn,dotnet/roslyn,DustinCampbell/roslyn,TyOverby/roslyn,AmadeusW/roslyn,drognanar/roslyn,VSadov/roslyn,MattWindsor91/roslyn,abock/roslyn,MattWindsor91/roslyn,VSadov/roslyn,DustinCampbell/roslyn,wvdd007/roslyn,jasonmalinowski/roslyn,jamesqo/roslyn,paulvanbrenk/roslyn,bkoelman/roslyn,lorcanmooney/roslyn,akrisiun/roslyn,AmadeusW/roslyn,jeffanders/roslyn,bartdesmet/roslyn,physhi/roslyn,aelij/roslyn,abock/roslyn,bbarry/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,stephentoub/roslyn,cston/roslyn,dpoeschl/roslyn,reaction1989/roslyn,khyperia/roslyn,mmitche/roslyn,weltkante/roslyn,mavasani/roslyn,aelij/roslyn,tmat/roslyn,drognanar/roslyn,KevinRansom/roslyn,zooba/roslyn,tannergooding/roslyn,gafter/roslyn,Hosch250/roslyn,KirillOsenkov/roslyn,AlekseyTs/roslyn,OmarTawfik/roslyn,swaroop-sridhar/roslyn,agocke/roslyn,lorcanmooney/roslyn,AlekseyTs/roslyn,TyOverby/roslyn,ErikSchierboom/roslyn,srivatsn/roslyn,tmeschter/roslyn,agocke/roslyn,mattwar/roslyn,aelij/roslyn | src/Features/Core/Portable/Completion/CompletionTags.cs | src/Features/Core/Portable/Completion/CompletionTags.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Tags;
namespace Microsoft.CodeAnalysis.Completion
{
/// <summary>
/// The set of well known tags used for the <see cref="CompletionItem.Tags"/> property.
/// These tags influence the presentation of items in the list.
/// </summary>
public static class CompletionTags
{
// accessibility
public const string Public = WellKnownTags.Public;
public const string Protected = WellKnownTags.Protected;
public const string Private = WellKnownTags.Private;
public const string Internal = WellKnownTags.Internal;
// project elements
public const string File = WellKnownTags.File;
public const string Project = WellKnownTags.Project;
public const string Folder = WellKnownTags.Folder;
public const string Assembly = WellKnownTags.Assembly;
// language elements
public const string Class = WellKnownTags.Class;
public const string Constant = WellKnownTags.Constant;
public const string Delegate = WellKnownTags.Delegate;
public const string Enum = WellKnownTags.Enum;
public const string EnumMember = WellKnownTags.EnumMember;
public const string Event = WellKnownTags.Event;
public const string ExtensionMethod = WellKnownTags.ExtensionMethod;
public const string Field = WellKnownTags.Field;
public const string Interface = WellKnownTags.Interface;
public const string Intrinsic = WellKnownTags.Intrinsic;
public const string Keyword = WellKnownTags.Keyword;
public const string Label = WellKnownTags.Label;
public const string Local = WellKnownTags.Local;
public const string Namespace = WellKnownTags.Namespace;
public const string Method = WellKnownTags.Method;
public const string Module = WellKnownTags.Module;
public const string Operator = WellKnownTags.Operator;
public const string Parameter = WellKnownTags.Parameter;
public const string Property = WellKnownTags.Property;
public const string RangeVariable = WellKnownTags.RangeVariable;
public const string Reference = WellKnownTags.Reference;
public const string Structure = WellKnownTags.Structure;
public const string TypeParameter = WellKnownTags.TypeParameter;
// other
public const string Snippet = WellKnownTags.Snippet;
public const string Error = WellKnownTags.Error;
public const string Warning = WellKnownTags.Warning;
internal const string StatusInformation = WellKnownTags.StatusInformation;
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Tags;
namespace Microsoft.CodeAnalysis.Completion
{
/// <summary>
/// The set of well known tags used for the <see cref="CompletionItem.Tags"/> property.
/// These tags influence the presentation of items in the list.
/// </summary>
public static class CompletionTags
{
// accessibility
public const string Public = WellKnownTags.Public;
public const string Protected = WellKnownTags.Protected;
public const string Private = WellKnownTags.Private;
public const string Internal = WellKnownTags.Internal;
// project elements
public const string File = WellKnownTags.File;
public const string Project = WellKnownTags.Project;
public const string Folder = WellKnownTags.Folder;
public const string Assembly = WellKnownTags.Assembly;
// language elements
public const string Class = WellKnownTags.Class;
public const string Constant = WellKnownTags.Constant;
public const string Delegate = WellKnownTags.Delegate;
public const string Enum = WellKnownTags.Enum;
public const string EnumMember = WellKnownTags.EnumMember;
public const string Event = WellKnownTags.Event;
public const string ExtensionMethod = WellKnownTags.ExtensionMethod;
public const string Field = WellKnownTags.Field;
public const string Interface = WellKnownTags.Interface;
public const string Intrinsic = WellKnownTags.Intrinsic;
public const string Keyword = WellKnownTags.Keyword;
public const string Label = WellKnownTags.Label;
public const string Local = WellKnownTags.Local;
public const string Namespace = WellKnownTags.Namespace;
public const string Method = WellKnownTags.Method;
public const string Module = WellKnownTags.Module;
public const string Operator = WellKnownTags.Operator;
public const string Parameter = WellKnownTags.Parameter;
public const string Property = WellKnownTags.Property;
public const string RangeVariable = WellKnownTags.RangeVariable;
public const string Reference = WellKnownTags.Reference;
public const string Structure = WellKnownTags.Structure;
public const string TypeParameter = WellKnownTags.TypeParameter;
// other
public const string Snippet = WellKnownTags.Snippet;
public const string Error = WellKnownTags.Error;
public const string Warning = WellKnownTags.Warning;
internal const string StatusInformation = WellKnownTags.StatusInformation;
} | mit | C# |
9cfee12d9ec2021398363ccef452012f5c112007 | fix version | arkoc/EntityFramework.Guardian | EntityFramework.Guardian.Core/Properties/AssemblyInfo.cs | EntityFramework.Guardian.Core/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EntityFramework.Guardian")]
[assembly: AssemblyDescription("EntityFramework plugin for implementing database security including row-Level and column-level permissions.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Aram Kocharyan")]
[assembly: AssemblyProduct("EntityFramework.Guardian")]
[assembly: AssemblyCopyright("Copyright © Aram Kocharyan 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("44b106f0-deb2-4121-8af7-45b499b784f3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.1.3.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EntityFramework.Guardian")]
[assembly: AssemblyDescription("EntityFramework plugin for implementing database security including row-Level and column-level permissions.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Aram Kocharyan")]
[assembly: AssemblyProduct("EntityFramework.Guardian")]
[assembly: AssemblyCopyright("Copyright © Aram Kocharyan 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("44b106f0-deb2-4121-8af7-45b499b784f3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.1.2.0")]
| mit | C# |
27d9da743a1e8544746cab824c11be97ac85dcdd | Update version | baylesj/OkayCloudSearch,baylesj/OkayCloudSearch | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OkayCloudSearch")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Amazon CloudSearch Client")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCompany("Jordan Bayles")]
[assembly: AssemblyDescription("Lucene syntax Amazon CloudSearch client")]
// 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("8ace1017-c436-4f00-b040-84f7619af92f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.*")]
[assembly: AssemblyFileVersion("2.2.*")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OkayCloudSearch")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Amazon CloudSearch Client")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCompany("Jordan Bayles")]
[assembly: AssemblyDescription("Lucene syntax Amazon CloudSearch client")]
// 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("8ace1017-c436-4f00-b040-84f7619af92f")]
// 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.*")]
[assembly: AssemblyFileVersion("2.0.*")]
| mit | C# |
c6f1aec28dd318a88a46e4977152d7956b2c45e5 | implement Animal.cs | petyakostova/Rambutan,STzvetkov/Rambutan | Rambutan/Animals/Animal.cs | Rambutan/Animals/Animal.cs | namespace Zoo.Animals
{
using System;
public abstract class Animal
{
// abstract information/methods that all animals can have.
private long animalID;
private AnymalType type; // AnymalType is enumeration with all specific lowest level names like "Lion", "Python", etc.
private Gender gender; // Gender is enumeration
private string dietType;
private double height;
private double weight;
private string color;
private string description;
private DateTime arrivalDate;
private Cade cage;
private HabitatType habitat;
private string healthStatus;
private DateTime dateOfLastExamination
private Veterinarian examinedBy;
// constructors
public Animal(string animalID)
{
this.AnimalID = animalID;
}
// TODO : Implement more constructors.
//properties => TODO : Enter checks.
public int animalID
{
get
{
return this.animalID;
}
set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("can not be null or empty!");
}
this.animalID = value;
}
}
// TODO: implement more properties after corroboration of the fields
// methods
public override string ToString()
{
return string.Format(
@"AnimalID : {0}
AnimalType: {1}
Gender: {2}
DietType: {3}
Height: {4}
Weight: {5}
Color: {6}
Description: {7}
ArrivalDate: {8}
Cage: {9}
Habitat: {10}
HealthStatus: {11}
DateOfLastExamination: {12}
ExaminedBy: {13}
{14}",
this.animalID;
this.type;
this.gender;
this.dietType;
this.height;
this.weight;
this.color;
this.description;
this.arrivalDate;
this.cage;
this.habitat;
this.healthStatus;
this.dateOfLastExamination
this.examinedBy;
new string('-', 40)
);
}
//TODO: Implement more methods
}
}
| namespace Zoo.Animals
{
using System;
public abstract class Animal
{
// TODO: Enter abstract information/methods that all animals can have.
}
}
| mit | C# |
a72a271ea7ecba521fb1dbed10379066cae3e82d | Remove debug prints to concolse | jojona/AGI17_perkunas,jojona/AGI17_perkunas | Perkunas/Assets/Scripts/ViveController.cs | Perkunas/Assets/Scripts/ViveController.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ViveController : MonoBehaviour {
// Use this for initialization
void Start () {
}
private SteamVR_TrackedObject trackedObj;
private SteamVR_Controller.Device Controller
{
get { return SteamVR_Controller.Input((int)trackedObj.index); }
}
void Awake() {
trackedObj = GetComponent<SteamVR_TrackedObject> ();
}
// Update is called once per frame
void Update () {
// Controller inputs
// Touchpad
// Location
if (Controller.GetAxis () != Vector2.zero) {
//Debug.Log (gameObject.name + Controller.GetAxis ());
}
if (Controller.GetPress (SteamVR_Controller.ButtonMask.Touchpad)) {
LaserPointer pointer = this.gameObject.GetComponent<LaserPointer> ();
pointer.holdDown();
}
if (Controller.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad))
{
LaserPointer pointer = this.gameObject.GetComponent<LaserPointer> ();
pointer.release();
}
// Hair Trigger
if (Controller.GetHairTriggerDown ()) {
//Debug.Log (gameObject.name + "Trigger Press");
Grabber g = this.gameObject.GetComponent<Grabber> ();
if (g != null) {
g.grab ();
}
}
if (Controller.GetHairTriggerUp()) {
//Debug.Log(gameObject.name + "Trigger Release");
Grabber g = this.gameObject.GetComponent<Grabber> ();
if (g != null) {
g.ungrab (Controller.velocity, Controller.angularVelocity);
}
}
if (Controller.GetHairTrigger ()) {
//Debug.Log (gameObject.name + "Trigger get");
}
// Grip button
if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip)) {
//Debug.Log(gameObject.name + " Grip Press");
}
if (Controller.GetPressUp(SteamVR_Controller.ButtonMask.Grip)) {
//Debug.Log(gameObject.name + " Grip Release");
}
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ViveController : MonoBehaviour {
// Use this for initialization
void Start () {
}
private SteamVR_TrackedObject trackedObj;
private SteamVR_Controller.Device Controller
{
get { return SteamVR_Controller.Input((int)trackedObj.index); }
}
void Awake() {
trackedObj = GetComponent<SteamVR_TrackedObject> ();
}
// Update is called once per frame
void Update () {
// Controller inputs
// Touchpad
// Location
if (Controller.GetAxis () != Vector2.zero) {
Debug.Log (gameObject.name + Controller.GetAxis ());
}
if (Controller.GetPress (SteamVR_Controller.ButtonMask.Touchpad)) {
LaserPointer pointer = this.gameObject.GetComponent<LaserPointer> ();
pointer.holdDown();
}
if (Controller.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad))
{
LaserPointer pointer = this.gameObject.GetComponent<LaserPointer> ();
pointer.release();
}
// Hair Trigger
if (Controller.GetHairTriggerDown ()) {
Debug.Log (gameObject.name + "Trigger Press");
Grabber g = this.gameObject.GetComponent<Grabber> ();
if (g != null) {
g.grab ();
}
}
if (Controller.GetHairTriggerUp()) {
Debug.Log(gameObject.name + "Trigger Release");
Grabber g = this.gameObject.GetComponent<Grabber> ();
if (g != null) {
g.ungrab (Controller.velocity, Controller.angularVelocity);
}
}
if (Controller.GetHairTrigger ()) {
Debug.Log (gameObject.name + "Trigger get");
}
// Grip button
if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip)) {
Debug.Log(gameObject.name + " Grip Press");
}
if (Controller.GetPressUp(SteamVR_Controller.ButtonMask.Grip)) {
Debug.Log(gameObject.name + " Grip Release");
}
}
}
| mit | C# |
d903c3ece1378e49cc49f84a92d0717602ffdada | Fix compilation error | tzachshabtay/MonoAGS | Source/Engine/AGS.Engine.Desktop/DesktopKeyboardState.cs | Source/Engine/AGS.Engine.Desktop/DesktopKeyboardState.cs | using System;
using AGS.API;
namespace AGS.Engine.Desktop
{
public class DesktopKeyboardState : IKeyboardState
{
public DesktopKeyboardState()
{
OnSoftKeyboardHidden = new AGSEvent<AGSEventArgs>();
}
public bool CapslockOn { get { return Console.CapsLock; } }
public IEvent<AGSEventArgs> OnSoftKeyboardHidden { get; private set; }
public bool SoftKeyboardVisible { get { return false; } }
public void HideSoftKeyboard() { }
public void ShowSoftKeyboard() { }
}
}
| using System;
namespace AGS.Engine.Desktop
{
public class DesktopKeyboardState : IKeyboardState
{
public bool CapslockOn { get { return Console.CapsLock; } }
public bool SoftKeyboardVisible { get { return false; } }
public void HideSoftKeyboard() { }
public void ShowSoftKeyboard() { }
}
}
| artistic-2.0 | C# |
70f03052fb4accd42cf8edc3b943b46a044016be | Use ChatRelay instead of UIManager when examining objects | krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation,Necromunger/unitystation,krille90/unitystation,Necromunger/unitystation,krille90/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation | UnityProject/Assets/Scripts/Objects/MessageOnInteract.cs | UnityProject/Assets/Scripts/Objects/MessageOnInteract.cs | using JetBrains.Annotations;
using PlayGroups.Input;
using UI;
using UnityEngine;
public class MessageOnInteract : InputTrigger
{
public string Message;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public override void Interact(GameObject originator, Vector3 position, string hand)
{
ChatRelay.Instance.AddToChatLogClient(Message, ChatChannel.Examine);
}
}
| using JetBrains.Annotations;
using PlayGroups.Input;
using UI;
using UnityEngine;
public class MessageOnInteract : InputTrigger
{
public string Message;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public override void Interact(GameObject originator, Vector3 position, string hand)
{
UIManager.Chat.AddChatEvent(new ChatEvent(Message, ChatChannel.Examine));
}
}
| agpl-3.0 | C# |
3d089c0a1a47d1778101605ad0dfc638b505b340 | bump version to 1.3.4 | jpdillingham/Utility.CommandLine.Arguments,jpdillingham/Utility.CommandLine.Arguments | Utility.CommandLine.Arguments/Properties/AssemblyInfo.cs | Utility.CommandLine.Arguments/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Utility.CommandLine.Arguments")]
[assembly: AssemblyDescription("A C# .NET Class Library containing tools for parsing the command line arguments of console applications.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Utility.CommandLine.Arguments")]
[assembly: AssemblyCopyright("Copyright (c) 2017 JP Dillingham ([email protected])")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("b739dd22-4bd3-4d17-a351-33d129e9fe30")]
[assembly: AssemblyVersion("1.3.4")]
[assembly: AssemblyFileVersion("1.3.4")] | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Utility.CommandLine.Arguments")]
[assembly: AssemblyDescription("A C# .NET Class Library containing tools for parsing the command line arguments of console applications.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Utility.CommandLine.Arguments")]
[assembly: AssemblyCopyright("Copyright (c) 2017 JP Dillingham ([email protected])")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("b739dd22-4bd3-4d17-a351-33d129e9fe30")]
[assembly: AssemblyVersion("1.3.3")]
[assembly: AssemblyFileVersion("1.3.3")] | mit | C# |
a2f11709031851c7cf8bcf2902795cfd12218698 | Validate the WalletName property. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs | WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs | using ReactiveUI;
using System;
using System.IO;
using System.Windows.Input;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Wallets;
using WalletWasabi.Stores;
using NBitcoin;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.AddWallet;
using System.Threading.Tasks;
using WalletWasabi.Gui.Validation;
using WalletWasabi.Models;
namespace WalletWasabi.Fluent.ViewModels
{
public class AddWalletPageViewModel : NavBarItemViewModel
{
private string _walletName = "";
private bool _optionsEnabled;
public AddWalletPageViewModel(IScreen screen, WalletManager walletManager, BitcoinStore store, Network network) : base(screen)
{
Title = "Add Wallet";
this.WhenAnyValue(x => x.WalletName)
.Select(x => !string.IsNullOrWhiteSpace(x))
.Subscribe(x => OptionsEnabled = x);
RecoverWalletCommand = ReactiveCommand.Create(() => screen.Router.Navigate.Execute(new RecoveryPageViewModel(screen)));
CreateWalletCommand = ReactiveCommand.CreateFromTask(
async () =>
{
var result = await PasswordInteraction.Handle("").ToTask();
if (result is { } password)
{
var (km, mnemonic) = await Task.Run(
() =>
{
var walletGenerator = new WalletGenerator(
walletManager.WalletDirectories.WalletsDir,
network)
{
TipHeight = store.SmartHeaderChain.TipHeight
};
return walletGenerator.GenerateWallet(WalletName, password);
});
await screen.Router.Navigate.Execute(
new RecoveryWordsViewModel(screen, km, mnemonic, walletManager));
}
});
PasswordInteraction = new Interaction<string, string?>();
PasswordInteraction.RegisterHandler(
async interaction => interaction.SetOutput(await new EnterPasswordViewModel().ShowDialogAsync()));
this.ValidateProperty(x => x.WalletName, errors => ValidateWalletName(errors, walletManager, WalletName));
}
private void ValidateWalletName(IValidationErrors errors, WalletManager walletManager, string walletName)
{
string walletFilePath = Path.Combine(walletManager.WalletDirectories.WalletsDir, $"{walletName}.json");
if (string.IsNullOrEmpty(walletName))
{
return;
}
if (File.Exists(walletFilePath))
{
errors.Add(ErrorSeverity.Error, $"A wallet named {WalletName} already exists. Please try a different name.");
}
if (string.IsNullOrWhiteSpace(walletName))
{
errors.Add(ErrorSeverity.Error, "Wallet name is not valid.");
return;
}
if (!WalletGenerator.ValidateWalletName(walletName))
{
errors.Add(ErrorSeverity.Error, $"{walletName} is not a valid Wallet name. Please try a different name.");
}
}
public override string IconName => "add_circle_regular";
public string WalletName
{
get => _walletName;
set => this.RaiseAndSetIfChanged(ref _walletName, value);
}
public bool OptionsEnabled
{
get => _optionsEnabled;
set => this.RaiseAndSetIfChanged(ref _optionsEnabled, value);
}
private Interaction<string, string?> PasswordInteraction { get; }
public ICommand CreateWalletCommand { get; }
public ICommand RecoverWalletCommand { get; }
}
} | using ReactiveUI;
using System;
using System.Windows.Input;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Wallets;
using WalletWasabi.Stores;
using NBitcoin;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.AddWallet;
using System.Threading.Tasks;
namespace WalletWasabi.Fluent.ViewModels
{
public class AddWalletPageViewModel : NavBarItemViewModel
{
private string _walletName = "";
private bool _optionsEnabled;
public AddWalletPageViewModel(IScreen screen, WalletManager walletManager, BitcoinStore store, Network network) : base(screen)
{
Title = "Add Wallet";
this.WhenAnyValue(x => x.WalletName)
.Select(x => !string.IsNullOrWhiteSpace(x))
.Subscribe(x => OptionsEnabled = x);
RecoverWalletCommand = ReactiveCommand.Create(() => screen.Router.Navigate.Execute(new RecoveryPageViewModel(screen)));
CreateWalletCommand = ReactiveCommand.CreateFromTask(
async () =>
{
var result = await PasswordInteraction.Handle("").ToTask();
if (result is { } password)
{
var (km, mnemonic) = await Task.Run(
() =>
{
var walletGenerator = new WalletGenerator(walletManager.WalletDirectories.WalletsDir,network)
{
TipHeight = store.SmartHeaderChain.TipHeight
};
return walletGenerator.GenerateWallet(WalletName, password);
});
await screen.Router.Navigate.Execute(
new RecoveryWordsViewModel(screen, km, mnemonic, walletManager));
}
});
PasswordInteraction = new Interaction<string, string?>();
PasswordInteraction.RegisterHandler(
async interaction => interaction.SetOutput(await new EnterPasswordViewModel().ShowDialogAsync()));
}
public override string IconName => "add_circle_regular";
public string WalletName
{
get => _walletName;
set => this.RaiseAndSetIfChanged(ref _walletName, value);
}
public bool OptionsEnabled
{
get => _optionsEnabled;
set => this.RaiseAndSetIfChanged(ref _optionsEnabled, value);
}
private Interaction<string, string?> PasswordInteraction { get; }
public ICommand CreateWalletCommand { get; }
public ICommand RecoverWalletCommand { get; }
}
} | mit | C# |
00327a318e55499301d05ba5b98549e3b98ea425 | Fix pragma warning restore (#26389) | poizan42/coreclr,krk/coreclr,cshung/coreclr,krk/coreclr,krk/coreclr,krk/coreclr,cshung/coreclr,poizan42/coreclr,poizan42/coreclr,poizan42/coreclr,poizan42/coreclr,cshung/coreclr,cshung/coreclr,cshung/coreclr,krk/coreclr,krk/coreclr,cshung/coreclr,poizan42/coreclr | src/System.Private.CoreLib/shared/System/ByReference.cs | src/System.Private.CoreLib/shared/System/ByReference.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.Runtime.CompilerServices;
using System.Runtime.Versioning;
namespace System
{
// ByReference<T> is meant to be used to represent "ref T" fields. It is working
// around lack of first class support for byref fields in C# and IL. The JIT and
// type loader has special handling for it that turns it into a thin wrapper around ref T.
[NonVersionable]
internal readonly ref struct ByReference<T>
{
// CS0169: The private field '{blah}' is never used
#pragma warning disable 169
#pragma warning disable CA1823
private readonly IntPtr _value;
#pragma warning restore CA1823
#pragma warning restore 169
[Intrinsic]
public ByReference(ref T value)
{
// Implemented as a JIT intrinsic - This default implementation is for
// completeness and to provide a concrete error if called via reflection
// or if intrinsic is missed.
throw new PlatformNotSupportedException();
}
public ref T Value
{
[Intrinsic]
get
{
// Implemented as a JIT intrinsic - This default implementation is for
// completeness and to provide a concrete error if called via reflection
// or if the intrinsic is missed.
throw new PlatformNotSupportedException();
}
}
}
}
| // 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.Runtime.CompilerServices;
using System.Runtime.Versioning;
namespace System
{
// ByReference<T> is meant to be used to represent "ref T" fields. It is working
// around lack of first class support for byref fields in C# and IL. The JIT and
// type loader has special handling for it that turns it into a thin wrapper around ref T.
[NonVersionable]
internal readonly ref struct ByReference<T>
{
// CS0169: The private field '{blah}' is never used
#pragma warning disable 169
#pragma warning disable CA1823
private readonly IntPtr _value;
#pragma warning disable CA1823
#pragma warning restore 169
[Intrinsic]
public ByReference(ref T value)
{
// Implemented as a JIT intrinsic - This default implementation is for
// completeness and to provide a concrete error if called via reflection
// or if intrinsic is missed.
throw new PlatformNotSupportedException();
}
public ref T Value
{
[Intrinsic]
get
{
// Implemented as a JIT intrinsic - This default implementation is for
// completeness and to provide a concrete error if called via reflection
// or if the intrinsic is missed.
throw new PlatformNotSupportedException();
}
}
}
}
| mit | C# |
b9841f62ef91b94e4ab768e67dd8505425e88d78 | define ActionCreator | mattak/Unidux | Assets/Plugins/Unidux/Examples/Todo/Scripts/TodoVisibilityDuck.cs | Assets/Plugins/Unidux/Examples/Todo/Scripts/TodoVisibilityDuck.cs | namespace Unidux.Example.Todo
{
public static class TodoVisibilityDuck
{
public enum ActionType
{
SET_VISIBILITY,
}
public class Action
{
public ActionType ActionType;
public VisibilityFilter Filter;
}
public static class ActionCreator
{
public static Action SetVisibility(VisibilityFilter filter)
{
return new Action()
{
ActionType = ActionType.SET_VISIBILITY,
Filter = filter,
};
}
}
public static State Reducer(State state, Action action)
{
switch (action.ActionType)
{
case ActionType.SET_VISIBILITY:
state.Todo = SetVisibility(state.Todo, action.Filter);
return state;
}
return state;
}
public static TodoState SetVisibility(TodoState state, VisibilityFilter filter)
{
state.Filter = filter;
state.SetStateChanged();
return state;
}
}
} | namespace Unidux.Example.Todo
{
public static class TodoVisibilityDuck
{
public enum ActionType
{
SET_VISIBILITY,
}
public class Action
{
public ActionType ActionType;
public VisibilityFilter Filter;
}
public static State Reducer(State state, Action action)
{
switch (action.ActionType)
{
case ActionType.SET_VISIBILITY:
state.Todo = SetVisibility(state.Todo, action.Filter);
return state;
}
return state;
}
public static TodoState SetVisibility(TodoState state, VisibilityFilter filter)
{
// TODO: be immutable
state.Filter = filter;
state.SetStateChanged();
return state;
}
}
} | mit | C# |
f45220e8d14cc44c36db74585ea5b2ae6ada5062 | remove testcode #26 | neuecc/MagicOnion | sandbox/Sandbox.ConsoleServer/Services/MyFirstService.cs | sandbox/Sandbox.ConsoleServer/Services/MyFirstService.cs | #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
using MagicOnion;
using MagicOnion.Server;
using System.Threading.Tasks;
using System;
namespace Sandbox.ConsoleServer.Services
{
public class MyFirstService : ServiceBase<IMyFirstService>, IMyFirstService
{
public async Task<UnaryResult<string>> SumAsync(int x, int y)
{
return UnaryResult((x + y).ToString());
}
public UnaryResult<string> SumAsync2(int x, int y)
{
return UnaryResult((x + y).ToString());
}
public async Task<ClientStreamingResult<int, string>> StreamingOne()
{
var stream = GetClientStreamingContext<int, string>();
await stream.ForEachAsync(x =>
{
});
return stream.Result("finished");
}
public async Task<ServerStreamingResult<string>> StreamingTwo(int x, int y, int z)
{
var stream = GetServerStreamingContext<string>();
var acc = 0;
for (int i = 0; i < z; i++)
{
acc = acc + x + y;
await stream.WriteAsync(acc.ToString());
}
return stream.Result();
}
public ServerStreamingResult<string> StreamingTwo2(int x, int y, int z)
{
var stream = GetServerStreamingContext<string>();
return stream.Result();
}
public async Task<DuplexStreamingResult<int, string>> StreamingThree()
{
var stream = GetDuplexStreamingContext<int, string>();
var waitTask = Task.Run(async () =>
{
await stream.ForEachAsync(x =>
{
});
});
await stream.WriteAsync("test1");
await stream.WriteAsync("test2");
await stream.WriteAsync("finish");
await waitTask;
return stream.Result();
}
}
}
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously | #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
using MagicOnion;
using MagicOnion.Server;
using System.Threading.Tasks;
using System;
namespace Sandbox.ConsoleServer.Services
{
public class MyFirstService : ServiceBase<IMyFirstService>, IMyFirstService
{
public async Task<UnaryResult<string>> SumAsync(int x, int y)
{
return ReturnStatus<string>((Grpc.Core.StatusCode)101, null);
//return UnaryResult((x + y).ToString());
}
public UnaryResult<string> SumAsync2(int x, int y)
{
return UnaryResult((x + y).ToString());
}
public async Task<ClientStreamingResult<int, string>> StreamingOne()
{
var stream = GetClientStreamingContext<int, string>();
await stream.ForEachAsync(x =>
{
});
return stream.Result("finished");
}
public async Task<ServerStreamingResult<string>> StreamingTwo(int x, int y, int z)
{
var stream = GetServerStreamingContext<string>();
var acc = 0;
for (int i = 0; i < z; i++)
{
acc = acc + x + y;
await stream.WriteAsync(acc.ToString());
}
return stream.Result();
}
public ServerStreamingResult<string> StreamingTwo2(int x, int y, int z)
{
var stream = GetServerStreamingContext<string>();
return stream.Result();
}
public async Task<DuplexStreamingResult<int, string>> StreamingThree()
{
var stream = GetDuplexStreamingContext<int, string>();
var waitTask = Task.Run(async () =>
{
await stream.ForEachAsync(x =>
{
});
});
await stream.WriteAsync("test1");
await stream.WriteAsync("test2");
await stream.WriteAsync("finish");
await waitTask;
return stream.Result();
}
}
}
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously | mit | C# |
e89f310d97813103ea8f09c075e4043a6ffeb289 | Update EntityUnitOfWork.cs | tiksn/TIKSN-Framework | TIKSN.Framework.Core/Data/EntityFrameworkCore/EntityUnitOfWork.cs | TIKSN.Framework.Core/Data/EntityFrameworkCore/EntityUnitOfWork.cs | using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace TIKSN.Data.EntityFrameworkCore
{
public class EntityUnitOfWork : UnitOfWorkBase
{
private readonly DbContext[] _dbContexts;
public EntityUnitOfWork(DbContext[] dbContexts) => this._dbContexts = dbContexts;
public override async Task CompleteAsync(CancellationToken cancellationToken)
{
var tasks = this._dbContexts.Select(dbContext => dbContext.SaveChangesAsync(cancellationToken)).ToArray();
await Task.WhenAll(tasks);
}
public override Task DiscardAsync(CancellationToken cancellationToken)
{
this._dbContexts.Do(dbContext => dbContext.ChangeTracker.Clear());
return Task.CompletedTask;
}
protected override bool IsDirty() => this._dbContexts.Any(dbContext => dbContext.ChangeTracker.HasChanges());
}
}
| using Microsoft.EntityFrameworkCore;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.EntityFrameworkCore
{
public class EntityUnitOfWork : UnitOfWorkBase
{
private readonly DbContext[] _dbContexts;
public EntityUnitOfWork(DbContext[] dbContexts)
{
_dbContexts = dbContexts;
}
public override async Task CompleteAsync(CancellationToken cancellationToken)
{
var tasks = _dbContexts.Select(dbContext => dbContext.SaveChangesAsync(cancellationToken)).ToArray();
await Task.WhenAll(tasks);
}
public override Task DiscardAsync(CancellationToken cancellationToken)
{
_dbContexts.Do(dbContext => dbContext.ChangeTracker.Clear());
return Task.CompletedTask;
}
protected override bool IsDirty()
{
return _dbContexts.Any(dbContext => dbContext.ChangeTracker.HasChanges());
}
}
} | mit | C# |
e9371770735858067b23e8b6b0ceeaeaf7334a9c | Update to RC1 | Azure-Samples/active-directory-dotnet-webapp-webapi-openidconnect-aspnet5,AzureADSamples/WebApp-WebAPI-OpenIdConnect-AspNet5,AzureADSamples/WebApp-WebAPI-OpenIdConnect-AspNet5,Azure-Samples/active-directory-dotnet-webapp-webapi-openidconnect-aspnet5,Azure-Samples/active-directory-dotnet-webapp-webapi-openidconnect-aspnet5,AzureADSamples/WebApp-WebAPI-OpenIdConnect-AspNet5 | TodoListWebApp/Utils/NaiveSessionCache.cs | TodoListWebApp/Utils/NaiveSessionCache.cs | using Microsoft.AspNet.Http;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System;
using Microsoft.AspNet.Http.Features;
namespace TodoListWebApp.Utils
{
public class NaiveSessionCache : TokenCache
{
private static readonly object FileLock = new object();
string UserObjectId = string.Empty;
string CacheId = string.Empty;
ISession Session = null;
public NaiveSessionCache(string userId, ISession session)
{
UserObjectId = userId;
CacheId = UserObjectId + "_TokenCache";
Session = session;
this.AfterAccess = AfterAccessNotification;
this.BeforeAccess = BeforeAccessNotification;
Load();
}
public void Load()
{
lock (FileLock)
{
this.Deserialize(Session.Get(CacheId));
}
}
public void Persist()
{
lock (FileLock)
{
// reflect changes in the persistent store
Session.Set(CacheId, this.Serialize());
// once the write operation took place, restore the HasStateChanged bit to false
this.HasStateChanged = false;
}
}
// Empties the persistent store.
public override void Clear()
{
base.Clear();
Session.Remove(CacheId);
}
public override void DeleteItem(TokenCacheItem item)
{
base.DeleteItem(item);
Persist();
}
// Triggered right before ADAL needs to access the cache.
// Reload the cache from the persistent store in case it changed since the last access.
void BeforeAccessNotification(TokenCacheNotificationArgs args)
{
Load();
}
// Triggered right after ADAL accessed the cache.
void AfterAccessNotification(TokenCacheNotificationArgs args)
{
// if the access operation resulted in a cache update
if (this.HasStateChanged)
{
Persist();
}
}
}
} | using Microsoft.AspNet.Http;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System;
using Microsoft.AspNet.Http.Features;
namespace TodoListWebApp.Utils
{
public class NaiveSessionCache : TokenCache
{
private static readonly object FileLock = new object();
string UserObjectId = string.Empty;
string CacheId = string.Empty;
ISession Session = null;
public NaiveSessionCache(string userId, ISession session)
{
UserObjectId = userId;
CacheId = UserObjectId + "_TokenCache";
Session = session;
this.AfterAccess = AfterAccessNotification;
this.BeforeAccess = BeforeAccessNotification;
Load();
}
public void Load()
{
lock (FileLock)
{
this.Deserialize((byte[])Session.Get(CacheId));
}
}
public void Persist()
{
lock (FileLock)
{
// reflect changes in the persistent store
Session.Set(CacheId, this.Serialize());
// once the write operation took place, restore the HasStateChanged bit to false
this.HasStateChanged = false;
}
}
// Empties the persistent store.
public override void Clear()
{
base.Clear();
Session.Remove(CacheId);
}
public override void DeleteItem(TokenCacheItem item)
{
base.DeleteItem(item);
Persist();
}
// Triggered right before ADAL needs to access the cache.
// Reload the cache from the persistent store in case it changed since the last access.
void BeforeAccessNotification(TokenCacheNotificationArgs args)
{
Load();
}
// Triggered right after ADAL accessed the cache.
void AfterAccessNotification(TokenCacheNotificationArgs args)
{
// if the access operation resulted in a cache update
if (this.HasStateChanged)
{
Persist();
}
}
}
} | apache-2.0 | C# |
0ad62b147586c02a3588c7b2464f93997cfd2b23 | remove usless var | skacofonix/WhatTheMovie,skacofonix/WhatTheMovie,skacofonix/WhatTheMovie | WTM.Crawler.Test/Parser/ShotParserTest.cs | WTM.Crawler.Test/Parser/ShotParserTest.cs | using NFluent;
using NUnit.Framework;
using WTM.Crawler.Parsers;
using WTM.Domain;
namespace WTM.Crawler.Test.Parser
{
[TestFixture]
public class ShotParserTest
{
[Test]
public void ShouldParseShotPage()
{
var shot1 = ParseShotAndDoBasicCheck(1);
Check.That(shot1.Navigation.PreviousId).IsNull();
Check.That(shot1.Navigation.PreviousUnsolvedId).IsNull();
ParseShotAndDoBasicCheck(10);
ParseShotAndDoBasicCheck(350532);
var shot352612 = ParseShotAndDoBasicCheck(352612);
Check.That(shot352612.UserStatus).Equals(ShotUserStatus.Unsolved);
ParseShotAndDoBasicCheck(353243);
}
[Test]
public void ShouldParseNerverSolvedShotPage()
{
var shot350523 = ParseShotAndDoBasicCheck(350523);
Check.That(shot350523.FirstSolver).IsNull();
Check.That(shot350523.UserStatus).Equals(ShotUserStatus.NeverSolved);
}
private Shot ParseShotAndDoBasicCheck(int shotId)
{
var shot = ParseFakeShot(shotId);
Check.That(shotId).Equals(shot.ShotId);
Check.That(shot.Poster).IsNotNull();
Check.That(shot.ImageUri).IsNotNull();
return shot;
}
private Shot ParseFakeShot(int shotId)
{
var resourceName = string.Format("Resources/Shots/{0}.html", shotId);
return CreateParserWithFakeFile(resourceName).GetById(shotId);
}
private ShotParser CreateParserWithFakeFile(string htmlFilePath)
{
return new ShotParser(new WebClientFake(htmlFilePath), new HtmlParser());
}
}
} | using NFluent;
using NUnit.Framework;
using WTM.Crawler.Parsers;
using WTM.Domain;
namespace WTM.Crawler.Test.Parser
{
[TestFixture]
public class ShotParserTest
{
[Test]
public void ShouldParseShotPage()
{
var shot1 = ParseShotAndDoBasicCheck(1);
Check.That(shot1.Navigation.PreviousId).IsNull();
Check.That(shot1.Navigation.PreviousUnsolvedId).IsNull();
ParseShotAndDoBasicCheck(10);
var shot350532 = ParseShotAndDoBasicCheck(350532);
var shot352612 = ParseShotAndDoBasicCheck(352612);
Check.That(shot352612.UserStatus).Equals(ShotUserStatus.Unsolved);
ParseShotAndDoBasicCheck(353243);
}
[Test]
public void ShouldParseNerverSolvedShotPage()
{
var shot350523 = ParseShotAndDoBasicCheck(350523);
Check.That(shot350523.FirstSolver).IsNull();
Check.That(shot350523.UserStatus).Equals(ShotUserStatus.NeverSolved);
}
private Shot ParseShotAndDoBasicCheck(int shotId)
{
var shot = ParseFakeShot(shotId);
Check.That(shotId).Equals(shot.ShotId);
Check.That(shot.Poster).IsNotNull();
Check.That(shot.ImageUri).IsNotNull();
return shot;
}
private Shot ParseFakeShot(int shotId)
{
var resourceName = string.Format("Resources/Shots/{0}.html", shotId);
return CreateParserWithFakeFile(resourceName).GetById(shotId);
}
private ShotParser CreateParserWithFakeFile(string htmlFilePath)
{
return new ShotParser(new WebClientFake(htmlFilePath), new HtmlParser());
}
}
} | mit | C# |
30964d8a2bd0521de37dcc5e7f383a4016eb7cb8 | Support classic | testfairy/testfairy-xamarin | samples/TestFairySampleiOS/TestFairySampleiOS/TestFairySampleiOSViewController.designer.cs | samples/TestFairySampleiOS/TestFairySampleiOS/TestFairySampleiOSViewController.designer.cs | // WARNING
//
// This file has been generated automatically by Xamarin Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
#if ! __UNIFIED__
using MonoTouch.Foundation;
#else
using Foundation;
using UIKit;
#endif
using System;
using System.CodeDom.Compiler;
namespace TestFairySampleiOS
{
[Register ("TestFairySampleiOSViewController")]
partial class TestFairySampleiOSViewController
{
void ReleaseDesignerOutlets ()
{
}
}
}
| // WARNING
//
// This file has been generated automatically by Xamarin Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
#if ! __UNIFIED__
#else
using Foundation;
using UIKit;
#endif
using System;
using System.CodeDom.Compiler;
namespace TestFairySampleiOS
{
[Register ("TestFairySampleiOSViewController")]
partial class TestFairySampleiOSViewController
{
void ReleaseDesignerOutlets ()
{
}
}
}
| apache-2.0 | C# |
64d36e053b90483173bc5bb70daa38f27cc602e5 | Test deploy | nzkelvin/vocabulary | vocab/vocab.mvc/Views/Home/Index.cshtml | vocab/vocab.mvc/Views/Home/Index.cshtml |
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>Testtttttt</p>
|
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
| mit | C# |
78a158284ea7d72a07cdacf2f48425ba94c650a7 | Support Unity 2017.3+ | DragonBox/u3d,DragonBox/u3d | examples/Example2/Assets/Editor/EditorRun.cs | examples/Example2/Assets/Editor/EditorRun.cs | using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
using System.IO;
using System;
namespace U3d {
class EditorRun {
[MenuItem ("U3d/Example/Build")]
static void Build() {
Debug.Log("Building Example2");
BuildTarget Target;
#if UNITY_2017_3_OR_NEWER
Target = BuildTarget.StandaloneOSX;
#else
Target = BuildTarget.StandaloneOSXIntel64;
#endif
BuildPlayer(EditorBuildSettings.scenes, "target/Example2.app", Target, BuildOptions.None);
}
private static void BuildPlayer(EditorBuildSettingsScene[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options) {
FileSystemUtil.EnsureParentExists(target_dir);
string res = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options);
if (res.Length > 0) {
throw new Exception("BuildPlayer failure: " + res);
}
}
}
class FileSystemUtil {
public static void EnsureParentExists(string target_dir) {
DirectoryInfo parent = Directory.GetParent(target_dir);
if (!parent.Exists) {
Directory.CreateDirectory(parent.FullName);
}
}
}
}
| using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
using System.IO;
using System;
namespace U3d {
class EditorRun {
[MenuItem ("U3d/Example/Build")]
static void Build() {
Debug.Log("Building Example2");
BuildPlayer(EditorBuildSettings.scenes, "target/Example2.app", BuildTarget.StandaloneOSXIntel64, BuildOptions.None);
}
private static void BuildPlayer(EditorBuildSettingsScene[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options) {
FileSystemUtil.EnsureParentExists(target_dir);
string res = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options);
if (res.Length > 0) {
throw new Exception("BuildPlayer failure: " + res);
}
}
}
class FileSystemUtil {
public static void EnsureParentExists(string target_dir) {
DirectoryInfo parent = Directory.GetParent(target_dir);
if (!parent.Exists) {
Directory.CreateDirectory(parent.FullName);
}
}
}
}
| mit | C# |
f7bf7318d5090cf4ab3d0fc8567ae767f2b409df | Make RegistrationFeature AtRestPath user configurable | timba/NServiceKit,nataren/NServiceKit,NServiceKit/NServiceKit,timba/NServiceKit,MindTouch/NServiceKit,NServiceKit/NServiceKit,NServiceKit/NServiceKit,MindTouch/NServiceKit,ZocDoc/ServiceStack,timba/NServiceKit,nataren/NServiceKit,ZocDoc/ServiceStack,ZocDoc/ServiceStack,ZocDoc/ServiceStack,MindTouch/NServiceKit,nataren/NServiceKit,nataren/NServiceKit,MindTouch/NServiceKit,NServiceKit/NServiceKit,timba/NServiceKit | src/ServiceStack.ServiceInterface/RegistrationFeature.cs | src/ServiceStack.ServiceInterface/RegistrationFeature.cs | using System;
using ServiceStack.FluentValidation;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.WebHost.Endpoints;
namespace ServiceStack.ServiceInterface
{
/// <summary>
/// Enable the Registration feature and configure the RegistrationService.
/// </summary>
public class RegistrationFeature : IPlugin
{
public string AtRestPath { get; set; }
public RegistrationFeature()
{
this.AtRestPath = "/register";
}
public void Register(IAppHost appHost)
{
appHost.RegisterService<RegistrationService>(AtRestPath);
appHost.RegisterAs<RegistrationValidator, IValidator<Registration>>();
}
}
} | using System;
using ServiceStack.FluentValidation;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.WebHost.Endpoints;
namespace ServiceStack.ServiceInterface
{
/// <summary>
/// Enable the Registration feature and configure the RegistrationService.
/// </summary>
public class RegistrationFeature : IPlugin
{
private string AtRestPath { get; set; }
public RegistrationFeature()
{
this.AtRestPath = "/register";
}
public void Register(IAppHost appHost)
{
appHost.RegisterService<RegistrationService>(AtRestPath);
appHost.RegisterAs<RegistrationValidator, IValidator<Registration>>();
}
}
} | bsd-3-clause | C# |
454eec2acfaf731a28d30f2c5d7278486402f54c | Make sure Settings is never null | NickCraver/StackExchange.Exceptional,NickCraver/StackExchange.Exceptional | src/StackExchange.Exceptional.Shared/Internal/Statics.cs | src/StackExchange.Exceptional.Shared/Internal/Statics.cs | namespace StackExchange.Exceptional.Internal
{
/// <summary>
/// Internal Exceptional static controls, not meant for consumption.
/// This can and probably will break without warning. Don't use the .Internal namespace directly.
/// </summary>
public static class Statics
{
/// <summary>
/// Settings for context-less logging.
/// </summary>
/// <remarks>
/// In ASP.NET (non-Core) this is populated by the ConfigSettings load.
/// In ASP.NET Core this is populated by .Configure() in the DI pipeline.
/// </remarks>
public static ExceptionalSettingsBase Settings { get; set; } = new ExceptionalSettingsDefault();
/// <summary>
/// Returns whether an error passed in right now would be logged.
/// </summary>
public static bool IsLoggingEnabled { get; set; } = true;
}
}
| namespace StackExchange.Exceptional.Internal
{
/// <summary>
/// Internal Exceptional static controls, not meant for consumption.
/// This can and probably will break without warning. Don't use the .Internal namespace directly.
/// </summary>
public static class Statics
{
/// <summary>
/// Settings for context-less logging.
/// </summary>
/// <remarks>
/// In ASP.NET (non-Core) this is populated by the ConfigSettings load.
/// In ASP.NET Core this is populated by .Configure() in the DI pipeline.
/// </remarks>
public static ExceptionalSettingsBase Settings { get; set; }
/// <summary>
/// Returns whether an error passed in right now would be logged.
/// </summary>
public static bool IsLoggingEnabled { get; set; } = true;
}
}
| apache-2.0 | C# |
91ae4896b083c7a634ba3c116ecf028c854fbb30 | Add API support for #15 | MelHarbour/HeadRaceTiming-Site,MelHarbour/HeadRaceTiming-Site,MelHarbour/HeadRaceTiming-Site | HeadRaceTiming-Site/Controllers/CrewApiController.cs | HeadRaceTiming-Site/Controllers/CrewApiController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using HeadRaceTimingSite.Models;
using Microsoft.EntityFrameworkCore;
using HeadRaceTimingSite.ViewModels;
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace HeadRaceTimingSite.Controllers
{
[Route("api/[controller]")]
public class CrewApiController : Controller
{
private readonly TimingSiteContext _context;
public CrewApiController(TimingSiteContext context)
{
_context = context;
}
[HttpGet("{id}")]
public async Task<Crew> GetById(int id)
{
return await _context.Crews.FirstOrDefaultAsync(x => x.CrewId == id);
}
[HttpGet("ByCompetition/{id}")]
public async Task<IEnumerable<ViewModels.Result>> GetByCompetition(int id)
{
IEnumerable<Crew> crews = await _context.Crews.Where(c => c.CompetitionId == id)
.Include(x => x.Competition.TimingPoints).Include(x => x.Results)
.ToListAsync();
return crews.OrderBy(x => x.OverallTime).Select((x,i) => new ViewModels.Result() { Name = x.Name, StartNumber = x.StartNumber, OverallTime = x.OverallTime, Rank = i+1 })
.ToList();
}
[HttpGet("ByCompetition/{id}/{search}")]
public async Task<IEnumerable<ViewModels.Result>> GetByCompetition(int id, string search)
{
IEnumerable<Crew> crews = await _context.Crews.Where(c => c.CompetitionId == id)
.Include(x => x.Competition.TimingPoints).Include(x => x.Results)
.ToListAsync();
string lowerSearch = search.ToLower();
return crews.OrderBy(x => x.OverallTime).Select((x, i) => new ViewModels.Result() { Name = x.Name, StartNumber = x.StartNumber, OverallTime = x.OverallTime, Rank = i + 1 })
.Where(x => x.Name.ToLower().Contains(lowerSearch))
.ToList();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using HeadRaceTimingSite.Models;
using Microsoft.EntityFrameworkCore;
using HeadRaceTimingSite.ViewModels;
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace HeadRaceTimingSite.Controllers
{
[Route("api/[controller]")]
public class CrewApiController : Controller
{
private readonly TimingSiteContext _context;
public CrewApiController(TimingSiteContext context)
{
_context = context;
}
[HttpGet("{id}")]
public async Task<Crew> GetById(int id)
{
return await _context.Crews.FirstOrDefaultAsync(x => x.CrewId == id);
}
[HttpGet("ByCompetition/{id}")]
public async Task<IEnumerable<ViewModels.Result>> GetByCompetition(int id)
{
IEnumerable<Crew> crews = await _context.Crews.Where(c => c.CompetitionId == id)
.Include(x => x.Competition.TimingPoints).Include(x => x.Results)
.ToListAsync();
return crews.OrderBy(x => x.OverallTime).Select((x,i) => new ViewModels.Result() { Name = x.Name, StartNumber = x.StartNumber, OverallTime = x.OverallTime, Rank = i+1 })
.ToList();
}
}
}
| mit | C# |
155a8d0734ab5900896e7dd949cb054506a2c0b4 | Fix issue #3 | themehrdad/NetTelebot,vertigra/NetTelebot-2.0 | NetTelebot.Commands.TestApplication/CalculatorBot.cs | NetTelebot.Commands.TestApplication/CalculatorBot.cs | namespace NetTelebot.Commands.TestApplication
{
public class CalculatorBot : Bot
{
public CalculatorBot(string token): base("calculator", token)
{
CommandInfo command = new CommandInfo("/start") {StaticAcceptMessage = "Ok you started the calculator"};
Configuration.Commands.Add(command);
Configuration.StaticUnknownCommandMessage = "Unknown command. Please try another command. Send /start to get a list of available comands.";
CommandInfo command2 = new CommandInfo("/newbrand") {StaticAcceptMessage = "New brand is saved."};
ParameterInfo parameter = new ParameterInfo
{
Name = "Name",
Type = ParameterTypes.Text,
Optional = false,
StaticPrompt = "Ok, enter new brand name."
};
command2.Parameters.Add(parameter);
Configuration.Commands.Add(command2);
CommandInfo command3 = new CommandInfo("/getinfo") { StaticAcceptMessage = "New command."};
ParameterInfo parameter2 = new ParameterInfo
{
Name = "Name",
Type = ParameterTypes.Text,
Optional = false,
StaticPrompt = "Is new comand."
};
command3.Parameters.Add(parameter2);
Configuration.Commands.Add(command3);
}
}
}
| namespace NetTelebot.Commands.TestApplication
{
public class CalculatorBot : Bot
{
public CalculatorBot(string token): base("calculator", token)
{
CommandInfo command = new CommandInfo("/start") {StaticAcceptMessage = "Ok you started the calculator"};
Configuration.Commands.Add(command);
Configuration.StaticUnknownCommandMessage = "Unknown command. Please try another command. Send /start to get a list of available comands.";
CommandInfo command2 = new CommandInfo("/newbrand") {StaticAcceptMessage = "New brand is saved."};
ParameterInfo parameter = new ParameterInfo()
{
Name = "Name",
Type = ParameterTypes.Text,
Optional = false,
StaticPrompt = "Ok, enter new brand name."
};
command2.Parameters.Add(parameter);
Configuration.Commands.Add(command2);
CommandInfo command3 = new CommandInfo("/getinfo") { StaticAcceptMessage = "New command."};
ParameterInfo parameter2 = new ParameterInfo()
{
Name = "Name",
Type = ParameterTypes.Text,
Optional = false,
StaticPrompt = "Is new comand."
};
command3.Parameters.Add(parameter2);
Configuration.Commands.Add(command3);
}
}
}
| mit | C# |
2139346f0328b43c30ea8be55391da6e809a4ea1 | Introduce AnonymousObserver | citizenmatt/ndc-london-2013 | rx/rx/Program.cs | rx/rx/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace rx
{
class Program
{
static void Main(string[] args)
{
var subject = new Subject<string>();
using (subject.Subscribe(new AnonymousBobserver<string>(s => Console.WriteLine(s), () => Console.WriteLine("Done"))))
{
var wc = new WebClient();
var task = wc.DownloadStringTaskAsync("http://www.google.com/robots.txt");
task.ContinueWith(t =>
{
subject.OnNext(t.Result);
subject.OnCompleted();
});
// Wait for the async call
Console.ReadLine();
}
}
}
internal class AnonymousBobserver<T> : IBobserver<T>
{
private readonly Action<T> onNext;
private readonly Action onCompleted;
public AnonymousBobserver(Action<T> onNext, Action onCompleted)
{
this.onNext = onNext;
this.onCompleted = onCompleted;
}
public void OnNext(T result)
{
onNext(result);
}
public void OnCompleted()
{
onCompleted();
}
}
public class Subject<T>
{
private readonly IList<IBobserver<T>> observers = new List<IBobserver<T>>();
public IDisposable Subscribe(IBobserver<T> observer)
{
observers.Add(observer);
return new Disposable(() => observers.Remove(observer));
}
public void OnNext(T result)
{
foreach (var observer in observers)
{
observer.OnNext(result);
}
}
public void OnCompleted()
{
foreach (var observer in observers)
{
observer.OnCompleted();
}
}
}
public interface IBobserver<T>
{
void OnNext(T result);
void OnCompleted();
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace rx
{
class Program
{
static void Main(string[] args)
{
var subject = new Subject<string>();
using (subject.Subscribe(result => Console.WriteLine(result)))
{
var wc = new WebClient();
var task = wc.DownloadStringTaskAsync("http://www.google.com/robots.txt");
task.ContinueWith(t =>
{
subject.OnNext(t.Result);
subject.OnCompleted();
});
// Wait for the async call
Console.ReadLine();
}
}
}
public class Subject<T>
{
private readonly IList<IBobserver<T>> observers = new List<IBobserver<T>>();
public IDisposable Subscribe(IBobserver<T> observer)
{
observers.Add(observer);
return new Disposable(() => observers.Remove(observer));
}
public void OnNext(T result)
{
foreach (var observer in observers)
{
observer.OnNext(result);
}
}
public void OnCompleted()
{
foreach (var observer in observers)
{
observer.OnCompleted();
}
}
}
public interface IBobserver<T>
{
void OnNext(T result);
void OnCompleted();
}
}
| mit | C# |
71a39cb875214e2605643dd1de4f825e72dda4f9 | Include async keyword check | giggio/code-cracker,baks/code-cracker,eriawan/code-cracker,code-cracker/code-cracker,kindermannhubert/code-cracker,jhancock93/code-cracker,robsonalves/code-cracker,AlbertoMonteiro/code-cracker,jwooley/code-cracker,adraut/code-cracker,dlsteuer/code-cracker,dmgandini/code-cracker,ElemarJR/code-cracker,akamud/code-cracker,thomaslevesque/code-cracker,carloscds/code-cracker,carloscds/code-cracker,f14n/code-cracker,GuilhermeSa/code-cracker,eirielson/code-cracker,caioadz/code-cracker,gerryaobrien/code-cracker,thorgeirk11/code-cracker,andrecarlucci/code-cracker,modulexcite/code-cracker,code-cracker/code-cracker | src/CSharp/CodeCracker/Style/TaskNameAsyncAnalyzer.cs | src/CSharp/CodeCracker/Style/TaskNameAsyncAnalyzer.cs | using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using System.Collections.Immutable;
using System.Threading.Tasks;
namespace CodeCracker.Style
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class TaskNameAsyncAnalyzer : DiagnosticAnalyzer
{
public const string DiagnosticId = "CC0061";
internal const string Title = "Async method can be terminating with 'Async' name.";
internal const string MessageFormat = "Change method name to {0}";
internal const string Category = SupportedCategories.Style;
const string Description = "Async method can be terminating with 'Async' name.";
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(
DiagnosticId,
Title,
MessageFormat,
Category,
DiagnosticSeverity.Info,
isEnabledByDefault: true,
description: Description,
helpLink: HelpLink.ForDiagnostic(DiagnosticId));
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } }
public override void Initialize(AnalysisContext context)
{
context.RegisterSyntaxNodeAction(AnalyzeMethod, SyntaxKind.MethodDeclaration);
}
private static void AnalyzeMethod(SyntaxNodeAnalysisContext context)
{
var invocationExpression = (MethodDeclarationSyntax)context.Node;
if (invocationExpression.Identifier.ToString().EndsWith("Async")) return;
var returnTask = invocationExpression.ReturnType?.ToString().Contains("Task") ?? false;
if (invocationExpression.Modifiers.Any(SyntaxKind.AsyncKeyword) || returnTask)
{
var errorMessage = invocationExpression.Identifier.ToString() + "Async";
var diag = Diagnostic.Create(Rule, invocationExpression.GetLocation(), errorMessage);
context.ReportDiagnostic(diag);
}
}
}
} | using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using System.Collections.Immutable;
using System.Threading.Tasks;
namespace CodeCracker.Style
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class TaskNameAsyncAnalyzer : DiagnosticAnalyzer
{
public const string DiagnosticId = "CC0061";
internal const string Title = "Async method can be terminating with 'Async' name.";
internal const string MessageFormat = "Change method name to {0}";
internal const string Category = SupportedCategories.Style;
const string Description = "Async method can be terminating with 'Async' name.";
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(
DiagnosticId,
Title,
MessageFormat,
Category,
DiagnosticSeverity.Info,
isEnabledByDefault: true,
description: Description,
helpLink: HelpLink.ForDiagnostic(DiagnosticId));
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } }
public override void Initialize(AnalysisContext context)
{
context.RegisterSyntaxNodeAction(AnalyzeMethod, SyntaxKind.MethodDeclaration);
}
private static void AnalyzeMethod(SyntaxNodeAnalysisContext context)
{
var invocationExpression = (MethodDeclarationSyntax)context.Node;
var nameSyntax = invocationExpression.ReturnType?.ToString();
if (nameSyntax == null || !nameSyntax.Contains("Task")) return;
if(invocationExpression.Identifier.ToString().EndsWith("Async")) return;
var errorMessage = invocationExpression.Identifier.ToString()+"Async";
var diag = Diagnostic.Create(Rule, invocationExpression.GetLocation(),errorMessage);
context.ReportDiagnostic(diag);
}
}
} | apache-2.0 | C# |
4841778b30421487d08434af19c51dee7ad13394 | Simplify xml test code creating a string | stephenmichaelf/corefx,lggomez/corefx,dotnet-bot/corefx,seanshpark/corefx,fgreinacher/corefx,lggomez/corefx,ravimeda/corefx,ptoonen/corefx,tijoytom/corefx,marksmeltzer/corefx,weltkante/corefx,weltkante/corefx,ravimeda/corefx,gkhanna79/corefx,tijoytom/corefx,parjong/corefx,ptoonen/corefx,zhenlan/corefx,wtgodbe/corefx,mmitche/corefx,JosephTremoulet/corefx,parjong/corefx,DnlHarvey/corefx,stone-li/corefx,rubo/corefx,shimingsg/corefx,nchikanov/corefx,YoupHulsebos/corefx,JosephTremoulet/corefx,richlander/corefx,yizhang82/corefx,mmitche/corefx,rahku/corefx,JosephTremoulet/corefx,lggomez/corefx,seanshpark/corefx,billwert/corefx,nbarbettini/corefx,yizhang82/corefx,nbarbettini/corefx,nbarbettini/corefx,alexperovich/corefx,Ermiar/corefx,nbarbettini/corefx,yizhang82/corefx,Ermiar/corefx,wtgodbe/corefx,jlin177/corefx,billwert/corefx,parjong/corefx,gkhanna79/corefx,seanshpark/corefx,krk/corefx,rubo/corefx,wtgodbe/corefx,the-dwyer/corefx,MaggieTsang/corefx,weltkante/corefx,rjxby/corefx,rubo/corefx,ViktorHofer/corefx,alexperovich/corefx,ericstj/corefx,krytarowski/corefx,richlander/corefx,krk/corefx,BrennanConroy/corefx,nchikanov/corefx,Jiayili1/corefx,JosephTremoulet/corefx,billwert/corefx,ericstj/corefx,dhoehna/corefx,Jiayili1/corefx,yizhang82/corefx,dhoehna/corefx,jlin177/corefx,richlander/corefx,YoupHulsebos/corefx,wtgodbe/corefx,mazong1123/corefx,marksmeltzer/corefx,nchikanov/corefx,seanshpark/corefx,mazong1123/corefx,rubo/corefx,gkhanna79/corefx,nchikanov/corefx,cydhaselton/corefx,krytarowski/corefx,ptoonen/corefx,richlander/corefx,axelheer/corefx,Jiayili1/corefx,fgreinacher/corefx,zhenlan/corefx,wtgodbe/corefx,rjxby/corefx,krytarowski/corefx,rahku/corefx,ericstj/corefx,ViktorHofer/corefx,seanshpark/corefx,rahku/corefx,rahku/corefx,cydhaselton/corefx,stephenmichaelf/corefx,mazong1123/corefx,ravimeda/corefx,twsouthwick/corefx,jlin177/corefx,MaggieTsang/corefx,marksmeltzer/corefx,gkhanna79/corefx,dotnet-bot/corefx,DnlHarvey/corefx,DnlHarvey/corefx,mmitche/corefx,ptoonen/corefx,billwert/corefx,krk/corefx,Jiayili1/corefx,weltkante/corefx,jlin177/corefx,twsouthwick/corefx,rjxby/corefx,zhenlan/corefx,ravimeda/corefx,stone-li/corefx,the-dwyer/corefx,rjxby/corefx,marksmeltzer/corefx,Petermarcu/corefx,elijah6/corefx,elijah6/corefx,mazong1123/corefx,alexperovich/corefx,krk/corefx,axelheer/corefx,DnlHarvey/corefx,krk/corefx,nbarbettini/corefx,krk/corefx,the-dwyer/corefx,Jiayili1/corefx,alexperovich/corefx,BrennanConroy/corefx,marksmeltzer/corefx,mazong1123/corefx,rjxby/corefx,Ermiar/corefx,shimingsg/corefx,fgreinacher/corefx,tijoytom/corefx,the-dwyer/corefx,tijoytom/corefx,ViktorHofer/corefx,yizhang82/corefx,seanshpark/corefx,billwert/corefx,tijoytom/corefx,shimingsg/corefx,krytarowski/corefx,rjxby/corefx,cydhaselton/corefx,dotnet-bot/corefx,krytarowski/corefx,parjong/corefx,twsouthwick/corefx,cydhaselton/corefx,elijah6/corefx,alexperovich/corefx,ravimeda/corefx,the-dwyer/corefx,stone-li/corefx,ptoonen/corefx,cydhaselton/corefx,YoupHulsebos/corefx,twsouthwick/corefx,nchikanov/corefx,dhoehna/corefx,tijoytom/corefx,nbarbettini/corefx,seanshpark/corefx,dhoehna/corefx,ericstj/corefx,tijoytom/corefx,yizhang82/corefx,Ermiar/corefx,stone-li/corefx,wtgodbe/corefx,wtgodbe/corefx,mmitche/corefx,gkhanna79/corefx,marksmeltzer/corefx,gkhanna79/corefx,parjong/corefx,dhoehna/corefx,lggomez/corefx,shimingsg/corefx,dotnet-bot/corefx,ViktorHofer/corefx,Jiayili1/corefx,richlander/corefx,krytarowski/corefx,mazong1123/corefx,twsouthwick/corefx,Ermiar/corefx,Petermarcu/corefx,mmitche/corefx,zhenlan/corefx,parjong/corefx,YoupHulsebos/corefx,jlin177/corefx,stephenmichaelf/corefx,axelheer/corefx,rjxby/corefx,zhenlan/corefx,ravimeda/corefx,fgreinacher/corefx,BrennanConroy/corefx,Petermarcu/corefx,shimingsg/corefx,nbarbettini/corefx,ravimeda/corefx,zhenlan/corefx,JosephTremoulet/corefx,ptoonen/corefx,JosephTremoulet/corefx,zhenlan/corefx,axelheer/corefx,billwert/corefx,YoupHulsebos/corefx,stone-li/corefx,Petermarcu/corefx,Petermarcu/corefx,stephenmichaelf/corefx,YoupHulsebos/corefx,rahku/corefx,JosephTremoulet/corefx,yizhang82/corefx,gkhanna79/corefx,DnlHarvey/corefx,stone-li/corefx,dhoehna/corefx,stephenmichaelf/corefx,dotnet-bot/corefx,lggomez/corefx,twsouthwick/corefx,dotnet-bot/corefx,rubo/corefx,richlander/corefx,axelheer/corefx,weltkante/corefx,ViktorHofer/corefx,stephenmichaelf/corefx,ericstj/corefx,rahku/corefx,stephenmichaelf/corefx,DnlHarvey/corefx,Petermarcu/corefx,ericstj/corefx,weltkante/corefx,stone-li/corefx,the-dwyer/corefx,marksmeltzer/corefx,DnlHarvey/corefx,jlin177/corefx,elijah6/corefx,elijah6/corefx,MaggieTsang/corefx,MaggieTsang/corefx,billwert/corefx,Ermiar/corefx,nchikanov/corefx,alexperovich/corefx,rahku/corefx,lggomez/corefx,krk/corefx,alexperovich/corefx,mazong1123/corefx,weltkante/corefx,ViktorHofer/corefx,Jiayili1/corefx,dhoehna/corefx,elijah6/corefx,lggomez/corefx,ViktorHofer/corefx,YoupHulsebos/corefx,ptoonen/corefx,cydhaselton/corefx,elijah6/corefx,ericstj/corefx,twsouthwick/corefx,Ermiar/corefx,nchikanov/corefx,krytarowski/corefx,MaggieTsang/corefx,MaggieTsang/corefx,richlander/corefx,cydhaselton/corefx,shimingsg/corefx,shimingsg/corefx,dotnet-bot/corefx,mmitche/corefx,MaggieTsang/corefx,Petermarcu/corefx,jlin177/corefx,the-dwyer/corefx,parjong/corefx,axelheer/corefx,mmitche/corefx | src/Common/tests/System/Xml/ModuleCore/cltmconsole.cs | src/Common/tests/System/Xml/ModuleCore/cltmconsole.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.IO;
using System.Text; //Encoding
using System.Diagnostics; //TraceListener
namespace OLEDB.Test.ModuleCore
{
////////////////////////////////////////////////////////////////
// CLTMConsole
//
////////////////////////////////////////////////////////////////
public class CLTMConsole : TextWriter
{
//Data
//Constructor
public CLTMConsole()
{
}
//Overloads - A subclass must minimally implement the Write(Char) method.
public override void Write(char ch)
{
CError.Write(ch.ToString());
}
//Overloads - We also implement "string" since its much more efficient and TextWriter will call this instead
public override void Write(string strText)
{
CError.Write(strText);
}
//Overloads - We also implement "string" since its much more efficient and TextWriter will call this instead
public override void Write(char[] ch)
{
//Note: This is a workaround the TextWriter::Write(char[]) that incorrectly
//writes 1 char at a time, which means \r\n is written separately and then gets fixed
//up to be two carriage returns!
if (ch != null)
{
Write(new string(ch));
}
}
public override void WriteLine(string strText)
{
Write(strText + this.NewLine);
}
//Overloads
//Writes a line terminator to the text stream.
//The default line terminator is a carriage return followed by a line feed ("\r\n"),
//but this value can be changed using the NewLine property.
public override void WriteLine()
{
Write(this.NewLine);
}
//Overloads
public override Encoding Encoding
{
get { return Encoding.Unicode; }
}
}
////////////////////////////////////////////////////////////////
// CLTMTraceListener
//
////////////////////////////////////////////////////////////////
public class CLTMTraceListener //: TraceListener
{
//Data
//Constructor
public CLTMTraceListener()
{
}
}
}
| // 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.IO;
using System.Text; //Encoding
using System.Diagnostics; //TraceListener
namespace OLEDB.Test.ModuleCore
{
////////////////////////////////////////////////////////////////
// CLTMConsole
//
////////////////////////////////////////////////////////////////
public class CLTMConsole : TextWriter
{
//Data
//Constructor
public CLTMConsole()
{
}
//Overloads - A subclass must minimally implement the Write(Char) method.
public override void Write(char ch)
{
CError.Write(ch.ToString());
}
//Overloads - We also implement "string" since its much more efficient and TextWriter will call this instead
public override void Write(string strText)
{
CError.Write(strText);
}
//Overloads - We also implement "string" since its much more efficient and TextWriter will call this instead
public override void Write(char[] ch)
{
//Note: This is a workaround the TextWriter::Write(char[]) that incorrectly
//writes 1 char at a time, which means \r\n is written separately and then gets fixed
//up to be two carriage returns!
if (ch != null)
{
StringBuilder builder = new StringBuilder(ch.Length);
builder.Append(ch);
Write(builder.ToString());
}
}
public override void WriteLine(string strText)
{
Write(strText + this.NewLine);
}
//Overloads
//Writes a line terminator to the text stream.
//The default line terminator is a carriage return followed by a line feed ("\r\n"),
//but this value can be changed using the NewLine property.
public override void WriteLine()
{
Write(this.NewLine);
}
//Overloads
public override Encoding Encoding
{
get { return Encoding.Unicode; }
}
}
////////////////////////////////////////////////////////////////
// CLTMTraceListener
//
////////////////////////////////////////////////////////////////
public class CLTMTraceListener //: TraceListener
{
//Data
//Constructor
public CLTMTraceListener()
{
}
}
}
| mit | C# |
ae963975c07e16a58c29bcb41aec523c4672e8f1 | Fix test | mvno/Okanshi,mvno/Okanshi,mvno/Okanshi | tests/Okanshi.Tests/MonitorApiTest.cs | tests/Okanshi.Tests/MonitorApiTest.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Threading;
using FluentAssertions;
using Newtonsoft.Json;
using Xunit;
namespace Okanshi.Test
{
public class MonitorApiTest : IDisposable
{
private readonly MonitorApi _monitorApi;
private readonly string _monitorUrl = "http://localhost:13004/" + Guid.NewGuid() + "/";
public MonitorApiTest()
{
_monitorApi = new MonitorApi(new MonitorApiOptions { HttpPrefix = _monitorUrl });
_monitorApi.Start();
Thread.Sleep(500);
HealthChecks.Clear();
CSharp.Monitor.ResetCounters();
}
public void Dispose()
{
_monitorApi.Stop();
}
public class AssemblyDependency
{
public string Name;
public string Version;
}
[Fact]
public void Asking_for_dependencies_gets_the_current_assembly()
{
var httpClient = new HttpClient();
var result = httpClient.GetStringAsync(_monitorUrl + "dependencies").Result;
var listOfAssemblies = JsonConvert.DeserializeObject<List<AssemblyDependency>>(result);
listOfAssemblies.Single(depencency => depencency.Name == Assembly.GetExecutingAssembly().GetName().Name);
}
[Fact]
public void Asking_for_healtchecks_runs_the_healthchecks()
{
var httpClient = new HttpClient();
var result = httpClient.GetStringAsync(_monitorUrl + "healthchecks").Result;
JsonConvert.DeserializeObject<Dictionary<string, bool>>(result).Should().BeEmpty();
}
[Fact]
public void Asking_for_statistics_returns_the_statistics()
{
var httpClient = new HttpClient();
var result = httpClient.GetStringAsync(_monitorUrl).Result;
JsonConvert.DeserializeObject<Dictionary<string, bool>>(result).Should().BeEmpty();
}
[Fact]
public void Starting_api_returns_monitor_instance()
{
_monitorApi.Stop();
var monitor = _monitorApi.Start();
monitor.Should().NotBeNull();
}
[Fact]
public void Stopping_api_multiple_times_does_not_hang()
{
CSharp.Monitor.Stop();
_monitorApi.Stop();
_monitorApi.Stop();
_monitorApi.Stop();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Threading;
using FluentAssertions;
using Newtonsoft.Json;
using Xunit;
namespace Okanshi.Test
{
public class MonitorApiTest : IDisposable
{
private readonly MonitorApi _monitorApi;
private readonly string _monitorUrl = "http://localhost:13004/" + AppDomain.CurrentDomain.SetupInformation.ApplicationName + "/";
public MonitorApiTest()
{
_monitorApi = new MonitorApi(new MonitorApiOptions { HttpPrefix = _monitorUrl });
_monitorApi.Start();
Thread.Sleep(500);
HealthChecks.Clear();
CSharp.Monitor.ResetCounters();
}
public void Dispose()
{
_monitorApi.Stop();
}
public class AssemblyDependency
{
public string Name;
public string Version;
}
[Fact]
public void Asking_for_dependencies_gets_the_current_assembly()
{
var httpClient = new HttpClient();
var result = httpClient.GetStringAsync(_monitorUrl + "dependencies").Result;
var listOfAssemblies = JsonConvert.DeserializeObject<List<AssemblyDependency>>(result);
listOfAssemblies.Single(depencency => depencency.Name == Assembly.GetExecutingAssembly().GetName().Name);
}
[Fact]
public void Asking_for_healtchecks_runs_the_healthchecks()
{
var httpClient = new HttpClient();
var result = httpClient.GetStringAsync(_monitorUrl + "healthchecks").Result;
JsonConvert.DeserializeObject<Dictionary<string, bool>>(result).Should().BeEmpty();
}
[Fact]
public void Asking_for_statistics_returns_the_statistics()
{
var httpClient = new HttpClient();
var result = httpClient.GetStringAsync(_monitorUrl).Result;
JsonConvert.DeserializeObject<Dictionary<string, bool>>(result).Should().BeEmpty();
}
[Fact]
public void Starting_api_returns_monitor_instance()
{
_monitorApi.Stop();
var monitor = _monitorApi.Start();
monitor.Should().NotBeNull();
}
[Fact]
public void Stopping_api_multiple_times_does_not_hang()
{
CSharp.Monitor.Stop();
_monitorApi.Stop();
_monitorApi.Stop();
_monitorApi.Stop();
}
}
}
| mit | C# |
1da56c2529c8d52bd8f3b1ceb07795379221dc02 | Update the IBufferWriter contract definition documentation to be clearer (#35554) | BrennanConroy/corefx,BrennanConroy/corefx,ViktorHofer/corefx,wtgodbe/corefx,wtgodbe/corefx,shimingsg/corefx,wtgodbe/corefx,shimingsg/corefx,ptoonen/corefx,ViktorHofer/corefx,ericstj/corefx,ptoonen/corefx,shimingsg/corefx,wtgodbe/corefx,ericstj/corefx,ericstj/corefx,shimingsg/corefx,wtgodbe/corefx,shimingsg/corefx,shimingsg/corefx,ViktorHofer/corefx,ptoonen/corefx,BrennanConroy/corefx,ptoonen/corefx,wtgodbe/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ViktorHofer/corefx,wtgodbe/corefx,ericstj/corefx,shimingsg/corefx,ptoonen/corefx,ViktorHofer/corefx,ericstj/corefx,ptoonen/corefx,ericstj/corefx,ericstj/corefx,ptoonen/corefx | src/System.Memory/src/System/Buffers/IBufferWriter.cs | src/System.Memory/src/System/Buffers/IBufferWriter.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Buffers
{
/// <summary>
/// Represents an output sink into which <typeparam name="T"/> data can be written.
/// </summary>
public interface IBufferWriter<T>
{
/// <summary>
/// Notifies <see cref="IBufferWriter{T}"/> that <paramref name="count"/> amount of data was written to the output <see cref="Span{T}"/>/<see cref="Memory{T}"/>
/// </summary>
/// <remarks>
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
/// </remarks>
void Advance(int count);
/// <summary>
/// Returns a <see cref="Memory{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <code>0</code>), some non-empty buffer is returned.
/// </summary>
/// <remarks>
/// This must never return an empty <see cref="Memory{T}"/> but it can throw
/// if the requested buffer size is not available.
/// </remarks>
/// <remarks>
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
/// </remarks>
/// <remarks>
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
/// </remarks>
Memory<T> GetMemory(int sizeHint = 0);
/// <summary>
/// Returns a <see cref="Span{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <code>0</code>), some non-empty buffer is returned.
/// </summary>
/// <remarks>
/// This must never return an empty <see cref="Span{T}"/> but it can throw
/// if the requested buffer size is not available.
/// </remarks>
/// <remarks>
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
/// </remarks>
/// <remarks>
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
/// </remarks>
Span<T> GetSpan(int sizeHint = 0);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Buffers
{
/// <summary>
/// Represents a <typeparam name="T"/> sink
/// </summary>
public interface IBufferWriter<T>
{
/// <summary>
/// Notifies <see cref="IBufferWriter{T}"/> that <paramref name="count"/> amount of data was written to <see cref="Span{T}"/>/<see cref="Memory{T}"/>
/// </summary>
void Advance(int count);
/// <summary>
/// Requests the <see cref="Memory{T}"/> that is at least <paramref name="sizeHint"/> in size if possible, otherwise returns maximum available memory.
/// If <paramref name="sizeHint"/> is equal to <code>0</code>, currently available memory would get returned.
/// </summary>
Memory<T> GetMemory(int sizeHint = 0);
/// <summary>
/// Requests the <see cref="Span{T}"/> that is at least <paramref name="sizeHint"/> in size if possible, otherwise returns maximum available memory.
/// If <paramref name="sizeHint"/> is equal to <code>0</code>, currently available memory would get returned.
/// </summary>
Span<T> GetSpan(int sizeHint = 0);
}
}
| mit | C# |
e20bd993fbce64e895a1101cd528a23785ded03b | add newline to end of chat messages without one | bcwood/LyncChatLogger | LyncChatLogger/ChatLog.cs | LyncChatLogger/ChatLog.cs | using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using Microsoft.Lync.Model.Conversation;
namespace LyncChatLogger
{
public static class ChatLog
{
private static Dictionary<string, string> _logs = new Dictionary<string, string>();
public static void Open(Conversation conversation)
{
Participant participant = LyncHelper.GetConversationParticipant(conversation);
if (participant != null)
{
string username = LyncHelper.GetContactUsername(participant.Contact);
DebugLog.Write("Conversation with {0} started at {1} {2}", username, DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString());
}
}
public static void Close(Conversation conversation)
{
string conversationId = (string) conversation.Properties[ConversationProperty.Id];
if (_logs.ContainsKey(conversationId))
_logs.Remove(conversationId);
Participant participant = LyncHelper.GetConversationParticipant(conversation);
if (participant != null)
{
string username = LyncHelper.GetContactUsername(participant.Contact);
DebugLog.Write("Conversation with {0} ended at {1} {2}", username, DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString());
}
}
public static void Write(InstantMessageModality messageInfo, string text)
{
string username = LyncHelper.GetContactUsername(messageInfo.Participant.Contact);
string path = GetLogFilePath(messageInfo);
using (var writer = new StreamWriter(path, true))
{
if (!text.EndsWith(Environment.NewLine))
text += Environment.NewLine;
writer.Write("[{0} {1}] {2}: {3}", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString(), username, text);
}
}
private static string GetLogFilePath(InstantMessageModality messageInfo)
{
string path = ConfigurationManager.AppSettings["LOG_PATH"];
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
Participant participant = LyncHelper.GetConversationParticipant(messageInfo.Conversation);
string username = LyncHelper.GetContactUsername(participant.Contact);
path += "/" + username;
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
string conversationId = (string) messageInfo.Conversation.Properties[ConversationProperty.Id];
string filename = GetConversationFilename(conversationId);
path += "/" + filename;
return path;
}
private static string GetConversationFilename(string conversationId)
{
string filename;
if (!_logs.ContainsKey(conversationId))
{
filename = DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt";
_logs.Add(conversationId, filename);
}
else
{
filename = _logs[conversationId];
}
return filename;
}
}
}
| using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using Microsoft.Lync.Model.Conversation;
namespace LyncChatLogger
{
public static class ChatLog
{
private static Dictionary<string, string> _logs = new Dictionary<string, string>();
public static void Open(Conversation conversation)
{
Participant participant = LyncHelper.GetConversationParticipant(conversation);
if (participant != null)
{
string username = LyncHelper.GetContactUsername(participant.Contact);
DebugLog.Write("Conversation with {0} started at {1} {2}", username, DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString());
}
}
public static void Close(Conversation conversation)
{
string conversationId = (string) conversation.Properties[ConversationProperty.Id];
if (_logs.ContainsKey(conversationId))
_logs.Remove(conversationId);
Participant participant = LyncHelper.GetConversationParticipant(conversation);
if (participant != null)
{
string username = LyncHelper.GetContactUsername(participant.Contact);
DebugLog.Write("Conversation with {0} ended at {1} {2}", username, DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString());
}
}
public static void Write(InstantMessageModality messageInfo, string text)
{
string username = LyncHelper.GetContactUsername(messageInfo.Participant.Contact);
string path = GetLogFilePath(messageInfo);
using (var writer = new StreamWriter(path, true))
{
writer.Write("[{0} {1}] {2}: {3}", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString(), username, text);
}
}
private static string GetLogFilePath(InstantMessageModality messageInfo)
{
string path = ConfigurationManager.AppSettings["LOG_PATH"];
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
Participant participant = LyncHelper.GetConversationParticipant(messageInfo.Conversation);
string username = LyncHelper.GetContactUsername(participant.Contact);
path += "/" + username;
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
string conversationId = (string) messageInfo.Conversation.Properties[ConversationProperty.Id];
string filename = GetConversationFilename(conversationId);
path += "/" + filename;
return path;
}
private static string GetConversationFilename(string conversationId)
{
string filename;
if (!_logs.ContainsKey(conversationId))
{
filename = DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt";
_logs.Add(conversationId, filename);
}
else
{
filename = _logs[conversationId];
}
return filename;
}
}
}
| mit | C# |
01eeda768f72f44f675295a425700bbf5971098e | Use multicast instead of explicit BehaviourSubject setup | MHeasell/Mappy,MHeasell/Mappy | Mappy/ExtensionMethods.cs | Mappy/ExtensionMethods.cs | namespace Mappy
{
using System;
using System.ComponentModel;
using System.Reactive.Linq;
using System.Reactive.Subjects;
public static class ExtensionMethods
{
public static IObservable<TField> PropertyAsObservable<TSource, TField>(this TSource source, Func<TSource, TField> accessor, string name) where TSource : INotifyPropertyChanged
{
var obs = Observable.FromEventPattern<PropertyChangedEventHandler, PropertyChangedEventArgs>(
x => source.PropertyChanged += x,
x => source.PropertyChanged -= x)
.Where(x => x.EventArgs.PropertyName == name)
.Select(_ => accessor(source))
.Multicast(new BehaviorSubject<TField>(accessor(source)));
// FIXME: This is leaky.
// We create a connection here but don't hold on to the reference.
// We can never unregister our event handler without this.
obs.Connect();
return obs;
}
}
}
| namespace Mappy
{
using System;
using System.ComponentModel;
using System.Reactive.Linq;
using System.Reactive.Subjects;
public static class ExtensionMethods
{
public static IObservable<TField> PropertyAsObservable<TSource, TField>(this TSource source, Func<TSource, TField> accessor, string name) where TSource : INotifyPropertyChanged
{
var subject = new BehaviorSubject<TField>(accessor(source));
// FIXME: This is leaky.
// We create a subscription to connect this to the subject
// but we don't hold onto this subscription.
// The subject we return can never be garbage collected
// because the subscription cannot be freed.
Observable.FromEventPattern<PropertyChangedEventHandler, PropertyChangedEventArgs>(
x => source.PropertyChanged += x,
x => source.PropertyChanged -= x)
.Where(x => x.EventArgs.PropertyName == name)
.Select(_ => accessor(source))
.Subscribe(subject);
return subject;
}
}
}
| mit | C# |
83297ffc0ed1eaee60cf2e6b8cd8bb6e70b05d70 | Delete stop reciever, to stop receiver use CancellationToken | witoong623/TirkxDownloader,witoong623/TirkxDownloader | Framework/Interface/IMessageRecieverT.cs | Framework/Interface/IMessageRecieverT.cs | using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace TirkxDownloader.Framework.Interface
{
/// <summary>
/// This interface should be implemented for recieve JSON then parse it and return to caller
/// </summary>
/// <typeparam name="T">Type of message, must be JSON compatibility</typeparam>
public interface IMessageReciever<T>
{
ICollection<string> Prefixes { get; }
bool IsRecieving { get; }
Task<T> GetMessageAsync();
Task<T> GetMessageAsync(CancellationToken ct);
/// <summary>
/// Call this method when terminate application
/// </summary>
void Close();
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TirkxDownloader.Framework.Interface
{
/// <summary>
/// This interface should be implemented for recieve JSON then parse it and return to caller
/// </summary>
/// <typeparam name="T">Type of message, must be JSON compatibility</typeparam>
interface IMessageReciever<T>
{
ICollection<string> Prefixes { get; }
bool IsRecieving { get; }
Task<T> GetMessageAsync();
/// <summary>
/// Call this method when terminate application
/// </summary>
void Close();
/// <summary>
/// Call this method when you want to stop reciever
/// </summary>
void StopReciever();
}
}
| mit | C# |
f816a86bb9028124bf7b6556466b1e26a3608cbb | Update copyright | ethomson/gitresources,ethomson/gitresources,alsafonov/gitresources,alsafonov/gitresources | GitResources/Views/Shared/_Layout.cshtml | GitResources/Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
@{
var pageTitle = (ViewBag.Title != null && ViewBag.Title.Length > 0) ?
"Git Resources: " + ViewBag.Title :
"Git Resources";
}
<title>@pageTitle</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<!--
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Git Resources", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
<li>@Html.ActionLink("API", "Index", "Help", new { area = "HelpPage" }, null)</li>
</ul>
</div>
</div>
</div>
-->
<div class="container body-content">
@RenderBody()
@RenderSection("SPAViews", required: false)
<hr />
<footer>
<p>Copyright © @DateTime.Now.Year, Edward Thomson</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("Scripts", required: false)
</body>
</html>
| <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
@{
var pageTitle = (ViewBag.Title != null && ViewBag.Title.Length > 0) ?
"Git Resources: " + ViewBag.Title :
"Git Resources";
}
<title>@pageTitle</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<!--
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Git Resources", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
<li>@Html.ActionLink("API", "Index", "Help", new { area = "HelpPage" }, null)</li>
</ul>
</div>
</div>
</div>
-->
<div class="container body-content">
@RenderBody()
@RenderSection("SPAViews", required: false)
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("Scripts", required: false)
</body>
</html>
| mit | C# |
fac18c075eb588debaf199ba26cd8aec4ada634e | Fix geckowebdriver download (#83) | rosolko/WebDriverManager.Net | WebDriverManager/DriverConfigs/Impl/FirefoxConfig.cs | WebDriverManager/DriverConfigs/Impl/FirefoxConfig.cs | using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using AngleSharp.Html.Parser;
using Architecture = WebDriverManager.Helpers.Architecture;
namespace WebDriverManager.DriverConfigs.Impl
{
public class FirefoxConfig : IDriverConfig
{
private const string DownloadUrl = "https://github.com/mozilla/geckodriver/releases/download/v<version>/geckodriver-v<version>-";
public virtual string GetName()
{
return "Firefox";
}
public virtual string GetUrl32()
{
return GetUrl(Architecture.X32);
}
public virtual string GetUrl64()
{
return GetUrl(Architecture.X64);
}
public virtual string GetBinaryName()
{
return "geckodriver" + (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty);
}
public virtual string GetLatestVersion()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
using (var client = new WebClient())
{
var htmlCode = client.DownloadString("https://github.com/mozilla/geckodriver/releases");
var parser = new HtmlParser();
var document = parser.ParseDocument(htmlCode);
var version = document.QuerySelectorAll(".release-header .f1 a")
.Select(element => element.TextContent)
.FirstOrDefault();
return version;
}
}
private static string GetUrl(Architecture architecture)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return $"{DownloadUrl}macos.tar.gz";
}
return RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
? $"{DownloadUrl}linux{((int)architecture).ToString()}.tar.gz"
: $"{DownloadUrl}win{((int)architecture).ToString()}.zip";
}
}
}
| using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using AngleSharp.Html.Parser;
using Architecture = WebDriverManager.Helpers.Architecture;
namespace WebDriverManager.DriverConfigs.Impl
{
public class FirefoxConfig : IDriverConfig
{
private const string DownloadUrl = "https://github.com/mozilla/geckodriver/releases/download/v<version>/geckodriver-v<version>-";
public virtual string GetName()
{
return "Firefox";
}
public virtual string GetUrl32()
{
return GetUrl(Architecture.X32);
}
public virtual string GetUrl64()
{
return GetUrl(Architecture.X64);
}
public virtual string GetBinaryName()
{
return "geckodriver" + (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty);
}
public virtual string GetLatestVersion()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
using (var client = new WebClient())
{
var htmlCode = client.DownloadString("https://github.com/mozilla/geckodriver/releases");
var parser = new HtmlParser();
var document = parser.ParseDocument(htmlCode);
var version = document.QuerySelectorAll(".release-header .f1 a")
.Select(element => element.TextContent)
.FirstOrDefault()
?.Remove(0, 1);
return version;
}
}
private static string GetUrl(Architecture architecture)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return $"{DownloadUrl}macos.tar.gz";
}
return RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
? $"{DownloadUrl}linux{((int)architecture).ToString()}.tar.gz"
: $"{DownloadUrl}win{((int)architecture).ToString()}.zip";
}
}
}
| mit | C# |
736a36a326700ab325db2f3938025f9cf76a1490 | Fix failed testcase | smoogipoo/osu,johnneijzen/osu,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,EVAST9919/osu,smoogipooo/osu,peppy/osu,2yangk23/osu,peppy/osu-new,NeoAdonis/osu,2yangk23/osu,EVAST9919/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,ppy/osu,johnneijzen/osu,peppy/osu | osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs | osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public class TestSceneNowPlayingOverlay : OsuTestScene
{
[Cached]
private MusicController musicController = new MusicController();
private WorkingBeatmap currentTrack;
public TestSceneNowPlayingOverlay()
{
Clock = new FramedClock();
var np = new NowPlayingOverlay
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre
};
Add(musicController);
Add(np);
AddStep(@"show", () => np.Show());
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
AddStep(@"hide", () => np.Hide());
}
[Test]
public void TestPrevTrackBehavior()
{
AddStep(@"Play track", () =>
{
musicController.NextTrack();
currentTrack = Beatmap.Value;
});
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack());
AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value);
AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack());
// If the track isn't changing, check the current track's time instead
AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value || currentTrack.Track.CurrentTime < 2000);
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public class TestSceneNowPlayingOverlay : OsuTestScene
{
[Cached]
private MusicController musicController = new MusicController();
private WorkingBeatmap currentTrack;
public TestSceneNowPlayingOverlay()
{
Clock = new FramedClock();
var np = new NowPlayingOverlay
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre
};
Add(musicController);
Add(np);
AddStep(@"show", () => np.Show());
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
AddStep(@"hide", () => np.Hide());
}
[Test]
public void TestPrevTrackBehavior()
{
AddStep(@"Play track", () =>
{
musicController.NextTrack();
currentTrack = Beatmap.Value;
});
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack());
AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value);
AddStep(@"Seek track to 1 second", () => musicController.SeekTo(1000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack());
AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value);
}
}
}
| mit | C# |
ef2ef28f3fdbb1156f496c8f7bb9c3601a84c534 | Change MaybeNullWhenAttribute to internal to remove collision with diagnostics ns | NicolasDorier/NBitcoin,MetacoSA/NBitcoin,MetacoSA/NBitcoin | NBitcoin/NullableShims.cs | NBitcoin/NullableShims.cs | #if NULLABLE_SHIMS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
internal sealed class MaybeNullWhenAttribute : Attribute
{
public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; }
public bool ReturnValue { get; }
}
}
#endif
| #if NULLABLE_SHIMS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
public sealed class MaybeNullWhenAttribute : Attribute
{
public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; }
public bool ReturnValue { get; }
}
}
#endif
| mit | C# |
9a5e2a71ca3f825fef9be222374181d4f13f1998 | Optimize c# test detection | kbilsted/LineCounter.Net | LineCounter/Strategies/CSharpStrategy.cs | LineCounter/Strategies/CSharpStrategy.cs | using System.IO;
using System.Collections.Generic;
namespace KbgSoft.LineCounter.Strategies {
public class CSharpStrategy : IStrategy {
private static readonly TrimStringLens l = new TrimStringLens();
private bool foundTests = false;
public string StatisticsKey => foundTests ? "C# test" : "C#";
public Statistics Count(string path) {
using (TextReader reader = File.OpenText(path))
{
return Count(new MultiLineCommentFilterStream().ReadLines(reader));
}
}
public Statistics Count(IEnumerable<string> lines) {
var res = new Statistics();
int lineCount = 0;
foreach (var line in lines) {
lineCount++;
l.SetValue(line);
if (lineCount < 40 && !foundTests && (l.StartsWithOrdinal("using NUnit.") || l.StartsWithOrdinal("using Selenium.") || l.StartsWithOrdinal("using Xunit")))
foundTests = true;
if (l == "{" || l == "}" || l == ";" || l == "};")
continue;
if (l.StartsWithOrdinal("/")) {
if (l.StartsWithOrdinal("/// ")) {
if (l == "/// <summary>" || l == "/// </summary>")
continue;
res.DocumentationLines++;
continue;
}
if (l.StartsWithOrdinal("//"))
continue;
}
res.CodeLines++;
}
return res;
}
}
} | using System.IO;
using System.Collections.Generic;
namespace KbgSoft.LineCounter.Strategies {
public class CSharpStrategy : IStrategy {
private static readonly TrimStringLens l = new TrimStringLens();
private bool foundTests = false;
public string StatisticsKey => foundTests ? "C# test" : "C#";
public Statistics Count(string path) {
using (TextReader reader = File.OpenText(path))
{
return Count(new MultiLineCommentFilterStream().ReadLines(reader));
}
}
public Statistics Count(IEnumerable<string> lines) {
var res = new Statistics();
foreach (var line in lines) {
l.SetValue(line);
if (!foundTests && (l.StartsWithOrdinal("using NUnit.") || l.StartsWithOrdinal("using Selenium.") || l.StartsWithOrdinal("using Xunit")))
foundTests = true;
if (l == "{" || l == "}" || l == ";" || l == "};")
continue;
if (l.StartsWithOrdinal("/")) {
if (l.StartsWithOrdinal("/// ")) {
if (l == "/// <summary>" || l == "/// </summary>")
continue;
res.DocumentationLines++;
continue;
}
if (l.StartsWithOrdinal("//"))
continue;
}
res.CodeLines++;
}
return res;
}
}
} | apache-2.0 | C# |
e0d9935dc1be1ee4a516c8d61cca5a94c3a64bb4 | add win check for Game | svmnotn/friendly-guacamole | Assets/src/data/Game.cs | Assets/src/data/Game.cs | using System.Collections.Generic;
public class Game {
List<Player> players;
Player curr;
Dictionary<Vector, Grid> map;
public Game(List<Player> players) {
this.players = players;
curr = players.ToArray () [0];
map = new Dictionary<Vector, Grid> ();
map.Add (new Vector (0, 0), new Grid ());
}
public Winner Check(Vector click) {
return new Winner();
}
}
| using System.Collections.Generic;
public class Game {
List<Player> players;
Player curr;
Dictionary<Vector, Grid> map;
public Game(List<Player> players) {
this.players = players;
curr = players.ToArray () [0];
map = new Dictionary<Vector, Grid> ();
map.Add (new Vector (0, 0), new Grid ());
}
}
| mit | C# |
d44f02f807b52770cbadb5c7f2aaaec159737d3a | fix on columns | trurl123/csharp-driver,kishkaru/csharp-driver,datastax/csharp-driver,maxwellb/csharp-driver,maxwellb/csharp-driver,jorgebay/csharp-driver,datastax/csharp-driver,bridgewell/csharp-driver,alprema/csharp-driver,AtwooTM/csharp-driver,aNutForAJarOfTuna/csharp-driver,mintsoft/csharp-driver,oguimbal/csharp-driver | Cassandra.Native/RowPopulators/CqlRow.cs | Cassandra.Native/RowPopulators/CqlRow.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace Cassandra.Native
{
public class CqlRow
{
public object[] columns;
Dictionary<string, int> columnIdxes;
internal CqlRow(OutputRows rawrows, Dictionary<string, int> columnIdxes)
{
columns = new object[rawrows.Metadata.Columns.Length];
this.columnIdxes = columnIdxes;
int i = 0;
foreach (var len in rawrows.GetRawColumnLengths())
{
if (len < 0)
columns[i] = null;
else
{
byte[] buffer = new byte[len];
rawrows.ReadRawColumnValue(buffer, 0, len);
columns[i] = TypeInterpreter.CqlConvert(buffer,
rawrows.Metadata.Columns[i].type_code, rawrows.Metadata.Columns[i].type_info);
}
i++;
if (i >= rawrows.Metadata.Columns.Length)
break;
}
}
public int Length
{
get
{
return columns.Length;
}
}
public object this[int idx]
{
get
{
return columns[idx];
}
}
public object this[string name]
{
get
{
return columns[columnIdxes[name]];
}
}
public T GetValue<T>(string name)
{
return (T)this[name];
}
public T GetValue<T>(int idx)
{
return (T)this[idx];
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace Cassandra.Native
{
public class CqlRow
{
public object[] columns;
Dictionary<string, int> columnIdxes;
internal CqlRow(OutputRows rawrows, Dictionary<string, int> columnIdxes)
{
columns = new object[rawrows.Metadata.Columns.Length];
this.columnIdxes = columnIdxes;
int i = 0;
foreach (var len in rawrows.GetRawColumnLengths())
{
if (len < 0)
columns[i] = null;
else
{
byte[] buffer = new byte[len];
rawrows.ReadRawColumnValue(buffer, 0, len);
columns[i] = TypeInterpreter.CqlConvert(buffer,
rawrows.Metadata.Columns[i].type_code, rawrows.Metadata.Columns[i].type_info);
i++;
if (i >= rawrows.Metadata.Columns.Length)
break;
}
}
}
public int Length
{
get
{
return columns.Length;
}
}
public object this[int idx]
{
get
{
return columns[idx];
}
}
public object this[string name]
{
get
{
return columns[columnIdxes[name]];
}
}
public T GetValue<T>(string name)
{
return (T)this[name];
}
public T GetValue<T>(int idx)
{
return (T)this[idx];
}
}
}
| apache-2.0 | C# |
45c394dc8a568f2accbaf7c76ca0a0514a7fad70 | Update the Licensed of Assemblyinfo | StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals | rocketmq-client-donet/Properties/AssemblyInfo.cs | rocketmq-client-donet/Properties/AssemblyInfo.cs | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Reflection;
using System.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("RocketMQ.Interop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RocketMQ.Interop")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("057deebc-ec31-4265-b1ab-6738d51ef463")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RocketMQ.Interop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RocketMQ.Interop")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("057deebc-ec31-4265-b1ab-6738d51ef463")]
// 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")]
| apache-2.0 | C# |
addd4892dfcdd2d493a0ca850c7f9280fb31fea0 | Remove unnecessary Android permissions | igrali/SQLite.Net-PCL,fernandovm/SQLite.Net-PCL,mattleibow/SQLite.Net-PCL,kreuzhofer/SQLite.Net-PCL,molinch/SQLite.Net-PCL,oysteinkrog/SQLite.Net-PCL,TiendaNube/SQLite.Net-PCL,igrali/SQLite.Net-PCL,caseydedore/SQLite.Net-PCL | src/SQLite.Net.Platform.XamarinAndroid/Properties/AssemblyInfo.cs | src/SQLite.Net.Platform.XamarinAndroid/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using Android;
using Android.App;
// 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("SQLite.Net.Platform.XamarinAndroid")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Øystein Krog")]
[assembly: AssemblyProduct("SQLite.Net.Platform.XamarinAndroid")]
[assembly: AssemblyCopyright("Copyright © Øystein Krog")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
| using System.Reflection;
using System.Runtime.InteropServices;
using Android;
using Android.App;
// 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("SQLite.Net.Platform.XamarinAndroid")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Øystein Krog")]
[assembly: AssemblyProduct("SQLite.Net.Platform.XamarinAndroid")]
[assembly: AssemblyCopyright("Copyright © Øystein Krog")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Manifest.Permission.Internet)]
[assembly: UsesPermission(Manifest.Permission.WriteExternalStorage)] | mit | C# |
5cc07e25990f542869024e96250014e77692945e | Add missing SupportsBody property | elastic/elasticsearch-net,elastic/elasticsearch-net | src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.SnapshotLifecycleManagement.cs | src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.SnapshotLifecycleManagement.cs | // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// -----------------------------------------------
//
// This file is automatically generated
// Please do not edit these files manually
// Run the following in the root of the repos:
//
// *NIX : ./build.sh codegen
// Windows : build.bat codegen
//
// -----------------------------------------------
// ReSharper disable RedundantUsingDirective
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
// ReSharper disable once CheckNamespace
namespace Elasticsearch.Net.Specification.SnapshotLifecycleManagementApi
{
///<summary>Request options for DeleteSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete.html</para></summary>
public class DeleteSnapshotLifecycleRequestParameters : RequestParameters<DeleteSnapshotLifecycleRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
public override bool SupportsBody => false;
}
///<summary>Request options for ExecuteSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute.html</para></summary>
public class ExecuteSnapshotLifecycleRequestParameters : RequestParameters<ExecuteSnapshotLifecycleRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
public override bool SupportsBody => false;
}
///<summary>Request options for GetSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html</para></summary>
public class GetSnapshotLifecycleRequestParameters : RequestParameters<GetSnapshotLifecycleRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
public override bool SupportsBody => false;
}
///<summary>Request options for GetSnapshotLifecycleStats <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-get-stats.html</para></summary>
public class GetSnapshotLifecycleStatsRequestParameters : RequestParameters<GetSnapshotLifecycleStatsRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
public override bool SupportsBody => false;
}
///<summary>Request options for PutSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put.html</para></summary>
public class PutSnapshotLifecycleRequestParameters : RequestParameters<PutSnapshotLifecycleRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
public override bool SupportsBody => true;
}
} | // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// -----------------------------------------------
//
// This file is automatically generated
// Please do not edit these files manually
// Run the following in the root of the repos:
//
// *NIX : ./build.sh codegen
// Windows : build.bat codegen
//
// -----------------------------------------------
// ReSharper disable RedundantUsingDirective
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
// ReSharper disable once CheckNamespace
namespace Elasticsearch.Net.Specification.SnapshotLifecycleManagementApi
{
///<summary>Request options for DeleteSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete.html</para></summary>
public class DeleteSnapshotLifecycleRequestParameters : RequestParameters<DeleteSnapshotLifecycleRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
public override bool SupportsBody => false;
}
///<summary>Request options for ExecuteSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute.html</para></summary>
public class ExecuteSnapshotLifecycleRequestParameters : RequestParameters<ExecuteSnapshotLifecycleRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
public override bool SupportsBody => false;
}
///<summary>Request options for GetSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html</para></summary>
public class GetSnapshotLifecycleRequestParameters : RequestParameters<GetSnapshotLifecycleRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
public override bool SupportsBody => false;
}
///<summary>Request options for GetSnapshotLifecycleStats <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-get-stats.html</para></summary>
public class GetSnapshotLifecycleStatsRequestParameters : RequestParameters<GetSnapshotLifecycleStatsRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
}
///<summary>Request options for PutSnapshotLifecycle <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put.html</para></summary>
public class PutSnapshotLifecycleRequestParameters : RequestParameters<PutSnapshotLifecycleRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
public override bool SupportsBody => true;
}
} | apache-2.0 | C# |
60df6e66212e18df906714ce1778957224528c22 | Document the exception | punker76/Espera,flagbug/Espera | Espera/Espera.Core/INetworkSongFinder.cs | Espera/Espera.Core/INetworkSongFinder.cs | using System.Collections.Generic;
using System.Threading.Tasks;
namespace Espera.Core
{
public interface INetworkSongFinder<T> where T : Song
{
/// <summary>
/// Searches songs with the specified search term.
/// </summary>
/// <exception cref="NetworkSongFinderException">The search failed.</exception>
Task<IReadOnlyList<T>> GetSongsAsync(string searchTerm);
}
} | using System.Collections.Generic;
using System.Threading.Tasks;
namespace Espera.Core
{
public interface INetworkSongFinder<T> where T : Song
{
Task<IReadOnlyList<T>> GetSongsAsync(string searchTerm);
}
} | mit | C# |
8521910fc2634db63a2636ea6adfcb6c9eb1f2e3 | Fix type error. | msgpack/msgpack-cli,msgpack/msgpack-cli | test/MsgPack.UnitTest/Serialization/StructWithDataContractTest.cs | test/MsgPack.UnitTest/Serialization/StructWithDataContractTest.cs | #region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2016 FUJIWARA, Yusuke and contributors
//
// 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.
//
// Contributors:
// Samuel Cragg
//
#endregion -- License Terms --
using System.Runtime.Serialization;
#if !MSTEST
using NUnit.Framework;
#else
using TestFixtureAttribute = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using TestAttribute = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
using Assert = NUnit.Framework.Assert;
using Is = NUnit.Framework.Is;
#endif
namespace MsgPack.Serialization
{
#if !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
[TestFixture]
public class StructWithDataContractTest
{
[Test]
public void ShouldSerializeStructsWithDataContracts()
{
MessagePackSerializer<TestStruct> serializer = MessagePackSerializer.Get<TestStruct>();
byte[] result = serializer.PackSingleObject( new TestStruct() );
Assert.That( result, Is.Not.Null );
}
[Test]
public void ShouldDeserializeStructsWithDataContracts()
{
MessagePackSerializer<TestStruct> serializer = MessagePackSerializer.Get<TestStruct>();
byte[] bytes = serializer.PackSingleObject( new TestStruct( 123 ) );
TestStruct result = serializer.UnpackSingleObject( bytes );
Assert.That( result.Field, Is.EqualTo( 123 ) );
}
[DataContract]
public struct TestStruct
{
[DataMember]
private int _field;
public TestStruct( int field )
{
_field = field;
}
public int Field
{
get { return _field; }
}
}
}
#endif // !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
}
| #region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2016 FUJIWARA, Yusuke and contributors
//
// 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.
//
// Contributors:
// Samuel Cragg
//
#endregion -- License Terms --
using System.Runtime.Serialization;
#if !MSTEST
using NUnit.Framework;
#else
using TestFixtureAttribute = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using TestAttribute = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.DataTestMethodAttribute;
using Assert = NUnit.Framework.Assert;
using Is = NUnit.Framework.Is;
#endif
namespace MsgPack.Serialization
{
#if !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
[TestFixture]
public class StructWithDataContractTest
{
[Test]
public void ShouldSerializeStructsWithDataContracts()
{
MessagePackSerializer<TestStruct> serializer = MessagePackSerializer.Get<TestStruct>();
byte[] result = serializer.PackSingleObject( new TestStruct() );
Assert.That( result, Is.Not.Null );
}
[Test]
public void ShouldDeserializeStructsWithDataContracts()
{
MessagePackSerializer<TestStruct> serializer = MessagePackSerializer.Get<TestStruct>();
byte[] bytes = serializer.PackSingleObject( new TestStruct( 123 ) );
TestStruct result = serializer.UnpackSingleObject( bytes );
Assert.That( result.Field, Is.EqualTo( 123 ) );
}
[DataContract]
public struct TestStruct
{
[DataMember]
private int _field;
public TestStruct( int field )
{
_field = field;
}
public int Field
{
get { return _field; }
}
}
}
#endif // !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
}
| apache-2.0 | C# |
7378b394c4f6e3071fe7c12458fc08646df22bd0 | Put in a new class to do some quick timing output to the debug window | jlewin/agg-sharp,larsbrubaker/agg-sharp,MatterHackers/agg-sharp | Gui/PerformanceTimer/PerformanceTimer.cs | Gui/PerformanceTimer/PerformanceTimer.cs | /*
Copyright (c) 2015, Lars Brubaker
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Diagnostics;
namespace MatterHackers.Agg.UI
{
public class PerformanceTimer : IDisposable
{
public static Func<GuiWidget> GetParentWindowFunction = null;
private static string lastPannelName = "";
public string Name
{
get; private set;
}
private PerformancePannel timingPannelToReportTo;
static internal bool InPerformanceMeasuring = false;
static object locker = new object();
public PerformanceTimer(string pannelName, string name)
{
lock(locker)
{
if (!InPerformanceMeasuring)
{
InPerformanceMeasuring = true;
if (pannelName == "_LAST_")
{
pannelName = lastPannelName;
}
this.timingPannelToReportTo = PerformancePannel.GetNamedPannel(pannelName);
this.Name = name;
this.timingPannelToReportTo.Start(this);
lastPannelName = pannelName;
InPerformanceMeasuring = false;
}
}
}
public void Dispose()
{
lock (locker)
{
// Check that we actually created a time (we don't when we find things that are happening while timing.
if (!InPerformanceMeasuring)
{
InPerformanceMeasuring = true;
timingPannelToReportTo.Stop(this);
InPerformanceMeasuring = false;
}
}
}
}
public class QuickTimer : IDisposable
{
Stopwatch quickTimerTime = Stopwatch.StartNew();
string name;
double startTime;
public QuickTimer(string name)
{
this.name = name;
startTime = quickTimerTime.Elapsed.TotalMilliseconds;
}
public void Dispose()
{
double totalTime = quickTimerTime.Elapsed.TotalMilliseconds - startTime;
Debug.WriteLine(name + ": {0:0.0}ms".FormatWith(totalTime));
}
}
} | /*
Copyright (c) 2015, Lars Brubaker
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Diagnostics;
namespace MatterHackers.Agg.UI
{
public class PerformanceTimer : IDisposable
{
public static Func<GuiWidget> GetParentWindowFunction = null;
private static string lastPannelName = "";
public string Name
{
get; private set;
}
private PerformancePannel timingPannelToReportTo;
static internal bool InPerformanceMeasuring = false;
static object locker = new object();
public PerformanceTimer(string pannelName, string name)
{
lock(locker)
{
if (!InPerformanceMeasuring)
{
InPerformanceMeasuring = true;
if (pannelName == "_LAST_")
{
pannelName = lastPannelName;
}
this.timingPannelToReportTo = PerformancePannel.GetNamedPannel(pannelName);
this.Name = name;
this.timingPannelToReportTo.Start(this);
lastPannelName = pannelName;
InPerformanceMeasuring = false;
}
}
}
public void Dispose()
{
lock (locker)
{
// Check that we actually created a time (we don't when we find things that are happening while timing.
if (!InPerformanceMeasuring)
{
InPerformanceMeasuring = true;
timingPannelToReportTo.Stop(this);
InPerformanceMeasuring = false;
}
}
}
}
} | bsd-2-clause | C# |
0577fff643c1aa3c6f567bd50f22e8e399f9da43 | implement GET and POST in controller implement bad request for PUT and DELETE | MCeddy/IoT-core | IoT-Core/Controllers/ValuesController.cs | IoT-Core/Controllers/ValuesController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using IoT_Core.Models;
namespace IoT_Core.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
private SensorValueContext _dbContext;
public ValuesController(SensorValueContext dbContext)
{
this._dbContext = dbContext;
}
// GET api/values
[HttpGet]
public IActionResult Get()
{
var results = _dbContext.SensorValues
.OrderBy(sv => sv.Id)
.ToList();
return Ok(results);
}
// GET api/values/5
[HttpGet("{id}")]
public IActionResult Get(int id)
{
var sensorValues = _dbContext.SensorValues
.FirstOrDefault(value => value.Id == id);
if (sensorValues == null)
{
return NotFound();
}
return Ok(sensorValues);
}
// POST api/values
[HttpPost]
public async Task<IActionResult> Post([FromBody]SensorValues values)
{
if (!ModelState.IsValid)
{
return BadRequest();
}
_dbContext.SensorValues.Add(values);
await _dbContext.SaveChangesAsync();
return CreatedAtAction("Get", values.Id);
}
// PUT api/values/5
[HttpPut("{id}")]
public IActionResult Put(int id, [FromBody]string value)
{
return Forbid();
}
// DELETE api/values/5
[HttpDelete("{id}")]
public IActionResult Delete(int id)
{
return Forbid();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace IoT_Core.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
| mit | C# |
9ffe0667c014399d16357ae52f80b11d03c3b60e | Set root view controller | markradacz/monotouch-samples,albertoms/monotouch-samples,albertoms/monotouch-samples,W3SS/monotouch-samples,markradacz/monotouch-samples,xamarin/monotouch-samples,W3SS/monotouch-samples,markradacz/monotouch-samples,kingyond/monotouch-samples,xamarin/monotouch-samples,kingyond/monotouch-samples,iFreedive/monotouch-samples,albertoms/monotouch-samples,W3SS/monotouch-samples,xamarin/monotouch-samples,kingyond/monotouch-samples,iFreedive/monotouch-samples,iFreedive/monotouch-samples | MediaCapture/MediaCapture/AppDelegate.cs | MediaCapture/MediaCapture/AppDelegate.cs | //
// how to capture still images, video and audio using iOS AVFoundation and the AVCAptureSession
//
// This sample handles all of the low-level AVFoundation and capture graph setup required to capture and save media. This code also exposes the
// capture, configuration and notification capabilities in a more '.Netish' way of programming. The client code will not need to deal with threads, delegate classes
// buffer management, or objective-C data types but instead will create .NET objects and handle standard .NET events. The underlying iOS concepts and classes are detailed in
// the iOS developer online help (TP40010188-CH5-SW2).
//
// https://developer.apple.com/library/mac/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/04_MediaCapture.html#//apple_ref/doc/uid/TP40010188-CH5-SW2
//
// Enhancements, suggestions and bug reports can be sent to [email protected]
//
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace MediaCapture
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
private RootViewController rootViewController = null;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
rootViewController = new RootViewController();
window.RootViewController = rootViewController;
window.MakeKeyAndVisible ();
return true;
}
}
}
| //
// how to capture still images, video and audio using iOS AVFoundation and the AVCAptureSession
//
// This sample handles all of the low-level AVFoundation and capture graph setup required to capture and save media. This code also exposes the
// capture, configuration and notification capabilities in a more '.Netish' way of programming. The client code will not need to deal with threads, delegate classes
// buffer management, or objective-C data types but instead will create .NET objects and handle standard .NET events. The underlying iOS concepts and classes are detailed in
// the iOS developer online help (TP40010188-CH5-SW2).
//
// https://developer.apple.com/library/mac/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/04_MediaCapture.html#//apple_ref/doc/uid/TP40010188-CH5-SW2
//
// Enhancements, suggestions and bug reports can be sent to [email protected]
//
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace MediaCapture
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
private RootViewController rootView = null;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
rootView = new RootViewController();
window.AddSubview( rootView.View );
window.MakeKeyAndVisible ();
return true;
}
}
}
| mit | C# |
6262d37a30b2185196ddc7346582fd820777a7c5 | Revert Address to old version to avoid breaking existing clients | goshippo/shippo-csharp-client | Shippo/Address.cs | Shippo/Address.cs | using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Shippo {
[JsonObject (MemberSerialization.OptIn)]
public class Address : ShippoId {
[JsonProperty (PropertyName = "object_state")]
public object ObjectState { get; set; }
[JsonProperty (PropertyName = "object_purpose")]
public object ObjectPurpose { get; set; }
[JsonProperty (PropertyName = "object_source")]
public object ObjectSource { get; set; }
[JsonProperty (PropertyName = "object_created")]
public object ObjectCreated { get; set; }
[JsonProperty (PropertyName = "object_updated")]
public object ObjectUpdated { get; set; }
[JsonProperty (PropertyName = "object_owner")]
public object ObjectOwner { get; set; }
[JsonProperty (PropertyName = "name")]
public object Name { get; set; }
[JsonProperty (PropertyName = "company")]
public object Company { get; set; }
[JsonProperty (PropertyName = "street1")]
public object Street1 { get; set; }
[JsonProperty (PropertyName = "street_no")]
public object StreetNo { get; set; }
[JsonProperty (PropertyName = "street2")]
public object Street2 { get; set; }
[JsonProperty (PropertyName = "street3")]
public string Street3;
[JsonProperty (PropertyName = "city")]
public object City { get; set; }
[JsonProperty (PropertyName = "state")]
public object State { get; set; }
[JsonProperty (PropertyName = "zip")]
public object Zip { get; set; }
[JsonProperty (PropertyName = "country")]
public object Country { get; set; }
[JsonProperty (PropertyName = "phone")]
public object Phone { get; set; }
[JsonProperty (PropertyName = "email")]
public object Email { get; set; }
[JsonProperty (PropertyName = "is_residential")]
public object IsResidential { get; set; }
[JsonProperty (PropertyName = "ip")]
public object IP { get; set; }
[JsonProperty (PropertyName = "validate")]
public bool? Validate { get; set; }
[JsonProperty (PropertyName = "metadata")]
public object Metadata { get; set; }
[JsonProperty (PropertyName = "test")]
public bool? Test;
[JsonProperty (PropertyName = "messages")]
public object Messages { get; set; }
}
}
| using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Shippo {
[JsonObject (MemberSerialization.OptIn)]
public class Address : ShippoId {
[JsonProperty (PropertyName = "object_state")]
public string ObjectState;
[JsonProperty (PropertyName = "object_purpose")]
public string ObjectPurpose;
[JsonProperty (PropertyName = "object_source")]
public string ObjectSource;
[JsonProperty (PropertyName = "object_created")]
public DateTime? ObjectCreated;
[JsonProperty (PropertyName = "object_updated")]
public DateTime? ObjectUpdated;
[JsonProperty (PropertyName = "object_owner")]
public string ObjectOwner;
[JsonProperty (PropertyName = "name")]
public string Name;
[JsonProperty (PropertyName = "company")]
public string Company;
[JsonProperty (PropertyName = "street1")]
public string Street1;
[JsonProperty (PropertyName = "street_no")]
public string StreetNo;
[JsonProperty (PropertyName = "street2")]
public string Street2;
[JsonProperty (PropertyName = "street3")]
public string Street3;
[JsonProperty (PropertyName = "city")]
public string City;
[JsonProperty (PropertyName = "state")]
public string State;
[JsonProperty (PropertyName = "zip")]
public string Zip;
[JsonProperty (PropertyName = "country")]
public string Country;
[JsonProperty (PropertyName = "phone")]
public string Phone;
[JsonProperty (PropertyName = "email")]
public string Email;
[JsonProperty (PropertyName = "is_residential")]
public bool? IsResidential;
[JsonProperty (PropertyName = "validate")]
public bool? Validate;
[JsonProperty (PropertyName = "metadata")]
public string Metadata;
[JsonProperty (PropertyName = "test")]
public bool Test;
[JsonProperty (PropertyName = "messages")]
public List<string> Messages;
}
}
| apache-2.0 | C# |
1df040a8681974dcb13fa8c75b0c53cc8e979fdf | Change AddResult form styles. | LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform | src/CompetitionPlatform/Views/Project/AddResult.cshtml | src/CompetitionPlatform/Views/Project/AddResult.cshtml | @model CompetitionPlatform.Models.ProjectViewModels.AddResultViewModel
@*<form asp-controller="ProjectDetails" asp-action="SaveResult" enctype="multipart/form-data">
<div class="form-group col-md-10">
<input asp-for="@Model.ProjectId" type="hidden"/>
<input asp-for="@Model.ParticipantId" type="hidden"/>
<input asp-for="@Model.Link" class="form-control inline" placeholder="Insert link for the shared file(Dropbox, googleDrive, GitHub)"/>
<span asp-validation-for="@Model.Link" class="text-danger" />
</div>
<div class="form-group">
<input type="submit" value="Send Result" class="btn btn-primary col-md-2 inline" />
</div>
</form>*@
<br/>
<br/>
<br/>
<form asp-controller="ProjectDetails" asp-action="SaveResult" enctype="multipart/form-data" class="form form--share_result">
<input asp-for="@Model.ProjectId" type="hidden" />
<input asp-for="@Model.ParticipantId" type="hidden" />
<div class="col-sm-9">
<input asp-for="@Model.Link" class="form-control" type="text" placeholder="Insert link for the shared file(Dropbox, googleDrive, GitHub)" />
</div>
<div class="col-sm-3">
<button type="submit" class="btn btn-md"><i class="icon icon--share_result"></i> Send Result</button>
</div>
<span asp-validation-for="@Model.Link" class="text-danger" />
</form>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
} | @model CompetitionPlatform.Models.ProjectViewModels.AddResultViewModel
@*<form asp-controller="ProjectDetails" asp-action="SaveResult" enctype="multipart/form-data">
<div class="form-group col-md-10">
<input asp-for="@Model.ProjectId" type="hidden"/>
<input asp-for="@Model.ParticipantId" type="hidden"/>
<input asp-for="@Model.Link" class="form-control inline" placeholder="Insert link for the shared file(Dropbox, googleDrive, GitHub)"/>
<span asp-validation-for="@Model.Link" class="text-danger" />
</div>
<div class="form-group">
<input type="submit" value="Send Result" class="btn btn-primary col-md-2 inline" />
</div>
</form>*@
<form asp-controller="ProjectDetails" asp-action="SaveResult" enctype="multipart/form-data" class="form form--share_result">
<div class="row">
<input asp-for="@Model.ProjectId" type="hidden" />
<input asp-for="@Model.ParticipantId" type="hidden" />
<div class="col-sm-9">
<input asp-for="@Model.Link" class="form-control" type="text" placeholder="Insert link for the shared file(Dropbox, googleDrive, GitHub)" />
</div>
<span asp-validation-for="@Model.Link" class="text-danger" />
<div class="col-sm-3">
<button type="submit" class="btn btn-md"><i class="icon icon--share_result"></i> Send Result</button>
</div>
</div>
</form>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
} | mit | C# |
11231f89b2bfe15e140210ddc790e5d0c1da57bb | Increase asm version | Tornhoof/RoaringBitmap | RoaringBitmap/Properties/AssemblyInfo.cs | RoaringBitmap/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Roaring Bitmap")]
[assembly: AssemblyDescription("RoaringBitmap for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RoaringBitmap Contributors")]
[assembly: AssemblyProduct("Roaring Bitmap")]
[assembly: AssemblyCopyright("Copyright © Roaring Bitmap Contributors 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("2ee1be04-a8f5-4358-bf08-e417d3916b49")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.8.0")]
[assembly: AssemblyFileVersion("0.0.8.0")] | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Roaring Bitmap")]
[assembly: AssemblyDescription("RoaringBitmap for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RoaringBitmap Contributors")]
[assembly: AssemblyProduct("Roaring Bitmap")]
[assembly: AssemblyCopyright("Copyright © Roaring Bitmap Contributors 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("2ee1be04-a8f5-4358-bf08-e417d3916b49")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.7.3")]
[assembly: AssemblyFileVersion("0.0.7.3")] | apache-2.0 | C# |
2d68f7d5e5e73330f4fa5e2359e93ed41da8ec6b | Remove the main method. | bigfont/WebNotWar | app/startup.cs | app/startup.cs | using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
namespace WebNotWar
{
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello from a minimal ASP.NET Core rc1 Web App.");
});
}
}
}
| using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
namespace WebNotWar
{
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello from a minimal ASP.NET Core rc1 Web App.");
});
}
public static void Main(string[] args) => WebApplication.Run(args);
}
}
| mit | C# |
4bb06873d53d4459268e13305788cb9996d373ec | Move badge hierarchy declaration to constructor for safer access | NeoAdonis/osu,NeoAdonis/osu,ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu | osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs | osu.Game/Overlays/BeatmapSet/BeatmapBadge.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
#nullable enable
namespace osu.Game.Overlays.BeatmapSet
{
public abstract class BeatmapBadge : CompositeDrawable
{
/// <summary>
/// The text displayed on the badge's label.
/// </summary>
public LocalisableString BadgeText
{
set => badgeLabel.Text = value.ToUpper();
}
/// <summary>
/// The colour of the badge's label.
/// </summary>
public Colour4 BadgeColour
{
set => badgeLabel.Colour = value;
}
private readonly Box background;
private readonly OsuSpriteText badgeLabel;
protected BeatmapBadge()
{
AutoSizeAxes = Axes.Both;
InternalChild = new CircularContainer
{
Masking = true,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
badgeLabel = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
Margin = new MarginPadding { Horizontal = 10, Vertical = 2 },
}
}
};
}
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, OverlayColourProvider? colourProvider)
{
background.Colour = colourProvider?.Background5 ?? colours.Gray2;
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
#nullable enable
namespace osu.Game.Overlays.BeatmapSet
{
public abstract class BeatmapBadge : CompositeDrawable
{
/// <summary>
/// The text displayed on the badge's label.
/// </summary>
public LocalisableString BadgeText
{
set => badgeLabel.Text = value.ToUpper();
}
/// <summary>
/// The colour of the badge's label.
/// </summary>
public Colour4 BadgeColour
{
set => badgeLabel.Colour = value;
}
private OsuSpriteText badgeLabel = null!;
protected BeatmapBadge()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, OverlayColourProvider? colourProvider)
{
InternalChild = new CircularContainer
{
Masking = true,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider?.Background5 ?? colours.Gray2,
},
badgeLabel = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
Margin = new MarginPadding { Horizontal = 10, Vertical = 2 },
}
}
};
}
}
}
| mit | C# |
cdbfecaca805939e2788ccb017b9c13930196928 | update version | lncosie/antlr4,wjkohnen/antlr4,parrt/antlr4,krzkaczor/antlr4,parrt/antlr4,Pursuit92/antlr4,parrt/antlr4,Distrotech/antlr4,ericvergnaud/antlr4,antlr/antlr4,supriyantomaftuh/antlr4,wjkohnen/antlr4,ericvergnaud/antlr4,chienjchienj/antlr4,Pursuit92/antlr4,mcanthony/antlr4,antlr/antlr4,mcanthony/antlr4,Pursuit92/antlr4,jvanzyl/antlr4,cocosli/antlr4,joshids/antlr4,Pursuit92/antlr4,chienjchienj/antlr4,Pursuit92/antlr4,supriyantomaftuh/antlr4,wjkohnen/antlr4,sidhart/antlr4,jvanzyl/antlr4,wjkohnen/antlr4,joshids/antlr4,chandler14362/antlr4,parrt/antlr4,ericvergnaud/antlr4,Pursuit92/antlr4,supriyantomaftuh/antlr4,hce/antlr4,ericvergnaud/antlr4,lncosie/antlr4,worsht/antlr4,parrt/antlr4,worsht/antlr4,wjkohnen/antlr4,lncosie/antlr4,mcanthony/antlr4,sidhart/antlr4,Pursuit92/antlr4,ericvergnaud/antlr4,joshids/antlr4,wjkohnen/antlr4,jvanzyl/antlr4,chandler14362/antlr4,antlr/antlr4,joshids/antlr4,worsht/antlr4,krzkaczor/antlr4,lncosie/antlr4,joshids/antlr4,antlr/antlr4,Distrotech/antlr4,jvanzyl/antlr4,antlr/antlr4,antlr/antlr4,Distrotech/antlr4,hce/antlr4,parrt/antlr4,mcanthony/antlr4,chandler14362/antlr4,Pursuit92/antlr4,antlr/antlr4,chandler14362/antlr4,krzkaczor/antlr4,Distrotech/antlr4,wjkohnen/antlr4,antlr/antlr4,ericvergnaud/antlr4,chandler14362/antlr4,chandler14362/antlr4,cocosli/antlr4,joshids/antlr4,sidhart/antlr4,cooperra/antlr4,antlr/antlr4,parrt/antlr4,cocosli/antlr4,antlr/antlr4,parrt/antlr4,cocosli/antlr4,wjkohnen/antlr4,wjkohnen/antlr4,sidhart/antlr4,ericvergnaud/antlr4,joshids/antlr4,joshids/antlr4,krzkaczor/antlr4,supriyantomaftuh/antlr4,supriyantomaftuh/antlr4,chienjchienj/antlr4,krzkaczor/antlr4,worsht/antlr4,chienjchienj/antlr4,chandler14362/antlr4,Distrotech/antlr4,cooperra/antlr4,chandler14362/antlr4,ericvergnaud/antlr4,ericvergnaud/antlr4,sidhart/antlr4,Pursuit92/antlr4,ericvergnaud/antlr4,chandler14362/antlr4,parrt/antlr4,cooperra/antlr4,parrt/antlr4,mcanthony/antlr4,chienjchienj/antlr4,worsht/antlr4,hce/antlr4,cooperra/antlr4,hce/antlr4,lncosie/antlr4 | runtime/CSharp/Antlr4.Runtime/Properties/AssemblyInfo.cs | runtime/CSharp/Antlr4.Runtime/Properties/AssemblyInfo.cs | /*
* [The "BSD license"]
* Copyright (c) 2013 Terence Parr
* Copyright (c) 2013 Sam Harwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.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("Antlr4.Runtime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Antlr organization")]
[assembly: AssemblyProduct("Antlr4.Runtime")]
[assembly: AssemblyCopyright("Antlr organization")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
#if !PORTABLE || NET45PLUS
// 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)]
#if !PORTABLE
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bc228eb9-e79c-4e5a-a1b9-0434ea566bab")]
#endif
#endif
// 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("4.5.1.0")]
#if !COMPACT
[assembly: AssemblyFileVersion("4.5.1.0")]
[assembly: AssemblyInformationalVersion("4.5.1-dev")]
#endif
| /*
* [The "BSD license"]
* Copyright (c) 2013 Terence Parr
* Copyright (c) 2013 Sam Harwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.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("Antlr4.Runtime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Antlr organization")]
[assembly: AssemblyProduct("Antlr4.Runtime")]
[assembly: AssemblyCopyright("Antlr organization")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
#if !PORTABLE || NET45PLUS
// 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)]
#if !PORTABLE
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bc228eb9-e79c-4e5a-a1b9-0434ea566bab")]
#endif
#endif
// 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("4.5.0.0")]
#if !COMPACT
[assembly: AssemblyFileVersion("4.5.0.0")]
[assembly: AssemblyInformationalVersion("4.5.0-dev")]
#endif
| bsd-3-clause | C# |
ca873e2cc138a73f6824eae77a29510a189e5b2f | Update version. | Grabacr07/MetroTrilithon | source/MetroTrilithon.Desktop/Properties/AssemblyInfo.cs | source/MetroTrilithon.Desktop/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyTitle("MetroTrilithon.Desktop")]
[assembly: AssemblyDescription("Utilities for Windows Desktop apps")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("grabacr.net")]
[assembly: AssemblyProduct("MetroTrilithon")]
[assembly: AssemblyCopyright("Copyright © 2015 Grabacr07")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("4e2eb2e0-e5fe-4feb-a3e5-5f2f05cd1a67")]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2015/personal/controls", "MetroTrilithon.Controls")]
[assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2015/personal/converters", "MetroTrilithon.Converters")]
[assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2015/personal/interactivity", "MetroTrilithon.Interactivity")]
[assembly: AssemblyVersion("0.1.5.0")]
[assembly: AssemblyInformationalVersion("0.1.5-alpha")]
| using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyTitle("MetroTrilithon.Desktop")]
[assembly: AssemblyDescription("Utilities for Windows Desktop apps")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("grabacr.net")]
[assembly: AssemblyProduct("MetroTrilithon")]
[assembly: AssemblyCopyright("Copyright © 2015 Grabacr07")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("4e2eb2e0-e5fe-4feb-a3e5-5f2f05cd1a67")]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2015/personal/controls", "MetroTrilithon.Controls")]
[assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2015/personal/converters", "MetroTrilithon.Converters")]
[assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2015/personal/interactivity", "MetroTrilithon.Interactivity")]
[assembly: AssemblyVersion("0.1.5.0")]
[assembly: AssemblyInformationalVersion("0.1.5")]
| mit | C# |
86c8e9a99ac7ad20738dd66780aa38a72865b99b | Fix registry name enumeration (dotnet/coreclr#10711) | ViktorHofer/corefx,BrennanConroy/corefx,shimingsg/corefx,ericstj/corefx,ptoonen/corefx,wtgodbe/corefx,zhenlan/corefx,ptoonen/corefx,wtgodbe/corefx,zhenlan/corefx,Jiayili1/corefx,ericstj/corefx,mmitche/corefx,shimingsg/corefx,ericstj/corefx,ViktorHofer/corefx,mmitche/corefx,ravimeda/corefx,BrennanConroy/corefx,zhenlan/corefx,zhenlan/corefx,ViktorHofer/corefx,Ermiar/corefx,ericstj/corefx,shimingsg/corefx,zhenlan/corefx,mmitche/corefx,wtgodbe/corefx,Ermiar/corefx,ptoonen/corefx,Ermiar/corefx,ravimeda/corefx,shimingsg/corefx,shimingsg/corefx,mmitche/corefx,ericstj/corefx,Jiayili1/corefx,ptoonen/corefx,ptoonen/corefx,ravimeda/corefx,ravimeda/corefx,shimingsg/corefx,Ermiar/corefx,Jiayili1/corefx,mmitche/corefx,ravimeda/corefx,Ermiar/corefx,ViktorHofer/corefx,ericstj/corefx,ravimeda/corefx,ViktorHofer/corefx,wtgodbe/corefx,Jiayili1/corefx,zhenlan/corefx,ViktorHofer/corefx,wtgodbe/corefx,ptoonen/corefx,mmitche/corefx,ravimeda/corefx,ViktorHofer/corefx,Ermiar/corefx,zhenlan/corefx,shimingsg/corefx,wtgodbe/corefx,mmitche/corefx,Jiayili1/corefx,BrennanConroy/corefx,Jiayili1/corefx,ericstj/corefx,ptoonen/corefx,Jiayili1/corefx,Ermiar/corefx,wtgodbe/corefx | src/Common/src/CoreLib/Interop/Windows/Interop.Errors.cs | src/Common/src/CoreLib/Interop/Windows/Interop.Errors.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.
internal partial class Interop
{
// As defined in winerror.h and https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx
internal partial class Errors
{
internal const int ERROR_SUCCESS = 0x0;
internal const int ERROR_FILE_NOT_FOUND = 0x2;
internal const int ERROR_PATH_NOT_FOUND = 0x3;
internal const int ERROR_ACCESS_DENIED = 0x5;
internal const int ERROR_INVALID_HANDLE = 0x6;
internal const int ERROR_NOT_ENOUGH_MEMORY = 0x8;
internal const int ERROR_INVALID_DRIVE = 0xF;
internal const int ERROR_NO_MORE_FILES = 0x12;
internal const int ERROR_NOT_READY = 0x15;
internal const int ERROR_SHARING_VIOLATION = 0x20;
internal const int ERROR_HANDLE_EOF = 0x26;
internal const int ERROR_FILE_EXISTS = 0x50;
internal const int ERROR_INVALID_PARAMETER = 0x57;
internal const int ERROR_BROKEN_PIPE = 0x6D;
internal const int ERROR_INSUFFICIENT_BUFFER = 0x7A;
internal const int ERROR_INVALID_NAME = 0x7B;
internal const int ERROR_BAD_PATHNAME = 0xA1;
internal const int ERROR_ALREADY_EXISTS = 0xB7;
internal const int ERROR_ENVVAR_NOT_FOUND = 0xCB;
internal const int ERROR_FILENAME_EXCED_RANGE = 0xCE;
internal const int ERROR_NO_DATA = 0xE8;
internal const int ERROR_MORE_DATA = 0xEA;
internal const int ERROR_NO_MORE_ITEMS = 0x103;
internal const int ERROR_NOT_OWNER = 0x120;
internal const int ERROR_TOO_MANY_POSTS = 0x12A;
internal const int ERROR_ARITHMETIC_OVERFLOW = 0x216;
internal const int ERROR_MUTANT_LIMIT_EXCEEDED = 0x24B;
internal const int ERROR_OPERATION_ABORTED = 0x3E3;
internal const int ERROR_IO_PENDING = 0x3E5;
internal const int ERROR_NO_UNICODE_TRANSLATION = 0x459;
internal const int ERROR_NOT_FOUND = 0x490;
internal const int ERROR_BAD_IMPERSONATION_LEVEL = 0x542;
internal const int E_FILENOTFOUND = unchecked((int)0x80070002);
}
}
| // 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.
internal partial class Interop
{
internal partial class Errors
{
internal const int ERROR_SUCCESS = 0x0;
internal const int ERROR_FILE_NOT_FOUND = 0x2;
internal const int ERROR_PATH_NOT_FOUND = 0x3;
internal const int ERROR_ACCESS_DENIED = 0x5;
internal const int ERROR_INVALID_HANDLE = 0x6;
internal const int ERROR_NOT_ENOUGH_MEMORY = 0x8;
internal const int ERROR_INVALID_DRIVE = 0xF;
internal const int ERROR_NO_MORE_FILES = 0x12;
internal const int ERROR_NOT_READY = 0x15;
internal const int ERROR_SHARING_VIOLATION = 0x20;
internal const int ERROR_HANDLE_EOF = 0x26;
internal const int ERROR_FILE_EXISTS = 0x50;
internal const int ERROR_INVALID_PARAMETER = 0x57;
internal const int ERROR_BROKEN_PIPE = 0x6D;
internal const int ERROR_INSUFFICIENT_BUFFER = 0x7A;
internal const int ERROR_INVALID_NAME = 0x7B;
internal const int ERROR_BAD_PATHNAME = 0xA1;
internal const int ERROR_ALREADY_EXISTS = 0xB7;
internal const int ERROR_ENVVAR_NOT_FOUND = 0xCB;
internal const int ERROR_FILENAME_EXCED_RANGE = 0xCE;
internal const int ERROR_NO_DATA = 0xE8;
internal const int ERROR_MORE_DATA = 0xEA;
internal const int ERROR_NO_MORE_ITEMS = 0x103;
internal const int ERROR_NOT_OWNER = 0x120;
internal const int ERROR_TOO_MANY_POSTS = 0x12A;
internal const int ERROR_ARITHMETIC_OVERFLOW = 0x216;
internal const int ERROR_MUTANT_LIMIT_EXCEEDED = 0x24B;
internal const int ERROR_OPERATION_ABORTED = 0x3E3;
internal const int ERROR_IO_PENDING = 0x3E5;
internal const int ERROR_NO_UNICODE_TRANSLATION = 0x459;
internal const int ERROR_NOT_FOUND = 0x490;
internal const int ERROR_BAD_IMPERSONATION_LEVEL = 0x542;
internal const int E_FILENOTFOUND = unchecked((int)0x80070002);
}
}
| mit | C# |
f6a78e9df7297a184f17058f289ef1a093a9f735 | Set version to 0.2.1 | dancol90/mi-360 | Source/mi-360/Properties/AssemblyInfo.cs | Source/mi-360/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
// associate a un assembly.
[assembly: AssemblyTitle("mi-360")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Daniele Colanardi")]
[assembly: AssemblyProduct("mi-360")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
[assembly: Guid("885b11ae-354c-4690-a0a5-e9a82f51f262")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Versione principale
// Versione secondaria
// Numero di build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.1")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
// associate a un assembly.
[assembly: AssemblyTitle("mi-360")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Daniele Colanardi")]
[assembly: AssemblyProduct("mi-360")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
[assembly: Guid("885b11ae-354c-4690-a0a5-e9a82f51f262")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Versione principale
// Versione secondaria
// Numero di build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0")]
| bsd-3-clause | C# |
43ebf710ab0ea438e37c12dee8676b33217a4ef0 | Fix regression in reading config | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNet.Server.Kestrel/ServerInformation.cs | src/Microsoft.AspNet.Server.Kestrel/ServerInformation.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.Framework.Configuration;
namespace Microsoft.AspNet.Server.Kestrel
{
public class ServerInformation : IServerInformation, IKestrelServerInformation
{
public ServerInformation()
{
Addresses = new List<ServerAddress>();
}
public void Initialize(IConfiguration configuration)
{
var urls = configuration["server.urls"];
if (string.IsNullOrEmpty(urls))
{
urls = "http://+:5000/";
}
foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
var address = ServerAddress.FromUrl(url);
if (address != null)
{
Addresses.Add(address);
}
}
}
public string Name
{
get
{
return "Kestrel";
}
}
public IList<ServerAddress> Addresses { get; private set; }
public int ThreadCount { get; set; }
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.Framework.Configuration;
namespace Microsoft.AspNet.Server.Kestrel
{
public class ServerInformation : IServerInformation, IKestrelServerInformation
{
public ServerInformation()
{
Addresses = new List<ServerAddress>();
}
public void Initialize(IConfiguration configuration)
{
var urls = configuration["server.urls"];
if (!string.IsNullOrEmpty(urls))
{
urls = "http://+:5000/";
}
foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
var address = ServerAddress.FromUrl(url);
if (address != null)
{
Addresses.Add(address);
}
}
}
public string Name
{
get
{
return "Kestrel";
}
}
public IList<ServerAddress> Addresses { get; private set; }
public int ThreadCount { get; set; }
}
}
| apache-2.0 | C# |
d41352f4321922c5e0479e99e92f2f959a6cd3d7 | Set version to 1.0.1.0 | feg-giessen/videocommander | source/VideoCommander/Properties/AssemblyInfo.cs | source/VideoCommander/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("VideoCommander")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("D16")]
[assembly: AssemblyProduct("D16 VideoCommander")]
[assembly: AssemblyCopyright("Copyright © Peter Schuster 2011-2014")]
[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("875078e1-eed3-4e55-a91e-23eff998fda0")]
// 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.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: InternalsVisibleTo("VideoCommander.Test")] | 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("VideoCommander")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("D16")]
[assembly: AssemblyProduct("D16 VideoCommander")]
[assembly: AssemblyCopyright("Copyright © Peter Schuster 2011")]
[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("875078e1-eed3-4e55-a91e-23eff998fda0")]
// 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.7")]
[assembly: AssemblyFileVersion("1.0.0.7")]
[assembly: InternalsVisibleTo("VideoCommander.Test")] | mit | C# |
fc7aa74f050acea58d5cfe0706763b3f920c2b59 | Disable inheritance of transient attributes. | eylvisaker/AgateLib | AgateLib/_Attributes.cs | AgateLib/_Attributes.cs | //
// Copyright (c) 2006-2018 Erik Ylvisaker
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AgateLib
{
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class SingletonAttribute : Attribute
{
public string Name { get; set; }
}
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class TransientAttribute : Attribute
{
public TransientAttribute()
{
}
public TransientAttribute(string name)
{
Name = name;
}
public string Name { get; }
}
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class ScopedTransientAttribute : Attribute
{
}
/// <summary>
/// Indicates to the type resolution system that properties which
/// refer to types that can be resolved should have their values
/// set with the resolved services. This attribute is inherited.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
public class InjectPropertiesAttribute : Attribute
{
}
}
| //
// Copyright (c) 2006-2018 Erik Ylvisaker
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AgateLib
{
[AttributeUsage(AttributeTargets.Class)]
public class SingletonAttribute : Attribute
{
public string Name { get; set; }
}
[AttributeUsage(AttributeTargets.Class)]
public class TransientAttribute : Attribute
{
public TransientAttribute()
{
}
public TransientAttribute(string name)
{
Name = name;
}
public string Name { get; }
}
[AttributeUsage(AttributeTargets.Class)]
public class ScopedTransientAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class)]
public class InjectPropertiesAttribute : Attribute
{
}
}
| mit | C# |
cf9cdea74939909cbaabbc18ff8331d02c379655 | Comment only | NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework | Core/NakedObjects.Core/reflect/INakedObjectsFramework.cs | Core/NakedObjects.Core/reflect/INakedObjectsFramework.cs | using NakedObjects.Architecture.Persist;
using NakedObjects.Architecture.Reflect;
using NakedObjects.Architecture.Security;
using NakedObjects.Core.Context;
using NakedObjects.Core.Reflect;
using NakedObjects.Objects;
namespace NakedObjects {
/// <summary>
/// Defines a service that provides easy access to the principal components of the framework.
/// An implementation of this service interface will be injected into any domain
/// object that needs it.
/// </summary>
public interface INakedObjectsFramework {
IMessageBroker MessageBroker { get; }
IUpdateNotifier UpdateNotifier { get; }
ISession Session { get; }
INakedObjectPersistor ObjectPersistor { get; }
INakedObjectReflector Reflector { get; }
IAuthorizationManager AuthorizationManager { get; }
IContainerInjector Injector { get; }
}
} | using NakedObjects.Architecture.Persist;
using NakedObjects.Architecture.Reflect;
using NakedObjects.Architecture.Security;
using NakedObjects.Core.Context;
using NakedObjects.Core.Reflect;
using NakedObjects.Objects;
namespace NakedObjects {
public interface INakedObjectsFramework {
IMessageBroker MessageBroker { get; }
IUpdateNotifier UpdateNotifier { get; }
ISession Session { get; }
INakedObjectPersistor ObjectPersistor { get; }
INakedObjectReflector Reflector { get; }
IAuthorizationManager AuthorizationManager { get; }
IContainerInjector Injector { get; }
}
} | apache-2.0 | C# |
c3f03d8f0a83ee180ae546e30cad276a9bd34e28 | Add a method to read a string from #Strings | ZixiangBoy/dnlib,kiootic/dnlib,ilkerhalil/dnlib,jorik041/dnlib,modulexcite/dnlib,0xd4d/dnlib,picrap/dnlib,yck1509/dnlib,Arthur2e5/dnlib | dot10/dotNET/StringsStream.cs | dot10/dotNET/StringsStream.cs | using System.Text;
using dot10.IO;
namespace dot10.dotNET {
class StringsStream : DotNetStream {
/// <inheritdoc/>
public StringsStream(IImageStream imageStream, StreamHeader streamHeader)
: base(imageStream, streamHeader) {
}
/// <summary>
/// Read a <see cref="string"/>
/// </summary>
/// <param name="offset">Offset of string</param>
/// <returns>The UTF-8 decoded string or null if invalid offset</returns>
public string Read(uint offset) {
var data = imageStream.ReadBytesUntilByte(0);
if (data == null)
return null;
return Encoding.UTF8.GetString(data);
}
}
}
| using dot10.IO;
namespace dot10.dotNET {
class StringsStream : DotNetStream {
/// <inheritdoc/>
public StringsStream(IImageStream imageStream, StreamHeader streamHeader)
: base(imageStream, streamHeader) {
}
}
}
| mit | C# |
7d0390da4164f6d33ba1061b204f23955e10bef6 | Update algorithm for calculating tree probability | GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA | Source/Libraries/FaultData/DataWriters/TreeProbabilityGenerator.cs | Source/Libraries/FaultData/DataWriters/TreeProbabilityGenerator.cs | using GSF.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace FaultData.DataWriters
{
public class TreeProbabilityGenerator
{
public static XElement GetTreeProbability(AdoDataConnection connection, XElement element)
{
XElement returnElement = new XElement("span");
string faultType = (string)element.Attribute("faultType") ?? "AB";
double reactanceRatio = Convert.ToDouble((string)element.Attribute("reactanceRatio") ?? "-1.0");
reactanceRatio = Math.Abs(reactanceRatio);
double distance = Convert.ToDouble((string)element.Attribute("distance") ?? "-1.0");
double lowToMediumBorder = (1.27 * distance) / Math.Sqrt(Math.Pow((.31 * distance + 10), 2) + Math.Pow((1.27 * distance), 2));
double mediumToHighBorder = (1.27 * distance) / Math.Sqrt(Math.Pow((.31 * distance + 20), 2) + Math.Pow((1.27 * distance), 2));
returnElement.Value = "Undetermined";
if (faultType.ToLower().Contains("n"))
{
if (reactanceRatio <= mediumToHighBorder)
returnElement.Value = "High";
else if (reactanceRatio <= lowToMediumBorder && reactanceRatio >= mediumToHighBorder)
returnElement.Value = "Medium";
else
returnElement.Value = "Low";
}
return returnElement;
}
}
}
| using GSF.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace FaultData.DataWriters
{
public class TreeProbabilityGenerator
{
public static XElement GetTreeProbability(AdoDataConnection connection, XElement element)
{
XElement returnElement = new XElement("span");
string faultType = (string)element.Attribute("faultType") ?? "AB";
double reactanceRatio = Convert.ToDouble((string)element.Attribute("reactanceRatio") ?? "-1.0");
string[] probabilityNames = ((string)element.Attribute("probabilityNames") ?? "High,Medium,Low").Split(',');
string[] probabilityNumbersStrings = ((string)element.Attribute("probabilityNumbers") ?? ".64,.86,1.0").Split(',');
double[] cutoffs = probabilityNumbersStrings.Select(probabilityNumber => Convert.ToDouble(probabilityNumber)).ToArray();
returnElement.Value = "Undetermined";
if (faultType.ToLower().Contains("n") && probabilityNames.Length == cutoffs.Length)
for (int i = 0; i < probabilityNames.Length; i++)
if (reactanceRatio < cutoffs[i])
{
returnElement.Value = probabilityNames[i];
break;
}
return returnElement;
}
}
}
| mit | C# |
ff16a6a2ef26607d06cfbf85fc172c8ddd6f3807 | improve XML document. | jwChung/Experimentalism,jwChung/Experimentalism | src/Experiment.AutoFixture/TestFixtureAdapter.cs | src/Experiment.AutoFixture/TestFixtureAdapter.cs | using System;
using Jwc.Experiment;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.Kernel;
namespace Jwc.Experiment
{
/// <summary>
/// <see cref="ISpecimenContext"/>를 <see cref="ITestFixture"/> 인터페이스에 맞춘다.
/// auto data기능을 AutoFixture library로부터 채용하게 된다.
/// </summary>
public class TestFixtureAdapter : ITestFixture
{
private readonly ISpecimenContext _specimenContext;
/// <summary>
/// Initializes a new instance of the <see cref="TestFixtureAdapter"/> class.
/// </summary>
public TestFixtureAdapter()
{
_specimenContext = new SpecimenContext(new Fixture());
}
/// <summary>
/// Initializes a new instance of the <see cref="TestFixtureAdapter"/> class.
/// </summary>
/// <param name="specimenContext">The specimen context.</param>
/// <exception cref="System.ArgumentNullException">specimenContext</exception>
public TestFixtureAdapter(ISpecimenContext specimenContext)
{
if (specimenContext == null)
{
throw new ArgumentNullException("specimenContext");
}
_specimenContext = specimenContext;
}
/// <summary>
/// Gets the specimen context.
/// </summary>
/// <value>
/// The specimen context.
/// </value>
public ISpecimenContext SpecimenContext
{
get
{
return _specimenContext;
}
}
/// <summary>
/// request를 통해 테스트에 필요한 specimen를 만듦.
/// </summary>
/// <param name="request">specimen을 만들기 위해 필요한 정보를 제공.
/// 일반적으로 <see cref="Type" />을 많이 활용.</param>
/// <returns>
/// 만들어진 specimen 객체.
/// </returns>
public object Create(object request)
{
return SpecimenContext.Resolve(request);
}
}
} | using System;
using Jwc.Experiment;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.Kernel;
namespace Jwc.Experiment
{
/// <summary>
/// <see cref="ISpecimenContext"/>를 <see cref="ITestFixture"/>에 맞춘다.
/// auto data기능을 AutoFixture library로부터 채용하게 된다.
/// </summary>
public class TestFixtureAdapter : ITestFixture
{
private readonly ISpecimenContext _specimenContext;
/// <summary>
/// Initializes a new instance of the <see cref="TestFixtureAdapter"/> class.
/// </summary>
public TestFixtureAdapter()
{
_specimenContext = new SpecimenContext(new Fixture());
}
/// <summary>
/// Initializes a new instance of the <see cref="TestFixtureAdapter"/> class.
/// </summary>
/// <param name="specimenContext">The specimen context.</param>
/// <exception cref="System.ArgumentNullException">specimenContext</exception>
public TestFixtureAdapter(ISpecimenContext specimenContext)
{
if (specimenContext == null)
{
throw new ArgumentNullException("specimenContext");
}
_specimenContext = specimenContext;
}
/// <summary>
/// Gets the specimen context.
/// </summary>
/// <value>
/// The specimen context.
/// </value>
public ISpecimenContext SpecimenContext
{
get
{
return _specimenContext;
}
}
/// <summary>
/// request를 통해 테스트에 필요한 specimen를 만듦.
/// </summary>
/// <param name="request">specimen을 만들기 위해 필요한 정보를 제공.
/// 일반적으로
/// <see cref="Type" />을 많이 활용.</param>
/// <returns>
/// 만들어진 specimen 객체.
/// </returns>
public object Create(object request)
{
return SpecimenContext.Resolve(request);
}
}
} | mit | C# |
d79236736579088d02f7c767dbeeab07a2a5b3e4 | Fix display scoreboard packet id | pdelvo/Pdelvo.Minecraft | Pdelvo.Minecraft.Protocol/Packets/DisplayScoreboard.cs | Pdelvo.Minecraft.Protocol/Packets/DisplayScoreboard.cs | using System;
using Pdelvo.Minecraft.Network;
namespace Pdelvo.Minecraft.Protocol.Packets
{
[PacketUsage(PacketUsage.ServerToClient)]
public class DisplayScoreboard : Packet
{
public byte Position { get; set; }
public string ScoreName { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="DisplayScoreboard" /> class.
/// </summary>
/// <remarks>
/// </remarks>
public DisplayScoreboard()
{
Code = 0xD0;
}
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
Position = reader.ReadByte();
ScoreName = reader.ReadString16();
}
/// <summary>
/// Sends the specified writer.
/// </summary>
/// <param name="writer"> The writer. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnSend(BigEndianStream writer, int version)
{
if (writer == null)
throw new ArgumentNullException("writer");
writer.Write(Code);
writer.Write(Position);
writer.Write(ScoreName);
}
}
}
| using System;
using Pdelvo.Minecraft.Network;
namespace Pdelvo.Minecraft.Protocol.Packets
{
[PacketUsage(PacketUsage.ServerToClient)]
public class DisplayScoreboard : Packet
{
public byte Position { get; set; }
public string ScoreName { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="DisplayScoreboard" /> class.
/// </summary>
/// <remarks>
/// </remarks>
public DisplayScoreboard()
{
Code = 0xCF;
}
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
Position = reader.ReadByte();
ScoreName = reader.ReadString16();
}
/// <summary>
/// Sends the specified writer.
/// </summary>
/// <param name="writer"> The writer. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnSend(BigEndianStream writer, int version)
{
if (writer == null)
throw new ArgumentNullException("writer");
writer.Write(Code);
writer.Write(Position);
writer.Write(ScoreName);
}
}
}
| mit | C# |
7444166ba2c957362a8d0cf7c75cd535a5f22efc | use NRT | jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,physhi/roslyn,dotnet/roslyn,eriawan/roslyn,eriawan/roslyn,sharwell/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,eriawan/roslyn,diryboy/roslyn,mavasani/roslyn,AmadeusW/roslyn,physhi/roslyn,AmadeusW/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,sharwell/roslyn,bartdesmet/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,wvdd007/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,weltkante/roslyn,KevinRansom/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,bartdesmet/roslyn,dotnet/roslyn,AmadeusW/roslyn,physhi/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn | src/Features/Core/Portable/CommentSelection/ICommentSelectionService.cs | src/Features/Core/Portable/CommentSelection/ICommentSelectionService.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.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.CommentSelection
{
internal interface ICommentSelectionService : ILanguageService
{
Task<CommentSelectionInfo> GetInfoAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
Task<Document> FormatAsync(Document document, ImmutableArray<TextSpan> changes, CancellationToken cancellationToken);
}
}
| // 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.
#nullable disable
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.CommentSelection
{
internal interface ICommentSelectionService : ILanguageService
{
Task<CommentSelectionInfo> GetInfoAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
Task<Document> FormatAsync(Document document, ImmutableArray<TextSpan> changes, CancellationToken cancellationToken);
}
}
| mit | C# |
9ce239dedbf84f730b51913f109fc64754f6eff5 | fix StringNullOrEmptyToVisibilityConverter has no 0 parameter constructor | Wox-launcher/Wox,qianlifeng/Wox,Wox-launcher/Wox,lances101/Wox,qianlifeng/Wox,lances101/Wox,qianlifeng/Wox | Wox/Converters/StringNullOrEmptyToVisibilityConverter.cs | Wox/Converters/StringNullOrEmptyToVisibilityConverter.cs | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows;
using Wox.Plugin;
namespace Wox.Converters
{
public class StringNullOrEmptyToVisibilityConverter : ConvertorBase<StringNullOrEmptyToVisibilityConverter>
{
public StringNullOrEmptyToVisibilityConverter() { }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible;
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
public class ContextMenuEmptyToWidthConverter : ConvertorBase<ContextMenuEmptyToWidthConverter>
{
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
List<Result> results = value as List<Result>;
return results == null || results.Count == 0 ? 0 : 17;
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
} | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows;
using Wox.Plugin;
namespace Wox.Converters
{
public class StringNullOrEmptyToVisibilityConverter : ConvertorBase<StringNullOrEmptyToVisibilityConverter>
{
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible;
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
public class ContextMenuEmptyToWidthConverter : ConvertorBase<ContextMenuEmptyToWidthConverter>
{
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
List<Result> results = value as List<Result>;
return results == null || results.Count == 0 ? 0 : 17;
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
} | mit | C# |
8c65f42955cabd3d86161193e3f3482fefb1f9d4 | bump version to 1.3.6 | Terradue/DotNetOpenSearchGeoJson | Terradue.OpenSearch.GeoJson/Properties/AssemblyInfo.cs | Terradue.OpenSearch.GeoJson/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
/*!
\namespace Terradue.OpenSearch.GeoJson
@{
DotNetOpenSearchGeoJson Software Package
\xrefitem sw_version "Versions" "Software Package Version" 1.3.6
\xrefitem sw_link "Links" "Software Package List" [DotNetOpenSearchGeoJson](https://github.com/Terradue/DotNetOpenSearchGeoJson)
\xrefitem sw_license "License" "Software License" [GPLv3](https://github.com/Terradue/DotNetOpenSearchGeoJson/blob/master/LICENSE.txt)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.GeoJson
\ingroup OpenSearch
@}
*/
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.OpenSearch.GeoJson")]
[assembly: AssemblyDescription("Terradue.OpenSearch.GeoJson is a library targeting .NET 4.0 and above that provides an extension to Terradue.OpenSearch to query from a class or an URL from/to GeoJson format")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyAuthors("Emmanuel Mathot")]
[assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetOpenSearchGeoJson")]
[assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetOpenSearchGeoJson/blob/master/LICENSE")]
[assembly: AssemblyVersion("1.3.6.*")]
[assembly: AssemblyInformationalVersion("1.3.6")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| using System.Reflection;
using System.Runtime.CompilerServices;
/*!
\namespace Terradue.OpenSearch.GeoJson
@{
DotNetOpenSearchGeoJson Software Package
\xrefitem sw_version "Versions" "Software Package Version" 1.3.5
\xrefitem sw_link "Links" "Software Package List" [DotNetOpenSearchGeoJson](https://github.com/Terradue/DotNetOpenSearchGeoJson)
\xrefitem sw_license "License" "Software License" [GPLv3](https://github.com/Terradue/DotNetOpenSearchGeoJson/blob/master/LICENSE.txt)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.GeoJson
\ingroup OpenSearch
@}
*/
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.OpenSearch.GeoJson")]
[assembly: AssemblyDescription("Terradue.OpenSearch.GeoJson is a library targeting .NET 4.0 and above that provides an extension to Terradue.OpenSearch to query from a class or an URL from/to GeoJson format")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyAuthors("Emmanuel Mathot")]
[assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetOpenSearchGeoJson")]
[assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetOpenSearchGeoJson/blob/master/LICENSE")]
[assembly: AssemblyVersion("1.3.5.*")]
[assembly: AssemblyInformationalVersion("1.3.5")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| agpl-3.0 | C# |
74d80b1736e6be9dcf595ece1a0e658aeda245a7 | Update shadow layer on property change (#1278) | FormsCommunityToolkit/FormsCommunityToolkit | src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/Shadow/PlatformShadowEffect.ios.macos.cs | src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/Shadow/PlatformShadowEffect.ios.macos.cs | using System;
using System.ComponentModel;
using CoreGraphics;
using Xamarin.CommunityToolkit.Effects;
using Xamarin.Forms;
#if __IOS__
using NativeView = UIKit.UIView;
using Xamarin.Forms.Platform.iOS;
using Xamarin.CommunityToolkit.iOS.Effects;
#elif __MACOS__
using NativeView = AppKit.NSView;
using Xamarin.Forms.Platform.MacOS;
using Xamarin.CommunityToolkit.macOS.Effects;
#endif
[assembly: ExportEffect(typeof(PlatformShadowEffect), nameof(ShadowEffect))]
#if __IOS__
namespace Xamarin.CommunityToolkit.iOS.Effects
#elif __MACOS__
namespace Xamarin.CommunityToolkit.macOS.Effects
#endif
{
public class PlatformShadowEffect : PlatformEffect
{
const float defaultRadius = 10f;
const float defaultOpacity = .5f;
NativeView? View => Control ?? Container;
protected override void OnAttached()
{
if (View == null)
return;
Update(View);
}
protected override void OnDetached()
{
if (View?.Layer == null)
return;
View.Layer.ShadowOpacity = 0;
}
protected override void OnElementPropertyChanged(PropertyChangedEventArgs args)
{
base.OnElementPropertyChanged(args);
if (View == null)
return;
switch (args.PropertyName)
{
case ShadowEffect.ColorPropertyName:
UpdateColor(View);
break;
case ShadowEffect.OpacityPropertyName:
UpdateOpacity(View);
break;
case ShadowEffect.RadiusPropertyName:
UpdateRadius(View);
break;
case ShadowEffect.OffsetXPropertyName:
case ShadowEffect.OffsetYPropertyName:
UpdateOffset(View);
break;
case nameof(VisualElement.Width):
case nameof(VisualElement.Height):
Update(View);
break;
}
}
void UpdateColor(in NativeView view)
{
if (view.Layer != null)
view.Layer.ShadowColor = ShadowEffect.GetColor(Element).ToCGColor();
}
void UpdateOpacity(in NativeView view)
{
if (view.Layer != null)
{
var opacity = (float)ShadowEffect.GetOpacity(Element);
view.Layer.ShadowOpacity = opacity < 0 ? defaultOpacity : opacity;
}
}
void UpdateRadius(in NativeView view)
{
if (view.Layer != null)
{
var radius = (nfloat)ShadowEffect.GetRadius(Element);
view.Layer.ShadowRadius = radius < 0 ? defaultRadius : radius;
}
}
void UpdateOffset(in NativeView view)
{
if (view.Layer != null)
view.Layer.ShadowOffset = new CGSize((double)ShadowEffect.GetOffsetX(Element), (double)ShadowEffect.GetOffsetY(Element));
}
void Update(in NativeView view)
{
UpdateColor(view);
UpdateOpacity(view);
UpdateRadius(view);
UpdateOffset(view);
}
}
} | using System;
using System.ComponentModel;
using CoreGraphics;
using Xamarin.CommunityToolkit.Effects;
using Xamarin.Forms;
#if __IOS__
using NativeView = UIKit.UIView;
using Xamarin.Forms.Platform.iOS;
using Xamarin.CommunityToolkit.iOS.Effects;
#elif __MACOS__
using NativeView = AppKit.NSView;
using Xamarin.Forms.Platform.MacOS;
using Xamarin.CommunityToolkit.macOS.Effects;
#endif
[assembly: ExportEffect(typeof(PlatformShadowEffect), nameof(ShadowEffect))]
#if __IOS__
namespace Xamarin.CommunityToolkit.iOS.Effects
#elif __MACOS__
namespace Xamarin.CommunityToolkit.macOS.Effects
#endif
{
public class PlatformShadowEffect : PlatformEffect
{
const float defaultRadius = 10f;
const float defaultOpacity = .5f;
NativeView? View => Control ?? Container;
protected override void OnAttached()
{
if (View == null)
return;
UpdateColor(View);
UpdateOpacity(View);
UpdateRadius(View);
UpdateOffset(View);
}
protected override void OnDetached()
{
if (View?.Layer == null)
return;
View.Layer.ShadowOpacity = 0;
}
protected override void OnElementPropertyChanged(PropertyChangedEventArgs args)
{
base.OnElementPropertyChanged(args);
if (View == null)
return;
switch (args.PropertyName)
{
case nameof(ShadowEffect.ColorPropertyName):
UpdateColor(View);
break;
case nameof(ShadowEffect.OpacityPropertyName):
UpdateOpacity(View);
break;
case nameof(ShadowEffect.RadiusPropertyName):
UpdateRadius(View);
break;
case nameof(ShadowEffect.OffsetXPropertyName):
case nameof(ShadowEffect.OffsetYPropertyName):
UpdateOffset(View);
break;
}
}
void UpdateColor(in NativeView view)
{
if (view.Layer != null)
view.Layer.ShadowColor = ShadowEffect.GetColor(Element).ToCGColor();
}
void UpdateOpacity(in NativeView view)
{
if (view.Layer != null)
{
var opacity = (float)ShadowEffect.GetOpacity(Element);
view.Layer.ShadowOpacity = opacity < 0 ? defaultOpacity : opacity;
}
}
void UpdateRadius(in NativeView view)
{
if (view.Layer != null)
{
var radius = (nfloat)ShadowEffect.GetRadius(Element);
view.Layer.ShadowRadius = radius < 0 ? defaultRadius : radius;
}
}
void UpdateOffset(in NativeView view)
{
if (view.Layer != null)
view.Layer.ShadowOffset = new CGSize((double)ShadowEffect.GetOffsetX(Element), (double)ShadowEffect.GetOffsetY(Element));
}
}
} | mit | C# |
7d8911c329def8560cb1b6b0aa4bb45e888b5a98 | Improve readability | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Backend/Controllers/SoftwareController.cs | WalletWasabi.Backend/Controllers/SoftwareController.cs | using Microsoft.AspNetCore.Mvc;
using WalletWasabi.Backend.Models.Responses;
using WalletWasabi.Helpers;
namespace WalletWasabi.Backend.Controllers
{
/// <summary>
/// To acquire administrative data about the software.
/// </summary>
[Produces("application/json")]
[Route("api/[controller]")]
public class SoftwareController : Controller
{
private readonly VersionsResponse VersionsResponse = new VersionsResponse
{
ClientVersion = Constants.ClientVersion.ToString(3),
BackendMajorVersion = Constants.BackendMajorVersion
};
/// <summary>
/// Gets the latest versions of the client and backend.
/// </summary>
/// <returns>ClientVersion, BackendMajorVersion.</returns>
/// <response code="200">ClientVersion, BackendMajorVersion.</response>
[HttpGet("versions")]
[ProducesResponseType(typeof(VersionsResponse), 200)]
public VersionsResponse GetVersions()
{
return VersionsResponse;
}
}
}
| using Microsoft.AspNetCore.Mvc;
using WalletWasabi.Backend.Models.Responses;
using WalletWasabi.Helpers;
namespace WalletWasabi.Backend.Controllers
{
/// <summary>
/// To acquire administrative data about the software.
/// </summary>
[Produces("application/json")]
[Route("api/[controller]")]
public class SoftwareController : Controller
{
private readonly VersionsResponse VersionsResponse = new VersionsResponse { ClientVersion = Constants.ClientVersion.ToString(3), BackendMajorVersion = Constants.BackendMajorVersion };
/// <summary>
/// Gets the latest versions of the client and backend.
/// </summary>
/// <returns>ClientVersion, BackendMajorVersion.</returns>
/// <response code="200">ClientVersion, BackendMajorVersion.</response>
[HttpGet("versions")]
[ProducesResponseType(typeof(VersionsResponse), 200)]
public VersionsResponse GetVersions()
{
return VersionsResponse;
}
}
}
| mit | C# |
c3f7486abdf0ee4136942bbf8fe8ed099a9408aa | Change iterator properties to array fields | adamralph/FakeItEasy,blairconrad/FakeItEasy,FakeItEasy/FakeItEasy,thomaslevesque/FakeItEasy,thomaslevesque/FakeItEasy,FakeItEasy/FakeItEasy,adamralph/FakeItEasy,blairconrad/FakeItEasy | tests/FakeItEasy.Tests/ServiceLocatorTests.cs | tests/FakeItEasy.Tests/ServiceLocatorTests.cs | namespace FakeItEasy.Tests
{
using System;
using System.Diagnostics.CodeAnalysis;
using FakeItEasy.Core;
using FakeItEasy.Creation;
using FakeItEasy.Expressions;
using FluentAssertions;
using NUnit.Framework;
[TestFixture]
public class ServiceLocatorTests
{
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Used reflectively.")]
private static readonly Type[] SingletonTypes = new[]
{
typeof(IExpressionCallMatcherFactory),
typeof(ExpressionArgumentConstraintFactory),
typeof(IProxyGenerator)
};
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Used reflectively.")]
private static readonly Type[] NonSingletonTypes = new[]
{
typeof(IFakeCreatorFacade),
typeof(IFakeAndDummyManager),
typeof(IFixtureInitializer)
};
[Test]
public void Current_should_not_be_null()
{
ServiceLocator.Current.Should().NotBeNull();
}
[Test]
public void Should_be_registered_as_singleton([ValueSource(nameof(SingletonTypes))] Type type)
{
var first = ServiceLocator.Current.Resolve(type);
var second = ServiceLocator.Current.Resolve(type);
second.Should().BeSameAs(first);
}
[Test]
public void Should_be_registered_as_non_singleton([ValueSource(nameof(NonSingletonTypes))] Type type)
{
var first = ServiceLocator.Current.Resolve(type);
var second = ServiceLocator.Current.Resolve(type);
second.Should().NotBeSameAs(first);
}
}
}
| namespace FakeItEasy.Tests
{
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using FakeItEasy.Core;
using FakeItEasy.Creation;
using FakeItEasy.Expressions;
using FluentAssertions;
using NUnit.Framework;
[TestFixture]
public class ServiceLocatorTests
{
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Used reflectively.")]
private static IEnumerable<Type> SingletonTypes
{
get
{
yield return typeof(IExpressionCallMatcherFactory);
yield return typeof(ExpressionArgumentConstraintFactory);
yield return typeof(IProxyGenerator);
}
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Used reflectively.")]
private static IEnumerable<Type> NonSingletonTypes
{
get
{
yield return typeof(IFakeCreatorFacade);
yield return typeof(IFakeAndDummyManager);
yield return typeof(IFixtureInitializer);
}
}
[Test]
public void Current_should_not_be_null()
{
ServiceLocator.Current.Should().NotBeNull();
}
[Test]
public void Should_be_registered_as_singleton([ValueSource(nameof(SingletonTypes))] Type type)
{
var first = ServiceLocator.Current.Resolve(type);
var second = ServiceLocator.Current.Resolve(type);
second.Should().BeSameAs(first);
}
[Test]
public void Should_be_registered_as_non_singleton([ValueSource(nameof(NonSingletonTypes))] Type type)
{
var first = ServiceLocator.Current.Resolve(type);
var second = ServiceLocator.Current.Resolve(type);
second.Should().NotBeSameAs(first);
}
}
}
| mit | C# |
018800ed41e3a37876b306792239405599fddac2 | Update Privacy.cshtml.cs | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Privacy.cshtml.cs | src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Privacy.cshtml.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace Company.WebApplication1.Pages
{
public class PrivacyModel : PageModel
{
private readonly ILogger<PrivacyModel> logger;
public PrivacyModel(ILogger<PrivacyModel> _logger)
{
logger = _logger;
}
public void OnGet()
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace Company.WebApplication1.Pages
{
public class PrivacyModel : PageModel
{
private readonly ILogger<PrivacyModel> logger;
public ErrorModel(ILogger<PrivacyModel> _logger)
{
logger = _logger;
}
public void OnGet()
{
}
}
}
| apache-2.0 | C# |
c30be07508a6dab07416d0ceee700a9d3c7cb880 | Remove unused method | tvdburgt/subtle | Subtle.Gui/AboutForm.cs | Subtle.Gui/AboutForm.cs | using System.Windows.Forms;
using Octokit;
using Subtle.Model;
using Application = System.Windows.Forms.Application;
namespace Subtle.Gui
{
public partial class AboutForm : Form
{
private const string RepositoryOwner = "tvdburgt";
private const string RepositoryName = "subtle";
private const string RepositoryUrl = "https://github.com/tvdburgt/subtle";
private readonly OSDbClient osdbClient;
private readonly IGitHubClient githubClient;
public AboutForm(OSDbClient osdbClient, IGitHubClient githubClient)
{
this.osdbClient = osdbClient;
this.githubClient = githubClient;
InitializeComponent();
LoadSubtleInfo();
LoadServerInfo();
}
private async void LoadSubtleInfo()
{
siteLabel.Text = RepositoryUrl;
siteLabel.Links[0].LinkData = RepositoryUrl;
versionLabel.Text = $"v{Application.ProductVersion}";
var releases = await githubClient.Release.GetAll(RepositoryOwner, RepositoryName);
var latest = releases[0];
latestVersionLabel.Text = $"{latest.TagName} ({latest.PublishedAt:d})";
latestVersionLabel.Links[0].LinkData = latest.HtmlUrl;
}
private async void LoadServerInfo()
{
var info = await osdbClient.GetServerInfoAsync();
apiLabel.Text = $"{info.ApiUrl} ({info.ApiVersion})";
subtitleCountLabel.Text = $"{int.Parse(info.SubtitleCount):n0}";
userCountLabel.Text = $"{info.OnlineUserCount:n0}";
clientCountLabel.Text = $"{info.OnlineClientCount:n0}";
subtitleQuotaLabel.Text = $"{info.DownloadQuota.Remaining:n0} (of {info.DownloadQuota.Limit:n0})";
responseTimeLabel.Text = $"{info.ResponseTime.TotalSeconds:0.000}s";
serverTimeLabel.Text = $"{info.ServerTime:0.000}s";
}
private void OnLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(e.Link.LinkData.ToString());
}
}
}
| using System.Windows.Forms;
using Octokit;
using Subtle.Model;
using Application = System.Windows.Forms.Application;
namespace Subtle.Gui
{
public partial class AboutForm : Form
{
private const string RepositoryOwner = "tvdburgt";
private const string RepositoryName = "subtle";
private const string RepositoryUrl = "https://github.com/tvdburgt/subtle";
private readonly OSDbClient osdbClient;
private readonly IGitHubClient githubClient;
public AboutForm(OSDbClient osdbClient, IGitHubClient githubClient)
{
this.osdbClient = osdbClient;
this.githubClient = githubClient;
InitializeComponent();
LoadSubtleInfo();
LoadServerInfo();
}
private async void LoadSubtleInfo()
{
siteLabel.Text = RepositoryUrl;
siteLabel.Links[0].LinkData = RepositoryUrl;
versionLabel.Text = $"v{Application.ProductVersion}";
var releases = await githubClient.Release.GetAll(RepositoryOwner, RepositoryName);
var latest = releases[0];
latestVersionLabel.Text = $"{latest.TagName} ({latest.PublishedAt:d})";
latestVersionLabel.Links[0].LinkData = latest.HtmlUrl;
}
private async void LoadServerInfo()
{
var info = await osdbClient.GetServerInfoAsync();
apiLabel.Text = $"{info.ApiUrl} ({info.ApiVersion})";
subtitleCountLabel.Text = $"{int.Parse(info.SubtitleCount):n0}";
userCountLabel.Text = $"{info.OnlineUserCount:n0}";
clientCountLabel.Text = $"{info.OnlineClientCount:n0}";
subtitleQuotaLabel.Text = $"{info.DownloadQuota.Remaining:n0} (of {info.DownloadQuota.Limit:n0})";
responseTimeLabel.Text = $"{info.ResponseTime.TotalSeconds:0.000}s";
serverTimeLabel.Text = $"{info.ServerTime:0.000}s";
}
private void OnLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(e.Link.LinkData.ToString());
}
private void versionLabel_Click(object sender, System.EventArgs e)
{
}
}
}
| mit | C# |
5fa7f5a7972666f7a6bd637259aed9743e2ae6c3 | Use Pool_update.async_apply | GaborApatiNagy/xenadmin,minli1/xenadmin,huizh/xenadmin,minli1/xenadmin,MihaelaStoica/xenadmin,jijiang/xenadmin,jijiang/xenadmin,letsboogey/xenadmin,minli1/xenadmin,letsboogey/xenadmin,GaborApatiNagy/xenadmin,kc284/xenadmin,Frezzle/xenadmin,xenserver/xenadmin,geosharath/xenadmin,stephen-turner/xenadmin,huizh/xenadmin,geosharath/xenadmin,ushamandya/xenadmin,huizh/xenadmin,letsboogey/xenadmin,GaborApatiNagy/xenadmin,jijiang/xenadmin,xenserver/xenadmin,kc284/xenadmin,stephen-turner/xenadmin,GaborApatiNagy/xenadmin,kc284/xenadmin,jijiang/xenadmin,xenserver/xenadmin,minli1/xenadmin,Frezzle/xenadmin,huizh/xenadmin,huizh/xenadmin,ushamandya/xenadmin,stephen-turner/xenadmin,letsboogey/xenadmin,ushamandya/xenadmin,geosharath/xenadmin,stephen-turner/xenadmin,geosharath/xenadmin,minli1/xenadmin,MihaelaStoica/xenadmin,letsboogey/xenadmin,jijiang/xenadmin,Frezzle/xenadmin,GaborApatiNagy/xenadmin,huizh/xenadmin,MihaelaStoica/xenadmin,MihaelaStoica/xenadmin,geosharath/xenadmin,kc284/xenadmin,jijiang/xenadmin,minli1/xenadmin,ushamandya/xenadmin,letsboogey/xenadmin,geosharath/xenadmin,ushamandya/xenadmin,MihaelaStoica/xenadmin,kc284/xenadmin,stephen-turner/xenadmin,Frezzle/xenadmin,stephen-turner/xenadmin,Frezzle/xenadmin,GaborApatiNagy/xenadmin,Frezzle/xenadmin,MihaelaStoica/xenadmin,ushamandya/xenadmin | XenAdmin/Wizards/PatchingWizard/PlanActions/ApplyPoolUpdatePlanAction.cs | XenAdmin/Wizards/PatchingWizard/PlanActions/ApplyPoolUpdatePlanAction.cs | /* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* 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.
*
* 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 HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using XenAPI;
namespace XenAdmin.Wizards.PatchingWizard.PlanActions
{
public class ApplyPoolUpdatePlanAction : PlanActionWithSession
{
private readonly Host host;
private readonly Pool_update poolUpdate;
public ApplyPoolUpdatePlanAction(Host host, Pool_update patch)
: base(host.Connection, string.Format(Messages.UPDATES_WIZARD_APPLYING_UPDATE, patch.Name, host.Name))
{
this.host = host;
this.poolUpdate = patch;
}
protected override void RunWithSession(ref Session session)
{
XenRef<Task> task = Pool_update.async_apply(session, poolUpdate.opaque_ref, host.opaque_ref);
PollTaskForResultAndDestroy(Connection, ref session, task);
}
}
} | /* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* 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.
*
* 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 HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using XenAPI;
namespace XenAdmin.Wizards.PatchingWizard.PlanActions
{
public class ApplyPoolUpdatePlanAction : PlanActionWithSession
{
private readonly Host host;
private readonly Pool_update poolUpdate;
public ApplyPoolUpdatePlanAction(Host host, Pool_update patch)
: base(host.Connection, string.Format(Messages.UPDATES_WIZARD_APPLYING_UPDATE, patch.Name, host.Name))
{
this.host = host;
this.poolUpdate = patch;
}
protected override void RunWithSession(ref Session session)
{
//XenRef<Task> task =
Pool_update.apply(session, poolUpdate.opaque_ref, host.opaque_ref);
//PollTaskForResultAndDestroy(Connection, ref session, task);
}
}
} | bsd-2-clause | C# |
92fb237c5ba3047342ae6c445b3fd07cafe7182d | Disable MongoDb tests | AsynkronIT/protoactor-dotnet | tests/Proto.Cluster.Identity.Tests/MongoIdentityTests.cs | tests/Proto.Cluster.Identity.Tests/MongoIdentityTests.cs | // ReSharper disable UnusedType.Global
namespace Proto.Cluster.Identity.Tests
{
using System;
using IdentityLookup;
using MongoDb;
using MongoDB.Driver;
using Proto.Cluster.Tests;
using Xunit;
using Xunit.Abstractions;
public class MongoIdentityClusterFixture : BaseInMemoryClusterFixture
{
public MongoIdentityClusterFixture() : base(3)
{
}
protected override IIdentityLookup GetIdentityLookup(string clusterName)
{
var db = GetMongo();
var pids = db.GetCollection<PidLookupEntity>("pids");
var identity = new IdentityStorageLookup(new MongoIdentityStorage(clusterName, pids));
return identity;
}
internal static IMongoDatabase GetMongo()
{
var connectionString =
Environment.GetEnvironmentVariable("MONGO") ?? "mongodb://127.0.0.1:27017/ProtoMongo";
var url = MongoUrl.Create(connectionString);
var settings = MongoClientSettings.FromUrl(url);
var client = new MongoClient(settings);
var database = client.GetDatabase("ProtoMongo");
return database;
}
}
// public class MongoClusterTests : ClusterTests, IClassFixture<MongoIdentityClusterFixture>
// {
// // ReSharper disable once SuggestBaseTypeForParameter
// public MongoClusterTests(ITestOutputHelper testOutputHelper, MongoIdentityClusterFixture clusterFixture)
// : base(testOutputHelper, clusterFixture)
// {
// }
// }
//
// public class MongoStorageTests : IdentityStorageTests
// {
// public MongoStorageTests() : base(Init)
// {
// }
//
// private static IIdentityStorage Init(string clusterName)
// {
// var db = MongoIdentityClusterFixture.GetMongo();
// return new MongoIdentityStorage(clusterName, db.GetCollection<PidLookupEntity>("pids"));
// }
// }
} | // ReSharper disable UnusedType.Global
namespace Proto.Cluster.Identity.Tests
{
using System;
using IdentityLookup;
using MongoDb;
using MongoDB.Driver;
using Proto.Cluster.Tests;
using Xunit;
using Xunit.Abstractions;
public class MongoIdentityClusterFixture : BaseInMemoryClusterFixture
{
public MongoIdentityClusterFixture() : base(3)
{
}
protected override IIdentityLookup GetIdentityLookup(string clusterName)
{
var db = GetMongo();
var pids = db.GetCollection<PidLookupEntity>("pids");
var identity = new IdentityStorageLookup(new MongoIdentityStorage(clusterName, pids));
return identity;
}
internal static IMongoDatabase GetMongo()
{
var connectionString =
Environment.GetEnvironmentVariable("MONGO") ?? "mongodb://127.0.0.1:27017/ProtoMongo";
var url = MongoUrl.Create(connectionString);
var settings = MongoClientSettings.FromUrl(url);
var client = new MongoClient(settings);
var database = client.GetDatabase("ProtoMongo");
return database;
}
}
public class MongoClusterTests : ClusterTests, IClassFixture<MongoIdentityClusterFixture>
{
// ReSharper disable once SuggestBaseTypeForParameter
public MongoClusterTests(ITestOutputHelper testOutputHelper, MongoIdentityClusterFixture clusterFixture)
: base(testOutputHelper, clusterFixture)
{
}
}
public class MongoStorageTests : IdentityStorageTests
{
public MongoStorageTests() : base(Init)
{
}
private static IIdentityStorage Init(string clusterName)
{
var db = MongoIdentityClusterFixture.GetMongo();
return new MongoIdentityStorage(clusterName, db.GetCollection<PidLookupEntity>("pids"));
}
}
} | apache-2.0 | C# |
915f805db0b122bdf65d65c98e1ccda9915a3ea9 | Update version to 0.1.1 | yufeih/Nine.Application,studio-nine/Nine.Application | src/Portable/AssemblyInfo.cs | src/Portable/AssemblyInfo.cs | using System.Resources;
using System.Reflection;
[assembly: AssemblyTitle("Nine.Application")]
[assembly: AssemblyDescription("A portable way of accessing common device functionality for client applications")]
[assembly: AssemblyCompany("Studio Nine")]
[assembly: AssemblyProduct("Nine.Application")]
[assembly: AssemblyCopyright("Copyright © Studio Nine 2015")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
| using System.Resources;
using System.Reflection;
[assembly: AssemblyTitle("Nine.Application")]
[assembly: AssemblyDescription("A portable way of accessing common device functionality for client applications")]
[assembly: AssemblyCompany("Studio Nine")]
[assembly: AssemblyProduct("Nine.Application")]
[assembly: AssemblyCopyright("Copyright © Studio Nine 2015")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
| mit | C# |
7ed0692f33738cc51fe91bd3575a853bfbde7be6 | Increment build -> v0.1.1 | awseward/Bugsnag.NET,awseward/Bugsnag.NET | Bugsnag.NET/Properties/AssemblyInfo.cs | Bugsnag.NET/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("Bugsnag.NET")]
[assembly: AssemblyProduct("Bugsnag.NET")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: InternalsVisibleTo("Bugsnag.NET.Tests")]
// 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("72121f80-f8ac-4be5-b914-4f65faffc1cc")]
// 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.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.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("Bugsnag.NET")]
[assembly: AssemblyProduct("Bugsnag.NET")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: InternalsVisibleTo("Bugsnag.NET.Tests")]
// 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("72121f80-f8ac-4be5-b914-4f65faffc1cc")]
// 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")]
[assembly: AssemblyInformationalVersion("0.1")] | mit | C# |
e6f06447eb25868d5430b768fb038183d4f504b9 | Update version to 0.0.3.0 | imasm/CSharpExtensions | CSharpEx/Properties/AssemblyVersion.cs | CSharpEx/Properties/AssemblyVersion.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// La información de versión de un ensamblado consta de los cuatro valores siguientes:
//
// Versión principal
// Versión secundaria
// Número de compilación
// Revisión
//
// Puede especificar todos los valores o establecer como predeterminados los números de versión de compilación y de revisión
// mediante el asterisco ('*'), como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.3.0")]
[assembly: AssemblyFileVersion("0.0.3.0")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// La información de versión de un ensamblado consta de los cuatro valores siguientes:
//
// Versión principal
// Versión secundaria
// Número de compilación
// Revisión
//
// Puede especificar todos los valores o establecer como predeterminados los números de versión de compilación y de revisión
// mediante el asterisco ('*'), como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.2.0")]
[assembly: AssemblyFileVersion("0.0.2.0")] | apache-2.0 | C# |
126a7d45ae1e67fd4de728be43a57cf38bdcc4cc | rename Setup -> HFTSetup | greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d | Assets/HappyFunTimes/HappyFunTimesCore/Editor/HFTSetup.cs | Assets/HappyFunTimes/HappyFunTimesCore/Editor/HFTSetup.cs | /*
* Copyright 2015, Gregg Tavares.
* All rights reserved.
*
* 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 Gregg Tavares. 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.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace HappyFunTimesEditor
{
[InitializeOnLoad]
class HFTStartup
{
static HFTStartup ()
{
PlayerSettings.runInBackground = true;
}
}
} // namespace HappyFunTimesEditor
| /*
* Copyright 2015, Gregg Tavares.
* All rights reserved.
*
* 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 Gregg Tavares. 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.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace HappyFunTimesEditor
{
[InitializeOnLoad]
class Startup
{
static Startup ()
{
PlayerSettings.runInBackground = true;
}
}
} // namespace HappyFunTimesEditor
| bsd-3-clause | C# |
9121988895ac607701ecc0fb5daba8928a75de86 | remove unused field | StefanoFiumara/Harry-Potter-Unity | Assets/Scripts/HarryPotterUnity/Tween/ShuffleDeckTween.cs | Assets/Scripts/HarryPotterUnity/Tween/ShuffleDeckTween.cs | using System;
using System.Collections.Generic;
using HarryPotterUnity.Cards;
using UnityEngine;
using Random = UnityEngine.Random;
namespace HarryPotterUnity.Tween
{
public class ShuffleDeckTween : ITweenObject
{
private readonly IEnumerable<BaseCard> _cards;
public float CompletionTime { get { return 2f; } }
public float TimeUntilNextTween { get { return 0f; } }
public ShuffleDeckTween(IEnumerable<BaseCard> cards, Func<BaseCard, Vector3> getTargetPosition)
{
_cards = cards;
}
public void ExecuteTween()
{
foreach (var card in _cards)
{
int cardIndex = ((IList<BaseCard>) _cards).IndexOf(card);
var targetPosition = new Vector3( card.transform.position.x,
card.transform.position.y,
(card.transform.parent.position.z + 16f) - cardIndex * 0.2f);
var midPoint = Vector3.MoveTowards(card.transform.position, Camera.main.transform.position, 80f);
midPoint.z = card.transform.position.z;
iTween.MoveTo(card.gameObject, iTween.Hash("time", 0.5f,
"path", new[] {midPoint, targetPosition},
"easetype", iTween.EaseType.EaseInOutSine,
"delay", Random.Range(0f, 1.5f)
));
}
}
}
}
| using System;
using System.Collections.Generic;
using HarryPotterUnity.Cards;
using UnityEngine;
using Random = UnityEngine.Random;
namespace HarryPotterUnity.Tween
{
public class ShuffleDeckTween : ITweenObject
{
private readonly IEnumerable<BaseCard> _cards;
private readonly Func<BaseCard, Vector3> _getTargetPosition;
public float CompletionTime { get { return 2f; } }
public float TimeUntilNextTween { get { return 0f; } }
public ShuffleDeckTween(IEnumerable<BaseCard> cards, Func<BaseCard, Vector3> getTargetPosition)
{
_cards = cards;
_getTargetPosition = getTargetPosition;
}
public void ExecuteTween()
{
foreach (var card in _cards)
{
int cardIndex = ((IList<BaseCard>) _cards).IndexOf(card);
var targetPosition = new Vector3( card.transform.position.x,
card.transform.position.y,
(card.transform.parent.position.z + 16f) - cardIndex * 0.2f);
var midPoint = Vector3.MoveTowards(card.transform.position, Camera.main.transform.position, 80f);
midPoint.z = card.transform.position.z;
iTween.MoveTo(card.gameObject, iTween.Hash("time", 0.5f,
"path", new[] {midPoint, targetPosition},
"easetype", iTween.EaseType.EaseInOutSine,
"delay", Random.Range(0f, 1.5f)
));
}
}
}
}
| mit | C# |
8c15c917e90b7785c6d5ef9a6fad3dcc7f418827 | Add reference to MemberRef of override directive | Desolath/ConfuserEx3,Desolath/Confuserex,yeaicc/ConfuserEx,engdata/ConfuserEx | Confuser.Renamer/References/OverrideDirectiveReference.cs | Confuser.Renamer/References/OverrideDirectiveReference.cs | using System;
using System.Linq;
using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer.References {
internal class OverrideDirectiveReference : INameReference<MethodDef> {
readonly VTableSlot baseSlot;
readonly VTableSlot thisSlot;
public OverrideDirectiveReference(VTableSlot thisSlot, VTableSlot baseSlot) {
this.thisSlot = thisSlot;
this.baseSlot = baseSlot;
}
void AddImportReference(ConfuserContext context, INameService service, ModuleDef module, MethodDef method, MemberRef methodRef) {
if (method.Module != module && context.Modules.Contains((ModuleDefMD)method.Module)) {
var declType = (TypeRef)methodRef.DeclaringType.ScopeType;
service.AddReference(method.DeclaringType, new TypeRefReference(declType, method.DeclaringType));
service.AddReference(method, new MemberRefReference(methodRef, method));
var typeRefs = methodRef.MethodSig.Params.SelectMany(param => param.FindTypeRefs()).ToList();
typeRefs.AddRange(methodRef.MethodSig.RetType.FindTypeRefs());
foreach (var typeRef in typeRefs) {
var def = typeRef.ResolveTypeDefThrow();
if (def.Module != module && context.Modules.Contains((ModuleDefMD)def.Module))
service.AddReference(def, new TypeRefReference((TypeRef)typeRef, def));
}
}
}
public bool UpdateNameReference(ConfuserContext context, INameService service) {
MethodDef method = thisSlot.MethodDef;
IMethod target;
if (baseSlot.MethodDefDeclType is GenericInstSig) {
var declType = (GenericInstSig)baseSlot.MethodDefDeclType;
MemberRef targetRef = new MemberRefUser(method.Module, baseSlot.MethodDef.Name, baseSlot.MethodDef.MethodSig, declType.ToTypeDefOrRef());
targetRef = new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(targetRef);
service.AddReference(baseSlot.MethodDef, new MemberRefReference(targetRef, baseSlot.MethodDef));
target = targetRef;
}
else {
target = baseSlot.MethodDef;
if (target.Module != method.Module) {
target = (IMethod)new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(baseSlot.MethodDef);
if (target is MemberRef)
service.AddReference(baseSlot.MethodDef, new MemberRefReference((MemberRef)target, baseSlot.MethodDef));
}
}
if (target is MemberRef)
AddImportReference(context, service, method.Module, baseSlot.MethodDef, (MemberRef)target);
if (method.Overrides.Any(impl =>
new SigComparer().Equals(impl.MethodDeclaration.MethodSig, target.MethodSig) &&
new SigComparer().Equals(impl.MethodDeclaration.DeclaringType.ResolveTypeDef(), target.DeclaringType.ResolveTypeDef())))
return true;
method.Overrides.Add(new MethodOverride(method, (IMethodDefOrRef)target));
return true;
}
public bool ShouldCancelRename() {
return baseSlot.MethodDefDeclType is GenericInstSig && thisSlot.MethodDef.Module.IsClr20;
}
}
} | using System;
using System.Linq;
using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer.References {
internal class OverrideDirectiveReference : INameReference<MethodDef> {
readonly VTableSlot baseSlot;
readonly VTableSlot thisSlot;
public OverrideDirectiveReference(VTableSlot thisSlot, VTableSlot baseSlot) {
this.thisSlot = thisSlot;
this.baseSlot = baseSlot;
}
void AddImportReference(ConfuserContext context, INameService service, ModuleDef module, MethodDef method, MemberRef methodRef) {
if (method.Module != module && context.Modules.Contains((ModuleDefMD)method.Module)) {
var declType = (TypeRef)methodRef.DeclaringType.ScopeType;
service.AddReference(method.DeclaringType, new TypeRefReference(declType, method.DeclaringType));
service.AddReference(method, new MemberRefReference(methodRef, method));
var typeRefs = methodRef.MethodSig.Params.SelectMany(param => param.FindTypeRefs()).ToList();
typeRefs.AddRange(methodRef.MethodSig.RetType.FindTypeRefs());
foreach (var typeRef in typeRefs) {
var def = typeRef.ResolveTypeDefThrow();
if (def.Module != module && context.Modules.Contains((ModuleDefMD)def.Module))
service.AddReference(def, new TypeRefReference((TypeRef)typeRef, def));
}
}
}
public bool UpdateNameReference(ConfuserContext context, INameService service) {
MethodDef method = thisSlot.MethodDef;
IMethod target;
if (baseSlot.MethodDefDeclType is GenericInstSig) {
var declType = (GenericInstSig)baseSlot.MethodDefDeclType;
target = new MemberRefUser(method.Module, baseSlot.MethodDef.Name, baseSlot.MethodDef.MethodSig, declType.ToTypeDefOrRef());
target = (IMethod)new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(target);
}
else {
target = baseSlot.MethodDef;
if (target.Module != method.Module)
target = (IMethod)new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(baseSlot.MethodDef);
}
if (target is MemberRef)
AddImportReference(context, service, method.Module, baseSlot.MethodDef, (MemberRef)target);
if (method.Overrides.Any(impl =>
new SigComparer().Equals(impl.MethodDeclaration.MethodSig, target.MethodSig) &&
new SigComparer().Equals(impl.MethodDeclaration.DeclaringType.ResolveTypeDef(), target.DeclaringType.ResolveTypeDef())))
return true;
method.Overrides.Add(new MethodOverride(method, (IMethodDefOrRef)target));
return true;
}
public bool ShouldCancelRename() {
return baseSlot.MethodDefDeclType is GenericInstSig && thisSlot.MethodDef.Module.IsClr20;
}
}
} | mit | C# |
0fa2b124436bfd6a4df0524d00200bd2e40a0cbf | Allow CommandPaletteArgumentWindow nesting (Ask for arguments in callback of argument :) | DarrenTsung/DTCommandPalette | Editor/CommandPaletteArgumentWindow.cs | Editor/CommandPaletteArgumentWindow.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace DTCommandPalette {
public class CommandPaletteArgumentWindow : EditorWindow {
// PRAGMA MARK - Constants
private const string kTextFieldControlName = "CommandPaletteArgumentWindowTextField";
private const float kWindowWidth = 400.0f;
private const float kWindowHeight = 30.0f;
private const int kFontSize = 21;
// PRAGMA MARK - Public Interface
public static void Show(string title, Action<string> argumentCallback, Action cancelCallback = null) {
cancelCallback_ = cancelCallback;
argumentCallback_ = argumentCallback;
input_ = "";
EditorWindow window = EditorWindow.GetWindow(typeof(CommandPaletteArgumentWindow), utility: true, title: title, focus: true);
window.position = new Rect(0.0f, 0.0f, kWindowWidth, kWindowHeight);
window.CenterInMainEditorWindow();
window.wantsMouseMove = true;
focusTrigger_ = true;
isClosing_ = false;
}
// PRAGMA MARK - Internal
private static string input_ = "";
private static bool focusTrigger_ = false;
private static bool isClosing_ = false;
private static Action cancelCallback_;
private static Action<string> argumentCallback_;
private void OnGUI() {
Event e = Event.current;
switch (e.type) {
case EventType.KeyDown:
HandleKeyDownEvent(e);
break;
default:
break;
}
GUIStyle textFieldStyle = new GUIStyle(GUI.skin.textField);
textFieldStyle.fontSize = kFontSize;
GUI.SetNextControlName(kTextFieldControlName);
input_ = EditorGUI.TextField(new Rect(0.0f, 0.0f, kWindowWidth, kWindowHeight), input_, textFieldStyle);
this.position = new Rect(this.position.x, this.position.y, this.position.width, kWindowHeight);
if (focusTrigger_) {
focusTrigger_ = false;
EditorGUI.FocusTextInControl(kTextFieldControlName);
}
}
private void HandleKeyDownEvent(Event e) {
switch (e.keyCode) {
case KeyCode.Escape:
CloseIfNotClosing();
break;
case KeyCode.Return:
ReturnArgument(input_);
break;
default:
break;
}
}
private void ReturnArgument(string argument) {
CloseIfNotClosing();
cancelCallback_ = null;
if (argumentCallback_ != null) {
var argumentCallback = argumentCallback_;
argumentCallback_ = null;
argumentCallback.Invoke(argument);
}
}
private void OnFocus() {
focusTrigger_ = true;
}
private void OnLostFocus() {
CloseIfNotClosing();
}
private void CloseIfNotClosing() {
if (cancelCallback_ != null) {
cancelCallback_.Invoke();
cancelCallback_ = null;
}
if (!isClosing_) {
isClosing_ = true;
Close();
}
}
}
} | using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace DTCommandPalette {
public class CommandPaletteArgumentWindow : EditorWindow {
// PRAGMA MARK - Constants
private const string kTextFieldControlName = "CommandPaletteArgumentWindowTextField";
private const float kWindowWidth = 400.0f;
private const float kWindowHeight = 30.0f;
private const int kFontSize = 21;
// PRAGMA MARK - Public Interface
public static void Show(string title, Action<string> argumentCallback, Action cancelCallback = null) {
cancelCallback_ = cancelCallback;
argumentCallback_ = argumentCallback;
input_ = "";
EditorWindow window = EditorWindow.GetWindow(typeof(CommandPaletteArgumentWindow), utility: true, title: title, focus: true);
window.position = new Rect(0.0f, 0.0f, kWindowWidth, kWindowHeight);
window.CenterInMainEditorWindow();
window.wantsMouseMove = true;
focusTrigger_ = true;
isClosing_ = false;
}
// PRAGMA MARK - Internal
private static string input_ = "";
private static bool focusTrigger_ = false;
private static bool isClosing_ = false;
private static Action cancelCallback_;
private static Action<string> argumentCallback_;
private void OnGUI() {
Event e = Event.current;
switch (e.type) {
case EventType.KeyDown:
HandleKeyDownEvent(e);
break;
default:
break;
}
GUIStyle textFieldStyle = new GUIStyle(GUI.skin.textField);
textFieldStyle.fontSize = kFontSize;
GUI.SetNextControlName(kTextFieldControlName);
input_ = EditorGUI.TextField(new Rect(0.0f, 0.0f, kWindowWidth, kWindowHeight), input_, textFieldStyle);
this.position = new Rect(this.position.x, this.position.y, this.position.width, kWindowHeight);
if (focusTrigger_) {
focusTrigger_ = false;
EditorGUI.FocusTextInControl(kTextFieldControlName);
}
}
private void HandleKeyDownEvent(Event e) {
switch (e.keyCode) {
case KeyCode.Escape:
CloseIfNotClosing();
break;
case KeyCode.Return:
ReturnArgument(input_);
break;
default:
break;
}
}
private void ReturnArgument(string argument) {
if (argumentCallback_ != null) {
argumentCallback_.Invoke(argument);
argumentCallback_ = null;
}
cancelCallback_ = null;
CloseIfNotClosing();
}
private void OnFocus() {
focusTrigger_ = true;
}
private void OnLostFocus() {
CloseIfNotClosing();
}
private void CloseIfNotClosing() {
if (cancelCallback_ != null) {
cancelCallback_.Invoke();
cancelCallback_ = null;
}
if (!isClosing_) {
isClosing_ = true;
Close();
}
}
}
} | mit | C# |
12dce77d512ec4231ddf5d20a78a9372da500380 | Bump assembly version to 2.5.0. | jcheng31/DarkSkyApi,jcheng31/ForecastPCL | ForecastPCL/Properties/AssemblyInfo.cs | ForecastPCL/Properties/AssemblyInfo.cs | using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ForecastPCL")]
[assembly: AssemblyDescription("An unofficial PCL for the forecast.io weather API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jerome Cheng")]
[assembly: AssemblyProduct("ForecastPCL")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.0.0")]
[assembly: AssemblyFileVersion("2.5.0.0")]
| using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ForecastPCL")]
[assembly: AssemblyDescription("An unofficial PCL for the forecast.io weather API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jerome Cheng")]
[assembly: AssemblyProduct("ForecastPCL")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.0.0")]
[assembly: AssemblyFileVersion("2.4.0.0")]
| mit | C# |
b50d3a21f84ef9351bfc2e79b59c81b1dc70ffc2 | Use native pointer for format string | testfairy/testfairy-xamarin | binding/TestFairy.iOS/StructsAndEnums.cs | binding/TestFairy.iOS/StructsAndEnums.cs | using System;
using System.Runtime.InteropServices;
using Foundation;
// Generated by Objective Sharpie (https://download.xamarin.com/objective-sharpie/ObjectiveSharpie.pkg)
// > sharpie bind -output TestFairy -namespace TestFairyLib -sdk iphoneos10.1 TestFairy.h
namespace TestFairyLib
{
public static class CFunctions
{
// extern void TFLog (NSString *format, ...) __attribute__((format(NSString, 1, 2)));
[DllImport ("__Internal")]
public static extern void TFLog (IntPtr format, string arg0);
// extern void TFLogv (NSString *format, va_list arg_list);
[DllImport ("__Internal")]
public static extern unsafe void TFLogv (IntPtr format, sbyte* arg_list);
}
}
| using System;
using System.Runtime.InteropServices;
using Foundation;
// Generated by Objective Sharpie (https://download.xamarin.com/objective-sharpie/ObjectiveSharpie.pkg)
// > sharpie bind -output TestFairy -namespace TestFairyLib -sdk iphoneos10.1 TestFairy.h
namespace TestFairyLib
{
public static class CFunctions
{
// extern void TFLog (NSString *format, ...) __attribute__((format(NSString, 1, 2)));
[DllImport ("__Internal")]
public static extern void TFLog (NSString format, IntPtr varArgs);
// extern void TFLogv (NSString *format, va_list arg_list);
[DllImport ("__Internal")]
public static extern unsafe void TFLogv (NSString format, sbyte* arg_list);
}
}
| apache-2.0 | C# |
ab56bce5b15f69667988455feaf760c4eaadc9a6 | Fix directory selector crashing when attempting to display a bitlocker locked drive | peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework | osu.Framework/Graphics/UserInterface/DirectorySelectorDirectory.cs | osu.Framework/Graphics/UserInterface/DirectorySelectorDirectory.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Input.Events;
using osu.Framework.Extensions.EnumExtensions;
namespace osu.Framework.Graphics.UserInterface
{
public abstract class DirectorySelectorDirectory : DirectorySelectorItem
{
protected readonly DirectoryInfo Directory;
protected override string FallbackName => Directory.Name;
[Resolved]
private Bindable<DirectoryInfo> currentDirectory { get; set; }
protected DirectorySelectorDirectory(DirectoryInfo directory, string displayName = null)
: base(displayName)
{
Directory = directory;
try
{
bool isHidden = directory?.Attributes.HasFlagFast(FileAttributes.Hidden) == true;
// On Windows, system drives are returned with `System | Hidden | Directory` file attributes,
// but the expectation is that they shouldn't be shown in a hidden state.
bool isSystemDrive = directory?.Parent == null;
if (isHidden && !isSystemDrive)
ApplyHiddenState();
}
catch (IOException)
{
// various IO exceptions could occur when attempting to read attributes.
// one example is when a target directory is a drive which is locked by BitLocker:
//
// "Unhandled exception. System.IO.IOException: This drive is locked by BitLocker Drive Encryption. You must unlock this drive from Control Panel. : 'D:\'"
}
catch (UnauthorizedAccessException)
{
// checking attributes on access-controlled directories will throw an error so we handle it here to prevent a crash
}
}
protected override bool OnClick(ClickEvent e)
{
currentDirectory.Value = Directory;
return true;
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Input.Events;
using osu.Framework.Extensions.EnumExtensions;
namespace osu.Framework.Graphics.UserInterface
{
public abstract class DirectorySelectorDirectory : DirectorySelectorItem
{
protected readonly DirectoryInfo Directory;
protected override string FallbackName => Directory.Name;
[Resolved]
private Bindable<DirectoryInfo> currentDirectory { get; set; }
protected DirectorySelectorDirectory(DirectoryInfo directory, string displayName = null)
: base(displayName)
{
Directory = directory;
try
{
bool isHidden = directory?.Attributes.HasFlagFast(FileAttributes.Hidden) == true;
// On Windows, system drives are returned with `System | Hidden | Directory` file attributes,
// but the expectation is that they shouldn't be shown in a hidden state.
bool isSystemDrive = directory?.Parent == null;
if (isHidden && !isSystemDrive)
ApplyHiddenState();
}
catch (UnauthorizedAccessException)
{
// checking attributes on access-controlled directories will throw an error so we handle it here to prevent a crash
}
}
protected override bool OnClick(ClickEvent e)
{
currentDirectory.Value = Directory;
return true;
}
}
}
| mit | C# |
f8c767b6c4960e372b601f0e891a4727a1d42495 | Update version number. | Damnae/storybrew | editor/Properties/AssemblyInfo.cs | editor/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.49.*")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.48.*")]
| mit | C# |
e4ca54fd44c0619792ae7a5cdb71d690a325d855 | fix a bug when reuse IQueriable | DanielLavrushin/LinqToSolr | LinqToSolr/Query/LinqToSolrProvider.cs | LinqToSolr/Query/LinqToSolrProvider.cs | using System;
using System.Collections;
using System.Linq;
using System.Linq.Expressions;
using LinqToSolr.Expressions;
using LinqToSolr.Services;
using LinqToSolr.Data;
namespace LinqToSolr.Query
{
public class LinqToSolrProvider: IQueryProvider
{
internal Type ElementType;
internal ILinqToSolrService Service;
internal bool IsEnumerable;
public LinqToSolrProvider(ILinqToSolrService service)
{
Service = service;
ElementType = Service.ElementType;
}
public IQueryable CreateQuery(Expression expression)
{
ElementType = TypeSystem.GetElementType(expression.Type);
try
{
return (IQueryable)Activator.CreateInstance(typeof(LinqToSolrQueriable<>).MakeGenericType(ElementType), new object[] { this, expression });
}
catch (System.Reflection.TargetInvocationException ex)
{
throw ex.InnerException;
}
}
public IQueryable<TElement> CreateQuery<TElement>(Expression expression)
{
return new LinqToSolrQueriable<TElement>(this, expression);
}
public object Execute(Expression expression)
{
var query = GetSolrQuery(expression).Query(ElementType);
return IsEnumerable ? query : ((IEnumerable)query).Cast<object>().FirstOrDefault();
}
public TResult Execute<TResult>(Expression expression)
{
IsEnumerable = (typeof(TResult).Name == "IEnumerable`1");
var result = Execute(expression);
return (TResult)result;
}
internal ILinqToSolrService GetSolrQuery(Expression expression)
{
var elementType = TypeSystem.GetElementType(expression.Type);
Service.ElementType = elementType;
var qt = new LinqToSolrQueryTranslator(Service);
expression = Evaluator.PartialEval(expression);
Service.CurrentQuery = Service.CurrentQuery ?? new LinqToSolrQuery();
Service.CurrentQuery.FilterUrl = qt.Translate(BooleanVisitor.Process(expression));
return Service;
}
}
}
| using System;
using System.Collections;
using System.Linq;
using System.Linq.Expressions;
using LinqToSolr.Expressions;
using LinqToSolr.Services;
namespace LinqToSolr.Query
{
public class LinqToSolrProvider: IQueryProvider
{
internal Type ElementType;
internal ILinqToSolrService Service;
internal bool IsEnumerable;
public LinqToSolrProvider(ILinqToSolrService service)
{
Service = service;
ElementType = Service.ElementType;
}
public IQueryable CreateQuery(Expression expression)
{
ElementType = TypeSystem.GetElementType(expression.Type);
try
{
return (IQueryable)Activator.CreateInstance(typeof(LinqToSolrQueriable<>).MakeGenericType(ElementType), new object[] { this, expression });
}
catch (System.Reflection.TargetInvocationException ex)
{
throw ex.InnerException;
}
}
public IQueryable<TElement> CreateQuery<TElement>(Expression expression)
{
return new LinqToSolrQueriable<TElement>(this, expression);
}
public object Execute(Expression expression)
{
var query = GetSolrQuery(expression).Query(ElementType);
return IsEnumerable ? query : ((IEnumerable)query).Cast<object>().FirstOrDefault();
}
public TResult Execute<TResult>(Expression expression)
{
IsEnumerable = (typeof(TResult).Name == "IEnumerable`1");
var result = Execute(expression);
return (TResult)result;
}
internal ILinqToSolrService GetSolrQuery(Expression expression)
{
var elementType = TypeSystem.GetElementType(expression.Type);
Service.ElementType = elementType;
var qt = new LinqToSolrQueryTranslator(Service);
expression = Evaluator.PartialEval(expression);
Service.CurrentQuery.FilterUrl = qt.Translate(BooleanVisitor.Process(expression));
return Service;
}
}
}
| mit | C# |
6c4bc500fe71c7f7cf233ba383bdec2bddf2dc3a | Fix test on non-Windows OS | nkolev92/sdk,nkolev92/sdk | test/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackAHelloWorldProject.cs | test/Microsoft.NET.Pack.Tests/GivenThatWeWantToPackAHelloWorldProject.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Microsoft.NET.TestFramework;
using Microsoft.NET.TestFramework.Assertions;
using Microsoft.NET.TestFramework.Commands;
using FluentAssertions;
using Xunit;
using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
namespace Microsoft.NET.Pack.Tests
{
public class GivenThatWeWantToPackAHelloWorldProject : SdkTest
{
[Fact]
public void It_packs_successfully()
{
var helloWorldAsset = _testAssetsManager
.CopyTestAsset("HelloWorld", "PackHelloWorld")
.WithSource()
.Restore();
new PackCommand(Stage0MSBuild, helloWorldAsset.TestRoot)
.Execute()
.Should()
.Pass();
// Validate the contents of the NuGet package by looking at the generated .nuspec file, as that's simpler
// than unzipping and inspecting the .nupkg
string nuspecPath = Path.Combine(helloWorldAsset.TestRoot, "obj", "HelloWorld.1.0.0.nuspec");
var nuspec = XDocument.Load(nuspecPath);
var ns = nuspec.Root.Name.Namespace;
XElement filesSection = nuspec.Root.Element(ns + "files");
var fileTargets = filesSection.Elements().Select(files => files.Attribute("target").Value).ToList();
var expectedFileTargets = new[]
{
@"lib\netcoreapp1.0\HelloWorld.runtimeconfig.json",
@"lib\netcoreapp1.0\HelloWorld.dll"
}.Select(p => p.Replace('\\', Path.DirectorySeparatorChar));
fileTargets.Should().BeEquivalentTo(expectedFileTargets);
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Microsoft.NET.TestFramework;
using Microsoft.NET.TestFramework.Assertions;
using Microsoft.NET.TestFramework.Commands;
using FluentAssertions;
using Xunit;
using static Microsoft.NET.TestFramework.Commands.MSBuildTest;
namespace Microsoft.NET.Pack.Tests
{
public class GivenThatWeWantToPackAHelloWorldProject : SdkTest
{
[Fact]
public void It_packs_successfully()
{
var helloWorldAsset = _testAssetsManager
.CopyTestAsset("HelloWorld", "PackHelloWorld")
.WithSource()
.Restore();
new PackCommand(Stage0MSBuild, helloWorldAsset.TestRoot)
.Execute()
.Should()
.Pass();
// Validate the contents of the NuGet package by looking at the generated .nuspec file, as that's simpler
// than unzipping and inspecting the .nupkg
string nuspecPath = Path.Combine(helloWorldAsset.TestRoot, "obj", "HelloWorld.1.0.0.nuspec");
var nuspec = XDocument.Load(nuspecPath);
var ns = nuspec.Root.Name.Namespace;
XElement filesSection = nuspec.Root.Element(ns + "files");
var fileTargets = filesSection.Elements().Select(files => files.Attribute("target").Value).ToList();
fileTargets.Should().BeEquivalentTo(
@"lib\netcoreapp1.0\HelloWorld.runtimeconfig.json",
@"lib\netcoreapp1.0\HelloWorld.dll"
);
}
}
}
| mit | C# |
20c19ff5dbc020a46c5a10ebad52d009718e9f37 | Update index.cshtml | reactiveui/website,reactiveui/website,reactiveui/website,reactiveui/website | input/docs/concepts/index.cshtml | input/docs/concepts/index.cshtml | Order: 10
---
This page is an overview of ReactiveUI.
# What is ReactiveUI
# Why reactive
# What ReactiveUI is not
# What’s next
@Html.Partial("_ChildPages")
| Order: 10
---
@Html.Partial("_ChildPages") | mit | C# |
e84dc66eb42ead76016e8c8d8cdca005d867b691 | support load types from exe file | kerryjiang/NDock,huoxudong125/NDock,huoxudong125/NDock,jmptrader/NDock,kerryjiang/NDock,jmptrader/NDock | src/NDock.Server/Isolation/AssemblyImport.cs | src/NDock.Server/Isolation/AssemblyImport.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace NDock.Server.Isolation
{
/// <summary>
/// AssemblyImport, used for importing assembly to the current AppDomain
/// </summary>
public class AssemblyImport : MarshalByRefObject
{
private string m_ImportRoot;
/// <summary>
/// Initializes a new instance of the <see cref="AssemblyImport"/> class.
/// </summary>
public AssemblyImport(string importRoot)
{
m_ImportRoot = importRoot;
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
}
//Process cannot resolved assemblies
Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
AssemblyName name = new AssemblyName(args.Name);
var assemblyFilePath = Path.Combine(m_ImportRoot, name.Name + ".dll");
if (!File.Exists(assemblyFilePath))
{
assemblyFilePath = Path.Combine(m_ImportRoot, name.Name + ".exe");
if (!File.Exists(assemblyFilePath))
{
return null;
}
}
return Assembly.LoadFrom(assemblyFilePath);
}
/// <summary>
/// Registers the assembply import.
/// </summary>
/// <param name="hostAppDomain">The host application domain.</param>
public static void RegisterAssembplyImport(AppDomain hostAppDomain)
{
var assemblyImportType = typeof(AssemblyImport);
hostAppDomain.CreateInstanceFrom(assemblyImportType.Assembly.CodeBase,
assemblyImportType.FullName,
true,
BindingFlags.CreateInstance,
null,
new object[] { AppDomain.CurrentDomain.BaseDirectory },
null,
new object[0]);
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace NDock.Server.Isolation
{
/// <summary>
/// AssemblyImport, used for importing assembly to the current AppDomain
/// </summary>
public class AssemblyImport : MarshalByRefObject
{
private string m_ImportRoot;
/// <summary>
/// Initializes a new instance of the <see cref="AssemblyImport"/> class.
/// </summary>
public AssemblyImport(string importRoot)
{
m_ImportRoot = importRoot;
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
}
//Process cannot resolved assemblies
Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
AssemblyName name = new AssemblyName(args.Name);
var assemblyFilePath = Path.Combine(m_ImportRoot, name.Name + ".dll");
if (!File.Exists(assemblyFilePath))
return null;
return Assembly.LoadFrom(assemblyFilePath);
}
/// <summary>
/// Registers the assembply import.
/// </summary>
/// <param name="hostAppDomain">The host application domain.</param>
public static void RegisterAssembplyImport(AppDomain hostAppDomain)
{
var assemblyImportType = typeof(AssemblyImport);
hostAppDomain.CreateInstanceFrom(assemblyImportType.Assembly.CodeBase,
assemblyImportType.FullName,
true,
BindingFlags.CreateInstance,
null,
new object[] { AppDomain.CurrentDomain.BaseDirectory },
null,
new object[0]);
}
}
}
| apache-2.0 | C# |
bb9fceaeae4cafc468d84be9d3247b4604a6b7ff | edit assembly info for PS4MacroAPI | komefai/PS4Macro | PS4MacroAPI/Properties/AssemblyInfo.cs | PS4MacroAPI/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("PS4MacroAPI")]
[assembly: AssemblyDescription("Scripting API for PS4 Macro")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Komefai")]
[assembly: AssemblyProduct("PS4MacroAPI")]
[assembly: AssemblyCopyright("Komefai Copyright © 2017")]
[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("63b26590-8dd4-4534-8e5e-c72750f29934")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PS4MacroAPI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PS4MacroAPI")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[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("63b26590-8dd4-4534-8e5e-c72750f29934")]
// 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# |
875bb611c10aad8ef315212f0e21c8c7ae304546 | Fix issue with long data string (e.g. base64) | Krusen/PinSharp | PinSharp/Http/FormUrlEncodedContent.cs | PinSharp/Http/FormUrlEncodedContent.cs | using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
namespace PinSharp.Http
{
internal class FormUrlEncodedContent : ByteArrayContent
{
private static readonly Encoding DefaultHttpEncoding = Encoding.GetEncoding("ISO-8859-1");
public FormUrlEncodedContent(IEnumerable<KeyValuePair<string, string>> nameValueCollection)
: base(GetContentByteArray(nameValueCollection))
{
Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
}
private static byte[] GetContentByteArray(IEnumerable<KeyValuePair<string, string>> nameValueCollection)
{
if (nameValueCollection == null) throw new ArgumentNullException(nameof(nameValueCollection));
var stringBuilder = new StringBuilder();
foreach (var keyValuePair in nameValueCollection)
{
if (stringBuilder.Length > 0)
stringBuilder.Append('&');
stringBuilder.Append(Encode(keyValuePair.Key));
stringBuilder.Append('=');
stringBuilder.Append(Encode(keyValuePair.Value));
}
return DefaultHttpEncoding.GetBytes(stringBuilder.ToString());
}
private static string Encode(string data)
{
if (string.IsNullOrEmpty(data))
return "";
return EscapeLongDataString(data);
}
private static string EscapeLongDataString(string data)
{
// Uri.EscapeDataString() does not support strings longer than this
const int maxLength = 65519;
var sb = new StringBuilder();
var iterationsNeeded = data.Length / maxLength;
for (var i = 0; i <= iterationsNeeded; i++)
{
sb.Append(i < iterationsNeeded
? Uri.EscapeDataString(data.Substring(maxLength * i, maxLength))
: Uri.EscapeDataString(data.Substring(maxLength * i)));
}
return sb.ToString().Replace("%20", "+");
}
}
}
| using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
namespace PinSharp.Http
{
internal class FormUrlEncodedContent : ByteArrayContent
{
private static readonly Encoding DefaultHttpEncoding = Encoding.GetEncoding("ISO-8859-1");
public FormUrlEncodedContent(IEnumerable<KeyValuePair<string, string>> nameValueCollection)
: base(GetContentByteArray(nameValueCollection))
{
Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
}
private static byte[] GetContentByteArray(IEnumerable<KeyValuePair<string, string>> nameValueCollection)
{
if (nameValueCollection == null) throw new ArgumentNullException(nameof(nameValueCollection));
var stringBuilder = new StringBuilder();
foreach (var keyValuePair in nameValueCollection)
{
if (stringBuilder.Length > 0)
stringBuilder.Append('&');
stringBuilder.Append(Encode(keyValuePair.Key));
stringBuilder.Append('=');
stringBuilder.Append(Encode(keyValuePair.Value));
}
return DefaultHttpEncoding.GetBytes(stringBuilder.ToString());
}
private static string Encode(string data)
{
return string.IsNullOrEmpty(data) ? "" : Uri.EscapeDataString(data).Replace("%20", "+");
}
}
}
| unlicense | C# |
0da94b7acdd49b826fd52d687ea4c8976717849c | move init to startup | secondsun/PointingHenry10,secondsun/PointingHenry10 | PointingHenry10/Views/MainPage.xaml.cs | PointingHenry10/Views/MainPage.xaml.cs | using System;
using PointingHenry10.ViewModels;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using System.Collections.ObjectModel;
using FHSDK;
namespace PointingHenry10.Views
{
public sealed partial class MainPage : Page
{
public MainPage()
{
InitializeComponent();
NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
}
private void CreateSession_Click(object sender, RoutedEventArgs e)
{
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
await FHClient.Init();
}
}
}
| using System;
using PointingHenry10.ViewModels;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using System.Collections.ObjectModel;
namespace PointingHenry10.Views
{
public sealed partial class MainPage : Page
{
public MainPage()
{
InitializeComponent();
NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
}
private void CreateSession_Click(object sender, RoutedEventArgs e)
{
}
}
}
| apache-2.0 | C# |
5d759114ca8a3a7430f3fdfce410b60fad201a33 | Use ?? null-coalescing operator, throw immediately if method argument is null | stevenvolckaert/enterprise-library | src/StevenVolckaert.Core/ObjectExtensions.cs | src/StevenVolckaert.Core/ObjectExtensions.cs | namespace StevenVolckaert
{
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
/// <summary>
/// Provides extension methods for <see cref="object"/> instances.
/// </summary>
public static class ObjectExtensions
{
/// <summary>
/// Casts the object as a <see cref="List{T}"/> of the specified type.
/// </summary>
/// <typeparam name="TResult">
/// The type to cast the elements of <paramref name="source"/> to.
/// </typeparam>
/// <param name="source">
/// The <see cref="object"/> that needs to be casted to a <see cref="List{T}"/> of the specified
/// type.
/// </param>
/// <returns>
/// A <see cref="List{T}"/> that contains each element of the <paramref name="source"/>
/// sequence cast to the specified type.
/// </returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="source"/> is <c>null</c>.
/// </exception>
/// <exception cref="InvalidCastException">
/// An element in the sequence cannot be cast to the type <typeparamref name="TResult"/>.
/// </exception>
[SuppressMessage(
"Microsoft.Design",
"CA1002:DoNotExposeGenericLists",
Justification = "Method is provided for convenience."
)]
public static List<TResult> AsList<TResult>(this object source)
{
if (source is null)
throw new ArgumentNullException(nameof(source));
return source as List<TResult> ?? ((List<object>)source).Cast<TResult>().ToList();
}
}
}
| namespace StevenVolckaert
{
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
/// <summary>
/// Provides extension methods for <see cref="object"/> instances.
/// </summary>
public static class ObjectExtensions
{
/// <summary>
/// Casts the object as a <see cref="List{T}"/> of the specified type.
/// </summary>
/// <typeparam name="TResult">
/// The type to cast the elements of <paramref name="source"/> to.
/// </typeparam>
/// <param name="source">
/// The <see cref="object"/> that needs to be casted to a <see cref="List{T}"/> of the specified
/// type.
/// </param>
/// <returns>
/// A <see cref="List{T}"/> that contains each element of the <paramref name="source"/>
/// sequence cast to the specified type.
/// </returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="source"/> is <c>null</c>.
/// </exception>
/// <exception cref="InvalidCastException">
/// An element in the sequence cannot be cast to the type <typeparamref name="TResult"/>.
/// </exception>
[SuppressMessage(
"Microsoft.Design",
"CA1002:DoNotExposeGenericLists",
Justification = "Method is provided for convenience."
)]
public static List<TResult> AsList<TResult>(this object source)
{
var result = source as List<TResult>;
return result == null
? ((List<object>)source).Cast<TResult>().ToList()
: result;
}
}
}
| mit | C# |
aa6538fba89c63a93eb4edd026fe366ceb0401df | Increment build number to match NuGet | jcvandan/XeroAPI.Net,TDaphneB/XeroAPI.Net,MatthewSteeples/XeroAPI.Net,XeroAPI/XeroAPI.Net | source/XeroApi/Properties/AssemblyInfo.cs | source/XeroApi/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XeroApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Xero")]
[assembly: AssemblyProduct("XeroApi")]
[assembly: AssemblyCopyright("Copyright © Xero 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.1")]
[assembly: AssemblyFileVersion("1.1.0.1")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XeroApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Xero")]
[assembly: AssemblyProduct("XeroApi")]
[assembly: AssemblyCopyright("Copyright © Xero 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
| mit | C# |
fb8c1498096c98857dade840d56f4d7e51d166ea | Fix invalid JSON. | deltaDNA/unity-sdk,deltaDNA/unity-sdk | Assets/DeltaDNAAds/Platforms/Android/AdServiceListener.cs | Assets/DeltaDNAAds/Platforms/Android/AdServiceListener.cs | namespace DeltaDNAAds.Android
{
#if UNITY_ANDROID
internal class AdServiceListener : UnityEngine.AndroidJavaProxy {
private DDNASmartAds ads;
internal AdServiceListener(DDNASmartAds ads)
: base(Utils.AdServiceListenerClassName)
{
this.ads = ads;
}
void onRegisteredForAds() {
ads.DidRegisterForInterstitialAds();
}
void onRegisteredForRewardedAds() {
ads.DidRegisterForRewardedAds();
}
void onFailedToRegisterForAds(string reason) {
ads.DidFailToRegisterForInterstitialAds(reason);
}
void onFailedToRegisterForRewardedAds(string reason) {
ads.DidFailToRegisterForRewardedAds(reason);
}
void onAdOpened() {
ads.DidOpenInterstitialAd();
}
void onAdFailedToOpen() {
ads.DidFailToOpenInterstitialAd();
}
void onAdClosed() {
ads.DidCloseInterstitialAd();
}
void onRewardedAdOpened() {
ads.DidOpenRewardedAd();
}
void onRewardedAdFailedToOpen() {
ads.DidFailToOpenRewardedAd();
}
void onRewardedAdClosed(bool completed) {
string reward = completed ? "true" : "false";
ads.DidCloseRewardedAd("{\"reward\":"+reward+"}");
}
void onRecordEvent(string eventName, string eventParamsJson) {
ads.RecordEvent("{\"eventName\":\""+eventName+"\",\"parameters\":"+eventParamsJson+"}");
}
string toString() {
return "AdListener";
}
}
#endif
}
| namespace DeltaDNAAds.Android
{
#if UNITY_ANDROID
internal class AdServiceListener : UnityEngine.AndroidJavaProxy {
private DDNASmartAds ads;
internal AdServiceListener(DDNASmartAds ads)
: base(Utils.AdServiceListenerClassName)
{
this.ads = ads;
}
void onRegisteredForAds() {
ads.DidRegisterForInterstitialAds();
}
void onRegisteredForRewardedAds() {
ads.DidRegisterForRewardedAds();
}
void onFailedToRegisterForAds(string reason) {
ads.DidFailToRegisterForInterstitialAds(reason);
}
void onFailedToRegisterForRewardedAds(string reason) {
ads.DidFailToRegisterForRewardedAds(reason);
}
void onAdOpened() {
ads.DidOpenInterstitialAd();
}
void onAdFailedToOpen() {
ads.DidFailToOpenInterstitialAd();
}
void onAdClosed() {
ads.DidCloseInterstitialAd();
}
void onRewardedAdOpened() {
ads.DidOpenRewardedAd();
}
void onRewardedAdFailedToOpen() {
ads.DidFailToOpenRewardedAd();
}
void onRewardedAdClosed(bool completed) {
ads.DidCloseRewardedAd("{reward:"+completed+"}");
}
void onRecordEvent(string eventName, string eventParamsJson) {
ads.RecordEvent("{eventName:"+eventName+",parameters:"+eventParamsJson+"}");
}
string toString() {
return "AdListener";
}
}
#endif
} | apache-2.0 | C# |
1c2d0ca33fe2b1dcf7f1580a89380774ae25ab16 | Fix test referring to wrong value | ericgreenmix/marten,ericgreenmix/marten,ericgreenmix/marten,ericgreenmix/marten | src/DocumentDbTests/Bugs/Bug_2211_select_transform_inner_object.cs | src/DocumentDbTests/Bugs/Bug_2211_select_transform_inner_object.cs | using System;
using System.Linq;
using System.Threading.Tasks;
using Bug2211;
using Marten;
using Marten.Testing.Harness;
using Shouldly;
using Weasel.Core;
using Xunit;
namespace DocumentDbTests.Bugs
{
public class Bug_2211_select_transform_inner_object: BugIntegrationContext
{
[Fact]
public async Task should_be_able_to_select_nested_objects()
{
using var documentStore = SeparateStore(x =>
{
x.AutoCreateSchemaObjects = AutoCreate.All;
x.Schema.For<TestEntity>();
});
await documentStore.Advanced.Clean.DeleteAllDocumentsAsync();
await using var session = documentStore.OpenSession();
var testEntity = new TestEntity { Name = "Test", Inner = new TestDto { Name = "TestDto" } };
session.Store(testEntity);
await session.SaveChangesAsync();
await using var querySession = documentStore.QuerySession();
var results = await querySession.Query<TestEntity>()
.Select(x => new { Inner = x.Inner })
.ToListAsync();
results.Count.ShouldBe(1);
results[0].Inner.Name.ShouldBe(testEntity.Inner.Name);
}
}
}
namespace Bug2211
{
public class TestEntity
{
public Guid Id { get; set; }
public string Name { get; set; }
public TestDto Inner { get; set; }
}
public class TestDto
{
public string Name { get; set; }
}
}
| using System;
using System.Linq;
using System.Threading.Tasks;
using Bug2211;
using Marten;
using Marten.Testing.Harness;
using Shouldly;
using Weasel.Core;
using Xunit;
namespace DocumentDbTests.Bugs
{
public class Bug_2211_select_transform_inner_object: BugIntegrationContext
{
[Fact]
public async Task should_be_able_to_select_nested_objects()
{
using var documentStore = SeparateStore(x =>
{
x.AutoCreateSchemaObjects = AutoCreate.All;
x.Schema.For<TestEntity>();
});
await documentStore.Advanced.Clean.DeleteAllDocumentsAsync();
await using var session = documentStore.OpenSession();
session.Store(new TestEntity { Name = "Test", Inner = new TestDto { Name = "TestDto" } });
await session.SaveChangesAsync();
await using var querySession = documentStore.QuerySession();
var results = await querySession.Query<TestEntity>()
.Select(x => new { Inner = x.Inner })
.ToListAsync();
results.Count.ShouldBe(1);
results[0].Inner.Name.ShouldBe("Test Dto");
}
}
}
namespace Bug2211
{
public class TestEntity
{
public Guid Id { get; set; }
public string Name { get; set; }
public TestDto Inner { get; set; }
}
public class TestDto
{
public string Name { get; set; }
}
}
| mit | C# |
767a40e9c1c07fbeac819b34b0fa9716ee9c74d2 | Change serialize/deserialze abstract class to interface | insthync/LiteNetLibManager,insthync/LiteNetLibManager | Scripts/GameApi/Messages/ServerSpawnSceneObjectMessage.cs | Scripts/GameApi/Messages/ServerSpawnSceneObjectMessage.cs | using System.Collections;
using System.Collections.Generic;
using LiteNetLib.Utils;
using UnityEngine;
namespace LiteNetLibHighLevel
{
public class ServerSpawnSceneObjectMessage : ILiteNetLibMessage
{
public uint objectId;
public Vector3 position;
public void Deserialize(NetDataReader reader)
{
objectId = reader.GetUInt();
position = new Vector3(reader.GetFloat(), reader.GetFloat(), reader.GetFloat());
}
public void Serialize(NetDataWriter writer)
{
writer.Put(objectId);
writer.Put(position.x);
writer.Put(position.y);
writer.Put(position.z);
}
}
}
| using System.Collections;
using System.Collections.Generic;
using LiteNetLib.Utils;
using UnityEngine;
namespace LiteNetLibHighLevel
{
public class ServerSpawnSceneObjectMessage : LiteNetLibMessageBase
{
public uint objectId;
public Vector3 position;
public override void Deserialize(NetDataReader reader)
{
objectId = reader.GetUInt();
position = new Vector3(reader.GetFloat(), reader.GetFloat(), reader.GetFloat());
}
public override void Serialize(NetDataWriter writer)
{
writer.Put(objectId);
writer.Put(position.x);
writer.Put(position.y);
writer.Put(position.z);
}
}
}
| mit | C# |
fd9b9b43878728173a297d615a59e8b35db917f3 | Set correct version number, v0.1.1 | UmbrellaInc/FalconSharp,UmbrellaInc/FalconSharp | src/FalconSharp/Properties/VersionInfo.cs | src/FalconSharp/Properties/VersionInfo.cs | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18449
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyVersion("1.0.*")]
[assembly: System.Reflection.AssemblyInformationalVersion("0.1.1")]
| //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18449
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyVersion("1.0.*")]
[assembly: System.Reflection.AssemblyInformationalVersion("0.1.2")]
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.