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 |
|---|---|---|---|---|---|---|---|---|
680f435813a2b3a6e866b06f5d1026375823f788
|
make model class partial
|
OBeautifulCode/OBeautifulCode.Build
|
Conventions/VisualStudioProjectTemplates/Assembly/class1.cs
|
Conventions/VisualStudioProjectTemplates/Assembly/class1.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Class1.cs" company="OBeautifulCode">
// Copyright (c) OBeautifulCode 2018. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace [PROJECT_NAME]
{
/// <summary>
/// TODO: Starting point for new project.
/// </summary>
public partial class Class1
{
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Class1.cs" company="OBeautifulCode">
// Copyright (c) OBeautifulCode 2018. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace [PROJECT_NAME]
{
/// <summary>
/// TODO: Starting point for new project.
/// </summary>
public class Class1
{
}
}
|
mit
|
C#
|
2caf53e4dbd9d2edb66cbbdb6085054f3cf6e0b1
|
Update SimpleJsonBondDeserializer.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Serialization/Bond/SimpleJsonBondDeserializer.cs
|
TIKSN.Core/Serialization/Bond/SimpleJsonBondDeserializer.cs
|
using System.IO;
using Bond.Protocols;
namespace TIKSN.Serialization.Bond
{
public class SimpleJsonBondDeserializer : DeserializerBase<string>
{
protected override T DeserializeInternal<T>(string serial)
{
var reader = new SimpleJsonReader(new StringReader(serial));
return global::Bond.Deserialize<T>.From(reader);
}
}
}
|
using Bond.Protocols;
using System.IO;
namespace TIKSN.Serialization.Bond
{
public class SimpleJsonBondDeserializer : DeserializerBase<string>
{
protected override T DeserializeInternal<T>(string serial)
{
var reader = new SimpleJsonReader(new StringReader(serial));
return global::Bond.Deserialize<T>.From(reader);
}
}
}
|
mit
|
C#
|
b790016a6944432704de7b279a4ce68dcfcafb79
|
throw Away.Code; // for placeholders
|
xingh/nroles,xingh/nroles,xingh/nroles
|
src/NRoles/roles.cs
|
src/NRoles/roles.cs
|
using System;
namespace NRoles {
/// <summary>
/// Marks a type as a role.
/// </summary>
public interface Role { }
/// <summary>
/// Composes a role into a type.
/// </summary>
/// <typeparam name="TRole">Role to compose.</typeparam>
public interface Does<TRole> where TRole : Role { }
/// <summary>
/// Marks a role member as superseded in a composition type.
/// </summary>
[AttributeUsage(AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false)]
public class SupersedeAttribute : Attribute { }
/// <summary>
/// Marks a role member as a placeholder in a composition type.
/// The composition member will be replaced by the member from the role.
/// </summary>
[AttributeUsage(AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false)]
public class PlaceholderAttribute : Attribute { }
/// <summary>
/// Extension methods to aid in developing with roles in the same assembly, where
/// the post-compiler hasn't run yet.
/// </summary>
public static class Roles {
/// <summary>
/// Treats a composition type as one of the roles it composes.
/// Only necessary when using compositions in the same assembly that
/// they are defined, because the post-compiler hasn't yet run on them.
/// </summary>
/// <typeparam name="TRole">The role that the composition uses.</typeparam>
/// <param name="self">The composition.</param>
/// <returns>The composition cast to the desired role.</returns>
public static TRole As<TRole>(this Does<TRole> self) where TRole : Role {
return (TRole)self;
}
/// <summary>
/// Cast a role to another type. Note: this cast can fail.
/// Only necessary when using roles in the same assembly that
/// they are defined, because the post-compiler hasn't yet run on them.
/// </summary>
/// <typeparam name="T">Target type.</typeparam>
/// <param name="self">Role to cast from.</param>
/// <returns>The input role instance cast to the desired type.</returns>
public static T Cast<T>(this Role self) {
return (T)self;
}
}
/// <summary>
/// Defines a single method to be used in a placeholder (<see cref="PlaceholderAttribute"/>).
/// It's just a convenient way to mark it as throw-away code: <c>throw Away.Code</c>.
/// </summary>
public static class Away {
/// <summary>
/// To be used as a placeholder's code simply as <c>throw Away.Code</c>.
/// </summary>
public static Exception Code {
get {
return new Exception("Throw-away code not thrown away!");
}
}
}
}
|
using System;
namespace NRoles {
/// <summary>
/// Marks a type as a role.
/// </summary>
public interface Role { }
/// <summary>
/// Composes a role into a type.
/// </summary>
/// <typeparam name="TRole">Role to compose.</typeparam>
public interface Does<TRole> where TRole : Role { }
/// <summary>
/// Marks a role member as superseded in a composition type.
/// </summary>
[AttributeUsage(AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false)]
public class SupersedeAttribute : Attribute { }
/// <summary>
/// Marks a role member as a placeholder in a composition type.
/// The composition member will be replaced by the member from the role.
/// </summary>
[AttributeUsage(AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false)]
public class PlaceholderAttribute : Attribute { }
/// <summary>
/// Extension methods to aid in developing with roles in the same assembly, where
/// the post-compiler hasn't run yet.
/// </summary>
public static class Roles {
/// <summary>
/// Treats a composition type as one of the roles it composes.
/// Only necessary when using compositions in the same assembly that
/// they are defined, because the post-compiler hasn't yet run on them.
/// </summary>
/// <typeparam name="TRole">The role that the composition uses.</typeparam>
/// <param name="self">The composition.</param>
/// <returns>The composition cast to the desired role.</returns>
public static TRole As<TRole>(this Does<TRole> self) where TRole : Role {
return (TRole)self;
}
/// <summary>
/// Cast a role to another type. Note: this cast can fail.
/// Only necessary when using roles in the same assembly that
/// they are defined, because the post-compiler hasn't yet run on them.
/// </summary>
/// <typeparam name="T">Target type.</typeparam>
/// <param name="self">Role to cast from.</param>
/// <returns>The input role instance cast to the desired type.</returns>
public static T Cast<T>(this Role self) {
return (T)self;
}
}
}
|
mit
|
C#
|
a7654de3c46b7de212f378b8a0be8bd37bfd503d
|
Convert IEnumrable<char>.Count(...) to equivalent foreach loop, in anticipation of changing Peek(int) to return a ReadOnlySpan<char>, which is not compatible with the Count extension method.
|
plioi/parsley
|
src/Parsley/Text.cs
|
src/Parsley/Text.cs
|
namespace Parsley;
public class Text
{
int index;
readonly string input;
int line;
public Text(string input)
: this(input, 0, 1) { }
Text(string input, int index, int line)
{
this.input = input;
this.index = index;
if (index > input.Length)
this.index = input.Length;
this.line = line;
}
public string Peek(int characters)
=> index + characters >= input.Length
? input.Substring(index)
: input.Substring(index, characters);
public void Advance(int characters)
{
if (characters == 0)
return;
int newIndex = index + characters;
int countNewLines = 0;
foreach (var ch in Peek(characters))
if (ch == '\n')
countNewLines++;
int newLineNumber = line + countNewLines;
index = newIndex;
line = newLineNumber;
if (index > input.Length)
index = input.Length;
}
public bool EndOfInput => index >= input.Length;
public bool TryMatch(Predicate<char> test, out string value)
{
int i = index;
while (i < input.Length && test(input[i]))
i++;
value = Peek(i - index);
return value.Length > 0;
}
int Column
{
get
{
if (index == 0)
return 1;
int indexOfPreviousNewLine = input.LastIndexOf('\n', index - 1);
return index - indexOfPreviousNewLine;
}
}
public Position Position
=> new(line, Column);
public (int index, int line) Snapshot()
=> (index, line);
public void Restore((int index, int line) snapshot)
{
index = snapshot.index;
line = snapshot.line;
}
public override string ToString()
=> input.Substring(index);
}
|
namespace Parsley;
public class Text
{
int index;
readonly string input;
int line;
public Text(string input)
: this(input, 0, 1) { }
Text(string input, int index, int line)
{
this.input = input;
this.index = index;
if (index > input.Length)
this.index = input.Length;
this.line = line;
}
public string Peek(int characters)
=> index + characters >= input.Length
? input.Substring(index)
: input.Substring(index, characters);
public void Advance(int characters)
{
if (characters == 0)
return;
int newIndex = index + characters;
int newLineNumber = line + Peek(characters).Cast<char>().Count(ch => ch == '\n');
index = newIndex;
line = newLineNumber;
if (index > input.Length)
index = input.Length;
}
public bool EndOfInput => index >= input.Length;
public bool TryMatch(Predicate<char> test, out string value)
{
int i = index;
while (i < input.Length && test(input[i]))
i++;
value = Peek(i - index);
return value.Length > 0;
}
int Column
{
get
{
if (index == 0)
return 1;
int indexOfPreviousNewLine = input.LastIndexOf('\n', index - 1);
return index - indexOfPreviousNewLine;
}
}
public Position Position
=> new(line, Column);
public (int index, int line) Snapshot()
=> (index, line);
public void Restore((int index, int line) snapshot)
{
index = snapshot.index;
line = snapshot.line;
}
public override string ToString()
=> input.Substring(index);
}
|
mit
|
C#
|
e94e782d3a7987cbe95755426e2a63c65fa8c6e6
|
Fix build failure under mono
|
jthorpe4/EDDiscovery,jeoffman/EDDiscovery,mwerle/EDDiscovery,jgoode/EDDiscovery,vendolis/EDDiscovery,mwerle/EDDiscovery,jeoffman/EDDiscovery,vendolis/EDDiscovery,jgoode/EDDiscovery
|
EDDiscovery/Export/ExportBase.cs
|
EDDiscovery/Export/ExportBase.cs
|
using EDDiscovery.EliteDangerous;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Globalization;
using System.Linq;
using System.Text;
namespace EDDiscovery.Export
{
public enum CSVFormat
{
USA_UK = 0,
EU = 1,
}
public abstract class ExportBase
{
protected string delimiter = ",";
protected CultureInfo formatculture;
private CSVFormat csvformat;
public CSVFormat Csvformat
{
get
{
return csvformat;
}
set
{
csvformat = value;
if (csvformat == CSVFormat.EU)
{
delimiter = ";";
formatculture = new System.Globalization.CultureInfo("sv");
}
else
{
delimiter = ",";
formatculture = new System.Globalization.CultureInfo("en-US");
}
}
}
abstract public bool ToCSV(string filename);
abstract public bool GetData(EDDiscoveryForm _discoveryForm);
protected string MakeValueCsvFriendly(object value)
{
if (value == null) return delimiter;
if (value is INullable && ((INullable)value).IsNull) return delimiter;
if (value is DateTime)
{
if (((DateTime)value).TimeOfDay.TotalSeconds == 0)
return ((DateTime)value).ToString("yyyy-MM-dd") + delimiter; ;
return ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss") + delimiter; ;
}
string output = value.ToString();
if (output.Contains(",") || output.Contains("\""))
output = '"' + output.Replace("\"", "\"\"") + '"';
return output + delimiter;
}
}
}
|
using EDDiscovery.EliteDangerous;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Globalization;
using System.Linq;
using System.Text;
namespace EDDiscovery.Export
{
public enum CSVFormat
{
USA_UK = 0,
EU = 1,
}
public abstract class ExportBase
{
protected string delimiter = ",";
protected CultureInfo formatculture;
private CSVFormat csvformat;
public CSVFormat Csvformat
{
get
{
return csvformat;
}
set
{
csvformat = value;
if (csvformat == CSVFormat.EU)
{
delimiter = ";";
formatculture = new System.Globalization.CultureInfo("sv");
}
else
{
delimiter = ",";
formatculture = new System.Globalization.CultureInfo("en-US");
}
}
}
abstract public bool ToCSV(string filename);
abstract public bool GetData(EDDiscoveryForm _discoveryForm);
protected string MakeValueCsvFriendly(object value)
{
if (value == null) return delimiter;
if (value is Nullable && ((INullable)value).IsNull) return delimiter;
if (value is DateTime)
{
if (((DateTime)value).TimeOfDay.TotalSeconds == 0)
return ((DateTime)value).ToString("yyyy-MM-dd") + delimiter; ;
return ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss") + delimiter; ;
}
string output = value.ToString();
if (output.Contains(",") || output.Contains("\""))
output = '"' + output.Replace("\"", "\"\"") + '"';
return output + delimiter;
}
}
}
|
apache-2.0
|
C#
|
fb38a78e53309f2def82222b089929c3614d323d
|
Revert "test change to webapi"
|
abkmr/WebApi,abkmr/WebApi
|
OData/src/System.Web.Http.OData/OData/EdmEntityObject.cs
|
OData/src/System.Web.Http.OData/OData/EdmEntityObject.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using Microsoft.Data.Edm;
namespace System.Web.Http.OData
{
/// <summary>
/// Represents an <see cref="IEdmEntityObject"/> with no backing CLR <see cref="Type"/>.
/// </summary>
public class EdmEntityObject : EdmStructuredObject, IEdmEntityObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EdmStructuredObject"/> class.
/// </summary>
/// <param name="edmType">The <see cref="IEdmEntityType"/> of this object.</param>
public EdmEntityObject(IEdmEntityType edmType)
: this(edmType, isNullable: false)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EdmStructuredObject"/> class.
/// </summary>
/// <param name="edmType">The <see cref="IEdmEntityTypeReference"/> of this object.</param>
public EdmEntityObject(IEdmEntityTypeReference edmType)
: this(edmType.EntityDefinition(), edmType.IsNullable)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EdmStructuredObject"/> class.
/// </summary>
/// <param name="edmType">The <see cref="IEdmEntityType"/> of this object.</param>
/// <param name="isNullable">true if this object can be nullable; otherwise, false.</param>
public EdmEntityObject(IEdmEntityType edmType, bool isNullable)
: base(edmType, isNullable)
{
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using Microsoft.Data.Edm;
namespace System.Web.Http.OData
{
/// <summary>
/// Represents an <see cref="IEdmEntityObject"/> with no backing CLR <see cref="Type"/>.
/// </summary>
public class EdmEntityObject : EdmStructuredObject, IEdmEntityObject
{
/// <summary>
/// Initializes a new instance of the <see cref="EdmStructuredObject"/> class.
/// </summary>
/// <param name="edmType">The <see cref="IEdmEntityType"/> of this object.</param>
public EdmEntityObject(IEdmEntityType edmType)
: this(edmType, isNullable: false)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EdmStructuredObject"/> class.
/// </summary>
/// <param name="edmType">The <see cref="IEdmEntityTypeReference"/> of this object.</param>
public EdmEntityObject(IEdmEntityTypeReference edmType)
: this(edmType.EntityDefinition(), edmType.IsNullable)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EdmStructuredObject"/> class.
/// </summary>
/// <param name="edmType">The <see cref="IEdmEntityType"/> of this object.</param>
/// <param name="isNullable">true if this object can be nullable; otherwise, false.</param>
public EdmEntityObject(IEdmEntityType edmType, bool isNullable)
{
base(edmType, isNullable);
}
}
}
|
mit
|
C#
|
9b7127575989d2976b06aed69616a69523f9ad9b
|
Change default setting for mirror local groups. - Closes #119
|
MutonUfoAI/pgina,daviddumas/pgina,daviddumas/pgina,stefanwerfling/pgina,stefanwerfling/pgina,pgina/pgina,MutonUfoAI/pgina,stefanwerfling/pgina,MutonUfoAI/pgina,daviddumas/pgina,pgina/pgina,pgina/pgina
|
Plugins/LocalMachine/Settings.cs
|
Plugins/LocalMachine/Settings.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using pGina.Shared.Settings;
namespace pGina.Plugin.LocalMachine
{
public class Settings
{
private static dynamic m_settings = new pGinaDynamicSettings(PluginImpl.PluginUuid);
static Settings()
{
// Authentication step settings:
m_settings.SetDefault("AlwaysAuthenticate", true); // Auth regardless of other plugins auth step
// Authorization step settings
m_settings.SetDefault("AuthzLocalAdminsOnly", false); // Prevent non-admins
m_settings.SetDefault("AuthzLocalGroupsOnly", false); // Require group membership in following list
m_settings.SetDefault("AuthzLocalGroups", new string[] { }); // Only users in these groups (in their UserInformation, not in SAM!) can be authorized
m_settings.SetDefault("AuthzApplyToAllUsers", true); // Authorize *all* users according to above rules, if false - non-admin/group checks are only done for users *we* authenticated
m_settings.SetDefault("MirrorGroupsForAuthdUsers", true); // Load users groups from local SAM into userInfo
// Gateway step settings
m_settings.SetDefault("GroupCreateFailIsFail", true); // Do we fail gateway if group create/add fails?
m_settings.SetDefault("MandatoryGroups", new string[] { }); // *All* users are added to these groups (by name)
m_settings.SetDefault("ScramblePasswords", false); // Do we scramble users passwords after logout?
m_settings.SetDefault("RemoveProfiles", false); // Do we remove accounts/profiles after logout?
// Notification settings
m_settings.SetDefault("CleanupUsers", new string[] { }); // List of principal names we must cleanup!
m_settings.SetDefault("BackgroundTimerSeconds", 60); // How often we look to cleanup
}
public static dynamic Store
{
get { return m_settings; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using pGina.Shared.Settings;
namespace pGina.Plugin.LocalMachine
{
public class Settings
{
private static dynamic m_settings = new pGinaDynamicSettings(PluginImpl.PluginUuid);
static Settings()
{
// Authentication step settings:
m_settings.SetDefault("AlwaysAuthenticate", true); // Auth regardless of other plugins auth step
// Authorization step settings
m_settings.SetDefault("AuthzLocalAdminsOnly", false); // Prevent non-admins
m_settings.SetDefault("AuthzLocalGroupsOnly", false); // Require group membership in following list
m_settings.SetDefault("AuthzLocalGroups", new string[] { }); // Only users in these groups (in their UserInformation, not in SAM!) can be authorized
m_settings.SetDefault("AuthzApplyToAllUsers", true); // Authorize *all* users according to above rules, if false - non-admin/group checks are only done for users *we* authenticated
m_settings.SetDefault("MirrorGroupsForAuthdUsers", false); // Load users groups from local SAM into userInfo
// Gateway step settings
m_settings.SetDefault("GroupCreateFailIsFail", true); // Do we fail gateway if group create/add fails?
m_settings.SetDefault("MandatoryGroups", new string[] { }); // *All* users are added to these groups (by name)
m_settings.SetDefault("ScramblePasswords", false); // Do we scramble users passwords after logout?
m_settings.SetDefault("RemoveProfiles", false); // Do we remove accounts/profiles after logout?
// Notification settings
m_settings.SetDefault("CleanupUsers", new string[] { }); // List of principal names we must cleanup!
m_settings.SetDefault("BackgroundTimerSeconds", 60); // How often we look to cleanup
}
public static dynamic Store
{
get { return m_settings; }
}
}
}
|
bsd-3-clause
|
C#
|
f00dcde0d3033d2dc775b6990c6890be4781959e
|
Update index.cshtml
|
ArtyomGusarov/AzureWebAppProjectCloud,ArtyomGusarov/AzureWebAppProjectCloud
|
site/index.cshtml
|
site/index.cshtml
|
@{
var txt = DateTime.Now;
}
<html>
<body>
<p>The dateTime is @txt</p>
</body>
</html>
|
@{
var txt = DateTime.Now;
}
<html>
<body>
<p>The DateTime is @txt</p>
</body>
</html>
|
mit
|
C#
|
ece15d692e82d1fb39cbb1dbca4591e14109d006
|
Fix metadata key, its the aggregate sequence number not the global one
|
liemqv/EventFlow,AntoineGa/EventFlow,rasmus/EventFlow
|
Source/EventFlow/MetadataKeys.cs
|
Source/EventFlow/MetadataKeys.cs
|
// The MIT License (MIT)
//
// Copyright (c) 2015 Rasmus Mikkelsen
// https://github.com/rasmus/EventFlow
//
// 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.
namespace EventFlow
{
public sealed class MetadataKeys
{
public const string EventName = "event_name";
public const string EventVersion = "event_version";
public const string Timestamp = "timestamp";
public const string AggregateSequenceNumber = "aggregate_sequence_number";
}
}
|
// The MIT License (MIT)
//
// Copyright (c) 2015 Rasmus Mikkelsen
// https://github.com/rasmus/EventFlow
//
// 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.
namespace EventFlow
{
public sealed class MetadataKeys
{
public const string EventName = "event_name";
public const string EventVersion = "event_version";
public const string Timestamp = "timestamp";
public const string AggregateSequenceNumber = "global_sequence_number";
}
}
|
mit
|
C#
|
c8eb499a701a057236533701d231b49cc0f5d585
|
update demo
|
csyntax/MyDynamicXmlBuilder
|
sample/Program.cs
|
sample/Program.cs
|
using System;
using System.Dynamic;
using MyDynamicXmlBuilder;
namespace MyDynamicXmlBuilder.Example
{
internal class Program
{
internal static void Main(string[] args)
{
dynamic xml = new XmlBuilder();
xml.Declaration();
/* xml.user("Kiro Zlatniq", new
{
id = 1,
username = "kiro",
age = 50,
});*/
xml.user(XmlBuilder.Fragment(u => {
u.firstname("Kiro");
u.lastname("Zlatnia");
u.email("kiro@zlatnia.bg");
u.phone(new { type = "cell" }, "(985) 555-1234");
}));
Console.WriteLine(xml.ToString(true));
}
}
}
|
using System;
using System.Dynamic;
using MyDynamicXmlBuilder;
namespace MyDynamicXmlBuilder.Example
{
internal class Program
{
internal static void Main(string[] args)
{
dynamic xml = new XmlBuilder();
xml.Declaration();
xml.user("Kiro Zlatniq", new
{
id = 1,
username = "kiro",
age = 50,
});
Console.WriteLine(xml.ToString(true));
}
}
}
|
mit
|
C#
|
043b93a152c20ee56e15a4d9ec3287a9b7864921
|
bump version
|
sabarcelos/EasyGelf,Pliner/EasyGelf,WassMM/EasyGelf
|
Source/Version.cs
|
Source/Version.cs
|
using System;
using System.Reflection;
// EasyGelf version number: <major>.<minor>.<non-breaking-feature>.<build>
[assembly: AssemblyVersion("0.2.3.0")]
[assembly: CLSCompliant(true)]
//0.2.3.0 Facility, LoggerName, ThreadName and Source Info
//0.2.2.0 Transport Encoders
//0.2.1.0 Buffered Transport
//0.2.0.0 Merge all external dependencies except log4net into one assembly
//0.1.0.0 Initial
|
using System;
using System.Reflection;
// EasyGelf version number: <major>.<minor>.<non-breaking-feature>.<build>
[assembly: AssemblyVersion("0.2.2.0")]
[assembly: CLSCompliant(true)]
//0.2.2.0 Transport Encoders
//0.2.1.0 Buffered Transport
//0.2.0.0 Merge all external dependencies except log4net into one assembly
//0.1.0.0 Initial
|
mit
|
C#
|
f1aa99e1033c8115259f4b9dcbc7c9ecf49932b0
|
Fix catch selection blueprint not displayed after copy-pasted
|
peppy/osu,UselessToucan/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu,smoogipooo/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,peppy/osu,ppy/osu
|
osu.Game.Rulesets.Catch/Edit/Blueprints/CatchSelectionBlueprint.cs
|
osu.Game.Rulesets.Catch/Edit/Blueprints/CatchSelectionBlueprint.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints
{
public abstract class CatchSelectionBlueprint<THitObject> : HitObjectSelectionBlueprint<THitObject>
where THitObject : CatchHitObject
{
protected override bool AlwaysShowWhenSelected => true;
public override Vector2 ScreenSpaceSelectionPoint
{
get
{
float x = HitObject.OriginalX;
float y = HitObjectContainer.PositionAtTime(HitObject.StartTime);
return HitObjectContainer.ToScreenSpace(new Vector2(x, y + HitObjectContainer.DrawHeight));
}
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => SelectionQuad.Contains(screenSpacePos);
protected ScrollingHitObjectContainer HitObjectContainer => (ScrollingHitObjectContainer)playfield.HitObjectContainer;
[Resolved]
private Playfield playfield { get; set; }
protected CatchSelectionBlueprint(THitObject hitObject)
: base(hitObject)
{
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints
{
public abstract class CatchSelectionBlueprint<THitObject> : HitObjectSelectionBlueprint<THitObject>
where THitObject : CatchHitObject
{
public override Vector2 ScreenSpaceSelectionPoint
{
get
{
float x = HitObject.OriginalX;
float y = HitObjectContainer.PositionAtTime(HitObject.StartTime);
return HitObjectContainer.ToScreenSpace(new Vector2(x, y + HitObjectContainer.DrawHeight));
}
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => SelectionQuad.Contains(screenSpacePos);
protected ScrollingHitObjectContainer HitObjectContainer => (ScrollingHitObjectContainer)playfield.HitObjectContainer;
[Resolved]
private Playfield playfield { get; set; }
protected CatchSelectionBlueprint(THitObject hitObject)
: base(hitObject)
{
}
}
}
|
mit
|
C#
|
2fda1965c46823739ae293e09e1a75ee597c635d
|
Test for throwing exception when pop on empty stack
|
ozim/CakeStuff
|
ReverseWords/LargestElementInStack/LargestElementInStackTests.cs
|
ReverseWords/LargestElementInStack/LargestElementInStackTests.cs
|
namespace LargestElementInStack
{
using System;
using NUnit.Framework;
[TestFixture]
public class LargestElementInStackTests
{
[Test]
public void WhenPushedTwoValuesLatestIsReturnedByPop()
{
LargestElementInStack stack = new LargestElementInStack();
int firstValue = 10;
int secondValue = 15;
stack.Push(firstValue);
stack.Push(secondValue);
int returnedValue = stack.Pop();
Assert.AreEqual(secondValue, returnedValue);
}
[Test]
public void PoppedValueIsRemovedFromStack()
{
LargestElementInStack stack = new LargestElementInStack();
int firstValue = 10;
int secondValue = 15;
stack.Push(firstValue);
stack.Push(secondValue);
stack.Pop();
int returnedValue = stack.Pop();
Assert.AreEqual(firstValue, returnedValue);
}
[Test]
public void PeekDoesNotRemoveValueFromStack()
{
LargestElementInStack stack = new LargestElementInStack();
int firstValue = 10;
int secondValue = 15;
stack.Push(firstValue);
stack.Push(secondValue);
stack.Peek();
int returnedValue = stack.Pop();
Assert.AreEqual(secondValue, returnedValue);
}
[Test]
public void GetMaxReturnsMaxValue()
{
LargestElementInStack stack = new LargestElementInStack();
int firstValue = 10;
int secondValue = 25;
int thirdValue = 15;
stack.Push(firstValue);
stack.Push(secondValue);
stack.Push(thirdValue);
int returnedValue = stack.GetMax();
Assert.AreEqual(secondValue, returnedValue);
}
[Test]
public void ThrowsInvalidOperationExceptionWhilePopOnEmptyStack() {
LargestElementInStack stack = new LargestElementInStack();
Assert.Throws(typeof(InvalidOperationException), () => stack.Pop());
}
}
}
|
namespace LargestElementInStack
{
using NUnit.Framework;
[TestFixture]
public class LargestElementInStackTests
{
[Test]
public void WhenPushedTwoValuesLatestIsReturnedByPop()
{
LargestElementInStack stack = new LargestElementInStack();
int firstValue = 10;
int secondValue = 15;
stack.Push(firstValue);
stack.Push(secondValue);
int returnedValue = stack.Pop();
Assert.AreEqual(secondValue, returnedValue);
}
[Test]
public void PoppedValueIsRemovedFromStack()
{
LargestElementInStack stack = new LargestElementInStack();
int firstValue = 10;
int secondValue = 15;
stack.Push(firstValue);
stack.Push(secondValue);
stack.Pop();
int returnedValue = stack.Pop();
Assert.AreEqual(firstValue, returnedValue);
}
[Test]
public void PeekDoesNotRemoveValueFromStack()
{
LargestElementInStack stack = new LargestElementInStack();
int firstValue = 10;
int secondValue = 15;
stack.Push(firstValue);
stack.Push(secondValue);
stack.Peek();
int returnedValue = stack.Pop();
Assert.AreEqual(secondValue, returnedValue);
}
[Test]
public void GetMaxReturnsMaxValue()
{
LargestElementInStack stack = new LargestElementInStack();
int firstValue = 10;
int secondValue = 25;
int thirdValue = 15;
stack.Push(firstValue);
stack.Push(secondValue);
stack.Push(thirdValue);
int returnedValue = stack.GetMax();
Assert.AreEqual(secondValue, returnedValue);
}
}
}
|
apache-2.0
|
C#
|
0558f7b4b8e0002c9d8b6677a07d45b0b37eebe3
|
Remove events from FigureModel
|
virtuallynaked/virtually-naked,virtuallynaked/virtually-naked
|
Viewer/src/figure/FigureModel.cs
|
Viewer/src/figure/FigureModel.cs
|
using System;
using System.Linq;
public class FigureModel {
private readonly FigureDefinition definition;
public FigureModel(FigureDefinition definition) {
this.definition = definition;
}
public bool IsVisible { get; set; }
public Shape Shape { get; set; }
public MaterialSetOption MaterialSet { get; set; }
public string ShapeName {
get {
return Shape?.Label;
}
set {
var shape = definition.ShapeOptions.Find(option => option.Label == value);
if (shape == null) {
shape = definition.ShapeOptions.First();
}
Shape = shape;
}
}
public string MaterialSetName {
get {
return MaterialSet?.Label;
}
set {
var materialSet = definition.MaterialSetOptions.Find(option => option.Label == value);
if (materialSet == null) {
materialSet = definition.MaterialSetOptions.First();
}
MaterialSet = materialSet;
}
}
}
|
using System;
using System.Linq;
public class FigureModel {
private readonly FigureDefinition definition;
public FigureModel(FigureDefinition definition) {
this.definition = definition;
}
private bool isVisible = true;
public event Action<bool, bool> IsVisibleChanged;
public bool IsVisible {
get {
return isVisible;
}
set {
var old = isVisible;
isVisible = value;
IsVisibleChanged?.Invoke(old, value);
}
}
private Shape shape;
public event Action<Shape, Shape> ShapeChanged;
public Shape Shape {
get {
return shape;
}
set {
var old = shape;
shape = value;
ShapeChanged?.Invoke(old, value);
}
}
private MaterialSetOption materialSet;
public event Action<MaterialSetOption, MaterialSetOption> MaterialSetChanged;
public MaterialSetOption MaterialSet {
get {
return materialSet;
}
set {
var old = materialSet;
materialSet = value;
MaterialSetChanged?.Invoke(old, value);
}
}
public string ShapeName {
get {
return Shape?.Label;
}
set {
var shape = definition.ShapeOptions.Find(option => option.Label == value);
if (shape == null) {
shape = definition.ShapeOptions.First();
}
Shape = shape;
}
}
public string MaterialSetName {
get {
return MaterialSet?.Label;
}
set {
var materialSet = definition.MaterialSetOptions.Find(option => option.Label == value);
if (materialSet == null) {
materialSet = definition.MaterialSetOptions.First();
}
MaterialSet = materialSet;
}
}
}
|
mit
|
C#
|
41aa5617d16a416afaaf8c33ed8b91f04fa52d06
|
remove comments
|
AEdmunds/Vassall-Theme,AEdmunds/Vassall-Theme,AEdmunds/Vassall-Theme,AEdmunds/Vassall-Theme,AEdmunds/Vassall-Theme,AEdmunds/Vassall-Theme
|
Views/AdditionalResources.cshtml
|
Views/AdditionalResources.cshtml
|
@{
Style.Require("bootstrap");
Style.Require("custom");
Style.Require("styler");
Style.Require("isotope");
Style.Require("color_scheme");
Style.Require("google-fonts");
Style.Require("font-awesome");
Style.Require("font-awesome-ie7");
Style.Require("flexslider");
Style.Require("jquery.fancybox");
Style.Require("overwrite");
Style.Require("bic-cal");
Script.Require("jquery-ui");
Script.Require("bootstrap");
Script.Require("jquery.flexslider");
Script.Require("jquery.isotope");
Script.Require("jquery.fancybox.pack");
Script.Require("rs-plugin");
Script.Require("rs-plugin-revolution");
Script.Require("revolution");
Script.Require("custom");
Script.Require("access");
}
|
@{
/* Links
***************************************************************/
//RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content(theme.Location + "/" + theme.Path + "/Images/" + "favicon.ico")});
// SetMeta(new MetaEntry { Name = "viewport", Content = "width=device-width, initial-scale=1.0" }); // Needed for Bootstrap responsiveness
// SetMeta(httpEquiv: "X-UA-Compatible", content: "IE=edge,chrome=1");
/* Styles
***************************************************************/
// Style.Include("site.css");
Style.Require("bootstrap");
Style.Require("custom");
Style.Require("styler");
Style.Require("isotope");
Style.Require("color_scheme");
Style.Require("google-fonts");
Style.Require("font-awesome");
Style.Require("font-awesome-ie7");
Style.Require("flexslider");
Style.Require("jquery.fancybox");
Style.Require("overwrite");
Style.Require("bic-cal");
/* Scripts
***************************************************************/
//Script.Include("~/Core/Shapes/Scripts/html5.js").AtHead();
// script files
//Script.Require("jquery.1.7.2");
Script.Require("jquery-ui");
Script.Require("bootstrap");
Script.Require("jquery.flexslider");
Script.Require("jquery.isotope");
Script.Require("jquery.fancybox.pack");
Script.Require("rs-plugin");
Script.Require("rs-plugin-revolution");
Script.Require("revolution");
Script.Require("custom");
//Script.Require("bic-cal");
Script.Require("access");
}
|
bsd-2-clause
|
C#
|
78f7dd4c850eb9c860ab674b7f07957e4db361eb
|
Rename ChessPiece.IsValidDestination parameters
|
ProgramFOX/Chess.NET
|
ChessDotNet/ChessPiece.cs
|
ChessDotNet/ChessPiece.cs
|
namespace ChessDotNet
{
public abstract class ChessPiece
{
public abstract Player Owner
{
get;
set;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj))
return true;
if (obj == null || GetType() != obj.GetType())
return false;
ChessPiece piece1 = this;
ChessPiece piece2 = (ChessPiece)obj;
return piece1.Owner == piece2.Owner;
}
public override int GetHashCode()
{
return new { Piece = GetFenCharacter(), Owner }.GetHashCode();
}
public static bool operator ==(ChessPiece piece1, ChessPiece piece2)
{
if (ReferenceEquals(piece1, piece2))
return true;
if ((object)piece1 == null || (object)piece2 == null)
return false;
return piece1.Equals(piece2);
}
public static bool operator !=(ChessPiece piece1, ChessPiece piece2)
{
if (ReferenceEquals(piece1, piece2))
return false;
if ((object)piece1 == null || (object)piece2 == null)
return true;
return !piece1.Equals(piece2);
}
public abstract string GetFenCharacter();
public abstract bool IsValidDestination(Position origin, Position destination, ChessGame game);
}
}
|
namespace ChessDotNet
{
public abstract class ChessPiece
{
public abstract Player Owner
{
get;
set;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj))
return true;
if (obj == null || GetType() != obj.GetType())
return false;
ChessPiece piece1 = this;
ChessPiece piece2 = (ChessPiece)obj;
return piece1.Owner == piece2.Owner;
}
public override int GetHashCode()
{
return new { Piece = GetFenCharacter(), Owner }.GetHashCode();
}
public static bool operator ==(ChessPiece piece1, ChessPiece piece2)
{
if (ReferenceEquals(piece1, piece2))
return true;
if ((object)piece1 == null || (object)piece2 == null)
return false;
return piece1.Equals(piece2);
}
public static bool operator !=(ChessPiece piece1, ChessPiece piece2)
{
if (ReferenceEquals(piece1, piece2))
return false;
if ((object)piece1 == null || (object)piece2 == null)
return true;
return !piece1.Equals(piece2);
}
public abstract string GetFenCharacter();
public abstract bool IsValidDestination(Position from, Position to, ChessGame game);
}
}
|
mit
|
C#
|
ae20932db9b96e06e818bb6e245cdfff4d341cfc
|
Fix access and placement of WmChromaEvent.
|
danpierce1/Colore,CoraleStudios/Colore,WolfspiritM/Colore,Sharparam/Colore
|
Colore/Razer/Constants.cs
|
Colore/Razer/Constants.cs
|
// ---------------------------------------------------------------------------------------
// <copyright file="Constants.cs" company="">
// Copyright © 2015 by Adam Hellberg and Brandon Scott.
//
// 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.
//
// Disclaimer: Colore is in no way affiliated with Razer and/or any of its employees
// and/or licensors. Adam Hellberg and Brandon Scott do not take responsibility
// for any harm caused, direct or indirect, to any Razer peripherals
// via the use of Colore.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
// ---------------------------------------------------------------------------------------
using System;
namespace Colore.Razer
{
/// <summary>
/// The definitions of generic constant values used in the project
/// </summary>
public static class Constants
{
/// <summary>
/// Used by Razer code to send Chroma event messages.
/// </summary>
public const UInt32 WmChromaEvent = WmApp + 0x2000;
/// <summary>
/// Used to define private messages, usually of the form WM_APP+x, where x is an integer value.
/// </summary>
/// <remarks>
/// The <strong>WM_APP</strong> constant is used to distinguish between message values
/// that are reserved for use by the system and values that can be used by an
/// application to send messages within a private window class.
/// </remarks>
private const UInt32 WmApp = 0x8000;
}
}
|
// ---------------------------------------------------------------------------------------
// <copyright file="Constants.cs" company="">
// Copyright © 2015 by Adam Hellberg and Brandon Scott.
//
// 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.
//
// Disclaimer: Colore is in no way affiliated with Razer and/or any of its employees
// and/or licensors. Adam Hellberg and Brandon Scott do not take responsibility
// for any harm caused, direct or indirect, to any Razer peripherals
// via the use of Colore.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
// ---------------------------------------------------------------------------------------
using System;
namespace Colore.Razer
{
/// <summary>
/// The definitions of generic constant values used in the project
/// </summary>
public static class Constants
{
/// <summary>
/// Used to define private messages, usually of the form WM_APP+x, where x is an integer value.
/// </summary>
/// <remarks>
/// The <strong>WM_APP</strong> constant is used to distinguish between message values
/// that are reserved for use by the system and values that can be used by an
/// application to send messages within a private window class.
/// </remarks>
private const UInt32 WmApp = 0x8000;
/// <summary>
/// Used by Razer code to send Chroma event messages.
/// </summary>
const UInt32 WmChromaEvent = WmApp + 0x2000;
}
}
|
mit
|
C#
|
5c727525f38a08a3fdeb51830836a9b38642150b
|
introduce a typo => runtime error
|
jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets
|
BuildViews/FrameworkWeb/Views/Home/Contact.cshtml
|
BuildViews/FrameworkWeb/Views/Home/Contact.cshtml
|
@model FrameworkWeb.Models.CompanyInfo
@{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
@Model.PhoneNubmer
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>
|
@model FrameworkWeb.Models.CompanyInfo
@{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
@Model.PhoneNumber
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>
|
apache-2.0
|
C#
|
80fbd89f111c742f06487de07e808f5ba30c448f
|
Rename args to arguments in ICommand.
|
janpieterz/CommandRunner,Intreba/CommandRunner
|
CommandRunner/ICommand.cs
|
CommandRunner/ICommand.cs
|
using System.Collections.Generic;
namespace CommandRunner
{
/// <summary>
/// Implement this interface to enable your commands.
/// </summary>
public interface ICommand
{
/// <summary>
/// Method called when command should be executed.
/// </summary>
/// <param name="arguments">The arguments a user provied, minus the Command itself</param>
void Execute(IEnumerable<string> arguments);
/// <summary>
/// A simple help to document all different sub-commands so users can easily see which parameters should be used and how.
/// </summary>
IEnumerable<string> Help { get; }
/// <summary>
/// The command identifier.
/// </summary>
string Command { get; }
}
}
|
using System.Collections.Generic;
namespace CommandRunner
{
/// <summary>
/// Implement this interface to enable your commands.
/// </summary>
public interface ICommand
{
/// <summary>
/// Method called when command should be executed.
/// </summary>
/// <param name="args">The arguments a user provied, minus the Command itself</param>
void Execute(IEnumerable<string> args);
/// <summary>
/// A simple help to document all different sub-commands so users can easily see which parameters should be used and how.
/// </summary>
IEnumerable<string> Help { get; }
/// <summary>
/// The command identifier.
/// </summary>
string Command { get; }
}
}
|
mit
|
C#
|
233801521ccfe70ff18bfc9ade7cf4d040a5b619
|
Set version 0.8.2
|
hazzik/DelegateDecompiler,morgen2009/DelegateDecompiler,jaenyph/DelegateDecompiler
|
src/DelegateDecompiler/Properties/AssemblyInfo.cs
|
src/DelegateDecompiler/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("DelegateDecompiler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DelegateDecompiler")]
[assembly: AssemblyCopyright("Copyright © hazzik 2012 - 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cec0a257-502b-4718-91c3-9e67555c5e1b")]
// 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.8.2.0")]
[assembly: AssemblyFileVersion("0.8.2.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("DelegateDecompiler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DelegateDecompiler")]
[assembly: AssemblyCopyright("Copyright © hazzik 2012 - 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cec0a257-502b-4718-91c3-9e67555c5e1b")]
// 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.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
|
mit
|
C#
|
e41e669f24f53b14680e598dab7b5186d3fddc57
|
Make construct protected
|
github/VisualStudio,github/VisualStudio,github/VisualStudio
|
src/GitHub.InlineReviews/Tags/InlineCommentTag.cs
|
src/GitHub.InlineReviews/Tags/InlineCommentTag.cs
|
using GitHub.Extensions;
using GitHub.Services;
using GitHub.Models;
using Microsoft.VisualStudio.Text.Tagging;
namespace GitHub.InlineReviews.Tags
{
/// <summary>
/// Base class for inline comment tags.
/// </summary>
/// <seealso cref="AddInlineCommentTag"/>
/// <seealso cref="ShowInlineCommentTag"/>
public abstract class InlineCommentTag : ITag
{
protected InlineCommentTag(
IPullRequestSession session,
int lineNumber,
DiffChangeType diffChangeType)
{
Guard.ArgumentNotNull(session, nameof(session));
LineNumber = lineNumber;
Session = session;
DiffChangeType = diffChangeType;
}
public int LineNumber { get; }
public IPullRequestSession Session { get; }
public DiffChangeType DiffChangeType { get; }
}
}
|
using GitHub.Extensions;
using GitHub.Services;
using GitHub.Models;
using Microsoft.VisualStudio.Text.Tagging;
namespace GitHub.InlineReviews.Tags
{
/// <summary>
/// Base class for inline comment tags.
/// </summary>
/// <seealso cref="AddInlineCommentTag"/>
/// <seealso cref="ShowInlineCommentTag"/>
public abstract class InlineCommentTag : ITag
{
public InlineCommentTag(
IPullRequestSession session,
int lineNumber,
DiffChangeType diffChangeType)
{
Guard.ArgumentNotNull(session, nameof(session));
LineNumber = lineNumber;
Session = session;
DiffChangeType = diffChangeType;
}
public int LineNumber { get; }
public IPullRequestSession Session { get; }
public DiffChangeType DiffChangeType { get; }
}
}
|
mit
|
C#
|
d25792a686ffe626744872f4149a6d621ecdd71c
|
Fix flags (Mac shouldn't be 0 based)
|
Redth/Cake.Xamarin.Build
|
Cake.Xamarin.Build/Models/BuildPlatforms.cs
|
Cake.Xamarin.Build/Models/BuildPlatforms.cs
|
using System;
namespace Cake.Xamarin.Build
{
[Flags]
public enum BuildPlatforms
{
Mac = 1,
Windows = 2,
Linux = 4
}
}
|
using System;
namespace Cake.Xamarin.Build
{
[Flags]
public enum BuildPlatforms
{
Mac = 0,
Windows = 1,
Linux = 2
}
}
|
mit
|
C#
|
cee5ca3ae9fbaa82d1026e64484c171a4a6ce662
|
Update FullAuditedEntityOfTPrimaryKey.cs
|
lemestrez/aspnetboilerplate,liujunhua/aspnetboilerplate,beratcarsi/aspnetboilerplate,expertmaksud/aspnetboilerplate,ddNils/aspnetboilerplate,carldai0106/aspnetboilerplate,Tobyee/aspnetboilerplate,690486439/aspnetboilerplate,AlexGeller/aspnetboilerplate,nicklv/aspnetboilerplate,MDSNet2016/aspnetboilerplate,690486439/aspnetboilerplate,liujunhua/aspnetboilerplate,yuzukwok/aspnetboilerplate,SecComm/aspnetboilerplate,carldai0106/aspnetboilerplate,SXTSOFT/aspnetboilerplate,asauriol/aspnetboilerplate,nineconsult/Kickoff2016Net,s-takatsu/aspnetboilerplate,ryancyq/aspnetboilerplate,ilyhacker/aspnetboilerplate,nicklv/aspnetboilerplate,zquans/aspnetboilerplate,ZhaoRd/aspnetboilerplate,LenFon/aspnetboilerplate,AntTech/aspnetboilerplate,SecComm/aspnetboilerplate,daywrite/aspnetboilerplate,fengyeju/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,verdentk/aspnetboilerplate,spraiin/aspnetboilerplate,asauriol/aspnetboilerplate,LenFon/aspnetboilerplate,anhuisunfei/aspnetboilerplate,ryancyq/aspnetboilerplate,sagacite2/aspnetboilerplate,AndHuang/aspnetboilerplate,ddNils/aspnetboilerplate,beratcarsi/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ZhaoRd/aspnetboilerplate,sagacite2/aspnetboilerplate,FJQBT/ABP,zquans/aspnetboilerplate,andmattia/aspnetboilerplate,luenick/aspnetboilerplate,luchaoshuai/aspnetboilerplate,Nongzhsh/aspnetboilerplate,zclmoon/aspnetboilerplate,s-takatsu/aspnetboilerplate,Tinkerc/aspnetboilerplate,lvjunlei/aspnetboilerplate,chendong152/aspnetboilerplate,zclmoon/aspnetboilerplate,lidonghao1116/aspnetboilerplate,ddNils/aspnetboilerplate,AlexGeller/aspnetboilerplate,AndHuang/aspnetboilerplate,hanu412/aspnetboilerplate,nineconsult/Kickoff2016Net,yuzukwok/aspnetboilerplate,daywrite/aspnetboilerplate,ryancyq/aspnetboilerplate,4nonym0us/aspnetboilerplate,Saviio/aspnetboilerplate,ilyhacker/aspnetboilerplate,virtualcca/aspnetboilerplate,ilyhacker/aspnetboilerplate,fengyeju/aspnetboilerplate,chendong152/aspnetboilerplate,lidonghao1116/aspnetboilerplate,virtualcca/aspnetboilerplate,oceanho/aspnetboilerplate,azhe127/aspnetboilerplate,lvjunlei/aspnetboilerplate,burakaydemir/aspnetboilerplate,MetSystem/aspnetboilerplate,beratcarsi/aspnetboilerplate,lvjunlei/aspnetboilerplate,verdentk/aspnetboilerplate,luenick/aspnetboilerplate,s-takatsu/aspnetboilerplate,jefferyzhang/aspnetboilerplate,chenkaibin/aspnetboilerplate,Tobyee/aspnetboilerplate,dVakulen/aspnetboilerplate,chenkaibin/aspnetboilerplate,Sivalingaamorthy/aspnetboilerplate,Saviio/aspnetboilerplate,ShiningRush/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,jaq316/aspnetboilerplate,gentledepp/aspnetboilerplate,oceanho/aspnetboilerplate,carldai0106/aspnetboilerplate,AndHuang/aspnetboilerplate,berdankoca/aspnetboilerplate,fengyeju/aspnetboilerplate,gentledepp/aspnetboilerplate,ShiningRush/aspnetboilerplate,jefferyzhang/aspnetboilerplate,berdankoca/aspnetboilerplate,MaikelE/aspnetboilerplate-fork,takintsft/aspnetboilerplate,zclmoon/aspnetboilerplate,Nongzhsh/aspnetboilerplate,4nonym0us/aspnetboilerplate,burakaydemir/aspnetboilerplate,cato541265/aspnetboilerplate,690486439/aspnetboilerplate,zquans/aspnetboilerplate,Nongzhsh/aspnetboilerplate,Sivalingaamorthy/aspnetboilerplate,AlexGeller/aspnetboilerplate,hanu412/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,yuzukwok/aspnetboilerplate,dVakulen/aspnetboilerplate,spraiin/aspnetboilerplate,MetSystem/aspnetboilerplate,daywrite/aspnetboilerplate,yhhno/aspnetboilerplate,SecComm/aspnetboilerplate,MDSNet2016/aspnetboilerplate,virtualcca/aspnetboilerplate,chenkaibin/aspnetboilerplate,FJQBT/ABP,MaikelE/aspnetboilerplate-fork,takintsft/aspnetboilerplate,anhuisunfei/aspnetboilerplate,gregoriusxu/aspnetboilerplate,yhhno/aspnetboilerplate,jaq316/aspnetboilerplate,andmattia/aspnetboilerplate,MaikelE/aspnetboilerplate-fork,oceanho/aspnetboilerplate,saeedallahyari/aspnetboilerplate,jaq316/aspnetboilerplate,cato541265/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,Tobyee/aspnetboilerplate,backendeveloper/aspnetboilerplate,berdankoca/aspnetboilerplate,rucila/aspnetboilerplate,AntTech/aspnetboilerplate,lemestrez/aspnetboilerplate,azhe127/aspnetboilerplate,Tinkerc/aspnetboilerplate,lemestrez/aspnetboilerplate,backendeveloper/aspnetboilerplate,SXTSOFT/aspnetboilerplate,rucila/aspnetboilerplate,verdentk/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,saeedallahyari/aspnetboilerplate,ShiningRush/aspnetboilerplate,gregoriusxu/aspnetboilerplate,SXTSOFT/aspnetboilerplate,ZhaoRd/aspnetboilerplate,4nonym0us/aspnetboilerplate,expertmaksud/aspnetboilerplate,andmattia/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate
|
src/Abp/Domain/Entities/Auditing/FullAuditedEntityOfTPrimaryKey.cs
|
src/Abp/Domain/Entities/Auditing/FullAuditedEntityOfTPrimaryKey.cs
|
using System;
namespace Abp.Domain.Entities.Auditing
{
/// <summary>
/// Implements <see cref="IFullAudited"/> to be a base class for full-audited entities.
/// </summary>
/// <typeparam name="TPrimaryKey">Type of the primary key of the entity</typeparam>
public abstract class FullAuditedEntity<TPrimaryKey> : AuditedEntity<TPrimaryKey>, IFullAudited
{
/// <summary>
/// Is this entity Deleted?
/// </summary>
public virtual bool IsDeleted { get; set; }
/// <summary>
/// Which user deleted this entity?
/// </summary>
public virtual long? DeleterUserId { get; set; }
/// <summary>
/// Deletion time of this entity.
/// </summary>
public virtual DateTime? DeletionTime { get; set; }
}
}
|
using System;
namespace Abp.Domain.Entities.Auditing
{
/// <summary>
/// Implements <see cref="IFullAudited"/> to be a base class for full-audited entities.
/// </summary>
/// <typeparam name="TPrimaryKey">Type of the primary key of the entity</typeparam>
public abstract class FullAuditedEntity<TPrimaryKey> : AuditedEntity<TPrimaryKey>, IFullAudited
{
/// <summary>
/// Is this entity Deleted?
/// </summary>
public bool IsDeleted { get; set; }
/// <summary>
/// Which user deleted this entity?
/// </summary>
public long? DeleterUserId { get; set; }
/// <summary>
/// Deletion time of this entity.
/// </summary>
public DateTime? DeletionTime { get; set; }
}
}
|
mit
|
C#
|
9f9a7fd0f960b447ec85990dc21c435e8f815f25
|
document C# EntryPointFinder
|
dotnet/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,mavasani/roslyn,weltkante/roslyn,weltkante/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn
|
src/VisualStudio/CSharp/Impl/ProjectSystemShim/EntryPointFinder.cs
|
src/VisualStudio/CSharp/Impl/ProjectSystemShim/EntryPointFinder.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.
#nullable disable
using System.Collections.Generic;
using Microsoft.CodeAnalysis;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
{
internal class EntryPointFinder : AbstractEntryPointFinder
{
protected override bool MatchesMainMethodName(string name)
=> name == "Main";
public static IEnumerable<INamedTypeSymbol> FindEntryPoints(INamespaceSymbol symbol)
{
var visitor = new EntryPointFinder();
// Only search source symbols
visitor.Visit(symbol.ContainingCompilation.SourceModule.GlobalNamespace);
return visitor.EntryPoints;
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Generic;
using Microsoft.CodeAnalysis;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
{
internal class EntryPointFinder : AbstractEntryPointFinder
{
protected override bool MatchesMainMethodName(string name)
=> name == "Main";
public static IEnumerable<INamedTypeSymbol> FindEntryPoints(INamespaceSymbol symbol)
{
var visitor = new EntryPointFinder();
visitor.Visit(symbol.ContainingCompilation.SourceModule.GlobalNamespace);
return visitor.EntryPoints;
}
}
}
|
mit
|
C#
|
ad72675d60b3eb26c886d436b82aa0296d66030f
|
Update src/VisualStudio/Core/Def/Storage/VisualStudioCloudCacheService.cs
|
mavasani/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,diryboy/roslyn,weltkante/roslyn,eriawan/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,wvdd007/roslyn,diryboy/roslyn,sharwell/roslyn,wvdd007/roslyn,KevinRansom/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,eriawan/roslyn,mavasani/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,physhi/roslyn,dotnet/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,physhi/roslyn,dotnet/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,wvdd007/roslyn,physhi/roslyn
|
src/VisualStudio/Core/Def/Storage/VisualStudioCloudCacheService.cs
|
src/VisualStudio/Core/Def/Storage/VisualStudioCloudCacheService.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Storage;
using Microsoft.VisualStudio.RpcContracts.Caching;
namespace Microsoft.VisualStudio.LanguageServices.Storage
{
/// <summary>
/// Tiny wrappers that takes the platform <see cref="ICacheService"/> and wraps it to our own layers as an <see
/// cref="ICloudCacheService"/>.
/// </summary>
internal class VisualStudioCloudCacheService : AbstractCloudCacheService
{
private readonly IThreadingContext _threadingContext;
public VisualStudioCloudCacheService(IThreadingContext threadingContext, ICacheService cacheService)
: base(cacheService)
{
_threadingContext = threadingContext;
}
public override void Dispose()
{
if (this.CacheService is IAsyncDisposable asyncDisposable)
{
_threadingContext.JoinableTaskFactory.Run(
() => asyncDisposable.DisposeAsync().AsTask());
}
else if (this.CacheService is IDisposable disposable)
{
disposable.Dispose();
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Storage;
using Microsoft.VisualStudio.RpcContracts.Caching;
namespace Microsoft.VisualStudio.LanguageServices.Storage
{
/// <summary>
/// Tiny wrappers that takes the platform <see cref="ICacheService"/> and wraps it to our own layers as an <see
/// cref="ICloudCacheService"/>.
/// </summary>
internal class VisualStudioCloudCacheService : AbstractCloudCacheService
{
private readonly IThreadingContext _threadingContext;
public VisualStudioCloudCacheService(IThreadingContext threadingContext, ICacheService cacheService)
: base(cacheService)
{
_threadingContext = threadingContext;
}
public override void Dispose()
{
if (this.CacheService is IAsyncDisposable asyncDisposable)
{
_threadingContext.JoinableTaskFactory.Run(
async () => await asyncDisposable.DisposeAsync().ConfigureAwait(false));
}
else if (this.CacheService is IDisposable disposable)
{
disposable.Dispose();
}
}
}
}
|
mit
|
C#
|
e1d9e00b28b27a9c263f211cb5dbd3f93fac500d
|
Delete temporary file in LocalDataStreamFixture
|
jmerriweather/Halibut
|
source/Halibut.Tests/LocalDataStreamFixture.cs
|
source/Halibut.Tests/LocalDataStreamFixture.cs
|
using System.IO;
using NUnit.Framework;
namespace Halibut.Tests
{
[TestFixture]
public class LocalDataStreamFixture
{
[Test]
public void ShouldUseInMemoryReceiverLocallyToRead()
{
const string input = "Hello World!";
var dataStream = DataStream.FromString(input);
string result = null;
dataStream.Receiver().Read(stream => result = ReadStreamAsString(stream));
Assert.AreEqual(input, result);
}
[Test]
public void ShouldUseInMemoryReceiverLocallyToSaveToFile()
{
const string input = "We all live in a yellow submarine";
var dataStream = DataStream.FromString(input);
var filePath = Path.GetTempFileName();
try
{
dataStream.Receiver().SaveTo(filePath);
Assert.AreEqual(input, File.ReadAllText(filePath));
}
finally
{
File.Delete(filePath);
}
}
private static string ReadStreamAsString(Stream stream)
{
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
}
|
using System.IO;
using NUnit.Framework;
namespace Halibut.Tests
{
[TestFixture]
public class LocalDataStreamFixture
{
[Test]
public void ShouldUseInMemoryReceiverLocallyToRead()
{
const string input = "Hello World!";
var dataStream = DataStream.FromString(input);
string result = null;
dataStream.Receiver().Read(stream => result = ReadStreamAsString(stream));
Assert.AreEqual(input, result);
}
[Test]
public void ShouldUseInMemoryReceiverLocallyToSaveToFile()
{
const string input = "We all live in a yellow submarine";
var dataStream = DataStream.FromString(input);
var filePath = Path.GetTempFileName();
dataStream.Receiver().SaveTo(filePath);
Assert.AreEqual(input, File.ReadAllText(filePath));
}
private static string ReadStreamAsString(Stream stream)
{
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
}
|
apache-2.0
|
C#
|
e262cfe986a67787f474afb4573be7ee30769240
|
Update BaseAnimation.cs
|
rotorgames/Rg.Plugins.Popup,rotorgames/Rg.Plugins.Popup
|
Rg.Plugins.Popup/Animations/Base/BaseAnimation.cs
|
Rg.Plugins.Popup/Animations/Base/BaseAnimation.cs
|
using System.Threading.Tasks;
using Rg.Plugins.Popup.Converters.TypeConverters;
using Rg.Plugins.Popup.Interfaces.Animations;
using Rg.Plugins.Popup.Pages;
using Xamarin.Forms;
using EasingTypeConverter = Rg.Plugins.Popup.Converters.TypeConverters.EasingTypeConverter;
namespace Rg.Plugins.Popup.Animations.Base
{
public abstract class BaseAnimation : IPopupAnimation
{
private const uint DefaultDuration = 200;
[TypeConverter(typeof(UintTypeConverter))]
public uint DurationIn { get; set; } = DefaultDuration;
[TypeConverter(typeof(UintTypeConverter))]
public uint DurationOut { get; set; } = DefaultDuration;
[TypeConverter(typeof(EasingTypeConverter))]
public Easing EasingIn { get; set; } = Easing.Linear;
[TypeConverter(typeof(EasingTypeConverter))]
public Easing EasingOut { get; set; } = Easing.Linear;
public abstract void Preparing(View content, PopupPage page);
public abstract void Disposing(View content, PopupPage page);
public abstract Task Appearing(View content, PopupPage page);
public abstract Task Disappearing(View content, PopupPage page);
protected virtual int GetTopOffset(View content, Page page)
{
return (int)(content.Height + page.Height) / 2;
}
protected virtual int GetLeftOffset(View content, Page page)
{
return (int)(content.Width + page.Width) / 2;
}
/// <summary>
/// Use this method for avoiding the problem with blinking animation on iOS
/// See https://github.com/rotorgames/Rg.Plugins.Popup/issues/404
/// </summary>
/// <param name="page">Page.</param>
protected virtual void HidePage(Page page)
{
page.IsVisible = false;
}
/// <summary>
/// Use this method for avoiding the problem with blinking animation on iOS
/// See https://github.com/rotorgames/Rg.Plugins.Popup/issues/404
/// </summary>
/// <param name="page">Page.</param>
protected virtual void ShowPage(Page page)
{
//Fix: #404
Device.BeginInvokeOnMainThread(() => page.IsVisible = true);
}
}
}
|
using System.Threading.Tasks;
using Rg.Plugins.Popup.Converters.TypeConverters;
using Rg.Plugins.Popup.Interfaces.Animations;
using Rg.Plugins.Popup.Pages;
using Xamarin.Forms;
namespace Rg.Plugins.Popup.Animations.Base
{
public abstract class BaseAnimation : IPopupAnimation
{
private const uint DefaultDuration = 200;
[TypeConverter(typeof(UintTypeConverter))]
public uint DurationIn { get; set; } = DefaultDuration;
[TypeConverter(typeof(UintTypeConverter))]
public uint DurationOut { get; set; } = DefaultDuration;
[TypeConverter(typeof(EasingTypeConverter))]
public Easing EasingIn { get; set; } = Easing.Linear;
[TypeConverter(typeof(EasingTypeConverter))]
public Easing EasingOut { get; set; } = Easing.Linear;
public abstract void Preparing(View content, PopupPage page);
public abstract void Disposing(View content, PopupPage page);
public abstract Task Appearing(View content, PopupPage page);
public abstract Task Disappearing(View content, PopupPage page);
protected virtual int GetTopOffset(View content, Page page)
{
return (int)(content.Height + page.Height) / 2;
}
protected virtual int GetLeftOffset(View content, Page page)
{
return (int)(content.Width + page.Width) / 2;
}
/// <summary>
/// Use this method for avoiding the problem with blinking animation on iOS
/// See https://github.com/rotorgames/Rg.Plugins.Popup/issues/404
/// </summary>
/// <param name="page">Page.</param>
protected virtual void HidePage(Page page)
{
page.IsVisible = false;
}
/// <summary>
/// Use this method for avoiding the problem with blinking animation on iOS
/// See https://github.com/rotorgames/Rg.Plugins.Popup/issues/404
/// </summary>
/// <param name="page">Page.</param>
protected virtual void ShowPage(Page page)
{
//Fix: #404
Device.BeginInvokeOnMainThread(() => page.IsVisible = true);
}
}
}
|
mit
|
C#
|
66f840bc5e525038e0fd0bdef0898a86eb9f751c
|
fix typo
|
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
|
Anlab.Mvc/Views/Home/Index.cshtml
|
Anlab.Mvc/Views/Home/Index.cshtml
|
@{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: September 30, 2020<br /><br />
In response to the emergency need for the analysis of wine for smoke taint,
the UC Davis Department of Viticulture and Enology is partnering with the UC Davis Analytical Lab to offer testing<br /><br />
Please click <a href="/media/pdf/anlab_smoke-taint_instructions.pdf" target="_blank"><strong>here</strong> for more information</a> on
<strong> Wine Testing for Smoke Taint</strong>.
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
|
@{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: September 30, 2020<br /><br />
In response to the emergency need for the analysis of wine for smoke taint,
the UC Davis Department of Viticulture and Enology is partnering with the UC Davis Analytical Lab to offer testing<br /><br />
Please click <a href="/media/pdf/anlab_smoke-taint_instructions.pdf" target="_blank"><strong>here</strong> for more information</a> on
<strong>on Wine Testing for Smoke Taint</strong>.
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
|
mit
|
C#
|
f43c7537cc1a8a38a09ac1491e56e6015cef8dc8
|
Update RemoteService Interface
|
c0nnex/SPAD.neXt,c0nnex/SPAD.neXt
|
SPAD.Interfaces/ServiceContract/IRemoteService.cs
|
SPAD.Interfaces/ServiceContract/IRemoteService.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
namespace SPAD.neXt.Interfaces.ServiceContract
{
public static class RemoteServiceContract
{
public static readonly Uri ServiceUrl = new Uri("net.pipe://localhost/SPAD.neXt");
public const string ServiceEndpoint = "RemoteService";
public const string ServiceNamespace = "http://www.spadnext.com/Service/RemoteService";
public static readonly Version RemoteApiVersion = new Version(1, 1, 0, 0);
}
public sealed class RemoteServiceResponse
{
public bool HasError { get; set; } = false;
public string Error { get; set; }
public double Value { get; set; }
}
[DataContract]
public enum RemoteServiceResult
{
[EnumMember]
CONNECTION_OK = 0,
[EnumMember]
CONNECTION_OUTDATED = 1,
[EnumMember]
CONNECTION_DENIED = 2,
[EnumMember]
CONNECTION_BUSY = 3
}
[ServiceContract( Namespace = RemoteServiceContract.ServiceNamespace, CallbackContract = typeof(IRemoteServiceCallback))]
public interface IRemoteServiceBase
{
[OperationContract]
RemoteServiceResult Initialize(string clientName, Version remoteApiVersion);
[OperationContract]
string GetVersion();
[OperationContract(IsOneWay = true)]
void Ping(ulong tick);
}
[ServiceContract( Namespace = RemoteServiceContract.ServiceNamespace, CallbackContract = typeof(IRemoteServiceCallback))]
[ServiceKnownType(typeof(RemoteServiceResponse))]
public interface IRemoteService : IRemoteServiceBase
{
[OperationContract]
RemoteServiceResponse GetValue(string variableName);
[OperationContract]
RemoteServiceResponse SetValue(string variableName, double newValue);
[OperationContract]
RemoteServiceResponse EmulateEvent(string targetDevice,string targetEvent, string eventTrigger, string eventParameter);
}
public interface IRemoteServiceCallback
{
[OperationContract(IsOneWay = true)]
void RemoteEvent(string eventName);
[OperationContract(IsOneWay = true)]
void Pong(ulong tick);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
namespace SPAD.neXt.Interfaces.ServiceContract
{
public static class RemoteServiceContract
{
public static readonly Uri ServiceUrl = new Uri("net.pipe://localhost/SPAD.neXt");
public static readonly string ServiceEndpoint = "RemoteService";
}
public sealed class RemoteServiceResponse
{
public bool HasError { get; set; } = false;
public string Error { get; set; }
public double Value { get; set; }
}
[ServiceContract( Namespace = Constants.Namespace , CallbackContract = typeof(IRemoteServiceCallback))]
[ServiceKnownType(typeof(RemoteServiceResponse))]
public interface IRemoteService
{
[OperationContract]
RemoteServiceResponse GetValue(string variableName);
[OperationContract]
RemoteServiceResponse SetValue(string variableName, double newValue);
[OperationContract]
RemoteServiceResponse EmulateEvent(string targetDevice,string targetEvent, string eventTrigger, string eventParameter);
[OperationContract]
string GetVersion();
[OperationContract(IsOneWay = true)]
void Ping(uint tick);
}
public interface IRemoteServiceCallback
{
[OperationContract(IsOneWay = true)]
void RemoteEvent(string eventName);
[OperationContract(IsOneWay = true)]
void Pong(uint tick);
}
}
|
mit
|
C#
|
d92c1fde183f70133db39f453551393d45b29438
|
Comment model changed
|
gyuwon/.NET-Data-Access-Layer,gyuwon/.NET-Data-Access-Layer
|
Commerce/Models/CommerceModels.cs
|
Commerce/Models/CommerceModels.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace Commerce.Models
{
public class Item
{
public long Id { get; set; }
[Required]
public string Name { get; set; }
public string Description { get; set; }
[Required]
public decimal Price { get; set; }
public ICollection<Comment> Comments { get; set; }
}
public class Comment
{
public long Id { get; set; }
public long ItemId { get; set; }
[Required, JsonIgnore]
public string AuthorId { get; set; }
[Required]
public string Content { get; set; }
public DateTime CreatedAt { get; set; }
[JsonIgnore]
public Item Item { get; set; }
[JsonIgnore]
public ApplicationUser Author { get; set; }
[NotMapped]
public string AuthorName { get; set; }
}
public class CommentBindingModel
{
[Required]
public string Content { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace Commerce.Models
{
public class Item
{
public long Id { get; set; }
[Required]
public string Name { get; set; }
public string Description { get; set; }
[Required]
public decimal Price { get; set; }
public ICollection<Comment> Comments { get; set; }
}
public class Comment
{
public long Id { get; set; }
public long ItemId { get; set; }
[Required]
public string AuthorId { get; set; }
[Required]
public string Content { get; set; }
public DateTime CreatedAt { get; set; }
[JsonIgnore]
public Item Item { get; set; }
[JsonIgnore]
public ApplicationUser Author { get; set; }
}
public class CommentBindingModel
{
[Required]
public string Content { get; set; }
}
}
|
mit
|
C#
|
d9d60e5a3db49f4b6d264a344948d68af4f1ff0f
|
Update ArcadeMode.cs
|
overtools/OWLib
|
DataTool/DataModels/ArcadeMode.cs
|
DataTool/DataModels/ArcadeMode.cs
|
using System.Linq;
using System.Runtime.Serialization;
using TankLib;
using TankLib.STU.Types;
using DataTool.Helper;
using static DataTool.Helper.IO;
namespace DataTool.DataModels {
[DataContract]
public class ArcadeMode {
[DataMember]
public teResourceGUID GUID;
[DataMember]
public string Name;
[DataMember]
public string Description;
[DataMember]
public teResourceGUID Image;
[DataMember]
public teResourceGUID Brawl;
[DataMember]
public teResourceGUID[] Children;
[DataMember]
public string[] About;
public ArcadeMode(ulong key) {
STU_E3594B8E stu = STUHelper.GetInstance<STU_E3594B8E>(key);
if (stu == null) return;
Init(stu, key);
}
public ArcadeMode(STU_E3594B8E stu) {
Init(stu);
}
private void Init(STU_E3594B8E arcade, ulong key = default) {
GUID = (teResourceGUID) key;
Name = GetString(arcade.m_name);
Description = GetString(arcade.m_description);
Image = arcade.m_21EB3E73;
switch (arcade) {
case STU_598579A3 a1:
Brawl = a1.m_5DC61E59;
break;
case STU_19C05237 a2:
Children = Helper.JSON.FixArray(a2.m_children);
break;
default:
break;
}
About = arcade.m_5797DE13?.Select(x => {
var aboutStuff = STUHelper.GetInstance<STU_56830926>(x);
var name = GetString(aboutStuff.m_name);
string desc = null;
if (aboutStuff is STU_F31D4F9C ye)
desc = GetString(ye.m_description);
return new string[] {name, desc};
}).SelectMany(x => x).Where(x => x != null).ToArray();
}
}
}
|
using System.Runtime.Serialization;
using TankLib;
using TankLib.STU.Types;
using DataTool.Helper;
using static DataTool.Helper.IO;
namespace DataTool.DataModels {
[DataContract]
public class ArcadeMode {
[DataMember]
public teResourceGUID GUID;
[DataMember]
public string Name;
[DataMember]
public string Description;
[DataMember]
public teResourceGUID Image;
[DataMember]
public teResourceGUID Brawl;
[DataMember]
public teResourceGUID[] Children;
[DataMember]
public teResourceGUID[] Unknown;
public ArcadeMode(ulong key) {
STU_E3594B8E stu = STUHelper.GetInstance<STU_E3594B8E>(key);
if (stu == null) return;
Init(stu, key);
}
public ArcadeMode(STU_E3594B8E stu) {
Init(stu);
}
private void Init(STU_E3594B8E arcade, ulong key = default) {
GUID = (teResourceGUID) key;
Name = GetString(arcade.m_name);
Description = GetString(arcade.m_description);
Image = arcade.m_21EB3E73;
Unknown = Helper.JSON.FixArray(arcade.m_5797DE13);
switch (arcade) {
case STU_598579A3 a1:
Brawl = a1.m_5DC61E59;
break;
case STU_19C05237 a2:
Children = Helper.JSON.FixArray(a2.m_children);
break;
default:
break;
}
}
}
}
|
mit
|
C#
|
5f395e8a72d05327344e56f8f428bae79d486cd2
|
Test helper `Type.GetInstanceMethod(string)` is guaranteed never to return null.
|
fixie/fixie
|
src/Fixie.Tests/TestExtensions.cs
|
src/Fixie.Tests/TestExtensions.cs
|
namespace Fixie.Tests
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using Fixie.Internal;
static class TestExtensions
{
const BindingFlags InstanceMethods = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
public static MethodInfo GetInstanceMethod(this Type type, string methodName)
{
var instanceMethod = type.GetMethod(methodName, InstanceMethods);
if (instanceMethod == null)
throw new Exception($"Could not find instance method '{methodName}' on type '{type.FullName}'");
return instanceMethod;
}
public static IReadOnlyList<MethodInfo> GetInstanceMethods(this Type type)
{
return type.GetMethods(InstanceMethods);
}
public static IEnumerable<string> Lines(this RedirectedConsole console)
{
return console.Output.Lines();
}
public static IEnumerable<string> Lines(this string multiline)
{
var lines = multiline.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList();
while (lines.Count > 0 && lines[lines.Count-1] == "")
lines.RemoveAt(lines.Count-1);
return lines;
}
public static string CleanStackTraceLineNumbers(this string stackTrace)
{
//Avoid brittle assertion introduced by stack trace line numbers.
return Regex.Replace(stackTrace, @":line \d+", ":line #");
}
public static string CleanDuration(this string output)
{
//Avoid brittle assertion introduced by test duration.
var decimalSeparator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
return Regex.Replace(output, @"took [\d" + Regex.Escape(decimalSeparator) + @"]+ seconds", @"took 1.23 seconds");
}
}
}
|
namespace Fixie.Tests
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using Fixie.Internal;
static class TestExtensions
{
const BindingFlags InstanceMethods = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
public static MethodInfo GetInstanceMethod(this Type type, string methodName)
{
return type.GetMethod(methodName, InstanceMethods);
}
public static IReadOnlyList<MethodInfo> GetInstanceMethods(this Type type)
{
return type.GetMethods(InstanceMethods);
}
public static IEnumerable<string> Lines(this RedirectedConsole console)
{
return console.Output.Lines();
}
public static IEnumerable<string> Lines(this string multiline)
{
var lines = multiline.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList();
while (lines.Count > 0 && lines[lines.Count-1] == "")
lines.RemoveAt(lines.Count-1);
return lines;
}
public static string CleanStackTraceLineNumbers(this string stackTrace)
{
//Avoid brittle assertion introduced by stack trace line numbers.
return Regex.Replace(stackTrace, @":line \d+", ":line #");
}
public static string CleanDuration(this string output)
{
//Avoid brittle assertion introduced by test duration.
var decimalSeparator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
return Regex.Replace(output, @"took [\d" + Regex.Escape(decimalSeparator) + @"]+ seconds", @"took 1.23 seconds");
}
}
}
|
mit
|
C#
|
66b7b07c86e09dce9cc881ee22449df84efe4f9d
|
Remove unused import
|
nikeee/HolzShots
|
src/HolzShots.Core/ClipboardEx.cs
|
src/HolzShots.Core/ClipboardEx.cs
|
using System;
using System.Diagnostics;
namespace HolzShots
{
public static class ClipboardEx
{
/// <summary> Wrapper around Clipboard.SetText that catches exceptions. </summary>
public static bool SetText(string text)
{
Debug.Assert(text != null);
try
{
Clipboard.SetText(text);
return true;
}
catch (Exception e)
{
Trace.WriteLine(e.Message);
return false;
}
}
}
}
|
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace HolzShots
{
public static class ClipboardEx
{
/// <summary> Wrapper around Clipboard.SetText that catches exceptions. </summary>
public static bool SetText(string text)
{
Debug.Assert(text != null);
try
{
Clipboard.SetText(text);
return true;
}
catch (Exception e)
{
Trace.WriteLine(e.Message);
return false;
}
}
}
}
|
agpl-3.0
|
C#
|
a962a08251973af7b4e94591fca4162b9ff0a966
|
Update kod.cs
|
jakubcze/prywatnejm
|
kod.cs
|
kod.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RozliczeniePracownikow
{
public class Rozliczenia
{
public virtual double kosztPrzejazduSamochod(int kilometry, float spalanie, float cenaLitr, float dodatkowe)
{
return Math.Round((kilometry / 100) * spalanie * cenaLitr + dodatkowe,2);
}
public decimal chorobowe(int liczbaDni, float wynagrodzenie, float stawkaChorobowa = 0.8f)
{
return Math.Round((decimal)( (wynagrodzenie*12/360)*liczbaDni*stawkaChorobowa ),1);
}
}
}
|
int a = 2;
Console.WriteLine(a);
|
mit
|
C#
|
0b93df52014a91c4d83a4ab5da418a4113a7f8c3
|
Allow null for user_id in Invitee.cs
|
janssenr/RobinApi.Net
|
src/RobinApi.Net/Model/Invitee.cs
|
src/RobinApi.Net/Model/Invitee.cs
|
using System;
using System.Runtime.Serialization;
namespace RobinApi.Net.Model
{
[DataContract]
public class Invitee
{
[DataMember(Name = "id", EmitDefaultValue = false)]
public int Id { get; set; }
[DataMember(Name = "event_id", EmitDefaultValue = false)]
public string EventId { get; set; }
[DataMember(Name = "user_id", EmitDefaultValue = false)]
public int? UserId { get; set; }
[DataMember(Name = "email", EmitDefaultValue = false)]
public string Email { get; set; }
[DataMember(Name = "display_name", EmitDefaultValue = false)]
public string DisplayName { get; set; }
[DataMember(Name = "response_status", EmitDefaultValue = false)]
public string ResponseStatus { get; set; }
[DataMember(Name = "is_organizer", EmitDefaultValue = false)]
public bool IsOrganizer { get; set; }
[DataMember(Name = "is_resource", EmitDefaultValue = false)]
public bool IsResource { get; set; }
[DataMember(Name = "created_at", EmitDefaultValue = false)]
public DateTime CreatedAt { get; set; }
[DataMember(Name = "updated_at", EmitDefaultValue = false)]
public DateTime UpdatedAt { get; set; }
}
}
|
using System;
using System.Runtime.Serialization;
namespace RobinApi.Net.Model
{
[DataContract]
public class Invitee
{
[DataMember(Name = "id", EmitDefaultValue = false)]
public int Id { get; set; }
[DataMember(Name = "event_id", EmitDefaultValue = false)]
public string EventId { get; set; }
[DataMember(Name = "user_id", EmitDefaultValue = false)]
public int UserId { get; set; }
[DataMember(Name = "email", EmitDefaultValue = false)]
public string Email { get; set; }
[DataMember(Name = "display_name", EmitDefaultValue = false)]
public string DisplayName { get; set; }
[DataMember(Name = "response_status", EmitDefaultValue = false)]
public string ResponseStatus { get; set; }
[DataMember(Name = "is_organizer", EmitDefaultValue = false)]
public bool IsOrganizer { get; set; }
[DataMember(Name = "is_resource", EmitDefaultValue = false)]
public bool IsResource { get; set; }
[DataMember(Name = "created_at", EmitDefaultValue = false)]
public DateTime CreatedAt { get; set; }
[DataMember(Name = "updated_at", EmitDefaultValue = false)]
public DateTime UpdatedAt { get; set; }
}
}
|
mit
|
C#
|
6c9915832f64e15ec751a16ad5472fed31c0708f
|
Fix spelling in readme
|
ethanli83/EFSqlTranslator
|
EFSqlTranslator.Tests/TranslatorTests/ManualJoinTranslationTests.cs
|
EFSqlTranslator.Tests/TranslatorTests/ManualJoinTranslationTests.cs
|
using System.Linq;
using EFSqlTranslator.EFModels;
using EFSqlTranslator.Translation;
using EFSqlTranslator.Translation.DbObjects;
using EFSqlTranslator.Translation.DbObjects.SqlObjects;
using NUnit.Framework;
namespace EFSqlTranslator.Tests.TranslatorTests
{
[TestFixture]
[CategoryReadMe(
Index = 5,
Title = "Translating Manual Join",
Description = @"
This libary supports more complicated join. You can define your own join condition rather than
have to be limited to column pairs."
)]
public class ManualTranslationTests
{
[Test]
[TranslationReadMe(
Index = 0,
Title = "Join on custom condition"
)]
public void Test_Translate_Join_Select_Columns()
{
using (var db = new TestingContext())
{
var query = db.Blogs.Where(b => b.Posts.Any(p => p.User.UserName != null));
var query1 = db.Posts.
Join(
query,
(p, b) => p.BlogId == b.BlogId && p.User.UserName == "ethan",
(p, b) => new { PId = p.PostId, b.Name },
JoinType.LeftOuter);
var script = LinqTranslator.Translate(query1.Expression, new EFModelInfoProvider(db), new SqlObjectFactory());
var sql = script.ToString();
const string expected = @"
select p0.'PostId' as 'PId', sq0.'Name'
from Posts p0
inner join Users u0 on p0.'UserId' = u0.'UserId'
left outer join (
select b0.'Name', b0.'BlogId' as 'BlogId_jk0'
from Blogs b0
left outer join (
select p0.'BlogId' as 'BlogId_jk0'
from Posts p0
inner join Users u0 on p0.'UserId' = u0.'UserId'
where u0.'UserName' is not null
group by p0.'BlogId'
) sq0 on b0.'BlogId' = sq0.'BlogId_jk0'
where sq0.'BlogId_jk0' is not null
) sq0 on (p0.'BlogId' = sq0.'BlogId_jk0') and (u0.'UserName' = 'ethan')";
TestUtils.AssertStringEqual(expected, sql);
}
}
}
}
|
using System.Linq;
using EFSqlTranslator.EFModels;
using EFSqlTranslator.Translation;
using EFSqlTranslator.Translation.DbObjects;
using EFSqlTranslator.Translation.DbObjects.SqlObjects;
using NUnit.Framework;
namespace EFSqlTranslator.Tests.TranslatorTests
{
[TestFixture]
[CategoryReadMe(
Index = 5,
Title = "Translating Manual J
Description = @"
This libary supports more complicated join. You can define your own join condition rather than
have to be limited to column pairs."
)]
public class ManualTranslationTests
{
[Test]
[TranslationReadMe(
Index = 0,
Title = "Join on custom condition"
)]
public void Test_Translate_Join_Select_Columns()
{
using (var db = new TestingContext())
{
var query = db.Blogs.Where(b => b.Posts.Any(p => p.User.UserName != null));
var query1 = db.Posts.
Join(
query,
(p, b) => p.BlogId == b.BlogId && p.User.UserName == "ethan",
(p, b) => new { PId = p.PostId, b.Name },
JoinType.LeftOuter);
var script = LinqTranslator.Translate(query1.Expression, new EFModelInfoProvider(db), new SqlObjectFactory());
var sql = script.ToString();
const string expected = @"
select p0.'PostId' as 'PId', sq0.'Name'
from Posts p0
inner join Users u0 on p0.'UserId' = u0.'UserId'
left outer join (
select b0.'Name', b0.'BlogId' as 'BlogId_jk0'
from Blogs b0
left outer join (
select p0.'BlogId' as 'BlogId_jk0'
from Posts p0
inner join Users u0 on p0.'UserId' = u0.'UserId'
where u0.'UserName' is not null
group by p0.'BlogId'
) sq0 on b0.'BlogId' = sq0.'BlogId_jk0'
where sq0.'BlogId_jk0' is not null
) sq0 on (p0.'BlogId' = sq0.'BlogId_jk0') and (u0.'UserName' = 'ethan')";
TestUtils.AssertStringEqual(expected, sql);
}
}
}
}
|
apache-2.0
|
C#
|
6e71a995bcefeeb660bcb64d19245f25a098ff5b
|
Clear compatibility file.
|
fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game
|
game/server/base/compat.cs
|
game/server/base/compat.cs
|
//------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2008, mEthLab Interactive
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// compat.cs
// stuff to enable compatibility with older versions
//------------------------------------------------------------------------------
// Note: Some missing files are transmitted automagically while others need some
// hacky magic in order to be transmitted to clients that don't have them.
datablock AudioDescription(AudioCompat)
{
volume = 1.0;
isLooping= false;
is3D = false;
ReferenceDistance= 5.0;
MaxDistance= 30.0;
type = $SimAudioType;
isStreaming = true;
};
// *** for graphics files ***
//datablock ParticleData(TextureDummy_Nr)
//{
// textureName = "path";
//};
// *** for sound files ***
//datablock AudioProfile(AudioDummy_Nr)
//{
// filename = "path";
// description = AudioCompat;
// preload = true;
//};
// *** for a missing ShapeBaseImageData ***
//datablock ShapeBaseImageData(ImageDummy_Nr)
//{
// shapeFile = "path";
// stateName[0] = "DoNothing";
//};
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2008, mEthLab Interactive
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// compat.cs
// stuff to enable compatibility with older versions
//------------------------------------------------------------------------------
// Note: Some missing files are transmitted automagically while others need some
// hacky magic in order to be transmitted to clients that don't have them.
datablock AudioDescription(AudioCompat)
{
volume = 1.0;
isLooping= false;
is3D = false;
ReferenceDistance= 5.0;
MaxDistance= 30.0;
type = $SimAudioType;
isStreaming = true;
};
// *** for graphics files ***
//datablock ParticleData(FileDummy_Path)
//{
// textureName = "path";
//};
// *** for sound files ***
//datablock AudioProfile(FileDummy_Path)
//{
// filename = "path";
// description = AudioCompat;
// preload = true;
//};
// *** for a missing ShapeBaseImageData ***
//datablock ShapeBaseImageData(FileDummy_Path)
//{
// shapeFile = "path";
// stateName[0] = "DoNothing";
//};
//------------------------------------------------------------------------------
datablock ParticleData(TextureFileDummy1)
{
textureName = "share/textures/rotc/rainbow1.png";
};
datablock ParticleData(TextureFileDummy2)
{
textureName = "share/shapes/rotc/effects/explosion4_white.png";
};
datablock ParticleData(TextureFileDummy3)
{
textureName = "share/textures/rotc/zone.lane.png";
};
datablock ParticleData(TextureFileDummy4)
{
textureName = "share/hud/rotc/icon.anchor.20x20.png";
};
datablock ParticleData(TextureFileDummy5)
{
textureName = "share/hud/rotc/icon.explosivedisc.20x20.png";
};
datablock ParticleData(TextureFileDummy6)
{
textureName = "share/hud/rotc/icon.grenade.20x20.png";
};
datablock ParticleData(TextureFileDummy7)
{
textureName = "share/hud/rotc/icon.repeldisc.20x20.png";
};
datablock ParticleData(TextureFileDummy8)
{
textureName = "share/hud/rotc/icon.slasherdisc.20x20.png";
};
datablock ParticleData(TextureFileDummy9)
{
textureName = "share/hud/rotc/icon.stabilizer.20x20.png";
};
datablock ParticleData(TextureFileDummy10)
{
textureName = "share/hud/rotc/icon.permaboard.20x20.png";
};
datablock ParticleData(TextureFileDummy11)
{
textureName = "share/hud/rotc/icon.vamp.20x20.png";
};
|
lgpl-2.1
|
C#
|
86ed90c90bec01f30c0f5121ebaab008914a8e41
|
Update Settings.cs
|
wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
|
src/Core2D.Desktop/Settings.cs
|
src/Core2D.Desktop/Settings.cs
|
using System.IO;
using Core2D.Configuration.Themes;
namespace Core2D.Desktop
{
public class Settings
{
public ThemeName? Theme { get; set; } = null;
public FileInfo[]? Scripts { get; set; }
public FileInfo? Project { get; set; }
public bool Repl { get; set; }
public bool UseSkia { get; set; }
#if ENABLE_DIRECT2D1
public bool UseDirect2D1 { get; set; }
#endif
public bool EnableMultiTouch { get; set; } = true;
public bool UseGpu { get; set; } = true;
public bool AllowEglInitialization { get; set; } = true;
public bool UseWgl { get; set; }
public bool UseDeferredRendering { get; set; } = true;
public bool UseWindowsUIComposition { get; set; } = true;
public bool UseDirectX11 { get; set; }
public bool UseManagedSystemDialogs { get; set; }
public bool UseHeadless { get; set; }
public bool UseHeadlessDrawing { get; set; }
public bool UseHeadlessVnc { get; set; }
public bool CreateHeadlessScreenshots { get; set; }
public string ScreenshotExtension { get; set; } = "png";
public double ScreenshotWidth { get; set; } = 1366;
public double ScreenshotHeight { get; set; } = 690;
public string? VncHost { get; set; } = null;
public int VncPort { get; set; } = 5901;
public bool HttpServer { get; set; }
}
}
|
using System.IO;
using Core2D.Configuration.Themes;
namespace Core2D.Desktop
{
public class Settings
{
public ThemeName? Theme { get; set; } = null;
public FileInfo[]? Scripts { get; set; }
public FileInfo? Project { get; set; }
public bool Repl { get; set; }
public bool UseSkia { get; set; }
public bool EnableMultiTouch { get; set; } = true;
public bool UseGpu { get; set; } = true;
public bool AllowEglInitialization { get; set; } = true;
public bool UseWgl { get; set; }
public bool UseDeferredRendering { get; set; } = true;
public bool UseWindowsUIComposition { get; set; } = true;
public bool UseDirectX11 { get; set; }
public bool UseManagedSystemDialogs { get; set; }
public bool UseHeadless { get; set; }
public bool UseHeadlessDrawing { get; set; }
public bool UseHeadlessVnc { get; set; }
public bool CreateHeadlessScreenshots { get; set; }
public string ScreenshotExtension { get; set; } = "png";
public double ScreenshotWidth { get; set; } = 1366;
public double ScreenshotHeight { get; set; } = 690;
public string? VncHost { get; set; } = null;
public int VncPort { get; set; } = 5901;
public bool HttpServer { get; set; }
}
}
|
mit
|
C#
|
e4d71d6528277d0fa7ea3c887b3c1665f36335d0
|
Add methods a Vector2
|
SpoonmanGames/Monogame-Helpers
|
Helpers/ExtensionMethods/Vector2Ext.cs
|
Helpers/ExtensionMethods/Vector2Ext.cs
|
using Microsoft.Xna.Framework;
namespace Helpers.ExtensionMethods.Vector2Ext
{
public static class Vector2Ext
{
public static Vector2 Add(this Vector2 v2, int value2)
{
v2.X += value2;
v2.Y += value2;
return v2;
}
public static Vector2 Add(this Vector2 v2, float value2)
{
v2.X += value2;
v2.Y += value2;
return v2;
}
public static Vector2 AddToX(this Vector2 v2, int value2)
{
v2.X += value2;
return v2;
}
public static Vector2 AddToX(this Vector2 v2, float value2)
{
v2.X += value2;
return v2;
}
public static Vector2 AddToY(this Vector2 v2, int value2)
{
v2.Y += value2;
return v2;
}
public static Vector2 AddToY(this Vector2 v2, float value2)
{
v2.Y += value2;
return v2;
}
}
}
|
using Microsoft.Xna.Framework;
namespace Helpers.ExtensionMethods.Vector2Ext
{
public static class Vector2Ext
{
public static Vector2 Add(this Vector2 v2, int value2)
{
v2.X += value2;
v2.Y += value2;
return v2;
}
public static Vector2 Add(this Vector2 v2, float value2)
{
v2.X += value2;
v2.Y += value2;
return v2;
}
}
}
|
apache-2.0
|
C#
|
e0fae1e5d938093747194626be9c8f559f422165
|
add Sensor parameter but mark it as obsolete
|
ericnewton76/gmaps-api-net
|
src/Google.Maps/BaseRequest.cs
|
src/Google.Maps/BaseRequest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Google.Maps
{
public abstract class BaseRequest
{
[Obsolete("The Google Maps API no longer requires this parameter and it will be removed in the next release")]
public bool? Sensor { get; set; }
public abstract Uri ToUri();
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Google.Maps
{
public abstract class BaseRequest
{
public abstract Uri ToUri();
}
}
|
apache-2.0
|
C#
|
fa93215946518193a85ac038b7e96634ab8b285b
|
Add missing namespace
|
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
|
Util/Xamarin.AndroidBinderator/Xamarin.AndroidBinderator/Util.cs
|
Util/Xamarin.AndroidBinderator/Xamarin.AndroidBinderator/Util.cs
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace AndroidBinderator
{
internal static class Util
{
internal static string HashMd5(Stream value)
{
using (var md5 = MD5.Create())
return BitConverter.ToString(md5.ComputeHash(value)).Replace("-", "").ToLowerInvariant();
}
internal static string HashSha256(string value)
{
return HashSha256(Encoding.UTF8.GetBytes(value));
}
internal static string HashSha256(byte[] value)
{
using (var sha256 = new SHA256Managed())
{
var hash = new StringBuilder();
var hashData = sha256.ComputeHash(value);
foreach (var b in hashData)
hash.Append(b.ToString("x2"));
return hash.ToString();
}
}
internal static string HashSha256(Stream value)
{
using (var sha256 = new SHA256Managed())
{
var hash = new StringBuilder();
var hashData = sha256.ComputeHash(value);
foreach (var b in hashData)
hash.Append(b.ToString("x2"));
return hash.ToString();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace AndroidBinderator
{
internal static class Util
{
internal static string HashMd5(Stream value)
{
using (var md5 = MD5.Create())
return BitConverter.ToString(md5.ComputeHash(value)).Replace("-", "").ToLowerInvariant();
}
internal static string HashSha256(string value)
{
return HashSha256(Encoding.UTF8.GetBytes(value));
}
internal static string HashSha256(byte[] value)
{
using (var sha256 = new SHA256Managed())
{
var hash = new StringBuilder();
var hashData = sha256.ComputeHash(value);
foreach (var b in hashData)
hash.Append(b.ToString("x2"));
return hash.ToString();
}
}
internal static string HashSha256(Stream value)
{
using (var sha256 = new SHA256Managed())
{
var hash = new StringBuilder();
var hashData = sha256.ComputeHash(value);
foreach (var b in hashData)
hash.Append(b.ToString("x2"));
return hash.ToString();
}
}
}
}
|
mit
|
C#
|
e6478cdd25d15604989a3f3fa011a9eed16cb7fb
|
remove unused using statment
|
peasy/Peasy.NET,peasy/Samples,peasy/Samples,ahanusa/Peasy.NET,ahanusa/facile.net,peasy/Samples
|
Orders.com.Web.Api/Global.asax.cs
|
Orders.com.Web.Api/Global.asax.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
namespace Orders.com.Web.Api
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace Orders.com.Web.Api
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
}
|
mit
|
C#
|
e21ceb420a439708085e8280d4b59b7c4dea4037
|
Use bufferless stream to improve perf and resource usage
|
projectkudu/kudu,shrimpy/kudu,MavenRain/kudu,kenegozi/kudu,kenegozi/kudu,shanselman/kudu,puneet-gupta/kudu,badescuga/kudu,MavenRain/kudu,YOTOV-LIMITED/kudu,sitereactor/kudu,chrisrpatterson/kudu,projectkudu/kudu,shanselman/kudu,sitereactor/kudu,badescuga/kudu,kenegozi/kudu,mauricionr/kudu,puneet-gupta/kudu,uQr/kudu,juvchan/kudu,dev-enthusiast/kudu,barnyp/kudu,juoni/kudu,oliver-feng/kudu,sitereactor/kudu,bbauya/kudu,barnyp/kudu,sitereactor/kudu,shibayan/kudu,dev-enthusiast/kudu,duncansmart/kudu,mauricionr/kudu,chrisrpatterson/kudu,badescuga/kudu,badescuga/kudu,shibayan/kudu,projectkudu/kudu,WeAreMammoth/kudu-obsolete,mauricionr/kudu,badescuga/kudu,mauricionr/kudu,puneet-gupta/kudu,EricSten-MSFT/kudu,duncansmart/kudu,YOTOV-LIMITED/kudu,barnyp/kudu,sitereactor/kudu,juvchan/kudu,juvchan/kudu,oliver-feng/kudu,bbauya/kudu,EricSten-MSFT/kudu,shanselman/kudu,EricSten-MSFT/kudu,kali786516/kudu,kenegozi/kudu,duncansmart/kudu,puneet-gupta/kudu,juoni/kudu,chrisrpatterson/kudu,projectkudu/kudu,juvchan/kudu,MavenRain/kudu,oliver-feng/kudu,projectkudu/kudu,bbauya/kudu,puneet-gupta/kudu,juvchan/kudu,shibayan/kudu,kali786516/kudu,YOTOV-LIMITED/kudu,shrimpy/kudu,kali786516/kudu,barnyp/kudu,oliver-feng/kudu,uQr/kudu,shrimpy/kudu,shibayan/kudu,dev-enthusiast/kudu,juoni/kudu,chrisrpatterson/kudu,MavenRain/kudu,shrimpy/kudu,bbauya/kudu,uQr/kudu,WeAreMammoth/kudu-obsolete,dev-enthusiast/kudu,YOTOV-LIMITED/kudu,kali786516/kudu,EricSten-MSFT/kudu,WeAreMammoth/kudu-obsolete,duncansmart/kudu,EricSten-MSFT/kudu,shibayan/kudu,uQr/kudu,juoni/kudu
|
Kudu.Services/HttpRequestExtensions.cs
|
Kudu.Services/HttpRequestExtensions.cs
|
using System.IO;
using System.IO.Compression;
using System.Web;
namespace Kudu.Services
{
public static class HttpRequestExtensions
{
public static Stream GetInputStream(this HttpRequestBase request)
{
var contentEncoding = request.Headers["Content-Encoding"];
if (contentEncoding != null && contentEncoding.Contains("gzip"))
{
return new GZipStream(request.GetBufferlessInputStream(), CompressionMode.Decompress);
}
return request.GetBufferlessInputStream();
}
}
}
|
using System.IO;
using System.IO.Compression;
using System.Web;
namespace Kudu.Services
{
public static class HttpRequestExtensions
{
public static Stream GetInputStream(this HttpRequestBase request)
{
var contentEncoding = request.Headers["Content-Encoding"];
if (contentEncoding != null && contentEncoding.Contains("gzip"))
{
return new GZipStream(request.InputStream, CompressionMode.Decompress);
}
return request.InputStream;
}
}
}
|
apache-2.0
|
C#
|
b58d6b56575acb519238823b033c732eabee93c3
|
use same type as the property in the underlying model
|
zmira/abremir.AllMyBricks
|
abremir.AllMyBricks.ThirdParty.Brickset/Models/ParameterSetId.cs
|
abremir.AllMyBricks.ThirdParty.Brickset/Models/ParameterSetId.cs
|
namespace abremir.AllMyBricks.ThirdParty.Brickset.Models
{
public class ParameterSetId : ParameterApiKey
{
public long SetID { get; set; }
}
}
|
namespace abremir.AllMyBricks.ThirdParty.Brickset.Models
{
public class ParameterSetId : ParameterApiKey
{
public int SetID { get; set; }
}
}
|
mit
|
C#
|
53611cb5dcc8b9d64891962245be8cad979085e5
|
Fix loading of projections.
|
Elders/Cronus.Projections.Cassandra,Elders/Cronus.Projections.Cassandra
|
src/Elders.Cronus.Projections.Cassandra/Properties/AssemblyInfo.cs
|
src/Elders.Cronus.Projections.Cassandra/Properties/AssemblyInfo.cs
|
// <auto-generated/>
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitleAttribute("Elders.Cronus.Projections.Cassandra")]
[assembly: AssemblyDescriptionAttribute("Cronus.Projections.Cassandra")]
[assembly: ComVisibleAttribute(false)]
[assembly: AssemblyProductAttribute("Elders.Cronus.Projections.Cassandra")]
[assembly: AssemblyCopyrightAttribute("Copyright © 2016")]
[assembly: AssemblyVersionAttribute("2.0.0.0")]
[assembly: AssemblyFileVersionAttribute("2.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("2.0.0-beta.3+7.Branch.release-2.0.0.Sha.c3464179c56c54b20d97b4a8872bbd4b80faf36d")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "2.0.0.0";
}
}
|
// <auto-generated/>
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitleAttribute("Elders.Cronus.Projections.Cassandra")]
[assembly: AssemblyDescriptionAttribute("Cronus.Projections.Cassandra")]
[assembly: ComVisibleAttribute(false)]
[assembly: AssemblyProductAttribute("Elders.Cronus.Projections.Cassandra")]
[assembly: AssemblyCopyrightAttribute("Copyright © 2016")]
[assembly: AssemblyVersionAttribute("2.0.0.0")]
[assembly: AssemblyFileVersionAttribute("2.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("2.0.0-beta.2+5.Branch.release-2.0.0.Sha.69aad40cf7616dfb556c4b254552712db54ac792")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "2.0.0.0";
internal const string InformationalVersion = "2.0.0-beta.2+5.Branch.release-2.0.0.Sha.69aad40cf7616dfb556c4b254552712db54ac792";
}
}
|
apache-2.0
|
C#
|
63d7043bd89547a7cf395e45c17c6759e6ec41a1
|
Remove unnecessary Normalize method
|
rmterra/NesZord
|
src/NesZord.Core/Memory/Ram.cs
|
src/NesZord.Core/Memory/Ram.cs
|
using System;
namespace NesZord.Core.Memory
{
internal class Ram : IBoundedMemory
{
private static readonly MemoryAddress INTERNAL_RAM_FIRST_ADDRESS = new MemoryAddress(0x00, 0x00);
private static readonly MemoryAddress INTERNAL_RAM_LASTADDRESS = new MemoryAddress(0x07, 0xff);
private static readonly MemoryAddress MIRROR1_FIRST_ADDRESS = new MemoryAddress(0x08, 0x00);
private static readonly MemoryAddress MIRROR1_LAST_ADDRESS = new MemoryAddress(0x0f, 0xff);
private static readonly MemoryAddress MIRROR2_FIRST_ADDRESS = new MemoryAddress(0x10, 0x00);
private static readonly MemoryAddress MIRROR2_LAST_ADDRESS = new MemoryAddress(0x17, 0xff);
private static readonly MemoryAddress MIRROR3_FIRST_ADDRESS = new MemoryAddress(0x18, 0x00);
private static readonly MemoryAddress MIRROR3_LAST_ADDRESS = new MemoryAddress(0x1f, 0xff);
private readonly BoundedMemory internalRam;
private readonly BoundedMemory mirror1;
private readonly BoundedMemory mirror2;
private readonly BoundedMemory mirror3;
public Ram()
{
this.internalRam = new BoundedMemory(INTERNAL_RAM_FIRST_ADDRESS, INTERNAL_RAM_LASTADDRESS);
this.mirror1 = new BoundedMemory(MIRROR1_FIRST_ADDRESS, MIRROR1_LAST_ADDRESS);
this.mirror2 = new BoundedMemory(MIRROR2_FIRST_ADDRESS, MIRROR2_LAST_ADDRESS);
this.mirror3 = new BoundedMemory(MIRROR3_FIRST_ADDRESS, MIRROR3_LAST_ADDRESS);
}
public MemoryAddress FirstAddress { get { return this.internalRam.FirstAddress; } }
public MemoryAddress LastAddress { get { return this.mirror3.LastAddress; } }
public void Write(MemoryAddress address, byte value)
{
if (address == null) { throw new ArgumentNullException(nameof(address)); }
if (address.In(this.FirstAddress, this.LastAddress) == false)
{
throw new ArgumentOutOfRangeException(nameof(address));
}
var normalizedAddress = address.And(this.internalRam.LastAddress);
this.internalRam.Write(normalizedAddress, value);
this.WriteOnMirror(this.mirror1, normalizedAddress, value);
this.WriteOnMirror(this.mirror2, normalizedAddress, value);
this.WriteOnMirror(this.mirror3, normalizedAddress, value);
}
public byte Read(MemoryAddress address)
{
if (address == null) { throw new ArgumentNullException(nameof(address)); }
if (address.In(this.FirstAddress, this.LastAddress) == false)
{
throw new ArgumentOutOfRangeException(nameof(address));
}
var normalizedAddress = address.And(this.internalRam.LastAddress);
return this.internalRam.Read(normalizedAddress);
}
private void WriteOnMirror(BoundedMemory mirror, MemoryAddress address, byte value)
{
var mirrorAddress = address.Or(mirror.FirstAddress);
mirror.Write(mirrorAddress, value);
}
}
}
|
using System;
namespace NesZord.Core.Memory
{
internal class Ram : IBoundedMemory
{
private static readonly MemoryAddress INTERNAL_RAM_FIRST_ADDRESS = new MemoryAddress(0x00, 0x00);
private static readonly MemoryAddress INTERNAL_RAM_LASTADDRESS = new MemoryAddress(0x07, 0xff);
private static readonly MemoryAddress MIRROR1_FIRST_ADDRESS = new MemoryAddress(0x08, 0x00);
private static readonly MemoryAddress MIRROR1_LAST_ADDRESS = new MemoryAddress(0x0f, 0xff);
private static readonly MemoryAddress MIRROR2_FIRST_ADDRESS = new MemoryAddress(0x10, 0x00);
private static readonly MemoryAddress MIRROR2_LAST_ADDRESS = new MemoryAddress(0x17, 0xff);
private static readonly MemoryAddress MIRROR3_FIRST_ADDRESS = new MemoryAddress(0x18, 0x00);
private static readonly MemoryAddress MIRROR3_LAST_ADDRESS = new MemoryAddress(0x1f, 0xff);
private readonly BoundedMemory internalRam;
private readonly BoundedMemory mirror1;
private readonly BoundedMemory mirror2;
private readonly BoundedMemory mirror3;
public Ram()
{
this.internalRam = new BoundedMemory(INTERNAL_RAM_FIRST_ADDRESS, INTERNAL_RAM_LASTADDRESS);
this.mirror1 = new BoundedMemory(MIRROR1_FIRST_ADDRESS, MIRROR1_LAST_ADDRESS);
this.mirror2 = new BoundedMemory(MIRROR2_FIRST_ADDRESS, MIRROR2_LAST_ADDRESS);
this.mirror3 = new BoundedMemory(MIRROR3_FIRST_ADDRESS, MIRROR3_LAST_ADDRESS);
}
public MemoryAddress FirstAddress { get { return this.internalRam.FirstAddress; } }
public MemoryAddress LastAddress { get { return this.mirror3.LastAddress; } }
public void Write(MemoryAddress address, byte value)
{
if (address == null) { throw new ArgumentNullException(nameof(address)); }
if (address.In(this.FirstAddress, this.LastAddress) == false)
{
throw new ArgumentOutOfRangeException(nameof(address));
}
var normalizedAddress = this.Normalize(address);
this.internalRam.Write(normalizedAddress, value);
this.WriteOnMirror(this.mirror1, normalizedAddress, value);
this.WriteOnMirror(this.mirror2, normalizedAddress, value);
this.WriteOnMirror(this.mirror3, normalizedAddress, value);
}
public byte Read(MemoryAddress address)
{
if (address == null) { throw new ArgumentNullException(nameof(address)); }
if (address.In(this.FirstAddress, this.LastAddress) == false)
{
throw new ArgumentOutOfRangeException(nameof(address));
}
var normalizedAddress = this.Normalize(address);
return this.internalRam.Read(normalizedAddress);
}
private MemoryAddress Normalize(MemoryAddress address)
=> address.And(this.internalRam.LastAddress);
private void WriteOnMirror(BoundedMemory mirror, MemoryAddress address, byte value)
{
var mirrorAddress = address.Or(mirror.FirstAddress);
mirror.Write(mirrorAddress, value);
}
}
}
|
apache-2.0
|
C#
|
209176fd0b3bea645e9cd04c607edb9da628416a
|
Remove need for function test to register telemetry source
|
mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype
|
test/websites/Glimpse.FunctionalTest.Website/Startup.cs
|
test/websites/Glimpse.FunctionalTest.Website/Startup.cs
|
using System.Diagnostics.Tracing;
using Glimpse.Agent.AspNet.Mvc;
using Glimpse.Agent.Web;
using Glimpse.Server.Web;
using Microsoft.AspNet.Builder;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse.FunctionalTest.Website
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services
.AddGlimpse()
.RunningAgentWeb()
.RunningServerWeb()
.WithLocalAgent();
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
app.UseGlimpseServer();
app.UseGlimpseAgent();
app.UseMvcWithDefaultRoute();
}
}
}
|
using System.Diagnostics.Tracing;
using Glimpse.Agent.AspNet.Mvc;
using Glimpse.Agent.Web;
using Glimpse.Server.Web;
using Microsoft.AspNet.Builder;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse.FunctionalTest.Website
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services
.AddGlimpse()
.RunningAgentWeb()
.RunningServerWeb()
.WithLocalAgent();
services.AddMvc();
services.AddTransient<MvcTelemetryListener>();
}
public void Configure(IApplicationBuilder app)
{
var telemetryListener = app.ApplicationServices.GetRequiredService<TelemetryListener>();
telemetryListener.SubscribeWithAdapter(app.ApplicationServices.GetRequiredService<MvcTelemetryListener>());
app.UseGlimpseServer();
app.UseGlimpseAgent();
app.UseMvcWithDefaultRoute();
}
}
}
|
mit
|
C#
|
07d3e366239a22eca6a6f4027cdd7a03d1d5023d
|
Add tests
|
skonves/Konves.KScript
|
tests/Konves.KScript.UnitTests/ExpressionTestFixture.cs
|
tests/Konves.KScript.UnitTests/ExpressionTestFixture.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Konves.KScript.UnitTests
{
[TestClass]
public class ExpressionTestFixture
{
[TestCategory(nameof(Expression))]
[TestMethod]
public void EvaluateTest()
{
string stringValue = "string value";
decimal decimalValue = 5m;
DateTime dateValue = DateTime.Parse("2015-1-1");
bool boolValue = true;
IDictionary<string, object> state = new Dictionary<string, object> {
{ nameof(stringValue), stringValue },
{ nameof(decimalValue), decimalValue },
{ nameof(dateValue), dateValue },
{ nameof(boolValue), boolValue }
};
DoEvaluateTest($"{{{nameof(stringValue)}}} = '{stringValue}'", state, true);
DoEvaluateTest($"TRUE != FALSE", state, true);
DoEvaluateTest($"NOW > '2000-1-1'", state, true);
DoEvaluateTest($"NULL IS NOT NULL", state, false);
DoEvaluateTest($"(5) > (1)", state, true);
DoEvaluateTest($"TRUE OR FALSE", state, true);
DoEvaluateTest($"5 BETWEEN 1 AND 10", state, true);
DoEvaluateTest($"'asdf' IN ['asdf','qwerty']", state, true);
DoEvaluateTest($"TRUE AND NOT FALSE", state, true);
}
private void DoEvaluateTest(string s, IDictionary<string, object> state, bool expected)
{
// Arrange
IExpression expression = new Expression(s);
// Act
bool result = expression.Evaluate(state);
// Assert
Assert.AreEqual(expected, result);
}
[TestCategory(nameof(Expression))]
[ExpectedException(typeof(ArgumentException))]
[TestMethod]
public void EvaluateTest_BadSyntax()
{
DoEvaluateTest_BadSyntax("not a valid expression", null);
}
private void DoEvaluateTest_BadSyntax(string s, IDictionary<string, object> state)
{
// Arrange
IExpression expression = new Expression(s);
// Act
bool result = expression.Evaluate(state);
// Assert
Assert.Fail();
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Konves.KScript.UnitTests
{
[TestClass]
public class ExpressionTestFixture
{
[TestCategory(nameof(Expression))]
[TestMethod]
public void EvaluateTest()
{
string stringValue = "string value";
decimal decimalValue = 5m;
DateTime dateValue = DateTime.Parse("2015-1-1");
bool boolValue = true;
IDictionary<string, object> state = new Dictionary<string, object> {
{ nameof(stringValue), stringValue },
{ nameof(decimalValue), decimalValue },
{ nameof(dateValue), dateValue },
{ nameof(boolValue), boolValue }
};
DoEvaluateTest($"{{{nameof(stringValue)}}} = '{stringValue}'", state, true);
DoEvaluateTest($"TRUE != FALSE", state, true);
DoEvaluateTest($"NOW > '2000-1-1'", state, true);
DoEvaluateTest($"NULL IS NOT NULL", state, false);
DoEvaluateTest($"(5) > (1)", state, true);
}
private void DoEvaluateTest(string s, IDictionary<string, object> state, bool expected)
{
// Arrange
IExpression expression = new Expression(s);
// Act
bool result = expression.Evaluate(state);
// Assert
Assert.AreEqual(expected, result);
}
[TestCategory(nameof(Expression))]
[ExpectedException(typeof(ArgumentException))]
[TestMethod]
public void EvaluateTest_BadSyntax()
{
DoEvaluateTest_BadSyntax("not a valid expression", null);
}
private void DoEvaluateTest_BadSyntax(string s, IDictionary<string, object> state)
{
// Arrange
IExpression expression = new Expression(s);
// Act
bool result = expression.Evaluate(state);
// Assert
Assert.Fail();
}
}
}
|
apache-2.0
|
C#
|
b3911d2781e74a8295f91958f3cd2356857397fc
|
Update ArrayOperations.cs
|
shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/hackerrank,shreeharshas/hackerrank,shreeharshas/Algorithms,shreeharshas/hackerrank,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/hackerrank
|
interim/ArrayOperations.cs
|
interim/ArrayOperations.cs
|
/*
Methods to left shift array arr of size n, d times
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class ArrayOperations {
static void Main(String[] args) { //rename to shift(int n, int d)
string s = Console.ReadLine();
int n = Convert.ToInt32(s.Split(' ')[0]);
int d = Convert.ToInt32(s.Split(' ')[1]);
string inputStr = Console.ReadLine();
int[] arr= inputStr.Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
int[] arr2 = new int[arr.Length];
for(int i=0;i<arr.Length;i++){
int j = (i+d)%arr.Length;
arr2[i] = arr[j];
}
for(int i=0;i<arr.Length;i++){
arr[i] = arr2[i];
}
for(int i=0;i<arr.Length;i++){
Console.Write(arr[i] + " ");
}
}
}
|
/*
Methods to left shift array arr of size n, d times
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
static void Main(String[] args) {
string s = Console.ReadLine();
int n = Convert.ToInt32(s.Split(' ')[0]);
int d = Convert.ToInt32(s.Split(' ')[1]);
string inputStr = Console.ReadLine();
int[] arr= inputStr.Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
int[] arr2 = new int[arr.Length];
for(int i=0;i<arr.Length;i++){
int j = (i+d)%arr.Length;
arr2[i] = arr[j];
}
for(int i=0;i<arr.Length;i++){
arr[i] = arr2[i];
}
for(int i=0;i<arr.Length;i++){
Console.Write(arr[i] + " ");
}
}
}
|
mit
|
C#
|
7dab33c3343cf4c0e95163dbce282adc964dafb2
|
Add CachedBundleContainerFactory test.
|
honestegg/cassette,honestegg/cassette,damiensawyer/cassette,BluewireTechnologies/cassette,damiensawyer/cassette,honestegg/cassette,BluewireTechnologies/cassette,damiensawyer/cassette,andrewdavey/cassette,andrewdavey/cassette,andrewdavey/cassette
|
src/Cassette.UnitTests/Configuration/CachedBundleContainerFactory.cs
|
src/Cassette.UnitTests/Configuration/CachedBundleContainerFactory.cs
|
using System.Linq;
using Cassette.Manifests;
using Cassette.Scripts;
using Cassette.Scripts.Manifests;
using Moq;
using Should;
using Xunit;
namespace Cassette.Configuration
{
public class CachedBundleContainerFactory_Tests : BundleContainerFactoryTestSuite
{
readonly Mock<ICassetteManifestCache> cache;
public CachedBundleContainerFactory_Tests()
{
cache = new Mock<ICassetteManifestCache>();
cache.Setup(c => c.LoadCassetteManifest()).Returns(() => new CassetteManifest());
}
[Fact]
public void GivenCachedManifestWithOneBundle_WhenCreateWithMatchingUpToDateBundle_ThenCachedBundleIsReturned()
{
var cachedManifest = new CassetteManifest(
"",
new[]
{
new ScriptBundleManifest { Path = "~", Hash = new byte[] { 1, 2, 3 } }
}
);
cache.Setup(c => c.LoadCassetteManifest()).Returns(cachedManifest);
var factory = CreateFactory();
var container = factory.Create(new[] { new ScriptBundle("~") });
var bundle = container.Bundles.Single();
bundle.Hash.ShouldEqual(new byte[] { 1, 2, 3 });
bundle.IsFromCache.ShouldBeTrue();
bundle.IsProcessed.ShouldBeTrue();
}
internal override IBundleContainerFactory CreateFactory()
{
return new CachedBundleContainerFactory(cache.Object, Settings);
}
}
}
|
using Cassette.Manifests;
using Moq;
namespace Cassette.Configuration
{
public class CachedBundleContainerFactory_Tests : BundleContainerFactoryTestSuite
{
readonly Mock<ICassetteManifestCache> cache;
public CachedBundleContainerFactory_Tests()
{
cache = new Mock<ICassetteManifestCache>();
cache.Setup(c => c.LoadCassetteManifest()).Returns(() => new CassetteManifest());
}
internal override IBundleContainerFactory CreateFactory()
{
return new CachedBundleContainerFactory(cache.Object, Settings);
}
}
}
|
mit
|
C#
|
7e44451f0cb3f0bb4aa8a8dd46d32f64d0044deb
|
Clean up.
|
Robelind/MvcCoreBootstrap
|
src/MvcCoreBootstrapForm/Builders/MvcCoreBootstrapDropdownBuilder.cs
|
src/MvcCoreBootstrapForm/Builders/MvcCoreBootstrapDropdownBuilder.cs
|
using MvcCoreBootstrap.Building;
using MvcCoreBootstrapForm.Config;
namespace MvcCoreBootstrapForm.Builders
{
public class MvcCoreBootstrapDropdownBuilder : BuilderBase
{
private readonly DropdownConfig _config;
internal MvcCoreBootstrapDropdownBuilder(DropdownConfig config)
{
_config = config;
}
/// <summary>
/// Do not generate a label automatically for the dropdown.
/// </summary>
/// <returns>The dropdown builder instance.</returns>
public MvcCoreBootstrapDropdownBuilder NoLabel()
{
return(this.SetConfigProp<MvcCoreBootstrapDropdownBuilder>(() => _config.AutoLabel = false));
}
/// <summary>
/// Sets the label for the dropdown.
/// </summary>
/// <param name="label">Text input label.</param>
/// <returns>The dropdown builder instance.</returns>
public MvcCoreBootstrapDropdownBuilder Label(string label)
{
return(this.SetConfigProp<MvcCoreBootstrapDropdownBuilder>(() => _config.Label = label));
}
/// <summary>
/// Sets the disabled state for the text input.
/// </summary>
/// <param name="disabled">If true, the text input is disabled</param>
/// <returns>The dropdown builder instance.</returns>
public MvcCoreBootstrapDropdownBuilder Disabled(bool disabled = true)
{
return(this.SetConfigProp<MvcCoreBootstrapDropdownBuilder>(() => _config.Disabled = disabled));
}
/// <summary>
/// Sets a css class for the dropdown element.
/// </summary>
/// <param name="cssClass">Name of css class.</param>
/// <param name="condition">If true, the css class will be set for the dropdown element.</param>
/// <returns>The dropdown builder instance.</returns>
public MvcCoreBootstrapDropdownBuilder CssClass(string cssClass, bool condition = true)
{
return(this.AddCssClass<MvcCoreBootstrapDropdownBuilder>(_config.CssClasses, cssClass, condition));
}
}
}
|
using MvcCoreBootstrap.Building;
using MvcCoreBootstrapForm.Config;
namespace MvcCoreBootstrapForm.Builders
{
public class MvcCoreBootstrapDropdownBuilder : BuilderBase
{
private readonly DropdownConfig _config;
internal MvcCoreBootstrapDropdownBuilder(DropdownConfig config)
{
_config = config;
}
/// <summary>
/// Sets the id attribute for the dropdown.
/// </summary>
/// <param name="id">Id</param>
/// <returns>The dropdown builder instance.</returns>
public MvcCoreBootstrapDropdownBuilder Id(string id)
{
return(this.SetConfigProp<MvcCoreBootstrapDropdownBuilder>(() => _config.Id = id));
}
/// <summary>
/// Sets the name attribute for the dropdown.
/// </summary>
/// <param name="name">Name</param>
/// <returns>The dropdown builder instance.</returns>
public MvcCoreBootstrapDropdownBuilder Name(string name)
{
return(this.SetConfigProp<MvcCoreBootstrapDropdownBuilder>(() => _config.Name = name));
}
/// <summary>
/// Do not generate a label automatically for the dropdown.
/// </summary>
/// <returns>The dropdown builder instance.</returns>
public MvcCoreBootstrapDropdownBuilder NoLabel()
{
return(this.SetConfigProp<MvcCoreBootstrapDropdownBuilder>(() => _config.AutoLabel = false));
}
/// <summary>
/// Sets the label for the dropdown.
/// </summary>
/// <param name="label">Text input label.</param>
/// <returns>The dropdown builder instance.</returns>
public MvcCoreBootstrapDropdownBuilder Label(string label)
{
return(this.SetConfigProp<MvcCoreBootstrapDropdownBuilder>(() => _config.Label = label));
}
/// <summary>
/// Sets the disabled state for the text input.
/// </summary>
/// <param name="disabled">If true, the text input is disabled</param>
/// <returns>The text input builder instance.</returns>
public MvcCoreBootstrapTextInputBuilder Disabled(bool disabled = true)
{
return(this.SetConfigProp<MvcCoreBootstrapTextInputBuilder>(() => _config.Disabled = disabled));
}
/// <summary>
/// Sets a css class for the dropdown element.
/// </summary>
/// <param name="cssClass">Name of css class.</param>
/// <param name="condition">If true, the css class will be set for the dropdown element.</param>
/// <returns>The dropdown builder instance.</returns>
public MvcCoreBootstrapDropdownBuilder CssClass(string cssClass, bool condition = true)
{
return(this.AddCssClass<MvcCoreBootstrapDropdownBuilder>(_config.CssClasses, cssClass, condition));
}
}
}
|
mit
|
C#
|
c184b163ac423a481cb71a223ccf3eac91963905
|
add method to set a path to a custom ca file
|
SEEK-Jobs/pact-net,SEEK-Jobs/pact-net,SEEK-Jobs/pact-net
|
PactNet/PactUriOptions.cs
|
PactNet/PactUriOptions.cs
|
using System;
using System.Text;
namespace PactNet
{
public class PactUriOptions
{
public string Username { get; }
public string Password { get; }
public string Token { get; }
public string AuthorizationScheme { get; }
public string AuthorizationValue { get; }
public PactUriOptions() { }
public PactUriOptions(string username, string password)
public PactUriOptions SetSslCaFilePath(string pathToSslCaFile)
{
if (String.IsNullOrEmpty(pathToSslCaFile))
{
throw new ArgumentException($"{nameof(pathToSslCaFile)} is null or empty");
}
SslCaFilePath = pathToSslCaFile;
return this;
}
{
if (String.IsNullOrEmpty(username))
{
throw new ArgumentException("username is null or empty.");
}
if (username.Contains(":"))
{
throw new ArgumentException("username contains a ':' character, which is not allowed.");
}
if (String.IsNullOrEmpty(password))
{
throw new ArgumentException("password is null or empty.");
}
Username = username;
Password = password;
AuthorizationScheme = "Basic";
AuthorizationValue = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{Username}:{Password}"));
}
public PactUriOptions(string token)
{
if (String.IsNullOrEmpty(token))
{
throw new ArgumentException("token is null or empty.");
}
Token = token;
AuthorizationScheme = "Bearer";
AuthorizationValue = token;
}
}
}
|
using System;
using System.Text;
namespace PactNet
{
public class PactUriOptions
{
public string Username { get; }
public string Password { get; }
public string Token { get; }
public string AuthorizationScheme { get; }
public string AuthorizationValue { get; }
public PactUriOptions(string username, string password)
{
if (String.IsNullOrEmpty(username))
{
throw new ArgumentException("username is null or empty.");
}
if (username.Contains(":"))
{
throw new ArgumentException("username contains a ':' character, which is not allowed.");
}
if (String.IsNullOrEmpty(password))
{
throw new ArgumentException("password is null or empty.");
}
Username = username;
Password = password;
AuthorizationScheme = "Basic";
AuthorizationValue = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{Username}:{Password}"));
}
public PactUriOptions(string token)
{
if (String.IsNullOrEmpty(token))
{
throw new ArgumentException("token is null or empty.");
}
Token = token;
AuthorizationScheme = "Bearer";
AuthorizationValue = token;
}
}
}
|
mit
|
C#
|
e16c32bd8bf08e3d35f168bd624570bd75a5a91e
|
Add compute file hash.
|
robertzml/Poseidon
|
Poseidon.Common/Hasher.cs
|
Poseidon.Common/Hasher.cs
|
using System;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Poseidon.Common
{
/// <summary>
/// 散列算法类
/// </summary>
public class Hasher
{
#region Method
/// <summary>
/// SHA1加密
/// </summary>
/// <param name="source">明文</param>
/// <returns>密文</returns>
public static string SHA1Encrypt(string source)
{
SHA1 sha = new SHA1CryptoServiceProvider();
byte[] result = sha.ComputeHash(Encoding.Default.GetBytes(source));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < result.Length; i++)
{
sb.Append(result[i].ToString("x2"));
}
return sb.ToString();
}
/// <summary>
/// MD5加密
/// </summary>
/// <param name="source">明文</param>
/// <returns>密文</returns>
public static string MD5Encrypt(string source)
{
MD5 md5Hasher = MD5.Create();
byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(source));
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
return sBuilder.ToString();
}
/// <summary>
/// 获取文件MD5哈希值
/// </summary>
/// <param name="fileName">文件路径</param>
/// <returns></returns>
public static string GetFileMD5Hash(string fileName)
{
try
{
FileStream file = new FileStream(fileName, FileMode.Open);
MD5 md5 = new MD5CryptoServiceProvider();
byte[] retVal = md5.ComputeHash(file);
file.Close();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < retVal.Length; i++)
{
sb.Append(retVal[i].ToString("x2"));
}
return sb.ToString();
}
catch (Exception ex)
{
throw new Exception("GetFileMD5Hash() fail, error:" + ex.Message);
}
}
#endregion //Method
}
}
|
using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Poseidon.Common
{
/// <summary>
/// 散列算法类
/// </summary>
public class Hasher
{
#region Method
/// <summary>
/// SHA1加密
/// </summary>
/// <param name="source">明文</param>
/// <returns>密文</returns>
public static string SHA1Encrypt(string source)
{
SHA1 sha = new SHA1CryptoServiceProvider();
byte[] result = sha.ComputeHash(Encoding.Default.GetBytes(source));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < result.Length; i++)
{
sb.Append(result[i].ToString("x2"));
}
return sb.ToString();
}
/// <summary>
/// MD5加密
/// </summary>
/// <param name="source">明文</param>
/// <returns>密文</returns>
public static string MD5Encrypt(string source)
{
MD5 md5Hasher = MD5.Create();
byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(source));
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
return sBuilder.ToString();
}
#endregion //Method
}
}
|
mit
|
C#
|
542a46b0a7675cc9b4676cdceeb1326257217261
|
Update r# version
|
NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu,ZLima12/osu,ppy/osu,peppy/osu,EVAST9919/osu,2yangk23/osu,ZLima12/osu,UselessToucan/osu,NeoAdonis/osu,johnneijzen/osu,peppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,ppy/osu,EVAST9919/osu,2yangk23/osu,johnneijzen/osu,UselessToucan/osu
|
build/build.cake
|
build/build.cake
|
#addin "nuget:?package=CodeFileSanity&version=0.0.21"
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.3.4"
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Build");
var configuration = Argument("configuration", "Release");
var rootDirectory = new DirectoryPath("..");
var solution = rootDirectory.CombineWithFilePath("osu.sln");
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Compile")
.Does(() => {
DotNetCoreBuild(solution.FullPath, new DotNetCoreBuildSettings {
Configuration = configuration,
});
});
Task("Test")
.IsDependentOn("Compile")
.Does(() => {
var testAssemblies = GetFiles(rootDirectory + "/**/*.Tests/bin/**/*.Tests.dll");
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
Parallel = true,
ToolTimeout = TimeSpan.FromMinutes(10),
});
});
// windows only because both inspectcore and nvika depend on net45
Task("InspectCode")
.WithCriteria(IsRunningOnWindows())
.IsDependentOn("Compile")
.Does(() => {
InspectCode(solution, new InspectCodeSettings {
CachesHome = "inspectcode",
OutputFile = "inspectcodereport.xml",
});
int returnCode = StartProcess(nVikaToolPath, $@"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
if (returnCode != 0)
throw new Exception($"inspectcode failed with return code {returnCode}");
});
Task("CodeFileSanity")
.Does(() => {
ValidateCodeSanity(new ValidateCodeSanitySettings {
RootDirectory = rootDirectory.FullPath,
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
});
});
Task("Build")
.IsDependentOn("CodeFileSanity")
.IsDependentOn("InspectCode")
.IsDependentOn("Test");
RunTarget(target);
|
#addin "nuget:?package=CodeFileSanity&version=0.0.21"
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2"
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Build");
var configuration = Argument("configuration", "Release");
var rootDirectory = new DirectoryPath("..");
var solution = rootDirectory.CombineWithFilePath("osu.sln");
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Compile")
.Does(() => {
DotNetCoreBuild(solution.FullPath, new DotNetCoreBuildSettings {
Configuration = configuration,
});
});
Task("Test")
.IsDependentOn("Compile")
.Does(() => {
var testAssemblies = GetFiles(rootDirectory + "/**/*.Tests/bin/**/*.Tests.dll");
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
Parallel = true,
ToolTimeout = TimeSpan.FromMinutes(10),
});
});
// windows only because both inspectcore and nvika depend on net45
Task("InspectCode")
.WithCriteria(IsRunningOnWindows())
.IsDependentOn("Compile")
.Does(() => {
InspectCode(solution, new InspectCodeSettings {
CachesHome = "inspectcode",
OutputFile = "inspectcodereport.xml",
});
int returnCode = StartProcess(nVikaToolPath, $@"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
if (returnCode != 0)
throw new Exception($"inspectcode failed with return code {returnCode}");
});
Task("CodeFileSanity")
.Does(() => {
ValidateCodeSanity(new ValidateCodeSanitySettings {
RootDirectory = rootDirectory.FullPath,
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
});
});
Task("Build")
.IsDependentOn("CodeFileSanity")
.IsDependentOn("InspectCode")
.IsDependentOn("Test");
RunTarget(target);
|
mit
|
C#
|
d0808c95c510838656fb2e523de321779e979890
|
update LProgress
|
LingJiJian/uLui,LingJiJian/uLui,LingJiJian/uLui,LingJiJian/uLui,LingJiJian/uLui,LingJiJian/uLui
|
Assets/Game/Resources/Scripts/LWidget/LProgress.cs
|
Assets/Game/Resources/Scripts/LWidget/LProgress.cs
|
/****************************************************************************
Copyright (c) 2015 Lingjijian
Created by Lingjijian on 2015
342854406@qq.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEngine.EventSystems;
[SLua.CustomLuaClass]
public class LProgress : MonoBehaviour {
public float maxValue;
public float minValue;
private float _value;
public Image bar;
public Text label;
private bool _isStartProgress;
private float _arrivePercentage;
private float _startProgressStep;
public UnityAction onProgress;
public UnityAction onProgressEnd;
public LProgress()
{
maxValue = 100;
minValue = 0;
_value = 15;
_isStartProgress = false;
_arrivePercentage = 0;
_startProgressStep = 0;
}
public void setValue(float value)
{
this._value = Mathf.Min(maxValue, Mathf.Max(minValue, value));
bar.fillAmount = this._value / maxValue;
}
public float getValue()
{
return _value;
}
public float getPercentage()
{
return (_value - minValue) / (maxValue - minValue);
}
public void startProgress(float value,float step)
{
if (value <= minValue && value >= maxValue) {
return;
}
_arrivePercentage = (value - minValue) / (maxValue - minValue);
_startProgressStep = step;
_isStartProgress = true;
}
void Update()
{
if (_isStartProgress) {
_value = _value + _startProgressStep;
float perc = getPercentage ();
bar.fillAmount = perc;
if (label) {
label.text = (perc * 100 ).ToString("0.0")+"%";
}
if (perc < _arrivePercentage) {
if (onProgress!=null)
onProgress.Invoke ();
} else {
if (onProgressEnd!=null)
onProgressEnd.Invoke ();
_isStartProgress = false;
}
}
}
}
|
/****************************************************************************
Copyright (c) 2015 Lingjijian
Created by Lingjijian on 2015
342854406@qq.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEngine.EventSystems;
[SLua.CustomLuaClass]
public class LProgress : MonoBehaviour {
public float maxValue;
public float minValue;
private float _value;
public Image bar;
public Text label;
private bool _isStartProgress;
private float _arrivePercentage;
private float _startProgressStep;
public UnityAction onProgress;
public UnityAction onProgressEnd;
public LProgress()
{
maxValue = 100;
minValue = 0;
_value = 15;
_isStartProgress = false;
_arrivePercentage = 0;
_startProgressStep = 0;
}
public void setValue(float value)
{
this._value = Mathf.Min(maxValue, Mathf.Max(minValue, value));
bar.fillAmount = this._value / maxValue;
}
public float getPercentage()
{
return (_value - minValue) / (maxValue - minValue);
}
public void startProgress(float value,float step)
{
if (value <= minValue && value >= maxValue) {
return;
}
_arrivePercentage = (value - minValue) / (maxValue - minValue);
_startProgressStep = step;
_isStartProgress = true;
}
void Update()
{
if (_isStartProgress) {
_value = _value + _startProgressStep;
float perc = getPercentage ();
bar.fillAmount = perc;
if (label) {
label.text = (perc * 100 ).ToString("0.0")+"%";
}
if (perc < _arrivePercentage) {
if (onProgress!=null)
onProgress.Invoke ();
} else {
if (onProgressEnd!=null)
onProgressEnd.Invoke ();
_isStartProgress = false;
}
}
}
}
|
mit
|
C#
|
90470bca62cbdedfb2f42e371610ef02a6034543
|
Add test
|
sakapon/Bellona.Analysis
|
Bellona/UnitTest/Clustering/ClusteringModelTest.cs
|
Bellona/UnitTest/Clustering/ClusteringModelTest.cs
|
using System;
using System.Drawing;
using System.Linq;
using Bellona.Clustering;
using Bellona.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTest.Clustering
{
[TestClass]
public class ClusteringModelTest
{
[TestMethod]
public void Test_1()
{
var model = new ClusteringModel<Color>(20, c => new double[] { c.R, c.G, c.B });
model.Train(TestData.GetColors(), 50);
model.Clusters
.Do(c => Console.WriteLine(c.Id))
.Execute(c => c.Records.Execute(r => Console.WriteLine(r.Element)));
var cluster = model.AssignElement(Color.FromArgb(0, 92, 175)); // Ruri
Console.WriteLine("Ruri: {0}", cluster.Id);
}
}
}
|
using System;
using System.Drawing;
using System.Linq;
using Bellona.Clustering;
using Bellona.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTest.Clustering
{
[TestClass]
public class ClusteringModelTest
{
[TestMethod]
public void Test_1()
{
var model = new ClusteringModel<Color>(20, c => new double[] { c.R, c.G, c.B });
model.Train(TestData.GetColors(), 50);
model.Clusters
.Do(c => Console.WriteLine(c.Id))
.Execute(c => c.Records.Execute(r => Console.WriteLine(r.Element)));
}
}
}
|
mit
|
C#
|
94d21c95c6c39e2cf4af356b65eba745864455d3
|
Allow substituting of internal types.
|
samcragg/Crest,samcragg/Crest,samcragg/Crest
|
tools/Crest.OpenApi/Properties/AssemblyInfo.cs
|
tools/Crest.OpenApi/Properties/AssemblyInfo.cs
|
// Copyright (c) Samuel Cragg.
//
// Licensed under the MIT license. See LICENSE file in the project root for
// full license information.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Samuel Cragg")]
[assembly: AssemblyProduct("Crest.OpenApi")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // NSubstitute
[assembly: InternalsVisibleTo("OpenApi.UnitTests")]
|
// Copyright (c) Samuel Cragg.
//
// Licensed under the MIT license. See LICENSE file in the project root for
// full license information.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Samuel Cragg")]
[assembly: AssemblyProduct("Crest.OpenApi")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("OpenApi.UnitTests")]
|
mit
|
C#
|
edcf9f9a321cc865b2c680f1439197cf2e217a37
|
Reset the counter for the next playthrough - BH
|
Tolk-Haggard/GlobalGameJam2017
|
SoundWaves/Assets/DestroyEnemy.cs
|
SoundWaves/Assets/DestroyEnemy.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class DestroyEnemy : MonoBehaviour {
public static int kills = 0;
void OnCollisionEnter (Collision col) {
if(col.gameObject.name.Contains("Monster")) {
kills += 1;
Destroy(col.gameObject);
if (kills >= 5) {
kills = 0;
SceneManager.LoadScene ("GameWin", LoadSceneMode.Single);
}
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class DestroyEnemy : MonoBehaviour {
public static int kills = 0;
void OnCollisionEnter (Collision col) {
if(col.gameObject.name.Contains("Monster")) {
kills += 1;
Destroy(col.gameObject);
if (kills >= 5) {
SceneManager.LoadScene ("GameWin", LoadSceneMode.Single);
}
}
}
}
|
mit
|
C#
|
adeb6fc08357abe61ead0e9f699ae1af30225ea1
|
add clean IP task log file
|
NuGet/NuGet.Services.Dashboard,NuGet/NuGet.Services.Dashboard,NuGet/NuGet.Services.Dashboard
|
NuGet.Services.Dashboard.Operations/Tasks/DashBoardTasks/IssLogCleanUptask.cs
|
NuGet.Services.Dashboard.Operations/Tasks/DashBoardTasks/IssLogCleanUptask.cs
|
using System;
using System.IO;
namespace NuGetGallery.Operations.Tasks.DashBoardTasks
{
[Command("IssCleanUpTask", "clean up old iss log in current dir", AltName = "clean")]
class IssLogCleanUptask : OpsTask
{
public override void ExecuteCommand()
{
var dirs = Directory.EnumerateDirectories(Environment.CurrentDirectory, "*.log");
var files = Directory.EnumerateFiles(Environment.CurrentDirectory, "*.log");
foreach (string file in files)
{
try
{
string filename = file.Substring(Environment.CurrentDirectory.Length);
string date = filename.Substring("\\u_ex".Length, "yyMMddHH".Length);
DateTime logdate = new DateTime();
logdate = DateTime.ParseExact(date, "yyMMddHH", null);
if (logdate < DateTime.UtcNow.AddHours(-48)) File.Delete(file);
}
catch (Exception e)
{
Console.WriteLine("clean up error: {0}", e.Message);
}
}
foreach (string dir in dirs)
{
try
{
string date = RemoveLetter(dir.Substring(Environment.CurrentDirectory.Length));
DateTime logdate = new DateTime();
logdate = DateTime.ParseExact(date, "yyMMddHH", null);
if (logdate < DateTime.UtcNow.AddHours(-48)) Directory.Delete(dir, true);
}
catch (Exception e)
{
Console.WriteLine("clean up error: {0}", e.Message);
}
}
}
private string RemoveLetter(string src)
{
if (src.Equals("")) return src;
if (char.IsDigit(src[0])) return src[0] + RemoveLetter(src.Substring(1));
else return RemoveLetter(src.Substring(1));
}
}
}
|
using System;
using System.IO;
namespace NuGetGallery.Operations.Tasks.DashBoardTasks
{
[Command("IssCleanUpTask", "clean up old iss log in current dir", AltName = "clean")]
class IssLogCleanUptask : OpsTask
{
public override void ExecuteCommand()
{
var dirs = Directory.EnumerateDirectories(Environment.CurrentDirectory, "*.log");
foreach (string dir in dirs)
{
try
{
string date = RemoveLetter(dir.Substring(Environment.CurrentDirectory.Length));
DateTime logdate = new DateTime();
logdate = DateTime.ParseExact(date, "yyMMddHH", null);
if (logdate < DateTime.UtcNow.AddHours(-48)) Directory.Delete(dir, true);
}
catch (Exception e)
{
Console.WriteLine("clean up error: {0}", e.Message);
}
}
}
private string RemoveLetter(string src)
{
if (src.Equals("")) return src;
if (char.IsDigit(src[0])) return src[0] + RemoveLetter(src.Substring(1));
else return RemoveLetter(src.Substring(1));
}
}
}
|
apache-2.0
|
C#
|
f0a302b7043b64f689904edc670f835d231c1670
|
make helper method private
|
StrubT/StrubTUtilities
|
StrubTUtilities/DataExtensions.cs
|
StrubTUtilities/DataExtensions.cs
|
using System.Data;
using System.Linq;
namespace StrubT {
public static class DataExtensions {
public static IReadOnlyTable<object> AsReadOnly(this DataTable dataTable) {
var table = new Table<object>(dataTable.TableName);
table.AddColumns(dataTable.Columns.Cast<DataColumn>().Select(c => c.ColumnName).ToList());
table.AddRows(dataTable.Rows.Cast<DataRow>().Select(r => r.ItemArray));
return table;
}
public static IReadOnlyTable<T> AsReadOnly<T>(this DataTable dataTable) {
var table = new Table<T>(dataTable.TableName);
table.AddColumns(dataTable.Columns.Cast<DataColumn>().Select(c => c.ColumnName).ToList());
table.AddRows(dataTable.Rows.Cast<DataRow>().Select(r => dataTable.Columns.Cast<DataColumn>().Select(c => r.Field<T>(c)).ToList()));
return table;
}
#if NETSTANDARD2_0
static T Field<T>(this DataRow row, DataColumn column) => (T)row[column];
#endif
}
}
|
using System.Data;
using System.Linq;
namespace StrubT {
public static class DataExtensions {
public static IReadOnlyTable<object> AsReadOnly(this DataTable dataTable) {
var table = new Table<object>(dataTable.TableName);
table.AddColumns(dataTable.Columns.Cast<DataColumn>().Select(c => c.ColumnName).ToList());
table.AddRows(dataTable.Rows.Cast<DataRow>().Select(r => r.ItemArray));
return table;
}
public static IReadOnlyTable<T> AsReadOnly<T>(this DataTable dataTable) {
var table = new Table<T>(dataTable.TableName);
table.AddColumns(dataTable.Columns.Cast<DataColumn>().Select(c => c.ColumnName).ToList());
table.AddRows(dataTable.Rows.Cast<DataRow>().Select(r => dataTable.Columns.Cast<DataColumn>().Select(c => r.Field<T>(c)).ToList()));
return table;
}
#if NETSTANDARD2_0
public static T Field<T>(this DataRow row, DataColumn column) => (T)row[column];
#endif
}
}
|
mit
|
C#
|
36bfc6e7eff1cc650fdae6fbd5b04dfaabc2aab1
|
update the version number
|
mikebarker/Plethora.NET
|
src/AssemblyInfo.Common.cs
|
src/AssemblyInfo.Common.cs
|
//------------------------------------------------------------------------------
// Copyright 2007 The Plethora Project.
// All rights reserved.
//
// Refer to the Licence.txt distributed with this file for licencing terms.
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Permissions;
// Assembly Properties
#if DEBUG
[assembly: AssemblyConfiguration("DEBUG")]
#else
[assembly: AssemblyConfiguration("RELEASE")]
#endif
[assembly: AssemblyCompany("Optium ltd")]
[assembly: AssemblyProduct("The Plethora .NET Project")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version
[assembly: AssemblyVersion("0.12.*")]
[assembly: AssemblyFileVersion("0.12.0.0")]
// Interoperability
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
|
//------------------------------------------------------------------------------
// Copyright 2007 The Plethora Project.
// All rights reserved.
//
// Refer to the Licence.txt distributed with this file for licencing terms.
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Permissions;
// Assembly Properties
#if DEBUG
[assembly: AssemblyConfiguration("DEBUG")]
#else
[assembly: AssemblyConfiguration("RELEASE")]
#endif
[assembly: AssemblyCompany("Optium ltd")]
[assembly: AssemblyProduct("The Plethora .NET Project")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version
[assembly: AssemblyVersion("0.11.*")]
[assembly: AssemblyFileVersion("0.11.0.1")]
// Interoperability
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
|
mit
|
C#
|
ad27e5b3bad0b697e38e1837052d8eb30f3dc7bc
|
Change message.
|
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
|
src/CompetitionPlatform/Views/Shared/CreateClosed.cshtml
|
src/CompetitionPlatform/Views/Shared/CreateClosed.cshtml
|
@{
ViewData["Title"] = "Access Denied";
}
<div class="container">
<h2 class="text-danger">Creating projects is unavailable.</h2>
<p>
The Function "сreating project" is only available for lykke community members with an approved KYC Status.
</p>
</div>
|
@{
ViewData["Title"] = "Access Denied";
}
<div class="container">
<h2 class="text-danger">Creating projects is temporarily unavailable.</h2>
<p>
The Function "сreating project" is only available for lykke community members with an approved KYC Status.
</p>
</div>
|
mit
|
C#
|
5e499c9e6f77db6fe98445d2a802080a358b0b2a
|
Add timestamp to end of stub emails to make them unique
|
ValuationOffice/VORBS,ValuationOffice/VORBS,ValuationOffice/VORBS
|
VORBS/Utils/StubbedEmailClient.cs
|
VORBS/Utils/StubbedEmailClient.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Web;
using VORBS.Utils.interfaces;
namespace VORBS.Utils
{
public class StubbedEmailClient : ISmtpClient
{
private NLog.Logger _logger;
public StubbedEmailClient()
{
_logger = NLog.LogManager.GetCurrentClassLogger();
_logger.Trace(LoggerHelper.InitializeClassMessage());
}
public LinkedResource GetLinkedResource(string path, string id)
{
LinkedResource resource = new LinkedResource(path);
resource.ContentId = id;
_logger.Trace(LoggerHelper.ExecutedFunctionMessage(resource, path, id));
return resource;
}
public void Send(MailMessage message)
{
string rootDirectory = $@"{AppDomain.CurrentDomain.SetupInformation.ApplicationBase}Logs/{DateTime.Now.ToString("yyyy-MM-dd")}/EmailLogs/{message.To.FirstOrDefault().User}";
if (!Directory.Exists(rootDirectory))
Directory.CreateDirectory(rootDirectory);
string fileName = $"{message.Subject}_{DateTime.Now.ToString("hh-mm-ss")}";
using (FileStream fs = File.Create($"{rootDirectory}/{fileName}.html"))
{
StringBuilder builder = new StringBuilder();
builder.AppendLine($"From: {message.From}");
builder.AppendLine($"To: {message.To}");
builder.AppendLine($"BCC: {message.Bcc}");
builder.AppendLine($"Subject: {message.Subject}");
builder.AppendLine(message.Body);
byte[] info = new UTF8Encoding(true).GetBytes(builder.ToString());
fs.Write(info, 0, info.Length);
// writing data in bytes already
byte[] data = new byte[] { 0x0 };
fs.Write(data, 0, data.Length);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Web;
using VORBS.Utils.interfaces;
namespace VORBS.Utils
{
public class StubbedEmailClient : ISmtpClient
{
private NLog.Logger _logger;
public StubbedEmailClient()
{
_logger = NLog.LogManager.GetCurrentClassLogger();
_logger.Trace(LoggerHelper.InitializeClassMessage());
}
public LinkedResource GetLinkedResource(string path, string id)
{
LinkedResource resource = new LinkedResource(path);
resource.ContentId = id;
_logger.Trace(LoggerHelper.ExecutedFunctionMessage(resource, path, id));
return resource;
}
public void Send(MailMessage message)
{
string rootDirectory = $@"{AppDomain.CurrentDomain.SetupInformation.ApplicationBase}Logs/{DateTime.Now.ToString("yyyy-MM-dd")}/EmailLogs/{message.To.FirstOrDefault().User}";
if (!Directory.Exists(rootDirectory))
Directory.CreateDirectory(rootDirectory);
string fileName = $"Subject--{message.Subject}";
using (FileStream fs = File.Create($"{rootDirectory}/{fileName}.html"))
{
StringBuilder builder = new StringBuilder();
builder.AppendLine($"From: {message.From}");
builder.AppendLine($"To: {message.To}");
builder.AppendLine($"BCC: {message.Bcc}");
builder.AppendLine($"Subject: {message.Subject}");
builder.AppendLine(message.Body);
byte[] info = new UTF8Encoding(true).GetBytes(builder.ToString());
fs.Write(info, 0, info.Length);
// writing data in bytes already
byte[] data = new byte[] { 0x0 };
fs.Write(data, 0, data.Length);
}
}
}
}
|
apache-2.0
|
C#
|
c509ad77ffc67b3a4cc5e7374206e1279bcfaae8
|
Allow configure to be null
|
mrahhal/MR.Augmenter,mrahhal/MR.Augmenter
|
src/MR.Augmenter/AugmenterServiceCollectionExtensions.cs
|
src/MR.Augmenter/AugmenterServiceCollectionExtensions.cs
|
using System;
using Microsoft.Extensions.DependencyInjection;
using MR.Augmenter.Internal;
namespace MR.Augmenter
{
public static class AugmenterServiceCollectionExtensions
{
/// <summary>
/// Adds augmenter to services.
/// </summary>
/// <param name="services"></param>
/// <param name="configure">Can be null.</param>
public static IAugmenterBuilder AddAugmenter(
this IServiceCollection services,
Action<AugmenterConfiguration> configure)
{
services.AddScoped<IAugmenter, Augmenter>();
var configuration = new AugmenterConfiguration();
configure?.Invoke(configuration);
configuration.Build();
services.AddSingleton(configuration);
return new AugmenterBuilder(services);
}
}
}
|
using System;
using Microsoft.Extensions.DependencyInjection;
using MR.Augmenter.Internal;
namespace MR.Augmenter
{
public static class AugmenterServiceCollectionExtensions
{
public static IAugmenterBuilder AddAugmenter(
this IServiceCollection services,
Action<AugmenterConfiguration> configure)
{
services.AddScoped<IAugmenter, Augmenter>();
var configuration = new AugmenterConfiguration();
configure(configuration);
configuration.Build();
services.AddSingleton(configuration);
return new AugmenterBuilder(services);
}
}
}
|
mit
|
C#
|
a34624218f7674f9f4cabb13c23d8605fd496e88
|
Update AssemblyInfoResult.cs
|
mansoor-omrani/AssemblyInfo
|
AssemblyInfo/AssemblyInfoResult.cs
|
AssemblyInfo/AssemblyInfoResult.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AssemblyInfo
{
public class AssemblyInfoResult
{
public string CodeBase { get; set; }
public string ContentType { get; set; }
public string CultureInfo { get; set; }
public string CultureName { get; set; }
public string FullName { get; set; }
public string Name { get; set; }
public string Version { get; set; }
public string VersionCompatibility { get; set; }
public string Naming { get; set; }
private List<string> exportedTypes;
public List<string> ExportedTypes
{
get
{
if (exportedTypes == null)
exportedTypes = new List<string>();
return exportedTypes;
}
}
private List<string> types;
public List<string> Types
{
get
{
if (types == null)
types = new List<string>();
return types;
}
}
public string ToJson()
{
var _exportedTypes = string.Join(",", ExportedTypes.ToArray());
var _types = string.Join(",", Types.ToArray());
return
$@"
{{
""CodeBase"": ""{CodeBase}"",
""ContentType"": ""{ContentType}"",
""CultureInfo"": ""{CultureInfo}"",
""CultureName"": ""{CultureName}"",
""FullName"": ""{FullName}"",
""Name"": ""{Name}"",
""Version"": ""{Version}"",
""VersionCompatibility"": ""{VersionCompatibility}"",
""Naming"": ""{Naming}"",
""Types"": {_types},
""ExportedTypes"": {_exportedTypes}
}}";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AssemblyInfo
{
public class AssemblyInfoResult
{
public string CodeBase { get; set; }
public string ContentType { get; set; }
public string CultureInfo { get; set; }
public string CultureName { get; set; }
public string FullName { get; set; }
public string Name { get; set; }
public string Version { get; set; }
public string VersionCompatibility { get; set; }
public string Naming { get; set; }
private List<string> exportedTypes;
public List<string> ExportedTypes
{
get
{
if (exportedTypes == null)
exportedTypes = new List<string>();
return exportedTypes;
}
}
private List<string> types;
public List<string> Types
{
get
{
if (types == null)
types = new List<string>();
return types;
}
}
public string ToJson()
{
var _types = string.Join(",", Types.ToArray());
return
$@"
{{
""CodeBase"": ""{CodeBase}"",
""ContentType"": ""{ContentType}"",
""CultureInfo"": ""{CultureInfo}"",
""CultureName"": ""{CultureName}"",
""FullName"": ""{FullName}"",
""Name"": ""{Name}"",
""Version"": ""{Version}"",
""VersionCompatibility"": ""{VersionCompatibility}"",
""Naming"": ""{Naming}"",
""Types"": {_types}
}}";
}
}
}
|
mit
|
C#
|
e70266fa8e3588841ffb293cea786b637e6b1627
|
Set a default value for MP3 recording preset for new config files
|
Heufneutje/HeufyAudioRecorder,Heufneutje/AudioSharp
|
AudioSharp.Config/ConfigHandler.cs
|
AudioSharp.Config/ConfigHandler.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Input;
using AudioSharp.Utils;
namespace AudioSharp.Config
{
public class ConfigHandler
{
public static void SaveConfig(Configuration config)
{
string json = JsonUtils.SerializeObject(config);
File.WriteAllText(Path.Combine(FileUtils.AppDataFolder, "settings.json"), json);
}
public static Configuration ReadConfig()
{
string path = Path.Combine(FileUtils.AppDataFolder, "settings.json");
if (File.Exists(path))
{
string json = File.ReadAllText(path);
Configuration config = JsonUtils.DeserializeObject<Configuration>(json);
if (config.MP3EncodingPreset == 0)
config.MP3EncodingPreset = 1001;
return config;
}
return new Configuration()
{
RecordingsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic),
RecordingPrefix = "Recording{n}",
NextRecordingNumber = 1,
AutoIncrementRecordingNumber = true,
OutputFormat = "wav",
ShowTrayIcon = true,
GlobalHotkeys = new Dictionary<HotkeyType, Tuple<Key, ModifierKeys>>(),
RecordingSettingsPanelVisible = true,
RecordingOutputPanelVisible = true,
CheckForUpdates = true,
MP3EncodingPreset = 1001
};
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Input;
using AudioSharp.Utils;
namespace AudioSharp.Config
{
public class ConfigHandler
{
public static void SaveConfig(Configuration config)
{
string json = JsonUtils.SerializeObject(config);
File.WriteAllText(Path.Combine(FileUtils.AppDataFolder, "settings.json"), json);
}
public static Configuration ReadConfig()
{
string path = Path.Combine(FileUtils.AppDataFolder, "settings.json");
if (File.Exists(path))
{
string json = File.ReadAllText(path);
Configuration config = JsonUtils.DeserializeObject<Configuration>(json);
if (config.MP3EncodingPreset == 0)
config.MP3EncodingPreset = 1001;
return config;
}
return new Configuration()
{
RecordingsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic),
RecordingPrefix = "Recording{n}",
NextRecordingNumber = 1,
AutoIncrementRecordingNumber = true,
OutputFormat = "wav",
ShowTrayIcon = true,
GlobalHotkeys = new Dictionary<HotkeyType, Tuple<Key, ModifierKeys>>(),
RecordingSettingsPanelVisible = true,
RecordingOutputPanelVisible = true,
CheckForUpdates = true
};
}
}
}
|
mit
|
C#
|
86b29e262039823f119e0f350716a2dc971c097d
|
Increase test log queue size
|
Abc-Arbitrage/ZeroLog
|
ZeroLog.Tests/IntegrationTests.cs
|
ZeroLog.Tests/IntegrationTests.cs
|
using System;
using System.Diagnostics;
using System.Threading;
using NUnit.Framework;
using ZeroLog.Appenders;
namespace ZeroLog.Tests
{
[TestFixture]
[Ignore("Manual")]
public class IntegrationTests
{
[SetUp]
public void SetUp()
{
LogManager.Initialize(new[] { new NullAppender(), }, 1 << 23);
Thread.Sleep(1);
}
[TearDown]
public void Teardown()
{
LogManager.Shutdown();
}
[Test]
public void should_test_console()
{
LogManager.GetLogger(typeof(IntegrationTests)).Info().Append("Hello").Log();
}
[Test]
public void should_test_append()
{
var logger = LogManager.GetLogger(typeof(IntegrationTests));
Console.WriteLine("Starting test");
var sw = Stopwatch.StartNew();
const int count = 5000000;
for (var i = 0; i < count; i++)
logger.InfoFormat("{0}", (byte)1, (char)1, (short)2, (float)3, 2.0, "", true, TimeSpan.Zero);
var throughput = count / sw.Elapsed.TotalSeconds;
Console.WriteLine($"Finished test, throughput is: {throughput:N0}");
}
[Test]
public void should_not_allocate()
{
const int count = 1000000;
GC.Collect(2, GCCollectionMode.Forced, true);
var gcCount = GC.CollectionCount(0);
var timer = Stopwatch.StartNew();
var logger = LogManager.GetLogger(typeof(IntegrationTests));
for (int k = 0; k < count; k++)
{
Thread.Sleep(1);
logger.Info().Append("Hello").Log();
}
LogManager.Shutdown();
timer.Stop();
Console.WriteLine("BCL : {0} us/log", timer.ElapsedMilliseconds * 1000.0 / count);
Console.WriteLine("GCs : {0}", GC.CollectionCount(0) - gcCount);
}
}
}
|
using System;
using System.Diagnostics;
using System.Threading;
using NUnit.Framework;
using ZeroLog.Appenders;
namespace ZeroLog.Tests
{
[TestFixture]
[Ignore("Manual")]
public class IntegrationTests
{
[SetUp]
public void SetUp()
{
LogManager.Initialize(new[] { new NullAppender(), }, 1 << 14);
Thread.Sleep(1);
}
[TearDown]
public void Teardown()
{
LogManager.Shutdown();
}
[Test]
public void should_test_console()
{
LogManager.GetLogger(typeof(IntegrationTests)).Info().Append("Hello").Log();
}
[Test]
public void should_test_append()
{
var logger = LogManager.GetLogger(typeof(IntegrationTests));
Console.WriteLine("Starting test");
var sw = Stopwatch.StartNew();
const int count = 5000000;
for (var i = 0; i < count; i++)
logger.InfoFormat("{0}", (byte)1, (char)1, (short)2, (float)3, 2.0, "", true, TimeSpan.Zero);
var throughput = count / sw.Elapsed.TotalSeconds;
Console.WriteLine($"Finished test, throughput is: {throughput:N0}");
}
[Test]
public void should_not_allocate()
{
const int count = 1000000;
GC.Collect(2, GCCollectionMode.Forced, true);
var gcCount = GC.CollectionCount(0);
var timer = Stopwatch.StartNew();
var logger = LogManager.GetLogger(typeof(IntegrationTests));
for (int k = 0; k < count; k++)
{
Thread.Sleep(1);
logger.Info().Append("Hello").Log();
}
LogManager.Shutdown();
timer.Stop();
Console.WriteLine("BCL : {0} us/log", timer.ElapsedMilliseconds * 1000.0 / count);
Console.WriteLine("GCs : {0}", GC.CollectionCount(0) - gcCount);
}
}
}
|
mit
|
C#
|
086f6c6e4153c2511353f4b1bbab3b45b05a552c
|
fix IsApproved logic
|
tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web
|
src/Tugberk.Domain/Post.cs
|
src/Tugberk.Domain/Post.cs
|
using System.Collections.Generic;
using System.Linq;
namespace Tugberk.Domain
{
public class Post
{
public string Id { get; set; }
public string Language { get; set; }
public string Title { get; set; }
public string Abstract { get; set; }
public string Content { get; set; }
public PostFormat Format { get; set; }
public ChangeRecord CreationRecord { get; set; }
public IReadOnlyCollection<ChangeRecord> UpdateRecords { get; set; }
public IReadOnlyCollection<User> Authors { get; set; }
public IReadOnlyCollection<Slug> Slugs { get; set; }
public IReadOnlyCollection<Tag> Tags { get; set; }
public IReadOnlyCollection<CommentStatusActionRecord> CommentStatusActions { get; set; }
public IReadOnlyCollection<ApprovalStatusActionRecord> ApprovaleStatusActions { get; set; }
public Slug DefaultSlug => Slugs.Where(x => x.IsDefault)
.OrderByDescending(x => x.CreatedOn)
.First();
public bool IsApproved
{
get
{
if(ApprovaleStatusActions.Count < 1)
{
return false;
}
return ApprovaleStatusActions
.OrderByDescending(x => x.RecordedOn)
.First().Status == ApprovalStatus.Approved;
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
namespace Tugberk.Domain
{
public class Post
{
public string Id { get; set; }
public string Language { get; set; }
public string Title { get; set; }
public string Abstract { get; set; }
public string Content { get; set; }
public PostFormat Format { get; set; }
public ChangeRecord CreationRecord { get; set; }
public IReadOnlyCollection<ChangeRecord> UpdateRecords { get; set; }
public IReadOnlyCollection<User> Authors { get; set; }
public IReadOnlyCollection<Slug> Slugs { get; set; }
public IReadOnlyCollection<Tag> Tags { get; set; }
public IReadOnlyCollection<CommentStatusActionRecord> CommentStatusActions { get; set; }
public IReadOnlyCollection<ApprovalStatusActionRecord> ApprovaleStatusActions { get; set; }
public Slug DefaultSlug => Slugs.Where(x => x.IsDefault)
.OrderByDescending(x => x.CreatedOn)
.First();
public bool IsApproved => ApprovaleStatusActions
.OrderByDescending(x => x.RecordedOn)
.First().Status == ApprovalStatus.Approved;
}
}
|
agpl-3.0
|
C#
|
660ac913086d761a1551d1d9029c3e68f736e9c1
|
Mark Xpdm.Math as CLS-Compliant
|
neoeinstein/xpdm
|
Xpdm.Math/AssemblyInfo.cs
|
Xpdm.Math/AssemblyInfo.cs
|
//
// AssemblyInfo.cs
//
// Author:
// Marcus Griep <marcus@griep.us>
//
// Copyright (c) 2009 Marcus Griep
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Xpdm.Math")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: CLSCompliant(true)]
|
//
// AssemblyInfo.cs
//
// Author:
// Marcus Griep <marcus@griep.us>
//
// Copyright (c) 2009 Marcus Griep
//
// 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.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Xpdm.Math")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
|
mit
|
C#
|
bc73b7af84c1f134ffff05a80cb7a36ce18ad03b
|
Update assembly and file version
|
pratoservices/extjswebdriver,pratoservices/extjswebdriver,pratoservices/extjswebdriver
|
ExtjsWd/Properties/AssemblyInfo.cs
|
ExtjsWd/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("ExtjsWd")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ExtjsWd")]
[assembly: AssemblyCopyright("Copyright © Microsoft 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("efc31b18-7c2f-44f2-a1f3-4c49b28f409c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]
|
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("ExtjsWd")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ExtjsWd")]
[assembly: AssemblyCopyright("Copyright © Microsoft 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("efc31b18-7c2f-44f2-a1f3-4c49b28f409c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
e8989bc3a2c337c2840bfc6390490aaaf1c9d798
|
update wording
|
ForNeVeR/fornever.me,ForNeVeR/fornever.me,ForNeVeR/fornever.me
|
ForneverMind/views/en/Index.cshtml
|
ForneverMind/views/en/Index.cshtml
|
@model ForneverMind.Models.PostArchiveModel
@{
Layout = "en/_Layout.cshtml";
ViewBag.Title = "int 20h";
}
<p>Hello!</p>
<p>My name is Friedrich von Never.</p>
<p>This is my website where I publish my technical and programming notes.</p>
<h2>Latest posts</h2>
<ul>
@foreach (var post in Model.Posts)
{
<li>
<a href="..@post.Url">@post.Title</a> — @post.Date.ToString("yyyy-MM-dd")
</li>
}
</ul>
<p>You can view a list of all the posts in the <a href="./archive.html">Archive</a>.</p>
|
@model ForneverMind.Models.PostArchiveModel
@{
Layout = "en/_Layout.cshtml";
ViewBag.Title = "int 20h";
}
<p>Hello!</p>
<p>My name is Friedrich von Never.</p>
<p>This is my website where I'm publising my technical and programming notes.</p>
<h2>Latest posts</h2>
<ul>
@foreach (var post in Model.Posts)
{
<li>
<a href="..@post.Url">@post.Title</a> — @post.Date.ToString("yyyy-MM-dd")
</li>
}
</ul>
<p>You can view a list of all the posts in the <a href="./archive.html">Archive</a>.</p>
|
mit
|
C#
|
2d73171f9c4164f277345852745d5966986e743e
|
Fix transfer type
|
ChristopherHaws/gdax-dotnet
|
Gdax/Accounts/GetTransfersQuery.cs
|
Gdax/Accounts/GetTransfersQuery.cs
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Gdax
{
public static class GetTransfersQuery
{
public static async Task<PagedResults<Transfer, DateTimeOffset?>> GetTransfersAsync(this GdaxClient client, Guid accountId, PagingOptions<DateTimeOffset?> paging = null)
{
Check.NotNull(client, nameof(client));
Check.NotEmpty(accountId, nameof(accountId));
var request = new GdaxRequestBuilder($"/accounts/{accountId}/transfers")
.AddPagingOptions(paging, CursorEncoders.DateTimeOffset)
.Build();
var response = await client.GetResponseAsync<IList<Transfer>>(request).ConfigureAwait(false);
return new PagedResults<Transfer, DateTimeOffset?>(response, CursorEncoders.DateTimeOffset, paging);
}
public class Transfer
{
[JsonProperty("id")]
public Guid Id { get; set; }
[JsonProperty("type")]
public TransferType Type { get; set; }
[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
[JsonProperty("completed_at")]
public DateTime? CompletedAt { get; set; }
[JsonProperty("canceled_at")]
public DateTime? CanceledAt { get; set; }
[JsonProperty("processed_at")]
public DateTime? ProcessedAt { get; set; }
[JsonProperty("amount")]
public Decimal Amount { get; set; }
[JsonProperty("details")]
public TransferDetails Details { get; set; }
}
public enum TransferType
{
Withdraw,
Deposit,
}
public class TransferDetails
{
[JsonProperty("coinbase_account_id")]
public Guid CoinbaseAccountId { get; set; }
[JsonProperty("coinbase_transaction_id")]
public String CoinbaseTransactionId { get; set; }
[JsonProperty("crypto_address")]
public String CryptoAddress { get; set; }
[JsonProperty("crypto_transaction_hash")]
public String CryptoTransactionHash { get; set; }
[JsonProperty("crypto_transaction_id")]
public String CryptoTransactionId { get; set; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Gdax
{
public static class GetTransfersQuery
{
public static async Task<PagedResults<Transfer, DateTimeOffset?>> GetTransfersAsync(this GdaxClient client, Guid accountId, PagingOptions<DateTimeOffset?> paging = null)
{
Check.NotNull(client, nameof(client));
Check.NotEmpty(accountId, nameof(accountId));
var request = new GdaxRequestBuilder($"/accounts/{accountId}/transfers")
.AddPagingOptions(paging, CursorEncoders.DateTimeOffset)
.Build();
var response = await client.GetResponseAsync<IList<Transfer>>(request).ConfigureAwait(false);
return new PagedResults<Transfer, DateTimeOffset?>(response, CursorEncoders.DateTimeOffset, paging);
}
public class Transfer
{
[JsonProperty("id")]
public Guid Id { get; set; }
[JsonProperty("type")]
public LedgerEntryType Type { get; set; }
[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
[JsonProperty("completed_at")]
public DateTime? CompletedAt { get; set; }
[JsonProperty("canceled_at")]
public DateTime? CanceledAt { get; set; }
[JsonProperty("processed_at")]
public DateTime? ProcessedAt { get; set; }
[JsonProperty("amount")]
public Decimal Amount { get; set; }
[JsonProperty("details")]
public TransferDetails Details { get; set; }
}
public enum LedgerEntryType
{
Withdraw,
Deposit,
}
public class TransferDetails
{
[JsonProperty("coinbase_account_id")]
public Guid CoinbaseAccountId { get; set; }
[JsonProperty("coinbase_transaction_id")]
public String CoinbaseTransactionId { get; set; }
[JsonProperty("crypto_address")]
public String CryptoAddress { get; set; }
[JsonProperty("crypto_transaction_hash")]
public String CryptoTransactionHash { get; set; }
[JsonProperty("crypto_transaction_id")]
public String CryptoTransactionId { get; set; }
}
}
}
|
mit
|
C#
|
541b2a595afdc1f6ad5785c2aedba661121b94c7
|
Use safe cast for readability
|
alastairs/BobTheBuilder
|
BobTheBuilder/Activation/InstanceCreator.cs
|
BobTheBuilder/Activation/InstanceCreator.cs
|
using System.Linq;
using BobTheBuilder.ArgumentStore.Queries;
using JetBrains.Annotations;
namespace BobTheBuilder.Activation
{
internal class InstanceCreator
{
private readonly IArgumentStoreQuery constructorArgumentsQuery;
public InstanceCreator([NotNull]IArgumentStoreQuery constructorArgumentsQuery)
{
this.constructorArgumentsQuery = constructorArgumentsQuery;
}
public T CreateInstanceOf<T>() where T: class
{
var instanceType = typeof(T);
var constructor = instanceType.GetConstructors().Single();
var constructorArguments = constructorArgumentsQuery.Execute(instanceType);
return constructor.Invoke(constructorArguments.Select(arg => arg.Value).ToArray()) as T;
}
}
}
|
using System.Linq;
using BobTheBuilder.ArgumentStore.Queries;
using JetBrains.Annotations;
namespace BobTheBuilder.Activation
{
internal class InstanceCreator
{
private readonly IArgumentStoreQuery constructorArgumentsQuery;
public InstanceCreator([NotNull]IArgumentStoreQuery constructorArgumentsQuery)
{
this.constructorArgumentsQuery = constructorArgumentsQuery;
}
public T CreateInstanceOf<T>() where T: class
{
var instanceType = typeof(T);
var constructor = instanceType.GetConstructors().Single();
var constructorArguments = constructorArgumentsQuery.Execute(instanceType);
return (T)constructor.Invoke(constructorArguments.Select(arg => arg.Value).ToArray());
}
}
}
|
apache-2.0
|
C#
|
a785324102ef43ec430d32b0851afd97ee24dba6
|
Add "Deprecated" to Tardigrade-Strings
|
mnaiman/duplicati,mnaiman/duplicati,duplicati/duplicati,duplicati/duplicati,duplicati/duplicati,duplicati/duplicati,mnaiman/duplicati,duplicati/duplicati,mnaiman/duplicati,mnaiman/duplicati
|
Duplicati/Library/Backend/Tardigrade/Strings.cs
|
Duplicati/Library/Backend/Tardigrade/Strings.cs
|
using Duplicati.Library.Localization.Short;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Duplicati.Library.Backend.Strings
{
internal static class Tardigrade
{
public static string DisplayName { get { return LC.L(@"Tardigrade Decentralised Cloud Storage (Deprecated)"); } }
public static string Description { get { return LC.L(@"This backend can read and write data to the Tardigrade Decentralized Cloud Storage. It is deprecated - please move over to the new Storj DCS. (Deprecated)"); } }
}
}
|
using Duplicati.Library.Localization.Short;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Duplicati.Library.Backend.Strings
{
internal static class Tardigrade
{
public static string DisplayName { get { return LC.L(@"Tardigrade Decentralised Cloud Storage"); } }
public static string Description { get { return LC.L(@"This backend can read and write data to the Tardigrade Decentralized Cloud Storage. It is deprecated - please move over to the new Storj DCS."); } }
}
}
|
lgpl-2.1
|
C#
|
6a1471aa105e64bd93845d747ea8aa18af7efa48
|
introduce notion of looking up item by slot and Items having name. naive implementation for now.
|
BennieCopeland/NSpec,nspec/NSpec,nspectator/NSpectator,nspectator/NSpectator,mattflo/NSpec,mattflo/NSpec,BennieCopeland/NSpec,mattflo/NSpec,nspec/NSpec,mattflo/NSpec
|
SampleSpecs/Compare/NSpec/VendingMachineSpec.cs
|
SampleSpecs/Compare/NSpec/VendingMachineSpec.cs
|
using System.Collections.Generic;
using System.Linq;
using NSpec;
namespace SampleSpecs.Compare.NSpec
{
class VendingMachineSpec : nspec
{
void given_new_vending_machine()
{
before = () => machine = new VendingMachine();
it["should have no items"] = ()=> machine.Items().should_be_empty();
context["given doritos are registered in A1 for 50 cents"] = () =>
{
before = () => machine.RegisterItem("A1", "doritos", .5m);
specify = () => machine.Items().Count().should_be(1);
specify = () => machine.Item("A1").Name.should_be("doritos");
};
}
private VendingMachine machine;
}
internal class VendingMachine
{
public VendingMachine()
{
items = new Item[] { };
}
public IEnumerable<Item> Items()
{
return items;
}
public void RegisterItem(string slot, string name, decimal price)
{
items = new[]{new Item{Name = name}};
}
public Item Item(string slot)
{
return items.First();
}
private Item[] items;
}
internal class Item
{
public string Name { get; set; }
}
}
|
using System.Collections.Generic;
using System.Linq;
using NSpec;
namespace SampleSpecs.Compare.NSpec
{
class VendingMachineSpec : nspec
{
void given_new_vending_machine()
{
before = () => machine = new VendingMachine();
it["should have no items"] = ()=> machine.Items().should_be_empty();
context["given doritos are registered in A1 for 50 cents"] = () =>
{
before = () => machine.RegisterItem("A1", "doritos", .5m);
specify = () => machine.Items().Count().should_be(1);
};
}
private VendingMachine machine;
}
internal class VendingMachine
{
public VendingMachine()
{
items = new Item[] { };
}
public IEnumerable<Item> Items()
{
return items;
}
public void RegisterItem(string slot, string name, decimal price)
{
items = new[]{new Item()};
}
private Item[] items;
}
internal class Item
{
}
}
|
mit
|
C#
|
db58302feb76e087d4d396aa7c7e7c21c2938b0b
|
Change Copyright page to License page.
|
dsteinweg/TeacherPouch,dsteinweg/TeacherPouch,dsteinweg/TeacherPouch,dsteinweg/TeacherPouch
|
TeacherPouch.Web/Controllers/PagesController.cs
|
TeacherPouch.Web/Controllers/PagesController.cs
|
using System;
using System.Web.Mvc;
using TeacherPouch.Models;
using TeacherPouch.Web.ViewModels;
namespace TeacherPouch.Web.Controllers
{
public partial class PagesController : ControllerBase
{
// GET: /
public virtual ViewResult Home()
{
return View(Views.Home);
}
public virtual ViewResult About()
{
return View(Views.About);
}
// GET: /Contact
public virtual ViewResult Contact()
{
var viewModel = new ContactViewModel();
return View(Views.Contact, viewModel);
}
// POST: /Contact
[HttpPost]
[ValidateAntiForgeryToken]
public virtual ActionResult Contact(ContactSubmission submision)
{
if (submision.IsValid)
{
if (!base.Request.IsLocal)
{
submision.SendEmail();
}
}
else
{
var viewModel = new ContactViewModel();
viewModel.ErrorMessage = "You must fill out the form before submitting.";
return View(Views.Contact, viewModel);
}
return RedirectToAction(Actions.ContactThanks());
}
// GET: /Contact/Thanks
public virtual ViewResult ContactThanks()
{
return View(Views.ContactThanks);
}
// GET: /License
public virtual ViewResult License()
{
return View(Views.License);
}
}
}
|
using System;
using System.Web.Mvc;
using TeacherPouch.Models;
using TeacherPouch.Web.ViewModels;
namespace TeacherPouch.Web.Controllers
{
public partial class PagesController : ControllerBase
{
// GET: /
public virtual ViewResult Home()
{
return View(Views.Home);
}
public virtual ViewResult About()
{
return View(Views.About);
}
// GET: /Contact
public virtual ViewResult Contact()
{
var viewModel = new ContactViewModel();
return View(Views.Contact, viewModel);
}
// POST: /Contact
[HttpPost]
[ValidateAntiForgeryToken]
public virtual ActionResult Contact(ContactSubmission submision)
{
if (submision.IsValid)
{
if (!base.Request.IsLocal)
{
submision.SendEmail();
}
}
else
{
var viewModel = new ContactViewModel();
viewModel.ErrorMessage = "You must fill out the form before submitting.";
return View(Views.Contact, viewModel);
}
return RedirectToAction(Actions.ContactThanks());
}
// GET: /Contact/Thanks
public virtual ViewResult ContactThanks()
{
return View(Views.ContactThanks);
}
// GET: /Copyright
public virtual ViewResult Copyright()
{
return View(Views.Copyright);
}
}
}
|
mit
|
C#
|
d05678cd75c09652115becafdd37d61c229dbc9d
|
Update CaesarCipher.cs
|
natalya-k/algorithms
|
encryption/CaesarCipher.cs
|
encryption/CaesarCipher.cs
|
using System;
using System.Text;
namespace Algorithms
{
static class CaesarCipher
{
private const int LettersNumber = 26;
private const int Shift = 3;
private const string PlainText = "The quick brown fox jumps over the lazy dog.";
public static void Test()
{
Console.WriteLine("Plain: {0}", PlainText);
string encrypted = Encrypt(PlainText, Shift);
Console.WriteLine("Encrypted: {0}", encrypted);
string decrypted = Decrypt(encrypted, Shift);
Console.WriteLine("Decrypted: {0}", decrypted);
}
private static string Encrypt(string input, int shift)
{
StringBuilder resultSB = new StringBuilder();
foreach (char ch in input)
{
if (char.IsLetter(ch))
{
//отступ к началу буквенных символов
char offset = char.IsUpper(ch) ? 'A' : 'a';
char shifted = (char)((ch - offset + shift) % LettersNumber + offset);
resultSB.Append(shifted);
}
else
{
resultSB.Append(ch);
}
}
return resultSB.ToString();
}
private static string Decrypt(string input, int shift)
{
return Encrypt(input, LettersNumber - shift);
}
}
}
|
using System;
using System.Text;
namespace Algorithms
{
static class CaesarCipher
{
private const int LettersNumber = 26;
private const int Shift = 3;
private const string PlainText = "The quick brown fox jumps over the lazy dog.";
public static void Test()
{
Console.WriteLine("Plain: {0}", PlainText);
string encrypted = Encrypt(PlainText, Shift);
Console.WriteLine("Encrypted: {0}", encrypted);
string decrypted = Decrypt(encrypted, Shift);
Console.WriteLine("Decrypted: {0}", decrypted);
}
private static string Encrypt(string input, int shift)
{
StringBuilder resultSB = new StringBuilder();
foreach (char ch in input)
{
if (char.IsLetter(ch))
{
char offset = char.IsUpper(ch) ? 'A' : 'a';
char shifted = (char)((ch + shift - offset) % LettersNumber + offset);
resultSB.Append(shifted);
}
else
{
resultSB.Append(ch);
}
}
return resultSB.ToString();
}
private static string Decrypt(string input, int shift)
{
return Encrypt(input, LettersNumber - shift);
}
}
}
|
mit
|
C#
|
3e375bebcc8e3c00b6032a00eeba79bb1c916199
|
Use the return type of the aggregate
|
TheEadie/PlayerRank,TheEadie/PlayerRank
|
src/PlayerRank/League.cs
|
src/PlayerRank/League.cs
|
using System.Collections.Generic;
using System.Linq;
using PlayerRank.Scoring;
namespace PlayerRank
{
/// <summary>
/// A league made up of multiple <see cref="Game"/>s over time.
/// </summary>
public class League
{
private readonly List<Game> _games = new List<Game>();
private readonly List<string> _players = new List<string>();
/// <summary>
/// Gets the current leader board for this league based on a specifed scoring strategy
/// </summary>
public IEnumerable<PlayerScore> GetLeaderBoard(IScoringStrategy scoringStrategy)
{
scoringStrategy.Reset();
IList<PlayerScore> leaderBoard = new List<PlayerScore>();
leaderBoard = _games.Aggregate(leaderBoard, scoringStrategy.UpdateScores);
scoringStrategy.SetPositions(leaderBoard);
return leaderBoard;
}
public IEnumerable<History> GetLeaderBoardHistory(IScoringStrategy scoringStrategy)
{
scoringStrategy.Reset();
var initialGame = new Game();
foreach (var player in _players)
{
initialGame.AddResult(player, new Points(0));
}
var games = new List<Game> {initialGame};
games.AddRange(_games);
var history = new List<History>();
IList<PlayerScore> leaderBoard = new List<PlayerScore>();
foreach (var game in games)
{
scoringStrategy.UpdateScores(leaderBoard, game);
scoringStrategy.SetPositions(leaderBoard);
history.Add(new History(game, leaderBoard.Select(item => item.Clone()).ToList()));
}
return history;
}
/// <summary>
/// Records a game in this league
/// </summary>
public void RecordGame(Game game)
{
_games.Add(game);
foreach (var player in game.GetResults().Select(x => x.Name))
{
if (!_players.Contains(player))
{
_players.Add(player);
}
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using PlayerRank.Scoring;
namespace PlayerRank
{
/// <summary>
/// A league made up of multiple <see cref="Game"/>s over time.
/// </summary>
public class League
{
private readonly List<Game> _games = new List<Game>();
private readonly List<string> _players = new List<string>();
/// <summary>
/// Gets the current leader board for this league based on a specifed scoring strategy
/// </summary>
public IEnumerable<PlayerScore> GetLeaderBoard(IScoringStrategy scoringStrategy)
{
scoringStrategy.Reset();
IList<PlayerScore> leaderBoard = new List<PlayerScore>();
_games.Aggregate(leaderBoard, scoringStrategy.UpdateScores);
scoringStrategy.SetPositions(leaderBoard);
return leaderBoard;
}
public IEnumerable<History> GetLeaderBoardHistory(IScoringStrategy scoringStrategy)
{
scoringStrategy.Reset();
var initialGame = new Game();
foreach (var player in _players)
{
initialGame.AddResult(player, new Points(0));
}
var games = new List<Game> {initialGame};
games.AddRange(_games);
var history = new List<History>();
IList<PlayerScore> leaderBoard = new List<PlayerScore>();
foreach (var game in games)
{
scoringStrategy.UpdateScores(leaderBoard, game);
scoringStrategy.SetPositions(leaderBoard);
history.Add(new History(game, leaderBoard.Select(item => item.Clone()).ToList()));
}
return history;
}
/// <summary>
/// Records a game in this league
/// </summary>
public void RecordGame(Game game)
{
_games.Add(game);
foreach (var player in game.GetResults().Select(x => x.Name))
{
if (!_players.Contains(player))
{
_players.Add(player);
}
}
}
}
}
|
mit
|
C#
|
f4ad20c62ad3b89bfd73641af0d56442e1923848
|
fix attributes and add sizeof test for structure size
|
splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net
|
IPTables.Net.Tests/ConntrackLibraryTests.cs
|
IPTables.Net.Tests/ConntrackLibraryTests.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using IPTables.Net.Conntrack;
using IPTables.Net.Iptables.NativeLibrary;
using NUnit.Framework;
namespace IPTables.Net.Tests
{
[TestFixture]
class ConntrackLibraryTests
{
public static bool IsLinux
{
get
{
int p = (int)Environment.OSVersion.Platform;
return (p == 4) || (p == 6) || (p == 128);
}
}
[TestCase]
public void TestStructureSize()
{
Assert.AreEqual(16, Marshal.SizeOf(typeof(ConntrackQueryFilter)));
}
[TestCase]
public void TestDump()
{
if (IsLinux)
{
ConntrackSystem cts = new ConntrackSystem();
List<byte[]> list = new List<byte[]>();
cts.Dump(false,list.Add);
}
}
[TestCase]
public void TestDumpFiltered()
{
if (IsLinux)
{
ConntrackSystem cts = new ConntrackSystem();
ConntrackQueryFilter[] qf = new ConntrackQueryFilter[]
{
new ConntrackQueryFilter{Key = cts.GetConstant("CTA_TUPLE_ORIG"), Max = cts.GetConstant("CTA_TUPLE_MAX"), CompareLength = 0},
new ConntrackQueryFilter{Key = cts.GetConstant("CTA_TUPLE_IP"), Max = cts.GetConstant("CTA_IP_MAX"), CompareLength = 0},
new ConntrackQueryFilter{Key = cts.GetConstant("CTA_IP_V4_DST"), Max = 0, CompareLength = 4},
};
List<byte[]> list = new List<byte[]>();
cts.Dump(false, list.Add);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using IPTables.Net.Conntrack;
using IPTables.Net.Iptables.NativeLibrary;
using NUnit.Framework;
namespace IPTables.Net.Tests
{
[TestFixture]
class ConntrackLibraryTests
{
public static bool IsLinux
{
get
{
int p = (int)Environment.OSVersion.Platform;
return (p == 4) || (p == 6) || (p == 128);
}
}
[TestFixtureSetUp]
public void TestDump()
{
if (IsLinux)
{
ConntrackSystem cts = new ConntrackSystem();
List<byte[]> list = new List<byte[]>();
cts.Dump(false,list.Add);
}
}
[TestFixtureSetUp]
public void TestDumpFiltered()
{
if (IsLinux)
{
ConntrackSystem cts = new ConntrackSystem();
ConntrackQueryFilter[] qf = new ConntrackQueryFilter[]
{
new ConntrackQueryFilter{Key = cts.GetConstant("CTA_TUPLE_ORIG"), Max = cts.GetConstant("CTA_TUPLE_MAX"), CompareLength = 0},
new ConntrackQueryFilter{Key = cts.GetConstant("CTA_TUPLE_IP"), Max = cts.GetConstant("CTA_IP_MAX"), CompareLength = 0},
new ConntrackQueryFilter{Key = cts.GetConstant("CTA_IP_V4_DST"), Max = 0, CompareLength = 4},
};
List<byte[]> list = new List<byte[]>();
cts.Dump(false, list.Add);
}
}
}
}
|
apache-2.0
|
C#
|
5d0edd323ef1e263b42eb6ea942d7ee4802d07d8
|
Remove IScriptExtent.Translate method from extensions
|
daviwil/PSScriptAnalyzer,dlwyatt/PSScriptAnalyzer,PowerShell/PSScriptAnalyzer
|
Engine/Extensions.cs
|
Engine/Extensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation.Language;
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions
{
// TODO Add documentation
public static class Extensions
{
public static IEnumerable<string> GetLines(this string text)
{
return text.Split('\n').Select(line => line.TrimEnd('\r'));
}
/// <summary>
/// Converts IScriptExtent to Range
/// </summary>
public static Range ToRange(this IScriptExtent extent)
{
return new Range(
extent.StartLineNumber,
extent.StartColumnNumber,
extent.EndLineNumber,
extent.EndColumnNumber);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation.Language;
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions
{
// TODO Add documentation
public static class Extensions
{
public static IEnumerable<string> GetLines(this string text)
{
return text.Split('\n').Select(line => line.TrimEnd('\r'));
}
public static IScriptExtent Translate(this IScriptExtent extent, int lineDelta, int columnDelta)
{
var newStartLineNumber = extent.StartLineNumber + lineDelta;
if (newStartLineNumber < 1)
{
throw new ArgumentException(
"Invalid line delta. Resulting start line number must be greather than 1.");
}
var newStartColumnNumber = extent.StartColumnNumber + columnDelta;
var newEndColumnNumber = extent.EndColumnNumber + columnDelta;
if (newStartColumnNumber < 1 || newEndColumnNumber < 1)
{
throw new ArgumentException(@"Invalid column delta.
Resulting start column and end column number must be greather than 1.");
}
return new ScriptExtent(
new ScriptPosition(
extent.File,
newStartLineNumber,
newStartColumnNumber,
extent.StartScriptPosition.Line),
new ScriptPosition(
extent.File,
extent.EndLineNumber + lineDelta,
newEndColumnNumber,
extent.EndScriptPosition.Line));
}
/// <summary>
/// Converts IScriptExtent to Range
/// </summary>
public static Range ToRange(this IScriptExtent extent)
{
return new Range(
extent.StartLineNumber,
extent.StartColumnNumber,
extent.EndLineNumber,
extent.EndColumnNumber);
}
}
}
|
mit
|
C#
|
dd615f1e07bef597d99e4da5aadeefe8ff539eb8
|
Make sure FileInfo's are disposed.
|
rubenv/tripod,rubenv/tripod
|
src/Core/Tripod.Core/Tripod.Base/RecursiveDirectoryEnumerator.cs
|
src/Core/Tripod.Core/Tripod.Base/RecursiveDirectoryEnumerator.cs
|
//
// RecursiveDirectoryEnumerator.cs
//
// Author:
// Ruben Vermeersch <ruben@savanne.be>
//
// Copyright (c) 2010 Ruben Vermeersch <ruben@savanne.be>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Collections;
using System.Collections.Generic;
using GLib;
namespace Tripod.Base
{
public class RecursiveFileEnumerator : IEnumerable<File>
{
Uri root;
public RecursiveFileEnumerator (Uri root)
{
this.root = root;
}
IEnumerable<File> ScanForFiles (File root)
{
var enumerator = root.EnumerateChildren ("standard::name,standard::type", FileQueryInfoFlags.None, null);
foreach (FileInfo info in enumerator) {
File file = root.GetChild (info.Name);
if (info.FileType == FileType.Regular) {
yield return file;
} else if (info.FileType == FileType.Directory) {
foreach (var child in ScanForFiles (file)) {
yield return child;
}
}
info.Dispose ();
}
enumerator.Close (null);
}
public IEnumerator<File> GetEnumerator ()
{
var file = FileFactory.NewForUri (root);
return ScanForFiles (file).GetEnumerator ();
}
IEnumerator IEnumerable.GetEnumerator ()
{
return GetEnumerator ();
}
}
}
|
//
// RecursiveDirectoryEnumerator.cs
//
// Author:
// Ruben Vermeersch <ruben@savanne.be>
//
// Copyright (c) 2010 Ruben Vermeersch <ruben@savanne.be>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Collections;
using System.Collections.Generic;
using GLib;
namespace Tripod.Base
{
public class RecursiveFileEnumerator : IEnumerable<File>
{
Uri root;
public RecursiveFileEnumerator (Uri root)
{
this.root = root;
}
IEnumerable<File> ScanForFiles (File root)
{
var enumerator = root.EnumerateChildren ("standard::name,standard::type", FileQueryInfoFlags.None, null);
foreach (FileInfo info in enumerator) {
File file = root.GetChild (info.Name);
if (info.FileType == FileType.Regular) {
yield return file;
} else if (info.FileType == FileType.Directory) {
foreach (var child in ScanForFiles (file)) {
yield return child;
}
}
}
enumerator.Close (null);
}
public IEnumerator<File> GetEnumerator ()
{
var file = FileFactory.NewForUri (root);
return ScanForFiles (file).GetEnumerator ();
}
IEnumerator IEnumerable.GetEnumerator ()
{
return GetEnumerator ();
}
}
}
|
mit
|
C#
|
74ae4c8de73b498d6c7aa434c848dc69355dad58
|
Revert "Try to use SampleData instead of real data in the meantime"
|
github/VisualStudio,github/VisualStudio,github/VisualStudio
|
src/GitHub.VisualStudio/UI/Views/PullRequestCreationView.xaml.cs
|
src/GitHub.VisualStudio/UI/Views/PullRequestCreationView.xaml.cs
|
using GitHub.Exports;
using GitHub.UI;
using GitHub.ViewModels;
using System.ComponentModel.Composition;
using System.Windows.Controls;
using ReactiveUI;
namespace GitHub.VisualStudio.UI.Views
{
public class GenericPullRequestCreationView : SimpleViewUserControl<IPullRequestCreationViewModel, GenericPullRequestCreationView>
{ }
[ExportView(ViewType = UIViewType.PRCreation)]
[PartCreationPolicy(CreationPolicy.NonShared)]
public partial class PullRequestCreationView : GenericPullRequestCreationView
{
public PullRequestCreationView()
{
InitializeComponent();
DataContextChanged += (s, e) => ViewModel = e.NewValue as IPullRequestCreationViewModel;
this.WhenActivated(d =>
{
});
}
}
}
|
using GitHub.Exports;
using GitHub.UI;
using GitHub.ViewModels;
using System.ComponentModel.Composition;
using System.Windows.Controls;
using ReactiveUI;
namespace GitHub.VisualStudio.UI.Views
{
public class GenericPullRequestCreationView : SimpleViewUserControl<IPullRequestCreationViewModel, GenericPullRequestCreationView>
{ }
[ExportView(ViewType = UIViewType.PRCreation)]
[PartCreationPolicy(CreationPolicy.NonShared)]
public partial class PullRequestCreationView : GenericPullRequestCreationView
{
public PullRequestCreationView()
{
InitializeComponent();
// DataContextChanged += (s, e) => ViewModel = e.NewValue as IPullRequestCreationViewModel;
DataContextChanged += (s, e) => ViewModel = new GitHub.SampleData.PullRequestCreationViewModelDesigner() as IPullRequestCreationViewModel;
this.WhenActivated(d =>
{
});
}
}
}
|
mit
|
C#
|
1d925e1e796d60e252c40bfdbaaa11b67bc4f0fc
|
Add checks to test
|
nikeee/HolzShots
|
src/HolzShots.Core.Tests/Net/Custom/CustomUploaderLoaderTests.cs
|
src/HolzShots.Core.Tests/Net/Custom/CustomUploaderLoaderTests.cs
|
using HolzShots.Net.Custom;
using Xunit;
namespace HolzShots.Core.Tests.Net.Custom
{
public class CustomUploaderLoaderTests
{
[Theory]
[FileStringContentData("Files/DirectUpload.net.hsjson")]
[FileStringContentData("Files/FotosHochladen.hsjson")]
public void ValidateTest(string content)
{
var parseResult = CustomUploaderLoader.TryLoad(content, out var result);
Assert.True(parseResult);
Assert.NotNull(result);
Assert.NotNull(result.Info);
Assert.NotNull(result.Uploader);
Assert.NotNull(result.SchemaVersion);
}
}
}
|
using HolzShots.Net.Custom;
using Xunit;
namespace HolzShots.Core.Tests.Net.Custom
{
public class CustomUploaderLoaderTests
{
[Theory]
[FileStringContentData("Files/DirectUpload.net.hsjson")]
[FileStringContentData("Files/FotosHochladen.hsjson")]
public void ValidateTest(string content)
{
var parseResult = CustomUploaderLoader.TryLoad(content, out var result);
Assert.True(parseResult);
Assert.NotNull(result);
}
}
}
|
agpl-3.0
|
C#
|
8b0a1cf37aaa7e269cecfbdbd333e2dbe36806e2
|
test port changed
|
Softlr/selenium-webdriver-extensions,Softlr/Selenium.WebDriver.Extensions,RaYell/selenium-webdriver-extensions,Softlr/selenium-webdriver-extensions
|
test/Selenium.WebDriver.Extensions.IntegrationTests/TestsBase.cs
|
test/Selenium.WebDriver.Extensions.IntegrationTests/TestsBase.cs
|
namespace Selenium.WebDriver.Extensions.IntegrationTests
{
using System;
using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;
using Nancy.Hosting.Self;
using OpenQA.Selenium;
using PostSharp.Patterns.Model;
[Disposable]
[PublicAPI]
[ExcludeFromCodeCoverage]
public abstract class TestsBase
{
protected TestsBase(IWebDriver browser, string path)
{
var config = new HostConfiguration { UrlReservations = { CreateAutomatically = true } };
const string serverUrl = "http://localhost:54321";
Host = new NancyHost(config, new Uri(serverUrl));
Host.Start();
Browser = browser;
Browser.Navigate().GoToUrl(new Uri($"{serverUrl}{path}"));
}
[Child]
protected NancyHost Host { get; }
[Reference]
protected IWebDriver Browser { get; }
}
}
|
namespace Selenium.WebDriver.Extensions.IntegrationTests
{
using System;
using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;
using Nancy.Hosting.Self;
using OpenQA.Selenium;
using PostSharp.Patterns.Model;
[Disposable]
[PublicAPI]
[ExcludeFromCodeCoverage]
public abstract class TestsBase
{
protected TestsBase(IWebDriver browser, string path)
{
var config = new HostConfiguration { UrlReservations = { CreateAutomatically = true } };
const string serverUrl = "http://localhost:50502";
Host = new NancyHost(config, new Uri(serverUrl));
Host.Start();
Browser = browser;
Browser.Navigate().GoToUrl(new Uri($"{serverUrl}{path}"));
}
[Child]
protected NancyHost Host { get; }
[Reference]
protected IWebDriver Browser { get; }
}
}
|
apache-2.0
|
C#
|
e059c489e4350097788aa8a968cc7595838bfac7
|
Improve Unit Tests #6 - fixed boolean tests
|
synergy-software/synergy.contracts,synergy-software/synergy.contracts
|
Synergy.Contracts.Test/Failures/FailBooleanTest.cs
|
Synergy.Contracts.Test/Failures/FailBooleanTest.cs
|
using NUnit.Framework;
namespace Synergy.Contracts.Test.Failures
{
[TestFixture]
public class FailBooleanTest
{
[Test]
public void IfFalse()
{
// ARRANGE
bool someFalseValue = false;
// ACT
var exception = Assert.Throws<DesignByContractViolationException>(
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
() => Fail.IfFalse(someFalseValue, "this should be true")
);
// ASSERT
Assert.That(exception.Message, Is.EqualTo("this should be true"));
}
[Test]
public void IfFalseSuccess()
{
// ARRANGE
var someTrueValue = true;
// ACT
Fail.IfFalse(someTrueValue, "this should be true");
}
[Test]
public void IfTrue()
{
// ARRANGE
var someTrueValue = true;
// ACT
var exception = Assert.Throws<DesignByContractViolationException>(
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
() => Fail.IfTrue(someTrueValue, "this should be false")
);
// ASSERT
Assert.That(exception.Message, Is.EqualTo("this should be false"));
}
[Test]
public void IfTrueSuccess()
{
// ARRANGE
var someFalseValue = false;
// ACT
Fail.IfTrue(someFalseValue, "this should be false");
}
}
}
|
using NUnit.Framework;
namespace Synergy.Contracts.Test.Failures
{
[TestFixture]
public class FailBooleanTest
{
[Test]
public void IfFalse()
{
Assert.Throws<DesignByContractViolationException>(
() => Fail.IfFalse(false, "this should be true - first check")
);
Fail.IfFalse(true, "this should be true - second check");
}
[Test]
public void IfTrue()
{
Assert.Throws<DesignByContractViolationException>(
() => Fail.IfTrue(true, "this should be false - first check")
);
Fail.IfTrue(false, "this should be false - second check");
}
}
}
|
mit
|
C#
|
e2a2be2c0753ab00487a00081b2bdd58e0fd6389
|
Update ArkResponseBase.cs
|
kristjank/ark-net,sharkdev-j/ark-net
|
ark-net/Model/BaseModels/ArkResponseBase.cs
|
ark-net/Model/BaseModels/ArkResponseBase.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ArkResponseBase.cs" company="Ark">
// MIT License
// //
// // Copyright (c) 2017 Kristjan Košič
// //
// // Permission is hereby granted, free of charge, to any person obtaining a copy
// // of this software and associated documentation files (the "Software"), to deal
// // in the Software without restriction, including without limitation the rights
// // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// // copies of the Software, and to permit persons to whom the Software is
// // furnished to do so, subject to the following conditions:
// //
// // The above copyright notice and this permission notice shall be included in all
// // copies or substantial portions of the Software.
// //
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// // SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace ArkNet.Model.BaseModels
{
/// <summary>
/// Represents the Ark Response Base model as an <see cref="ArkResponseBase"/> type.
/// </summary>
///
public class ArkResponseBase
{
/// <summary>
/// Indicates whether or not errors occurred.
/// </summary>
///
/// <value>Gets/sets the value as a <see cref="bool"/>.</value>
///
public bool Success { get; set; }
/// <summary>
/// Operation success message.
/// </summary>
///
/// <value>Gets/sets the value as a <see cref="string"/>.</value>
///
public string Message { get; set; }
/// <summary>
/// Additional information about the error, if occured.
/// </summary>
///
/// <value>Gets/sets the value as a <see cref="string"/>.</value>
///
public string Error { get; set; }
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ArkResponseBase.cs" company="Ark Labs">
// MIT License
// //
// // Copyright (c) 2017 Kristjan Košič
// //
// // Permission is hereby granted, free of charge, to any person obtaining a copy
// // of this software and associated documentation files (the "Software"), to deal
// // in the Software without restriction, including without limitation the rights
// // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// // copies of the Software, and to permit persons to whom the Software is
// // furnished to do so, subject to the following conditions:
// //
// // The above copyright notice and this permission notice shall be included in all
// // copies or substantial portions of the Software.
// //
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// // SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace ArkNet.Model.BaseModels
{
/// <summary>
/// Represents the Ark Response Base model as an <see cref="ArkResponseBase"/> type.
/// </summary>
///
public class ArkResponseBase
{
/// <summary>
/// Indicates whether or not errors occurred.
/// </summary>
///
/// <value>Gets/sets the value as a <see cref="bool"/>.</value>
///
public bool Success { get; set; }
/// <summary>
/// Operation success message.
/// </summary>
///
/// <value>Gets/sets the value as a <see cref="string"/>.</value>
///
public string Message { get; set; }
/// <summary>
/// Additional information about the error, if occured.
/// </summary>
///
/// <value>Gets/sets the value as a <see cref="string"/>.</value>
///
public string Error { get; set; }
}
}
|
mit
|
C#
|
d829ede2241e1dc53d80ddb6be298a0f6e411843
|
Simplify release title with version selector
|
rosolko/WebDriverManager.Net
|
WebDriverManager/DriverConfigs/Impl/OperaConfig.cs
|
WebDriverManager/DriverConfigs/Impl/OperaConfig.cs
|
using System.Linq;
using System.Net;
using AngleSharp;
using AngleSharp.Parser.Html;
namespace WebDriverManager.DriverConfigs.Impl
{
public class OperaConfig : IDriverConfig
{
public virtual string GetName()
{
return "Opera";
}
public virtual string GetUrl32()
{
return "https://github.com/operasoftware/operachromiumdriver/releases/download/v.<version>/operadriver_win32.zip";
}
public virtual string GetUrl64()
{
return "https://github.com/operasoftware/operachromiumdriver/releases/download/v.<version>/operadriver_win64.zip";
}
public virtual string GetBinaryName()
{
return "operadriver.exe";
}
public virtual string GetLatestVersion()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
using (var client = new WebClient())
{
var htmlCode = client.DownloadString("https://github.com/operasoftware/operachromiumdriver/releases");
var parser = new HtmlParser(Configuration.Default.WithDefaultLoader());
var document = parser.Parse(htmlCode);
var version = document.QuerySelectorAll(".release-title > a")
.Select(element => element.TextContent)
.FirstOrDefault();
return version;
}
}
}
}
|
using System.Linq;
using System.Net;
using AngleSharp;
using AngleSharp.Parser.Html;
namespace WebDriverManager.DriverConfigs.Impl
{
public class OperaConfig : IDriverConfig
{
public virtual string GetName()
{
return "Opera";
}
public virtual string GetUrl32()
{
return "https://github.com/operasoftware/operachromiumdriver/releases/download/v.<version>/operadriver_win32.zip";
}
public virtual string GetUrl64()
{
return "https://github.com/operasoftware/operachromiumdriver/releases/download/v.<version>/operadriver_win64.zip";
}
public virtual string GetBinaryName()
{
return "operadriver.exe";
}
public virtual string GetLatestVersion()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
using (var client = new WebClient())
{
var htmlCode = client.DownloadString("https://github.com/operasoftware/operachromiumdriver/releases");
var parser = new HtmlParser(Configuration.Default.WithDefaultLoader());
var document = parser.Parse(htmlCode);
var version = document.QuerySelectorAll("[class~='release-title'] a")
.Select(element => element.TextContent)
.FirstOrDefault();
return version;
}
}
}
}
|
mit
|
C#
|
d42c1dbe98405008d3948a3711d29b973462708a
|
Drop Decimals in PossibleTimeSaveFormatter
|
LiveSplit/LiveSplit
|
LiveSplit/LiveSplit.Core/TimeFormatters/PossibleTimeSaveFormatter.cs
|
LiveSplit/LiveSplit.Core/TimeFormatters/PossibleTimeSaveFormatter.cs
|
using System;
namespace LiveSplit.TimeFormatters
{
public class PossibleTimeSaveFormatter : GeneralTimeFormatter
{
public PossibleTimeSaveFormatter()
{
Accuracy = TimeAccuracy.Seconds;
DropDecimals = false;
NullFormat = NullFormat.Dash;
}
}
}
|
using System;
namespace LiveSplit.TimeFormatters
{
public class PossibleTimeSaveFormatter : GeneralTimeFormatter
{
public PossibleTimeSaveFormatter()
{
Accuracy = TimeAccuracy.Seconds;
NullFormat = NullFormat.Dash;
}
}
}
|
mit
|
C#
|
35ae4e07c8dc9821e14b9fe278f99967a3552569
|
Add get best id method for season ids.
|
henrikfroehling/TraktApiSharp
|
Source/Lib/TraktApiSharp/Objects/Get/Shows/Seasons/TraktSeasonIds.cs
|
Source/Lib/TraktApiSharp/Objects/Get/Shows/Seasons/TraktSeasonIds.cs
|
namespace TraktApiSharp.Objects.Get.Shows.Seasons
{
using Newtonsoft.Json;
/// <summary>A collection of ids for various web services, including the Trakt id, for a Trakt season.</summary>
public class TraktSeasonIds
{
/// <summary>Gets or sets the Trakt numeric id.</summary>
[JsonProperty(PropertyName = "trakt")]
public int Trakt { get; set; }
/// <summary>Gets or sets the numeric id from thetvdb.com</summary>
[JsonProperty(PropertyName = "tvdb")]
public int? Tvdb { get; set; }
/// <summary>Gets or sets the numeric id from themoviedb.org</summary>
[JsonProperty(PropertyName = "tmdb")]
public int? Tmdb { get; set; }
/// <summary>Gets or sets the numeric id from tvrage.com</summary>
[JsonProperty(PropertyName = "tvrage")]
public int? TvRage { get; set; }
/// <summary>Returns, whether any id has been set.</summary>
[JsonIgnore]
public bool HasAnyId => Trakt > 0 || Tvdb > 0 || Tvdb > 0 || TvRage > 0;
/// <summary>Gets the most reliable id from those that have been set.</summary>
/// <returns>The id as a string or an empty string, if no id is set.</returns>
public string GetBestId()
{
if (Trakt > 0)
return Trakt.ToString();
if (Tvdb.HasValue && Tvdb.Value > 0)
return Tvdb.Value.ToString();
if (Tmdb.HasValue && Tmdb.Value > 0)
return Tmdb.Value.ToString();
if (TvRage.HasValue && TvRage.Value > 0)
return TvRage.Value.ToString();
return string.Empty;
}
}
}
|
namespace TraktApiSharp.Objects.Get.Shows.Seasons
{
using Newtonsoft.Json;
/// <summary>A collection of ids for various web services, including the Trakt id, for a Trakt season.</summary>
public class TraktSeasonIds
{
/// <summary>Gets or sets the Trakt numeric id.</summary>
[JsonProperty(PropertyName = "trakt")]
public int Trakt { get; set; }
/// <summary>Gets or sets the numeric id from thetvdb.com</summary>
[JsonProperty(PropertyName = "tvdb")]
public int? Tvdb { get; set; }
/// <summary>Gets or sets the numeric id from themoviedb.org</summary>
[JsonProperty(PropertyName = "tmdb")]
public int? Tmdb { get; set; }
/// <summary>Gets or sets the numeric id from tvrage.com</summary>
[JsonProperty(PropertyName = "tvrage")]
public int? TvRage { get; set; }
/// <summary>Returns, whether any id has been set.</summary>
[JsonIgnore]
public bool HasAnyId => Trakt > 0 || Tvdb > 0 || Tvdb > 0 || TvRage > 0;
}
}
|
mit
|
C#
|
8c26f6b167776d9fc790e55daf2dd02dfbaf839d
|
Make sure the RaygunExceptionFilterAttribute hasn't already been added before we add it to the GlobalFilters list
|
articulate/raygun4net,MindscapeHQ/raygun4net,articulate/raygun4net,nelsonsar/raygun4net,ddunkin/raygun4net,tdiehl/raygun4net,ddunkin/raygun4net,MindscapeHQ/raygun4net,nelsonsar/raygun4net,MindscapeHQ/raygun4net,tdiehl/raygun4net
|
Mindscape.Raygun4Net.Mvc/RaygunExceptionFilterAttacher.cs
|
Mindscape.Raygun4Net.Mvc/RaygunExceptionFilterAttacher.cs
|
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Mindscape.Raygun4Net
{
public static class RaygunExceptionFilterAttacher
{
public static void AttachExceptionFilter(HttpApplication context, RaygunHttpModule module)
{
if (GlobalFilters.Filters.Count == 0) return;
Filter filter = GlobalFilters.Filters.FirstOrDefault(f => f.Instance.GetType().FullName.Equals("System.Web.Mvc.HandleErrorAttribute"));
if (filter != null)
{
if (GlobalFilters.Filters.Any(f => f.Instance.GetType() == typeof(RaygunExceptionFilterAttribute))) return;
GlobalFilters.Filters.Add(new RaygunExceptionFilterAttribute(context, module));
}
}
}
}
|
using System;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Mindscape.Raygun4Net
{
public static class RaygunExceptionFilterAttacher
{
public static void AttachExceptionFilter(HttpApplication context, RaygunHttpModule module)
{
if (GlobalFilters.Filters.Count == 0) return;
Filter filter = GlobalFilters.Filters.FirstOrDefault(f => f.Instance.GetType().FullName.Equals("System.Web.Mvc.HandleErrorAttribute"));
if (filter != null)
{
GlobalFilters.Filters.Add(new RaygunExceptionFilterAttribute(context, module));
}
}
}
}
|
mit
|
C#
|
342ac2a8303d5e1a412bab8ab25e271063515820
|
Fix Version Problem for Scaffolding
|
YOTOV-LIMITED/lab,LaylaLiu/lab,congysu/lab
|
WebAPIODataV4Scaffolding/src/System.Web.OData.Design.Scaffolding/ScaffolderVersions.cs
|
WebAPIODataV4Scaffolding/src/System.Web.OData.Design.Scaffolding/ScaffolderVersions.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
namespace System.Web.OData.Design.Scaffolding
{
internal static class ScaffolderVersions
{
public static readonly Version WebApiODataScaffolderVersion = new Version(0, 1, 0, 0);
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
namespace System.Web.OData.Design.Scaffolding
{
internal static class ScaffolderVersions
{
public static readonly Version WebApiODataScaffolderVersion = new Version(1, 0, 0, 0);
}
}
|
mit
|
C#
|
61cae5463f35d0ab8cf06b7251fdd3fb89420923
|
Test that all accounts decrypt correctly
|
detunized/lastpass-sharp,detunized/lastpass-sharp,rottenorange/lastpass-sharp
|
test/VaultTest.cs
|
test/VaultTest.cs
|
using System.Linq;
using NUnit.Framework;
namespace LastPass.Test
{
[TestFixture]
class VaultTest
{
[Test]
public void Create_returns_vault_with_correct_accounts()
{
var vault = Vault.Create(new Blob(TestData.Blob, 1));
Assert.AreEqual(TestData.Accounts.Length, vault.EncryptedAccounts.Length);
Assert.AreEqual(TestData.Accounts.Select(i => i.Url), vault.EncryptedAccounts.Select(i => i.Url));
}
[Test]
public void DecryptAccount_decrypts_accounts()
{
var vault = Vault.Create(new Blob(TestData.Blob, 1));
for (var i = 0; i < vault.EncryptedAccounts.Length; ++i)
{
var account = vault.DecryptAccount(vault.EncryptedAccounts[i],
"p8utF7ZB8yD06SrtrD4hsdvEOiBU1Y19cr2dhG9DWZg=".Decode64());
var expectedAccount = TestData.Accounts[i];
Assert.AreEqual(expectedAccount.Name, account.Name);
Assert.AreEqual(expectedAccount.Username, account.Username);
Assert.AreEqual(expectedAccount.Password, account.Password);
Assert.AreEqual(expectedAccount.Url, account.Url);
}
}
}
}
|
using System.Linq;
using NUnit.Framework;
namespace LastPass.Test
{
[TestFixture]
class VaultTest
{
[Test]
public void Create_returns_vault_with_correct_accounts()
{
var vault = Vault.Create(new Blob(TestData.Blob, 1));
Assert.AreEqual(TestData.Accounts.Length, vault.EncryptedAccounts.Length);
Assert.AreEqual(TestData.Accounts.Select(i => i.Url), vault.EncryptedAccounts.Select(i => i.Url));
}
[Test]
public void DecryptAccount_decrypts_account()
{
var vault = Vault.Create(new Blob(TestData.Blob, 1));
var account = vault.DecryptAccount(vault.EncryptedAccounts[0], "p8utF7ZB8yD06SrtrD4hsdvEOiBU1Y19cr2dhG9DWZg=".Decode64());
Assert.AreEqual(TestData.Accounts[0].Name, account.Name);
Assert.AreEqual(TestData.Accounts[0].Username, account.Username);
Assert.AreEqual(TestData.Accounts[0].Password, account.Password);
Assert.AreEqual(TestData.Accounts[0].Url, account.Url);
}
}
}
|
mit
|
C#
|
15bdd6bb81102bafd3ba240166e830191438950a
|
Remove "Portable" from namespace name in CoreAssets
|
florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho
|
Bindings/Portable/CoreData.cs
|
Bindings/Portable/CoreData.cs
|
using Urho.Gui;
using Urho.Resources;
namespace Urho
{
//TODO: generate this class using T4 from CoreData folder
public static class CoreAssets
{
public static ResourceCache Cache => Application.Current.ResourceCache;
public static class Models
{
public static Model Box => Cache.GetModel("Models/Box.mdl");
public static Model Cone => Cache.GetModel("Models/Cone.mdl");
public static Model Cylinder => Cache.GetModel("Models/Cylinder.mdl");
public static Model Plane => Cache.GetModel("Models/Plane.mdl");
public static Model Pyramid => Cache.GetModel("Models/Pyramid.mdl");
public static Model Sphere => Cache.GetModel("Models/Sphere.mdl");
public static Model Torus => Cache.GetModel("Models/Torus.mdl");
}
public static class Materials
{
public static Material DefaultGrey => Cache.GetMaterial("Materials/DefaultGrey.xml");
}
public static class Fonts
{
public static Font AnonymousPro => Cache.GetFont("Fonts/Anonymous Pro.ttf");
}
public static class RenderPaths
{
}
public static class Shaders
{
}
public static class Techniques
{
}
}
}
|
using Urho.Gui;
using Urho.Resources;
namespace Urho.Portable
{
//TODO: generate this class using T4 from CoreData folder
public static class CoreAssets
{
public static ResourceCache Cache => Application.Current.ResourceCache;
public static class Models
{
public static Model Box => Cache.GetModel("Models/Box.mdl");
public static Model Cone => Cache.GetModel("Models/Cone.mdl");
public static Model Cylinder => Cache.GetModel("Models/Cylinder.mdl");
public static Model Plane => Cache.GetModel("Models/Plane.mdl");
public static Model Pyramid => Cache.GetModel("Models/Pyramid.mdl");
public static Model Sphere => Cache.GetModel("Models/Sphere.mdl");
public static Model Torus => Cache.GetModel("Models/Torus.mdl");
}
public static class Materials
{
public static Material DefaultGrey => Cache.GetMaterial("Materials/DefaultGrey.xml");
}
public static class Fonts
{
public static Font AnonymousPro => Cache.GetFont("Fonts/Anonymous Pro.ttf");
}
public static class RenderPaths
{
}
public static class Shaders
{
}
public static class Techniques
{
}
}
}
|
mit
|
C#
|
a59a5b6a1c7ffddef7b00ffb49b2f4e0b3438fb6
|
Replace main with top-level statements
|
mycroes/SupportManager,mycroes/SupportManager,mycroes/SupportManager
|
SupportManager.Telegram/Program.cs
|
SupportManager.Telegram/Program.cs
|
using System;
using Microsoft.EntityFrameworkCore;
using SupportManager.Telegram;
using SupportManager.Telegram.Infrastructure;
using Topshelf;
if (args.Length == 2 && args[0].Equals("migrate", StringComparison.InvariantCultureIgnoreCase))
{
var db = DbContextFactory.Create(args[1]);
db.Database.Migrate();
return;
}
HostFactory.Run(cfg =>
{
var config = new Configuration();
cfg.AddCommandLineDefinition("db", v => config.DbFileName = v);
cfg.AddCommandLineDefinition("botkey", v => config.BotKey = v);
cfg.AddCommandLineDefinition("url", v => config.SupportManagerUri = new Uri(v));
cfg.AddCommandLineDefinition("hostUrl", v => config.HostUri = new Uri(v));
cfg.Service<Service>(svc =>
{
svc.ConstructUsing(() => new Service(config));
svc.WhenStarted((s, h) => s.Start(h));
svc.WhenStopped((s, h) => s.Stop(h));
});
cfg.SetServiceName("SupportManager.Telegram");
cfg.SetDisplayName("SupportManager.Telegram");
cfg.SetDescription("SupportManager Telegram bot");
cfg.RunAsNetworkService();
cfg.StartAutomatically();
});
|
using System;
using Microsoft.EntityFrameworkCore;
using SupportManager.Telegram.DAL;
using Topshelf;
namespace SupportManager.Telegram
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 2 && args[0].Equals("migrate", StringComparison.InvariantCultureIgnoreCase))
{
var filename = args[1];
var builder = new DbContextOptionsBuilder<UserDbContext>();
builder.UseSqlite($"Data Source={filename}");
var db = new UserDbContext(builder.Options);
db.Database.Migrate();
return;
}
var config = new Configuration();
var exitCode = HostFactory.Run(cfg =>
{
cfg.AddCommandLineDefinition("db", v => config.DbFileName = v);
cfg.AddCommandLineDefinition("botkey", v => config.BotKey = v);
cfg.AddCommandLineDefinition("url", v => config.SupportManagerUri = new Uri(v));
cfg.AddCommandLineDefinition("hostUrl", v => config.HostUri = new Uri(v));
cfg.Service<Service>(svc =>
{
svc.ConstructUsing(() => new Service(config));
svc.WhenStarted((s, h) => s.Start(h));
svc.WhenStopped((s, h) => s.Stop(h));
});
cfg.SetServiceName("SupportManager.Telegram");
cfg.SetDisplayName("SupportManager.Telegram");
cfg.SetDescription("SupportManager Telegram bot");
cfg.RunAsNetworkService();
cfg.StartAutomatically();
});
}
}
}
|
mit
|
C#
|
8d5ddcb301f5c51be1d6516d7c5d153cd7a91255
|
Remove paramter from bootstrap instance creation
|
brickpile/brickpile,brickpile/brickpile,brickpile/brickpile
|
BrickPile.Core/Initialiser.cs
|
BrickPile.Core/Initialiser.cs
|
using System;
using System.Linq;
using BrickPile.Core;
using BrickPile.Core.Conventions;
using StructureMap;
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(Initialiser), "PreStart")]
namespace BrickPile.Core
{
/// <summary>
///
/// </summary>
internal static class Initialiser
{
private static IBrickPileBootstrapper _brickPileBootstrapper;
private static bool _initialised;
/// <summary>
/// Pres the start.
/// </summary>
/// <exception cref="System.Exception">Unexpected second call to PreStart</exception>
public static void PreStart()
{
if (_initialised)
{
throw new Exception("Unexpected second call to PreStart");
}
_initialised = true;
// Get the first non-abstract implementation of IBrickPileBootstrapper if one exists in the
// app domain. If none exist then just use the default one.
var bootstrapperInterface = typeof(IBrickPileBootstrapper);
var defaultBootstrapper = typeof(DefaultBrickPileBootstrapper);
var locatedBootstrappers =
from asm in AppDomain.CurrentDomain.GetAssemblies() // TODO ignore known assemblies like m$ and such
from type in asm.GetTypes()
where bootstrapperInterface.IsAssignableFrom(type)
where !type.IsInterface
where type != defaultBootstrapper
select type;
var bootStrapperType = locatedBootstrappers.FirstOrDefault() ?? defaultBootstrapper;
_brickPileBootstrapper = (IBrickPileBootstrapper) Activator.CreateInstance(bootStrapperType);
_brickPileBootstrapper.Initialise();
}
}
}
|
using System;
using System.Linq;
using BrickPile.Core;
using BrickPile.Core.Conventions;
using StructureMap;
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(Initialiser), "PreStart")]
namespace BrickPile.Core
{
/// <summary>
///
/// </summary>
internal static class Initialiser
{
private static IBrickPileBootstrapper _brickPileBootstrapper;
private static bool _initialised;
/// <summary>
/// Pres the start.
/// </summary>
/// <exception cref="System.Exception">Unexpected second call to PreStart</exception>
public static void PreStart()
{
if (_initialised)
{
throw new Exception("Unexpected second call to PreStart");
}
_initialised = true;
// Get the first non-abstract implementation of IBrickPileBootstrapper if one exists in the
// app domain. If none exist then just use the default one.
var bootstrapperInterface = typeof(IBrickPileBootstrapper);
var defaultBootstrapper = typeof(DefaultBrickPileBootstrapper);
var locatedBootstrappers =
from asm in AppDomain.CurrentDomain.GetAssemblies() // TODO ignore known assemblies like m$ and such
from type in asm.GetTypes()
where bootstrapperInterface.IsAssignableFrom(type)
where !type.IsInterface
where type != defaultBootstrapper
select type;
var bootStrapperType = locatedBootstrappers.FirstOrDefault() ?? defaultBootstrapper;
_brickPileBootstrapper = (IBrickPileBootstrapper) Activator.CreateInstance(bootStrapperType, ObjectFactory.Container, new BrickPileConventions());
_brickPileBootstrapper.Initialise();
}
}
}
|
mit
|
C#
|
d11b746fdf16ce8db171408657d67d9840a10eec
|
Fix formatting
|
vazgriz/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary,vazgriz/CSharpGameLibrary
|
CSGL.Vulkan/VkShaderModule.cs
|
CSGL.Vulkan/VkShaderModule.cs
|
using System;
using System.Collections.Generic;
using System.IO;
namespace CSGL.Vulkan {
public class VkShaderModuleCreateInfo {
public IList<byte> data;
}
public class VkShaderModule : IDisposable, INative<Unmanaged.VkShaderModule> {
Unmanaged.VkShaderModule shaderModule;
bool disposed = false;
public VkDevice Device { get; private set; }
public Unmanaged.VkShaderModule Native {
get {
return shaderModule;
}
}
public VkShaderModule(VkDevice device, VkShaderModuleCreateInfo info) {
if (device == null) throw new ArgumentNullException(nameof(device));
if (info == null) throw new ArgumentNullException(nameof(info));
Device = device;
CreateShader(info);
}
void CreateShader(VkShaderModuleCreateInfo mInfo) {
if (mInfo.data == null) throw new ArgumentNullException(nameof(mInfo.data));
var info = new Unmanaged.VkShaderModuleCreateInfo();
info.sType = VkStructureType.ShaderModuleCreateInfo;
info.codeSize = (IntPtr)mInfo.data.Count;
var dataPinned = new NativeArray<byte>(mInfo.data);
info.pCode = dataPinned.Address;
using (dataPinned) {
var result = Device.Commands.createShaderModule(Device.Native, ref info, Device.Instance.AllocationCallbacks, out shaderModule);
if (result != VkResult.Success) throw new ShaderModuleException(result, string.Format("Error creating shader module: {0}"));
}
}
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
void Dispose(bool disposing) {
if (disposed) return;
Device.Commands.destroyShaderModule(Device.Native, shaderModule, Device.Instance.AllocationCallbacks);
disposed = true;
}
~VkShaderModule() {
Dispose(false);
}
}
public class ShaderModuleException : VulkanException {
public ShaderModuleException(VkResult result, string message) : base(result, message) { }
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
namespace CSGL.Vulkan {
public class VkShaderModuleCreateInfo {
public IList<byte> data;
}
public class VkShaderModule : IDisposable, INative<Unmanaged.VkShaderModule> {
Unmanaged.VkShaderModule shaderModule;
bool disposed = false;
public VkDevice Device { get; private set; }
public Unmanaged.VkShaderModule Native {
get {
return shaderModule;
}
}
public VkShaderModule(VkDevice device, VkShaderModuleCreateInfo info) {
if (device == null) throw new ArgumentNullException(nameof(device));
if (info == null) throw new ArgumentNullException(nameof(info));
this.Device = device;
CreateShader(info);
}
void CreateShader(VkShaderModuleCreateInfo mInfo) {
if (mInfo.data == null) throw new ArgumentNullException(nameof(mInfo.data));
var info = new Unmanaged.VkShaderModuleCreateInfo();
info.sType = VkStructureType.ShaderModuleCreateInfo;
info.codeSize = (IntPtr)mInfo.data.Count;
var dataPinned = new NativeArray<byte>(mInfo.data);
info.pCode = dataPinned.Address;
using (dataPinned) {
var result = Device.Commands.createShaderModule(Device.Native, ref info, Device.Instance.AllocationCallbacks, out shaderModule);
if (result != VkResult.Success) throw new ShaderModuleException(result, string.Format("Error creating shader module: {0}"));
}
}
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
void Dispose(bool disposing) {
if (disposed) return;
Device.Commands.destroyShaderModule(Device.Native, shaderModule, Device.Instance.AllocationCallbacks);
disposed = true;
}
~VkShaderModule() {
Dispose(false);
}
}
public class ShaderModuleException : VulkanException {
public ShaderModuleException(VkResult result, string message) : base(result, message) { }
}
}
|
mit
|
C#
|
9456f1f5cf946511e4529f773d45bab680328a18
|
remove exception handler
|
StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis
|
service/FunctionApp/Defaults.cs
|
service/FunctionApp/Defaults.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http.ExceptionHandling;
using Common;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace FunctionApp
{
public static class Defaults
{
private static string InMemoryLoggerKey { get; } = Guid.NewGuid().ToString("N");
private static string TraceWriterKey { get; } = Guid.NewGuid().ToString("N");
private static string ExecutionContextKey { get; } = Guid.NewGuid().ToString("N");
public static void ApplyRequestHandlingDefaults(this HttpRequestMessage request, TraceWriter traceWriter, ExecutionContext context)
{
// Use our own JSON serializer settings everywhere.
var config = request.GetConfiguration();
GlobalConfig.EnsureJsonSerializerSettings();
foreach (var formatter in config.Formatters.OfType<JsonMediaTypeFormatter>())
formatter.SerializerSettings = Constants.JsonSerializerSettings;
// Propagate error details in responses generated from exceptions.
request.Properties.Add(InMemoryLoggerKey, AmbientContext.Loggers.OfType<InMemoryLogger>().First());
request.Properties.Add(TraceWriterKey, traceWriter);
request.Properties.Add(ExecutionContextKey, context);
}
public static InMemoryLogger TryGetInMemoryLogger(this HttpRequestMessage request) =>
request.Properties.TryGetValue(InMemoryLoggerKey, out object value) ? value as InMemoryLogger : null;
public static TraceWriter TryGetTraceWriter(this HttpRequestMessage request) =>
request.Properties.TryGetValue(TraceWriterKey, out object value) ? value as TraceWriter : null;
public static ExecutionContext TryGetExecutionContext(this HttpRequestMessage request) =>
request.Properties.TryGetValue(ExecutionContextKey, out object value) ? value as ExecutionContext : null;
// Key is hardcoded just to avoid dependency on the whole Microsoft.Azure.WebJobs.Script package and all its dependencies.
public static string TryGetRequestId(this HttpRequestMessage request) =>
request.Properties.TryGetValue("MS_AzureFunctionsRequestID", out object value) ? value as string : null;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http.ExceptionHandling;
using Common;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace FunctionApp
{
public static class Defaults
{
private static string InMemoryLoggerKey { get; } = Guid.NewGuid().ToString("N");
private static string TraceWriterKey { get; } = Guid.NewGuid().ToString("N");
private static string ExecutionContextKey { get; } = Guid.NewGuid().ToString("N");
public static void ApplyRequestHandlingDefaults(this HttpRequestMessage request, TraceWriter traceWriter, ExecutionContext context)
{
// Use our own JSON serializer settings everywhere.
var config = request.GetConfiguration();
GlobalConfig.EnsureJsonSerializerSettings();
foreach (var formatter in config.Formatters.OfType<JsonMediaTypeFormatter>())
formatter.SerializerSettings = Constants.JsonSerializerSettings;
// Always include full error details.
request.GetRequestContext().IncludeErrorDetail = true;
request.GetRequestContext().IsLocal = true;
// Propagate error details in responses generated from exceptions.
config.Services.Replace(typeof(IExceptionHandler), new DetailedExceptionHandler());
request.Properties.Add(InMemoryLoggerKey, AmbientContext.Loggers.OfType<InMemoryLogger>().First());
request.Properties.Add(TraceWriterKey, traceWriter);
request.Properties.Add(ExecutionContextKey, context);
}
public static InMemoryLogger TryGetInMemoryLogger(this HttpRequestMessage request) =>
request.Properties.TryGetValue(InMemoryLoggerKey, out object value) ? value as InMemoryLogger : null;
public static TraceWriter TryGetTraceWriter(this HttpRequestMessage request) =>
request.Properties.TryGetValue(TraceWriterKey, out object value) ? value as TraceWriter : null;
public static ExecutionContext TryGetExecutionContext(this HttpRequestMessage request) =>
request.Properties.TryGetValue(ExecutionContextKey, out object value) ? value as ExecutionContext : null;
// Key is hardcoded just to avoid dependency on the whole Microsoft.Azure.WebJobs.Script package and all its dependencies.
public static string TryGetRequestId(this HttpRequestMessage request) =>
request.Properties.TryGetValue("MS_AzureFunctionsRequestID", out object value) ? value as string : null;
}
}
|
mit
|
C#
|
7cbb7215e0d905011bce6f8a6d4818258eee8049
|
Remove Id from storable object
|
TheEadie/LazyStorage,TheEadie/LazyStorage,TheEadie/LazyLibrary
|
LazyStorage/StorableObject.cs
|
LazyStorage/StorableObject.cs
|
using System;
using System.Collections.Generic;
namespace LazyStorage
{
public class StorableObject
{
public Dictionary<string, string> Info { get; }
public StorableObject()
{
Info = new Dictionary<string, string>();
}
}
}
|
using System;
using System.Collections.Generic;
namespace LazyStorage
{
public class StorableObject : IEquatable<StorableObject>
{
public int LazyStorageInternalId { get; set; }
public Dictionary<string, string> Info { get; }
public StorableObject()
{
Info = new Dictionary<string, string>();
}
public bool Equals(StorableObject other)
{
return (other.LazyStorageInternalId == LazyStorageInternalId);
}
}
}
|
mit
|
C#
|
d24f4cf2ac470f57e165f9c2568b639a3987671d
|
Fix identation
|
cryogen/orchard,Cphusion/Orchard,IDeliverable/Orchard,arminkarimi/Orchard,phillipsj/Orchard,armanforghani/Orchard,dcinzona/Orchard,NIKASoftwareDevs/Orchard,Codinlab/Orchard,fortunearterial/Orchard,Morgma/valleyviewknolls,hannan-azam/Orchard,m2cms/Orchard,MetSystem/Orchard,patricmutwiri/Orchard,mgrowan/Orchard,xiaobudian/Orchard,Anton-Am/Orchard,dozoft/Orchard,xkproject/Orchard,emretiryaki/Orchard,MetSystem/Orchard,SzymonSel/Orchard,SouleDesigns/SouleDesigns.Orchard,rtpHarry/Orchard,abhishekluv/Orchard,spraiin/Orchard,MpDzik/Orchard,IDeliverable/Orchard,dcinzona/Orchard-Harvest-Website,OrchardCMS/Orchard-Harvest-Website,grapto/Orchard.CloudBust,SeyDutch/Airbrush,yonglehou/Orchard,Inner89/Orchard,planetClaire/Orchard-LETS,jimasp/Orchard,DonnotRain/Orchard,JRKelso/Orchard,dburriss/Orchard,yonglehou/Orchard,Morgma/valleyviewknolls,AEdmunds/beautiful-springtime,qt1/orchard4ibn,salarvand/orchard,fortunearterial/Orchard,MetSystem/Orchard,jchenga/Orchard,qt1/Orchard,caoxk/orchard,dmitry-urenev/extended-orchard-cms-v10.1,LaserSrl/Orchard,sfmskywalker/Orchard,MpDzik/Orchard,Anton-Am/Orchard,kouweizhong/Orchard,stormleoxia/Orchard,gcsuk/Orchard,Inner89/Orchard,xiaobudian/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Anton-Am/Orchard,RoyalVeterinaryCollege/Orchard,SouleDesigns/SouleDesigns.Orchard,salarvand/Portal,bigfont/orchard-cms-modules-and-themes,bedegaming-aleksej/Orchard,abhishekluv/Orchard,patricmutwiri/Orchard,angelapper/Orchard,angelapper/Orchard,NIKASoftwareDevs/Orchard,m2cms/Orchard,Cphusion/Orchard,jimasp/Orchard,gcsuk/Orchard,cryogen/orchard,hbulzy/Orchard,AndreVolksdorf/Orchard,jtkech/Orchard,vairam-svs/Orchard,jimasp/Orchard,SzymonSel/Orchard,bigfont/orchard-cms-modules-and-themes,geertdoornbos/Orchard,smartnet-developers/Orchard,Morgma/valleyviewknolls,escofieldnaxos/Orchard,abhishekluv/Orchard,ericschultz/outercurve-orchard,escofieldnaxos/Orchard,Ermesx/Orchard,li0803/Orchard,Fogolan/OrchardForWork,patricmutwiri/Orchard,mvarblow/Orchard,sfmskywalker/Orchard,oxwanawxo/Orchard,TalaveraTechnologySolutions/Orchard,jersiovic/Orchard,Dolphinsimon/Orchard,Codinlab/Orchard,kgacova/Orchard,OrchardCMS/Orchard,gcsuk/Orchard,tobydodds/folklife,Cphusion/Orchard,qt1/Orchard,harmony7/Orchard,openbizgit/Orchard,fassetar/Orchard,qt1/Orchard,Praggie/Orchard,jchenga/Orchard,grapto/Orchard.CloudBust,LaserSrl/Orchard,jtkech/Orchard,phillipsj/Orchard,bigfont/orchard-cms-modules-and-themes,AdvantageCS/Orchard,TaiAivaras/Orchard,harmony7/Orchard,omidnasri/Orchard,huoxudong125/Orchard,Lombiq/Orchard,smartnet-developers/Orchard,AndreVolksdorf/Orchard,infofromca/Orchard,enspiral-dev-academy/Orchard,salarvand/Portal,TaiAivaras/Orchard,andyshao/Orchard,bigfont/orchard-continuous-integration-demo,arminkarimi/Orchard,dburriss/Orchard,vard0/orchard.tan,xkproject/Orchard,geertdoornbos/Orchard,sebastienros/msc,Praggie/Orchard,Anton-Am/Orchard,rtpHarry/Orchard,angelapper/Orchard,SzymonSel/Orchard,Anton-Am/Orchard,spraiin/Orchard,escofieldnaxos/Orchard,austinsc/Orchard,AEdmunds/beautiful-springtime,dmitry-urenev/extended-orchard-cms-v10.1,oxwanawxo/Orchard,spraiin/Orchard,Sylapse/Orchard.HttpAuthSample,ericschultz/outercurve-orchard,jchenga/Orchard,IDeliverable/Orchard,salarvand/orchard,omidnasri/Orchard,bigfont/orchard-cms-modules-and-themes,Inner89/Orchard,jagraz/Orchard,omidnasri/Orchard,luchaoshuai/Orchard,geertdoornbos/Orchard,xiaobudian/Orchard,caoxk/orchard,Sylapse/Orchard.HttpAuthSample,openbizgit/Orchard,bigfont/orchard-continuous-integration-demo,asabbott/chicagodevnet-website,stormleoxia/Orchard,qt1/orchard4ibn,huoxudong125/Orchard,Codinlab/Orchard,Inner89/Orchard,jchenga/Orchard,huoxudong125/Orchard,aaronamm/Orchard,bigfont/orchard-continuous-integration-demo,qt1/orchard4ibn,abhishekluv/Orchard,sfmskywalker/Orchard,openbizgit/Orchard,Morgma/valleyviewknolls,jagraz/Orchard,dburriss/Orchard,marcoaoteixeira/Orchard,Fogolan/OrchardForWork,xkproject/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,emretiryaki/Orchard,yersans/Orchard,jerryshi2007/Orchard,yonglehou/Orchard,austinsc/Orchard,spraiin/Orchard,Lombiq/Orchard,grapto/Orchard.CloudBust,openbizgit/Orchard,kgacova/Orchard,dcinzona/Orchard,planetClaire/Orchard-LETS,tobydodds/folklife,cooclsee/Orchard,arminkarimi/Orchard,jaraco/orchard,arminkarimi/Orchard,vairam-svs/Orchard,asabbott/chicagodevnet-website,dcinzona/Orchard-Harvest-Website,qt1/orchard4ibn,yersans/Orchard,TaiAivaras/Orchard,JRKelso/Orchard,OrchardCMS/Orchard-Harvest-Website,KeithRaven/Orchard,KeithRaven/Orchard,omidnasri/Orchard,hhland/Orchard,TalaveraTechnologySolutions/Orchard,qt1/orchard4ibn,OrchardCMS/Orchard,MpDzik/Orchard,Praggie/Orchard,ehe888/Orchard,tobydodds/folklife,harmony7/Orchard,armanforghani/Orchard,NIKASoftwareDevs/Orchard,infofromca/Orchard,neTp9c/Orchard,dburriss/Orchard,phillipsj/Orchard,aaronamm/Orchard,salarvand/orchard,LaserSrl/Orchard,vard0/orchard.tan,caoxk/orchard,jimasp/Orchard,cryogen/orchard,jerryshi2007/Orchard,AEdmunds/beautiful-springtime,vairam-svs/Orchard,sfmskywalker/Orchard,Dolphinsimon/Orchard,jaraco/orchard,abhishekluv/Orchard,jaraco/orchard,OrchardCMS/Orchard,RoyalVeterinaryCollege/Orchard,rtpHarry/Orchard,xkproject/Orchard,abhishekluv/Orchard,OrchardCMS/Orchard-Harvest-Website,Ermesx/Orchard,jtkech/Orchard,armanforghani/Orchard,Serlead/Orchard,Inner89/Orchard,marcoaoteixeira/Orchard,dburriss/Orchard,TalaveraTechnologySolutions/Orchard,aaronamm/Orchard,MetSystem/Orchard,emretiryaki/Orchard,yersans/Orchard,Sylapse/Orchard.HttpAuthSample,TalaveraTechnologySolutions/Orchard,Codinlab/Orchard,andyshao/Orchard,KeithRaven/Orchard,vairam-svs/Orchard,omidnasri/Orchard,AndreVolksdorf/Orchard,omidnasri/Orchard,Fogolan/OrchardForWork,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,mvarblow/Orchard,Lombiq/Orchard,cooclsee/Orchard,salarvand/Portal,hbulzy/Orchard,MpDzik/Orchard,DonnotRain/Orchard,hhland/Orchard,hbulzy/Orchard,jtkech/Orchard,dcinzona/Orchard-Harvest-Website,salarvand/Portal,hannan-azam/Orchard,hannan-azam/Orchard,TaiAivaras/Orchard,omidnasri/Orchard,ehe888/Orchard,enspiral-dev-academy/Orchard,salarvand/orchard,andyshao/Orchard,fortunearterial/Orchard,dozoft/Orchard,NIKASoftwareDevs/Orchard,SeyDutch/Airbrush,Sylapse/Orchard.HttpAuthSample,harmony7/Orchard,tobydodds/folklife,bedegaming-aleksej/Orchard,oxwanawxo/Orchard,yonglehou/Orchard,mgrowan/Orchard,vard0/orchard.tan,marcoaoteixeira/Orchard,JRKelso/Orchard,omidnasri/Orchard,alejandroaldana/Orchard,Serlead/Orchard,dozoft/Orchard,johnnyqian/Orchard,Dolphinsimon/Orchard,alejandroaldana/Orchard,gcsuk/Orchard,RoyalVeterinaryCollege/Orchard,openbizgit/Orchard,jersiovic/Orchard,Dolphinsimon/Orchard,Serlead/Orchard,MpDzik/Orchard,bedegaming-aleksej/Orchard,kgacova/Orchard,Ermesx/Orchard,johnnyqian/Orchard,kouweizhong/Orchard,arminkarimi/Orchard,neTp9c/Orchard,hhland/Orchard,emretiryaki/Orchard,AEdmunds/beautiful-springtime,fassetar/Orchard,sebastienros/msc,kgacova/Orchard,salarvand/orchard,mvarblow/Orchard,vairam-svs/Orchard,Ermesx/Orchard,vard0/orchard.tan,cooclsee/Orchard,yersans/Orchard,jerryshi2007/Orchard,fassetar/Orchard,sfmskywalker/Orchard,jerryshi2007/Orchard,SzymonSel/Orchard,dcinzona/Orchard,hhland/Orchard,huoxudong125/Orchard,SeyDutch/Airbrush,planetClaire/Orchard-LETS,hhland/Orchard,salarvand/Portal,grapto/Orchard.CloudBust,kouweizhong/Orchard,enspiral-dev-academy/Orchard,bedegaming-aleksej/Orchard,Fogolan/OrchardForWork,Lombiq/Orchard,stormleoxia/Orchard,armanforghani/Orchard,mvarblow/Orchard,vard0/orchard.tan,MetSystem/Orchard,smartnet-developers/Orchard,neTp9c/Orchard,ericschultz/outercurve-orchard,Cphusion/Orchard,KeithRaven/Orchard,phillipsj/Orchard,brownjordaninternational/OrchardCMS,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,alejandroaldana/Orchard,austinsc/Orchard,KeithRaven/Orchard,stormleoxia/Orchard,dcinzona/Orchard-Harvest-Website,qt1/Orchard,neTp9c/Orchard,SouleDesigns/SouleDesigns.Orchard,AdvantageCS/Orchard,Morgma/valleyviewknolls,austinsc/Orchard,asabbott/chicagodevnet-website,phillipsj/Orchard,patricmutwiri/Orchard,jaraco/orchard,m2cms/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,infofromca/Orchard,sfmskywalker/Orchard,asabbott/chicagodevnet-website,luchaoshuai/Orchard,jagraz/Orchard,Serlead/Orchard,yonglehou/Orchard,Fogolan/OrchardForWork,SzymonSel/Orchard,DonnotRain/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,luchaoshuai/Orchard,jersiovic/Orchard,caoxk/orchard,kouweizhong/Orchard,MpDzik/Orchard,omidnasri/Orchard,geertdoornbos/Orchard,gcsuk/Orchard,JRKelso/Orchard,armanforghani/Orchard,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-continuous-integration-demo,SeyDutch/Airbrush,dmitry-urenev/extended-orchard-cms-v10.1,dmitry-urenev/extended-orchard-cms-v10.1,li0803/Orchard,johnnyqian/Orchard,AdvantageCS/Orchard,li0803/Orchard,Codinlab/Orchard,SeyDutch/Airbrush,infofromca/Orchard,austinsc/Orchard,hannan-azam/Orchard,kouweizhong/Orchard,jimasp/Orchard,marcoaoteixeira/Orchard,sfmskywalker/Orchard,dcinzona/Orchard-Harvest-Website,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,dmitry-urenev/extended-orchard-cms-v10.1,RoyalVeterinaryCollege/Orchard,fassetar/Orchard,NIKASoftwareDevs/Orchard,cryogen/orchard,aaronamm/Orchard,dozoft/Orchard,AdvantageCS/Orchard,enspiral-dev-academy/Orchard,dcinzona/Orchard,dcinzona/Orchard,huoxudong125/Orchard,LaserSrl/Orchard,andyshao/Orchard,jagraz/Orchard,smartnet-developers/Orchard,emretiryaki/Orchard,Ermesx/Orchard,RoyalVeterinaryCollege/Orchard,ehe888/Orchard,johnnyqian/Orchard,planetClaire/Orchard-LETS,alejandroaldana/Orchard,angelapper/Orchard,planetClaire/Orchard-LETS,xkproject/Orchard,harmony7/Orchard,mgrowan/Orchard,m2cms/Orchard,oxwanawxo/Orchard,Serlead/Orchard,Praggie/Orchard,angelapper/Orchard,tobydodds/folklife,luchaoshuai/Orchard,AdvantageCS/Orchard,cooclsee/Orchard,escofieldnaxos/Orchard,johnnyqian/Orchard,xiaobudian/Orchard,smartnet-developers/Orchard,mgrowan/Orchard,dcinzona/Orchard-Harvest-Website,jchenga/Orchard,ericschultz/outercurve-orchard,ehe888/Orchard,patricmutwiri/Orchard,stormleoxia/Orchard,TalaveraTechnologySolutions/Orchard,TalaveraTechnologySolutions/Orchard,DonnotRain/Orchard,yersans/Orchard,IDeliverable/Orchard,SouleDesigns/SouleDesigns.Orchard,hannan-azam/Orchard,ehe888/Orchard,cooclsee/Orchard,brownjordaninternational/OrchardCMS,kgacova/Orchard,oxwanawxo/Orchard,spraiin/Orchard,Cphusion/Orchard,mgrowan/Orchard,mvarblow/Orchard,jtkech/Orchard,grapto/Orchard.CloudBust,alejandroaldana/Orchard,xiaobudian/Orchard,jersiovic/Orchard,escofieldnaxos/Orchard,sebastienros/msc,dozoft/Orchard,sebastienros/msc,AndreVolksdorf/Orchard,JRKelso/Orchard,geertdoornbos/Orchard,hbulzy/Orchard,infofromca/Orchard,jagraz/Orchard,LaserSrl/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,qt1/orchard4ibn,SouleDesigns/SouleDesigns.Orchard,Dolphinsimon/Orchard,li0803/Orchard,OrchardCMS/Orchard-Harvest-Website,andyshao/Orchard,rtpHarry/Orchard,OrchardCMS/Orchard-Harvest-Website,fortunearterial/Orchard,hbulzy/Orchard,neTp9c/Orchard,Praggie/Orchard,Sylapse/Orchard.HttpAuthSample,brownjordaninternational/OrchardCMS,m2cms/Orchard,TaiAivaras/Orchard,tobydodds/folklife,brownjordaninternational/OrchardCMS,bedegaming-aleksej/Orchard,OrchardCMS/Orchard,rtpHarry/Orchard,qt1/Orchard,OrchardCMS/Orchard-Harvest-Website,fassetar/Orchard,sfmskywalker/Orchard,jersiovic/Orchard,TalaveraTechnologySolutions/Orchard,Lombiq/Orchard,IDeliverable/Orchard,vard0/orchard.tan,aaronamm/Orchard,fortunearterial/Orchard,li0803/Orchard,TalaveraTechnologySolutions/Orchard,DonnotRain/Orchard,marcoaoteixeira/Orchard,enspiral-dev-academy/Orchard,grapto/Orchard.CloudBust,luchaoshuai/Orchard,OrchardCMS/Orchard,AndreVolksdorf/Orchard,jerryshi2007/Orchard,brownjordaninternational/OrchardCMS,sebastienros/msc
|
src/Orchard/Environment/Extensions/Loaders/AreaExtensionLoader.cs
|
src/Orchard/Environment/Extensions/Loaders/AreaExtensionLoader.cs
|
using System;
using System.Linq;
using System.Reflection;
using Orchard.Environment.Extensions.Models;
namespace Orchard.Environment.Extensions.Loaders {
public class AreaExtensionLoader : IExtensionLoader {
public int Order { get { return 5; } }
public ExtensionEntry Load(ExtensionDescriptor descriptor) {
if (descriptor.Location == "~/Areas") {
var assembly = Assembly.Load("Orchard.Web");
return new ExtensionEntry {
Descriptor = descriptor,
Assembly = assembly,
ExportedTypes = assembly.GetExportedTypes().Where(x => IsTypeFromModule(x, descriptor))
};
}
return null;
}
private static bool IsTypeFromModule(Type type, ExtensionDescriptor descriptor) {
return (type.Namespace + ".").StartsWith("Orchard.Web.Areas." + descriptor.Name + ".");
}
}
}
|
using System;
using System.Linq;
using System.Reflection;
using Orchard.Environment.Extensions.Models;
namespace Orchard.Environment.Extensions.Loaders {
public class AreaExtensionLoader : IExtensionLoader {
public int Order { get { return 5; } }
public ExtensionEntry Load(ExtensionDescriptor descriptor) {
if (descriptor.Location == "~/Areas") {
var assembly = Assembly.Load("Orchard.Web");
return new ExtensionEntry {
Descriptor = descriptor,
Assembly = assembly,
ExportedTypes = assembly.GetExportedTypes().Where(x => IsTypeFromModule(x, descriptor))
};
}
return null;
}
private static bool IsTypeFromModule(Type type, ExtensionDescriptor descriptor) {
return (type.Namespace + ".").StartsWith("Orchard.Web.Areas." + descriptor.Name + ".");
}
}
}
|
bsd-3-clause
|
C#
|
08f05190ce9dd63a6c69b7c88a1efb1e299ccc4d
|
Allow anonymous on password reset requests
|
miracle-as/kitos,os2kitos/kitos,os2kitos/kitos,miracle-as/kitos,os2kitos/kitos,os2kitos/kitos,miracle-as/kitos,miracle-as/kitos
|
Presentation.Web/Controllers/API/PasswordResetRequestController.cs
|
Presentation.Web/Controllers/API/PasswordResetRequestController.cs
|
using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Core.DomainModel;
using Core.DomainServices;
using Presentation.Web.Models;
namespace Presentation.Web.Controllers.API
{
[AllowAnonymous]
public class PasswordResetRequestController : BaseApiController
{
private readonly IUserService _userService;
private readonly IUserRepository _userRepository;
public PasswordResetRequestController(IUserService userService, IUserRepository userRepository)
{
_userService = userService;
_userRepository = userRepository;
}
// POST api/PasswordResetRequest
public HttpResponseMessage Post([FromBody] UserDTO input)
{
try
{
var user = _userRepository.GetByEmail(input.Email);
var request = _userService.IssuePasswordReset(user, null, null);
return Ok();
}
catch (Exception e)
{
return CreateResponse(HttpStatusCode.InternalServerError, e);
}
}
// GET api/PasswordResetRequest
public HttpResponseMessage Get(string requestId)
{
try
{
var request = _userService.GetPasswordReset(requestId);
if (request == null) return NotFound();
var dto = AutoMapper.Mapper.Map<PasswordResetRequest, PasswordResetRequestDTO>(request);
var msg = CreateResponse(HttpStatusCode.OK, dto);
return msg;
}
catch (Exception e)
{
return CreateResponse(HttpStatusCode.InternalServerError, e);
}
}
}
}
|
using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Core.DomainModel;
using Core.DomainServices;
using Presentation.Web.Models;
namespace Presentation.Web.Controllers.API
{
public class PasswordResetRequestController : BaseApiController
{
private readonly IUserService _userService;
private readonly IUserRepository _userRepository;
public PasswordResetRequestController(IUserService userService, IUserRepository userRepository)
{
_userService = userService;
_userRepository = userRepository;
}
// POST api/PasswordResetRequest
public HttpResponseMessage Post([FromBody] UserDTO input)
{
try
{
var user = _userRepository.GetByEmail(input.Email);
var request = _userService.IssuePasswordReset(user, null, null);
return Ok();
}
catch (Exception e)
{
return CreateResponse(HttpStatusCode.InternalServerError, e);
}
}
// GET api/PasswordResetRequest
public HttpResponseMessage Get(string requestId)
{
try
{
var request = _userService.GetPasswordReset(requestId);
if (request == null) return NotFound();
var dto = AutoMapper.Mapper.Map<PasswordResetRequest, PasswordResetRequestDTO>(request);
var msg = CreateResponse(HttpStatusCode.OK, dto);
return msg;
}
catch (Exception e)
{
return CreateResponse(HttpStatusCode.InternalServerError, e);
}
}
}
}
|
mpl-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.