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 |
---|---|---|---|---|---|---|---|---|
b7ce0293a1815b63e26c9dac4e0639b946c6becc | Remove duplicate diagnostics | ravimeda/cli,svick/cli,dasMulli/cli,harshjain2/cli,Faizan2304/cli,ravimeda/cli,livarcocc/cli-1,johnbeisner/cli,johnbeisner/cli,EdwardBlair/cli,dasMulli/cli,harshjain2/cli,svick/cli,ravimeda/cli,livarcocc/cli-1,livarcocc/cli-1,EdwardBlair/cli,blackdwarf/cli,Faizan2304/cli,harshjain2/cli,johnbeisner/cli,Faizan2304/cli,dasMulli/cli,EdwardBlair/cli,svick/cli,blackdwarf/cli,blackdwarf/cli,blackdwarf/cli | test/Microsoft.DotNet.Tools.Tests.Utilities/DotnetUnderTest.cs | test/Microsoft.DotNet.Tools.Tests.Utilities/DotnetUnderTest.cs | // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public static class DotnetUnderTest
{
static string _pathToDotnetUnderTest;
public static string FullName
{
get
{
if (_pathToDotnetUnderTest == null)
{
_pathToDotnetUnderTest = new Muxer().MuxerPath;
}
return _pathToDotnetUnderTest;
}
}
}
}
| // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public static class DotnetUnderTest
{
static string _pathToDotnetUnderTest;
public static string FullName
{
get
{
if (_pathToDotnetUnderTest == null)
{
_pathToDotnetUnderTest = new Muxer().MuxerPath;
}
Console.WriteLine($"Executing tests against {_pathToDotnetUnderTest}");
return _pathToDotnetUnderTest;
}
}
}
}
| mit | C# |
096d78cef104e0c86c48065b348801ea9053b20e | Implement UnitTest for AddExpensePageViewModel#Categories. | ProjectBlueMonkey/BlueMonkey,ProjectBlueMonkey/BlueMonkey | client/BlueMonkey/BlueMonkey.ViewModel.Tests/AddExpensePageViewModelTest.cs | client/BlueMonkey/BlueMonkey.ViewModel.Tests/AddExpensePageViewModelTest.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using BlueMonkey.Business;
using BlueMonkey.Model;
using BlueMonkey.ViewModels;
using Moq;
using Prism.Navigation;
using Xunit;
namespace BlueMonkey.ViewModel.Tests
{
public class AddExpensePageViewModelTest
{
[Fact]
public void Expense()
{
var navigationService = new Mock<INavigationService>();
var editExpense = new Mock<IEditExpense>();
var actual = new AddExpensePageViewModel(navigationService.Object, editExpense.Object);
Assert.NotNull(actual.Expense);
Assert.Null(actual.Expense.Value);
var expense = new Expense();
editExpense.Setup(x => x.Expense).Returns(expense);
editExpense.Raise(m => m.PropertyChanged += null, new PropertyChangedEventArgs("Expense"));
Assert.Equal(expense, actual.Expense.Value);
}
[Fact]
public void Categories()
{
var navigationService = new Mock<INavigationService>();
var editExpense = new Mock<IEditExpense>();
var actual = new AddExpensePageViewModel(navigationService.Object, editExpense.Object);
Assert.NotNull(actual.Categories);
Assert.NotNull(actual.Categories.Value);
Assert.Equal(0, actual.Categories.Value.Count());
var categories = new [] { new Category {Name = "category1"}, new Category { Name = "category2" } };
editExpense.Setup(x => x.Categories).Returns(categories);
editExpense.Raise(m => m.PropertyChanged += null, new PropertyChangedEventArgs("Categories"));
var actualCategory = actual.Categories.Value?.ToList();
Assert.NotNull(actualCategory);
Assert.Equal(2, actualCategory.Count);
Assert.Equal("category1", actualCategory[0]);
Assert.Equal("category2", actualCategory[1]);
}
}
} | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using BlueMonkey.Business;
using BlueMonkey.Model;
using BlueMonkey.ViewModels;
using Moq;
using Prism.Navigation;
using Xunit;
namespace BlueMonkey.ViewModel.Tests
{
public class AddExpensePageViewModelTest
{
[Fact]
public void Expense()
{
var navigationService = new Mock<INavigationService>();
var editExpense = new Mock<IEditExpense>();
var actual = new AddExpensePageViewModel(navigationService.Object, editExpense.Object);
Assert.NotNull(actual.Expense);
Assert.Null(actual.Expense.Value);
var expense = new Expense();
editExpense.Setup(x => x.Expense).Returns(expense);
editExpense.Raise(m => m.PropertyChanged += null, new PropertyChangedEventArgs("Expense"));
Assert.Equal(expense, actual.Expense.Value);
}
}
} | mit | C# |
ccac62edae574123264887094a8e65df571aef91 | Fix for parsing floats in cultures with decimal separator different than dot. | mausch/SolrNet,vladen/SolrNet,tombeany/SolrNet,vladen/SolrNet,tombeany/SolrNet,vyzvam/SolrNet,erandr/SolrNet,drakeh/SolrNet,Laoujin/SolrNet,18098924759/SolrNet,18098924759/SolrNet,drakeh/SolrNet,Laoujin/SolrNet,SolrNet/SolrNet,MetSystem/SolrNet,vladen/SolrNet,drakeh/SolrNet,doss78/SolrNet,erandr/SolrNet,doss78/SolrNet,chang892886597/SolrNet,vmanral/SolrNet,18098924759/SolrNet,vyzvam/SolrNet,tombeany/SolrNet,MetSystem/SolrNet,vmanral/SolrNet,mausch/SolrNet,vyzvam/SolrNet,chang892886597/SolrNet,yonglehou/SolrNet,mausch/SolrNet,chang892886597/SolrNet,yonglehou/SolrNet,Laoujin/SolrNet,vladen/SolrNet,erandr/SolrNet,erandr/SolrNet,yonglehou/SolrNet,doss78/SolrNet,SolrNet/SolrNet,vmanral/SolrNet,MetSystem/SolrNet | SolrNet/Impl/ResponseParsers/InterestingTermsResponseParser.cs | SolrNet/Impl/ResponseParsers/InterestingTermsResponseParser.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Globalization;
namespace SolrNet.Impl.ResponseParsers
{
public class InterestingTermsResponseParser<T> : ISolrAbstractResponseParser<T>, ISolrMoreLikeThisHandlerResponseParser<T>
{
private static Func<XElement, KeyValuePair<string, float>> extractList =
x => new KeyValuePair<string, float>(x.Value.Trim(), 0.0f);
private static Func<XElement, KeyValuePair<string, float>> extractDetails =
x => new KeyValuePair<string, float>((string)x.Attribute("name"), float.Parse(x.Value, CultureInfo.InvariantCulture.NumberFormat));
public void Parse(System.Xml.Linq.XDocument xml, IAbstractSolrQueryResults<T> results)
{
if (results is IMoreLikeThisQueryResults<T>)
{
this.Parse(xml, (IMoreLikeThisQueryResults<T>)results);
}
}
public void Parse(System.Xml.Linq.XDocument xml, IMoreLikeThisQueryResults<T> results)
{
Func<XElement, KeyValuePair<string, float>> extract;
var it = xml.Element("response").Elements("arr").FirstOrDefault(e => (string)e.Attribute("name") == "interestingTerms");
if (it == null)
{
it = xml.Element("response").Elements("lst").FirstOrDefault(e => (string)e.Attribute("name") == "interestingTerms");
if (it == null)
{
return;
}
extract = extractDetails;
}
else
{
extract = extractList;
}
results.InterestingTerms = it.Elements().Select(x => extract(x)).ToList();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace SolrNet.Impl.ResponseParsers
{
public class InterestingTermsResponseParser<T> : ISolrAbstractResponseParser<T>, ISolrMoreLikeThisHandlerResponseParser<T>
{
private static Func<XElement, KeyValuePair<string, float>> extractList =
x => new KeyValuePair<string, float>(x.Value.Trim(), 0.0f);
private static Func<XElement, KeyValuePair<string, float>> extractDetails =
x => new KeyValuePair<string, float>((string)x.Attribute("name"), float.Parse(x.Value));
public void Parse(System.Xml.Linq.XDocument xml, IAbstractSolrQueryResults<T> results)
{
if (results is IMoreLikeThisQueryResults<T>)
{
this.Parse(xml, (IMoreLikeThisQueryResults<T>)results);
}
}
public void Parse(System.Xml.Linq.XDocument xml, IMoreLikeThisQueryResults<T> results)
{
Func<XElement, KeyValuePair<string, float>> extract;
var it = xml.Element("response").Elements("arr").FirstOrDefault(e => (string)e.Attribute("name") == "interestingTerms");
if (it == null)
{
it = xml.Element("response").Elements("lst").FirstOrDefault(e => (string)e.Attribute("name") == "interestingTerms");
if (it == null)
{
return;
}
extract = extractDetails;
}
else
{
extract = extractList;
}
results.InterestingTerms = it.Elements().Select(x => extract(x)).ToList();
}
}
}
| apache-2.0 | C# |
904edaf716cec421e210311a3b42b0cc1e2f693c | Update WithAutoProperties.cs | Fody/PropertyChanged | Tests/IlGeneratedByDependencyReaderTests/WithAutoProperties.cs | Tests/IlGeneratedByDependencyReaderTests/WithAutoProperties.cs | using System.Linq;
using Xunit;
public class WithAutoProperties
{
//TODO: add test for abstract
[Fact]
public void Run()
{
var typeDefinition = DefinitionFinder.FindType<Person>();
var node = new TypeNode
{
TypeDefinition = typeDefinition,
Mappings = ModuleWeaver.GetMappings(typeDefinition).ToList()
};
new IlGeneratedByDependencyReader(node).Process();
Assert.Equal(2, node.PropertyDependencies.Count);
var first = node.PropertyDependencies[0];
Assert.Equal("FullName", first.ShouldAlsoNotifyFor.Name);
Assert.Equal("GivenNames", first.WhenPropertyIsSet.Name);
var second = node.PropertyDependencies[1];
Assert.Equal("FullName", second.ShouldAlsoNotifyFor.Name);
Assert.Equal("FamilyName", second.WhenPropertyIsSet.Name);
}
public class Person
{
public string GivenNames { get; set; }
public string FamilyName { get; set; }
public string FullName => $"{GivenNames} {FamilyName}";
}
} | using System.Linq;
using Xunit;
public class WithAutoProperties
{
//TODO: add test for abstract
[Fact]
public void Run()
{
var typeDefinition = DefinitionFinder.FindType<Person>();
var node = new TypeNode
{
TypeDefinition = typeDefinition,
Mappings = ModuleWeaver.GetMappings(typeDefinition).ToList()
};
new IlGeneratedByDependencyReader(node).Process();
Assert.Equal(2, node.PropertyDependencies.Count);
var first = node.PropertyDependencies[0];
Assert.Equal("FullName", first.ShouldAlsoNotifyFor.Name);
Assert.Equal("GivenNames", first.WhenPropertyIsSet.Name);
var second = node.PropertyDependencies[1];
Assert.Equal("FullName", second.ShouldAlsoNotifyFor.Name);
Assert.Equal("FamilyName", second.WhenPropertyIsSet.Name);
}
public class Person
{
public string GivenNames { get; set; }
public string FamilyName { get; set; }
public string FullName => $"{GivenNames} {FamilyName}";
}
} | mit | C# |
44d2fa6e9effd58b495c1b758696d50c423aaa6b | Improve code. | Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW | src/MitternachtBot/Modules/Games/Common/Hangman/TermPool.cs | src/MitternachtBot/Modules/Games/Common/Hangman/TermPool.cs | using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using Mitternacht.Common;
using Mitternacht.Modules.Games.Common.Hangman.Exceptions;
using Newtonsoft.Json;
namespace Mitternacht.Modules.Games.Common.Hangman {
public class TermPool {
const string termsPath = "data/word_images.json";
public static IReadOnlyDictionary<string, HangmanObject[]> Data { get; } = new Dictionary<string, HangmanObject[]>();
static TermPool() {
try {
Data = JsonConvert.DeserializeObject<Dictionary<string, HangmanObject[]>>(File.ReadAllText(termsPath));
} catch { }
}
private static readonly ImmutableArray<TermType> _termTypes = Enum.GetValues(typeof(TermType)).Cast<TermType>().ToImmutableArray();
public static HangmanObject GetTerm(TermType type) {
var rng = new NadekoRandom();
if(type == TermType.Random) {
type = _termTypes[rng.Next(0, _termTypes.Length - 1)];
}
return Data.TryGetValue(type.ToString(), out var termTypes) && termTypes.Length != 0
? termTypes[rng.Next(0, termTypes.Length)]
: throw new TermNotFoundException(type);
}
}
} | using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using Mitternacht.Common;
using Mitternacht.Modules.Games.Common.Hangman.Exceptions;
using Newtonsoft.Json;
namespace Mitternacht.Modules.Games.Common.Hangman {
public class TermPool {
const string termsPath = "data/word_images.json";
public static IReadOnlyDictionary<string, HangmanObject[]> Data { get; } = new Dictionary<string, HangmanObject[]>();
static TermPool() {
try {
Data = JsonConvert.DeserializeObject<Dictionary<string, HangmanObject[]>>(File.ReadAllText(termsPath));
} catch { }
}
private static readonly ImmutableArray<TermType> _termTypes = Enum.GetValues(typeof(TermType)).Cast<TermType>().ToImmutableArray();
public static HangmanObject GetTerm(TermType type) {
var rng = new NadekoRandom();
if(type == TermType.Random) {
type = _termTypes[rng.Next(0, _termTypes.Length - 1)];
}
if(Data.TryGetValue(type.ToString(), out var termTypes) && termTypes.Length != 0) {
var obj = termTypes[rng.Next(0, termTypes.Length)];
obj.Word = obj.Word.Trim().ToLowerInvariant();
return obj;
} else {
throw new TermNotFoundException(type);
}
}
}
} | mit | C# |
9ec5be3017eedcac40c52d85003f5232e858911d | Fix casting error in WhenAny shim | rzhw/Squirrel.Windows,rzhw/Squirrel.Windows | src/Squirrel.Core/ReactiveUIMicro/ReactiveUI/WhenAnyShim.cs | src/Squirrel.Core/ReactiveUIMicro/ReactiveUI/WhenAnyShim.cs | using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Windows;
namespace ReactiveUIMicro
{
public static class WhenAnyShim
{
public static IObservable<TVal> WhenAny<TSender, TTarget, TVal>(this TSender This, Expression<Func<TSender, TTarget>> property, Func<IObservedChange<TSender, TTarget>, TVal> selector)
where TSender : IReactiveNotifyPropertyChanged
{
var propName = Reflection.SimpleExpressionToPropertyName(property);
var getter = Reflection.GetValueFetcherForProperty(This.GetType(), propName);
return This.Changed
.Where(x => x.PropertyName == propName)
.Select(_ => new ObservedChange<TSender, TTarget>() {
Sender = This,
PropertyName = propName,
Value = (TTarget)getter(This),
})
.StartWith(new ObservedChange<TSender, TTarget>() { Sender = This, PropertyName = propName, Value = (TTarget)getter(This) })
.Select(selector);
}
}
} | using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Windows;
namespace ReactiveUIMicro
{
public static class WhenAnyShim
{
public static IObservable<TVal> WhenAny<TSender, TTarget, TVal>(this TSender This, Expression<Func<TSender, TTarget>> property, Func<IObservedChange<TSender, TTarget>, TVal> selector)
where TSender : IReactiveNotifyPropertyChanged
{
var propName = Reflection.SimpleExpressionToPropertyName(property);
var getter = Reflection.GetValueFetcherForProperty<TSender>(propName);
return This.Changed
.Where(x => x.PropertyName == propName)
.Select(_ => new ObservedChange<TSender, TTarget>() {
Sender = This,
PropertyName = propName,
Value = (TTarget)getter(This),
})
.StartWith(new ObservedChange<TSender, TTarget>() { Sender = This, PropertyName = propName, Value = (TTarget)getter(This) })
.Select(selector);
}
}
} | mit | C# |
9b9d5c17d84327b60e144bc82edb1f83f146ed2e | Add support for nested properties access in GetElementAttribute command using dot separated syntax | 2gis/Winium.StoreApps,krishachetan89/Winium.StoreApps,NetlifeBackupSolutions/Winium.StoreApps,goldbillka/Winium.StoreApps,NetlifeBackupSolutions/Winium.StoreApps,goldbillka/Winium.StoreApps,2gis/Winium.StoreApps,krishachetan89/Winium.StoreApps | WindowsUniversalAppDriver/WindowsUniversalAppDriver.InnerServer/Commands/GetElementAttributeCommand.cs | WindowsUniversalAppDriver/WindowsUniversalAppDriver.InnerServer/Commands/GetElementAttributeCommand.cs | namespace WindowsUniversalAppDriver.InnerServer.Commands
{
using System;
using System.Reflection;
using WindowsUniversalAppDriver.Common;
internal class GetElementAttributeCommand : CommandBase
{
#region Public Properties
public string ElementId { get; set; }
#endregion
#region Public Methods and Operators
public override string DoImpl()
{
var element = this.Automator.WebElements.GetRegisteredElement(this.ElementId);
object value;
string attributeName = null;
if (this.Parameters.TryGetValue("NAME", out value))
{
attributeName = value.ToString();
}
if (attributeName == null)
{
return this.JsonResponse(ResponseStatus.Success, null);
}
var properties = attributeName.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
object propertyValueObject = element;
foreach (var property in properties)
{
propertyValueObject = GetProperty(propertyValueObject, property);
if (propertyValueObject == null)
{
break;
}
}
var propertyValue = propertyValueObject == null ? null : propertyValueObject.ToString();
return this.JsonResponse(ResponseStatus.Success, propertyValue);
}
private static object GetProperty(object obj, string propertyName)
{
var property = obj.GetType().GetRuntimeProperty(propertyName);
return property == null ? null : property.GetValue(obj, null);
}
#endregion
}
}
| namespace WindowsUniversalAppDriver.InnerServer.Commands
{
using System.Reflection;
using WindowsUniversalAppDriver.Common;
internal class GetElementAttributeCommand : CommandBase
{
#region Public Properties
public string ElementId { get; set; }
#endregion
#region Public Methods and Operators
public override string DoImpl()
{
var element = this.Automator.WebElements.GetRegisteredElement(this.ElementId);
object value;
var attributeName = (string)null;
if (this.Parameters.TryGetValue("NAME", out value))
{
attributeName = value.ToString();
}
if (attributeName == null)
{
return this.JsonResponse(ResponseStatus.Success, null);
}
var property = element.GetType().GetRuntimeProperty(attributeName);
if (property == null)
{
return this.JsonResponse(ResponseStatus.Success, null);
}
var attributeValue = property.GetValue(element, null).ToString();
return this.JsonResponse(ResponseStatus.Success, attributeValue);
}
#endregion
}
}
| mpl-2.0 | C# |
eb9feb6d6715f57fe3bcab9244b5ce640f818141 | Update OperationData.cs | ADAPT/ADAPT | source/ADAPT/LoggedData/OperationData.cs | source/ADAPT/LoggedData/OperationData.cs | /*******************************************************************************
* Copyright (C) 2015-16, 2018 AgGateway and ADAPT Contributors
* Copyright (C) 2015-16 Deere and Company
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* Tarak Reddy, Tim Shearouse - initial API and implementation
* Kathleen Oneal - removed implementConfigId and machineConfigId, added EquipmentConfigId
* Justin Sliekers - implement device element changes
* Joseph Ross - Added EquipmentConfigurationGroup
* Jason Roesbeke - added Description
* Kelly Nelson - Changed ProductId to allow for multiples
* Kelly Nelson - Added CoinicidentOperationDataIDs
* R. Andres Ferreyra - Added initialization of CoinicidentOperationDataIDs
*******************************************************************************/
using System;
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel.Common;
using AgGateway.ADAPT.ApplicationDataModel.Equipment;
namespace AgGateway.ADAPT.ApplicationDataModel.LoggedData
{
public class OperationData
{
public OperationData()
{
Id = CompoundIdentifierFactory.Instance.Create();
EquipmentConfigurationIds = new List<int>();
CoincidentOperationDataIds = new List<int>();
}
public CompoundIdentifier Id { get; private set; }
public int? LoadId { get; set; }
public OperationTypeEnum OperationType { get; set; }
public int? PrescriptionId { get; set; }
public List<int> ProductIds { get; set; }
public int? VarietyLocatorId { get; set; }
public int? WorkItemOperationId { get; set; }
public int MaxDepth { get; set; }
public int SpatialRecordCount { get; set; }
public List<int> EquipmentConfigurationIds { get; set; }
public Func<IEnumerable<SpatialRecord>> GetSpatialRecords { get; set; }
public Func<int, IEnumerable<DeviceElementUse>> GetDeviceElementUses { get; set; }
public string Description { get; set; }
public List<int> CoincidentOperationDataIds { get; set; }
}
}
| /*******************************************************************************
* Copyright (C) 2015-16 AgGateway and ADAPT Contributors
* Copyright (C) 2015-16 Deere and Company
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* Tarak Reddy, Tim Shearouse - initial API and implementation
* Kathleen Oneal - removed implementConfigId and machineConfigId, added EquipmentConfigId
* Justin Sliekers - implement device element changes
* Joseph Ross - Added EquipmentConfigurationGroup
* Jason Roesbeke - added Description
* Kelly Nelson - Changed ProductId to allow for multiples
* Kelly Nelson - Added CoinicidentOperationDataIDs
*******************************************************************************/
using System;
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel.Common;
using AgGateway.ADAPT.ApplicationDataModel.Equipment;
namespace AgGateway.ADAPT.ApplicationDataModel.LoggedData
{
public class OperationData
{
public OperationData()
{
Id = CompoundIdentifierFactory.Instance.Create();
EquipmentConfigurationIds = new List<int>();
}
public CompoundIdentifier Id { get; private set; }
public int? LoadId { get; set; }
public OperationTypeEnum OperationType { get; set; }
public int? PrescriptionId { get; set; }
public List<int> ProductIds { get; set; }
public int? VarietyLocatorId { get; set; }
public int? WorkItemOperationId { get; set; }
public int MaxDepth { get; set; }
public int SpatialRecordCount { get; set; }
public List<int> EquipmentConfigurationIds { get; set; }
public Func<IEnumerable<SpatialRecord>> GetSpatialRecords { get; set; }
public Func<int, IEnumerable<DeviceElementUse>> GetDeviceElementUses { get; set; }
public string Description { get; set; }
public List<int> CoincidentOperationDataIds { get; set; }
}
}
| epl-1.0 | C# |
9b5416365d8e0d8e5eeab81e64c6d596e4514838 | Refactor the ConditionalRenderer class. | andrewdavey/cassette,honestegg/cassette,andrewdavey/cassette,honestegg/cassette,BluewireTechnologies/cassette,BluewireTechnologies/cassette,honestegg/cassette,damiensawyer/cassette,damiensawyer/cassette,andrewdavey/cassette,damiensawyer/cassette | src/Cassette/ConditionalRenderer.cs | src/Cassette/ConditionalRenderer.cs | using System.Text;
using Cassette.Scripts;
namespace Cassette
{
/// <summary>
/// Renders conditional comments as described by http://www.quirksmode.org/css/condcom.html
/// </summary>
class ConditionalRenderer
{
StringBuilder html;
bool isNotIECondition;
public string RenderCondition(string condition, string content)
{
html = new StringBuilder();
isNotIECondition = ConditionContainsNotIE(condition);
StartComment(condition);
ContentWrappedInLineBreaks(content);
EndComment();
return html.ToString();
}
void StartComment(string condition)
{
html.AppendFormat(HtmlConstants.ConditionalCommentStart, condition);
if (isNotIECondition)
{
html.Append("<!-->");
}
}
void ContentWrappedInLineBreaks(string content)
{
html.AppendLine();
html.Append(content);
html.AppendLine();
}
void EndComment()
{
if (isNotIECondition)
{
html.Append("<!-- ");
}
html.Append(HtmlConstants.ConditionalCommentEnd);
}
/// <summary>
/// Check if the condition contains '!IE". Ignores any brackets or spaces.
/// </summary>
bool ConditionContainsNotIE(string condition)
{
return condition
.Replace(" ", "")
.Replace("(", "")
.Contains("!IE");
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cassette.Scripts;
namespace Cassette
{
public class ConditionalRenderer
{
public string RenderCondition(string condition, string content)
{
var html = new StringBuilder();
// Check if the condition contains !IE. Ignore any brackets or spaces
bool notIECondition = condition.Replace(" ", "").Replace("(", "").Contains("!IE");
// Append the start of the conditional, including a comment closer if !IE
html.AppendFormat(HtmlConstants.ConditionalCommentStart, condition);
if (notIECondition)
{
html.Append("<!-->");
}
html.AppendLine();
// Append the content
html.Append(content);
// Append the end of the conditional, starting with a comment opener if !IE
html.AppendLine();
if (notIECondition)
{
html.Append("<!-- ");
}
html.Append(HtmlConstants.ConditionalCommentEnd);
// Return the finished conditional
return html.ToString();
}
}
}
| mit | C# |
e71b13683a1189ae8fda808b2b2f22674e651900 | Add null check | EVAST9919/osu,peppy/osu,naoey/osu,DrabWeb/osu,peppy/osu-new,ZLima12/osu,ZLima12/osu,naoey/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,johnneijzen/osu,NeoAdonis/osu,2yangk23/osu,EVAST9919/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,DrabWeb/osu,DrabWeb/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,naoey/osu,peppy/osu,johnneijzen/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu | osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs | osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.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.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{
public class HitCirclePlacementBlueprint : PlacementBlueprint
{
public new HitCircle HitObject => (HitCircle)base.HitObject;
public HitCirclePlacementBlueprint()
: base(new HitCircle())
{
InternalChild = new HitCirclePiece(HitObject);
}
protected override void LoadComplete()
{
base.LoadComplete();
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position)?? Vector2.Zero;
}
protected override bool OnClick(ClickEvent e)
{
HitObject.StartTime = EditorClock.CurrentTime;
EndPlacement();
return true;
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
HitObject.Position = e.MousePosition;
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.
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{
public class HitCirclePlacementBlueprint : PlacementBlueprint
{
public new HitCircle HitObject => (HitCircle)base.HitObject;
public HitCirclePlacementBlueprint()
: base(new HitCircle())
{
InternalChild = new HitCirclePiece(HitObject);
}
protected override void LoadComplete()
{
base.LoadComplete();
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
HitObject.Position = Parent.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position);
}
protected override bool OnClick(ClickEvent e)
{
HitObject.StartTime = EditorClock.CurrentTime;
EndPlacement();
return true;
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
HitObject.Position = e.MousePosition;
return true;
}
}
}
| mit | C# |
15e78765308e42716332c4c737272e775509ebec | Fix incorrect argument ordering. | wieslawsoltes/Perspex,AvaloniaUI/Avalonia,akrisiun/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,grokys/Perspex,jkoritzinsky/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex | src/Avalonia.Controls/Repeater/ItemsRepeaterElementIndexChangedEventArgs.cs | src/Avalonia.Controls/Repeater/ItemsRepeaterElementIndexChangedEventArgs.cs | // This source file is adapted from the WinUI project.
// (https://github.com/microsoft/microsoft-ui-xaml)
//
// Licensed to The Avalonia Project under MIT License, courtesy of The .NET Foundation.
using System;
namespace Avalonia.Controls
{
/// <summary>
/// Provides data for the <see cref="ItemsRepeater.ElementIndexChanged"/> event.
/// </summary>
public class ItemsRepeaterElementIndexChangedEventArgs : EventArgs
{
internal ItemsRepeaterElementIndexChangedEventArgs(IControl element, int oldIndex, int newIndex)
{
Element = element;
OldIndex = oldIndex;
NewIndex = newIndex;
}
/// <summary>
/// Get the element for which the index changed.
/// </summary>
public IControl Element { get; private set; }
/// <summary>
/// Gets the index of the element after the change.
/// </summary>
public int NewIndex { get; private set; }
/// <summary>
/// Gets the index of the element before the change.
/// </summary>
public int OldIndex { get; private set; }
internal void Update(IControl element, int oldIndex, int newIndex)
{
Element = element;
NewIndex = newIndex;
OldIndex = oldIndex;
}
}
}
| // This source file is adapted from the WinUI project.
// (https://github.com/microsoft/microsoft-ui-xaml)
//
// Licensed to The Avalonia Project under MIT License, courtesy of The .NET Foundation.
using System;
namespace Avalonia.Controls
{
/// <summary>
/// Provides data for the <see cref="ItemsRepeater.ElementIndexChanged"/> event.
/// </summary>
public class ItemsRepeaterElementIndexChangedEventArgs : EventArgs
{
internal ItemsRepeaterElementIndexChangedEventArgs(IControl element, int oldIndex, int newIndex)
{
Element = element;
OldIndex = oldIndex;
NewIndex = newIndex;
}
/// <summary>
/// Get the element for which the index changed.
/// </summary>
public IControl Element { get; private set; }
/// <summary>
/// Gets the index of the element after the change.
/// </summary>
public int NewIndex { get; private set; }
/// <summary>
/// Gets the index of the element before the change.
/// </summary>
public int OldIndex { get; private set; }
internal void Update(IControl element, int newIndex, int oldIndex)
{
Element = element;
NewIndex = newIndex;
OldIndex = oldIndex;
}
}
}
| mit | C# |
52d7a425f651cbb6163f730378cbc9f2b9e2e34e | Fix version check condition. | Microsoft/PTVS,Microsoft/PTVS,zooba/PTVS,int19h/PTVS,huguesv/PTVS,Microsoft/PTVS,int19h/PTVS,Microsoft/PTVS,int19h/PTVS,huguesv/PTVS,zooba/PTVS,Microsoft/PTVS,Microsoft/PTVS,huguesv/PTVS,huguesv/PTVS,huguesv/PTVS,int19h/PTVS,zooba/PTVS,int19h/PTVS,int19h/PTVS,zooba/PTVS,huguesv/PTVS,zooba/PTVS,zooba/PTVS | Python/Product/VSInterpreters/PackageManager/CPythonPipPackageManagerProvider.cs | Python/Product/VSInterpreters/PackageManager/CPythonPipPackageManagerProvider.cs | // Python Tools for Visual Studio
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using Microsoft.PythonTools.Infrastructure;
namespace Microsoft.PythonTools.Interpreter {
[Export(typeof(IPackageManagerProvider))]
sealed class CPythonPipPackageManagerProvider : IPackageManagerProvider {
class PipCommandsV26 : PipPackageManagerCommands {
public override IEnumerable<string> Base() => new[] { "-c", ProcessOutput.QuoteSingleArgument("import pip; pip.main()") };
public override IEnumerable<string> Prepare() => new[] { PythonToolsInstallPath.GetFile("pip_downloader.py", typeof(PipPackageManager).Assembly) };
}
class PipCommandsV27AndLater : PipPackageManagerCommands {
public override IEnumerable<string> Prepare() => new[] { PythonToolsInstallPath.GetFile("pip_downloader.py", typeof(PipPackageManager).Assembly) };
}
private static readonly PipPackageManagerCommands CommandsV26 = new PipCommandsV26();
private static readonly PipPackageManagerCommands CommandsV27AndLater = new PipCommandsV27AndLater();
public IEnumerable<IPackageManager> GetPackageManagers(IPythonInterpreterFactory factory) {
IPackageManager pm = null;
try {
// 'python -m pip', causes this error on Python 2.6: pip is a package and cannot be directly executed
// We have to use 'python -m pip' on pip v10, because pip.main() no longer exists
// pip v10 is not supported on Python 2.6, so pip.main() is fine there
var cmds = factory.Configuration.Version > new Version(2, 6) ? CommandsV27AndLater : CommandsV26;
pm = new PipPackageManager(factory, cmds, 1000);
} catch (NotSupportedException) {
}
if (pm != null) {
yield return pm;
}
}
}
}
| // Python Tools for Visual Studio
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using Microsoft.PythonTools.Infrastructure;
namespace Microsoft.PythonTools.Interpreter {
[Export(typeof(IPackageManagerProvider))]
sealed class CPythonPipPackageManagerProvider : IPackageManagerProvider {
class PipCommandsV26 : PipPackageManagerCommands {
public override IEnumerable<string> Base() => new[] { "-c", ProcessOutput.QuoteSingleArgument("import pip; pip.main()") };
public override IEnumerable<string> Prepare() => new[] { PythonToolsInstallPath.GetFile("pip_downloader.py", typeof(PipPackageManager).Assembly) };
}
class PipCommandsV27AndLater : PipPackageManagerCommands {
public override IEnumerable<string> Prepare() => new[] { PythonToolsInstallPath.GetFile("pip_downloader.py", typeof(PipPackageManager).Assembly) };
}
private static readonly PipPackageManagerCommands CommandsV26 = new PipCommandsV26();
private static readonly PipPackageManagerCommands CommandsV27AndLater = new PipCommandsV27AndLater();
public IEnumerable<IPackageManager> GetPackageManagers(IPythonInterpreterFactory factory) {
IPackageManager pm = null;
try {
var cmds = factory.Configuration.Version >= new Version(2, 6) ? CommandsV27AndLater : CommandsV26;
pm = new PipPackageManager(factory, cmds, 1000);
} catch (NotSupportedException) {
}
if (pm != null) {
yield return pm;
}
}
}
}
| apache-2.0 | C# |
5268355310cd9c719d8a498c2247330253649e03 | Remove stray space in 404 page | StackExchange/StackExchange.DataExplorer,rschrieken/StackExchange.DataExplorer,jango2015/StackExchange.DataExplorer,rschrieken/StackExchange.DataExplorer,tms/StackExchange.DataExplorer,vebin/StackExchange.DataExplorer,gavioto/StackExchange.DataExplorer,vebin/StackExchange.DataExplorer,tms/StackExchange.DataExplorer,vebin/StackExchange.DataExplorer,rschrieken/StackExchange.DataExplorer,StackExchange/StackExchange.DataExplorer,gavioto/StackExchange.DataExplorer,gavioto/StackExchange.DataExplorer,StackExchange/StackExchange.DataExplorer,tms/StackExchange.DataExplorer,jango2015/StackExchange.DataExplorer,jango2015/StackExchange.DataExplorer | App/StackExchange.DataExplorer/Views/Shared/PageNotFound.cshtml | App/StackExchange.DataExplorer/Views/Shared/PageNotFound.cshtml | @using StackExchange.DataExplorer
@{this.SetPageTitle("Page not found - Stack Exchange Data Explorer");}
<div class="subheader">
<h2>Page Not Found</h2>
</div>
<div style="width:400px; float:left;">
<p>Sorry we could not find the page requested. However, we did find a picture of <a href="http://en.wikipedia.org/wiki/Edgar_F._Codd">Edgar F. Codd</a>, the inventor of the relational data model.</p>
<p>If you feel something is missing that should be here, <a href="http://meta.stackexchange.com/contact">contact us</a>.</p>
</div>
<img src="/Content/images/edgar.jpg" style="float:right;" />
<br class="clear" />
<p> </p>
| @using StackExchange.DataExplorer
@{this.SetPageTitle("Page not found - Stack Exchange Data Explorer");}
<div class="subheader">
<h2>Page Not Found</h2>
</div>
<div style="width:400px; float:left;">
<p>Sorry we could not find the page requested. However, we did find a picture of <a href="http://en.wikipedia.org/wiki/Edgar_F._Codd">Edgar F. Codd </a>, the inventor of the relational data model.</p>
<p>If you feel something is missing that should be here, <a href="http://meta.stackexchange.com/contact">contact us</a>.</p>
</div>
<img src="/Content/images/edgar.jpg" style="float:right;" />
<br class="clear" />
<p> </p> | mit | C# |
c547ccd47876026defd992a2b0a810138441ffc8 | Enable nullable: System.Management.Automation.Interpreter.ILightCallSiteBinder (#14156) | daxian-dbw/PowerShell,daxian-dbw/PowerShell,JamesWTruher/PowerShell-1,TravisEz13/PowerShell,PaulHigin/PowerShell,JamesWTruher/PowerShell-1,TravisEz13/PowerShell,TravisEz13/PowerShell,TravisEz13/PowerShell,JamesWTruher/PowerShell-1,PaulHigin/PowerShell,PaulHigin/PowerShell,daxian-dbw/PowerShell,PaulHigin/PowerShell,daxian-dbw/PowerShell,JamesWTruher/PowerShell-1 | src/System.Management.Automation/engine/interpreter/ILightCallSiteBinder.cs | src/System.Management.Automation/engine/interpreter/ILightCallSiteBinder.cs | /* ****************************************************************************
*
* Copyright (c) Microsoft Corporation.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0. A
* copy of the license can be found in the License.html file at the root of this distribution. If
* you cannot locate the Apache License, Version 2.0, please send an email to
* [email protected]. By using this source code in any fashion, you are agreeing to be bound
* by the terms of the Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*
*
* ***************************************************************************/
#nullable enable
#if !CLR2
#else
using Microsoft.Scripting.Ast;
#endif
namespace System.Management.Automation.Interpreter
{
internal interface ILightCallSiteBinder
{
bool AcceptsArgumentArray { get; }
}
}
| /* ****************************************************************************
*
* Copyright (c) Microsoft Corporation.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0. A
* copy of the license can be found in the License.html file at the root of this distribution. If
* you cannot locate the Apache License, Version 2.0, please send an email to
* [email protected]. By using this source code in any fashion, you are agreeing to be bound
* by the terms of the Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*
*
* ***************************************************************************/
#if !CLR2
#else
using Microsoft.Scripting.Ast;
#endif
namespace System.Management.Automation.Interpreter
{
internal interface ILightCallSiteBinder
{
bool AcceptsArgumentArray { get; }
}
}
| mit | C# |
e1a1b552e2e49098578c8f06d9cb058b12eeeaa8 | Order tasks by name on qual list page | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | BatteryCommander.Web/Views/Qualification/List.cshtml | BatteryCommander.Web/Views/Qualification/List.cshtml | @model IEnumerable<BatteryCommander.Common.Models.Qualification>
@using BatteryCommander.Common.Models;
@{
ViewBag.Title = "Qualifications";
}
<h2>@ViewBag.Title @Html.ActionLink("Add New", "New", null, new { @class = "btn btn-primary" })</h2>
<table class="table table-bordered">
<tr>
<th> @Html.DisplayNameFor(model => model.Name)</th>
<th> @Html.DisplayNameFor(model => model.Description)</th>
<th>GO</th>
<th>NOGO</th>
<th>UNKNOWN</th>
<th>Tasks</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.Name)</td>
<td>@Html.DisplayFor(modelItem => item.Description)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Pass)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Fail)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Unknown)</td>
<td>
@foreach (var task in item.Tasks.OrderBy(t => t.Name))
{
<li>@Html.DisplayFor(t => task)</li>
}
</td>
<td>
@Html.ActionLink("View", "View", new { qualificationId = item.Id }, new { @class = "btn btn-default" })
<a href="~/Qualification/@item.Id/Update" class="btn btn-warning">Bulk Update Soldiers</a>
</td>
</tr>
}
</table>
| @model IEnumerable<BatteryCommander.Common.Models.Qualification>
@using BatteryCommander.Common.Models;
@{
ViewBag.Title = "Qualifications";
}
<h2>@ViewBag.Title @Html.ActionLink("Add New", "New", null, new { @class = "btn btn-primary" })</h2>
<table class="table table-bordered">
<tr>
<th> @Html.DisplayNameFor(model => model.Name)</th>
<th> @Html.DisplayNameFor(model => model.Description)</th>
<th>GO</th>
<th>NOGO</th>
<th>UNKNOWN</th>
<th>Tasks</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.Name)</td>
<td>@Html.DisplayFor(modelItem => item.Description)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Pass)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Fail)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Unknown)</td>
<td>
@foreach (var task in item.Tasks)
{
<li>@Html.DisplayFor(t => task)</li>
}
</td>
<td>
@Html.ActionLink("View", "View", new { qualificationId = item.Id }, new { @class = "btn btn-default" })
<a href="~/Qualification/@item.Id/Update" class="btn btn-warning">Bulk Update Soldiers</a>
</td>
</tr>
}
</table>
| mit | C# |
584a27d153d54487b95498e05edd5c5ff0cbc2ac | Fix indenting | quartz-software/kephas,quartz-software/kephas | src/Kephas.Data/IDataOperationContext.cs | src/Kephas.Data/IDataOperationContext.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="IDataOperationContext.cs" company="Quartz Software SRL">
// Copyright (c) Quartz Software SRL. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// <summary>
// Declares the IDataOperationContext interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Kephas.Data
{
using Kephas.Services;
/// <summary>
/// Contract for data operations contexts.
/// </summary>
public interface IDataOperationContext : IContext
{
/// <summary>
/// Gets the dataContext.
/// </summary>
/// <value>
/// The dataContext.
/// </value>
IDataContext DataContext { get; }
}
} | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="IDataOperationContext.cs" company="Quartz Software SRL">
// Copyright (c) Quartz Software SRL. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// <summary>
// Declares the IDataOperationContext interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Kephas.Data
{
using Kephas.Services;
/// <summary>
/// Contract for data operations contexts.
/// </summary>
public interface IDataOperationContext : IContext
{
/// <summary>
/// Gets the dataContext.
/// </summary>
/// <value>
/// The dataContext.
/// </value>
IDataContext DataContext { get; }
}
} | mit | C# |
fc4ed4db4a5bfd04d18215a5b56b3227b886237e | Fix log message | chadly/vlc-rtsp,chadly/vlc-rtsp,chadly/vlc-rtsp,chadly/cams | src/Camera.cs | src/Camera.cs | using System;
using System.Collections.Generic;
using System.IO;
namespace Cams
{
public abstract class Camera
{
public string Name { get; private set; }
public string RawFilePath { get; private set; }
public abstract string Type { get; }
public Camera(string path)
{
var d = new DirectoryInfo(path);
Name = Settings.MapCameraName(d.Name);
RawFilePath = path;
}
public void Process(string outputDir)
{
Console.WriteLine($"{Name} ({Type}): {RawFilePath}");
var files = DiscoverVideoFiles();
foreach (var file in files)
ProcessFile(file, outputDir);
Console.WriteLine();
}
bool ProcessFile(VideoFile file, string outputBase)
{
DateTime threshold = DateTime.Now.AddMinutes(Settings.MinutesToWaitBeforeProcessing);
if (file.Date >= threshold)
{
Console.WriteLine($"File was written less than {Settings.MinutesToWaitBeforeProcessing} minutes ago: {file.FilePath}");
return false;
}
string outputFile = Path.Combine(outputBase, file.Date.ToString("yyyy-MM-dd"), Name, $"{file.Date.ToString("HH-mm-ss")}.mp4");
string outputDir = new FileInfo(outputFile).DirectoryName;
Directory.CreateDirectory(outputDir);
bool converted = true;
if (!VideoConverter.CodecCopy(file.FilePath, outputFile))
{
converted = false;
FallbackCopy(file, outputFile);
}
Cleanup(file);
Console.WriteLine(converted ? $"Converted {outputFile}" : $"Failed to convert {outputFile}; copied instead");
return true;
}
protected abstract IEnumerable<VideoFile> DiscoverVideoFiles();
protected abstract void FallbackCopy(VideoFile file, string outputFile);
protected abstract void Cleanup(VideoFile file);
public override string ToString()
{
return Name;
}
}
} | using System;
using System.Collections.Generic;
using System.IO;
namespace Cams
{
public abstract class Camera
{
public string Name { get; private set; }
public string RawFilePath { get; private set; }
public abstract string Type { get; }
public Camera(string path)
{
var d = new DirectoryInfo(path);
Name = Settings.MapCameraName(d.Name);
RawFilePath = path;
}
public void Process(string outputDir)
{
Console.WriteLine($"{Name} ({Type}): {RawFilePath}");
var files = DiscoverVideoFiles();
foreach (var file in files)
ProcessFile(file, outputDir);
Console.WriteLine();
}
bool ProcessFile(VideoFile file, string outputBase)
{
DateTime threshold = DateTime.Now.AddMinutes(Settings.MinutesToWaitBeforeProcessing);
if (file.Date >= threshold)
{
Console.WriteLine($"File was written less than five minutes ago: {file.FilePath}");
return false;
}
string outputFile = Path.Combine(outputBase, file.Date.ToString("yyyy-MM-dd"), Name, $"{file.Date.ToString("HH-mm-ss")}.mp4");
string outputDir = new FileInfo(outputFile).DirectoryName;
Directory.CreateDirectory(outputDir);
bool converted = true;
if (!VideoConverter.CodecCopy(file.FilePath, outputFile))
{
converted = false;
FallbackCopy(file, outputFile);
}
Cleanup(file);
Console.WriteLine(converted ? $"Converted {outputFile}" : $"Failed to convert {outputFile}; copied instead");
return true;
}
protected abstract IEnumerable<VideoFile> DiscoverVideoFiles();
protected abstract void FallbackCopy(VideoFile file, string outputFile);
protected abstract void Cleanup(VideoFile file);
public override string ToString()
{
return Name;
}
}
} | mit | C# |
bb3a254bdef258ba3c6f26cb9ec13ac88a5d7366 | Update demo | sunkaixuan/SqlSugar | Src/Asp.Net/SqlServerTest/Demo/DemoG_SimpleClient.cs | Src/Asp.Net/SqlServerTest/Demo/DemoG_SimpleClient.cs | using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class DemoG_SimpleClient
{
public static void Init()
{
Console.WriteLine("");
Console.WriteLine("#### SimpleClient Start ####");
var order = new OrderDal();
order.GetList();
order.GetById(1);
order.MyTest();
Console.WriteLine("#### SimpleClient End ####");
}
public class OrderDal:Repository<Order>
{
public void MyTest() {
}
}
public class Repository<T> : SimpleClient<T> where T : class, new()
{
public Repository(ISqlSugarClient context = null) : base(context)//注意这里要有默认值等于null
{
if (context == null)
{
base.Context = new SqlSugarClient(new ConnectionConfig()
{
DbType = SqlSugar.DbType.SqlServer,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
ConnectionString = Config.ConnectionString
});
}
}
/// <summary>
/// 扩展方法,自带方法不能满足的时候可以添加新方法
/// </summary>
/// <returns></returns>
public List<T> CommQuery(string json)
{
//base.Context.Queryable<T>().ToList();可以拿到SqlSugarClient 做复杂操作
return null;
}
}
}
}
| using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class DemoG_SimpleClient
{
public static void Init()
{
Console.WriteLine("");
Console.WriteLine("#### SimpleClient Start ####");
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.SqlServer,
ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
AopEvents = new AopEvents
{
OnLogExecuting = (sql, p) =>
{
Console.WriteLine(sql);
Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value)));
}
}
});
Console.WriteLine("#### SimpleClient End ####");
}
}
}
| apache-2.0 | C# |
8e876f96956dafa568b97fbc73895181e56156df | Update demo | sunkaixuan/SqlSugar | Src/Asp.NetCore2/SqlSeverTest/SqlSeverTest/Config.cs | Src/Asp.NetCore2/SqlSeverTest/SqlSeverTest/Config.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
/// <summary>
/// Setting up the database name does not require you to create the database
/// 设置好数据库名不需要你去手动建库
/// </summary>
public class Config
{
/// <summary>
/// Account have permission to create database
/// 用有建库权限的数据库账号
/// </summary>
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST";
/// <summary>
/// Account have permission to create database
/// 用有建库权限的数据库账号
/// </summary>
public static string ConnectionString2 = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST2";
/// <summary>
/// Account have permission to create database
/// 用有建库权限的数据库账号
/// </summary>
public static string ConnectionString3 = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST3";
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
/// <summary>
/// Setting up the database name does not require you to create the database
/// 设置好数据库名不需要你去手动建库
/// </summary>
public class Config
{
/// <summary>
/// Account have permission to create database
/// 用有建库权限的数据库账号
/// </summary>
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST";
/// <summary>
/// Account have permission to create database
/// 用有建库权限的数据库账号
/// </summary>
public static string ConnectionString2 = "server=.;uid=sa;pwd==@jhl85661501;database=SQLSUGAR4XTEST2";
/// <summary>
/// Account have permission to create database
/// 用有建库权限的数据库账号
/// </summary>
public static string ConnectionString3 = "server=.;uid=sa;pwd==@jhl85661501;database=SQLSUGAR4XTEST3";
}
}
| apache-2.0 | C# |
014a90258ec9cca5ad6c74e4b65113036a6301ba | verify data has loaded before updating text | sterlingcrispin/UnityLocalization | localization/LocalizedText.cs | localization/LocalizedText.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LocalizedText : MonoBehaviour {
public LocalizationEnum.Key key;
// Use this for initialization
void Start () {
updateObject();
}
IEnumerator updateText(){
Text text = GetComponent<Text> ();
yield return new WaitUntil(() => LocalizationManager.Instance.GetIsReady() == true);
text.text = LocalizationManager.Instance.GetLocalizedValue (key);
}
public void updateObject(){
StartCoroutine(updateText());
}
} | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LocalizedText : MonoBehaviour {
public LocalizationEnum.Key key;
// Use this for initialization
void Start ()
{
Text text = GetComponent<Text> ();
text.text = LocalizationManager.instance.GetLocalizedValue (key);
}
} | mit | C# |
7407e66107385d060d1c0d20f88f26d875755ac1 | Update AssemblyInfo.cs | RytisLT/LiteDB,89sos98/LiteDB,mbdavid/LiteDB,falahati/LiteDB,RytisLT/LiteDB,falahati/LiteDB,89sos98/LiteDB | LiteDB.Tests/Properties/AssemblyInfo.cs | LiteDB.Tests/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("LiteDB.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LiteDB.Tests")]
[assembly: AssemblyCopyright("MIT © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: ComVisible(false)]
[assembly: Guid("de183e83-7df6-475c-8185-b0070d098821")]
[assembly: AssemblyVersion("3.1.2.0")]
[assembly: AssemblyFileVersion("3.1.2.0")]
| using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("LiteDB.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LiteDB.Tests")]
[assembly: AssemblyCopyright("MIT © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: ComVisible(false)]
[assembly: Guid("de183e83-7df6-475c-8185-b0070d098821")]
[assembly: AssemblyVersion("3.1.1.0")]
[assembly: AssemblyFileVersion("3.1.1.0")] | mit | C# |
7e44cd73c85ae4871fdad8b87c64124ce0e1506a | Set the last activity on creation so sql doesn't blow up. | aapttester/jack12051317,SonOfSam/JabbR,Org1106/Project13221106,kudupublic/test0704jabbr,mogulTest1/Project13171205,mogultest2/Project92105,krolson/kkJabbr,AAPT/jean0226case1322,lukehoban/JabbR,kudupublic/test0704jabbr,yadyn/JabbR,test0925/test0925,mogulTest1/ProjectfoIssue6,MogulTestOrg1008/Project13221008,kudupublic/lizzy0703,mogulTest1/ProjectfoIssue6,ajayanandgit/JabbR,ClarkL/1317on17jabbr,Createfor1322/jessica0122-1322,krolson/kkJabbr,pavanaReddy/Testing730,mogulTest1/Project13171113,mogulTest1/Project13231109,mogulTest1/Project13171109,kudutest/FaizJabbr,v-jli1/jean1210jabbr,meebey/JabbR,mogulTest1/MogulVerifyIssue5,clarktestkudu1029/test08jabbr,mogulTest1/Project91101,yadyn/JabbR,timgranstrom/JabbR,mogulTest1/Project13171113,mogultest2/Project13171008,Haacked/JabbR,kudustress/JabbR,test0925/test0925,MogulTestOrg2/JabbrApp,mogulTest1/Project13171205,kuduautomation/jabbr,mogultest2/Project92104,MogulTestOrg914/Project91407,mogulTest1/Project13231213,mogulTest1/Project13161127,mogultest2/Project13171210,fuzeman/vox,ClarkL/test09jabbr,huanglitest/JabbRTest2,mogulTest1/Project91404,mogulTest1/Project90301,mogulTest1/Project13231109,mogulTest1/Project13171109,mogulTest1/Project13171009,GitHubFlora001/jabbrtest0416,v-mohua/TestProject91001,borisyankov/JabbR,aapttester/jack12051317,mogulTest1/MogulVerifyIssue5,fuzeman/vox,mogulTest1/Project91404,mogultest2/Project13231008,ToJans/JabbR,mogulTest1/Project91009,mogulTest1/Project13231106,mogultest2/Project13171008,mogulTest1/Project13161127,ajayanandgit/JabbR,pavanaReddy/Testing730,18098924759/JabbR,CrankyTRex/JabbRMirror,mogulTest1/Project91009,MogulTestOrg/JabbrApp,mogulTest1/Project13231213,MogulTestOrg2/JabbrApp,v-jli/jean0704jabbryamini,mogultest2/Project92104,mogulTest1/Project13171024,timgranstrom/JabbR,ClarkL/test09jabbr,lukehoban/JabbR,mogulTest1/ProjectJabbr01,MogulTestOrg/JabbrApp,meebey/JabbR,mzdv/JabbR,KuduApps/TestDeploy123,M-Zuber/JabbR,mogultest2/Project92109,ToJans/JabbR,kudustress/JabbR,mogulTest1/Project13231113,mogultest2/Project13171010,mogulTest1/Project13231205,mogulTest1/Project13231113,SonOfSam/JabbR,KuduApps/TestDeploy123,Createfor1322/jessica0122-1322,fuzeman/vox,KuduautomationGithubOrganization/JabbrInitialSuccess,kudupublic/lizzy0703,kuduautomation/jabbr,LookLikeAPro/JabbR,mogulTest1/Project13231212,pavanaReddy/Testing730,krolson/kkJabbr,kudupublic/lizzy0703,v-mohua/TestProject91001,Org1106/Project13221113,v-jli/jean0704jabbryamini,huanglitest/JabbRTest2,mogulTest1/ProjectVerify912,MogulTestOrg911/Project91104,Org1106/Project13221106,18098924759/JabbR,v-jli1/jean1210jabbr,mogulTest1/Project13231106,lukehoban/JabbR,CrankyTRex/JabbRMirror,CrankyTRex/JabbRMirror,ClarkL/new09,MogulTestOrg9221/Project92108,kuduautomation/jabbr,mogulTest1/Project91101,ToJans/JabbR,JabbR/JabbR,ClarkL/new1317,mogulTest1/Project13171009,mogulTest1/Project13171024,mogultest2/Project13171210,ClarkL/1317on17jabbr,clarktestkudu1029/test08jabbr,mogulTest1/Project91409,mogulTest1/Project13231212,ClarkL/1323on17jabbr-,kudustress/JabbR,ClarkL/new09,GitHubFlora001/jabbrtest0416,KuduautomationGithubOrganization/JabbrInitialSuccess,borisyankov/JabbR,Haacked/JabbR,borisyankov/JabbR,MogulTestOrg911/Project91104,Haacked/JabbR,mogulTest1/Project91105,yadyn/JabbR,mogulTest1/Project13171106,KuduautomationGithubOrganization/JabbrInitialSuccess,M-Zuber/JabbR,mogulTest1/Project91409,mogulTest1/ProjectVerify912,GitHubFlora001/jabbrtest0416,e10/JabbR,mogultest2/Project92109,mzdv/JabbR,meebey/JabbR,mogulTest1/Project91105,mogultest2/Project92105,mogulTest1/Project90301,Org1106/Project13221113,mogulTest1/Project13171106,huanglitest/JabbRTest2,MogulTestOrg1008/Project13221008,v-jli/jean0704jabbryamini,v-jli1/jean1210jabbr,ClarkL/1323on17jabbr-,ClarkL/new1317,kudupublic/test0704jabbr,mogulTest1/Project13231205,LookLikeAPro/JabbR,mogultest2/Project13231008,MogulTestOrg9221/Project92108,JabbR/JabbR,kudutest/FaizJabbr,LookLikeAPro/JabbR,e10/JabbR,mogultest2/Project13171010,mogulTest1/ProjectJabbr01,AAPT/jean0226case1322,MogulTestOrg914/Project91407 | JabbR/Models/ChatRoom.cs | JabbR/Models/ChatRoom.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace JabbR.Models
{
public class ChatRoom
{
[Key]
public int Key { get; set; }
public DateTime LastActivity { get; set; }
public DateTime? LastNudged { get; set; }
public string Name { get; set; }
public virtual ChatUser Owner { get; set; }
public virtual ICollection<ChatMessage> Messages { get; set; }
public virtual ICollection<ChatUser> Users { get; set; }
public ChatRoom()
{
LastActivity = DateTime.UtcNow;
Messages = new HashSet<ChatMessage>();
Users = new HashSet<ChatUser>();
}
}
} | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace JabbR.Models
{
public class ChatRoom
{
[Key]
public int Key { get; set; }
public DateTime LastActivity { get; set; }
public DateTime? LastNudged { get; set; }
public string Name { get; set; }
public virtual ChatUser Owner { get; set; }
public virtual ICollection<ChatMessage> Messages { get; set; }
public virtual ICollection<ChatUser> Users { get; set; }
public ChatRoom()
{
Messages = new HashSet<ChatMessage>();
Users = new HashSet<ChatUser>();
}
}
} | mit | C# |
4a2bb597ebb5317016571f34fcfe206d4895cf67 | Add CommandHelpAttribute#Alias | appharbor/appharbor-cli | src/AppHarbor/CommandHelpAttribute.cs | src/AppHarbor/CommandHelpAttribute.cs | using System;
namespace AppHarbor
{
public class CommandHelpAttribute : Attribute
{
public CommandHelpAttribute(string description, string options = "", string alias = "")
{
Alias = alias;
Description = description;
Options = options;
}
public string Alias
{
get;
private set;
}
public string Description
{
get;
private set;
}
public string Options
{
get;
private set;
}
}
}
| using System;
namespace AppHarbor
{
public class CommandHelpAttribute : Attribute
{
public CommandHelpAttribute(string description, string options = "")
{
Description = description;
Options = options;
}
public string Description
{
get;
private set;
}
public string Options
{
get;
private set;
}
}
}
| mit | C# |
40426c7103c2a1296eb7335c57fc42fd798a3dae | Fix RateLimitLock waiting basically infinite times | BundledSticksInkorperated/Discore | src/Discore/Http/Net/RateLimitLock.cs | src/Discore/Http/Net/RateLimitLock.cs | using Nito.AsyncEx;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Discore.Http.Net
{
class RateLimitLock
{
public bool RequiresWait => GetDelay() > 0;
ulong resetAtEpochMilliseconds;
AsyncLock mutex;
public RateLimitLock()
{
mutex = new AsyncLock();
}
int GetDelay()
{
TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
ulong epochNowMilliseconds = (ulong)t.TotalMilliseconds;
if (resetAtEpochMilliseconds <= epochNowMilliseconds)
return 0;
else
return (int)(resetAtEpochMilliseconds - epochNowMilliseconds);
}
public Task WaitAsync(CancellationToken cancellationToken)
{
int msDelay = GetDelay();
return msDelay <= 0 ? Task.CompletedTask : Task.Delay(msDelay);
}
public void ResetAt(ulong epochSeconds)
{
resetAtEpochMilliseconds = epochSeconds * 1000;
}
public void ResetAfter(int milliseconds)
{
TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
ulong epochNowMilliseconds = (ulong)t.TotalMilliseconds;
resetAtEpochMilliseconds = epochNowMilliseconds + (ulong)milliseconds;
}
public AwaitableDisposable<IDisposable> LockAsync(CancellationToken cancellationToken)
{
return mutex.LockAsync(cancellationToken);
}
}
}
| using Nito.AsyncEx;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Discore.Http.Net
{
class RateLimitLock
{
public bool RequiresWait
{
get
{
TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
ulong epochNowMilliseconds = (ulong)t.TotalMilliseconds;
int msDelay = (int)(resetAtEpochMilliseconds - epochNowMilliseconds);
return msDelay > 0;
}
}
ulong resetAtEpochMilliseconds;
AsyncLock mutex;
public RateLimitLock()
{
mutex = new AsyncLock();
}
public Task WaitAsync(CancellationToken cancellationToken)
{
TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
ulong epochNowMilliseconds = (ulong)t.TotalMilliseconds;
int msDelay = (int)(resetAtEpochMilliseconds - epochNowMilliseconds);
return msDelay <= 0 ? Task.CompletedTask : Task.Delay(msDelay);
}
public void ResetAt(ulong epochSeconds)
{
resetAtEpochMilliseconds = epochSeconds * 1000;
}
public void ResetAfter(int milliseconds)
{
TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
ulong epochNowMilliseconds = (ulong)t.TotalMilliseconds;
resetAtEpochMilliseconds = epochNowMilliseconds + (ulong)milliseconds;
}
public AwaitableDisposable<IDisposable> LockAsync(CancellationToken cancellationToken)
{
return mutex.LockAsync(cancellationToken);
}
}
}
| mit | C# |
831813c00b31fef60dd5e0d840514772895de1c4 | Fix Bug with DeleteUser() | revaturelabs/revashare-svc-webapi | revashare-svc-webapi/revashare-svc-webapi.Logic/ServiceClient/ServiceClientUser.cs | revashare-svc-webapi/revashare-svc-webapi.Logic/ServiceClient/ServiceClientUser.cs | using revashare_svc_webapi.Logic.Interfaces;
using revashare_svc_webapi.Logic.RevaShareServiceReference;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace revashare_svc_webapi.Logic.ServiceClient
{
public partial class ServiceClient : IServiceClient
{
public bool DeleteUser(UserDAO user)
{
return rs.DeleteUser(user.UserName);
}
public UserDAO GetUser(string UserName)
{
return rs.GetUserByUsername(UserName);
}
public List<UserDAO> GetRiders()
{
return rs.GetRiders().ToList();
}
public List<UserDAO> GetDrivers()
{
return rs.GetDrivers().ToList();
}
public bool UpdateUser(UserDAO user)
{
return rs.UpdateUser(user);
}
public bool RequestToBeDriver(string user)
{
return rs.RequestToBeDriver(user);
}
public UserDAO Login(string UserName, string Password)
{
return rs.Login(UserName, Password);
}
public bool Register(UserDAO user, string UserName, string Password)
{
return rs.RegisterUser(user, UserName, Password);
}
}
}
| using revashare_svc_webapi.Logic.Interfaces;
using revashare_svc_webapi.Logic.RevaShareServiceReference;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace revashare_svc_webapi.Logic.ServiceClient
{
public partial class ServiceClient : IServiceClient
{
public bool DeleteUser(UserDAO user)
{
return rs.DeleteUser(user.Name);
}
public UserDAO GetUser(string UserName)
{
return rs.GetUserByUsername(UserName);
}
public List<UserDAO> GetRiders()
{
return rs.GetRiders().ToList();
}
public List<UserDAO> GetDrivers()
{
return rs.GetDrivers().ToList();
}
public bool UpdateUser(UserDAO user)
{
return rs.UpdateUser(user);
}
public bool RequestToBeDriver(string user)
{
return rs.RequestToBeDriver(user);
}
public UserDAO Login(string UserName, string Password)
{
return rs.Login(UserName, Password);
}
public bool Register(UserDAO user, string UserName, string Password)
{
return rs.RegisterUser(user, UserName, Password);
}
}
}
| mit | C# |
6d50ea317597d5d039d4c836d125268421eb3d24 | standardize on "auth0 domain" being just the domain name | StephenClearyExamples/FunctionsAuth0 | src/FunctionApp/Auth0Authenticator.cs | src/FunctionApp/Auth0Authenticator.cs | using System;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Protocols;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using Microsoft.IdentityModel.Tokens;
public sealed class Auth0Authenticator
{
private readonly string _auth0domain;
private readonly string _audience;
private readonly ConfigurationManager<OpenIdConnectConfiguration> _manager;
private readonly JwtSecurityTokenHandler _handler;
public Auth0Authenticator(string auth0Domain, string audience)
{
_auth0domain = auth0Domain;
_audience = audience;
_manager = new ConfigurationManager<OpenIdConnectConfiguration>($"https://{auth0Domain}/.well-known/openid-configuration", new OpenIdConnectConfigurationRetriever());
_handler = new JwtSecurityTokenHandler();
}
public async Task<ClaimsPrincipal> AuthenticateAsync(string token, CancellationToken cancellationToken = new CancellationToken())
{
// Note: ConfigurationManager<T> has an automatic refresh interval of 1 day.
// The config is cached in-between refreshes, so this call actually completes synchronously unless it needs to refresh.
var config = await _manager.GetConfigurationAsync(cancellationToken).ConfigureAwait(false);
var validationParameters = new TokenValidationParameters
{
ValidIssuer = _auth0domain,
ValidAudience = _audience,
ValidateIssuerSigningKey = true,
IssuerSigningKeys = config.SigningKeys,
};
var user = _handler.ValidateToken(token, validationParameters, out var _);
return user;
}
}
public static class Auth0AuthenticatorExtensions
{
public static async Task<ClaimsPrincipal> AuthenticateAsync(this Auth0Authenticator @this, AuthenticationHeaderValue header,
CancellationToken cancellationToken = new CancellationToken())
{
if (header == null || !string.Equals(header.Scheme, "Bearer", StringComparison.InvariantCultureIgnoreCase))
throw new InvalidOperationException("Authentication header does not use Bearer token.");
return await @this.AuthenticateAsync(header.Parameter, cancellationToken);
}
public static Task<ClaimsPrincipal> AuthenticateAsync(this Auth0Authenticator @this, HttpRequestMessage request,
CancellationToken cancellationToken = new CancellationToken()) =>
@this.AuthenticateAsync(request.Headers.Authorization, cancellationToken);
}
| using System;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Protocols;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using Microsoft.IdentityModel.Tokens;
public sealed class Auth0Authenticator
{
private readonly string _auth0domain;
private readonly string _audience;
private readonly ConfigurationManager<OpenIdConnectConfiguration> _manager;
private readonly JwtSecurityTokenHandler _handler;
public Auth0Authenticator(string auth0Domain, string audience)
{
_auth0domain = auth0Domain;
_audience = audience;
_manager = new ConfigurationManager<OpenIdConnectConfiguration>($"{auth0Domain}.well-known/openid-configuration", new OpenIdConnectConfigurationRetriever());
_handler = new JwtSecurityTokenHandler();
}
public async Task<ClaimsPrincipal> AuthenticateAsync(string token, CancellationToken cancellationToken = new CancellationToken())
{
// Note: ConfigurationManager<T> has an automatic refresh interval of 1 day.
// The config is cached in-between refreshes, so this call actually completes synchronously unless it needs to refresh.
var config = await _manager.GetConfigurationAsync(cancellationToken).ConfigureAwait(false);
var validationParameters = new TokenValidationParameters
{
ValidIssuer = _auth0domain,
ValidAudience = _audience,
ValidateIssuerSigningKey = true,
IssuerSigningKeys = config.SigningKeys,
};
var user = _handler.ValidateToken(token, validationParameters, out var _);
return user;
}
}
public static class Auth0AuthenticatorExtensions
{
public static async Task<ClaimsPrincipal> AuthenticateAsync(this Auth0Authenticator @this, AuthenticationHeaderValue header,
CancellationToken cancellationToken = new CancellationToken())
{
if (header == null || !string.Equals(header.Scheme, "Bearer", StringComparison.InvariantCultureIgnoreCase))
throw new InvalidOperationException("Authentication header does not use Bearer token.");
return await @this.AuthenticateAsync(header.Parameter, cancellationToken);
}
public static Task<ClaimsPrincipal> AuthenticateAsync(this Auth0Authenticator @this, HttpRequestMessage request,
CancellationToken cancellationToken = new CancellationToken()) =>
@this.AuthenticateAsync(request.Headers.Authorization, cancellationToken);
}
| mit | C# |
fcc6c01c979a0b5b87ffa706d6a1b1ef6def61ab | Update IdFactory.cs | Elfocrash/L2dotNET,MartLegion/L2dotNET | src/L2dotNET.Game/tables/IdFactory.cs | src/L2dotNET.Game/tables/IdFactory.cs | using System;
using System.Data;
using MySql.Data.MySqlClient;
using System.Collections.Generic;
using Ninject;
using L2dotNET.Services.Contracts;
using System.Linq;
namespace L2dotNET.Game.tables
{
sealed class IdFactory
{
[Inject]
public IServerService serverService { get { return GameServer.Kernel.Get<IServerService>(); } }
private static volatile IdFactory instance;
private static object syncRoot = new object();
public const int ID_MIN = 0x10000000, ID_MAX = 0x7FFFFFFF;
private int currentId = 1;
public static IdFactory Instance
{
get
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
{
instance = new IdFactory();
}
}
}
return instance;
}
}
public IdFactory()
{
}
public int nextId()
{
currentId++;
return currentId;
}
public void Initialize()
{
currentId = serverService.GetPlayersObjectIdList().DefaultIfEmpty(ID_MIN).Max();
Console.WriteLine("idfactory: used ids " + currentId);
}
}
}
| using System;
using System.Data;
using MySql.Data.MySqlClient;
using System.Collections.Generic;
using Ninject;
using L2dotNET.Services.Contracts;
using System.Linq;
namespace L2dotNET.Game.tables
{
sealed class IdFactory
{
[Inject]
public IServerService serverService { get { return GameServer.Kernel.Get<IServerService>(); } }
private static volatile IdFactory instance;
private static object syncRoot = new object();
public int id_min = 0x10000000, id_max = 0x7FFFFFFF;
private int currentId = 1;
public static IdFactory Instance
{
get
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
{
instance = new IdFactory();
}
}
}
return instance;
}
}
public IdFactory()
{
}
public int nextId()
{
currentId++;
return currentId;
}
public void Initialize()
{
currentId = serverService.GetPlayersObjectIdList().Max();
Console.WriteLine("idfactory: used ids " + currentId);
}
}
}
| mpl-2.0 | C# |
70c76e091a4647644374962ea40559221ed90741 | Update Program.cs | ickecode/GitTest1 | ConsoleApp1/ConsoleApp1/Program.cs | ConsoleApp1/ConsoleApp1/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
Console.ReadKey();
//Comment added in GitHub
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
Console.ReadKey();
}
}
}
| mit | C# |
98312b29f5dd039e7fc65be24e0c3402d3c36932 | Use invariant culture for number parsing (#165) | ForNeVeR/wpf-math | src/WpfMath/Colors/HtmlColorParser.cs | src/WpfMath/Colors/HtmlColorParser.cs | using System.Globalization;
using System.Windows.Media;
namespace WpfMath.Colors
{
internal class HtmlColorParser : SingleComponentColorParser
{
protected override Color? ParseSingleComponent(string component)
{
if (component.Length != 6)
return null;
var colorCode = int.Parse(component, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
var r = (byte) ((colorCode & 0xFF0000) >> 16);
var g = (byte) ((colorCode & 0xFF00) >> 8);
var b = (byte) (colorCode & 0xFF);
return Color.FromRgb(r, g, b);
}
}
}
| using System.Globalization;
using System.Windows.Media;
namespace WpfMath.Colors
{
internal class HtmlColorParser : SingleComponentColorParser
{
protected override Color? ParseSingleComponent(string component)
{
if (component.Length != 6)
return null;
var colorCode = int.Parse(component, NumberStyles.HexNumber);
var r = (byte) ((colorCode & 0xFF0000) >> 16);
var g = (byte) ((colorCode & 0xFF00) >> 8);
var b = (byte) (colorCode & 0xFF);
return Color.FromRgb(r, g, b);
}
}
}
| mit | C# |
eff35979967f34f94316b453bf5af30c84e66792 | Update Assets/MixedRealityToolkit/Interfaces/Diagnostics/IMixedRealityDiagnosticsSystem.cs | DDReaper/MixedRealityToolkit-Unity,vladkol/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,vladkol/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,vladkol/MixedRealityToolkit-Unity | Assets/MixedRealityToolkit/Interfaces/Diagnostics/IMixedRealityDiagnosticsSystem.cs | Assets/MixedRealityToolkit/Interfaces/Diagnostics/IMixedRealityDiagnosticsSystem.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Core.Definitions.Diagnostics;
using Microsoft.MixedReality.Toolkit.Core.Interfaces.Events;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Core.Interfaces.Diagnostics
{
/// <summary>
/// The interface contract that defines the Diagnostics system in the Mixed Reality Toolkit
/// </summary>
public interface IMixedRealityDiagnosticsSystem : IMixedRealityEventSystem, IMixedRealityEventSource
{
/// <summary>
/// Enable / disable diagnostic display.
/// </summary>
/// <remarks>
/// When set to true, visibility settings for individual diagnostics are honored. When set to false,
/// all visualizations are hidden.
/// </remarks>
bool ShowDiagnostics { get; set; }
/// <summary>
/// Enable / disable the profiler display
/// </summary>
bool ShowProfiler { get; set; }
}
}
| // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Core.Definitions.Diagnostics;
using Microsoft.MixedReality.Toolkit.Core.Interfaces.Events;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Core.Interfaces.Diagnostics
{
/// <summary>
/// The interface contract that defines the Diagnostics system in the Mixed Reality Toolkit
/// </summary>
public interface IMixedRealityDiagnosticsSystem : IMixedRealityEventSystem, IMixedRealityEventSource
{
/// <summary>
/// Enable / disable diagnotic display.
/// </summary>
/// <remarks>
/// When set to true, visibility settings for individual diagnostics are honored. When set to false,
/// all visualizations are hidden.
/// </remarks>
bool ShowDiagnostics { get; set; }
/// <summary>
/// Enable / disable the profiler display
/// </summary>
bool ShowProfiler { get; set; }
}
} | mit | C# |
cae43a7a8c3818db43cae099ea2acd8e10fc9703 | Make DateFormatConverterTemplateModel public | RSuter/NJsonSchema,NJsonSchema/NJsonSchema | src/NJsonSchema.CodeGeneration.CSharp/Models/DateFormatConverterTemplateModel.cs | src/NJsonSchema.CodeGeneration.CSharp/Models/DateFormatConverterTemplateModel.cs | //-----------------------------------------------------------------------
// <copyright file="DateFormatConverterTemplateModel.cs" company="NJsonSchema">
// Copyright (c) Rico Suter. All rights reserved.
// </copyright>
// <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license>
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------
using System.Linq;
namespace NJsonSchema.CodeGeneration.CSharp.Models
{
/// <summary>The DateFormatConverterTemplateModel.</summary>
public class DateFormatConverterTemplateModel
{
private readonly CSharpGeneratorSettings _settings;
/// <summary>The DateFormatConverterTemplateModel.</summary>
public DateFormatConverterTemplateModel(CSharpGeneratorSettings settings)
{
_settings = settings;
}
/// <summary>Gets or sets a value indicating whether to generate the DateFormatConverter class.</summary>
public bool GenerateDateFormatConverterClass => _settings.ExcludedTypeNames?.Contains("DateFormatConverter") != true;
}
}
| //-----------------------------------------------------------------------
// <copyright file="DateFormatConverterTemplateModel.cs" company="NJsonSchema">
// Copyright (c) Rico Suter. All rights reserved.
// </copyright>
// <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license>
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------
using System.Linq;
namespace NJsonSchema.CodeGeneration.CSharp.Models
{
class DateFormatConverterTemplateModel
{
private readonly CSharpGeneratorSettings _settings;
/// <summary>The DateFormatConverterTemplateModel.</summary>
public DateFormatConverterTemplateModel(CSharpGeneratorSettings settings)
{
_settings = settings;
}
/// <summary>Gets or sets a value indicating whether to generate the DateFormatConverter class.</summary>
public bool GenerateDateFormatConverterClass => _settings.ExcludedTypeNames?.Contains("DateFormatConverter") != true;
}
}
| mit | C# |
a5fc9f84c29ede6bd9f8ee039edeea98bdd3530d | Remove revision number | fryderykhuang/SuperSocket,mdavid/SuperSocket,ZixiangBoy/SuperSocket,chucklu/SuperSocket,memleaks/SuperSocket,ZixiangBoy/SuperSocket,mdavid/SuperSocket,kerryjiang/SuperSocket,fryderykhuang/SuperSocket,jmptrader/SuperSocket,fryderykhuang/SuperSocket,ZixiangBoy/SuperSocket,jmptrader/SuperSocket,chucklu/SuperSocket,mdavid/SuperSocket,kerryjiang/SuperSocket,chucklu/SuperSocket,jmptrader/SuperSocket | SocketServiceCore/GlobalAssemblyInfo.cs | SocketServiceCore/GlobalAssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.0.1.53845")]
[assembly: AssemblyFileVersion("0.0.1.53845")] | apache-2.0 | C# |
3687a4fa639e1dcb3d9d37562d86e511113439af | Update IgnoreCodes.cs | Fody/MethodTimer | Tests/AssemblyTesterSets/IgnoreCodes.cs | Tests/AssemblyTesterSets/IgnoreCodes.cs | using System.Collections.Generic;
public static class IgnoreCodes
{
public static IEnumerable<string> GetIgnoreCoders()
{
return new[] { "0x80131869" };
}
} | using System.Collections.Generic;
public static class IgnoreCodes
{
public static IEnumerable<string> GetIgnoreCoders()
{
#if NET472
return System.Linq.Enumerable.Empty<string>();
#endif
#if NETCOREAPP2_2
return new[] { "0x80131869" };
#endif
}
} | mit | C# |
6fb9bd45cba03f6892730d422688ebaa285fb247 | Make IUpdater public | brandonio21/update.net | update.net/IUpdater.cs | update.net/IUpdater.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace update.net
{
/// <summary>
/// An interface specification for all types of updaters. Updaters have the ability to
/// synchronously check versions, download changelogs, and asynchronously download and
/// run updates.
/// </summary>
public interface IUpdater
{
/// <summary>
/// An Event indicating that the updater download has completed
/// </summary>
event EventHandler UpdateDownloaded;
/// <summary>
/// An Event indicating that the updater download has progressed
/// </summary>
event EventHandler UpdateDownloadProgressChanged;
/// <summary>
/// Checks to see if a new update is available by comparing the provided version to
/// the one retrieved with a call to GetLatestVersion. An update is considered
/// available if the new version is greater than the current version
/// </summary>
/// <param name="currentVersion">The current running version of the application</param>
/// <returns>A boolean indicating whether the provided version is out of date</returns>
bool IsUpdateAvailable(int currentVersion);
/// <summary>
/// Performs an I/O operation to get the latest version and returns it
/// </summary>
/// <returns>The latest version number</returns>
int GetLatestVersion();
/// <summary>
/// Asyncrhonously downloads the update associated with the Updater object. The
/// progress and completion of the update can be tracked with the UpdateDownloaded
/// and UpdateDownloadProgressChanged events
/// </summary>
void DownloadUpdate();
/// <summary>
/// Runs the downloaded update. It is recommended to run this method only after
/// the UpdateDownloaded event has been fired.
/// </summary>
/// <param name="args">Arguments that may be passed to the update executable</param>
void RunUpdate(string args = null);
/// <summary>
/// Performs an I/O operation to get the changelog and returns it
/// </summary>
/// <returns>The downloaded changelog</returns>
string GetChangelog();
/// <summary>
/// Cleans up the resources of the Updater object, usually by deleting
/// all downloaded changelogs, version caches, and updaters.
/// </summary>
void Clean();
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace update.net
{
/// <summary>
/// An interface specification for all types of updaters. Updaters have the ability to
/// synchronously check versions, download changelogs, and asynchronously download and
/// run updates.
/// </summary>
interface IUpdater
{
event EventHandler UpdateDownloaded;
event EventHandler UpdateDownloadProgressChanged;
/// <summary>
/// Checks to see if a new update is available by comparing the provided version to
/// the one retrieved with a call to GetLatestVersion. An update is considered
/// available if the new version is greater than the current version
/// </summary>
/// <param name="currentVersion">The current running version of the application</param>
/// <returns>A boolean indicating whether the provided version is out of date</returns>
bool IsUpdateAvailable(int currentVersion);
/// <summary>
/// Performs an I/O operation to get the latest version and returns it
/// </summary>
/// <returns>The latest version number</returns>
int GetLatestVersion();
/// <summary>
/// Asyncrhonously downloads the update associated with the Updater object. The
/// progress and completion of the update can be tracked with the UpdateDownloaded
/// and UpdateDownloadProgressChanged events
/// </summary>
void DownloadUpdate();
/// <summary>
/// Runs the downloaded update. It is recommended to run this method only after
/// the UpdateDownloaded event has been fired.
/// </summary>
/// <param name="args">Arguments that may be passed to the update executable</param>
void RunUpdate(string args = null);
/// <summary>
/// Performs an I/O operation to get the changelog and returns it
/// </summary>
/// <returns>The downloaded changelog</returns>
string GetChangelog();
/// <summary>
/// Cleans up the resources of the Updater object, usually by deleting
/// all downloaded changelogs, version caches, and updaters.
/// </summary>
void Clean();
}
}
| mit | C# |
caca0efe649ae42ca732062fa0a7e0ca5deca6df | Fix backspace in PasswordConsole | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Helpers/PasswordConsole.cs | WalletWasabi/Helpers/PasswordConsole.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace WalletWasabi.Helpers
{
public class PasswordConsole
{
/// <summary>
/// Gets the console password.
/// </summary>
public static string ReadPassword()
{
var sb = new StringBuilder();
while (true)
{
ConsoleKeyInfo cki = Console.ReadKey(true);
if (cki.Key == ConsoleKey.Enter)
{
Console.WriteLine();
break;
}
if (cki.Key == ConsoleKey.Backspace)
{
if (sb.Length > 0)
{
Console.Write("\b \b");
sb.Length--;
}
continue;
}
Console.Write('*');
sb.Append(cki.KeyChar);
}
return sb.ToString();
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace WalletWasabi.Helpers
{
public class PasswordConsole
{
/// <summary>
/// Gets the console password.
/// </summary>
public static string ReadPassword()
{
var sb = new StringBuilder();
while (true)
{
ConsoleKeyInfo cki = Console.ReadKey(true);
if (cki.Key == ConsoleKey.Enter)
{
Console.WriteLine();
break;
}
if (cki.Key == ConsoleKey.Backspace)
{
if (sb.Length > 0)
{
Console.Write("\b\0\b");
sb.Length--;
}
continue;
}
Console.Write('*');
sb.Append(cki.KeyChar);
}
return sb.ToString();
}
}
}
| mit | C# |
3eb883739b0f8f3925edd58ea9222d0c8874ee5e | Add OnPropertiesChanged support to ViewModelBase | ahanusa/facile.net,peasy/Peasy.NET,ahanusa/Peasy.NET,peasy/Samples,peasy/Samples,peasy/Samples | Orders.com.WPF/VM/ViewModelBase.cs | Orders.com.WPF/VM/ViewModelBase.cs | using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
namespace Orders.com.WPF.VM
{
public class ViewModelBase : INotifyPropertyChanged
{
private bool _isDirty = false;
private bool _isNew = false;
private bool _isValid = true;
private IEnumerable<ValidationResult> _errors;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertiesChanged(params string[] propertyNames)
{
foreach (var propertyName in propertyNames)
OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, args);
}
public bool IsNew
{
get { return _isNew; }
protected set
{
_isNew = value;
OnPropertyChanged("IsNew");
}
}
public bool IsDirty
{
get { return _isDirty; }
protected set
{
_isDirty = value;
OnPropertyChanged("IsDirty");
}
}
public bool IsValid
{
get { return _isValid; }
protected set
{
_isValid = value;
OnPropertyChanged("IsValid");
}
}
public IEnumerable<ValidationResult> Errors
{
get { return _errors; }
protected set
{
_errors = value;
OnPropertyChanged("Errors");
}
}
}
}
| using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
namespace Orders.com.WPF.VM
{
public class ViewModelBase : INotifyPropertyChanged
{
private bool _isDirty = false;
private bool _isNew = false;
private bool _isValid = true;
private IEnumerable<ValidationResult> _errors;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, args);
}
public bool IsNew
{
get { return _isNew; }
protected set
{
_isNew = value;
OnPropertyChanged("IsNew");
}
}
public bool IsDirty
{
get { return _isDirty; }
protected set
{
_isDirty = value;
OnPropertyChanged("IsDirty");
}
}
public bool IsValid
{
get { return _isValid; }
protected set
{
_isValid = value;
OnPropertyChanged("IsValid");
}
}
public IEnumerable<ValidationResult> Errors
{
get { return _errors; }
protected set
{
_errors = value;
OnPropertyChanged("Errors");
}
}
}
}
| mit | C# |
53eb253a21a508c1e6e130555b47fcba3e6bc783 | allow multiple Dispose calls | KirillShlenskiy/Kirkin,KirillShlenskiy/Kirkin,KirillShlenskiy/Kirkin | src/Kirkin.Experimental/Threading/AsyncLock.cs | src/Kirkin.Experimental/Threading/AsyncLock.cs | using System;
using System.Threading;
using System.Threading.Tasks;
namespace Kirkin.Threading
{
public sealed class AsyncLock
{
private TaskCompletionSource<bool> _tcs;
public async Task<AsyncLockReleaser> EnterAsync()
{
TaskCompletionSource<bool> newTcs = new TaskCompletionSource<bool>();
TaskCompletionSource<bool> oldTcs = Interlocked.Exchange(ref _tcs, newTcs);
if (oldTcs != null)
{
// TODO: async completion?
await oldTcs.Task.ConfigureAwait(false);
}
return new AsyncLockReleaser(newTcs);
}
}
public struct AsyncLockReleaser : IDisposable
{
private readonly TaskCompletionSource<bool> _tcs;
internal AsyncLockReleaser(TaskCompletionSource<bool> tcs)
{
_tcs = tcs;
}
public void Dispose()
{
_tcs.TrySetResult(true);
}
}
} | using System;
using System.Threading;
using System.Threading.Tasks;
namespace Kirkin.Threading
{
public sealed class AsyncLock
{
private TaskCompletionSource<bool> _tcs;
public async Task<AsyncLockReleaser> EnterAsync()
{
TaskCompletionSource<bool> newTcs = new TaskCompletionSource<bool>();
TaskCompletionSource<bool> oldTcs = Interlocked.Exchange(ref _tcs, newTcs);
if (oldTcs != null)
{
// TODO: async completion?
await oldTcs.Task.ConfigureAwait(false);
}
return new AsyncLockReleaser(newTcs);
}
}
public struct AsyncLockReleaser : IDisposable
{
private readonly TaskCompletionSource<bool> _tcs;
internal AsyncLockReleaser(TaskCompletionSource<bool> tcs)
{
_tcs = tcs;
}
public void Dispose()
{
_tcs.SetResult(true);
}
}
} | mit | C# |
f6954576aa6bf706f412f0235dcc037e63f72709 | Update HtmlSanitizerOptions.cs | mganss/HtmlSanitizer | src/HtmlSanitizer/HtmlSanitizerOptions.cs | src/HtmlSanitizer/HtmlSanitizerOptions.cs | using System;
using System.Collections.Generic;
namespace Ganss.XSS
{
/// <summary>
/// Provides options to be used with <see cref="HtmlSanitizer"/>.
/// </summary>
public class HtmlSanitizerOptions
{
/// <summary>
/// Gets or sets the allowed tag names such as "a" and "div".
// </summary>
public ISet<string> AllowedTags { get; set; } = new HashSet<string>();
/// <summary>
/// Gets or sets the allowed HTML attributes such as "href" and "alt".
// </summary>
public ISet<string> AllowedAttributes { get; set; } = new HashSet<string>();
/// <summary>
/// Gets or sets the allowed CSS properties such as "font" and "margin".
// </summary>
public ISet<string> AllowedCssProperties { get; set; } = new HashSet<string>();
/// <summary>
/// Gets or sets the allowed CSS at-rules such as "@media" and "@font-face".
// </summary>
public ISet<CssRuleType> AllowedAtRules { get; set; } = new HashSet<CssRuleType>();
/// <summary>
/// Gets or sets the allowed URI schemes such as "http" and "https".
// </summary>
public ISet<string> AllowedSchemes { get; set; } = new HashSet<string>();
/// <summary>
/// Gets or sets the HTML attributes that can contain a URI such as "href".
// </summary>
public ISet<string> UriAttributes { get; set; } = new HashSet<string>();
}
}
| using System;
using System.Collections.Generic;
namespace Ganss.XSS
{
public class HtmlSanitizerOptions
{
public ICollection<string> AllowedTags { get; set; } = new HashSet<string>();
public ICollection<string> AllowedAttributes { get; set; } = new HashSet<string>();
public ICollection<string> AllowedCssProperties { get; set; } = new HashSet<string>();
public ICollection<string> AllowedAtRules { get; set; } = new HashSet<string>();
public ICollection<string> AllowedSchemes { get; set; } = new HashSet<string>();
public ICollection<string> UriAttributes { get; set; } = new HashSet<string>();
}
}
| mit | C# |
ee03b6d551c2d48caea12b5ae4fbd09301e1cc41 | fix typo in AnalyticsEvents | fashaikh/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/TryAppService,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/TryAppService,fashaikh/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/TryAppService,projectkudu/TryAppService,fashaikh/SimpleWAWS,fashaikh/SimpleWAWS,davidebbo/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS | SimpleWAWS/Code/AnalyticsEvents.cs | SimpleWAWS/Code/AnalyticsEvents.cs | using System.Linq;
using System.Collections.Generic;
using SimpleWAWS.Code;
namespace SimpleWAWS.Models
{
public static class AnalyticsEvents
{
// Event format "USER_LOGGED_IN; {userName}"
public const string UserLoggedIn = "USER_LOGGED_IN; {@user}";
public const string OldUserLoggedIn = "USER_LOGGED_IN";
public const string UserGotError = "USER_GOT_ERROR; {user}; {errorMessage}; Count: {Count}";
public const string MoreThanOneError = "MORE_THAN_ONE_ERROR; {user}; Count: {Count}";
// Event format "USER_CREATED_SITE_WITH_LANGUAGE_AND_TEMPLATE; {userName}; {language}; {template}; {siteUniqueId}"
public const string UserCreatedSiteWithLanguageAndTemplateName = "USER_CREATED_SITE_WITH_LANGUAGE_AND_TEMPLATE; {@user}; {@template}; {resourceGroupId}";
public const string OldUserCreatedSiteWithLanguageAndTemplateName = "USER_CREATED_SITE_WITH_LANGUAGE_AND_TEMPLATE";
public const string UserPuidValue = "USER_PUID_VALUE; {@user}";
public const string ErrorInRemoveRbacUser = "ERROR_REMOVE_RBAC_USER; {resourceGroupId}";
public const string ErrorInAddRbacUser = "ERROR_ADD_RBAC_USER; {@user} Count: {Count}";
public const string ErrorInCheckRbacUser = "ERROR_CHECK_RBAC_USER; {resourceGroupId}";
public const string RemoveUserFromTenant = "REMOVE_USER_FROM_TENANT; {userPrincipalId}";
public const string RemoveUserFromTenantResult = "REMOVE_USER_FROM_TENANT_RESULT; {@response}; {content}";
public const string UiEvent = "UI_EVENT; {eventName}; {@properties}";
public const string OldUiEvent = "UI_EVENT";
public const string NoRbacAccess = "NO_RBAC_ACCESS; {puid}; {email}";
public const string SearchGraphForUser = "SEARCH_GRAPH_FOR_USER; {@rbacUser}";
public const string SearchGraphResponse = "SEARCH_GRAPH_RESPONSE; {@response}";
public const string InviteUser = "INVITE_USER; {@rbacUser}";
public const string RedeemUserInvitation = "REDEEM_USER_INVITATION";
public const string UserAlreadyInTenant = "USER_ALREADY_IN_TENANT; {objectId}";
public const string AssignRbacResult = "ASSIGN_RBAC_RESULT; {csmResponseStatusCode}";
public const string FailedToAddRbacAccess = "FAILED_TO_ADD_RBAC_ACCESS";
public const string UserAddedToTenant = "USER_ADDED_TO_TENANT; {objectId}";
public const string AnonymousUserCreated = "ANONYMOUS_USER_CREATED";
public const string AnonymousUserLogedIn = "ANONYMOUS_USER_LOGGEDIN";
}
}
| using System.Linq;
using System.Collections.Generic;
using SimpleWAWS.Code;
namespace SimpleWAWS.Models
{
public static class AnalyticsEvents
{
// Event format "USER_LOGGED_IN; {userName}"
public const string UserLoggedIn = "USER_LOGGED_IN; {@user}";
public const string OldUserLoggedIn = "USER_LOGGED_IN";
public const string UserGotError = "USER_GOT_ERROR; {user}; {errorMessage}; Count: {Count}";
public const string MoreThanOneError = "MORE_THAN_ONE_ERROR; {user}; Count: {Count}";
// Event format "USER_CREATED_SITE_WITH_LANGUAGE_AND_TEMPLATE; {userName}; {language}; {template}; {siteUniqueId}"
public const string UserCreatedSiteWithLanguageAndTemplateName = "USER_CREATED_SITE_WITH_LANGUAGE_AND_TEMPLATE; {@user}; {@template}; {resourceGroupId}";
public const string OldUserCreatedSiteWithLanguageAndTemplateName = "USER_CREATED_SITE_WITH_LANGUAGE_AND_TEMPLATE";
public const string UserPuidValue = "USER_PUID_VALUE; {@user}";
public const string ErrorInRemoveRbacUser = "ERROR_REMOVE_RBAC_USER; {resourceGroupId}";
public const string ErrorInAddRbacUser = "ERROR_ADD_RBAC_USER; {@user} Count: {Count}";
public const string ErrorInCheckRbacUser = "ERROR_CHECK_RBAC_USER; {resourceGroupId}";
public const string RemoveUserFromTenant = "REMOVE_USER_FROM_TENANT; {userPrincipalId}";
public const string RemoveUserFromTenantResult = "REMOVE_USER_FROM_TENANT_RESULT; {@response}; {content}";
public const string UiEvent = "UI_EVENT; {eventName}; {@properties}";
public const string OldUiEvent = "UI_EVENT";
public const string NoRbacAccess = "NO_RBAC_ACCESS; {puid}; {email}";
public const string SearchGraphForUser = "SEARCH_GRAPH_FOR_USER; {@rbacUser}";
public const string SearchGraphResponse = "SEARCH_GRAPH_RESPONSE; {@response}";
public const string InviteUser = "INVITE_USER; {@rbacUser}";
public const string RedeemUserInvitation = "REDEEM_USER_INVITATION";
public const string UserAlreadyInTenant = "USER_ALREADY_IN_TENANT; {objectId}";
public const string AssignRbacResult = "ASSIGN_RBAC_RESULT; {csmResponseStatusCode}";
public const string FailedToAddRbacAccess = "FAILED_TO_ADD_RBAC_ACCESS";
public const string UserAddedToTenant = "USER_ADDED_TO_TENANT; {objectId}";
public const string AnonymousUserCreated = "ANONYMOUS_USER_CREATED";
public const string AnonymousUserLogedIn = "ANONYMOUS_USER_LOGEDIN";
}
}
| apache-2.0 | C# |
8aa1c539694798b85bba5b6a5660b10c9d60eec3 | Fix IPv6 support. | yonglehou/msgpack-rpc-cli,yfakariya/msgpack-rpc-cli | src/MsgPack.Rpc/Rpc/NetworkEnvironment.cs | src/MsgPack.Rpc/Rpc/NetworkEnvironment.cs | #region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --
using System;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
namespace MsgPack.Rpc
{
internal static class NetworkEnvironment
{
internal static EndPoint GetDefaultEndPoint( int port, bool preferIPv4 )
{
var iface = NetworkInterface.GetAllNetworkInterfaces().FirstOrDefault();
if ( iface != null )
{
bool canUseIPv6;
try
{
iface.GetIPProperties().GetIPv6Properties();
canUseIPv6 = true;
}
catch ( NetworkInformationException )
{
canUseIPv6 = false;
}
var ipProperties = iface.GetIPProperties();
if ( ipProperties.UnicastAddresses.Any() )
{
UnicastIPAddressInformation address = null;
if ( canUseIPv6 && !preferIPv4 )
{
address = ipProperties.UnicastAddresses.FirstOrDefault( item => item.Address.AddressFamily == AddressFamily.InterNetworkV6 );
}
if ( address == null )
{
address = ipProperties.UnicastAddresses.FirstOrDefault();
}
if ( address != null )
{
return new IPEndPoint( address.Address, port );
}
}
}
return new IPEndPoint( preferIPv4 ? IPAddress.Any : IPAddress.IPv6Any, port );
}
}
}
| #region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --
using System;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
namespace MsgPack.Rpc
{
internal static class NetworkEnvironment
{
internal static EndPoint GetDefaultEndPoint( int port )
{
var iface = NetworkInterface.GetAllNetworkInterfaces().FirstOrDefault();
if ( iface != null )
{
bool canUseIPv6;
try
{
iface.GetIPProperties().GetIPv6Properties();
canUseIPv6 = true;
}
catch ( NetworkInformationException )
{
canUseIPv6 = false;
}
var ipProperties = iface.GetIPProperties();
if ( ipProperties.UnicastAddresses.Any() )
{
UnicastIPAddressInformation address = null;
if ( canUseIPv6 )
{
address = ipProperties.UnicastAddresses.FirstOrDefault( item => item.Address.AddressFamily == AddressFamily.InterNetworkV6 );
}
if ( address == null )
{
address = ipProperties.UnicastAddresses.FirstOrDefault();
}
if ( address != null )
{
return new IPEndPoint( address.Address, port );
}
}
}
return new IPEndPoint( IPAddress.Loopback, port );
}
}
}
| apache-2.0 | C# |
58f4efe9a0da35e665211d11b752ab8496075109 | Build number auto-increment | chall3ng3r/GameOn,chall3ng3r/GameOn | Soruce/Windows/GameOn/Properties/AssemblyInfo.cs | Soruce/Windows/GameOn/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("GameOn")]
[assembly: AssemblyDescription("Run Unity3D games from browser with a click. Icon by pixelkit.com")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("chall3ng3r.com")]
[assembly: AssemblyProduct("GameOn")]
[assembly: AssemblyCopyright("Copyright © chall3ng3r.com 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("40028eab-2139-4b8d-aa34-81dc5b4e7186")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.*")]
//[assembly: AssemblyFileVersion("0.9.2048.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("GameOn")]
[assembly: AssemblyDescription("Run Unity3D games from browser with a click. Icon by pixelkit.com")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("chall3ng3r.com")]
[assembly: AssemblyProduct("GameOn")]
[assembly: AssemblyCopyright("Copyright © chall3ng3r.com 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("40028eab-2139-4b8d-aa34-81dc5b4e7186")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.2048.0")]
[assembly: AssemblyFileVersion("0.9.2048.0")]
| mit | C# |
cfce8a66850ddd8f4feacc1e839cbf1790a96286 | initialize mock spy with let | BaylorRae/Let.cs | tests/Let.cs.Tests/IntegrationTest.cs | tests/Let.cs.Tests/IntegrationTest.cs | using Moq;
using NUnit.Framework;
using System;
using LetTestHelper;
namespace Let.cs.Tests
{
[TestFixture]
public class IntegrationTest
{
private Mock<ISpy> MockSpy => LetHelper.Let("MockSpy", () => {
var mockSpy = new Mock<ISpy>();
mockSpy.Setup(spy => spy.DoSomething()).Returns(true);
return mockSpy;
});
private bool DoSomethingWithSpy => LetHelper.Let(() => MockSpy.Object.DoSomething());
[TearDown]
public void AfterEach()
{
LetHelper.Flush();
}
[Test]
public void ItLazilyInvokesTheCallback()
{
MockSpy.Verify(spy => spy.DoSomething(), Times.Exactly(0));
Assert.That(DoSomethingWithSpy, Is.True);
MockSpy.Verify(spy => spy.DoSomething(), Times.Exactly(1));
}
}
}
| using Moq;
using NUnit.Framework;
using System;
using LetTestHelper;
namespace Let.cs.Tests
{
[TestFixture]
public class IntegrationTest
{
private Mock<ISpy> MockSpy;
private bool DoSomethingWithSpy => LetHelper.Let(() => MockSpy.Object.DoSomething());
[SetUp]
public void BeforeEach()
{
MockSpy = new Mock<ISpy>();
MockSpy.Setup(spy => spy.DoSomething()).Returns(true);
}
[TearDown]
public void AfterEach()
{
LetHelper.Flush();
}
[Test]
public void ItLazilyInvokesTheCallback()
{
MockSpy.Verify(spy => spy.DoSomething(), Times.Exactly(0));
Assert.That(DoSomethingWithSpy, Is.True);
MockSpy.Verify(spy => spy.DoSomething(), Times.Exactly(1));
}
}
}
| mit | C# |
13f798101087aff3f7120a83078044411bf96edf | Rename Callback to Configure in UseConnections (#1939) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNetCore.Http.Connections/ConnectionsAppBuilderExtensions.cs | src/Microsoft.AspNetCore.Http.Connections/ConnectionsAppBuilderExtensions.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 Microsoft.AspNetCore.Http.Connections;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Builder
{
public static class ConnectionsAppBuilderExtensions
{
public static IApplicationBuilder UseConnections(this IApplicationBuilder app, Action<ConnectionsRouteBuilder> configure)
{
if (configure == null)
{
throw new ArgumentNullException(nameof(configure));
}
var dispatcher = app.ApplicationServices.GetRequiredService<HttpConnectionDispatcher>();
var routes = new RouteBuilder(app);
configure(new ConnectionsRouteBuilder(routes, dispatcher));
app.UseWebSockets();
app.UseRouter(routes.Build());
return app;
}
}
}
| // 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 Microsoft.AspNetCore.Http.Connections;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Builder
{
public static class ConnectionsAppBuilderExtensions
{
public static IApplicationBuilder UseConnections(this IApplicationBuilder app, Action<ConnectionsRouteBuilder> callback)
{
var dispatcher = app.ApplicationServices.GetRequiredService<HttpConnectionDispatcher>();
var routes = new RouteBuilder(app);
callback(new ConnectionsRouteBuilder(routes, dispatcher));
app.UseWebSockets();
app.UseRouter(routes.Build());
return app;
}
}
}
| apache-2.0 | C# |
6dcdc3b8af5c7b6f291101f797668f45664c6fae | Switch off schema driven document validation (#5286) | dotnet/docfx,dotnet/docfx,superyyrrzz/docfx,superyyrrzz/docfx,superyyrrzz/docfx,dotnet/docfx | src/Microsoft.DocAsCode.Build.SchemaDriven/Processors/MarkdownInterpreter.cs | src/Microsoft.DocAsCode.Build.SchemaDriven/Processors/MarkdownInterpreter.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.Build.SchemaDriven.Processors
{
using System;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Plugins;
using HtmlAgilityPack;
public class MarkdownInterpreter : IInterpreter
{
public bool CanInterpret(BaseSchema schema)
{
return schema != null && schema.ContentType == ContentType.Markdown;
}
public object Interpret(BaseSchema schema, object value, IProcessContext context, string path)
{
if (value == null || !CanInterpret(schema))
{
return value;
}
if (!(value is string val))
{
throw new ArgumentException($"{value.GetType()} is not supported type string.");
}
return MarkupCore(val, context, path);
}
private static string MarkupCore(string content, IProcessContext context, string path)
{
var host = context.Host;
var mr = host.Markup(content, context.GetOriginalContentFile(path));
(context.FileLinkSources).Merge(mr.FileLinkSources);
(context.UidLinkSources).Merge(mr.UidLinkSources);
(context.Dependency).UnionWith(mr.Dependency);
if (mr.Html.StartsWith(@"<p"))
mr.Html = mr.Html.Insert(mr.Html.IndexOf(@">"), " jsonPath=\"" + path + "\"");
return mr.Html;
}
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.Build.SchemaDriven.Processors
{
using System;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Plugins;
using HtmlAgilityPack;
public class MarkdownInterpreter : IInterpreter
{
public bool CanInterpret(BaseSchema schema)
{
return schema != null && schema.ContentType == ContentType.Markdown;
}
public object Interpret(BaseSchema schema, object value, IProcessContext context, string path)
{
if (value == null || !CanInterpret(schema))
{
return value;
}
if (!(value is string val))
{
throw new ArgumentException($"{value.GetType()} is not supported type string.");
}
return MarkupCore(val, context, path);
}
private static string MarkupCore(string content, IProcessContext context, string path)
{
var host = context.Host;
var mr = host.Markup(content, context.GetOriginalContentFile(path), false, true);
(context.FileLinkSources).Merge(mr.FileLinkSources);
(context.UidLinkSources).Merge(mr.UidLinkSources);
(context.Dependency).UnionWith(mr.Dependency);
if (mr.Html.StartsWith(@"<p"))
mr.Html = mr.Html.Insert(mr.Html.IndexOf(@">"), " jsonPath=\"" + path + "\"");
return mr.Html;
}
}
}
| mit | C# |
2454f5e48bd3c41670090e788c5766bead92249f | remove unused comments. | dotnetcore/CAP,dotnetcore/CAP,ouraspnet/cap,dotnetcore/CAP | test/DotNetCore.CAP.EntityFrameworkCore.Test/ConnectionUtil.cs | test/DotNetCore.CAP.EntityFrameworkCore.Test/ConnectionUtil.cs | using System;
using System.Data.SqlClient;
namespace DotNetCore.CAP.EntityFrameworkCore.Test
{
public static class ConnectionUtil
{
private const string DatabaseVariable = "Cap_SqlServer_DatabaseName";
private const string ConnectionStringTemplateVariable = "Cap_SqlServer_ConnectionStringTemplate";
private const string MasterDatabaseName = "master";
private const string DefaultDatabaseName = @"DotNetCore.CAP.EntityFrameworkCore.Test";
private const string DefaultConnectionStringTemplate = @"Server=192.168.2.206;Initial Catalog={0};User Id=sa;Password=123123;MultipleActiveResultSets=True";
public static string GetDatabaseName()
{
return Environment.GetEnvironmentVariable(DatabaseVariable) ?? DefaultDatabaseName;
}
public static string GetMasterConnectionString()
{
return string.Format(GetConnectionStringTemplate(), MasterDatabaseName);
}
public static string GetConnectionString()
{
return string.Format(GetConnectionStringTemplate(), GetDatabaseName());
}
private static string GetConnectionStringTemplate()
{
return
Environment.GetEnvironmentVariable(ConnectionStringTemplateVariable) ??
DefaultConnectionStringTemplate;
}
public static SqlConnection CreateConnection(string connectionString = null)
{
connectionString = connectionString ?? GetConnectionString();
var connection = new SqlConnection(connectionString);
connection.Open();
return connection;
}
}
}
| using System;
using System.Data.SqlClient;
namespace DotNetCore.CAP.EntityFrameworkCore.Test
{
public static class ConnectionUtil
{
private const string DatabaseVariable = "Cap_SqlServer_DatabaseName";
private const string ConnectionStringTemplateVariable = "Cap_SqlServer_ConnectionStringTemplate";
private const string MasterDatabaseName = "master";
private const string DefaultDatabaseName = @"DotNetCore.CAP.EntityFrameworkCore.Test";
//private const string DefaultConnectionStringTemplate = @"Server=.\sqlexpress;Database={0};Trusted_Connection=True;";
private const string DefaultConnectionStringTemplate = @"Server=192.168.2.206;Initial Catalog={0};User Id=sa;Password=123123;MultipleActiveResultSets=True";
public static string GetDatabaseName()
{
return Environment.GetEnvironmentVariable(DatabaseVariable) ?? DefaultDatabaseName;
}
public static string GetMasterConnectionString()
{
return string.Format(GetConnectionStringTemplate(), MasterDatabaseName);
}
public static string GetConnectionString()
{
//if (Environment.GetEnvironmentVariable("ASPNETCore_Environment") == "Development")
//{
// return "Server=192.168.2.206;Initial Catalog=Test2;User Id=cmswuliu;Password=h7xY81agBn*Veiu3;MultipleActiveResultSets=True";
//}
return string.Format(GetConnectionStringTemplate(), GetDatabaseName());
}
private static string GetConnectionStringTemplate()
{
return
Environment.GetEnvironmentVariable(ConnectionStringTemplateVariable) ??
DefaultConnectionStringTemplate;
}
public static SqlConnection CreateConnection(string connectionString = null)
{
connectionString = connectionString ?? GetConnectionString();
var connection = new SqlConnection(connectionString);
connection.Open();
return connection;
}
}
}
| mit | C# |
6003f606458255666dc33db00714ef0d15969061 | add refresh_token to scrub list in token request logger | IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4 | src/IdentityServer4/Logging/Models/TokenRequestValidationLog.cs | src/IdentityServer4/Logging/Models/TokenRequestValidationLog.cs | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Validation;
using System.Collections.Generic;
namespace IdentityServer4.Logging
{
internal class TokenRequestValidationLog
{
public string ClientId { get; set; }
public string ClientName { get; set; }
public string GrantType { get; set; }
public string Scopes { get; set; }
public string AuthorizationCode { get; set; }
public string RefreshToken { get; set; }
public string UserName { get; set; }
public IEnumerable<string> AuthenticationContextReferenceClasses { get; set; }
public string Tenant { get; set; }
public string IdP { get; set; }
public Dictionary<string, string> Raw { get; set; }
private static readonly string[] SensitiveValuesFilter =
{
OidcConstants.TokenRequest.ClientSecret,
OidcConstants.TokenRequest.Password,
OidcConstants.TokenRequest.ClientAssertion,
OidcConstants.TokenRequest.RefreshToken
};
public TokenRequestValidationLog(ValidatedTokenRequest request)
{
Raw = request.Raw.ToScrubbedDictionary(SensitiveValuesFilter);
if (request.Client != null)
{
ClientId = request.Client.ClientId;
ClientName = request.Client.ClientName;
}
if (request.Scopes != null)
{
Scopes = request.Scopes.ToSpaceSeparatedString();
}
GrantType = request.GrantType;
AuthorizationCode = request.AuthorizationCodeHandle;
RefreshToken = request.RefreshTokenHandle;
UserName = request.UserName;
}
public override string ToString()
{
return LogSerializer.Serialize(this);
}
}
} | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Validation;
using System.Collections.Generic;
namespace IdentityServer4.Logging
{
internal class TokenRequestValidationLog
{
public string ClientId { get; set; }
public string ClientName { get; set; }
public string GrantType { get; set; }
public string Scopes { get; set; }
public string AuthorizationCode { get; set; }
public string RefreshToken { get; set; }
public string UserName { get; set; }
public IEnumerable<string> AuthenticationContextReferenceClasses { get; set; }
public string Tenant { get; set; }
public string IdP { get; set; }
public Dictionary<string, string> Raw { get; set; }
private static readonly string[] SensitiveValuesFilter = {
OidcConstants.TokenRequest.ClientSecret,
OidcConstants.TokenRequest.Password,
OidcConstants.TokenRequest.ClientAssertion
};
public TokenRequestValidationLog(ValidatedTokenRequest request)
{
Raw = request.Raw.ToScrubbedDictionary(SensitiveValuesFilter);
if (request.Client != null)
{
ClientId = request.Client.ClientId;
ClientName = request.Client.ClientName;
}
if (request.Scopes != null)
{
Scopes = request.Scopes.ToSpaceSeparatedString();
}
GrantType = request.GrantType;
AuthorizationCode = request.AuthorizationCodeHandle;
RefreshToken = request.RefreshTokenHandle;
UserName = request.UserName;
}
public override string ToString()
{
return LogSerializer.Serialize(this);
}
}
} | apache-2.0 | C# |
a9124a1c228f9cc95c6a69cf45448051c8d8e824 | add missing Id field to Invoice model | FacturAPI/facturapi-net | facturapi-net/Models/Invoice.cs | facturapi-net/Models/Invoice.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Facturapi
{
public class Invoice
{
public string Id { get; set; }
public DateTime CreatedAt { get; set; }
public bool Livemode { get; set; }
public Customer Customer { get; set; }
public List<InvoiceItem> Items { get; set; }
public string PaymentForm { get; set; }
public static Task<SearchResult<Invoice>> ListAsync(Dictionary<string, object> query = null)
{
return new Wrapper().ListInvoices(query);
}
public static Task<Invoice> CreateAsync(Dictionary<string, object> data)
{
return new Wrapper().CreateInvoice(data);
}
public static Task<Invoice> RetrieveAsync(string id)
{
return new Wrapper().RetrieveInvoice(id);
}
public static Task<Invoice> CancelAsync(string id)
{
return new Wrapper().CancelInvoice(id);
}
public static Task SendByEmail(string id)
{
return new Wrapper().SendInvoiceByEmail(id);
}
public static Task<Stream> DownloadXml(string id)
{
return new Wrapper().DownloadXml(id);
}
public static Task<Stream> DownloadPdf(string id)
{
return new Wrapper().DownloadPdf(id);
}
public static Task<Stream> DownloadZip(string id)
{
return new Wrapper().DownloadZip(id);
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Facturapi
{
public class Invoice
{
public DateTime CreatedAt { get; set; }
public bool Livemode { get; set; }
public Customer Customer { get; set; }
public List<InvoiceItem> Items { get; set; }
public string PaymentForm { get; set; }
public static Task<SearchResult<Invoice>> ListAsync(Dictionary<string, object> query = null)
{
return new Wrapper().ListInvoices(query);
}
public static Task<Invoice> CreateAsync(Dictionary<string, object> data)
{
return new Wrapper().CreateInvoice(data);
}
public static Task<Invoice> RetrieveAsync(string id)
{
return new Wrapper().RetrieveInvoice(id);
}
public static Task<Invoice> CancelAsync(string id)
{
return new Wrapper().CancelInvoice(id);
}
public static Task SendByEmail(string id)
{
return new Wrapper().SendInvoiceByEmail(id);
}
public static Task<Stream> DownloadXml(string id)
{
return new Wrapper().DownloadXml(id);
}
public static Task<Stream> DownloadPdf(string id)
{
return new Wrapper().DownloadPdf(id);
}
public static Task<Stream> DownloadZip(string id)
{
return new Wrapper().DownloadZip(id);
}
}
}
| mit | C# |
915b8e12292a4e51d6739ac6f3f21f69d4835c99 | Improve comment. | MichalStrehovsky/roslyn,KevinRansom/roslyn,orthoxerox/roslyn,brettfo/roslyn,MattWindsor91/roslyn,MattWindsor91/roslyn,srivatsn/roslyn,xasx/roslyn,zooba/roslyn,akrisiun/roslyn,diryboy/roslyn,khyperia/roslyn,CaptainHayashi/roslyn,jcouv/roslyn,bkoelman/roslyn,MichalStrehovsky/roslyn,jmarolf/roslyn,mgoertz-msft/roslyn,dotnet/roslyn,jeffanders/roslyn,robinsedlaczek/roslyn,ErikSchierboom/roslyn,shyamnamboodiripad/roslyn,dpoeschl/roslyn,genlu/roslyn,AlekseyTs/roslyn,robinsedlaczek/roslyn,Giftednewt/roslyn,diryboy/roslyn,bartdesmet/roslyn,kelltrick/roslyn,lorcanmooney/roslyn,KevinRansom/roslyn,tmeschter/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,TyOverby/roslyn,stephentoub/roslyn,dotnet/roslyn,wvdd007/roslyn,tmat/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,paulvanbrenk/roslyn,gafter/roslyn,xasx/roslyn,jcouv/roslyn,tvand7093/roslyn,mattscheffer/roslyn,panopticoncentral/roslyn,CyrusNajmabadi/roslyn,gafter/roslyn,CaptainHayashi/roslyn,akrisiun/roslyn,abock/roslyn,wvdd007/roslyn,Hosch250/roslyn,jamesqo/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,nguerrera/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,zooba/roslyn,jmarolf/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,gafter/roslyn,jcouv/roslyn,lorcanmooney/roslyn,MattWindsor91/roslyn,dpoeschl/roslyn,OmarTawfik/roslyn,heejaechang/roslyn,yeaicc/roslyn,jamesqo/roslyn,Hosch250/roslyn,nguerrera/roslyn,mavasani/roslyn,kelltrick/roslyn,reaction1989/roslyn,khyperia/roslyn,tmeschter/roslyn,physhi/roslyn,stephentoub/roslyn,davkean/roslyn,dotnet/roslyn,wvdd007/roslyn,Giftednewt/roslyn,nguerrera/roslyn,heejaechang/roslyn,paulvanbrenk/roslyn,DustinCampbell/roslyn,tmat/roslyn,reaction1989/roslyn,jkotas/roslyn,jeffanders/roslyn,agocke/roslyn,mattscheffer/roslyn,eriawan/roslyn,pdelvo/roslyn,CyrusNajmabadi/roslyn,agocke/roslyn,jkotas/roslyn,TyOverby/roslyn,AlekseyTs/roslyn,khyperia/roslyn,robinsedlaczek/roslyn,DustinCampbell/roslyn,kelltrick/roslyn,OmarTawfik/roslyn,AnthonyDGreen/roslyn,weltkante/roslyn,mmitche/roslyn,AlekseyTs/roslyn,AnthonyDGreen/roslyn,abock/roslyn,AmadeusW/roslyn,mgoertz-msft/roslyn,tvand7093/roslyn,tannergooding/roslyn,bkoelman/roslyn,cston/roslyn,brettfo/roslyn,swaroop-sridhar/roslyn,tvand7093/roslyn,KevinRansom/roslyn,srivatsn/roslyn,ErikSchierboom/roslyn,mmitche/roslyn,yeaicc/roslyn,AmadeusW/roslyn,akrisiun/roslyn,jamesqo/roslyn,diryboy/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,DustinCampbell/roslyn,reaction1989/roslyn,amcasey/roslyn,cston/roslyn,jasonmalinowski/roslyn,zooba/roslyn,mattwar/roslyn,sharwell/roslyn,TyOverby/roslyn,VSadov/roslyn,VSadov/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,agocke/roslyn,yeaicc/roslyn,orthoxerox/roslyn,bkoelman/roslyn,sharwell/roslyn,genlu/roslyn,AnthonyDGreen/roslyn,paulvanbrenk/roslyn,KirillOsenkov/roslyn,jeffanders/roslyn,srivatsn/roslyn,CaptainHayashi/roslyn,weltkante/roslyn,drognanar/roslyn,panopticoncentral/roslyn,pdelvo/roslyn,physhi/roslyn,pdelvo/roslyn,swaroop-sridhar/roslyn,VSadov/roslyn,tmat/roslyn,bartdesmet/roslyn,drognanar/roslyn,mgoertz-msft/roslyn,Giftednewt/roslyn,tmeschter/roslyn,orthoxerox/roslyn,physhi/roslyn,stephentoub/roslyn,jkotas/roslyn,MichalStrehovsky/roslyn,swaroop-sridhar/roslyn,AmadeusW/roslyn,cston/roslyn,abock/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,amcasey/roslyn,xasx/roslyn,OmarTawfik/roslyn,aelij/roslyn,mavasani/roslyn,panopticoncentral/roslyn,mattwar/roslyn,aelij/roslyn,heejaechang/roslyn,Hosch250/roslyn,mavasani/roslyn,lorcanmooney/roslyn,davkean/roslyn,dpoeschl/roslyn,tannergooding/roslyn,mattscheffer/roslyn,eriawan/roslyn,brettfo/roslyn,mmitche/roslyn,MattWindsor91/roslyn,davkean/roslyn,drognanar/roslyn,mattwar/roslyn,amcasey/roslyn,aelij/roslyn,genlu/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn | src/Workspaces/Core/Desktop/Workspace/Storage/StorageOptions.cs | src/Workspaces/Core/Desktop/Workspace/Storage/StorageOptions.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.Options;
namespace Microsoft.CodeAnalysis.Storage
{
internal static class StorageOptions
{
public const string OptionName = "FeatureManager/Storage";
public static readonly Option<StorageDatabase> Database = new Option<StorageDatabase>(
OptionName, nameof(Database), defaultValue: StorageDatabase.Esent);
/// <summary>
/// Solution size threshold to start to use a DB (Default: 50MB)
/// </summary>
public static readonly Option<int> SolutionSizeThreshold = new Option<int>(
OptionName, nameof(SolutionSizeThreshold), defaultValue: 50 * 1024 * 1024);
}
} | // 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.Options;
namespace Microsoft.CodeAnalysis.Storage
{
internal static class StorageOptions
{
public const string OptionName = "FeatureManager/Storage";
public static readonly Option<StorageDatabase> Database = new Option<StorageDatabase>(
OptionName, nameof(Database), defaultValue: StorageDatabase.Esent);
/// <summary>
/// Threshold to start to use a DB (50MB)
/// </summary>
public static readonly Option<int> SolutionSizeThreshold = new Option<int>(
OptionName, nameof(SolutionSizeThreshold), defaultValue: 50 * 1024 * 1024);
}
} | mit | C# |
0cb439c3abc04c77a1f3fbb1771c6f883e2e69cd | Rename Precondition to Preconditions | jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode | CSharp8/Nullability/Preconditions.cs | CSharp8/Nullability/Preconditions.cs | using System;
using System.Diagnostics.CodeAnalysis;
namespace Nullability
{
class Preconditions
{
static void Main()
{
string? text = MaybeNull();
string textNotNull = CheckNotNull(text);
// This is relatively obvious...
Console.WriteLine(textNotNull.Length);
// This is less so. The NotNull attribute implies that the
// method will be validating the input, so the method
// won't return if the value is null.
Console.WriteLine(text.Length);
}
internal static T CheckNotNull<T>([NotNull] T? input) where T : class =>
input ?? throw new ArgumentNullException();
internal static string? MaybeNull() => DateTime.UtcNow.Second == 0 ? null : "not null";
}
}
| using System;
using System.Diagnostics.CodeAnalysis;
namespace Nullability
{
class Precondition
{
static void Main()
{
string? text = MaybeNull();
string textNotNull = CheckNotNull(text);
// This is relatively obvious...
Console.WriteLine(textNotNull.Length);
// This is less so. The NotNull attribute implies that the
// method will be validating the input, so the method
// won't return if the value is null.
Console.WriteLine(text.Length);
}
internal static T CheckNotNull<T>([NotNull] T? input) where T : class =>
input ?? throw new ArgumentNullException();
internal static string? MaybeNull() => DateTime.UtcNow.Second == 0 ? null : "not null";
}
}
| apache-2.0 | C# |
2fed323150dc4be4c8bc2bee96c836455d7f4a6c | Add display properties for soldier properites | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | BatteryCommander.Common/Models/Soldier.cs | BatteryCommander.Common/Models/Soldier.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BatteryCommander.Common.Models
{
public class Soldier
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required, StringLength(50)]
[Display(Name = "Last Name")]
public String LastName { get; set; }
[Required, StringLength(50)]
[Display(Name = "First Name")]
public String FirstName { get; set; }
[Required]
public Rank Rank { get; set; }
[Required]
public SoldierStatus Status { get; set; }
// TODO Position - PL, FDO, Section Chief, etc.
[Required]
public MOS MOS { get; set; }
[Required]
[Display(Name = "DMOSQ'd?")]
public Boolean IsDutyMOSQualified { get; set; }
[Required]
[Display(Name = "Highest Military Ed")]
public MilitaryEducationLevel EducationLevelCompleted { get; set; }
[Required]
public Group Group { get; set; }
[DataType(DataType.Date)]
[Display(Name = "ETS Date")]
public DateTime? ETSDate { get; set; }
public virtual ICollection<SoldierQualification> Qualifications { get; set; }
[StringLength(300)]
public String Notes { get; set; }
public Soldier()
{
this.Rank = Models.Rank.E1;
this.Status = Models.SoldierStatus.Active;
this.MOS = Models.MOS.Unknown;
this.EducationLevelCompleted = MilitaryEducationLevel.None;
this.Group = Models.Group.GhostGuns;
this.Qualifications = new List<SoldierQualification>();
}
}
} | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BatteryCommander.Common.Models
{
public class Soldier
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required, StringLength(50)]
public String LastName { get; set; }
[Required, StringLength(50)]
public String FirstName { get; set; }
[Required]
public Rank Rank { get; set; }
[Required]
public SoldierStatus Status { get; set; }
// TODO Position - PL, FDO, Section Chief, etc.
[Required]
public MOS MOS { get; set; }
[Required]
public Boolean IsDutyMOSQualified { get; set; }
[Required]
public MilitaryEducationLevel EducationLevelCompleted { get; set; }
[Required]
public Group Group { get; set; }
[DataType(DataType.Date)]
public DateTime? ETSDate { get; set; }
public virtual ICollection<SoldierQualification> Qualifications { get; set; }
[StringLength(300)]
public String Notes { get; set; }
public Soldier()
{
this.Rank = Models.Rank.E1;
this.Status = Models.SoldierStatus.Active;
this.MOS = Models.MOS.Unknown;
this.EducationLevelCompleted = MilitaryEducationLevel.None;
this.Group = Models.Group.GhostGuns;
this.Qualifications = new List<SoldierQualification>();
}
}
} | mit | C# |
2a4fe340a8e495ed8b7a8b68e59e8fb6dcae84a6 | test 1 | Borayvor/ASP.NET-MVC-CourseProject,Borayvor/ASP.NET-MVC-CourseProject,Borayvor/ASP.NET-MVC-CourseProject | EntertainmentSystem/Web/EntertainmentSystem.Web/Controllers/HomeController.cs | EntertainmentSystem/Web/EntertainmentSystem.Web/Controllers/HomeController.cs | namespace EntertainmentSystem.Web.Controllers
{
using System.Web.Mvc;
using Common.Constants;
using Data.Models.Media;
using Infrastructure.Mapping;
using Services.Contracts.Media.Fetchers;
using ViewModels.Media;
public class HomeController : BaseController
{
private readonly IMediaContentFetcherService mediaFetcherService;
public HomeController(IMediaContentFetcherService mediaFetcherService)
{
this.mediaFetcherService = mediaFetcherService;
}
[HttpGet]
public ActionResult Index()
{
// TODO: check bug where wrong upload file
return this.View();
}
[HttpGet]
[ChildActionOnly]
[OutputCache(Duration = GlobalConstants.CacheMediaHomeDuration)]
public ActionResult GetMusic()
{
return this.ConditionalActionResult(
() => this.mediaFetcherService
.GetLast(ContentType.Music)
.To<MediaContentHomeViewModel>(),
(music) => this.PartialView("_MusicHomePartial", music));
}
[HttpGet]
[ChildActionOnly]
[OutputCache(Duration = GlobalConstants.CacheMediaHomeDuration)]
public ActionResult GetPictures()
{
return this.ConditionalActionResult(
() => this.mediaFetcherService
.GetLast(ContentType.Picture)
.To<MediaContentHomeViewModel>(),
(pictures) => this.PartialView("_PicturesHomePartial", pictures));
}
[HttpGet]
[ChildActionOnly]
[OutputCache(Duration = GlobalConstants.CacheMediaHomeDuration)]
public ActionResult GetVideos()
{
return this.ConditionalActionResult(
() => this.mediaFetcherService
.GetLast(ContentType.Video)
.To<MediaContentHomeViewModel>(),
(videos) => this.PartialView("_VideosHomePartial", videos));
}
[HttpGet]
public ActionResult Error()
{
return this.View();
}
}
}
| namespace EntertainmentSystem.Web.Controllers
{
using System.Web.Mvc;
using Common.Constants;
using Data.Models.Media;
using Infrastructure.Mapping;
using Services.Contracts.Media.Fetchers;
using ViewModels.Media;
public class HomeController : BaseController
{
private readonly IMediaContentFetcherService mediaFetcherService;
public HomeController(IMediaContentFetcherService mediaFetcherService)
{
this.mediaFetcherService = mediaFetcherService;
}
[HttpGet]
public ActionResult Index()
{
// TODO: check bug where wrong upload file
return this.View();
}
[HttpGet]
[ChildActionOnly]
[OutputCache(Duration = GlobalConstants.CacheMediaHomeDuration)]
public ActionResult GetMusic()
{
return this.ConditionalActionResult(
() => this.mediaFetcherService
.GetLast(ContentType.Music)
.To<MediaContentHomeViewModel>(),
(music) => this.PartialView("_MusicHomePartial", music));
}
[HttpGet]
[ChildActionOnly]
[OutputCache(Duration = GlobalConstants.CacheMediaHomeDuration)]
public ActionResult GetPictures()
{
return this.ConditionalActionResult(
() => this.mediaFetcherService
.GetLast(ContentType.Picture)
.To<MediaContentHomeViewModel>(),
(pictures) => this.PartialView("_PicturesHomePartial", pictures));
}
[HttpGet]
[ChildActionOnly]
[OutputCache(Duration = GlobalConstants.CacheMediaHomeDuration)]
public ActionResult GetVideos()
{
return this.ConditionalActionResult(
() => this.mediaFetcherService
.GetLast(ContentType.Video)
.To<MediaContentHomeViewModel>(),
(videos) => this.PartialView("_VideosHomePartial", videos));
}
[HttpGet]
public ActionResult Error()
{
return this.View();
}
}
}
| mit | C# |
94f98a9f38c3b718ac4b1745f663abfcf5d75521 | add merchant guid | Paymentsense/Dapper.SimpleSave | PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Application/ApplicationDetailsDto.cs | PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Application/ApplicationDetailsDto.cs | using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace PS.Mothership.Core.Common.Dto.Application
{
[DataContract]
public class ApplicationDetailsDto
{
[DataMember]
public Guid ApplicationGuid { get; set; }
[DataMember]
public Guid MerchantGuid { get; set; }
[DataMember]
public LegalInfoDto LegalInfo { get; set; }
[DataMember]
public IEnumerable<ApplicationDetailLocationDto> ApplicationDetailLocation { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace PS.Mothership.Core.Common.Dto.Application
{
[DataContract]
public class ApplicationDetailsDto
{
[DataMember]
public Guid ApplicationGuid { get; set; }
[DataMember]
public LegalInfoDto LegalInfo { get; set; }
[DataMember]
public IEnumerable<ApplicationDetailLocationDto> ApplicationDetailLocation { get; set; }
}
}
| mit | C# |
f687ac24d27432ed7f0b8ae2aef62794695529c4 | Fix refactor fail and add book reference | 0culus/ElectronicCash | BitCommitment/BitCommitmentProvider.cs | BitCommitment/BitCommitmentProvider.cs | using System;
namespace BitCommitment
{
/// <summary>
/// A class to perform bit commitment. It does not care what the input is; it's just a
/// facility for exchanging bit commitment messages. Based on Bruce Schneier's one-way
/// function method for committing bits. See p.87 of `Applied Cryptography`.
/// </summary>
public class BitCommitmentProvider
{
public byte[] AliceRandBytes1 { get; set; }
public byte[] AliceRandBytes2 { get; set; }
public byte[] AliceBytesToCommitBytesToCommit { get; set; }
public BitCommitmentProvider(byte[] randBytes1,
byte[] randBytes2,
byte[] bytesToCommit)
{
AliceRandBytes1 = randBytes1;
AliceRandBytes2 = randBytes2;
AliceBytesToCommitBytesToCommit = bytesToCommit;
}
public byte[] BitCommitMessage()
{
throw new NotImplementedException();
}
}
}
| using System;
namespace BitCommitment
{
/// <summary>
/// A class to perform bit commitment. It does not care what the input is; it's just a
/// facility for exchanging bit commitment messages. Based on Bruce Schneier's RandBytes1-way
/// function method for committing bits
/// </summary>
public class BitCommitmentProvider
{
public byte[] AliceRandBytes1 { get; set; }
public byte[] AliceRandBytes2 { get; set; }
public byte[] AliceBytesToCommitBytesToCommit { get; set; }
public BitCommitmentProvider(byte[] randBytes1,
byte[] randBytes2,
byte[] bytesToCommit)
{
AliceRandBytes1 = randBytes1;
AliceRandBytes2 = randBytes2;
AliceBytesToCommitBytesToCommit = bytesToCommit;
}
public byte[] BitCommitMessage()
{
throw new NotImplementedException();
}
}
}
| mit | C# |
25db60db94c1715ceb920bfb7c922840125d2653 | build fix | neuralaxis/cocotte | Cocotte/ServiceCollectionExtensions.cs | Cocotte/ServiceCollectionExtensions.cs | using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Cocotte
{
/// <summary>
/// Configuration options for Cocotte
/// </summary>
public class CocotteOptions
{
private Uri _uri;
private string _exchange;
private string _consumer;
internal IList<TopicHandlerSubscription> Handlers = new List<TopicHandlerSubscription>();
public Uri Uri { get { return _uri; } set { _uri = value ?? throw new ArgumentNullException(nameof(value)); } }
public string Exchange { get { return _exchange; } set { if (String.IsNullOrEmpty(value)) { throw new ArgumentNullException(nameof(value)); } _exchange = value; } }
public string Consumer { get { return _consumer; } set { if (String.IsNullOrEmpty(value)) { throw new ArgumentNullException(nameof(value)); } _consumer = value; } }
public void AddHandler<THandler,TMessage>(string binding, THandler handler) where THandler: IHandler<TMessage>
{
Handlers.Add(new TopicHandlerSubscription { BindingKey = binding, Handler = handler });
}
internal CocotteOptions() { }
}
internal class TopicHandlerSubscription
{
public object Handler;
public string BindingKey;
}
public static class ServiceCollectionExtensions
{
public static void AddCocotte(this IServiceCollection svcs, Action<CocotteOptions> setup = null)
{
if (svcs == null) throw new ArgumentNullException(nameof(svcs));
var opts = new CocotteOptions();
setup?.Invoke(opts);
if (opts.Uri == null) opts.Uri = new Uri("amqp://localhost:5672/");
if (opts.Exchange == null) opts.Exchange = "events";
if (opts.Consumer == null) opts.Consumer = Assembly.GetEntryAssembly().GetName().Name;
var coco = new TopicClient(opts.Uri, opts.Exchange, opts.Consumer);
svcs.AddSingleton<IPublisher>(coco);
svcs.AddSingleton<ISubscriber>(coco);
svcs.AddSingleton(coco);
}
}
}
| using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Cocotte
{
/// <summary>
/// Configuration options for Cocotte
/// </summary>
public class CocotteOptions
{
private Uri _uri;
private string _exchange;
private string _consumer;
internal IList<TopicHandlerSubscription> Handlers = new List<TopicHandlerSubscription>();
public Uri Uri { get => _uri; set => _uri = value ?? throw new ArgumentNullException(nameof(value)); }
public string Exchange { get => _exchange; set { if (String.IsNullOrEmpty(value)) { throw new ArgumentNullException(nameof(value)); } _exchange = value; } }
public string Consumer { get => _consumer; set { if (String.IsNullOrEmpty(value)) { throw new ArgumentNullException(nameof(value)); } _consumer = value; } }
public void AddHandler<THandler,TMessage>(string binding, THandler handler) where THandler: IHandler<TMessage>
{
Handlers.Add(new TopicHandlerSubscription { BindingKey = binding, Handler = handler });
}
internal CocotteOptions() { }
}
internal class TopicHandlerSubscription
{
public object Handler;
public string BindingKey;
}
public static class ServiceCollectionExtensions
{
public static void AddCocotte(this IServiceCollection svcs, Action<CocotteOptions> setup = null)
{
if (svcs == null) throw new ArgumentNullException(nameof(svcs));
var opts = new CocotteOptions();
setup?.Invoke(opts);
if (opts.Uri == null) opts.Uri = new Uri("amqp://localhost:5672/");
if (opts.Exchange == null) opts.Exchange = "events";
if (opts.Consumer == null) opts.Consumer = Assembly.GetEntryAssembly().GetName().Name;
var coco = new TopicClient(opts.Uri, opts.Exchange, opts.Consumer);
svcs.AddSingleton<IPublisher>(coco);
svcs.AddSingleton<ISubscriber>(coco);
svcs.AddSingleton(coco);
}
}
}
| mit | C# |
a810ed2ee9bc0ddb73baf0bca3ae27857170776a | Comment Section Update | shahriarhossain/MailChimp.Api.Net | MailChimp.Api.Net/Services/Reports/MCReportsDomainPerformance.cs | MailChimp.Api.Net/Services/Reports/MCReportsDomainPerformance.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using MailChimp.Api.Net.Domain.Reports;
using MailChimp.Api.Net.Enum;
using Newtonsoft.Json;
namespace MailChimp.Api.Net.Services.Reports
{
public class MCReportsDomainPerformance
{
/// <summary>
/// Return statistics for the top-performing domains from a campaign.
/// <param name="campaignId">Unique id for campaign</param>
/// </summary>
public async Task<DomainPerformance> GetDomainPerformanceAsync(string campaignId)
{
string endpoint = Authenticate.EndPoint(TargetTypes.reports, SubTargetType.domain_performance, SubTargetType.not_applicable, campaignId);
string content;
using (var client = new HttpClient())
{
Authenticate.ClientAuthentication(client);
content = await client.GetStringAsync(endpoint);
}
return JsonConvert.DeserializeObject<DomainPerformance>(content);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using MailChimp.Api.Net.Domain.Reports;
using MailChimp.Api.Net.Enum;
using Newtonsoft.Json;
namespace MailChimp.Api.Net.Services.Reports
{
public class MCReportsDomainPerformance
{
/// <summary>
/// Return statistics for the top-performing domains from a campaign.
/// <param name="campaignId">Campaign Id</param>
/// </summary>
public async Task<DomainPerformance> GetDomainPerformanceAsync(string campaignId)
{
string endpoint = Authenticate.EndPoint(TargetTypes.reports, SubTargetType.domain_performance, SubTargetType.not_applicable, campaignId);
string content;
using (var client = new HttpClient())
{
Authenticate.ClientAuthentication(client);
content = await client.GetStringAsync(endpoint);
}
return JsonConvert.DeserializeObject<DomainPerformance>(content);
}
}
}
| mit | C# |
4f10f2bd8bb667585d85f14ae2d5459d5dcb2bb3 | Undo NodejsPackageParametersExtension.cs whitespace merge issue | mousetraps/nodejstools,kant2002/nodejstools,Microsoft/nodejstools,avitalb/nodejstools,mousetraps/nodejstools,avitalb/nodejstools,kant2002/nodejstools,kant2002/nodejstools,paladique/nodejstools,mjbvz/nodejstools,paulvanbrenk/nodejstools,paladique/nodejstools,AustinHull/nodejstools,Microsoft/nodejstools,kant2002/nodejstools,lukedgr/nodejstools,mjbvz/nodejstools,paulvanbrenk/nodejstools,paulvanbrenk/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,munyirik/nodejstools,avitalb/nodejstools,munyirik/nodejstools,AustinHull/nodejstools,mjbvz/nodejstools,AustinHull/nodejstools,AustinHull/nodejstools,Microsoft/nodejstools,kant2002/nodejstools,paladique/nodejstools,paladique/nodejstools,paulvanbrenk/nodejstools,paladique/nodejstools,avitalb/nodejstools,avitalb/nodejstools,munyirik/nodejstools,Microsoft/nodejstools,Microsoft/nodejstools,lukedgr/nodejstools,mousetraps/nodejstools,paulvanbrenk/nodejstools,munyirik/nodejstools,mousetraps/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,munyirik/nodejstools,AustinHull/nodejstools,mousetraps/nodejstools,lukedgr/nodejstools | Nodejs/Product/ProjectWizard/NodejsPackageParametersExtension.cs | Nodejs/Product/ProjectWizard/NodejsPackageParametersExtension.cs | //*********************************************************//
// Copyright (c) Microsoft. All rights reserved.
//
// Apache 2.0 License
//
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
//*********************************************************//
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using EnvDTE;
using Microsoft.VisualStudio.TemplateWizard;
namespace Microsoft.NodejsTools.ProjectWizard {
class NodejsPackageParametersExtension : IWizard {
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) {
var projectName = replacementsDictionary["$projectname$"];
replacementsDictionary.Add("$npmsafeprojectname$", NormalizeNpmPackageName(projectName));
}
public void ProjectFinishedGenerating(EnvDTE.Project project) {
return;
}
public void ProjectItemFinishedGenerating(ProjectItem projectItem) {
return;
}
public bool ShouldAddProjectItem(string filePath) {
return true;
}
public void BeforeOpeningFile(ProjectItem projectItem) {
return;
}
public void RunFinished() {
return;
}
private const int NpmPackageNameMaxLength = 214;
/// <summary>
/// Normalize a project name to be a valid Npm package name: https://docs.npmjs.com/files/package.json#name
/// </summary>
/// <param name="projectName">Name of a VS project.</param>
private static string NormalizeNpmPackageName(string projectName) {
// Remove all leading url-invalid, underscore, and period characters
var npmProjectNameTransform = Regex.Replace(projectName, "^[^a-zA-Z0-9-~]*", string.Empty);
// Replace all invalid characters with a dash
npmProjectNameTransform = Regex.Replace(npmProjectNameTransform, "[^a-zA-Z0-9-_~.]", "-");
// Insert hyphens between camelcased sections.
npmProjectNameTransform = Regex.Replace(npmProjectNameTransform, "([a-z0-9])([A-Z])", "$1-$2").ToLowerInvariant();
return npmProjectNameTransform.Substring(0, Math.Min(npmProjectNameTransform.Length, NpmPackageNameMaxLength));
}
}
}
| //*********************************************************//
// Copyright (c) Microsoft. All rights reserved.
//
// Apache 2.0 License
//
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
//*********************************************************//
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using EnvDTE;
using Microsoft.VisualStudio.TemplateWizard;
namespace Microsoft.NodejsTools.ProjectWizard {
class NodejsPackageParametersExtension : IWizard {
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) {
var projectName = replacementsDictionary["$projectname$"];
replacementsDictionary.Add("$npmsafeprojectname$", NormalizeNpmPackageName(projectName));
}
public void ProjectFinishedGenerating(EnvDTE.Project project) {
return;
}
public void ProjectItemFinishedGenerating(ProjectItem projectItem) {
return;
}
public bool ShouldAddProjectItem(string filePath) {
return true;
}
public void BeforeOpeningFile(ProjectItem projectItem) {
return;
}
public void RunFinished() {
return;
}
private const int NpmPackageNameMaxLength = 214;
/// <summary>
/// Normalize a project name to be a valid Npm package name: https://docs.npmjs.com/files/package.json#name
/// </summary>
/// <param name="projectName">Name of a VS project.</param>
private static string NormalizeNpmPackageName(string projectName) {
// Remove all leading url-invalid, underscore, and period characters
var npmProjectNameTransform = Regex.Replace(projectName, "^[^a-zA-Z0-9-~]*", string.Empty);
// Replace all invalid characters with a dash
npmProjectNameTransform = Regex.Replace(npmProjectNameTransform, "[^a-zA-Z0-9-_~.]", "-");
// Insert hyphens between camelcased sections.
npmProjectNameTransform = Regex.Replace(npmProjectNameTransform, "([a-z0-9])([A-Z])", "$1-$2").ToLowerInvariant();
return npmProjectNameTransform.Substring(0, Math.Min(npmProjectNameTransform.Length, NpmPackageNameMaxLength));
}
}
}
| apache-2.0 | C# |
216b59cf5ee4cf74e0035f6459ac5e987e6e9081 | Update ActionRepository | HatfieldConsultants/Hatfield.EnviroData.Core | Source/Hatfield.EnviroData.Core/Repositories/ActionRepository.cs | Source/Hatfield.EnviroData.Core/Repositories/ActionRepository.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Hatfield.EnviroData.Core.Repositories
{
public class ActionRepository : Repository<Action>, IActionRepository
{
private static readonly string ISChildOfRelationshipCV = "Is child of";
public ActionRepository(IDbContext dbContext)
: base(dbContext)
{
}
public Action GetActionById(int Id)
{
var matchedAction = _dbContext.Query<Action>().Where(x => x.ActionID == Id).FirstOrDefault();
return matchedAction;
}
public IEnumerable<Action> GetAllSampleCollectionActions()
{
var dbContext = (ODM2Entities)_dbContext;
var sampleCollectionActions = (from action in dbContext.Actions
join relatedAction in dbContext.RelatedActions
on action.ActionID equals relatedAction.RelatedActionID
where relatedAction.RelationshipTypeCV == ISChildOfRelationshipCV
select action)
.Distinct()
.OrderBy(x => x.BeginDateTime);
return sampleCollectionActions.ToList();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Hatfield.EnviroData.Core.Repositories
{
public class ActionRepository : Repository<Action>, IActionRepository
{
private static readonly string ISChildOfRelationshipCV = "isChildOf";
public ActionRepository(IDbContext dbContext)
: base(dbContext)
{
}
public Action GetActionById(int Id)
{
var matchedAction = _dbContext.Query<Action>().Where(x => x.ActionID == Id).FirstOrDefault();
return matchedAction;
}
public IEnumerable<Action> GetAllSampleCollectionActions()
{
var dbContext = (ODM2Entities)_dbContext;
var sampleCollectionActions = (from action in dbContext.Actions
join relatedAction in dbContext.RelatedActions
on action.ActionID equals relatedAction.RelatedActionID
where relatedAction.RelationshipTypeCV == ISChildOfRelationshipCV
select action)
.Distinct()
.OrderBy(x => x.BeginDateTime);
return sampleCollectionActions.ToList();
}
}
} | mpl-2.0 | C# |
ed8bdd4cc473f487f6019778027abeeb3a956a9a | Change domain id to new naming format | TeaCommerce/Tea-Commerce-for-Umbraco,TeaCommerce/Tea-Commerce-for-Umbraco,TeaCommerce/Tea-Commerce-for-Umbraco | Source/TeaCommerce.Umbraco.Configuration/Compatibility/Domain.cs | Source/TeaCommerce.Umbraco.Configuration/Compatibility/Domain.cs | using System.Collections.Generic;
using System.Linq;
using TeaCommerce.Api.Infrastructure.Caching;
using Umbraco.Core;
namespace TeaCommerce.Umbraco.Configuration.Compatibility {
public static class Domain {
private const string CacheKey = "Domains";
public static umbraco.cms.businesslogic.web.Domain[] GetDomainsById( int nodeId ) {
List<umbraco.cms.businesslogic.web.Domain> domains = CacheService.Instance.GetCacheValue<List<umbraco.cms.businesslogic.web.Domain>>( CacheKey );
if ( domains == null ) {
domains = new List<umbraco.cms.businesslogic.web.Domain>();
List<dynamic> result = ApplicationContext.Current.DatabaseContext.Database.Fetch<dynamic>( "select id, domainName from umbracoDomains" );
foreach ( dynamic domain in result ) {
if ( domains.All( d => d.Name != domain.domainName ) ) {
domains.Add( new umbraco.cms.businesslogic.web.Domain( domain.id ) );
}
}
CacheService.Instance.SetCacheValue( CacheKey, domains );
}
return domains.Where( d => d.RootNodeId == nodeId ).ToArray();
}
public static void InvalidateCache() {
CacheService.Instance.Invalidate( CacheKey );
}
}
} | using System.Collections.Generic;
using System.Linq;
using TeaCommerce.Api.Infrastructure.Caching;
using Umbraco.Core;
namespace TeaCommerce.Umbraco.Configuration.Compatibility {
public static class Domain {
private const string CacheKey = "Domains";
public static umbraco.cms.businesslogic.web.Domain[] GetDomainsById( int nodeId ) {
List<umbraco.cms.businesslogic.web.Domain> domains = CacheService.Instance.GetCacheValue<List<umbraco.cms.businesslogic.web.Domain>>( CacheKey );
if ( domains == null ) {
domains = new List<umbraco.cms.businesslogic.web.Domain>();
List<dynamic> result = ApplicationContext.Current.DatabaseContext.Database.Fetch<dynamic>( "select id, domainName from umbracoDomains" );
foreach ( dynamic domain in result ) {
if ( domains.All( d => d.Name != domain.domainName ) ) {
domains.Add( new umbraco.cms.businesslogic.web.Domain( domain.domainId ) );
}
}
CacheService.Instance.SetCacheValue( CacheKey, domains );
}
return domains.Where( d => d.RootNodeId == nodeId ).ToArray();
}
public static void InvalidateCache() {
CacheService.Instance.Invalidate( CacheKey );
}
}
} | mit | C# |
06125746435d81403f26dfeceb34bc89ff737a50 | Update Mono.Debugging.Soft/SourceLinkMap.cs | mono/debugger-libs,Unity-Technologies/debugger-libs,Unity-Technologies/debugger-libs,mono/debugger-libs | Mono.Debugging.Soft/SourceLinkMap.cs | Mono.Debugging.Soft/SourceLinkMap.cs | namespace Mono.Debugging.Soft
{
internal class SourceLinkMap
{
public string RelativePathWildcard { get; }
public string UriWildcard { get; }
public SourceLinkMap (string relativePathWildcard, string uriWildcard)
{
UriWildcard = uriWildcard;
RelativePathWildcard = relativePathWildcard;
}
}
}
| namespace Mono.Debugging.Soft
{
public class SourceLinkMap
{
public string RelativePathWildcard { get; }
public string UriWildcard { get; }
public SourceLinkMap (string relativePathWildcard, string uriWildcard)
{
UriWildcard = uriWildcard;
RelativePathWildcard = relativePathWildcard;
}
}
}
| mit | C# |
42f6985e8d17c2d3741d49c087d5b3fd71e2a73d | remove phonenumber on user info page | btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver | BTCPayServer/Views/Manage/Index.cshtml | BTCPayServer/Views/Manage/Index.cshtml | @model IndexViewModel
@{
ViewData["Title"] = "Profile";
ViewData.AddActivePage(ManageNavPages.Index);
}
<h4>@ViewData["Title"]</h4>
@Html.Partial("_StatusMessage", Model.StatusMessage)
<div class="row">
<div class="col-md-6">
<div asp-validation-summary="All" class="text-danger"></div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<form method="post">
<div class="form-group">
<label asp-for="Username"></label>
<input asp-for="Username" class="form-control" disabled />
</div>
<div class="form-group">
<label asp-for="Email"></label>
@if(Model.IsEmailConfirmed)
{
<div class="input-group">
<input asp-for="Email" class="form-control" />
<span class="input-group-addon" aria-hidden="true"><span class="glyphicon glyphicon-ok text-success"></span></span>
</div>
}
else
{
<input asp-for="Email" class="form-control" />
<button asp-action="SendVerificationEmail" class="btn btn-link">Send verification email</button>
}
<span asp-validation-for="Email" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-default">Save</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
| @model IndexViewModel
@{
ViewData["Title"] = "Profile";
ViewData.AddActivePage(ManageNavPages.Index);
}
<h4>@ViewData["Title"]</h4>
@Html.Partial("_StatusMessage", Model.StatusMessage)
<div class="row">
<div class="col-md-6">
<div asp-validation-summary="All" class="text-danger"></div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<form method="post">
<div class="form-group">
<label asp-for="Username"></label>
<input asp-for="Username" class="form-control" disabled />
</div>
<div class="form-group">
<label asp-for="Email"></label>
@if(Model.IsEmailConfirmed)
{
<div class="input-group">
<input asp-for="Email" class="form-control" />
<span class="input-group-addon" aria-hidden="true"><span class="glyphicon glyphicon-ok text-success"></span></span>
</div>
}
else
{
<input asp-for="Email" class="form-control" />
<button asp-action="SendVerificationEmail" class="btn btn-link">Send verification email</button>
}
<span asp-validation-for="Email" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="PhoneNumber"></label>
<input asp-for="PhoneNumber" class="form-control" />
<span asp-validation-for="PhoneNumber" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-default">Save</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
| mit | C# |
a7d8e93aab4fffb072826e20fc7165051d6e6b1c | Remove unused variable | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Controls/WalletExplorer/CoinInfoTabViewModel.cs | WalletWasabi.Gui/Controls/WalletExplorer/CoinInfoTabViewModel.cs | using System;
using System.Collections.Generic;
using System.Reactive.Disposables;
using System.Reflection;
using Splat;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinInfoTabViewModel : WasabiDocumentTabViewModel
{
public CoinInfoTabViewModel(string title, CoinViewModel coin) : base(title)
{
Coin = coin;
}
public CoinViewModel Coin { get; }
}
} | using System;
using System.Collections.Generic;
using System.Reactive.Disposables;
using System.Reflection;
using Splat;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinInfoTabViewModel : WasabiDocumentTabViewModel
{
public CoinInfoTabViewModel(string title, CoinViewModel coin) : base(title)
{
Global = Locator.Current.GetService<Global>();
Coin = coin;
}
public CoinViewModel Coin { get; }
private Global Global { get; }
}
} | mit | C# |
1a16527a3e3f96a561a74a6c554a5d81e059739f | Edit assembly description to make xml compliant for nuspec output. | dbenzel/Crosscutter | Crosscutter/Properties/AssemblyInfo.cs | Crosscutter/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("Crosscutter")]
[assembly: AssemblyDescription(".NET extensions, safety & convenience methods for known types.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Daryl Benzel")]
[assembly: AssemblyProduct("Crosscutter")]
[assembly: AssemblyCopyright("Copyright © Daryl Benzel 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("bd03676e-4bbc-4e8e-9f00-a3e2ae2d2b9d")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Crosscutter")]
[assembly: AssemblyDescription(".NET extensions, safety & convenience methods for known types.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Daryl Benzel")]
[assembly: AssemblyProduct("Crosscutter")]
[assembly: AssemblyCopyright("Copyright © Daryl Benzel 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("bd03676e-4bbc-4e8e-9f00-a3e2ae2d2b9d")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0")]
| mit | C# |
7b240f9562313ef9a7f379344390c1651163367f | add LibraryFrameworkType test | sharwell/roslyn,heejaechang/roslyn,jmarolf/roslyn,aelij/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,tmat/roslyn,KevinRansom/roslyn,wvdd007/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,panopticoncentral/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,heejaechang/roslyn,mavasani/roslyn,brettfo/roslyn,tannergooding/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,genlu/roslyn,mavasani/roslyn,aelij/roslyn,panopticoncentral/roslyn,mavasani/roslyn,diryboy/roslyn,tmat/roslyn,brettfo/roslyn,genlu/roslyn,AmadeusW/roslyn,tmat/roslyn,shyamnamboodiripad/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,gafter/roslyn,physhi/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,wvdd007/roslyn,aelij/roslyn,heejaechang/roslyn,brettfo/roslyn,physhi/roslyn,KevinRansom/roslyn,dotnet/roslyn,tannergooding/roslyn,stephentoub/roslyn,genlu/roslyn,bartdesmet/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,physhi/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,shyamnamboodiripad/roslyn,AlekseyTs/roslyn,ErikSchierboom/roslyn,jmarolf/roslyn,gafter/roslyn,diryboy/roslyn,weltkante/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,eriawan/roslyn,weltkante/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,jmarolf/roslyn,eriawan/roslyn,gafter/roslyn | src/Analyzers/CSharp/Tests/ConvertNameOf/ConvertNameOfTests.cs | src/Analyzers/CSharp/Tests/ConvertNameOf/ConvertNameOfTests.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.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.ConvertNameOf;
using Microsoft.CodeAnalysis.CSharp.CSharpConvertNameOfCodeFixProvider;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ConvertNameOf
{
public partial class ConvertNameOfTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (new CSharpConvertNameOfDiagnosticAnalyzer(), new CSharpConvertNameOfCodeFixProvider());
[Fact]
public async Task BasicType()
{
var text = @"
class Test
{
void Method()
{
var typeName = [||]typeof(Test).Name;
}
}
";
var expected = @"
class Test
{
void Method()
{
var typeName = [||]nameof(Test);
}
}
";
await TestInRegularAndScriptAsync(text, expected);
}
[Fact]
public async Task ClassLibraryType()
{
var text = @"
class Test
{
void Method()
{
var typeName = [||]typeof(String).Name;
}
}
";
var expected = @"
class Test
{
void Method()
{
var typeName = [||]nameof(String);
}
}
";
await TestInRegularAndScriptAsync(text, expected);
}
}
}
| // 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.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.ConvertNameOf;
using Microsoft.CodeAnalysis.CSharp.CSharpConvertNameOfCodeFixProvider;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ConvertNameOf
{
public partial class ConvertNameOfTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (new CSharpConvertNameOfDiagnosticAnalyzer(), new CSharpConvertNameOfCodeFixProvider());
[Fact]
public async Task BasicType()
{
var text = @"
class Test
{
void Method()
{
var typeName = [||]typeof(Test).Name;
}
}
";
var expected = @"
class Test
{
void Method()
{
var typeName = [||]nameof(Test);
}
}
";
await TestInRegularAndScriptAsync(text, expected);
}
}
}
| mit | C# |
c65cd3eb30a93f8aa7211252a7fbf1b558c6249c | upgrade StaticMap request tests to use FluentAssertions collection testing | ericnewton76/gmaps-api-net | src/Google.Maps.Test/StaticMaps/StaticMap_uribuilding_Tests.cs | src/Google.Maps.Test/StaticMaps/StaticMap_uribuilding_Tests.cs | using System;
using System.Collections.Generic;
using NUnit.Framework;
using FluentAssertions;
using Google.Maps.Test;
using Google.Maps.StaticMaps;
namespace Google.Maps.StaticMaps
{
[TestFixture]
public class StaticMap_uribuilding_Tests
{
Uri gmapsBaseUri = new Uri("http://maps.google.com/");
[Test]
public void BasicUri()
{
var expected = Helpers.ParseQueryString("/maps/api/staticmap?center=30.1,-60.2&size=512x512");
StaticMapRequest sm = new StaticMapRequest()
{
Center = new LatLng(30.1, -60.2)
};
Uri actualUri = sm.ToUri();
var actual = Helpers.ParseQueryString(actualUri.PathAndQuery);
actual.ShouldBeEquivalentTo(expected);
}
}
}
| using System;
using System.Collections.Generic;
using NUnit.Framework;
namespace Google.Maps.StaticMaps
{
[TestFixture]
public class StaticMap_uribuilding_Tests
{
Uri gmapsBaseUri = new Uri("http://maps.google.com/");
[Test]
public void BasicUri()
{
string expected = "/maps/api/staticmap?center=30.1,-60.2&size=512x512";
StaticMapRequest sm = new StaticMapRequest()
{
Center = new LatLng(30.1, -60.2)
};
Uri actualUri = sm.ToUri();
string actual = actualUri.PathAndQuery;
Assert.AreEqual(expected, actual);
}
}
}
| apache-2.0 | C# |
3e8fa66488121df4758366d32d08615301de2ac5 | Change FilterNumber to PhoneNumber so that it has the same name as the database field | Paymentsense/Dapper.SimpleSave | PS.Mothership.Core/PS.Mothership.Core.Common.Rellaid/Dto/InboundQueueDistributorDto.cs | PS.Mothership.Core/PS.Mothership.Core.Common.Rellaid/Dto/InboundQueueDistributorDto.cs | using System.Runtime.Serialization;
namespace PS.Mothership.Core.Common.Rellaid.Dto
{
[DataContract]
public class InboundQueueDistributorDto
{
[DataMember]
public string PhoneNumber { get; set; }
[DataMember]
public int RungCount { get; set; }
}
}
| using System.Runtime.Serialization;
namespace PS.Mothership.Core.Common.Rellaid.Dto
{
[DataContract]
public class InboundQueueDistributorDto
{
[DataMember]
public string FilterNumber { get; set; }
[DataMember]
public int RungCount { get; set; }
}
}
| mit | C# |
42dfb3ae1582a361954588a6c8ef04aded0961ba | allow retrieval of snippet insertion context. | AvaloniaUI/AvaloniaEdit,danwalmsley/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,danwalmsley/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit,AvaloniaUI/AvaloniaEdit | src/AvaloniaEdit/Snippets/Snippet.cs | src/AvaloniaEdit/Snippets/Snippet.cs | // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// 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 AvaloniaEdit.Document;
using AvaloniaEdit.Editing;
namespace AvaloniaEdit.Snippets
{
/// <summary>
/// A code snippet that can be inserted into the text editor.
/// </summary>
public class Snippet : SnippetContainerElement
{
/// <summary>
/// Inserts the snippet into the text area.
/// </summary>
public InsertionContext Insert(TextArea textArea)
{
if (textArea == null)
throw new ArgumentNullException(nameof(textArea));
var selection = textArea.Selection.SurroundingSegment;
var insertionPosition = textArea.Caret.Offset;
if (selection != null) // if something is selected
// use selection start instead of caret position,
// because caret could be at end of selection or anywhere inside.
// Removal of the selected text causes the caret position to be invalid.
insertionPosition = selection.Offset + TextUtilities.GetWhitespaceAfter(textArea.Document, selection.Offset).Length;
var context = new InsertionContext(textArea, insertionPosition);
using (context.Document.RunUpdate())
{
if (selection != null)
textArea.Document.Remove(insertionPosition, selection.EndOffset - insertionPosition);
Insert(context);
context.RaiseInsertionCompleted(EventArgs.Empty);
}
return context;
}
}
}
| // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// 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 AvaloniaEdit.Document;
using AvaloniaEdit.Editing;
namespace AvaloniaEdit.Snippets
{
/// <summary>
/// A code snippet that can be inserted into the text editor.
/// </summary>
public class Snippet : SnippetContainerElement
{
/// <summary>
/// Inserts the snippet into the text area.
/// </summary>
public void Insert(TextArea textArea)
{
if (textArea == null)
throw new ArgumentNullException(nameof(textArea));
var selection = textArea.Selection.SurroundingSegment;
var insertionPosition = textArea.Caret.Offset;
if (selection != null) // if something is selected
// use selection start instead of caret position,
// because caret could be at end of selection or anywhere inside.
// Removal of the selected text causes the caret position to be invalid.
insertionPosition = selection.Offset + TextUtilities.GetWhitespaceAfter(textArea.Document, selection.Offset).Length;
var context = new InsertionContext(textArea, insertionPosition);
using (context.Document.RunUpdate())
{
if (selection != null)
textArea.Document.Remove(insertionPosition, selection.EndOffset - insertionPosition);
Insert(context);
context.RaiseInsertionCompleted(EventArgs.Empty);
}
}
}
}
| mit | C# |
e11af842868b4ecfea311b61f8248d1292e25ad8 | add contravariant | CatPhat/Fabrik.SimpleBus | src/Fabrik.SimpleBus/IHandleAsync.cs | src/Fabrik.SimpleBus/IHandleAsync.cs | using System.Threading;
using System.Threading.Tasks;
namespace Fabrik.SimpleBus
{
public interface IHandleAsync<in TMessage>
{
Task HandleAsync(TMessage message, CancellationToken cancellationToken);
}
}
| using System.Threading;
using System.Threading.Tasks;
namespace Fabrik.SimpleBus
{
public interface IHandleAsync<TMessage>
{
Task HandleAsync(TMessage message, CancellationToken cancellationToken);
}
}
| mit | C# |
a5a529d7867ebb1334694510731e49b96547b26e | Change OnGet to OnGetAsync | dotnet-presentations/aspnetcore-app-workshop,jongalloway/aspnetcore-app-workshop,csharpfritz/aspnetcore-app-workshop,dotnet-presentations/aspnetcore-app-workshop,dotnet-presentations/aspnetcore-app-workshop,csharpfritz/aspnetcore-app-workshop,jongalloway/aspnetcore-app-workshop,dotnet-presentations/aspnetcore-app-workshop,anurse/ConferencePlanner,anurse/ConferencePlanner,csharpfritz/aspnetcore-app-workshop,csharpfritz/aspnetcore-app-workshop,anurse/ConferencePlanner | src/FrontEnd/Pages/Session.cshtml.cs | src/FrontEnd/Pages/Session.cshtml.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ConferenceDTO;
using FrontEnd.Services;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace FrontEnd.Pages
{
public class SessionModel : PageModel
{
private readonly IApiClient _apiClient;
public SessionModel(IApiClient apiClient)
{
_apiClient = apiClient;
}
public SessionResponse Session { get; set; }
public bool IsInPersonalAgenda { get; set; }
public int? DayOffset { get; set; }
public async Task<IActionResult> OnGetAsync(int id)
{
Session = await _apiClient.GetSessionAsync(id);
if (Session == null)
{
return RedirectToPage("/Index");
}
var sessions = await _apiClient.GetSessionsByAttendeeAsync(User.Identity.Name);
IsInPersonalAgenda = sessions.Any(s => s.ID == id);
var allSessions = await _apiClient.GetSessionsAsync();
var startDate = allSessions.Min(s => s.StartTime?.Date);
DayOffset = Session.StartTime?.DateTime.Subtract(startDate ?? DateTime.MinValue).Days;
if (!string.IsNullOrEmpty(Session.Abstract))
{
Session.Abstract = "<p>" + String.Join("</p><p>", Session.Abstract.Split("\r\n", StringSplitOptions.RemoveEmptyEntries)) + "</p>";
}
return Page();
}
public async Task<IActionResult> OnPostAsync(int sessionId)
{
await _apiClient.AddSessionToAttendeeAsync(User.Identity.Name, sessionId);
return RedirectToPage();
}
public async Task<IActionResult> OnPostRemoveAsync(int sessionId)
{
await _apiClient.RemoveSessionFromAttendeeAsync(User.Identity.Name, sessionId);
return RedirectToPage();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ConferenceDTO;
using FrontEnd.Services;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace FrontEnd.Pages
{
public class SessionModel : PageModel
{
private readonly IApiClient _apiClient;
public SessionModel(IApiClient apiClient)
{
_apiClient = apiClient;
}
public SessionResponse Session { get; set; }
public bool IsInPersonalAgenda { get; set; }
public int? DayOffset { get; set; }
public async Task<IActionResult> OnGet(int id)
{
Session = await _apiClient.GetSessionAsync(id);
if (Session == null)
{
return RedirectToPage("/Index");
}
var sessions = await _apiClient.GetSessionsByAttendeeAsync(User.Identity.Name);
IsInPersonalAgenda = sessions.Any(s => s.ID == id);
var allSessions = await _apiClient.GetSessionsAsync();
var startDate = allSessions.Min(s => s.StartTime?.Date);
DayOffset = Session.StartTime?.DateTime.Subtract(startDate ?? DateTime.MinValue).Days;
if (!string.IsNullOrEmpty(Session.Abstract))
{
Session.Abstract = "<p>" + String.Join("</p><p>", Session.Abstract.Split("\r\n", StringSplitOptions.RemoveEmptyEntries)) + "</p>";
}
return Page();
}
public async Task<IActionResult> OnPostAsync(int sessionId)
{
await _apiClient.AddSessionToAttendeeAsync(User.Identity.Name, sessionId);
return RedirectToPage();
}
public async Task<IActionResult> OnPostRemoveAsync(int sessionId)
{
await _apiClient.RemoveSessionFromAttendeeAsync(User.Identity.Name, sessionId);
return RedirectToPage();
}
}
}
| mit | C# |
d56fde9630ea3fd3737d9a70bab4ba29e68cca27 | Revert changes in BranchClassifier to make sure it always picks the right branch | Kantis/GitVersion,ermshiperete/GitVersion,dpurge/GitVersion,MarkZuber/GitVersion,pascalberger/GitVersion,Philo/GitVersion,onovotny/GitVersion,alexhardwicke/GitVersion,anobleperson/GitVersion,distantcam/GitVersion,MarkZuber/GitVersion,RaphHaddad/GitVersion,ermshiperete/GitVersion,DanielRose/GitVersion,openkas/GitVersion,pascalberger/GitVersion,asbjornu/GitVersion,orjan/GitVersion,FireHost/GitVersion,pascalberger/GitVersion,gep13/GitVersion,TomGillen/GitVersion,asbjornu/GitVersion,dazinator/GitVersion,onovotny/GitVersion,distantcam/GitVersion,dpurge/GitVersion,ParticularLabs/GitVersion,JakeGinnivan/GitVersion,onovotny/GitVersion,ermshiperete/GitVersion,anobleperson/GitVersion,GitTools/GitVersion,GeertvanHorrik/GitVersion,ParticularLabs/GitVersion,dpurge/GitVersion,alexhardwicke/GitVersion,GeertvanHorrik/GitVersion,DanielRose/GitVersion,JakeGinnivan/GitVersion,Philo/GitVersion,JakeGinnivan/GitVersion,TomGillen/GitVersion,GitTools/GitVersion,orjan/GitVersion,JakeGinnivan/GitVersion,ermshiperete/GitVersion,openkas/GitVersion,gep13/GitVersion,dazinator/GitVersion,anobleperson/GitVersion,Kantis/GitVersion,DanielRose/GitVersion,RaphHaddad/GitVersion,Kantis/GitVersion,FireHost/GitVersion,dpurge/GitVersion | GitVersion/GitFlow/BranchClassifier.cs | GitVersion/GitFlow/BranchClassifier.cs | namespace GitVersion
{
using System;
using LibGit2Sharp;
static class BranchClassifier
{
public static bool IsHotfix(this Branch branch)
{
return branch.Name.StartsWith("hotfix-") || branch.Name.StartsWith("hotfix/");
}
public static string GetHotfixSuffix(this Branch branch)
{
return branch.Name.TrimStart("hotfix-").TrimStart("hotfix/");
}
public static bool IsRelease(this Branch branch)
{
return branch.Name.StartsWith("release-") || branch.Name.StartsWith("release/");
}
public static string GetReleaseSuffix(this Branch branch)
{
return branch.Name.TrimStart("release-").TrimStart("release/");
}
public static string GetSuffix(this Branch branch, BranchType branchType)
{
switch (branchType)
{
case BranchType.Hotfix:
return branch.GetHotfixSuffix();
case BranchType.Release:
return branch.GetReleaseSuffix();
default:
throw new NotSupportedException(string.Format("Unexpected branch type {0}.", branchType));
}
}
public static bool IsDevelop(this Branch branch)
{
return branch.Name == "develop";
}
public static bool IsMaster(this Branch branch)
{
return branch.Name == "master";
}
public static bool IsPullRequest(this Branch branch)
{
return branch.CanonicalName.Contains("/pull/");
}
}
}
| namespace GitVersion
{
using System;
using LibGit2Sharp;
static class BranchClassifier
{
public static bool IsHotfix(this Branch branch)
{
return branch.Name.StartsWith("hotfix-") || branch.Name.StartsWith("hotfix/");
}
public static string GetHotfixSuffix(this Branch branch)
{
return branch.Name.TrimStart("hotfix-").TrimStart("hotfix/");
}
public static bool IsRelease(this Branch branch)
{
return branch.Name.StartsWith("release-") || branch.Name.StartsWith("release/");
}
public static string GetReleaseSuffix(this Branch branch)
{
return branch.Name.TrimStart("release-").TrimStart("release/");
}
public static string GetSuffix(this Branch branch, BranchType branchType)
{
switch (branchType)
{
case BranchType.Hotfix:
return branch.GetHotfixSuffix();
case BranchType.Release:
return branch.GetReleaseSuffix();
default:
throw new NotSupportedException(string.Format("Unexpected branch type {0}.", branchType));
}
}
public static bool IsDevelop(this Branch branch)
{
return branch.Name.EndsWith("develop");
}
public static bool IsMaster(this Branch branch)
{
return branch.Name.EndsWith("master");
}
public static bool IsPullRequest(this Branch branch)
{
return branch.CanonicalName.Contains("/pull/");
}
}
}
| mit | C# |
39a41e97b9bed401365d1dd86aeac6f36c19b7fd | bump to a release version | hudl/HudlFfmpeg | Hudl.Ffmpeg/Properties/AssemblyInfo.cs | Hudl.Ffmpeg/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("Hudl.Ffmpeg")]
[assembly: AssemblyDescription("Library for transcoding and creating special media effects.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hudl")]
[assembly: AssemblyProduct("Hudl.Ffmpeg")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("Hudl.Ffmpeg.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("06757495-d5ae-4f2d-9d6b-6b17cacbf798")]
// 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: AssemblyInformationalVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyVersion("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("Hudl.Ffmpeg")]
[assembly: AssemblyDescription("Library for transcoding and creating special media effects.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hudl")]
[assembly: AssemblyProduct("Hudl.Ffmpeg")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("Hudl.Ffmpeg.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("06757495-d5ae-4f2d-9d6b-6b17cacbf798")]
// 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: AssemblyInformationalVersion("1.5.0-beta3")]
[assembly: AssemblyFileVersion("1.5.0-beta3")]
[assembly: AssemblyVersion("1.0.0.0")]
| apache-2.0 | C# |
6fc587f418a57fce1353ada8292c4849aa49c03c | Update ScriptLocation.cs | NServiceBusSqlPersistence/NServiceBus.SqlPersistence | src/SqlPersistence/ScriptLocation.cs | src/SqlPersistence/ScriptLocation.cs | using System;
using System.IO;
using System.Reflection;
using NServiceBus;
using NServiceBus.Settings;
static class ScriptLocation
{
const string ScriptFolder = "NServiceBus.Persistence.Sql";
public static string FindScriptDirectory(ReadOnlySettings settings)
{
var currentDirectory = GetCurrentDirectory(settings);
return Path.Combine(currentDirectory, ScriptFolder, settings.GetSqlDialect().Name);
}
static string GetCurrentDirectory(ReadOnlySettings settings)
{
if (settings.TryGet("SqlPersistence.ScriptDirectory", out string scriptDirectory))
{
return scriptDirectory;
}
var entryAssembly = Assembly.GetEntryAssembly();
if (entryAssembly == null)
{
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
var scriptDir = Path.Combine(baseDir, ScriptFolder);
//if the app domain base dir contains the scripts folder, return it. Otherwise add "bin" to the base dir so that web apps work correctly
if (Directory.Exists(scriptDir))
{
return baseDir;
}
return Path.Combine(baseDir, "bin");
}
var codeBase = entryAssembly.CodeBase;
return Directory.GetParent(new Uri(codeBase).LocalPath).FullName;
}
public static void ValidateScriptExists(string createScript)
{
if (!File.Exists(createScript))
{
throw new Exception($"Expected '{createScript}' to exist. It is possible it was not deployed with the endpoint.");
}
}
}
| using System;
using System.IO;
using System.Reflection;
using NServiceBus;
using NServiceBus.Settings;
static class ScriptLocation
{
const string ScriptFolder = "NServiceBus.Persistence.Sql";
public static string FindScriptDirectory(ReadOnlySettings settings)
{
var currentDirectory = GetCurrentDirectory(settings);
return Path.Combine(currentDirectory, ScriptFolder, settings.GetSqlDialect().Name);
}
static string GetCurrentDirectory(ReadOnlySettings settings)
{
if (settings.TryGet("SqlPersistence.ScriptDirectory", out string scriptDirectory))
{
return scriptDirectory;
}
var entryAssembly = Assembly.GetEntryAssembly();
if (entryAssembly == null)
{
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
var scriptDir = Path.Combine(baseDir, ScriptFolder);
//if the app domain base dir contains the scripts folder, return it. Otherwise add "bin" to the base dir so that web apps work correctly
if (Directory.Exists(scriptDir))
{
return baseDir;
}
return Path.Combine(baseDir, "bin");
}
var codeBase = entryAssembly.CodeBase;
return Directory.GetParent(new Uri(codeBase).LocalPath).FullName;
}
public static void ValidateScriptExists(string createScript)
{
if (!File.Exists(createScript))
{
throw new Exception($"Expected '{createScript}' to exist. It is possible it was not deployed with the endpoint or NServiceBus.Persistence.Sql.MsBuild nuget was not included in the project.");
}
}
} | mit | C# |
e52b9ef61ac3d3d14a77a34c94845748b1dabb96 | Add ReleaseDate (#230) | JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET | SpotifyAPI/Web/Models/SimpleAlbum.cs | SpotifyAPI/Web/Models/SimpleAlbum.cs | using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace SpotifyAPI.Web.Models
{
public class SimpleAlbum : BasicModel
{
[JsonProperty("album_type")]
public string AlbumType { get; set; }
[JsonProperty("available_markets")]
public List<string> AvailableMarkets { get; set; }
[JsonProperty("external_urls")]
public Dictionary<string, string> ExternalUrls { get; set; }
[JsonProperty("href")]
public string Href { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("images")]
public List<Image> Images { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("release_date")]
public string ReleaseDate { get; set; }
[JsonProperty("release_date_precision")]
public string ReleaseDatePrecision { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("uri")]
public string Uri { get; set; }
}
} | using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace SpotifyAPI.Web.Models
{
public class SimpleAlbum : BasicModel
{
[JsonProperty("album_type")]
public string AlbumType { get; set; }
[JsonProperty("available_markets")]
public List<string> AvailableMarkets { get; set; }
[JsonProperty("external_urls")]
public Dictionary<string, string> ExternalUrls { get; set; }
[JsonProperty("href")]
public string Href { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("images")]
public List<Image> Images { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("uri")]
public string Uri { get; set; }
}
} | mit | C# |
91a79f75ee56abf065d63ba8f87d0d0bb56d0080 | Fix for NoVehicleUsage flag doing nothing | Trojaner25/Rocket-Safezone,Trojaner25/Rocket-Regions | Model/Flag/Impl/NoVehiclesUsageFlag.cs | Model/Flag/Impl/NoVehiclesUsageFlag.cs | using System.Collections.Generic;
using Rocket.Unturned.Player;
using RocketRegions.Util;
using SDG.Unturned;
using UnityEngine;
namespace RocketRegions.Model.Flag.Impl
{
public class NoVehiclesUsageFlag : BoolFlag
{
public override string Description => "Allow/Disallow usage of vehicles in region";
private readonly Dictionary<ulong, bool> _lastVehicleStates = new Dictionary<ulong, bool>();
public override void UpdateState(List<UnturnedPlayer> players)
{
foreach (var player in players)
{
var id = PlayerUtil.GetId(player);
var veh = player.Player.movement.getVehicle();
var isInVeh = veh != null;
if (!_lastVehicleStates.ContainsKey(id))
_lastVehicleStates.Add(id, veh);
var wasDriving = _lastVehicleStates[id];
if (!isInVeh || wasDriving ||
!GetValueSafe(Region.GetGroup(player))) continue;
byte seat;
Vector3 point;
byte angle;
veh.forceRemovePlayer(out seat, PlayerUtil.GetCSteamId(player), out point, out angle);
veh.removePlayer(seat, point, angle, true);
}
}
public override void OnRegionEnter(UnturnedPlayer p)
{
//do nothing
}
public override void OnRegionLeave(UnturnedPlayer p)
{
//do nothing
}
}
} | using System.Collections.Generic;
using Rocket.Unturned.Player;
using RocketRegions.Util;
using SDG.Unturned;
using UnityEngine;
namespace RocketRegions.Model.Flag.Impl
{
public class NoVehiclesUsageFlag : BoolFlag
{
public override string Description => "Allow/Disallow usage of vehicles in region";
private readonly Dictionary<ulong, bool> _lastVehicleStates = new Dictionary<ulong, bool>();
public override void UpdateState(List<UnturnedPlayer> players)
{
foreach (var player in players)
{
var id = PlayerUtil.GetId(player);
var veh = player.Player.movement.getVehicle();
var isInVeh = veh != null;
if (!_lastVehicleStates.ContainsKey(id))
_lastVehicleStates.Add(id, veh);
var wasDriving = _lastVehicleStates[id];
if (!isInVeh || wasDriving ||
!GetValueSafe(Region.GetGroup(player))) continue;
byte seat;
Vector3 point;
byte angle;
veh.forceRemovePlayer(out seat, PlayerUtil.GetCSteamId(player), out point, out angle);
}
}
public override void OnRegionEnter(UnturnedPlayer p)
{
//do nothing
}
public override void OnRegionLeave(UnturnedPlayer p)
{
//do nothing
}
}
} | agpl-3.0 | C# |
c0d29d2b13788375ff780a5368b0eec7d2f45818 | Add Channel property to SlackBotTarget. | Hooch180/NLogGwoKusExtensions | NLogGwoKusExtensions/SlackBotTarget.cs | NLogGwoKusExtensions/SlackBotTarget.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NLog;
using NLog.Config;
using NLog.Targets;
namespace NLogGwoKusExtensions
{
[Target("SlackBotTarget")]
public sealed class SlackBotTarget : TargetWithLayout
{
[RequiredParameter]
public string ApiKey { get; set; }
[RequiredParameter]
public string Channel { get; set; }
public SlackBotTarget()
{
}
protected override void Write(LogEventInfo logEvent)
{
base.Write(logEvent);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NLog;
using NLog.Config;
using NLog.Targets;
namespace NLogGwoKusExtensions
{
[Target("SlackBotTarget")]
public sealed class SlackBotTarget : TargetWithLayout
{
[RequiredParameter]
public string ApiKey { get; set; }
public SlackBotTarget()
{
}
protected override void Write(LogEventInfo logEvent)
{
base.Write(logEvent);
}
}
}
| mit | C# |
3f6e2606e3a79321b28ff83629dc5b0d11b7c5a2 | Add Comments to ITimestamped | marsop/ephemeral | ITimestamped.cs | ITimestamped.cs | using System;
namespace seasonal
{
// Simple interface for objects with time information
public interface ITimestamped
{
DateTimeOffset Timestamp { get; }
}
}
| using System;
namespace seasonal
{
public interface ITimestamped
{
DateTimeOffset Timestamp { get; }
}
} | mit | C# |
9ac7997d21c7278f59369c5185fdcc8b8e837aa5 | Rename fullTermsHtml to fullTermsSimple | Riksarkivet/iiif-model,dalbymodo/DalbyExperiment,digirati-co-uk/iiif-model | Digirati.IIIF/Model/AcceptTermsService.cs | Digirati.IIIF/Model/AcceptTermsService.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Digirati.IIIF.Model.Types;
using Newtonsoft.Json;
namespace Digirati.IIIF.Model
{
public class AcceptTermsService : Service
{
public override dynamic Profile
{
get { return "http://wellcomelibrary.org/ld/iiif-ext/0/accept-terms-click-through"; }
}
// do we need an extra setting to tell a viewer whether it can "pull through" (import into interface)?
[JsonProperty(Order = 102, PropertyName = "exp:fullTerms")]
public string ExpFullTerms { get; set; }
[JsonProperty(Order = 102, PropertyName = "exp:fullTermsSimple")]
public string ExpFullTermsSimple { get; set; }
[JsonProperty(Order = 103, PropertyName = "exp:actionLabel")]
public MetaDataValue ExpActionLabel { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Digirati.IIIF.Model.Types;
using Newtonsoft.Json;
namespace Digirati.IIIF.Model
{
public class AcceptTermsService : Service
{
public override dynamic Profile
{
get { return "http://wellcomelibrary.org/ld/iiif-ext/0/accept-terms-click-through"; }
}
// do we need an extra setting to tell a viewer whether it can "pull through" (import into interface)?
[JsonProperty(Order = 102, PropertyName = "exp:fullTerms")]
public string ExpFullTerms { get; set; }
[JsonProperty(Order = 102, PropertyName = "exp:fullTermsHtml")]
public string ExpFullTermsHtml { get; set; }
[JsonProperty(Order = 103, PropertyName = "exp:actionLabel")]
public MetaDataValue ExpActionLabel { get; set; }
}
}
| mit | C# |
4168c9b480d1a310148963d74786ab30b39d42f9 | fix mac interactive | bitsummation/pickaxe,bitsummation/pickaxe | DotNetCore/Pickaxe.Console/Interactive.cs | DotNetCore/Pickaxe.Console/Interactive.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Pickaxe.Console
{
internal class Interactive
{
public static void Prompt()
{
var builder = new StringBuilder();
System.Console.Write("pickaxe> ");
while (true)
{
var line = System.Console.ReadLine();
builder.Append(line);
if(line.EndsWith(';')) //run it
{
builder.Remove(builder.Length - 1, 1); //remove ;
var source = builder.ToString();
Thread thread = new Thread(() => Runner.Run(new[] { source }, new string[0]));
thread.Start();
thread.Join();
builder.Clear();
System.Console.Write("pickaxe> ");
continue;
}
System.Console.Write(" -> ");
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Pickaxe.Console
{
internal class Interactive
{
public static void Prompt()
{
var builder = new StringBuilder();
System.Console.Write("pickaxe> ");
while (true)
{
char character = Convert.ToChar(System.Console.Read());
if (character == '\n')
{
System.Console.Write(" -> ");
}
if (character == ';') //run it.
{
while (Convert.ToChar(System.Console.Read()) != '\n') { } //clear buf
Thread thread = new Thread(() => Runner.Run(new[] { builder.ToString() }, new string[0]));
thread.Start();
thread.Join();
builder.Clear();
System.Console.Write("pickaxe> ");
continue;
}
builder.Append(character);
}
}
}
}
| apache-2.0 | C# |
875807ef6d4a0dc77f69260b2a9eb85b93f4e196 | Add ICakeLog registration | agc93/Cake.BuildSystems.Module,agc93/Cake.BuildSystems.Module | src/Cake.TFBuild.Module/TFBuildModule.cs | src/Cake.TFBuild.Module/TFBuildModule.cs | // A Hello World! program in C#.
using Cake.Core;
using Cake.Core.Annotations;
using Cake.Core.Composition;
using Cake.Core.Diagnostics;
[assembly: CakeModule(typeof(Cake.TFBuild.Module.TFBuildEngineModule))]
namespace Cake.TFBuild.Module
{
class TFBuildEngineModule : ICakeModule
{
public void Register(ICakeContainerRegistrar registrar)
{
registrar.RegisterType<TFBuildEngine>().As<ICakeEngine>().Singleton();
registrar.RegisterType<TFBuildLog>().As<ICakeLog>().Singleton();
}
}
} | // A Hello World! program in C#.
using Cake.Core;
using Cake.Core.Annotations;
using Cake.Core.Composition;
[assembly: CakeModule(typeof(Cake.TFBuild.Module.TFBuildEngineModule))]
namespace Cake.TFBuild.Module
{
class TFBuildEngineModule : ICakeModule
{
public void Register(ICakeContainerRegistrar registrar)
{
registrar.RegisterType<TFBuildEngine>().As<ICakeEngine>().Singleton();
}
}
} | mit | C# |
81d6075ee85a22fdb0623e45e9678b382780e8c5 | add of reactions | Appleseed/base,Appleseed/base | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponseItem.cs | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponseItem.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
class SolrResponseItem
{
public string id { get; set; }
public string item_type { get; set; }
public string address_1 { get; set; }
public string city { get; set; }
public string state { get; set; }
public string classification { get; set; }
public string country { get; set; }
public string postal_code { get; set; }
public string product_description { get; set; }
public string product_quantity { get; set; }
public string product_type { get; set; }
public string code_info { get; set; }
public string reason_for_recall { get; set; }
public DateTime recall_initiation_date { get; set; }
public string recall_number { get; set; }
public string recalling_firm { get; set; }
public string voluntary_mandated { get; set; }
public DateTime report_date { get; set; }
public string status { get; set; }
public DateTime date_last_indexed { get; set; }
//IRefusal
public string fei_number { get; set; }
public string product_code { get; set; }
public string product_code_description { get; set; }
public DateTime refusal_date { get; set; }
public string entry_number { get; set; }
public string rfrnc_doc_id { get; set; }
public string line_number { get; set; }
public string line_sfx_id { get; set; }
public string fda_sample_analysis { get; set; }
public string private_lab_analysis { get; set; }
public string refusal_charges { get; set; }
//ICitations
public string act_cfr { get; set; }
public string program_area { get; set; }
public string description_short { get; set; }
public string description_long { get; set; }
public DateTime end_date { get; set; }
//IClassification
public string district_decision { get; set; }
public string district { get; set; }
public DateTime inspection_end_date { get; set; }
public string center { get; set; }
public string project_area { get; set; }
public string legal_name { get; set; }
//IAdvertise
public string[] reactions { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
class SolrResponseItem
{
public string id { get; set; }
public string item_type { get; set; }
public string address_1 { get; set; }
public string city { get; set; }
public string state { get; set; }
public string classification { get; set; }
public string country { get; set; }
public string postal_code { get; set; }
public string product_description { get; set; }
public string product_quantity { get; set; }
public string product_type { get; set; }
public string code_info { get; set; }
public string reason_for_recall { get; set; }
public DateTime recall_initiation_date { get; set; }
public string recall_number { get; set; }
public string recalling_firm { get; set; }
public string voluntary_mandated { get; set; }
public DateTime report_date { get; set; }
public string status { get; set; }
public DateTime date_last_indexed { get; set; }
//IRefusal
public string fei_number { get; set; }
public string product_code { get; set; }
public string product_code_description { get; set; }
public DateTime refusal_date { get; set; }
public string entry_number { get; set; }
public string rfrnc_doc_id { get; set; }
public string line_number { get; set; }
public string line_sfx_id { get; set; }
public string fda_sample_analysis { get; set; }
public string private_lab_analysis { get; set; }
public string refusal_charges { get; set; }
//ICitations
public string act_cfr { get; set; }
public string program_area { get; set; }
public string description_short { get; set; }
public string description_long { get; set; }
public DateTime end_date { get; set; }
//IClassification
public string district_decision { get; set; }
public string district { get; set; }
public DateTime inspection_end_date { get; set; }
public string center { get; set; }
public string project_area { get; set; }
public string legal_name { get; set; }
//IAdvertise
}
}
| apache-2.0 | C# |
186f608e7002cd69aa8c86d83a343c4e8d7fb025 | Replace events with IObservable objects | sakapon/Samples-2014,sakapon/Samples-2014,sakapon/Samples-2014 | RxSample/MouseRxWpf/MainWindow.xaml.cs | RxSample/MouseRxWpf/MainWindow.xaml.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MouseRxWpf
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public static readonly DependencyProperty OrientationProperty =
DependencyProperty.Register("Orientation", typeof(string), typeof(MainWindow), new PropertyMetadata(null));
public string Orientation
{
get { return (string)GetValue(OrientationProperty); }
private set { SetValue(OrientationProperty, value); }
}
public MainWindow()
{
InitializeComponent();
const double π = Math.PI;
var orientationSymbols = new[] { "→", "↘", "↓", "↙", "←", "↖", "↑", "↗" };
var zoneAngleRange = 2 * π / orientationSymbols.Length;
// Replace events with IObservable objects.
var mouseDown = Observable.FromEventPattern<MouseButtonEventArgs>(this, "MouseDown").Select(e => e.EventArgs);
var mouseUp = Observable.FromEventPattern<MouseButtonEventArgs>(this, "MouseUp").Select(e => e.EventArgs);
var mouseLeave = Observable.FromEventPattern<MouseEventArgs>(this, "MouseLeave").Select(e => e.EventArgs);
mouseDown.Select(e => e.GetPosition(this))
.SelectMany(p => mouseUp.Select(e => e.GetPosition(this)).Take(1),
(p1, p2) => new { Start = p1, End = p2 })
.Do(o => Debug.WriteLine(o))
.Select(o => o.End - o.Start)
.Where(d => d.Length >= 100)
.Select(d => 2 * π + Math.Atan2(d.Y, d.X))
.Select(angle => (int)Math.Round(angle / zoneAngleRange) % orientationSymbols.Length)
.Do(zone => Orientation = orientationSymbols[zone])
.Subscribe();
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MouseRxWpf
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public static readonly DependencyProperty OrientationProperty =
DependencyProperty.Register("Orientation", typeof(string), typeof(MainWindow), new PropertyMetadata(null));
public string Orientation
{
get { return (string)GetValue(OrientationProperty); }
private set { SetValue(OrientationProperty, value); }
}
public MainWindow()
{
InitializeComponent();
const double π = Math.PI;
var orientationSymbols = new[] { "→", "↘", "↓", "↙", "←", "↖", "↑", "↗" };
var zoneAngleRange = 2 * π / orientationSymbols.Length;
var mouseDown = Observable.FromEventPattern<MouseButtonEventArgs>(this, "MouseDown");
var mouseUp = Observable.FromEventPattern<MouseButtonEventArgs>(this, "MouseUp");
var mouseLeave = Observable.FromEventPattern<MouseEventArgs>(this, "MouseLeave");
mouseDown
.Select(e => e.EventArgs.GetPosition(this))
.SelectMany(p => mouseUp.Take(1), (p, e) => new { Start = p, End = e.EventArgs.GetPosition(this) })
.Do(o => Debug.WriteLine(o))
.Select(o => o.End - o.Start)
.Where(d => d.Length >= 100)
.Select(d => 2 * π + Math.Atan2(d.Y, d.X))
.Select(angle => (int)Math.Round(angle / zoneAngleRange) % orientationSymbols.Length)
.Do(zone => Orientation = orientationSymbols[zone])
.Subscribe();
}
}
}
| mit | C# |
4e300771c3fe20c040235e281f3fa9e4e6c2a160 | Clean up | nikeee/HolzShots | src/HolzShots.Core/Input/KeyboardHook.cs | src/HolzShots.Core/Input/KeyboardHook.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace HolzShots.Input
{
public abstract class KeyboardHook : IDisposable
{
protected Dictionary<int, Hotkey> RegisteredKeys { get; } = new Dictionary<int, Hotkey>();
/// <summary>Registers a hotkey in the system.</summary>
public abstract void RegisterHotkey(Hotkey hotkey);
/// <summary>Unregisters a hotkey in the system.</summary>
public abstract void UnregisterHotkey(Hotkey hotkey);
public abstract void UnregisterAllHotkeys();
protected void KeyPressed(object sender, KeyPressedEventArgs args)
{
if (args == null)
throw new ArgumentNullException(nameof(args));
var key = args.GetIdentifier();
if (RegisteredKeys.TryGetValue(key, out Hotkey hk) && hk != null)
hk.InvokePressed(this);
}
#region IDisposable Members
//private bool _isDisposed;
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
//if (!_isDisposed)
//{
// UnregisterAllHotkeys();
// _isDisposed = true;
//}
}
~KeyboardHook() => Dispose(false);
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace HolzShots.Input
{
public abstract class KeyboardHook : IDisposable
{
private readonly Dictionary<int, Hotkey> registeredKeys = new Dictionary<int, Hotkey>();
protected Dictionary<int, Hotkey> RegisteredKeys => registeredKeys;
/// <summary>Registers a hotkey in the system.</summary>
public abstract void RegisterHotkey(Hotkey hotkey);
/// <summary>Unregisters a hotkey in the system.</summary>
public abstract void UnregisterHotkey(Hotkey hotkey);
public abstract void UnregisterAllHotkeys();
protected void KeyPressed(object sender, KeyPressedEventArgs args)
{
if (args == null)
throw new ArgumentNullException(nameof(args));
var key = args.GetIdentifier();
if (RegisteredKeys.TryGetValue(key, out Hotkey hk) && hk != null)
hk.InvokePressed(this);
}
#region IDisposable Members
//private bool _isDisposed;
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
//if (!_isDisposed)
//{
// UnregisterAllHotkeys();
// _isDisposed = true;
//}
}
~KeyboardHook() => Dispose(false);
#endregion
}
}
| agpl-3.0 | C# |
80bdf308c34933d585135fabfbd1cdfbbabdce67 | remove absolute file ref | DevExpress/BigQueryProvider | BigQueryProvider/Tests/ConnStringHelper.cs | BigQueryProvider/Tests/ConnStringHelper.cs | using System.Data.Common;
namespace DevExpress.DataAccess.BigQuery.Tests {
public static class ConnStringHelper {
static readonly DbConnectionStringBuilder connectionStringBuilder = new DbConnectionStringBuilder();
public static string ConnectionString {
get { return connectionStringBuilder.ConnectionString.ToLower(); }
}
static ConnStringHelper() {
connectionStringBuilder["PrivateKeyFileName"] = @"..\..\zymosimeter-e34a09c6f230.p12";
connectionStringBuilder["ProjectID"] = "zymosimeter";
connectionStringBuilder["ServiceAccountEmail"] = "227277881286-l0fodnq2h35m58b80up9vi4g83p1ogus@developer.gserviceaccount.com";
connectionStringBuilder["DataSetId"] = "testdata";
}
}
}
| using System.Data.Common;
namespace DevExpress.DataAccess.BigQuery.Tests {
public static class ConnStringHelper {
static readonly DbConnectionStringBuilder connectionStringBuilder = new DbConnectionStringBuilder();
public static string ConnectionString {
get { return connectionStringBuilder.ConnectionString.ToLower(); }
}
static ConnStringHelper() {
connectionStringBuilder["PrivateKeyFileName"] = @"E:\work\data_access\BigQueryProvider\WindowsFormsApplication1\zymosimeter-e34a09c6f230.p12";
connectionStringBuilder["ProjectID"] = "zymosimeter";
connectionStringBuilder["ServiceAccountEmail"] = "227277881286-l0fodnq2h35m58b80up9vi4g83p1ogus@developer.gserviceaccount.com";
connectionStringBuilder["DataSetId"] = "testdata";
}
}
}
| apache-2.0 | C# |
ae278e6896a34ef84b9e9f1e0355c18989407f8c | Bump the AssemblyFileVersion but not AssemblyVersion | lovewitty/Open.NAT,OpenRA/Mono.Nat,nterry/Mono.Nat,mcatanzariti/Open.NAT,lontivero/Open.NAT,mono/Mono.Nat,nterry/Mono.Nat,OpenRA/Mono.Nat | src/Mono.Nat/AssemblyInfo.cs | src/Mono.Nat/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Mono.Nat")]
[assembly: AssemblyDescription(".NET Library for automatic network address translation")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mono.Nat")]
[assembly: AssemblyCopyright("Copyright Alan McGovern, Ben Motmans © 2006-2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("c8e81e95-9f15-4eb8-8982-3d2c9cd95dee")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: CLSCompliant(false)]
| using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Mono.Nat")]
[assembly: AssemblyDescription(".NET Library for automatic network address translation")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mono.Nat")]
[assembly: AssemblyCopyright("Copyright Alan McGovern, Ben Motmans © 2006-2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("c8e81e95-9f15-4eb8-8982-3d2c9cd95dee")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CLSCompliant(false)]
| mit | C# |
2cfa49c5f40784e5593b6d8df579c9b64163eb7a | Fix failing test | tgstation/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server-tools | tests/Tgstation.Server.Host.Service.Tests/TestServerService.cs | tests/Tgstation.Server.Host.Service.Tests/TestServerService.cs | using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Host.Watchdog;
namespace Tgstation.Server.Host.Service.Tests
{
/// <summary>
/// Tests for <see cref="ServerService"/>
/// </summary>
[TestClass]
public sealed class TestServerService
{
[TestMethod]
public void TestConstructionAndDisposal()
{
Assert.ThrowsException<ArgumentNullException>(() => new ServerService(null, null, default));
var mockWatchdogFactory = new Mock<IWatchdogFactory>();
Assert.ThrowsException<ArgumentNullException>(() => new ServerService(mockWatchdogFactory.Object, null, default));
var mockLoggerFactory = new LoggerFactory();
new ServerService(mockWatchdogFactory.Object, mockLoggerFactory, default).Dispose();
}
[TestMethod]
public void TestRun()
{
var type = typeof(ServerService);
var onStart = type.GetMethod("OnStart", BindingFlags.Instance | BindingFlags.NonPublic);
var onStop = type.GetMethod("OnStop", BindingFlags.Instance | BindingFlags.NonPublic);
var mockWatchdog = new Mock<IWatchdog>();
var args = Array.Empty<string>();
CancellationToken cancellationToken;
mockWatchdog.Setup(x => x.RunAsync(false, args, It.IsAny<CancellationToken>())).Callback((bool x, string[] _, CancellationToken token) => cancellationToken = token).Returns(Task.CompletedTask).Verifiable();
var mockWatchdogFactory = new Mock<IWatchdogFactory>();
var mockLoggerFactory = new LoggerFactory();
mockWatchdogFactory.Setup(x => x.CreateWatchdog(mockLoggerFactory)).Returns(mockWatchdog.Object).Verifiable();
using (var service = new ServerService(mockWatchdogFactory.Object, mockLoggerFactory, default))
{
onStart.Invoke(service, new object[] { args });
Assert.IsFalse(cancellationToken.IsCancellationRequested);
onStop.Invoke(service, Array.Empty<object>());
Assert.IsTrue(cancellationToken.IsCancellationRequested);
mockWatchdog.VerifyAll();
}
mockWatchdogFactory.VerifyAll();
}
}
}
| using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Host.Watchdog;
namespace Tgstation.Server.Host.Service.Tests
{
/// <summary>
/// Tests for <see cref="ServerService"/>
/// </summary>
[TestClass]
public sealed class TestServerService
{
[TestMethod]
public void TestConstructionAndDisposal()
{
Assert.ThrowsException<ArgumentNullException>(() => new ServerService(null, null, default));
var mockWatchdogFactory = new Mock<IWatchdogFactory>();
Assert.ThrowsException<ArgumentNullException>(() => new ServerService(mockWatchdogFactory.Object, null, default));
var mockLoggerFactory = new LoggerFactory();
new ServerService(mockWatchdogFactory.Object, mockLoggerFactory, default).Dispose();
}
[TestMethod]
public void TestRun()
{
var type = typeof(ServerService);
var onStart = type.GetMethod("OnStart", BindingFlags.Instance | BindingFlags.NonPublic);
var onStop = type.GetMethod("OnStop", BindingFlags.Instance | BindingFlags.NonPublic);
var mockWatchdog = new Mock<IWatchdog>();
var args = Array.Empty<string>();
CancellationToken cancellationToken;
mockWatchdog.Setup(x => x.RunAsync(false, args, It.IsAny<CancellationToken>())).Callback((string[] _, CancellationToken token) => cancellationToken = token).Returns(Task.CompletedTask).Verifiable();
var mockWatchdogFactory = new Mock<IWatchdogFactory>();
var mockLoggerFactory = new LoggerFactory();
mockWatchdogFactory.Setup(x => x.CreateWatchdog(mockLoggerFactory)).Returns(mockWatchdog.Object).Verifiable();
using (var service = new ServerService(mockWatchdogFactory.Object, mockLoggerFactory, default))
{
onStart.Invoke(service, new object[] { args });
Assert.IsFalse(cancellationToken.IsCancellationRequested);
onStop.Invoke(service, Array.Empty<object>());
Assert.IsTrue(cancellationToken.IsCancellationRequested);
mockWatchdog.VerifyAll();
}
mockWatchdogFactory.VerifyAll();
}
}
}
| agpl-3.0 | C# |
36473dc616a8f66a430a05840b7346acb3206eb4 | Remove unused namespace | fredatgithub/PaperBoy | ManualPaperBoy/Properties/AssemblyInfo.cs | ManualPaperBoy/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("ManualPaperBoy")]
[assembly: AssemblyDescription("This application downloads french editions of electronic newspaper")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Freddy Juhel")]
[assembly: AssemblyProduct("ManualPaperBoy")]
[assembly: AssemblyCopyright("Copyright © Freddy Juhel MIT 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("b492fe99-f506-48c7-8d6d-b35c2cdef668")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [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;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("ManualPaperBoy")]
[assembly: AssemblyDescription("This application downloads french editions of electronic newspaper")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Freddy Juhel")]
[assembly: AssemblyProduct("ManualPaperBoy")]
[assembly: AssemblyCopyright("Copyright © Freddy Juhel MIT 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("b492fe99-f506-48c7-8d6d-b35c2cdef668")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
ac073e22c9b5662a858f81a2a28a8f71b2cc71b7 | Fix crash caused by multiple identical audio device names | tacchinotacchi/osu,smoogipooo/osu,NeoAdonis/osu,2yangk23/osu,ppy/osu,ppy/osu,smoogipoo/osu,EVAST9919/osu,peppy/osu,smoogipoo/osu,naoey/osu,DrabWeb/osu,nyaamara/osu,DrabWeb/osu,osu-RP/osu-RP,2yangk23/osu,Drezi126/osu,ZLima12/osu,UselessToucan/osu,NeoAdonis/osu,naoey/osu,ZLima12/osu,peppy/osu,UselessToucan/osu,ppy/osu,DrabWeb/osu,UselessToucan/osu,Nabile-Rahmani/osu,peppy/osu-new,NeoAdonis/osu,EVAST9919/osu,Damnae/osu,naoey/osu,johnneijzen/osu,johnneijzen/osu,smoogipoo/osu,peppy/osu,Frontear/osuKyzer,RedNesto/osu | osu.Game/Overlays/Options/Sections/Audio/AudioDevicesOptions.cs | osu.Game/Overlays/Options/Sections/Audio/AudioDevicesOptions.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Graphics;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Overlays.Options.Sections.Audio
{
public class AudioDevicesOptions : OptionsSubsection
{
protected override string Header => "Devices";
private AudioManager audio;
private OptionDropdown<string> dropdown;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
this.audio = audio;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
audio.OnNewDevice -= onDeviceChanged;
audio.OnLostDevice -= onDeviceChanged;
}
private void updateItems()
{
var deviceItems = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("Default", string.Empty) };
deviceItems.AddRange(audio.AudioDeviceNames.Select(d => new KeyValuePair<string, string>(d, d)));
var preferredDeviceName = audio.AudioDevice.Value;
if (deviceItems.All(kv => kv.Value != preferredDeviceName))
deviceItems.Add(new KeyValuePair<string, string>(preferredDeviceName, preferredDeviceName));
// The option dropdown for audio device selection lists all audio
// device names. Dropdowns, however, may not have multiple identical
// keys. Thus, we remove duplicate audio device names from
// the dropdown. BASS does not give us a simple mechanism to select
// specific audio devices in such a case anyways.This functionality would
// require OS-specific and involved code.
dropdown.Items = deviceItems.Distinct().ToList();
}
private void onDeviceChanged(string name) => updateItems();
protected override void LoadComplete()
{
base.LoadComplete();
Children = new Drawable[]
{
dropdown = new OptionDropdown<string>
{
Bindable = audio.AudioDevice
},
};
updateItems();
audio.OnNewDevice += onDeviceChanged;
audio.OnLostDevice += onDeviceChanged;
}
}
} | // Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Graphics;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Overlays.Options.Sections.Audio
{
public class AudioDevicesOptions : OptionsSubsection
{
protected override string Header => "Devices";
private AudioManager audio;
private OptionDropdown<string> dropdown;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
this.audio = audio;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
audio.OnNewDevice -= onDeviceChanged;
audio.OnLostDevice -= onDeviceChanged;
}
private void updateItems()
{
var deviceItems = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("Default", string.Empty) };
deviceItems.AddRange(audio.AudioDeviceNames.Select(d => new KeyValuePair<string, string>(d, d)));
var preferredDeviceName = audio.AudioDevice.Value;
if (deviceItems.All(kv => kv.Value != preferredDeviceName))
deviceItems.Add(new KeyValuePair<string, string>(preferredDeviceName, preferredDeviceName));
dropdown.Items = deviceItems;
}
private void onDeviceChanged(string name) => updateItems();
protected override void LoadComplete()
{
base.LoadComplete();
Children = new Drawable[]
{
dropdown = new OptionDropdown<string>
{
Bindable = audio.AudioDevice
},
};
updateItems();
audio.OnNewDevice += onDeviceChanged;
audio.OnLostDevice += onDeviceChanged;
}
}
} | mit | C# |
b3642d963659092b7ffe691b09c0a6a60446ec6c | fix - chiamata ad esri mezzi tempo e distanza | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.FakePersistance.ExternalAPI/Servizi/ESRI/GetDistanzaTempoMezzi.cs | src/backend/SO115App.FakePersistance.ExternalAPI/Servizi/ESRI/GetDistanzaTempoMezzi.cs | using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using SO115App.ExternalAPI.Client;
using SO115App.Models.Classi.ESRI;
using SO115App.Models.Servizi.Infrastruttura.Notification.CallESRI;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.ESRI;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
namespace SO115App.ExternalAPI.Fake.Servizi.ESRI
{
public class GetDistanzaTempoMezzi : IGetDistanzaTempoMezzi
{
private readonly IHttpRequestManager<ESRI_DistanzaTempoMezzoResponse> _client;
private readonly IGetToken_ESRI _getToken;
private readonly IConfiguration _config;
private readonly IGetJobId _getJobId;
public GetDistanzaTempoMezzi(IHttpRequestManager<ESRI_DistanzaTempoMezzoResponse> client, IGetToken_ESRI getToken, IGetJobId getJobId, IConfiguration config)
{
_client = client;
_config = config;
_getToken = getToken;
_getJobId = getJobId;
}
public async Task<List<ESRI_MezzoResponse>> Get(ESRI_DistanzaTempoMezzi obj)
{
var token = _getToken.Get();
var jobId = _getJobId.Get(token, obj);
if (string.IsNullOrEmpty(token) || string.IsNullOrEmpty(jobId.Result))
throw new Exception("Errore servizio ESRI (token e job)");
var uri = new Uri($"{_config.GetSection("ESRI").GetSection("URLDistanzaTempoMezzo").Value.Replace("{jobId}", jobId.Result).Replace("{token}", token)}");
try
{
ESRI_DistanzaTempoMezzoResponse result = null;
do
{
result = await _client.GetAsync(uri);
} while (result.value == null);
return result.lstMezzi;
}
catch (Exception e)
{
throw new Exception("Errore servizio ESRI (distanza e tempo mezzi)");
}
}
}
}
| using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using SO115App.ExternalAPI.Client;
using SO115App.Models.Classi.ESRI;
using SO115App.Models.Servizi.Infrastruttura.Notification.CallESRI;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.ESRI;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
namespace SO115App.ExternalAPI.Fake.Servizi.ESRI
{
public class GetDistanzaTempoMezzi : IGetDistanzaTempoMezzi
{
private readonly IHttpRequestManager<ESRI_DistanzaTempoMezzoResponse> _client;
private readonly IGetToken_ESRI _getToken;
private readonly IConfiguration _config;
private readonly IGetJobId _getJobId;
public GetDistanzaTempoMezzi(IHttpRequestManager<ESRI_DistanzaTempoMezzoResponse> client, IGetToken_ESRI getToken, IGetJobId getJobId, IConfiguration config)
{
_client = client;
_config = config;
_getToken = getToken;
_getJobId = getJobId;
}
public async Task<List<ESRI_MezzoResponse>> Get(ESRI_DistanzaTempoMezzi obj)
{
var token = _getToken.Get();
var jobId = _getJobId.Get(token, obj);
if (string.IsNullOrEmpty(token) || string.IsNullOrEmpty(jobId.Result))
throw new Exception("Errore servizio ESRI (token e job)");
try
{
var uri = new Uri($"{_config.GetSection("ESRI").GetSection("URLDistanzaTempoMezzo").Value.Replace("{jobId}", jobId.Result).Replace("{token}", token)}");
var result = await _client.GetAsync(uri);
return result.lstMezzi;
}
catch (Exception e)
{
throw new Exception("Errore servizio ESRI (distanza e tempo mezzi)");
}
}
}
}
| agpl-3.0 | C# |
7386f2a16b2f964fbe22de4ed752de564ea23802 | add unit in OperationEntity.Duration | signumsoftware/framework,avifatal/framework,avifatal/framework,AlejandroCano/framework,AlejandroCano/framework,signumsoftware/framework | Signum.Entities/Basics/OperationLog.cs | Signum.Entities/Basics/OperationLog.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Signum.Utilities;
using System.Linq.Expressions;
using Signum.Utilities.ExpressionTrees;
namespace Signum.Entities.Basics
{
[Serializable, EntityKind(EntityKind.System, EntityData.Transactional), TicksColumn(false), InTypeScript(Undefined = false)]
public class OperationLogEntity : Entity
{
[ImplementedByAll]
public Lite<IEntity> Target { get; set; }
[ImplementedByAll]
public Lite<IEntity> Origin { get; set; }
[NotNullValidator]
public OperationSymbol Operation { get; set; }
[NotNullValidator]
public Lite<IUserEntity> User { get; set; }
public DateTime Start { get; set; }
public DateTime? End { get; set; }
static Expression<Func<OperationLogEntity, double?>> DurationExpression =
log => (double?)(log.End - log.Start).Value.TotalMilliseconds;
[ExpressionField("DurationExpression"), Unit("ms")]
public double? Duration
{
get { return End == null ? null : DurationExpression.Evaluate(this); }
}
public Lite<ExceptionEntity> Exception { get; set; }
public override string ToString()
{
return "{0} {1} {2:d}".FormatWith(Operation, User, Start);
}
public void SetTarget(IEntity target)
{
this.TemporalTarget = target;
this.Target = target == null || target.IsNew ? null : target.ToLite();
}
public IEntity GetTarget()
{
return TemporalTarget;
}
[Ignore]
IEntity TemporalTarget;
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Signum.Utilities;
using System.Linq.Expressions;
using Signum.Utilities.ExpressionTrees;
namespace Signum.Entities.Basics
{
[Serializable, EntityKind(EntityKind.System, EntityData.Transactional), TicksColumn(false), InTypeScript(Undefined = false)]
public class OperationLogEntity : Entity
{
[ImplementedByAll]
public Lite<IEntity> Target { get; set; }
[ImplementedByAll]
public Lite<IEntity> Origin { get; set; }
[NotNullValidator]
public OperationSymbol Operation { get; set; }
[NotNullValidator]
public Lite<IUserEntity> User { get; set; }
public DateTime Start { get; set; }
public DateTime? End { get; set; }
static Expression<Func<OperationLogEntity, double?>> DurationExpression =
log => (double?)(log.End - log.Start).Value.TotalMilliseconds;
[ExpressionField("DurationExpression")]
public double? Duration
{
get { return End == null ? null : DurationExpression.Evaluate(this); }
}
public Lite<ExceptionEntity> Exception { get; set; }
public override string ToString()
{
return "{0} {1} {2:d}".FormatWith(Operation, User, Start);
}
public void SetTarget(IEntity target)
{
this.TemporalTarget = target;
this.Target = target == null || target.IsNew ? null : target.ToLite();
}
public IEntity GetTarget()
{
return TemporalTarget;
}
[Ignore]
IEntity TemporalTarget;
}
}
| mit | C# |
de00602818bef41f71d0c49dfaf4cb14e2cca21f | Implement IInverseParser | picoe/Eto.Parse,smbecker/Eto.Parse,smbecker/Eto.Parse,picoe/Eto.Parse,ArsenShnurkov/Eto.Parse,ArsenShnurkov/Eto.Parse | Eto.Parse/Parsers/SurrogatePairTerminal.cs | Eto.Parse/Parsers/SurrogatePairTerminal.cs | namespace Eto.Parse.Parsers
{
public abstract class SurrogatePairTerminal : Parser, IInverseParser
{
protected SurrogatePairTerminal()
{
}
protected SurrogatePairTerminal(SurrogatePairTerminal other, ParserCloneArgs args)
: base(other, args)
{
Inverse = other.Inverse;
}
public bool Inverse { get; set; }
protected override int InnerParse(ParseArgs args)
{
var scanner = args.Scanner;
var highSurrogate = scanner.ReadChar();
if (highSurrogate > 0 && char.IsHighSurrogate((char)highSurrogate)
&& TestHighSurrogate(highSurrogate) != Inverse)
{
var lowSurrogate = scanner.ReadChar();
if (lowSurrogate > 0 && char.IsLowSurrogate((char)lowSurrogate)
&& TestLowSurrogate(lowSurrogate) != Inverse)
{
return 2;
}
scanner.Position -= 2;
}
return -1;
}
protected abstract bool TestLowSurrogate(int lowSurrogate);
protected abstract bool TestHighSurrogate(int highSurrogate);
}
} | namespace Eto.Parse.Parsers
{
public abstract class SurrogatePairTerminal : Parser
{
protected SurrogatePairTerminal()
{
}
protected SurrogatePairTerminal(Parser other, ParserCloneArgs args)
: base(other, args)
{
}
protected override int InnerParse(ParseArgs args)
{
var scanner = args.Scanner;
var highSurrogate = scanner.ReadChar();
if (highSurrogate > 0 && char.IsHighSurrogate((char)highSurrogate)
&& TestHighSurrogate(highSurrogate))
{
var lowSurrogate = scanner.ReadChar();
if (lowSurrogate > 0 && char.IsLowSurrogate((char)lowSurrogate)
&& TestLowSurrogate(lowSurrogate))
{
return 2;
}
scanner.Position -= 2;
}
return -1;
}
protected abstract bool TestLowSurrogate(int lowSurrogate);
protected abstract bool TestHighSurrogate(int highSurrogate);
}
} | mit | C# |
be44b7fa05f8f1949f84ea6a996250e4bc6cf3a4 | Fix wrong XML doc. | SolalPirelli/ThriftSharp,SolalPirelli/ThriftSharp | ThriftSharp/ThriftProtocolException.cs | ThriftSharp/ThriftProtocolException.cs | // Copyright (c) 2014 Solal Pirelli
// This code is licensed under the MIT License (see Licence.txt for details).
// Redistributions of this source code must retain the above copyright notice.
using System;
namespace ThriftSharp
{
/// <summary>
/// Fatal server exception transmitted to the client instead of the message.
/// </summary>
[ThriftStruct( "TApplicationException" )]
public sealed class ThriftProtocolException : Exception
{
/// <summary>
/// Gets the exception's message.
/// </summary>
[ThriftField( 1, false, "message" )]
public new string Message { get; internal set; }
/// <summary>
/// Gets the exception's type.
/// </summary>
[ThriftField( 2, false, "type" )]
public ThriftProtocolExceptionType? ExceptionType { get; internal set; }
/// <summary>
/// Initializes a new instance of the <see cref="ThriftProtocolException" /> class.
/// </summary>
/// <remarks>
/// For serialization purposes only.
/// </remarks>
private ThriftProtocolException() { }
/// <summary>
/// Initializes a new instance of the <see cref="ThriftProtocolException" /> class with the specified values.
/// </summary>
/// <param name="exceptionType">The exception type.</param>
internal ThriftProtocolException( ThriftProtocolExceptionType exceptionType )
{
ExceptionType = exceptionType;
}
}
} | // Copyright (c) 2014 Solal Pirelli
// This code is licensed under the MIT License (see Licence.txt for details).
// Redistributions of this source code must retain the above copyright notice.
using System;
namespace ThriftSharp
{
/// <summary>
/// Fatal server exception transmitted to the client instead of the message.
/// </summary>
[ThriftStruct( "TApplicationException" )]
public sealed class ThriftProtocolException : Exception
{
/// <summary>
/// Gets the exception's message.
/// </summary>
[ThriftField( 1, false, "message" )]
public new string Message { get; internal set; }
/// <summary>
/// Gets the exception's type.
/// </summary>
[ThriftField( 2, false, "type" )]
public ThriftProtocolExceptionType? ExceptionType { get; internal set; }
/// <summary>
/// Initializes a new instance of the <see cref="ThriftTransportException" /> class.
/// </summary>
/// <remarks>
/// For serialization purposes only.
/// </remarks>
private ThriftProtocolException() { }
/// <summary>
/// Initializes a new instance of the <see cref="ThriftTransportException" /> class with the specified values.
/// </summary>
/// <param name="exceptionType">The exception type.</param>
internal ThriftProtocolException( ThriftProtocolExceptionType exceptionType )
{
ExceptionType = exceptionType;
}
}
} | mit | C# |
6aba4e8a92229710b2490c973f6fb1c80ec9d2b2 | Bump version. | JohanLarsson/Gu.Wpf.Geometry | Gu.Wpf.Geometry/Properties/AssemblyInfo.cs | Gu.Wpf.Geometry/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyTitle("Gu.Wpf.Geometry")]
[assembly: AssemblyDescription("Geometries for WPF.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Johan Larsson")]
[assembly: AssemblyProduct("Gu.Wpf.Geometry")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a9cbadf5-65f8-4a81-858c-ea0cdfeb2e99")]
[assembly: AssemblyVersion("1.3.0.1")]
[assembly: AssemblyFileVersion("1.3.0.1")]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Tests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Demo", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Benchmarks", AllInternalsVisible = true)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: XmlnsDefinition("http://gu.se/Geometry", "Gu.Wpf.Geometry")]
[assembly: XmlnsDefinition("http://gu.se/Geometry", "Gu.Wpf.Geometry.Effects")]
[assembly: XmlnsPrefix("http://gu.se/Geometry", "geometry")]
[assembly: XmlnsPrefix("http://gu.se/Geometry", "effects")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyTitle("Gu.Wpf.Geometry")]
[assembly: AssemblyDescription("Geometries for WPF.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Johan Larsson")]
[assembly: AssemblyProduct("Gu.Wpf.Geometry")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a9cbadf5-65f8-4a81-858c-ea0cdfeb2e99")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Tests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Demo", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Benchmarks", AllInternalsVisible = true)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: XmlnsDefinition("http://gu.se/Geometry", "Gu.Wpf.Geometry")]
[assembly: XmlnsDefinition("http://gu.se/Geometry", "Gu.Wpf.Geometry.Effects")]
[assembly: XmlnsPrefix("http://gu.se/Geometry", "geometry")]
[assembly: XmlnsPrefix("http://gu.se/Geometry", "effects")]
| mit | C# |
edc026c74ad2f4d4ab77946c32d5d84f2788a9ae | Remove unnecessary `this` qualifier | ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework | osu.Framework/Localisation/LocalisableFormattable.cs | osu.Framework/Localisation/LocalisableFormattable.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 System;
using System.Collections.Generic;
using System.Globalization;
namespace osu.Framework.Localisation
{
/// <summary>
/// A string allowing for formatting <see cref="IFormattable"/>s using the current locale.
/// </summary>
public class LocalisableFormattable : IEquatable<LocalisableFormattable>
{
public readonly IFormattable Value;
public readonly string Format;
/// <summary>
/// Creates a <see cref="LocalisableFormattable"/> with an <see cref="IFormattable"/> value and a format string.
/// </summary>
/// <param name="value">The <see cref="IFormattable"/> value.</param>
/// <param name="format">The format string.</param>
public LocalisableFormattable(IFormattable value, string format)
{
Value = value;
Format = format;
}
public string ToString(IFormatProvider formatProvider)
{
if (formatProvider == null)
return ToString();
return Value.ToString(Format, formatProvider);
}
public override string ToString() => Value.ToString(Format, CultureInfo.InvariantCulture);
public bool Equals(LocalisableFormattable other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return EqualityComparer<object>.Default.Equals(Value, other.Value) &&
Format == other.Format;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((LocalisableFormattable)obj);
}
public override int GetHashCode() => HashCode.Combine(Value, Format);
}
}
| // 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 System;
using System.Collections.Generic;
using System.Globalization;
namespace osu.Framework.Localisation
{
/// <summary>
/// A string allowing for formatting <see cref="IFormattable"/>s using the current locale.
/// </summary>
public class LocalisableFormattable : IEquatable<LocalisableFormattable>
{
public readonly IFormattable Value;
public readonly string Format;
/// <summary>
/// Creates a <see cref="LocalisableFormattable"/> with an <see cref="IFormattable"/> value and a format string.
/// </summary>
/// <param name="value">The <see cref="IFormattable"/> value.</param>
/// <param name="format">The format string.</param>
public LocalisableFormattable(IFormattable value, string format)
{
Value = value;
Format = format;
}
public string ToString(IFormatProvider formatProvider)
{
if (formatProvider == null)
return ToString();
return Value.ToString(Format, formatProvider);
}
public override string ToString() => Value.ToString(Format, CultureInfo.InvariantCulture);
public bool Equals(LocalisableFormattable other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return EqualityComparer<object>.Default.Equals(Value, other.Value) &&
Format == other.Format;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((LocalisableFormattable)obj);
}
public override int GetHashCode() => HashCode.Combine(Value, Format);
}
}
| mit | C# |
87db62214de261e0095e6a945b3c01c94dbd6c0f | Delete null check codes, it is not necessary because set owner object function bugs was solved. | insthync/LiteNetLibManager,insthync/LiteNetLibManager | Scripts/GameApi/DefaultInterestManager.cs | Scripts/GameApi/DefaultInterestManager.cs | using System.Collections.Generic;
using UnityEngine;
namespace LiteNetLibManager
{
public class DefaultInterestManager : BaseInterestManager
{
[Tooltip("Update every ? seconds")]
public float updateInterval = 1f;
private float updateCountDown = 0f;
private void Update()
{
if (!IsServer)
{
// Update at server only
return;
}
updateCountDown -= Time.unscaledDeltaTime;
if (updateCountDown <= 0f)
{
updateCountDown = updateInterval;
HashSet<uint> subscribings = new HashSet<uint>();
foreach (LiteNetLibPlayer player in Manager.GetPlayers())
{
if (!player.IsReady)
{
// Don't subscribe if player not ready
continue;
}
foreach (LiteNetLibIdentity playerObject in player.GetSpawnedObjects())
{
// Update subscribing list, it will unsubscribe objects which is not in this list
subscribings.Clear();
foreach (LiteNetLibIdentity spawnedObject in Manager.Assets.GetSpawnedObjects())
{
if (ShouldSubscribe(playerObject, spawnedObject))
subscribings.Add(spawnedObject.ObjectId);
}
playerObject.UpdateSubscribings(subscribings);
}
}
}
}
}
}
| using System.Collections.Generic;
using UnityEngine;
namespace LiteNetLibManager
{
public class DefaultInterestManager : BaseInterestManager
{
[Tooltip("Update every ? seconds")]
public float updateInterval = 1f;
private float updateCountDown = 0f;
private void Update()
{
if (!IsServer)
{
// Update at server only
return;
}
updateCountDown -= Time.unscaledDeltaTime;
if (updateCountDown <= 0f)
{
updateCountDown = updateInterval;
HashSet<uint> subscribings = new HashSet<uint>();
foreach (LiteNetLibPlayer player in Manager.GetPlayers())
{
if (!player.IsReady)
{
// Don't subscribe if player not ready
continue;
}
foreach (LiteNetLibIdentity playerObject in player.GetSpawnedObjects())
{
// Skip destroyed player object
if (playerObject == null)
continue;
// Update subscribing list, it will unsubscribe objects which is not in this list
subscribings.Clear();
foreach (LiteNetLibIdentity spawnedObject in Manager.Assets.GetSpawnedObjects())
{
if (ShouldSubscribe(playerObject, spawnedObject))
subscribings.Add(spawnedObject.ObjectId);
}
playerObject.UpdateSubscribings(subscribings);
}
}
}
}
}
}
| mit | C# |
180fc6a2c73ec37eb0bc84b4e9b483c087b4b3b0 | Rename recommended mSpec convention to MspecExample for consistency | harryhazza77/testingFx | TestingFxTests/When_comparing_booleans.cs | TestingFxTests/When_comparing_booleans.cs | using Machine.Specifications;
namespace TestingFxTests
{
[Subject("Mspec")]
public class MspecExample
{
private static bool Subject;
private Establish context = () => Subject = false;
private Because of = () => Subject = true;
private It should_be_true = () => Subject.ShouldEqual(true);
}
} | using Machine.Specifications;
namespace TestingFxTests
{
[Subject("Booleans")]
public class When_comparing_booleans
{
private static bool Subject;
private Establish context = () => Subject = false;
private Because of = () => Subject = true;
private It should_be_true = () => Subject.ShouldEqual(true);
}
} | mit | C# |
fec8a6597c6de4dc473501610662e0fbb7f066e5 | fix bug in text | BigBabay/AsyncConverter,BigBabay/AsyncConverter | AsyncConverter.Tests/MathodToAsyncConverterAvailabilityTests.cs | AsyncConverter.Tests/MathodToAsyncConverterAvailabilityTests.cs | using JetBrains.ReSharper.FeaturesTestFramework.Intentions;
using NUnit.Framework;
namespace AsyncConverter.Tests
{
[TestFixture]
public class MathodToAsyncConverterAvailabilityTests : CSharpContextActionAvailabilityTestBase<MathodToAsyncConverter>
{
protected override string ExtraPath => "MathodToAsyncConverterAvailabilityTests";
protected override string RelativeTestDataPath => "MathodToAsyncConverterAvailabilityTests";
[Test]
public void Test()
{
DoTestFiles("Test01.cs");
}
}
} | using JetBrains.ReSharper.FeaturesTestFramework.Intentions;
using NUnit.Framework;
namespace AsyncConverter.Tests
{
[TestFixture]
public class MathodToAsyncConverterAvailabilityTests : CSharpContextActionAvailabilityTestBase<MathodToAsyncConverter>
{
protected override string ExtraPath => "MathodToAsyncConverterTests";
protected override string RelativeTestDataPath => "MathodToAsyncConverterTests";
[Test]
public void Test02()
{
DoTestFiles("Test01.cs");
}
}
} | mit | C# |
8f5b4cbe531538440e041ce469d0b920e8136341 | Check if character is �. | jesterret/ReClass.NET,jesterret/ReClass.NET,jesterret/ReClass.NET | ReClass.NET/Extensions/StringExtensions.cs | ReClass.NET/Extensions/StringExtensions.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text.RegularExpressions;
namespace ReClassNET.Extensions
{
public static class StringExtension
{
[Pure]
[DebuggerStepThrough]
public static bool IsPrintable(this char c)
{
return (!char.IsControl(c) || char.IsWhiteSpace(c)) && c != '\xFFFD' /* Unicode REPLACEMENT CHARACTER � */;
}
[DebuggerStepThrough]
public static IEnumerable<char> InterpretAsUtf8(this IEnumerable<byte> source)
{
Contract.Requires(source != null);
return source.Select(b => (char)b);
}
[DebuggerStepThrough]
public static IEnumerable<char> InterpretAsUtf16(this IEnumerable<byte> source)
{
Contract.Requires(source != null);
var bytes = source.ToArray();
var chars = new char[bytes.Length / 2];
Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length);
return chars;
}
[DebuggerStepThrough]
public static bool IsPrintableData(this IEnumerable<char> source)
{
Contract.Requires(source != null);
return CalculatePrintableDataThreshold(source) >= 1.0f;
}
[DebuggerStepThrough]
public static bool IsLikelyPrintableData(this IEnumerable<char> source)
{
Contract.Requires(source != null);
return CalculatePrintableDataThreshold(source) >= 0.75f;
}
[DebuggerStepThrough]
public static float CalculatePrintableDataThreshold(this IEnumerable<char> source)
{
var doCountValid = true;
var countValid = 0;
var countAll = 0;
foreach (var c in source)
{
countAll++;
if (doCountValid)
{
if (c.IsPrintable())
{
countValid++;
}
else
{
doCountValid = false;
}
}
}
if (countAll == 0)
{
return 0.0f;
}
return countValid / (float)countAll;
}
[Pure]
[DebuggerStepThrough]
public static string LimitLength(this string s, int length)
{
Contract.Requires(s != null);
Contract.Ensures(Contract.Result<string>() != null);
if (s.Length <= length)
{
return s;
}
return s.Substring(0, length);
}
private static readonly Regex HexRegex = new Regex("(0x|h)?([0-9A-F]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static bool TryGetHexString(this string s, out string value)
{
var match = HexRegex.Match(s);
value = match.Success ? match.Groups[2].Value : null;
return match.Success;
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text.RegularExpressions;
namespace ReClassNET.Extensions
{
public static class StringExtension
{
[Pure]
[DebuggerStepThrough]
public static bool IsPrintable(this char c)
{
return !char.IsControl(c) || char.IsWhiteSpace(c);
}
[DebuggerStepThrough]
public static IEnumerable<char> InterpretAsUtf8(this IEnumerable<byte> source)
{
Contract.Requires(source != null);
return source.Select(b => (char)b);
}
[DebuggerStepThrough]
public static IEnumerable<char> InterpretAsUtf16(this IEnumerable<byte> source)
{
Contract.Requires(source != null);
var bytes = source.ToArray();
var chars = new char[bytes.Length / 2];
Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length);
return chars;
}
[DebuggerStepThrough]
public static bool IsPrintableData(this IEnumerable<char> source)
{
Contract.Requires(source != null);
return CalculatePrintableDataThreshold(source) >= 1.0f;
}
[DebuggerStepThrough]
public static bool IsLikelyPrintableData(this IEnumerable<char> source)
{
Contract.Requires(source != null);
return CalculatePrintableDataThreshold(source) >= 0.75f;
}
[DebuggerStepThrough]
public static float CalculatePrintableDataThreshold(this IEnumerable<char> source)
{
var doCountValid = true;
var countValid = 0;
var countAll = 0;
foreach (var c in source)
{
countAll++;
if (doCountValid)
{
if (c.IsPrintable())
{
countValid++;
}
else
{
doCountValid = false;
}
}
}
if (countAll == 0)
{
return 0.0f;
}
return countValid / (float)countAll;
}
[Pure]
[DebuggerStepThrough]
public static string LimitLength(this string s, int length)
{
Contract.Requires(s != null);
Contract.Ensures(Contract.Result<string>() != null);
if (s.Length <= length)
{
return s;
}
return s.Substring(0, length);
}
private static readonly Regex HexRegex = new Regex("(0x|h)?([0-9A-F]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static bool TryGetHexString(this string s, out string value)
{
var match = HexRegex.Match(s);
value = match.Success ? match.Groups[2].Value : null;
return match.Success;
}
}
}
| mit | C# |
59d6a718d66eb39d81a3ad067354d1cbabb1c4b9 | Fix value not being loaded from beatmap in case of most dense grid setting | NeoAdonis/osu,ppy/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu | osu.Game.Rulesets.Osu/Edit/OsuRectangularPositionSnapGrid.cs | osu.Game.Rulesets.Osu/Edit/OsuRectangularPositionSnapGrid.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 System;
using osu.Framework.Allocation;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
namespace osu.Game.Rulesets.Osu.Edit
{
public class OsuRectangularPositionSnapGrid : RectangularPositionSnapGrid, IKeyBindingHandler<GlobalAction>
{
private static readonly int[] grid_sizes = { 4, 8, 16, 32 };
private int currentGridSizeIndex = grid_sizes.Length - 1;
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
public OsuRectangularPositionSnapGrid()
: base(OsuPlayfield.BASE_SIZE / 2)
{
}
[BackgroundDependencyLoader]
private void load()
{
var gridSizeIndex = Array.IndexOf(grid_sizes, editorBeatmap.BeatmapInfo.GridSize);
if (gridSizeIndex >= 0)
currentGridSizeIndex = gridSizeIndex;
updateSpacing();
}
private void nextGridSize()
{
currentGridSizeIndex = (currentGridSizeIndex + 1) % grid_sizes.Length;
updateSpacing();
}
private void updateSpacing()
{
int gridSize = grid_sizes[currentGridSizeIndex];
editorBeatmap.BeatmapInfo.GridSize = gridSize;
Spacing = new Vector2(gridSize);
}
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (e.Action)
{
case GlobalAction.EditorCycleGridDisplayMode:
nextGridSize();
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}
}
}
| // 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 System;
using osu.Framework.Allocation;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
namespace osu.Game.Rulesets.Osu.Edit
{
public class OsuRectangularPositionSnapGrid : RectangularPositionSnapGrid, IKeyBindingHandler<GlobalAction>
{
private static readonly int[] grid_sizes = { 4, 8, 16, 32 };
private int currentGridSizeIndex = grid_sizes.Length - 1;
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
public OsuRectangularPositionSnapGrid()
: base(OsuPlayfield.BASE_SIZE / 2)
{
}
[BackgroundDependencyLoader]
private void load()
{
var gridSizeIndex = Array.IndexOf(grid_sizes, editorBeatmap.BeatmapInfo.GridSize);
if (gridSizeIndex > 0)
currentGridSizeIndex = gridSizeIndex;
updateSpacing();
}
private void nextGridSize()
{
currentGridSizeIndex = (currentGridSizeIndex + 1) % grid_sizes.Length;
updateSpacing();
}
private void updateSpacing()
{
int gridSize = grid_sizes[currentGridSizeIndex];
editorBeatmap.BeatmapInfo.GridSize = gridSize;
Spacing = new Vector2(gridSize);
}
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (e.Action)
{
case GlobalAction.EditorCycleGridDisplayMode:
nextGridSize();
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}
}
}
| mit | C# |
c83388c7d091b4d3099f1218ed9c74f4ae6b83d8 | Copy in Proxy code from ProxyMiddleware.cs, | tiesmaster/DCC,tiesmaster/DCC | Dcc/Startup.cs | Dcc/Startup.cs | using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace Tiesmaster.Dcc
{
public class Startup
{
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Run(RunDccProxyAsync);
}
private static async Task RunDccProxyAsync(HttpContext context)
{
var requestMessage = new HttpRequestMessage();
var requestMethod = context.Request.Method;
if(!HttpMethods.IsGet(requestMethod) &&
!HttpMethods.IsHead(requestMethod) &&
!HttpMethods.IsDelete(requestMethod) &&
!HttpMethods.IsTrace(requestMethod))
{
var streamContent = new StreamContent(context.Request.Body);
requestMessage.Content = streamContent;
}
// Copy the request headers
foreach(var header in context.Request.Headers)
{
if(!requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()) && requestMessage.Content != null)
{
requestMessage.Content?.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
}
}
requestMessage.Headers.Host = _options.Host + ":" + _options.Port;
var uriString = $"{_options.Scheme}://{_options.Host}:{_options.Port}{context.Request.PathBase}{context.Request.Path}{context.Request.QueryString}";
requestMessage.RequestUri = new Uri(uriString);
requestMessage.Method = new HttpMethod(context.Request.Method);
using(var responseMessage = await _httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, context.RequestAborted))
{
context.Response.StatusCode = (int)responseMessage.StatusCode;
foreach(var header in responseMessage.Headers)
{
context.Response.Headers[header.Key] = header.Value.ToArray();
}
foreach(var header in responseMessage.Content.Headers)
{
context.Response.Headers[header.Key] = header.Value.ToArray();
}
// SendAsync removes chunking from the response. This removes the header so it doesn't expect a chunked response.
context.Response.Headers.Remove("transfer-encoding");
await responseMessage.Content.CopyToAsync(context.Response.Body);
}
}
} | using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace Tiesmaster.Dcc
{
public class Startup
{
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Run(RunDccProxyAsync);
}
private static async Task RunDccProxyAsync(HttpContext context)
{
await context.Response.WriteAsync("Hello from DCC ;)");
}
}
} | mit | C# |
e404be86652c323d17b8a12516ceb9f5bdf9063a | Add AndOf(Type) overrload. | bcjobs/infrastructure | Infra.IoC/Assemblies.cs | Infra.IoC/Assemblies.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Infra.IoC
{
[ContractClass(typeof(AssembliesContract))]
public abstract class Assemblies : IEnumerable<Assembly>
{
public static Assemblies Referenced { get; } = new ReferencedAssemblies();
static string LocalDirectory { get; } = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static Assemblies Local { get; } = new DirectoryAssemblies(LocalDirectory);
public static Assemblies In(string directory) => new DirectoryAssemblies(directory);
public static Assemblies Entry => new CombinedAssemblies(Assembly.GetEntryAssembly());
public abstract IEnumerator<Assembly> GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
Contract.Ensures(Contract.Result<IEnumerator>() != null);
return GetEnumerator();
}
public void ForAll(Action<Assembly> action)
{
Contract.Requires<ArgumentNullException>(action != null);
foreach (var assembly in this)
action(assembly);
}
public static Assemblies operator+(Assemblies x, Assemblies y)
{
Contract.Requires<ArgumentNullException>(x != null);
Contract.Requires<ArgumentNullException>(y != null);
Contract.Ensures(Contract.Result<Assemblies>() != null);
return new CombinedAssemblies(x, y);
}
public Assemblies AndOf<T>() =>
AndOf(typeof(T));
public Assemblies AndOf(params Type[] types) =>
new CombinedAssemblies(this,
new CombinedAssemblies(types
.Select(t => t.Assembly)
.ToArray()));
}
[ContractClassFor(typeof(Assemblies))]
abstract class AssembliesContract : Assemblies
{
public override IEnumerator<Assembly> GetEnumerator()
{
Contract.Ensures(Contract.Result<IEnumerator<Assembly>>() != null);
throw new NotImplementedException();
}
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Infra.IoC
{
[ContractClass(typeof(AssembliesContract))]
public abstract class Assemblies : IEnumerable<Assembly>
{
public static Assemblies Referenced { get; } = new ReferencedAssemblies();
static string LocalDirectory { get; } = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static Assemblies Local { get; } = new DirectoryAssemblies(LocalDirectory);
public static Assemblies In(string directory) => new DirectoryAssemblies(directory);
public static Assemblies Entry => new CombinedAssemblies(Assembly.GetEntryAssembly());
public abstract IEnumerator<Assembly> GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
Contract.Ensures(Contract.Result<IEnumerator>() != null);
return GetEnumerator();
}
public void ForAll(Action<Assembly> action)
{
Contract.Requires<ArgumentNullException>(action != null);
foreach (var assembly in this)
action(assembly);
}
public static Assemblies operator+(Assemblies x, Assemblies y)
{
Contract.Requires<ArgumentNullException>(x != null);
Contract.Requires<ArgumentNullException>(y != null);
Contract.Ensures(Contract.Result<Assemblies>() != null);
return new CombinedAssemblies(x, y);
}
public Assemblies AndOf<T>() =>
new CombinedAssemblies(this, new CombinedAssemblies(typeof(T).Assembly));
}
[ContractClassFor(typeof(Assemblies))]
abstract class AssembliesContract : Assemblies
{
public override IEnumerator<Assembly> GetEnumerator()
{
Contract.Ensures(Contract.Result<IEnumerator<Assembly>>() != null);
throw new NotImplementedException();
}
}
}
| mit | C# |
3f96136c576b797fe9150a306d3ad64df9fef8ab | Build and publish release candidate package | RockFramework/Rock.Encryption | Rock.Encryption/Properties/AssemblyInfo.cs | Rock.Encryption/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.Encryption")]
[assembly: AssemblyDescription("An easy-to-use crypto API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Encryption")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 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("a4476f1b-671a-43d1-8bdb-5a275ef62995")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0")]
[assembly: AssemblyInformationalVersion("0.9.0-rc3")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.Encryption")]
[assembly: AssemblyDescription("An easy-to-use crypto API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Encryption")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 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("a4476f1b-671a-43d1-8bdb-5a275ef62995")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0")]
[assembly: AssemblyInformationalVersion("0.9.0-rc2")]
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.