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 |
|---|---|---|---|---|---|---|---|---|
4bd57a2bdce629360be2e6d74af1645daf9bb6e3
|
Modify DescriptionAttribute to use PropertyAttribute
|
nunit/nunit-console,nunit/nunit-console,nunit/nunit-console
|
src/framework/DescriptionAttribute.cs
|
src/framework/DescriptionAttribute.cs
|
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// 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;
namespace NUnit.Framework
{
/// <summary>
/// Attribute used to provide descriptive text about a
/// test case or fixture.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false)]
public sealed class DescriptionAttribute : PropertyAttribute
{
public DescriptionAttribute(string description) : base(description) { }
}
}
|
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// 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;
namespace NUnit.Framework
{
/// <summary>
/// Attribute used to provide descriptive text about a
/// test case or fixture.
/// </summary>
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false)]
public class DescriptionAttribute : Attribute
{
string description;
/// <summary>
/// Construct the attribute
/// </summary>
/// <param name="description">Text describing the test</param>
public DescriptionAttribute(string description)
{
this.description=description;
}
/// <summary>
/// Gets the test description
/// </summary>
public string Description
{
get { return description; }
}
}
}
|
mit
|
C#
|
7f4b62459fa149c5e957aa8dc3eb49c21e533e87
|
Sort using statements.
|
GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples
|
dlp/api/DlpSnippets/DeidentifyMasking.cs
|
dlp/api/DlpSnippets/DeidentifyMasking.cs
|
// Copyright (c) 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
// [START dlp_deidentify_masking]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dlp.V2;
using System;
using System.Collections.Generic;
partial class DlpSnippets
{
public string DeidentiyMasking(string projectId = "YOUR-PROJECT-ID")
{
var transformation = new InfoTypeTransformations.Types.InfoTypeTransformation
{
PrimitiveTransformation = new PrimitiveTransformation
{
CharacterMaskConfig = new CharacterMaskConfig
{
MaskingCharacter = "*",
NumberToMask = 5,
ReverseOrder = false,
}
}
};
var request = new DeidentifyContentRequest
{
ParentAsProjectName = new ProjectName(projectId),
InspectConfig = new InspectConfig
{
InfoTypes =
{
new InfoType { Name = "US_SOCIAL_SECURITY_NUMBER" }
}
},
DeidentifyConfig = new DeidentifyConfig
{
InfoTypeTransformations = new InfoTypeTransformations
{
Transformations = { transformation }
}
},
Item = new ContentItem { Value = "My SSN is 372819127." }
};
DlpServiceClient dlp = DlpServiceClient.Create();
var response = dlp.DeidentifyContent(request);
Console.WriteLine($"Deidentified content: {response.Item.Value}");
return response.Item.Value;
}
}
// [END dlp_deidentify_masking]
|
// Copyright (c) 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
// [START dlp_deidentify_masking]
using System;
using System.Collections.Generic;
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dlp.V2;
partial class DlpSnippets
{
public string DeidentiyMasking(string projectId = "YOUR-PROJECT-ID")
{
var transformation = new InfoTypeTransformations.Types.InfoTypeTransformation
{
PrimitiveTransformation = new PrimitiveTransformation
{
CharacterMaskConfig = new CharacterMaskConfig
{
MaskingCharacter = "*",
NumberToMask = 5,
ReverseOrder = false,
}
}
};
var request = new DeidentifyContentRequest
{
ParentAsProjectName = new ProjectName(projectId),
InspectConfig = new InspectConfig
{
InfoTypes =
{
new InfoType { Name = "US_SOCIAL_SECURITY_NUMBER" }
}
},
DeidentifyConfig = new DeidentifyConfig
{
InfoTypeTransformations = new InfoTypeTransformations
{
Transformations = { transformation }
}
},
Item = new ContentItem { Value = "My SSN is 372819127." }
};
DlpServiceClient dlp = DlpServiceClient.Create();
var response = dlp.DeidentifyContent(request);
Console.WriteLine($"Deidentified content: {response.Item.Value}");
return response.Item.Value;
}
}
// [END dlp_deidentify_masking]
|
apache-2.0
|
C#
|
90882c8b057244dd193bfd280793ca2a1102abe1
|
Update GpsSourceEnum.cs
|
ADAPT/ADAPT
|
source/ADAPT/Logistics/GpsSourceEnum.cs
|
source/ADAPT/Logistics/GpsSourceEnum.cs
|
/*******************************************************************************
* Copyright (C) 2015 AgGateway and ADAPT Contributors
* Copyright (C) 2015 Deere and Company
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* Tarak Reddy, Tim Shearouse - initial API and implementation
* Jason Roesbeke - Added PPP & SBAS
* R. ANdres Ferreyra - Added mechanical
*******************************************************************************/
namespace AgGateway.ADAPT.ApplicationDataModel.Logistics
{
public enum GpsSourceEnum
{
Unknown,
Drawn,
MobileGPS,
DeereRTK,
DeereRTKX,
DeereSF1,
DeereSF2,
DeereWAAS,
GNSSfix,
DGNSSfix,
PreciseGNSS,
RTKFixedInteger,
RTKFloat,
EstDRmode,
ManualInput,
SimulateMode,
DesktopGeneratedData,
Other,
PPP, //Precise Point Positioning
SBAS, //Satellite Based Augmentation System
Mechanical // Represents mechanical and optical angle encoding mechanisms used primarily in center pivot irrigation systems.
}
}
|
/*******************************************************************************
* Copyright (C) 2015 AgGateway and ADAPT Contributors
* Copyright (C) 2015 Deere and Company
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* Tarak Reddy, Tim Shearouse - initial API and implementation
* Jason Roesbeke - Added PPP & SBAS
*******************************************************************************/
namespace AgGateway.ADAPT.ApplicationDataModel.Logistics
{
public enum GpsSourceEnum
{
Unknown,
Drawn,
MobileGPS,
DeereRTK,
DeereRTKX,
DeereSF1,
DeereSF2,
DeereWAAS,
GNSSfix,
DGNSSfix,
PreciseGNSS,
RTKFixedInteger,
RTKFloat,
EstDRmode,
ManualInput,
SimulateMode,
DesktopGeneratedData,
Other,
PPP, //Precise Point Positioning
SBAS, //Satellite Based Augmentation System
}
}
|
epl-1.0
|
C#
|
07756ca2f6d31bd4562b1b3bbbccdcc90e1a9ad0
|
Update WebResourcUrls to https.
|
aluxnimm/outlookcaldavsynchronizer
|
CalDavSynchronizer/WebResourceUrls.cs
|
CalDavSynchronizer/WebResourceUrls.cs
|
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/)
// Copyright (c) 2015 Gerhard Zehetbauer
// Copyright (c) 2015 Alexander Nimmervoll
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace CalDavSynchronizer
{
public static class WebResourceUrls
{
public static Uri GlobalOptionsFile => new Uri ("https://sourceforge.net/p/outlookcaldavsynchronizer/code/ci/master/tree/GlobalOptions.xml?format=raw");
public static Uri SiteContainingCurrentVersion => new Uri ("https://sourceforge.net/projects/outlookcaldavsynchronizer/files/");
public static Uri LatestVersionZipFile => new Uri ("https://sourceforge.net/projects/outlookcaldavsynchronizer/files/latest/download?source=files");
public static Uri ReadMeFile => new Uri ("https://sourceforge.net/p/outlookcaldavsynchronizer/code/ci/master/tree/README.md?format=raw");
public static Uri ReadMeFileDownloadSite => new Uri ("https://sourceforge.net/projects/outlookcaldavsynchronizer/files/README.md/download");
public static Uri HelpSite => new Uri ("https://caldavsynchronizer.org/documentation/");
public static Uri DonationSite => new Uri("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PWA2N6P5WRSJJ&lc=US");
public static Uri ProjectHomeSite => new Uri("https://caldavsynchronizer.org/");
}
}
|
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/)
// Copyright (c) 2015 Gerhard Zehetbauer
// Copyright (c) 2015 Alexander Nimmervoll
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace CalDavSynchronizer
{
public static class WebResourceUrls
{
public static Uri GlobalOptionsFile => new Uri ("http://sourceforge.net/p/outlookcaldavsynchronizer/code/ci/master/tree/GlobalOptions.xml?format=raw");
public static Uri SiteContainingCurrentVersion => new Uri ("https://sourceforge.net/projects/outlookcaldavsynchronizer/files/");
public static Uri LatestVersionZipFile => new Uri ("https://sourceforge.net/projects/outlookcaldavsynchronizer/files/latest/download?source=files");
public static Uri ReadMeFile => new Uri ("http://sourceforge.net/p/outlookcaldavsynchronizer/code/ci/master/tree/README.md?format=raw");
public static Uri ReadMeFileDownloadSite => new Uri ("https://sourceforge.net/projects/outlookcaldavsynchronizer/files/README.md/download");
public static Uri HelpSite => new Uri ("http://caldavsynchronizer.org/documentation/");
public static Uri DonationSite => new Uri("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PWA2N6P5WRSJJ&lc=US");
public static Uri ProjectHomeSite => new Uri("http://caldavsynchronizer.org/");
}
}
|
agpl-3.0
|
C#
|
7f4662b772b8650a9dc0c9c504e7dea98d78374d
|
Format EbsBlockDevice
|
carbon/Amazon
|
src/Amazon.Ec2/Models/EbsBlockDevice.cs
|
src/Amazon.Ec2/Models/EbsBlockDevice.cs
|
#nullable disable
using System.Xml.Serialization;
namespace Amazon.Ec2;
public sealed class EbsBlockDevice
{
public EbsBlockDevice() { }
public EbsBlockDevice(
string volumeId = null,
bool? deleteOnTermination = null,
bool? encrypted = null,
int? iops = null,
string snapshotId = null,
int? volumeSize = null,
string volumeType = null)
{
VolumeId = volumeId;
DeleteOnTermination = deleteOnTermination;
Encrypted = encrypted;
Iops = iops;
SnapshotId = snapshotId;
VolumeSize = volumeSize;
VolumeType = volumeType;
}
[XmlElement("volumeId")]
public string VolumeId { get; init; }
[XmlElement("status")]
public string Status { get; init; }
[XmlElement("attachTime")]
public DateTime? AttachTime { get; init; }
[XmlElement("deleteOnTermination")]
public bool? DeleteOnTermination { get; init; }
[XmlElement("encrypted")]
public bool? Encrypted { get; init; }
// [Range(100, 20000)]
[XmlElement("iops")]
public int? Iops { get; init; }
[XmlElement("snapshotId")]
public string SnapshotId { get; init; }
// The size of the volume, in GiB.
// [Range(1, 16384)]
[XmlElement("volumeSize")]
public int? VolumeSize { get; init; }
// gp2, io1, st1, sc1, or standard.
[XmlElement("volumeType")]
public string VolumeType { get; init; }
}
/*
<ebs>
<volumeId>vol-1234567890abcdef0</volumeId>
<status>attached</status>
<attachTime>2015-12-22T10:44:09.000Z</attachTime>
<deleteOnTermination>true</deleteOnTermination>
</ebs>
*/
|
#nullable disable
using System.Xml.Serialization;
namespace Amazon.Ec2
{
public class EbsBlockDevice
{
public EbsBlockDevice() { }
public EbsBlockDevice(
string volumeId = null,
bool? deleteOnTermination = null,
bool? encrypted = null,
int? iops = null,
string snapshotId = null,
int? volumeSize = null,
string volumeType = null)
{
VolumeId = volumeId;
DeleteOnTermination = deleteOnTermination;
Encrypted = encrypted;
Iops = iops;
SnapshotId = snapshotId;
VolumeSize = volumeSize;
VolumeType = volumeType;
}
[XmlElement("volumeId")]
public string VolumeId { get; set; }
[XmlElement("status")]
public string Status { get; set; }
[XmlElement("attachTime")]
public DateTime? AttachTime { get; set; }
[XmlElement("deleteOnTermination")]
public bool? DeleteOnTermination { get; set; }
[XmlElement("encrypted")]
public bool? Encrypted { get; set; }
// [Range(100, 20000)]
[XmlElement("iops")]
public int? Iops { get; set; }
[XmlElement("snapshotId")]
public string SnapshotId { get; set; }
// The size of the volume, in GiB.
// [Range(1, 16384)]
[XmlElement("volumeSize")]
public int? VolumeSize { get; set; }
// gp2, io1, st1, sc1, or standard.
[XmlElement("volumeType")]
public string VolumeType { get; set; }
}
}
/*
<ebs>
<volumeId>vol-1234567890abcdef0</volumeId>
<status>attached</status>
<attachTime>2015-12-22T10:44:09.000Z</attachTime>
<deleteOnTermination>true</deleteOnTermination>
</ebs>
*/
|
mit
|
C#
|
c4c5f7ac50d5425671ec17482afd0c1873c82524
|
Update AssemblyInfo.cs
|
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
|
src/PathDemo/Properties/AssemblyInfo.cs
|
src/PathDemo/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("PathDemo")]
[assembly: AssemblyDescription("A 2D vector diagram editor.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Wiesław Šoltés")]
[assembly: AssemblyProduct("PathDemo")]
[assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("PathDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PathDemo")]
[assembly: AssemblyCopyright("Copyright 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.*")]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
mit
|
C#
|
f12e66052c99581040e8d25822e9a979e041bf84
|
Reword outdated doc
|
peppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,UselessToucan/osu,peppy/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu
|
osu.Game/Rulesets/Mods/IApplicableToHealthProcessor.cs
|
osu.Game/Rulesets/Mods/IApplicableToHealthProcessor.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.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
public interface IApplicableToHealthProcessor : IApplicableMod
{
/// <summary>
/// Provides a loaded <see cref="HealthProcessor"/> to a mod. Called once on initialisation of a play instance.
/// </summary>
void ApplyToHealthProcessor(HealthProcessor healthProcessor);
}
}
|
// 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.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
public interface IApplicableToHealthProcessor : IApplicableMod
{
/// <summary>
/// Provides a ready <see cref="HealthProcessor"/> to a mod. Called once on initialisation of a play instance.
/// </summary>
void ApplyToHealthProcessor(HealthProcessor healthProcessor);
}
}
|
mit
|
C#
|
3225b3f60ae8c7798eea74f0bd18737d03b1403c
|
Include redirect_uri in POST data (#21)
|
Clancey/SimpleAuth
|
src/SimpleAuth/Api/WebAuthenticator.cs
|
src/SimpleAuth/Api/WebAuthenticator.cs
|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace SimpleAuth
{
public abstract class WebAuthenticator : Authenticator
{
public bool ClearCookiesBeforeLogin { get; set; }
public CookieHolder [] Cookies { get; set; }
public abstract string BaseUrl { get;set;}
public abstract Uri RedirectUrl{get;set;}
public List<string> Scope { get; set; } = new List<string>();
public virtual bool CheckUrl(Uri url, Cookie[] cookies)
{
try
{
if (url == null || string.IsNullOrWhiteSpace(url.Query))
return false;
if (url.Host != RedirectUrl.Host)
return false;
var parts = HttpUtility.ParseQueryString(url.Query);
var code = parts["code"];
if (!string.IsNullOrWhiteSpace(code))
{
Cookies = cookies?.Select (x => new CookieHolder { Domain = x.Domain, Path = x.Path, Name = x.Name, Value = x.Value }).ToArray ();
FoundAuthCode(code);
return true;
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
return false;
}
public virtual Task<Uri> GetInitialUrl()
{
var uri = new Uri(BaseUrl);
var collection = GetInitialUrlQueryParameters();
return Task.FromResult(uri.AddParameters(collection));
}
public virtual Dictionary<string, string> GetInitialUrlQueryParameters()
{
var data = new Dictionary<string, string>()
{
{"client_id",ClientId},
{"response_type","code"},
{"redirect_uri",RedirectUrl.AbsoluteUri}
};
if (Scope?.Count > 0) {
var scope = string.Join (" ", Scope);
data ["scope"] = scope;
}
return data;
}
public virtual Task<Dictionary<string, string>> GetTokenPostData(string clientSecret)
{
var tokenPostData = new Dictionary<string, string> {
{
"grant_type",
"authorization_code"
}, {
"code",
AuthCode
}, {
"client_id",
ClientId
}, {
"client_secret",
clientSecret
},
};
if (RedirectUrl != null)
{
tokenPostData["redirect_uri"] = RedirectUrl.ToString();
}
return Task.FromResult(tokenPostData);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace SimpleAuth
{
public abstract class WebAuthenticator : Authenticator
{
public bool ClearCookiesBeforeLogin { get; set; }
public CookieHolder [] Cookies { get; set; }
public abstract string BaseUrl { get;set;}
public abstract Uri RedirectUrl{get;set;}
public List<string> Scope { get; set; } = new List<string>();
public virtual bool CheckUrl(Uri url, Cookie[] cookies)
{
try
{
if (url == null || string.IsNullOrWhiteSpace(url.Query))
return false;
if (url.Host != RedirectUrl.Host)
return false;
var parts = HttpUtility.ParseQueryString(url.Query);
var code = parts["code"];
if (!string.IsNullOrWhiteSpace(code))
{
Cookies = cookies?.Select (x => new CookieHolder { Domain = x.Domain, Path = x.Path, Name = x.Name, Value = x.Value }).ToArray ();
FoundAuthCode(code);
return true;
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
return false;
}
public virtual Task<Uri> GetInitialUrl()
{
var uri = new Uri(BaseUrl);
var collection = GetInitialUrlQueryParameters();
return Task.FromResult(uri.AddParameters(collection));
}
public virtual Dictionary<string, string> GetInitialUrlQueryParameters()
{
var data = new Dictionary<string, string>()
{
{"client_id",ClientId},
{"response_type","code"},
{"redirect_uri",RedirectUrl.AbsoluteUri}
};
if (Scope?.Count > 0) {
var scope = string.Join (" ", Scope);
data ["scope"] = scope;
}
return data;
}
public virtual Task<Dictionary<string, string>> GetTokenPostData(string clientSecret)
{
return Task.FromResult(new Dictionary<string, string> {
{
"grant_type",
"authorization_code"
}, {
"code",
AuthCode
}, {
"client_id",
ClientId
}, {
"client_secret",
clientSecret
},
});
}
}
}
|
apache-2.0
|
C#
|
82f46a92a0142d244df577db4ef19b18c5678c64
|
fix so it compiles
|
antoniusriha/gtk-sharp,orion75/gtk-sharp,orion75/gtk-sharp,akrisiun/gtk-sharp,orion75/gtk-sharp,antoniusriha/gtk-sharp,Gankov/gtk-sharp,antoniusriha/gtk-sharp,akrisiun/gtk-sharp,Gankov/gtk-sharp,openmedicus/gtk-sharp,antoniusriha/gtk-sharp,akrisiun/gtk-sharp,openmedicus/gtk-sharp,openmedicus/gtk-sharp,openmedicus/gtk-sharp,sillsdev/gtk-sharp,openmedicus/gtk-sharp,Gankov/gtk-sharp,sillsdev/gtk-sharp,sillsdev/gtk-sharp,Gankov/gtk-sharp,orion75/gtk-sharp,akrisiun/gtk-sharp,akrisiun/gtk-sharp,openmedicus/gtk-sharp,sillsdev/gtk-sharp,sillsdev/gtk-sharp,openmedicus/gtk-sharp,orion75/gtk-sharp,Gankov/gtk-sharp,Gankov/gtk-sharp,antoniusriha/gtk-sharp
|
sample/DbClient/GnomeDbClient.cs
|
sample/DbClient/GnomeDbClient.cs
|
using System;
using Gda;
using GnomeDb;
using GdaSharp;
using Gtk;
using GtkSharp;
class GnomeDbClient {
static Gtk.Window window;
static Toolbar toolbar;
static Browser browser;
static VBox box;
static Gda.Client client = null;
static Gda.Connection cnc = null;
static void Main (string [] args)
{
GnomeDb.Application.Init ();
/* create the UI */
window = new Gtk.Window ("GNOME-DB client");
window.DeleteEvent += new DeleteEventHandler (Window_Delete);
box = new VBox (false, 0);
window.Add (box);
toolbar = new Toolbar ();
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
toolbar.AppendItem ("Change database", "Select another database to browse", String.Empty,
new Gtk.Image (Gtk.Stock.Add, IconSize.LargeToolbar),
new SignalFunc (DB_connect));
box.PackStart (toolbar, false, false, 0);
browser = new GnomeDb.Browser ();
box.PackStart (browser, true, true, 0);
window.ShowAll ();
GnomeDb.Application.Run ();
}
static void Client_Event (object o, EventNotificationArgs args)
{
switch (args.Event) {
case ClientEvent.Error :
System.Console.WriteLine ("There's been an error");
break;
}
}
static void Window_Delete (object o, DeleteEventArgs args)
{
GnomeDb.Application.Quit ();
args.RetVal = true;
}
static void DB_connect ()
{
GnomeDb.LoginDialog dialog;
dialog = new GnomeDb.LoginDialog ("Select data source");
if (dialog.Run () == true) {
if (client == null) {
client = new Gda.Client ();
client.EventNotification += new GdaSharp.EventNotificationHandler (Client_Event);
}
cnc = client.OpenConnection (dialog.Dsn, dialog.Username, dialog.Password,
Gda.ConnectionOptions.ReadOnly);
if (cnc != null)
browser.Connection = cnc;
}
dialog.Destroy ();
}
}
|
using System;
using Gda;
using GnomeDb;
using GdaSharp;
using Gtk;
using GtkSharp;
class GnomeDbClient {
static Gtk.Window window;
static Toolbar toolbar;
static Browser browser;
static VBox box;
static Gda.Client client = null;
static Gda.Connection cnc = null;
static void Main (string [] args)
{
GnomeDb.Application.Init ();
/* create the UI */
window = new Gtk.Window ("GNOME-DB client");
window.DeleteEvent += new DeleteEventHandler (Window_Delete);
box = new VBox (false, 0);
window.Add (box);
toolbar = new Toolbar ();
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
toolbar.AppendItem ("Change database", "Select another database to browse", String.Empty,
new Gtk.Image (Gtk.Stock.Add, IconSize.LargeToolbar),
new SignalFunc (DB_connect));
box.PackStart (toolbar, false, false, 0);
browser = new GnomeDb.Browser ();
box.PackStart (browser, true, true, 0);
window.ShowAll ();
GnomeDb.Application.Run ();
}
static void Client_Event (object o, EventNotificationArgs args)
{
switch (args.Event) {
case ClientEvent.Error :
System.Console.WriteLine ("There's been an error");
break;
}
}
static void Window_Delete (object o, DeleteEventArgs args)
{
GnomeDb.Application.Quit ();
args.RetVal = true;
}
static void DB_connect ()
{
GnomeDb.LoginDialog dialog;
dialog = new GnomeDb.LoginDialog ("Select data source");
if (dialog.Run () == true) {
if (client == null) {
client = new Gda.Client ();
client.EventNotification += new GdaSharp.EventNotificationHandler (Client_Event);
}
cnc = client.OpenConnection (dialog.Dsn, dialog.Username, dialog.Password,
Gda.ConnectionOptions.Only);
if (cnc != null)
browser.Connection = cnc;
}
dialog.Destroy ();
}
}
|
lgpl-2.1
|
C#
|
95280bfda381b8624ce13c89c26f5853dc8dba3f
|
Fix LookAheadParser and make inversable
|
ArsenShnurkov/Eto.Parse,smbecker/Eto.Parse,smbecker/Eto.Parse,picoe/Eto.Parse,picoe/Eto.Parse,ArsenShnurkov/Eto.Parse
|
Eto.Parse/Parsers/LookAheadParser.cs
|
Eto.Parse/Parsers/LookAheadParser.cs
|
using System;
namespace Eto.Parse.Parsers
{
public class LookAheadParser : UnaryParser, IInverseParser
{
public bool Inverse { get; set; }
protected LookAheadParser(LookAheadParser other, ParserCloneArgs chain)
: base(other, chain)
{
}
public LookAheadParser(Parser inner)
: base(inner)
{
}
protected override ParseMatch InnerParse(ParseArgs args)
{
var pos = args.Scanner.Position;
var match = Inner.Parse(args);
if (match.Success)
{
args.Scanner.SetPosition(pos);
return Inverse ? args.NoMatch : args.EmptyMatch;
}
else
return Inverse ? args.EmptyMatch : args.NoMatch;
}
public override Parser Clone(ParserCloneArgs chain)
{
return new LookAheadParser(this, chain);
}
}
}
|
using System;
namespace Eto.Parse.Parsers
{
public class LookAheadParser : UnaryParser
{
protected LookAheadParser(LookAheadParser other, ParserCloneArgs chain)
: base(other, chain)
{
}
public LookAheadParser(Parser inner)
: base(inner)
{
}
protected override ParseMatch InnerParse(ParseArgs args)
{
var pos = args.Scanner.Position;
var match = Inner.Parse(args);
if (match.Success)
{
args.Scanner.SetPosition(pos);
return args.NoMatch;
}
else
return new ParseMatch(pos, 0);
}
public override Parser Clone(ParserCloneArgs chain)
{
return new LookAheadParser(this, chain);
}
}
}
|
mit
|
C#
|
b4c1fc208d86b1e58115bd71125e41d2bbdca1b0
|
Update WhenValidatingBulkUploadFileAttributes.cs
|
SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice
|
src/SFA.DAS.ProviderApprenticeshipsService.Web.UnitTests/Orchestrators/BulkUpload/WhenValidatingBulkUploadFileAttributes.cs
|
src/SFA.DAS.ProviderApprenticeshipsService.Web.UnitTests/Orchestrators/BulkUpload/WhenValidatingBulkUploadFileAttributes.cs
|
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using SFA.DAS.NLog.Logger;
using SFA.DAS.ProviderApprenticeshipsService.Infrastructure.Configuration;
using SFA.DAS.ProviderApprenticeshipsService.Web.Orchestrators;
using SFA.DAS.ProviderApprenticeshipsService.Web.Orchestrators.BulkUpload;
namespace SFA.DAS.ProviderApprenticeshipsService.Web.UnitTests.Orchestrators.BulkUpload
{
[TestFixture]
public class WhenValidatingBulkUploadFileAttributes
{
private Mock<HttpPostedFileBase> _file;
private BulkUploadValidator _sut;
[SetUp]
public void SetUp()
{
_file = new Mock<HttpPostedFileBase>();
_file.Setup(m => m.FileName).Returns("APPDATA-20051030-213855.csv");
_file.Setup(m => m.ContentLength).Returns(400);
var textStream = new MemoryStream(Encoding.UTF8.GetBytes("hello world"));
_file.Setup(m => m.InputStream).Returns(textStream);
_sut = new BulkUploadValidator(new ProviderApprenticeshipsServiceConfiguration { MaxBulkUploadFileSize = 512 }, Mock.Of<ILog>());
}
[Test]
public void FileValidationNoErrors()
{
var errors = _sut.ValidateFileSize(_file.Object);
errors.Count().Should().Be(0);
}
[Test]
public void FileTooBig()
{
_file.Setup(m => m.ContentLength).Returns(2000000);
var errors = _sut.ValidateFileSize(_file.Object);
errors.Count().Should().Be(1);
errors.First().Message.Should().Be("File size cannot be larger than 512 kb");
}
}
}
|
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using SFA.DAS.NLog.Logger;
using SFA.DAS.ProviderApprenticeshipsService.Infrastructure.Configuration;
using SFA.DAS.ProviderApprenticeshipsService.Web.Orchestrators;
using SFA.DAS.ProviderApprenticeshipsService.Web.Orchestrators.BulkUpload;
namespace SFA.DAS.ProviderApprenticeshipsService.Web.UnitTests.Orchestrators.BulkUpload
{
[TestFixture]
public class WhenValidatingBulkUploadFileAttributes
{
private Mock<HttpPostedFileBase> _file;
private BulkUploadValidator _sut;
[SetUp]
public void SetUp()
{
_file = new Mock<HttpPostedFileBase>();
_file.Setup(m => m.FileName).Returns("APPDATA-20051030-213855.csv");
_file.Setup(m => m.ContentLength).Returns(400);
var textStream = new MemoryStream(Encoding.UTF8.GetBytes("hello world"));
_file.Setup(m => m.InputStream).Returns(textStream);
_sut = new BulkUploadValidator(new ProviderApprenticeshipsServiceConfiguration { MaxBulkUploadFileSize = 512 }, Mock.Of<ILog>());
}
[Test]
public void FileValidationNoErrors()
{
var errors = _sut.ValidateFileSize(_file.Object);
errors.Count().Should().Be(0);
}
[Test]
public void FileTooBig()
{
_file.Setup(m => m.ContentLength).Returns(2000000);
var errors = _sut.ValidateFileSize(_file.Object);
errors.Count().Should().Be(1);
errors.First().Message.Should().Be("File size cannot be larger then 512 kb");
}
}
}
|
mit
|
C#
|
e4cc357ce0c828f7ae281ef8840af67ed94cd67a
|
fix updated minor version number
|
NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity
|
ncmb_unity/Assets/NCMB/CommonConstant.cs
|
ncmb_unity/Assets/NCMB/CommonConstant.cs
|
/*******
Copyright 2014 NIFTY Corporation All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**********/
using System.Collections;
namespace NCMB.Internal
{
//通信種別
internal enum ConnectType
{
//GET通信
GET,
//POST通信
POST,
//PUT通信
PUT,
//DELETE通信
DELETE
}
/// <summary>
/// 定数を定義する共通用のクラスです
/// </summary>
internal static class CommonConstant
{
//service
public static readonly string DOMAIN = "mb.api.cloud.nifty.com";//ドメイン
public static readonly string DOMAIN_URL = "https://mb.api.cloud.nifty.com";//ドメインのURL
public static readonly string API_VERSION = "2013-09-01";//APIバージョン
public static readonly string SDK_VERSION = "2.1.0"; //SDKバージョン
//DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください
}
}
|
/*******
Copyright 2014 NIFTY Corporation All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**********/
using System.Collections;
namespace NCMB.Internal
{
//通信種別
internal enum ConnectType
{
//GET通信
GET,
//POST通信
POST,
//PUT通信
PUT,
//DELETE通信
DELETE
}
/// <summary>
/// 定数を定義する共通用のクラスです
/// </summary>
internal static class CommonConstant
{
//service
public static readonly string DOMAIN = "mb.api.cloud.nifty.com";//ドメイン
public static readonly string DOMAIN_URL = "https://mb.api.cloud.nifty.com";//ドメインのURL
public static readonly string API_VERSION = "2013-09-01";//APIバージョン
public static readonly string SDK_VERSION = "2.0.2"; //SDKバージョン
//DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください
}
}
|
apache-2.0
|
C#
|
50635c6bf8c36db105a7a6f077483ffe9ae05fa9
|
Implement INotifyPropertyChanged for settings
|
Schlechtwetterfront/snipp
|
Settings/Settings.cs
|
Settings/Settings.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace clipman.Settings
{
public class Settings : INotifyPropertyChanged
{
public int ClipLimit;
private KeyGesture focusWindowHotkey = new KeyGesture(Key.OemTilde, ModifierKeys.Control);
public KeyGesture FocusWindowHotkey
{
get { return focusWindowHotkey; }
}
private KeyGesture focusSearchBox = new KeyGesture(Key.F, ModifierKeys.Control);
public KeyGesture FocusSearchBox
{
get { return focusSearchBox; }
}
private KeyGesture clearAndFocusSearchBox = new KeyGesture(Key.Escape);
public KeyGesture ClearAndFocusSearchBox
{
get { return clearAndFocusSearchBox; }
}
private KeyGesture copySelectedClip = new KeyGesture(Key.C, ModifierKeys.Control);
public KeyGesture CopySelectedClip
{
get { return copySelectedClip; }
}
private KeyGesture pinSelectedClip = new KeyGesture(Key.P, ModifierKeys.Control);
public KeyGesture PinSelectedClip
{
get { return pinSelectedClip; }
}
private KeyGesture quit = new KeyGesture(Key.Q, ModifierKeys.Control);
public KeyGesture Quit
{
get { return quit; }
}
public event PropertyChangedEventHandler PropertyChanged;
public void RaisePropertyChanged(string property)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace clipman.Settings
{
public class Settings
{
public int ClipLimit;
private KeyGesture focusWindowHotkey = new KeyGesture(Key.OemTilde, ModifierKeys.Control);
public KeyGesture FocusWindowHotkey
{
get { return focusWindowHotkey; }
}
private KeyGesture focusSearchBox = new KeyGesture(Key.F, ModifierKeys.Control);
public KeyGesture FocusSearchBox
{
get { return focusSearchBox; }
}
private KeyGesture clearAndFocusSearchBox = new KeyGesture(Key.Escape);
public KeyGesture ClearAndFocusSearchBox
{
get { return clearAndFocusSearchBox; }
}
private KeyGesture copySelectedClip = new KeyGesture(Key.C, ModifierKeys.Control);
public KeyGesture CopySelectedClip
{
get { return copySelectedClip; }
}
private KeyGesture pinSelectedClip = new KeyGesture(Key.P, ModifierKeys.Control);
public KeyGesture PinSelectedClip
{
get { return pinSelectedClip; }
}
private KeyGesture quit = new KeyGesture(Key.Q, ModifierKeys.Control);
public KeyGesture Quit
{
get { return quit; }
}
}
}
|
apache-2.0
|
C#
|
6c415f9e1915a580fa9847d6f8b0d09082471dc4
|
Add Persistence.CQL.Tests to InternalsVisibleTo
|
Abc-Arbitrage/Zebus,biarne-a/Zebus
|
src/Abc.Zebus.Testing/Properties/AssemblyInfo.cs
|
src/Abc.Zebus.Testing/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("Abc.Zebus.Testing")]
[assembly: ComVisible(false)]
[assembly: Guid("2b782073-d62a-4e5e-91ed-e5c2290974b3")]
[assembly: InternalsVisibleTo("Abc.Zebus.Tests")]
[assembly: InternalsVisibleTo("Abc.Zebus.Integration")]
[assembly: InternalsVisibleTo("Abc.Zebus.Persistence")]
[assembly: InternalsVisibleTo("Abc.Zebus.Persistence.Tests")]
[assembly: InternalsVisibleTo("Abc.Zebus.Persistence.CQL.Tests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Abc.Zebus.Testing")]
[assembly: ComVisible(false)]
[assembly: Guid("2b782073-d62a-4e5e-91ed-e5c2290974b3")]
[assembly: InternalsVisibleTo("Abc.Zebus.Tests")]
[assembly: InternalsVisibleTo("Abc.Zebus.Integration")]
[assembly: InternalsVisibleTo("Abc.Zebus.Persistence")]
[assembly: InternalsVisibleTo("Abc.Zebus.Persistence.Tests")]
|
mit
|
C#
|
b005d846e1129914a7b358a06135c08018f208bb
|
Refactor AppHarborClient#GetAppHarborApi to private field
|
appharbor/appharbor-cli
|
src/AppHarbor/AppHarborClient.cs
|
src/AppHarbor/AppHarborClient.cs
|
using System;
using System.Collections.Generic;
using AppHarbor.Model;
namespace AppHarbor
{
public class AppHarborClient : IAppHarborClient
{
private readonly AuthInfo _authInfo;
public AppHarborClient(string AccessToken)
{
_authInfo = new AuthInfo { AccessToken = AccessToken };
}
public CreateResult<string> CreateApplication(string name, string regionIdentifier = null)
{
return _api.CreateApplication(name, regionIdentifier);
}
public Application GetApplication(string id)
{
return _api.GetApplication(id);
}
public IEnumerable<Application> GetApplications()
{
return _api.GetApplications();
}
public User GetUser()
{
return _api.GetUser();
}
private AppHarborApi _api
{
get
{
try
{
return new AppHarborApi(_authInfo);
}
catch (ArgumentNullException)
{
throw new CommandException("You're not logged in. Log in with \"appharbor login\"");
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using AppHarbor.Model;
namespace AppHarbor
{
public class AppHarborClient : IAppHarborClient
{
private readonly AuthInfo _authInfo;
public AppHarborClient(string AccessToken)
{
_authInfo = new AuthInfo { AccessToken = AccessToken };
}
public CreateResult<string> CreateApplication(string name, string regionIdentifier = null)
{
var appHarborApi = GetAppHarborApi();
return appHarborApi.CreateApplication(name, regionIdentifier);
}
public Application GetApplication(string id)
{
var appHarborApi = GetAppHarborApi();
return appHarborApi.GetApplication(id);
}
public IEnumerable<Application> GetApplications()
{
var appHarborApi = GetAppHarborApi();
return appHarborApi.GetApplications();
}
public User GetUser()
{
var appHarborApi = GetAppHarborApi();
return appHarborApi.GetUser();
}
private AppHarborApi GetAppHarborApi()
{
try
{
return new AppHarborApi(_authInfo);
}
catch (ArgumentNullException)
{
throw new CommandException("You're not logged in. Log in with \"appharbor login\"");
}
}
}
}
|
mit
|
C#
|
174990b8147603eb127a5a43e4d8434cf919ad8c
|
Revert "AssemlyInformationalVersion updated."
|
nseckinoral/xomni-sdk-dotnet
|
src/Common/CommonAssemblyInfo.cs
|
src/Common/CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("XOMNI Inc.")]
[assembly: AssemblyCopyright("Copyright XOMNI Inc. 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0-alpha-002")]
|
using System.Reflection;
[assembly: AssemblyCompany("XOMNI Inc.")]
[assembly: AssemblyCopyright("Copyright XOMNI Inc. 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0.0")]
|
mit
|
C#
|
9e2288a2be3cd31a408d7bdbd0dbc98dbd015675
|
Increment version number
|
DavidAnson/nuproj,zbrad/nuproj,faustoscardovi/nuproj,nuproj/nuproj,AArnott/nuproj,oliver-feng/nuproj,ericstj/nuproj,NN---/nuproj,DavidAnson/nuproj,kovalikp/nuproj,PedroLamas/nuproj
|
src/Common/CommonAssemblyInfo.cs
|
src/Common/CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("Immo Landwerth")]
[assembly: AssemblyProduct("NuProj")]
[assembly: AssemblyCopyright("Copyright © Immo Landwerth")]
[assembly: AssemblyTrademark("")]
[assembly : AssemblyMetadata("PreRelease", "Beta")]
[assembly : AssemblyMetadata("ProjectUrl", "http://nuproj.codeplex.com")]
[assembly : AssemblyMetadata("LicenseUrl", "http://nuproj.codeplex.com/license")]
[assembly: AssemblyVersion("0.9.2.0")]
[assembly: AssemblyFileVersion("0.9.2.0")]
|
using System.Reflection;
[assembly: AssemblyCompany("Immo Landwerth")]
[assembly: AssemblyProduct("NuProj")]
[assembly: AssemblyCopyright("Copyright © Immo Landwerth")]
[assembly: AssemblyTrademark("")]
[assembly : AssemblyMetadata("PreRelease", "Beta")]
[assembly : AssemblyMetadata("ProjectUrl", "http://nuproj.codeplex.com")]
[assembly : AssemblyMetadata("LicenseUrl", "http://nuproj.codeplex.com/license")]
[assembly: AssemblyVersion("0.9.1.0")]
[assembly: AssemblyFileVersion("0.9.1.0")]
|
mit
|
C#
|
9a4748dae6a798d2b4ce5eb68419df19381ed47b
|
Update ObservableResource.cs
|
Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
src/Core2D/ObservableResource.cs
|
src/Core2D/ObservableResource.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using Core2D.Attributes;
namespace Core2D
{
/// <summary>
/// Observable resources base class.
/// </summary>
public abstract class ObservableResource : ObservableObject
{
private ImmutableArray<ObservableObject> _resources;
/// <summary>
/// Initializes a new instance of the <see cref="ObservableResource"/> class.
/// </summary>
public ObservableResource() : base() => _resources = ImmutableArray.Create<ObservableObject>();
/// <summary>
/// Gets or sets shape resources.
/// </summary>
[Content]
public ImmutableArray<ObservableObject> Resources
{
get => _resources;
set => Update(ref _resources, value);
}
/// <summary>
/// Check whether the <see cref="Resources"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public bool ShouldSerializeResources() => _resources.IsEmpty == false;
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using Core2D.Attributes;
namespace Core2D
{
/// <summary>
/// Observable resources base class.
/// </summary>
public abstract class ObservableResource : ObservableObject
{
private ImmutableArray<ObservableObject> _resources;
/// <summary>
/// Initializes a new instance of the <see cref="ObservableResource"/> class.
/// </summary>
public ObservableResource() : base() => Resources = ImmutableArray.Create<ObservableObject>();
/// <summary>
/// Gets or sets shape resources.
/// </summary>
[Content]
public ImmutableArray<ObservableObject> Resources
{
get => _resources;
set => Update(ref _resources, value);
}
/// <summary>
/// Check whether the <see cref="Resources"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public bool ShouldSerializeResources() => _resources.IsEmpty == false;
}
}
|
mit
|
C#
|
ce581586c34941bd70690a97a3ca25346080581c
|
Fix crazy doc-comment typo.
|
zaccharles/nodatime,malcolmr/nodatime,zaccharles/nodatime,malcolmr/nodatime,zaccharles/nodatime,zaccharles/nodatime,nodatime/nodatime,BenJenkinson/nodatime,BenJenkinson/nodatime,jskeet/nodatime,nodatime/nodatime,malcolmr/nodatime,malcolmr/nodatime,zaccharles/nodatime,jskeet/nodatime,zaccharles/nodatime
|
src/NodaTime/Utility/InvalidNodaDataException.cs
|
src/NodaTime/Utility/InvalidNodaDataException.cs
|
// Copyright 2013 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
namespace NodaTime.Utility
{
/// <summary>
/// Exception thrown when data read by Noda Time (such as serialized time zone data) is invalid.
/// </summary>
/// <remarks>
/// This type only exists as <c>InvalidDataException</c> doesn't exist in the Portable Class Library.
/// Unfortunately, <c>InvalidDataException</c> itself is sealed, so we can't derive from it for the sake
/// of backward compatibility.
/// </remarks>
/// <threadsafety>Any public static members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
/// See the thread safety section of the user guide for more information.
/// </threadsafety>
#if !PCL
[Serializable]
#endif
// TODO: Derive from IOException instead, like EndOfStreamException does?
public class InvalidNodaDataException : Exception
{
/// <summary>
/// Creates an instance with the given message.
/// </summary>
/// <param name="message">The message for the exception.</param>
public InvalidNodaDataException(string message) : base(message) { }
}
}
|
// Copyright 2013 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
namespace NodaTime.Utility
{
/// <summary>
/// Exception thrown when data read by Noda Time (such as serialized time zone data) is invalid.
/// </summary>
/// <remarks>
/// This type only exists as <c>InvalidDataException</c> doesn't exist in the Portable Class Library.
/// Unfortunately, <c>InvalidDataException itself is sealed, so we can't derive from it for the sake
/// of backward compatibility.</c>
/// </remarks>
/// <threadsafety>Any public static members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
/// See the thread safety section of the user guide for more information.
/// </threadsafety>
#if !PCL
[Serializable]
#endif
// TODO: Derive from IOException instead, like EndOfStreamException does?
public class InvalidNodaDataException : Exception
{
/// <summary>
/// Creates an instance with the given message.
/// </summary>
/// <param name="message">The message for the exception.</param>
public InvalidNodaDataException(string message) : base(message) { }
}
}
|
apache-2.0
|
C#
|
441ae4495be1dbe93d013dffecded6ff1e6da355
|
Add a copy constructor to InputState
|
ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ZLima12/osu-framework
|
osu.Framework/Input/States/InputState.cs
|
osu.Framework/Input/States/InputState.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.
namespace osu.Framework.Input.States
{
/// <summary>
/// An object that stores all input states.
/// </summary>
public class InputState
{
/// <summary>
/// The mouse state.
/// </summary>
public readonly MouseState Mouse;
/// <summary>
/// The keyboard state.
/// </summary>
public readonly KeyboardState Keyboard;
/// <summary>
/// The touch state.
/// </summary>
public readonly TouchState Touch;
/// <summary>
/// The joystick state.
/// </summary>
public readonly JoystickState Joystick;
/// <summary>
/// The midi state.
/// </summary>
public readonly MidiState Midi;
/// <summary>
/// Creates a new <see cref="InputState"/> using the individual input states from another <see cref="InputState"/>.
/// </summary>
/// <param name="other">The <see cref="InputState"/> to take the individual input states from.</param>
public InputState(InputState other)
: this(other.Mouse, other.Keyboard, other.Touch, other.Joystick, other.Midi)
{
}
/// <summary>
/// Creates a new <see cref="InputState"/> using given individual input states.
/// </summary>
/// <param name="mouse">The mouse state.</param>
/// <param name="keyboard">The keyboard state.</param>
/// <param name="touch">The touch state.</param>
/// <param name="joystick">The joystick state.</param>
/// <param name="midi">The midi state.</param>
public InputState(MouseState mouse = null, KeyboardState keyboard = null, TouchState touch = null, JoystickState joystick = null, MidiState midi = null)
{
Mouse = mouse ?? new MouseState();
Keyboard = keyboard ?? new KeyboardState();
Touch = touch ?? new TouchState();
Joystick = joystick ?? new JoystickState();
Midi = midi ?? new MidiState();
}
}
}
|
// 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.
namespace osu.Framework.Input.States
{
public class InputState
{
public readonly MouseState Mouse;
public readonly KeyboardState Keyboard;
public readonly TouchState Touch;
public readonly JoystickState Joystick;
public readonly MidiState Midi;
public InputState(MouseState mouse = null, KeyboardState keyboard = null, TouchState touch = null, JoystickState joystick = null, MidiState midi = null)
{
Mouse = mouse ?? new MouseState();
Keyboard = keyboard ?? new KeyboardState();
Touch = touch ?? new TouchState();
Joystick = joystick ?? new JoystickState();
Midi = midi ?? new MidiState();
}
}
}
|
mit
|
C#
|
ffb18b364191f9a32b6a4bbc4df2b8f4c6df4e92
|
Make SegmentedAddonFileInfo use cached values, (very) slight performance improvement.
|
icedream/gmadsharp
|
src/addoncreator/Addon/SegmentedAddonFileInfo.cs
|
src/addoncreator/Addon/SegmentedAddonFileInfo.cs
|
using System;
using System.IO;
namespace GarrysMod.AddonCreator.Addon
{
public class SegmentedAddonFileInfo : AddonFileInfo
{
private readonly long _len;
private readonly long _pos;
private readonly Stream _stream;
private int _hash;
public SegmentedAddonFileInfo(Stream stream, long pos, long len, int fileHash)
{
_stream = stream;
_pos = pos;
_len = len;
_hash = fileHash;
}
public override long Size
{
get
{
return _len;
}
}
public override int Crc32Hash
{
get { return _hash; }
}
public override byte[] GetContents()
{
lock (_stream)
{
var output = new byte[_len];
var oldpos = _stream.Position;
_stream.Position = _pos;
for (long i = 0; i < _len; i += int.MaxValue) // for-loop for supporting long file sizes
{
var toRead = (int) Math.Min(int.MaxValue, _len);
var buffer = new byte[toRead];
var readReal = _stream.Read(buffer, 0, toRead);
buffer.CopyTo(output, i);
i -= (toRead - readReal); // make absolutely sure everything gets read
}
_stream.Position = oldpos;
return output;
}
}
}
}
|
using System;
using System.IO;
namespace GarrysMod.AddonCreator.Addon
{
public class SegmentedAddonFileInfo : AddonFileInfo
{
private readonly long _len;
private readonly long _pos;
private readonly Stream _stream;
private int _hash;
public SegmentedAddonFileInfo(Stream stream, long pos, long len, int fileHash)
{
_stream = stream;
_pos = pos;
_len = len;
_hash = fileHash;
}
public override byte[] GetContents()
{
lock (_stream)
{
var output = new byte[_len];
var oldpos = _stream.Position;
_stream.Position = _pos;
for (long i = 0; i < _len; i += int.MaxValue) // for-loop for supporting long file sizes
{
var toRead = (int) Math.Min(int.MaxValue, _len);
var buffer = new byte[toRead];
var readReal = _stream.Read(buffer, 0, toRead);
buffer.CopyTo(output, i);
i -= (toRead - readReal); // make absolutely sure everything gets read
}
_stream.Position = oldpos;
return output;
}
}
}
}
|
mit
|
C#
|
939702085ef2c8a6eaf389eb4fbd7adc34309c87
|
Remove strange failing tests
|
anthonylangsworth/Meraki
|
src/MerakiDashboard.Test/TestUnixTimestampConverter.cs
|
src/MerakiDashboard.Test/TestUnixTimestampConverter.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
namespace MerakiDashboard.Test
{
public class TestUnixTimestampConverter
{
[Theory]
[MemberData(nameof(ConvertTestData))]
public void Convert(double timestamp, DateTime expectedDateTime)
{
Assert.Equal(expectedDateTime, UnixTimestampConverter.ToDateTime(timestamp));
Assert.Equal(timestamp, UnixTimestampConverter.FromDateTime(UnixTimestampConverter.ToDateTime(timestamp)), 3);
}
public static IEnumerable<object[]> ConvertTestData()
{
yield return new object[] { "1474918068.66194", DateTime.Parse("2016-09-26T19:27:48.6620000") };
//yield return new object[] { "1474918295.0268", DateTime.Parse("2016-05-05T19:56:57.9490000") };
//yield return new object[] { "1462478217.94907", DateTime.Parse("2016-05-05T19:56:57.9490000") };
yield return new object[] { "0.0", UnixTimestampConverter.EpochStart };
yield return new object[] { "-100.0", UnixTimestampConverter.EpochStart.AddSeconds(-100.0) };
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
namespace MerakiDashboard.Test
{
public class TestUnixTimestampConverter
{
[Theory]
[MemberData(nameof(ConvertTestData))]
public void Convert(double timestamp, DateTime expectedDateTime)
{
Assert.Equal(expectedDateTime, UnixTimestampConverter.ToDateTime(timestamp));
Assert.Equal(timestamp, UnixTimestampConverter.FromDateTime(UnixTimestampConverter.ToDateTime(timestamp)), 3);
}
public static IEnumerable<object[]> ConvertTestData()
{
yield return new object[] { "1474918068.66194", DateTime.Parse("2016-09-26T19:27:48.6620000") };
yield return new object[] { "1474918295.0268", DateTime.Parse("2016-05-05T19:56:57.9490000") };
yield return new object[] { "1462478217.94907", DateTime.Parse("2016-05-05T19:56:57.9490000") };
yield return new object[] { "0.0", UnixTimestampConverter.EpochStart };
yield return new object[] { "-100.0", UnixTimestampConverter.EpochStart.AddSeconds(-100.0) };
}
}
}
|
mit
|
C#
|
e5e3fb4b0f647d70d8e468d177946d3fe91b0d68
|
Bump version, to make nightly builds appear newer.
|
wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,MrDaedra/Avalonia,MrDaedra/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,akrisiun/Perspex,jazzay/Perspex,SuperJMN/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex
|
src/Shared/SharedAssemblyInfo.cs
|
src/Shared/SharedAssemblyInfo.cs
|
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
[assembly: AssemblyCompany("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("Copyright AvaloniaUI 2016")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Avalonia")]
[assembly: AssemblyTrademark("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.5.2")]
[assembly: AssemblyFileVersion("0.5.2")]
[assembly: AssemblyInformationalVersion("0.5.2")]
|
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
[assembly: AssemblyCompany("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("Copyright AvaloniaUI 2016")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Avalonia")]
[assembly: AssemblyTrademark("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.5.1")]
[assembly: AssemblyFileVersion("0.5.1")]
[assembly: AssemblyInformationalVersion("0.5.1")]
|
mit
|
C#
|
ee14cff24a0517c845ab994d3e5f4ba088b55ba1
|
Update StorageBase.cs
|
A51UK/File-Repository
|
File-Repository/StorageBase.cs
|
File-Repository/StorageBase.cs
|
/*
* Copyright 2017 Craig Lee Mark Adams
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*
*
* */
using System;
using System.IO;
using System.Threading.Tasks;
namespace File_Repository
{
public abstract class StorageBase
{
public abstract Task<string> SaveAsync(FileSetOptions fileSetOptions);
public abstract Task<FileData> GetAsync(FileGetOptions fileGetOptions);
}
}
|
/*
* Copyright 2017 Criag Lee Mark Adams
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*
*
* */
using System;
using System.IO;
using System.Threading.Tasks;
namespace File_Repository
{
public abstract class StorageBase
{
public abstract Task<string> SaveAsync(FileSetOptions fileSetOptions);
public abstract Task<FileData> GetAsync(FileGetOptions fileGetOptions);
}
}
|
apache-2.0
|
C#
|
2d0c924bdf579bd935f1eaf9fa19ce50aba39d5f
|
Add xmldoc for MaxStarDifficulty and MaxLength
|
smoogipoo/osu,ppy/osu,ppy/osu,EVAST9919/osu,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,EVAST9919/osu,NeoAdonis/osu,peppy/osu,ZLima12/osu,UselessToucan/osu,2yangk23/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,johnneijzen/osu,johnneijzen/osu,ZLima12/osu,ppy/osu,smoogipooo/osu,peppy/osu
|
osu.Game/Beatmaps/BeatmapSetInfo.cs
|
osu.Game/Beatmaps/BeatmapSetInfo.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using osu.Game.Database;
namespace osu.Game.Beatmaps
{
public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles<BeatmapSetFileInfo>, ISoftDelete, IEquatable<BeatmapSetInfo>
{
public int ID { get; set; }
private int? onlineBeatmapSetID;
public int? OnlineBeatmapSetID
{
get => onlineBeatmapSetID;
set => onlineBeatmapSetID = value > 0 ? value : null;
}
public DateTimeOffset DateAdded { get; set; }
public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None;
public BeatmapMetadata Metadata { get; set; }
public List<BeatmapInfo> Beatmaps { get; set; }
[NotMapped]
public BeatmapSetOnlineInfo OnlineInfo { get; set; }
[NotMapped]
public BeatmapSetMetrics Metrics { get; set; }
/// <summary>
/// The maximum star difficulty of all beatmaps in this set.
/// </summary>
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0;
/// <summary>
/// The maximum playable length of all beatmaps in this set.
/// </summary>
public double MaxLength => Beatmaps?.Max(b => b.Length) ?? 0;
[NotMapped]
public bool DeletePending { get; set; }
public string Hash { get; set; }
public string StoryboardFile => Files?.Find(f => f.Filename.EndsWith(".osb"))?.Filename;
public List<BeatmapSetFileInfo> Files { get; set; }
public override string ToString() => Metadata?.ToString() ?? base.ToString();
public bool Protected { get; set; }
public bool Equals(BeatmapSetInfo other) => OnlineBeatmapSetID == other?.OnlineBeatmapSetID;
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using osu.Game.Database;
namespace osu.Game.Beatmaps
{
public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles<BeatmapSetFileInfo>, ISoftDelete, IEquatable<BeatmapSetInfo>
{
public int ID { get; set; }
private int? onlineBeatmapSetID;
public int? OnlineBeatmapSetID
{
get => onlineBeatmapSetID;
set => onlineBeatmapSetID = value > 0 ? value : null;
}
public DateTimeOffset DateAdded { get; set; }
public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None;
public BeatmapMetadata Metadata { get; set; }
public List<BeatmapInfo> Beatmaps { get; set; }
[NotMapped]
public BeatmapSetOnlineInfo OnlineInfo { get; set; }
[NotMapped]
public BeatmapSetMetrics Metrics { get; set; }
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0;
public double MaxLength => Beatmaps?.Max(b => b.Length) ?? 0;
[NotMapped]
public bool DeletePending { get; set; }
public string Hash { get; set; }
public string StoryboardFile => Files?.Find(f => f.Filename.EndsWith(".osb"))?.Filename;
public List<BeatmapSetFileInfo> Files { get; set; }
public override string ToString() => Metadata?.ToString() ?? base.ToString();
public bool Protected { get; set; }
public bool Equals(BeatmapSetInfo other) => OnlineBeatmapSetID == other?.OnlineBeatmapSetID;
}
}
|
mit
|
C#
|
562c9e56fbda6c85dc2ab98402296ec461232eeb
|
Fix naming
|
naoey/osu,NeoAdonis/osu,ZLima12/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,EVAST9919/osu,ppy/osu,DrabWeb/osu,smoogipoo/osu,UselessToucan/osu,DrabWeb/osu,ZLima12/osu,UselessToucan/osu,naoey/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,DrabWeb/osu,smoogipoo/osu,naoey/osu,johnneijzen/osu,peppy/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,2yangk23/osu,EVAST9919/osu,2yangk23/osu
|
osu.Game/Screens/Select/BeatmapClearScoresDialog.cs
|
osu.Game/Screens/Select/BeatmapClearScoresDialog.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Overlays.Dialog;
using osu.Game.Scoring;
using System;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Screens.Select
{
public class BeatmapClearScoresDialog : PopupDialog
{
private ScoreManager manager;
[BackgroundDependencyLoader]
private void load(ScoreManager scoreManager)
{
manager = scoreManager;
}
public BeatmapClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable<ScoreInfo> scores, Action refresh)
{
BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}";
Icon = FontAwesome.fa_eraser;
HeaderText = $@"Clearing {scores.Count()} local score(s). Are you sure?";
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Please.",
Action = () =>
{
manager.Delete(scores.ToList());
refresh();
}
},
new PopupDialogCancelButton
{
Text = @"No, I'm still attached.",
},
};
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Overlays.Dialog;
using osu.Game.Scoring;
using System;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Screens.Select
{
public class BeatmapClearScoresDialog : PopupDialog
{
private ScoreManager manager;
[BackgroundDependencyLoader]
private void load(ScoreManager beatmapManager)
{
manager = beatmapManager;
}
public BeatmapClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable<ScoreInfo> scores, Action refresh)
{
BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}";
Icon = FontAwesome.fa_eraser;
HeaderText = $@"Clearing {scores.Count()} local score(s). Are you sure?";
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Please.",
Action = () =>
{
manager.Delete(scores.ToList());
refresh();
}
},
new PopupDialogCancelButton
{
Text = @"No, I'm still attached.",
},
};
}
}
}
|
mit
|
C#
|
f14945358a37016500e30448de40db7307c309a7
|
Use symlinks instead of Windows shortcuts on Linux
|
nano-byte/LightTag
|
ResultSet.cs
|
ResultSet.cs
|
/*
* Copyright 2014 Bastian Eicher
*
* 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.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using IWshRuntimeLibrary;
using NanoByte.Common.Storage;
using NanoByte.Common.Utils;
namespace NanoByte.LightTag
{
public sealed class ResultSet
{
private readonly WshShellClass _wshShell = new WshShellClass();
private readonly DirectoryInfo _directory;
public ResultSet()
{
_directory = new DirectoryInfo(new[] {Locations.UserCacheDir, "LightTag", "Results", DateTime.Now.ToUnixTime().ToString(CultureInfo.InvariantCulture)}.Aggregate(Path.Combine));
_directory.Create();
}
public void Show()
{
Process.Start(new ProcessStartInfo(_directory.FullName) {UseShellExecute = true});
}
public void Add(FileInfo file)
{
string linkPath = Path.Combine(_directory.FullName, file.Name);
if (WindowsUtils.IsWindows)
{
var shortcut = (IWshShortcut)_wshShell.CreateShortcut(linkPath + ".lnk");
shortcut.TargetPath = file.FullName;
shortcut.Save();
}
else if (UnixUtils.IsUnix) UnixUtils.CreateSymlink(linkPath, file.FullName);
}
}
}
|
/*
* Copyright 2014 Bastian Eicher
*
* 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.Diagnostics;
using System.IO;
using System.Linq;
using IWshRuntimeLibrary;
using NanoByte.Common.Storage;
using NanoByte.Common.Utils;
namespace NanoByte.LightTag
{
public sealed class ResultSet
{
private readonly WshShellClass _wshShell = new WshShellClass();
private readonly DirectoryInfo _directory;
public ResultSet()
{
_directory = new DirectoryInfo(new[] {Locations.UserCacheDir, "LightTag", "Results", DateTime.Now.ToUnixTime().ToString()}.Aggregate(Path.Combine));
_directory.Create();
}
public void Show()
{
Process.Start(new ProcessStartInfo(_directory.FullName) {UseShellExecute = true});
}
public void Add(FileInfo file)
{
var shortcut = (IWshShortcut)_wshShell.CreateShortcut(Path.Combine(_directory.FullName, file.Name + ".lnk"));
shortcut.TargetPath = file.FullName;
shortcut.Save();
}
}
}
|
mit
|
C#
|
90c6e2f64f444bfdd3c784f9f3d55c2dc7c36f20
|
Make team result read-only
|
brwml/MatchMakerTool
|
Reporting/Models/TeamResult.cs
|
Reporting/Models/TeamResult.cs
|
namespace MatchMaker.Reporting.Models;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Xml.Linq;
using Ardalis.GuardClauses;
/// <summary>
/// Defines the <see cref="TeamResult" />
/// </summary>
[DataContract]
[DebuggerDisplay("Team Result (Team {TeamId}, Score {Score}, Errors {Errors}, Place {Place})")]
public class TeamResult
{
/// <summary>
/// Initializes a new instance of the <see cref="TeamResult"/> class.
/// </summary>
/// <param name="id">The team identifier</param>
/// <param name="score">The team score</param>
/// <param name="errors">The team score</param>
/// <param name="place">The team place</param>
public TeamResult(int id, int score, int errors, int place = 1)
{
this.TeamId = id;
this.Score = score;
this.Errors = errors;
this.Place = place;
}
/// <summary>
/// Gets or sets the Errors
/// </summary>
[DataMember]
public int Errors { get; }
/// <summary>
/// Gets or sets the Place
/// </summary>
[DataMember]
public int Place { get; }
/// <summary>
/// Gets or sets the Score
/// </summary>
[DataMember]
public int Score { get; }
/// <summary>
/// Gets or sets the team identifier
/// </summary>
[DataMember]
public int TeamId { get; }
/// <summary>
/// Creates a <see cref="TeamResult"/> from an <see cref="XElement"/>
/// </summary>
/// <param name="xml">The <see cref="XElement"/></param>
/// <returns>The <see cref="TeamResult"/></returns>
public static TeamResult FromXml(XElement xml)
{
Guard.Against.Null(xml, nameof(xml));
return new TeamResult(
xml.GetAttribute<int>("id"),
xml.GetAttribute<int>("score"),
xml.GetAttribute<int>("errors"),
xml.GetAttribute<int>("place"));
}
/// <summary>
/// Converts the <see cref="TeamResult"/> instance to XML.
/// </summary>
/// <returns>The <see cref="XElement"/> instance</returns>
public XElement ToXml()
{
return new XElement(
"team",
new XAttribute("id", this.TeamId),
new XAttribute("score", this.Score),
new XAttribute("errors", this.Errors),
new XAttribute("place", this.Place));
}
}
|
namespace MatchMaker.Reporting.Models;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Xml.Linq;
using Ardalis.GuardClauses;
/// <summary>
/// Defines the <see cref="TeamResult" />
/// </summary>
[DataContract]
[DebuggerDisplay("Team Result (Team {TeamId}, Score {Score}, Errors {Errors}, Place {Place})")]
public class TeamResult
{
/// <summary>
/// Gets or sets the Errors
/// </summary>
[DataMember]
public int Errors { get; set; }
/// <summary>
/// Gets or sets the Place
/// </summary>
[DataMember]
public int Place { get; set; }
/// <summary>
/// Gets or sets the Score
/// </summary>
[DataMember]
public int Score { get; set; }
/// <summary>
/// Gets or sets the team identifier
/// </summary>
[DataMember]
public int TeamId { get; set; }
/// <summary>
/// Creates a <see cref="TeamResult"/> from an <see cref="XElement"/>
/// </summary>
/// <param name="xml">The <see cref="XElement"/></param>
/// <returns>The <see cref="TeamResult"/></returns>
public static TeamResult FromXml(XElement xml)
{
Guard.Against.Null(xml, nameof(xml));
return new TeamResult
{
TeamId = xml.GetAttribute<int>("id"),
Score = xml.GetAttribute<int>("score"),
Errors = xml.GetAttribute<int>("errors"),
Place = xml.GetAttribute<int>("place")
};
}
/// <summary>
/// Converts the <see cref="TeamResult"/> instance to XML.
/// </summary>
/// <returns>The <see cref="XElement"/> instance</returns>
public XElement ToXml()
{
return new XElement(
"team",
new XAttribute("id", this.TeamId),
new XAttribute("score", this.Score),
new XAttribute("errors", this.Errors),
new XAttribute("place", this.Place));
}
}
|
mit
|
C#
|
052c816259b528cbb3247e245cd9c766e69f868b
|
Use ReadOnlyCollection for extensions.
|
GetTabster/Tabster.Data
|
FileType.cs
|
FileType.cs
|
#region
using System.Collections.Generic;
using System.Collections.ObjectModel;
#endregion
namespace Tabster.Data
{
public sealed class FileType
{
private readonly List<string> _extensions = new List<string>();
public FileType(string name, IEnumerable<string> extensions)
{
Name = name;
_extensions.AddRange(extensions);
}
public FileType(string name, string extension)
: this(name, new[] {extension})
{
}
public string Name { get; set; }
public ReadOnlyCollection<string> Extensions
{
get { return _extensions.AsReadOnly(); }
}
public string Extension
{
get { return Extensions.Count > 0 ? Extensions[0] : null; }
}
}
}
|
#region
using System.Collections.Generic;
using System.Collections.ObjectModel;
#endregion
namespace Tabster.Data
{
public sealed class FileType
{
public readonly Collection<string> Extensions;
public FileType(string name, IList<string> extensions)
{
Name = name;
Extensions = new Collection<string>(extensions);
}
public FileType(string name, string extension)
: this(name, new[] {extension})
{
}
public string Name { get; set; }
public string Extension
{
get { return Extensions.Count > 0 ? Extensions[0] : null; }
}
}
}
|
apache-2.0
|
C#
|
e9bd87545e47af17f8226f3850b906a147217883
|
Fix flaky test in free mod select test scene
|
peppy/osu,ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,peppy/osu
|
osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs
|
osu.Game.Tests/Visual/Multiplayer/TestSceneFreeModSelectScreen.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Overlays.Mods;
using osu.Game.Screens.OnlinePlay;
namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneFreeModSelectScreen : MultiplayerTestScene
{
[Test]
public void TestFreeModSelect()
{
FreeModSelectScreen freeModSelectScreen = null;
AddStep("create free mod select screen", () => Child = freeModSelectScreen = new FreeModSelectScreen
{
State = { Value = Visibility.Visible }
});
AddUntilStep("all column content loaded",
() => freeModSelectScreen.ChildrenOfType<ModColumn>().Any()
&& freeModSelectScreen.ChildrenOfType<ModColumn>().All(column => column.IsLoaded && column.ItemsLoaded));
AddUntilStep("all visible mods are playable",
() => this.ChildrenOfType<ModPanel>()
.Where(panel => panel.IsPresent)
.All(panel => panel.Mod.HasImplementation && panel.Mod.UserPlayable));
AddToggleStep("toggle visibility", visible =>
{
if (freeModSelectScreen != null)
freeModSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden;
});
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Overlays.Mods;
using osu.Game.Screens.OnlinePlay;
namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneFreeModSelectScreen : MultiplayerTestScene
{
[Test]
public void TestFreeModSelect()
{
FreeModSelectScreen freeModSelectScreen = null;
AddStep("create free mod select screen", () => Child = freeModSelectScreen = new FreeModSelectScreen
{
State = { Value = Visibility.Visible }
});
AddAssert("all visible mods are playable",
() => this.ChildrenOfType<ModPanel>()
.Where(panel => panel.IsPresent)
.All(panel => panel.Mod.HasImplementation && panel.Mod.UserPlayable));
AddToggleStep("toggle visibility", visible =>
{
if (freeModSelectScreen != null)
freeModSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden;
});
}
}
}
|
mit
|
C#
|
7292ca9734e3c36f5bdb743c9a63af35c27454b0
|
add file path to component list. fixes #19
|
pburls/dewey
|
Dewey.ListItems/Component.cs
|
Dewey.ListItems/Component.cs
|
using Dewey.State;
using System;
using System.Collections.Generic;
namespace Dewey.ListItems
{
static class ComponentExtensions
{
public static void Write(this Component component)
{
Console.ForegroundColor = (ConsoleColor)ItemColor.ComponentItem;
Console.WriteLine(component.BuildDescription());
}
public static void Write(this Component component, Stack<ItemColor> offsets)
{
offsets.WriteOffsets();
Console.ForegroundColor = (ConsoleColor)ItemColor.ComponentItem;
Console.WriteLine("├ {0}", component.BuildDescription());
}
private static string BuildDescription(this Component component)
{
string type = component.ComponentManifest.Type;
if (!string.IsNullOrWhiteSpace(component.ComponentManifest.SubType))
{
type = string.Format("{0}-{1}", type, component.ComponentManifest.SubType);
}
return string.Format("{0} ({1}) - \"{2}\"", component.ComponentManifest.Name, type, component.ComponentManifest.File.DirectoryName);
}
}
}
|
using Dewey.State;
using System;
using System.Collections.Generic;
namespace Dewey.ListItems
{
static class ComponentExtensions
{
public static void Write(this Component component)
{
Console.ForegroundColor = (ConsoleColor)ItemColor.ComponentItem;
Console.WriteLine(component.BuildDescription());
}
public static void Write(this Component component, Stack<ItemColor> offsets)
{
offsets.WriteOffsets();
Console.ForegroundColor = (ConsoleColor)ItemColor.ComponentItem;
Console.WriteLine("├ {0}", component.BuildDescription());
}
private static string BuildDescription(this Component component)
{
string type = component.ComponentManifest.Type;
if (!string.IsNullOrWhiteSpace(component.ComponentManifest.SubType))
{
type = string.Format("{0}-{1}", type, component.ComponentManifest.SubType);
}
return string.Format("{0} ({1})", component.ComponentManifest.Name, type);
}
}
}
|
mit
|
C#
|
2cf5a5f9374b88442cabe56c861637aeb0e92a17
|
Update SP and CU last version
|
KankuruSQL/KMO
|
KVersion.cs
|
KVersion.cs
|
namespace KMO
{
public static class KVersion
{
public const int Sp2017 = 1000;
public const int Cu2017 = 1000;
public const int Sp2016 = 4001;
public const int Cu2016 = 4451;
public const int Sp2014 = 5000;
public const int Cu2014 = 5556;
public const int Sp2012 = 7001;
public const int Cu2012 = 7001;
public const int Sp2008R2 = 6000;
public const int Cu2008R2 = 6542;
public const int Sp2008 = 6000;
public const int Cu2008 = 6547;
public const int Sp2005 = 5000;
public const int Cu2005 = 5324;
public const string Sp2017Link = "https://www.microsoft.com/en-us/sql-server/sql-server-downloads";
public const string Cu2017Link = "https://www.microsoft.com/en-us/sql-server/sql-server-downloads";
public const string Sp2016Link = "https://www.microsoft.com/en-us/download/details.aspx?id=54276";
public const string Cu2016Link = "https://support.microsoft.com/en-us/help/4040714";
public const string Sp2014Link = "https://www.microsoft.com/en-us/download/details.aspx?id=53168";
public const string Cu2014Link = "https://support.microsoft.com/en-us/help/4032541";
public const string Sp2012Link = "https://www.microsoft.com/en-us/download/details.aspx?id=56040";
public const string Cu2012Link = "https://www.microsoft.com/en-us/download/details.aspx?id=56040";
public const string Sp2008R2Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44271";
public const string Cu2008R2Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2008Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44278";
public const string Cu2008Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2005Link = "http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b953e84f-9307-405e-bceb-47bd345baece";
public const string Cu2005Link = "http://support.microsoft.com/kb/2716427";
}
}
|
namespace KMO
{
public static class KVersion
{
public const int Sp2017 = 800;
public const int Cu2017 = 800;
public const int Sp2016 = 4001;
public const int Cu2016 = 4435;
public const int Sp2014 = 5000;
public const int Cu2014 = 5546;
public const int Sp2012 = 6020;
public const int Cu2012 = 6598;
public const int Sp2008R2 = 6000;
public const int Cu2008R2 = 6542;
public const int Sp2008 = 6000;
public const int Cu2008 = 6547;
public const int Sp2005 = 5000;
public const int Cu2005 = 5324;
public const string Sp2017Link = "https://www.microsoft.com/en-us/evalcenter/evaluate-sql-server-2017-ctp";
public const string Cu2017Link = "https://www.microsoft.com/en-us/evalcenter/evaluate-sql-server-2017-ctp";
public const string Sp2016Link = "https://www.microsoft.com/en-us/download/details.aspx?id=54276";
public const string Cu2016Link = "https://support.microsoft.com/en-us/help/4019916";
public const string Sp2014Link = "https://www.microsoft.com/en-us/download/details.aspx?id=53168";
public const string Cu2014Link = "https://support.microsoft.com/en-us/help/4013098";
public const string Sp2012Link = "https://www.microsoft.com/en-us/download/details.aspx?id=49996";
public const string Cu2012Link = "https://support.microsoft.com/en-us/help/4016762";
public const string Sp2008R2Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44271";
public const string Cu2008R2Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2008Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44278";
public const string Cu2008Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2005Link = "http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b953e84f-9307-405e-bceb-47bd345baece";
public const string Cu2005Link = "http://support.microsoft.com/kb/2716427";
}
}
|
mit
|
C#
|
1c38e280b1444439f4b9163830dc7d6ded66b6ea
|
Introduce constant
|
EamonNerbonne/ValueUtils,EamonNerbonne/ValueUtils,EamonNerbonne/ValueUtils
|
ValueUtils/ReflectionHelper.cs
|
ValueUtils/ReflectionHelper.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ValueUtils
{
static class ReflectionHelper
{
public static IEnumerable<Type> WalkMeaningfulInheritanceChain(Type type)
{
if (type.IsValueType) {
yield return type;
yield break;
}
while (type != typeof(object)) {
yield return type;
type = type.BaseType;
}
}
const BindingFlags OnlyDeclaredInstanceMembers =
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
public static IEnumerable<FieldInfo> GetAllFields(Type type)
=> WalkMeaningfulInheritanceChain(type).Reverse()
.SelectMany(t => t.GetFields(OnlyDeclaredInstanceMembers));
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ValueUtils
{
static class ReflectionHelper
{
public static IEnumerable<Type> WalkMeaningfulInheritanceChain(Type type)
{
if (type.IsValueType) {
yield return type;
yield break;
}
while (type != typeof(object)) {
yield return type;
type = type.BaseType;
}
}
public static IEnumerable<FieldInfo> GetAllFields(Type type)
=> WalkMeaningfulInheritanceChain(type).Reverse()
.SelectMany(t => t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly));
}
}
|
apache-2.0
|
C#
|
def9cd7562683266c5323fc83da361bc349242f3
|
Change to one second
|
mvno/Okanshi,mvno/Okanshi,mvno/Okanshi
|
tests/Okanshi.Tests/StepCounterTest.cs
|
tests/Okanshi.Tests/StepCounterTest.cs
|
using System;
using System.Threading;
using FluentAssertions;
using Xunit;
namespace Okanshi.Test
{
public class StepCounterTest
{
[Fact]
public void Value_is_zero_if_multiple_steps_has_not_been_crossed()
{
var stepCounter = new StepCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(500));
var value = stepCounter.GetValue();
value.Should().Be(0);
}
[Fact]
public void Value_is_NaN_if_more_than_one_step_has_been_crossed_without_value_has_been_incremented()
{
var stepCounter = new StepCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(500));
stepCounter.GetValue();
Thread.Sleep(500 * 3);
var value = stepCounter.GetValue();
value.Should().Be(double.NaN);
}
[Theory]
[InlineData(1, 0.001)]
[InlineData(5, 0.005)]
public void Value_is_number_of_counts_per_interval_in_previous_step(int amount, float expectedValue)
{
var stepCounter = new StepCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(1000));
stepCounter.Increment(amount);
stepCounter.GetValue();
Thread.Sleep(1100);
var value = stepCounter.GetValue();
value.Should().BeApproximately(expectedValue, 0.001);
}
[Theory]
[InlineData(1, 2)]
[InlineData(5, 10)]
public void Incrementing_counter_does_not_affect_current_interval(int amount, int expectedValue)
{
var stepCounter = new StepCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(500));
stepCounter.Increment(amount);
var value = stepCounter.GetValue();
value.Should().Be(0);
}
}
}
|
using System;
using System.Threading;
using FluentAssertions;
using Xunit;
namespace Okanshi.Test
{
public class StepCounterTest
{
[Fact]
public void Value_is_zero_if_multiple_steps_has_not_been_crossed()
{
var stepCounter = new StepCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(500));
var value = stepCounter.GetValue();
value.Should().Be(0);
}
[Fact]
public void Value_is_NaN_if_more_than_one_step_has_been_crossed_without_value_has_been_incremented()
{
var stepCounter = new StepCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(500));
stepCounter.GetValue();
Thread.Sleep(500 * 3);
var value = stepCounter.GetValue();
value.Should().Be(double.NaN);
}
[Theory]
[InlineData(1, 0.002)]
[InlineData(5, 0.01)]
public void Value_is_number_of_counts_per_interval_in_previous_step(int amount, float expectedValue)
{
var stepCounter = new StepCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(500));
stepCounter.Increment(amount);
stepCounter.GetValue();
Thread.Sleep(600);
var value = stepCounter.GetValue();
value.Should().BeApproximately(expectedValue, 0.001);
}
[Theory]
[InlineData(1, 2)]
[InlineData(5, 10)]
public void Incrementing_counter_does_not_affect_current_interval(int amount, int expectedValue)
{
var stepCounter = new StepCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(500));
stepCounter.Increment(amount);
var value = stepCounter.GetValue();
value.Should().Be(0);
}
}
}
|
mit
|
C#
|
bbd59f52f1239dec04648c6d161ef25c34f1aae6
|
Verify that the parsed date time has time zone information
|
messagebird/csharp-rest-api
|
MessageBird/Json/Converters/RFC3339DateTimeConverter.cs
|
MessageBird/Json/Converters/RFC3339DateTimeConverter.cs
|
using System;
using MessageBird.Utilities;
using Newtonsoft.Json;
namespace MessageBird.Json.Converters
{
class RFC3339DateTimeConverter : JsonConverter
{
private const string Format = "yyyy-MM-dd'T'HH:mm:ssK";
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
if (value is DateTime)
{
var dateTime = (DateTime)value;
if (dateTime.Kind == DateTimeKind.Unspecified)
{
throw new JsonSerializationException("Cannot convert date time with an unspecified kind");
}
string convertedDateTime = dateTime.ToString(Format);
writer.WriteValue(convertedDateTime);
}
else
{
throw new JsonSerializationException("Expected value of type 'DateTime'.");
}
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
Type t = (ReflectionUtils.IsNullable(objectType))
? Nullable.GetUnderlyingType(objectType)
: objectType;
if (reader.TokenType == JsonToken.Null)
{
return null;
}
if (reader.TokenType == JsonToken.Date)
{
var dateTime = (DateTime)reader.Value;
if (dateTime.Kind == DateTimeKind.Unspecified)
{
throw new JsonSerializationException("Parsed date time is not in the expected RFC3339 format");
}
return dateTime;
}
throw new JsonSerializationException(String.Format("Unexpected token '{0}' when parsing date.", reader.TokenType));
}
public override bool CanConvert(Type objectType)
{
Type t = (ReflectionUtils.IsNullable(objectType))
? Nullable.GetUnderlyingType(objectType)
: objectType;
return t == typeof(DateTime);
}
}
}
|
using System;
using MessageBird.Utilities;
using Newtonsoft.Json;
namespace MessageBird.Json.Converters
{
class RFC3339DateTimeConverter : JsonConverter
{
private const string Format = "yyyy-MM-dd'T'HH:mm:ssK";
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
if (value is DateTime)
{
var dateTime = (DateTime)value;
if (dateTime.Kind == DateTimeKind.Unspecified)
{
throw new JsonSerializationException("Cannot convert date time with an unspecified kind");
}
string convertedDateTime = dateTime.ToString(Format);
writer.WriteValue(convertedDateTime);
}
else
{
throw new JsonSerializationException("Expected value of type 'DateTime'.");
}
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
Type t = (ReflectionUtils.IsNullable(objectType))
? Nullable.GetUnderlyingType(objectType)
: objectType;
if (reader.TokenType == JsonToken.Null)
{
return null;
}
if (reader.TokenType == JsonToken.Date)
{
return reader.Value;
}
throw new JsonSerializationException(String.Format("Unexpected token '{0}' when parsing date.", reader.TokenType));
}
public override bool CanConvert(Type objectType)
{
Type t = (ReflectionUtils.IsNullable(objectType))
? Nullable.GetUnderlyingType(objectType)
: objectType;
return t == typeof(DateTime);
}
}
}
|
isc
|
C#
|
4cb9ba648b1c11403aa7fff862ab65c267d53477
|
Update Copyright info
|
axomic/openasset-rest-cs
|
OpenAsset.RestClient.Library/Properties/AssemblyInfo.cs
|
OpenAsset.RestClient.Library/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("OpenAsset.RestClient.Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Axomic Ltd")]
[assembly: AssemblyProduct("OpenAsset RestClient Library")]
[assembly: AssemblyCopyright("Copyright © Axomic Ltd 2013-2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("137fd3b7-9fa8-4003-a734-bb82cf0e2586")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenAsset.RestClient.Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Axomic Ltd")]
[assembly: AssemblyProduct("OpenAsset RestClient Library")]
[assembly: AssemblyCopyright("Copyright © Axomic Ltd 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("137fd3b7-9fa8-4003-a734-bb82cf0e2586")]
// 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#
|
0b4dc816ffad304f7320981e0e155ed3b09c7918
|
Join up hardcoded lines in a Row
|
12joan/hangman
|
row.cs
|
row.cs
|
using System;
namespace Hangman {
public class Row {
public Cell[] Cells;
public Row(Cell[] cells) {
Cells = cells;
}
public string Draw(int width) {
// return new String(' ', width - Text.Length) + Text;
return String.Join("\n", Lines());
}
public string[] Lines() {
return new string[] {
"Line 1",
"Line 2"
};
}
}
}
|
using System;
namespace Hangman {
public class Row {
public Cell[] Cells;
public Row(Cell[] cells) {
Cells = cells;
}
public string Draw(int width) {
// return new String(' ', width - Text.Length) + Text;
return "I have many cells!";
}
}
}
|
unlicense
|
C#
|
426da06c1880b4bf8e00eada10a11f7193e13688
|
Make integration tests explicit
|
EasyNetQ/EasyNetQ,mcthuesen/EasyNetQ,maverix/EasyNetQ,lukasz-lysik/EasyNetQ,beyond-code-github/AzureNetQ,tkirill/EasyNetQ,Pliner/EasyNetQ,chinaboard/EasyNetQ,ar7z1/EasyNetQ,blackcow02/EasyNetQ,mcthuesen/EasyNetQ,EIrwin/EasyNetQ,Ascendon/EasyNetQ,alexwiese/EasyNetQ,zidad/EasyNetQ,GeckoInformasjonssystemerAS/EasyNetQ,alexwiese/EasyNetQ,reisenberger/EasyNetQ,scratch-net/EasyNetQ,blackcow02/EasyNetQ,nicklv/EasyNetQ,zidad/EasyNetQ,ar7z1/EasyNetQ,scratch-net/EasyNetQ,mcthuesen/EasyNetQ,mleenhardt/EasyNetQ,Roysvork/AzureNetQ,mleenhardt/EasyNetQ,alexwiese/EasyNetQ,fpommerening/EasyNetQ,reisenberger/EasyNetQ,sanjaysingh/EasyNetQ,tkirill/EasyNetQ,sanjaysingh/EasyNetQ,EIrwin/EasyNetQ,chinaboard/EasyNetQ,Ascendon/EasyNetQ,maverix/EasyNetQ,lukasz-lysik/EasyNetQ,danbarua/EasyNetQ,nicklv/EasyNetQ,micdenny/EasyNetQ,GeckoInformasjonssystemerAS/EasyNetQ,Pliner/EasyNetQ,fpommerening/EasyNetQ,danbarua/EasyNetQ
|
Source/EasyNetQ.Management.Client.Tests/ScenarioTest.cs
|
Source/EasyNetQ.Management.Client.Tests/ScenarioTest.cs
|
// ReSharper disable InconsistentNaming
using System;
using EasyNetQ.Management.Client.Model;
using NUnit.Framework;
namespace EasyNetQ.Management.Client.Tests
{
[TestFixture]
[Explicit("Requires a RabbitMQ server on localhost to work")]
public class ScenarioTest
{
[SetUp]
public void SetUp()
{
}
/// <summary>
/// Demonstrate how to create a virtual host, add some users, set permissions
/// and create exchanges, queues and bindings.
/// </summary>
[Test]
public void Should_be_able_to_provision_a_virtual_host()
{
var initial = new ManagementClient("http://localhost", "guest", "guest");
// first create a new virtual host
var vhost = initial.CreateVirtualHost("my_virtual_host");
// next create a user for that virutal host
var user = initial.CreateUser(new UserInfo("mike", "topSecret"));
// give the new user all permissions on the virtual host
initial.CreatePermission(new PermissionInfo(user, vhost));
// now log in again as the new user
var management = new ManagementClient("http://localhost", user.name, "topSecret");
// test that everything's OK
management.IsAlive(vhost);
// create an exchange
var exchange = management.CreateExchange(new ExchangeInfo("my_exchagne", "direct"), vhost);
// create a queue
var queue = management.CreateQueue(new QueueInfo("my_queue"), vhost);
// bind the exchange to the queue
management.CreateBinding(exchange, queue, new BindingInfo("my_routing_key"));
// publish a test message
management.Publish(exchange, new PublishInfo("my_routing_key", "Hello World!"));
// get any messages on the queue
var messages = management.GetMessagesFromQueue(queue, new GetMessagesCriteria(1, false));
foreach (var message in messages)
{
Console.Out.WriteLine("message.payload = {0}", message.payload);
}
}
}
}
// ReSharper restore InconsistentNaming
|
// ReSharper disable InconsistentNaming
using System;
using EasyNetQ.Management.Client.Model;
using NUnit.Framework;
namespace EasyNetQ.Management.Client.Tests
{
[TestFixture]
public class ScenarioTest
{
[SetUp]
public void SetUp()
{
}
/// <summary>
/// Demonstrate how to create a virtual host, add some users, set permissions
/// and create exchanges, queues and bindings.
/// </summary>
[Test]
public void Should_be_able_to_provision_a_virtual_host()
{
var initial = new ManagementClient("http://localhost", "guest", "guest");
// first create a new virtual host
var vhost = initial.CreateVirtualHost("my_virtual_host");
// next create a user for that virutal host
var user = initial.CreateUser(new UserInfo("mike", "topSecret"));
// give the new user all permissions on the virtual host
initial.CreatePermission(new PermissionInfo(user, vhost));
// now log in again as the new user
var management = new ManagementClient("http://localhost", user.name, "topSecret");
// test that everything's OK
management.IsAlive(vhost);
// create an exchange
var exchange = management.CreateExchange(new ExchangeInfo("my_exchagne", "direct"), vhost);
// create a queue
var queue = management.CreateQueue(new QueueInfo("my_queue"), vhost);
// bind the exchange to the queue
management.CreateBinding(exchange, queue, new BindingInfo("my_routing_key"));
// publish a test message
management.Publish(exchange, new PublishInfo("my_routing_key", "Hello World!"));
// get any messages on the queue
var messages = management.GetMessagesFromQueue(queue, new GetMessagesCriteria(1, false));
foreach (var message in messages)
{
Console.Out.WriteLine("message.payload = {0}", message.payload);
}
}
}
}
// ReSharper restore InconsistentNaming
|
mit
|
C#
|
c464a9d3d29990b56434923d3267819661afa5af
|
Add tests for external price services
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Tests/IntegrationTests/ExternalApiTests.cs
|
WalletWasabi.Tests/IntegrationTests/ExternalApiTests.cs
|
using NBitcoin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Backend.Models;
using WalletWasabi.Logging;
using WalletWasabi.Tests.XunitConfiguration;
using WalletWasabi.WebClients.BlockchainInfo;
using WalletWasabi.WebClients.Coinbase;
using WalletWasabi.WebClients.Gemini;
using WalletWasabi.WebClients.ItBit;
using WalletWasabi.WebClients.SmartBit;
using WalletWasabi.WebClients.SmartBit.Models;
using Xunit;
namespace WalletWasabi.Tests.IntegrationTests
{
public class ExternalApiTests
{
[Theory]
[InlineData("test")]
[InlineData("main")]
public async Task SmartBitExchangeRateProviderTestAsync(string networkString)
{
var network = Network.GetNetwork(networkString);
var client = new SmartBitClient(network);
var rateProvider = new SmartBitExchangeRateProvider(client);
IEnumerable<ExchangeRate> rates = await rateProvider.GetExchangeRateAsync();
var usdRate = Assert.Single(rates, x => x.Ticker == "USD");
Assert.NotEqual(0.0m, usdRate.Rate);
}
[Fact]
public async Task CoinbaseExchangeRateProviderTestsAsync()
{
var client = new CoinbaseExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
var usdRate = Assert.Single(rates, x => x.Ticker == "USD");
Assert.NotEqual(0.0m, usdRate.Rate);
}
[Fact]
public async Task BlockchainInfoExchangeRateProviderTestsAsync()
{
var client = new BlockchainInfoExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
var usdRate = Assert.Single(rates, x => x.Ticker == "USD");
Assert.NotEqual(0.0m, usdRate.Rate);
}
[Fact]
public async Task CoinGeckoExchangeRateProviderTestsAsync()
{
var client = new CoinGeckoExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
var usdRate = Assert.Single(rates, x => x.Ticker == "USD");
Assert.NotEqual(0.0m, usdRate.Rate);
}
[Fact]
public async Task CoinstampExchangeRateProviderTestsAsync()
{
var client = new CoinstampExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
var usdRate = Assert.Single(rates, x => x.Ticker == "USD");
Assert.NotEqual(0.0m, usdRate.Rate);
}
[Fact]
public async Task GeminiExchangeRateProviderTestsAsync()
{
var client = new GeminiExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
var usdRate = Assert.Single(rates, x => x.Ticker == "USD");
Assert.NotEqual(0.0m, usdRate.Rate);
}
[Fact]
public async Task ItBitExchangeRateProviderTestsAsync()
{
var client = new ItBitExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
var usdRate = Assert.Single(rates, x => x.Ticker == "USD");
Assert.NotEqual(0.0m, usdRate.Rate);
}
}
}
|
using NBitcoin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Backend.Models;
using WalletWasabi.Logging;
using WalletWasabi.Tests.XunitConfiguration;
using WalletWasabi.WebClients.BlockchainInfo;
using WalletWasabi.WebClients.Coinbase;
using WalletWasabi.WebClients.Gemini;
using WalletWasabi.WebClients.ItBit;
using WalletWasabi.WebClients.SmartBit;
using WalletWasabi.WebClients.SmartBit.Models;
using Xunit;
namespace WalletWasabi.Tests.IntegrationTests
{
public class ExternalApiTests
{
[Theory]
[InlineData("test")]
[InlineData("main")]
public async Task SmartBitExchangeRateProviderTestAsync(string networkString)
{
var network = Network.GetNetwork(networkString);
var client = new SmartBitClient(network);
var rateProvider = new SmartBitExchangeRateProvider(client);
IEnumerable<ExchangeRate> rates = await rateProvider.GetExchangeRateAsync();
Assert.Contains("USD", rates.Select(x => x.Ticker));
}
[Fact]
public async Task CoinbaseExchangeRateProviderTestsAsync()
{
var client = new CoinbaseExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
Assert.Contains("USD", rates.Select(x => x.Ticker));
}
[Fact]
public async Task BlockchainInfoExchangeRateProviderTestsAsync()
{
var client = new BlockchainInfoExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
Assert.Contains("USD", rates.Select(x => x.Ticker));
}
[Fact]
public async Task GeminiExchangeRateProviderTestsAsync()
{
var client = new GeminiExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
Assert.Contains("USD", rates.Select(x => x.Ticker));
}
[Fact]
public async Task ItBitExchangeRateProviderTestsAsync()
{
var client = new ItBitExchangeRateProvider();
IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync();
Assert.Contains("USD", rates.Select(x => x.Ticker));
}
}
}
|
mit
|
C#
|
a84d0cf7a2de2c38b2cc73155c23d3d983be1a34
|
refactor code
|
krisdimova/kasskata-Lessons
|
05.GitHub/Program.cs
|
05.GitHub/Program.cs
|
using System;
namespace _05.GitHub
{
class Program
{
static void Main()
{
Console.WriteLine("Clean Code");
}
}
}
|
using System;
namespace _05.GitHub
{
class Program
{
static void Main()
{
Console.WriteLine("Clean Code"); }
}
}
|
mit
|
C#
|
f8e8e79ff2828368a066406f5f327b866c25fe58
|
Update UnMergingtheMergedCells.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET
|
Examples/CSharp/Data/AddOn/Merging/UnMergingtheMergedCells.cs
|
Examples/CSharp/Data/AddOn/Merging/UnMergingtheMergedCells.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.AddOn.Merging
{
public class UnMergingtheMergedCells
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Create a Workbook.
//Open the excel file.
Workbook wbk = new Aspose.Cells.Workbook(dataDir + "mergingcells.xls");
//Create a Worksheet and get the first sheet.
Worksheet worksheet = wbk.Worksheets[0];
//Create a Cells object ot fetch all the cells.
Cells cells = worksheet.Cells;
//Unmerge the cells.
cells.UnMerge(5, 2, 2, 3);
//Save the file.
wbk.Save(dataDir + "unmergingcells.out.xls");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.AddOn.Merging
{
public class UnMergingtheMergedCells
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Create a Workbook.
//Open the excel file.
Workbook wbk = new Aspose.Cells.Workbook(dataDir + "mergingcells.xls");
//Create a Worksheet and get the first sheet.
Worksheet worksheet = wbk.Worksheets[0];
//Create a Cells object ot fetch all the cells.
Cells cells = worksheet.Cells;
//Unmerge the cells.
cells.UnMerge(5, 2, 2, 3);
//Save the file.
wbk.Save(dataDir + "unmergingcells.out.xls");
}
}
}
|
mit
|
C#
|
80811725613f10fcd6596f523c4960ad189faa25
|
Add AssemblyInformationalVersionAttribute
|
ZHZG/PropertyTools,jogibear9988/PropertyTools,punker76/PropertyTools,johnsonlu/PropertyTools,objorke/PropertyTools,ZHZG/PropertyTools,jogibear9988/PropertyTools,LavishSoftware/PropertyTools,Mitch-Connor/PropertyTools
|
Source/GlobalAssemblyInfo.cs
|
Source/GlobalAssemblyInfo.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalAssemblyInfo.cs" company="PropertyTools">
// The MIT License (MIT)
//
// Copyright (c) 2014 PropertyTools contributors
//
// 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>
// --------------------------------------------------------------------------------------------------------------------
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("PropertyTools for WPF")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright (C) PropertyTools contributors 2014.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The version numbers are updated in the build (see ~/appveyor.yml)
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalAssemblyInfo.cs" company="PropertyTools">
// The MIT License (MIT)
//
// Copyright (c) 2014 PropertyTools contributors
//
// 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>
// --------------------------------------------------------------------------------------------------------------------
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("PropertyTools for WPF")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright (C) PropertyTools contributors 2014.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2014.1.1.1")]
[assembly: AssemblyFileVersion("2014.1.1.1")]
|
mit
|
C#
|
f183c6221bf5677c08be34f2d4fb5ee87e8e7ce3
|
Move SharpDX to next minor verison 2.5.1
|
wyrover/SharpDX,Ixonos-USA/SharpDX,fmarrabal/SharpDX,Ixonos-USA/SharpDX,PavelBrokhman/SharpDX,TigerKO/SharpDX,mrvux/SharpDX,jwollen/SharpDX,davidlee80/SharpDX-1,weltkante/SharpDX,RobyDX/SharpDX,dazerdude/SharpDX,wyrover/SharpDX,TigerKO/SharpDX,TechPriest/SharpDX,jwollen/SharpDX,dazerdude/SharpDX,manu-silicon/SharpDX,fmarrabal/SharpDX,RobyDX/SharpDX,weltkante/SharpDX,davidlee80/SharpDX-1,wyrover/SharpDX,sharpdx/SharpDX,jwollen/SharpDX,mrvux/SharpDX,VirusFree/SharpDX,fmarrabal/SharpDX,RobyDX/SharpDX,waltdestler/SharpDX,RobyDX/SharpDX,dazerdude/SharpDX,andrewst/SharpDX,waltdestler/SharpDX,weltkante/SharpDX,VirusFree/SharpDX,manu-silicon/SharpDX,sharpdx/SharpDX,TechPriest/SharpDX,manu-silicon/SharpDX,TigerKO/SharpDX,Ixonos-USA/SharpDX,waltdestler/SharpDX,manu-silicon/SharpDX,weltkante/SharpDX,TechPriest/SharpDX,wyrover/SharpDX,TechPriest/SharpDX,davidlee80/SharpDX-1,Ixonos-USA/SharpDX,PavelBrokhman/SharpDX,VirusFree/SharpDX,sharpdx/SharpDX,jwollen/SharpDX,PavelBrokhman/SharpDX,fmarrabal/SharpDX,mrvux/SharpDX,PavelBrokhman/SharpDX,davidlee80/SharpDX-1,VirusFree/SharpDX,andrewst/SharpDX,andrewst/SharpDX,waltdestler/SharpDX,TigerKO/SharpDX,dazerdude/SharpDX
|
Source/SharedAssemblyInfo.cs
|
Source/SharedAssemblyInfo.cs
|
// Copyright (c) 2010-2013 SharpDX - Alexandre Mutel
//
// 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.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2013 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("2.5.1")]
[assembly:AssemblyFileVersion("2.5.1")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
|
// Copyright (c) 2010-2013 SharpDX - Alexandre Mutel
//
// 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.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2013 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("2.5.0")]
[assembly:AssemblyFileVersion("2.5.0")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
|
mit
|
C#
|
93fdabf961b8eaa512205c9b8d50872816f41e60
|
normalize PlatformTarget FrameworkNames to preferred equivalents
|
StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis
|
service/DotNetApis.Nuget/NugetUtility.cs
|
service/DotNetApis.Nuget/NugetUtility.cs
|
using System.Linq;
using System.Runtime.Versioning;
using NuGet.Frameworks;
namespace DotNetApis.Nuget
{
public static class NugetUtility
{
/// <summary>
/// Whether a framework is a PCL framework.
/// </summary>
/// <param name="frameworkName">The framework name.</param>
public static bool IsFrameworkPortable(this FrameworkName frameworkName) => NuGetFramework.ParseFrameworkName(frameworkName.FullName, DefaultFrameworkNameProvider.Instance).IsPCL;
/// <summary>
/// Normalizes the framework name, extending it into a full framework name if necessary, and choosing the most desirable equivalent (e.g., `win81` instead of `netcore451`).
/// </summary>
/// <param name="frameworkName">The framework name.</param>
public static FrameworkName NormalizeFrameworkName(this FrameworkName frameworkName)
{
var provider = DefaultFrameworkNameProvider.Instance;
// Noramlize into a full framework name.
var result = NuGetFramework.ParseFrameworkName(frameworkName.FullName, provider);
// Choose the most desirable form of the framework name.
if (provider.TryGetEquivalentFrameworks(result, out var options))
{
foreach (var option in options)
{
if (provider.CompareEquivalentFrameworks(result, option) > 0)
result = option;
}
}
return new FrameworkName(result.DotNetFrameworkName);
}
/// <summary>
/// Gets the short framework name.
/// </summary>
/// <param name="frameworkName">The framework name.</param>
public static string ShortFrameworkName(this FrameworkName frameworkName) =>
NuGetFramework.ParseFrameworkName(frameworkName.FullName, DefaultFrameworkNameProvider.Instance).GetShortFolderName();
/// <summary>
/// Attempts to parse a string as a framework name.
/// </summary>
/// <param name="frameworkString">The string.</param>
public static FrameworkName TryParseFrameworkName(string frameworkString)
{
try
{
return new FrameworkName(NuGetFramework.ParseFolder(frameworkString).DotNetFrameworkName);
}
catch
{
return null;
}
}
}
}
|
using System.Runtime.Versioning;
using NuGet.Frameworks;
namespace DotNetApis.Nuget
{
public static class NugetUtility
{
/// <summary>
/// Whether a framework is a PCL framework.
/// </summary>
/// <param name="frameworkName">The framework name.</param>
public static bool IsFrameworkPortable(this FrameworkName frameworkName) => NuGetFramework.ParseFrameworkName(frameworkName.FullName, DefaultFrameworkNameProvider.Instance).IsPCL;
/// <summary>
/// Normalizes the framework name into a full framework name.
/// </summary>
/// <param name="frameworkName">The framework name.</param>
public static FrameworkName NormalizeFrameworkName(this FrameworkName frameworkName) =>
new FrameworkName(NuGetFramework.ParseFrameworkName(frameworkName.FullName, DefaultFrameworkNameProvider.Instance).DotNetFrameworkName);
/// <summary>
/// Gets the short framework name.
/// </summary>
/// <param name="frameworkName">The framework name.</param>
public static string ShortFrameworkName(this FrameworkName frameworkName) =>
NuGetFramework.ParseFrameworkName(frameworkName.FullName, DefaultFrameworkNameProvider.Instance).GetShortFolderName();
/// <summary>
/// Attempts to parse a string as a framework name.
/// </summary>
/// <param name="frameworkString">The string.</param>
public static FrameworkName TryParseFrameworkName(string frameworkString)
{
try
{
return new FrameworkName(NuGetFramework.ParseFolder(frameworkString).DotNetFrameworkName);
}
catch
{
return null;
}
}
}
}
|
mit
|
C#
|
96357f83b099c7adf21f89a7c88b49927c57cbc4
|
Fix dependency context bug and add load overload
|
rakeshsinghranchi/core-setup,janvorli/core-setup,zamont/core-setup,joperezr/core-setup,ravimeda/core-setup,ramarag/core-setup,MichaelSimons/core-setup,ellismg/core-setup,ellismg/core-setup,janvorli/core-setup,chcosta/core-setup,ramarag/core-setup,joperezr/core-setup,vivmishra/core-setup,cakine/core-setup,steveharter/core-setup,gkhanna79/core-setup,ramarag/core-setup,steveharter/core-setup,crummel/dotnet_core-setup,cakine/core-setup,rakeshsinghranchi/core-setup,steveharter/core-setup,steveharter/core-setup,cakine/core-setup,ravimeda/core-setup,ellismg/core-setup,chcosta/core-setup,ellismg/core-setup,janvorli/core-setup,schellap/core-setup,karajas/core-setup,ericstj/core-setup,karajas/core-setup,schellap/core-setup,joperezr/core-setup,schellap/core-setup,ericstj/core-setup,gkhanna79/core-setup,ericstj/core-setup,ramarag/core-setup,wtgodbe/core-setup,zamont/core-setup,weshaggard/core-setup,janvorli/core-setup,wtgodbe/core-setup,schellap/core-setup,crummel/dotnet_core-setup,steveharter/core-setup,weshaggard/core-setup,schellap/core-setup,cakine/core-setup,zamont/core-setup,rakeshsinghranchi/core-setup,ericstj/core-setup,crummel/dotnet_core-setup,karajas/core-setup,vivmishra/core-setup,steveharter/core-setup,ellismg/core-setup,crummel/dotnet_core-setup,vivmishra/core-setup,wtgodbe/core-setup,gkhanna79/core-setup,crummel/dotnet_core-setup,joperezr/core-setup,karajas/core-setup,chcosta/core-setup,gkhanna79/core-setup,ramarag/core-setup,janvorli/core-setup,chcosta/core-setup,wtgodbe/core-setup,karajas/core-setup,weshaggard/core-setup,MichaelSimons/core-setup,wtgodbe/core-setup,chcosta/core-setup,vivmishra/core-setup,rakeshsinghranchi/core-setup,zamont/core-setup,gkhanna79/core-setup,crummel/dotnet_core-setup,karajas/core-setup,ravimeda/core-setup,ellismg/core-setup,ravimeda/core-setup,MichaelSimons/core-setup,ravimeda/core-setup,weshaggard/core-setup,cakine/core-setup,ravimeda/core-setup,MichaelSimons/core-setup,wtgodbe/core-setup,chcosta/core-setup,MichaelSimons/core-setup,weshaggard/core-setup,joperezr/core-setup,zamont/core-setup,vivmishra/core-setup,rakeshsinghranchi/core-setup,ericstj/core-setup,joperezr/core-setup,schellap/core-setup,vivmishra/core-setup,cakine/core-setup,janvorli/core-setup,ramarag/core-setup,zamont/core-setup,ericstj/core-setup,rakeshsinghranchi/core-setup,weshaggard/core-setup,MichaelSimons/core-setup,gkhanna79/core-setup
|
DependencyContext.cs
|
DependencyContext.cs
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Reflection;
using System.Collections.Generic;
namespace Microsoft.Extensions.DependencyModel
{
public class DependencyContext
{
private const string DepsResourceSufix = ".deps.json";
private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, CompilationLibrary[] compileLibraries, RuntimeLibrary[] runtimeLibraries)
{
Target = target;
Runtime = runtime;
CompilationOptions = compilationOptions;
CompileLibraries = compileLibraries;
RuntimeLibraries = runtimeLibraries;
}
public static DependencyContext Default => _defaultContext.Value;
public string Target { get; }
public string Runtime { get; }
public CompilationOptions CompilationOptions { get; }
public IReadOnlyList<CompilationLibrary> CompileLibraries { get; }
public IReadOnlyList<RuntimeLibrary> RuntimeLibraries { get; }
private static DependencyContext LoadDefault()
{
var entryAssembly = Assembly.GetEntryAssembly();
return Load(entryAssembly);
}
public static DependencyContext Load(Assembly assembly)
{
var stream = assembly.GetManifestResourceStream(assembly.GetName().Name + DepsResourceSufix);
if (stream == null)
{
return null;
}
using (stream)
{
return Load(stream);
}
}
public static DependencyContext Load(Stream stream)
{
return new DependencyContextReader().Read(stream);
}
}
}
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Reflection;
using System.Collections.Generic;
namespace Microsoft.Extensions.DependencyModel
{
public class DependencyContext
{
private const string DepsResourceSufix = ".deps.json";
private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, CompilationLibrary[] compileLibraries, RuntimeLibrary[] runtimeLibraries)
{
Target = target;
Runtime = runtime;
CompilationOptions = compilationOptions;
CompileLibraries = compileLibraries;
RuntimeLibraries = runtimeLibraries;
}
public static DependencyContext Default => _defaultContext.Value;
public string Target { get; }
public string Runtime { get; }
public CompilationOptions CompilationOptions { get; }
public IReadOnlyList<CompilationLibrary> CompileLibraries { get; }
public IReadOnlyList<RuntimeLibrary> RuntimeLibraries { get; }
private static DependencyContext LoadDefault()
{
var entryAssembly = Assembly.GetEntryAssembly();
var stream = entryAssembly?.GetManifestResourceStream(entryAssembly.GetName().Name + DepsResourceSufix);
if (stream == null)
{
return null;
}
using (stream)
{
return Load(stream);
}
}
public static DependencyContext Load(Stream stream)
{
return new DependencyContextReader().Read(stream);
}
}
}
|
mit
|
C#
|
d7fc3b2369e632aedce1eb1ba0424e263a8e7434
|
Remove spaces
|
pardahlman/RawRabbit,northspb/RawRabbit
|
src/RawRabbit/Common/ChannelFactory.cs
|
src/RawRabbit/Common/ChannelFactory.cs
|
using System;
using System.Collections.Concurrent;
using System.Threading;
using RabbitMQ.Client;
namespace RawRabbit.Common
{
public interface IChannelFactory : IDisposable
{
IModel GetChannel();
IModel CreateChannel();
}
public class ChannelFactory : IChannelFactory
{
private readonly IConnectionBroker _connectionBroker;
private readonly ConcurrentDictionary<IConnection, ThreadLocal<IModel>> _connectionToChannel;
public ChannelFactory(IConnectionBroker connectionBroker)
{
_connectionBroker = connectionBroker;
_connectionToChannel = new ConcurrentDictionary<IConnection, ThreadLocal<IModel>>();
}
public void Dispose()
{
_connectionBroker?.Dispose();
}
public void CloseAll()
{
foreach (var connection in _connectionToChannel.Keys)
{
connection?.Close();
}
}
public IModel GetChannel()
{
var currentConnection = _connectionBroker.GetConnection();
if (!_connectionToChannel.ContainsKey(currentConnection))
{
_connectionToChannel.TryAdd(currentConnection, new ThreadLocal<IModel>(currentConnection.CreateModel));
}
var threadChannel = _connectionToChannel[currentConnection];
if (threadChannel.Value.IsOpen)
{
return threadChannel.Value;
}
threadChannel.Value?.Dispose();
threadChannel.Value = _connectionBroker.GetConnection().CreateModel();
return threadChannel.Value;
}
public IModel CreateChannel()
{
return _connectionBroker.GetConnection().CreateModel();
}
}
}
|
using System;
using System.Collections.Concurrent;
using System.Threading;
using RabbitMQ.Client;
namespace RawRabbit.Common
{
public interface IChannelFactory : IDisposable
{
IModel GetChannel();
IModel CreateChannel();
}
public class ChannelFactory : IChannelFactory
{
private readonly IConnectionBroker _connectionBroker;
private readonly ConcurrentDictionary<IConnection, ThreadLocal<IModel>> _connectionToChannel;
public ChannelFactory(IConnectionBroker connectionBroker)
{
_connectionBroker = connectionBroker;
_connectionToChannel = new ConcurrentDictionary<IConnection, ThreadLocal<IModel>>();
}
public void Dispose()
{
_connectionBroker?.Dispose();
}
public void CloseAll()
{
foreach (var connection in _connectionToChannel.Keys)
{
connection?.Close();
}
}
public IModel GetChannel()
{
var currentConnection = _connectionBroker.GetConnection();
if (!_connectionToChannel.ContainsKey(currentConnection))
{
_connectionToChannel.TryAdd(currentConnection, new ThreadLocal<IModel>(currentConnection.CreateModel));
}
var threadChannel = _connectionToChannel[currentConnection];
if (threadChannel.Value.IsOpen)
{
return threadChannel.Value;
}
threadChannel.Value?.Dispose();
threadChannel.Value = _connectionBroker.GetConnection().CreateModel();
return threadChannel.Value;
}
public IModel CreateChannel()
{
return _connectionBroker.GetConnection().CreateModel();
}
}
}
|
mit
|
C#
|
78dbe98a9d4d0c4efbeca41579d6649fcdd85aed
|
Use proper C# get/set so list binding works
|
IrvingtonProgramming/InteractApp,IrvingtonProgramming/InteractApp,IrvingtonProgramming/InteractApp
|
InteractApp/Event.cs
|
InteractApp/Event.cs
|
using System;
using System.Collections.Generic;
namespace InteractApp
{
public class Event
{
public int Id { get; set; }
public String ImageUri { get; set; }
public String Name { get; set; }
public DateTime Date { get; set; }
public String Location { get; set; }
public String Desc { get; set; }
public List<String> Tags { get; set; }
public static Event newEvent(int EId, String EImageUri, String EName, DateTime EDate, String ELocation, String EDesc, List<String> ETags)
{
Event e = new Event ();
e.Id = EId;
e.ImageUri = EImageUri;
e.Name = EName;
e.Date = EDate;
e.Location = ELocation;
e.Desc = EDesc;
e.Tags = ETags;
return e;
}
}
}
|
using System;
using System.Collections.Generic;
namespace InteractApp
{
public class Event
{
public int Id;
public String ImageUri;
public String Name;
public DateTime Date;
public String Location;
public String Desc;
public List<String> Tags;
public Event (int EId, String EImageUri, String EName, DateTime EDate, String ELocation, String EDesc, List<String> ETags)
{
this.Id = EId;
this.ImageUri = EImageUri;
this.Name = EName;
this.Date = EDate;
this.Location = ELocation;
this.Desc = EDesc;
this.Tags = ETags;
}
}
}
|
mit
|
C#
|
10033239c7c38781455d25d9189c80abc28123fd
|
Allow binding to ControlPointGroup's ControlPoints
|
smoogipoo/osu,2yangk23/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,ppy/osu,johnneijzen/osu,EVAST9919/osu,2yangk23/osu,peppy/osu,johnneijzen/osu,peppy/osu,peppy/osu,peppy/osu-new,UselessToucan/osu,smoogipooo/osu,smoogipoo/osu,EVAST9919/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu
|
osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs
|
osu.Game/Beatmaps/ControlPoints/ControlPointGroup.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Framework.Bindables;
namespace osu.Game.Beatmaps.ControlPoints
{
public class ControlPointGroup : IComparable<ControlPointGroup>
{
public event Action<ControlPoint> ItemAdded;
public event Action<ControlPoint> ItemRemoved;
/// <summary>
/// The time at which the control point takes effect.
/// </summary>
public double Time { get; }
public IBindableList<ControlPoint> ControlPoints => controlPoints;
private readonly BindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
public ControlPointGroup(double time)
{
Time = time;
}
public int CompareTo(ControlPointGroup other) => Time.CompareTo(other.Time);
public void Add(ControlPoint point)
{
var existing = controlPoints.FirstOrDefault(p => p.GetType() == point.GetType());
if (existing != null)
Remove(existing);
point.AttachGroup(this);
controlPoints.Add(point);
ItemAdded?.Invoke(point);
}
public void Remove(ControlPoint point)
{
controlPoints.Remove(point);
ItemRemoved?.Invoke(point);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Beatmaps.ControlPoints
{
public class ControlPointGroup : IComparable<ControlPointGroup>
{
public event Action<ControlPoint> ItemAdded;
public event Action<ControlPoint> ItemRemoved;
/// <summary>
/// The time at which the control point takes effect.
/// </summary>
public double Time { get; }
public IReadOnlyList<ControlPoint> ControlPoints => controlPoints;
private readonly List<ControlPoint> controlPoints = new List<ControlPoint>();
public ControlPointGroup(double time)
{
Time = time;
}
public int CompareTo(ControlPointGroup other) => Time.CompareTo(other.Time);
public void Add(ControlPoint point)
{
var existing = controlPoints.FirstOrDefault(p => p.GetType() == point.GetType());
if (existing != null)
Remove(existing);
point.AttachGroup(this);
controlPoints.Add(point);
ItemAdded?.Invoke(point);
}
public void Remove(ControlPoint point)
{
controlPoints.Remove(point);
ItemRemoved?.Invoke(point);
}
}
}
|
mit
|
C#
|
718a6d2a0dd914b498eb8f24da4bfeef0c821a1e
|
Use regex to find idle jobs #31
|
dermeister0/TimesheetParser,dermeister0/TimesheetParser
|
Source/TimesheetParser.Business/IdleStrategies/BaseIdleStrategy.cs
|
Source/TimesheetParser.Business/IdleStrategies/BaseIdleStrategy.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace TimesheetParser.Business.IdleStrategies
{
abstract class BaseIdleStrategy : IIdleStrategy
{
Regex idleRegex = new Regex(@"(?i)^\s?idle\.?\s?$", RegexOptions.Compiled);
public abstract void DistributeIdle(ParseResult result);
protected IList<Model.Job> GetIdleJobs(ParseResult result)
{
return result.Jobs.Where(j => idleRegex.IsMatch(j.Description.Trim())).ToList();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace TimesheetParser.Business.IdleStrategies
{
abstract class BaseIdleStrategy : IIdleStrategy
{
public abstract void DistributeIdle(ParseResult result);
protected IList<Model.Job> GetIdleJobs(ParseResult result)
{
return result.Jobs.Where(j => string.Compare(j.Description.Trim(), "Idle.", StringComparison.OrdinalIgnoreCase) == 0).ToList();
}
}
}
|
mit
|
C#
|
db0c010afd2f9d0b37a3a80102f731bf2ee35a67
|
Update validate ip address
|
should-have/SH.ShowYou
|
SH.ShowYou/Controllers/GeoController.cs
|
SH.ShowYou/Controllers/GeoController.cs
|
using System.Web.Http;
using System.Web.Routing;
using SH.ShowYou.Helpers;
using System.Net;
namespace SH.ShowYou.Controllers
{
public class GeoController : ApiControllerBase
{
[Route("geo")]
[HttpGet]
public IHttpActionResult Get(string ip = "")
{
if (string.IsNullOrEmpty(ip))
{
ip = GetIpAddress();
}
IPAddress ipAddress;
if (string.IsNullOrEmpty(ip) || IPAddress.TryParse(ip, out ipAddress))
{
return BadRequest("Invalid ip address");
}
var geoLiteCityLocation = CsvDatabaseHelpers.GetGeoLiteCityLocation(ip);
return Ok(geoLiteCityLocation);
}
}
}
|
using System.Web.Http;
using System.Web.Routing;
using SH.ShowYou.Helpers;
using System.Net;
namespace SH.ShowYou.Controllers
{
public class GeoController : ApiControllerBase
{
[Route("geo")]
[HttpGet]
public IHttpActionResult Get(string ip = "")
{
if (string.IsNullOrEmpty(ip))
{
ip = GetIpAddress();
}
if (string.IsNullOrEmpty(ip))
{
return BadRequest();
}
var geoLiteCityLocation = CsvDatabaseHelpers.GetGeoLiteCityLocation(ip);
return Ok(geoLiteCityLocation);
}
}
}
|
mit
|
C#
|
3aae30c58dfed18c05c4be86a1faed2e8f203a3a
|
remove compilation warning
|
pchalamet/full-build,full-build/full-build,pchalamet/full-build,full-build/full-build
|
src/FullBuild/Commands/Packages+Check.cs
|
src/FullBuild/Commands/Packages+Check.cs
|
// Copyright (c) 2014, Pierre Chalamet
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of Pierre Chalamet nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL PIERRE CHALAMET BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using FullBuild.Config;
using FullBuild.Helpers;
using FullBuild.Model;
namespace FullBuild.Commands
{
internal partial class Packages
{
private static void CheckPackages()
{
// read anthology.json
var admDir = WellKnownFolders.GetAdminDirectory();
var anthology = Anthology.Load(admDir);
var config = ConfigManager.LoadConfig();
var nuget = NuGet.Default(config.NuGets);
foreach (var pkg in anthology.Packages)
{
var latestNuspec = nuget.GetLatestVersion(pkg.Name);
var latestVersion = latestNuspec.Version.ParseSemVersion();
var currentVersion = pkg.Version.ParseSemVersion();
if (currentVersion < latestVersion)
{
Console.WriteLine("{0} version {1} is available (current is {2})", pkg.Name, latestNuspec.Version, pkg.Version);
}
}
}
}
}
|
// Copyright (c) 2014, Pierre Chalamet
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of Pierre Chalamet nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL PIERRE CHALAMET BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using FullBuild.Config;
using FullBuild.Helpers;
using FullBuild.Model;
namespace FullBuild.Commands
{
internal partial class Packages
{
private static void CheckPackages()
{
// read anthology.json
var admDir = WellKnownFolders.GetAdminDirectory();
var anthology = Anthology.Load(admDir);
var wsDir = WellKnownFolders.GetWorkspaceDirectory();
var config = ConfigManager.LoadConfig();
var nuget = NuGet.Default(config.NuGets);
foreach (var pkg in anthology.Packages)
{
var latestNuspec = nuget.GetLatestVersion(pkg.Name);
var latestVersion = latestNuspec.Version.ParseSemVersion();
var currentVersion = pkg.Version.ParseSemVersion();
if (currentVersion < latestVersion)
{
Console.WriteLine("{0} version {1} is available (current is {2})", pkg.Name, latestNuspec.Version, pkg.Version);
}
}
}
}
}
|
apache-2.0
|
C#
|
5e1b62ffb19e283e7f72b7ecd3d128c50bfb3d0d
|
Patch from Tim Allen from bug #55066 - unit test to show that we no longer load XWPF footnotes twice
|
Yijtx/npoi,antony-liu/npoi,jcridev/npoi,stuartwmurray/npoi,tkalubi/npoi-1,xl1/npoi,tonyqus/npoi,vinod1988/npoi
|
testcases/ooxml/XWPF/UserModel/TestXWPFFootnotes.cs
|
testcases/ooxml/XWPF/UserModel/TestXWPFFootnotes.cs
|
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for Additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
namespace NPOI.XWPF.UserModel
{
using NUnit.Framework;
using NPOI.XWPF;
using NPOI.OpenXmlFormats.Wordprocessing;
using System.Collections.Generic;
using System;
[TestFixture]
public class TestXWPFFootnotes
{
[Test]
public void TestAddFootnotesToDocument()
{
XWPFDocument docOut = new XWPFDocument();
int noteId = 1;
XWPFFootnotes footnotes = docOut.CreateFootnotes();
CT_FtnEdn ctNote = new CT_FtnEdn();
ctNote.id = (noteId.ToString());
ctNote.type = (ST_FtnEdn.normal);
footnotes.AddFootnote(ctNote);
XWPFDocument docIn = XWPFTestDataSamples.WriteOutAndReadBack(docOut);
XWPFFootnote note = docIn.GetFootnoteByID(noteId);
Assert.AreEqual(note.GetCTFtnEdn().type, ST_FtnEdn.normal);
}
/**
* Bug 55066 - avoid double loading the footnotes
*/
[Test]
public void TestLoadFootnotesOnce()
{
XWPFDocument doc = XWPFTestDataSamples.OpenSampleDocument("Bug54849.docx");
IList<XWPFFootnote> footnotes = doc.GetFootnotes();
int hits = 0;
foreach (XWPFFootnote fn in footnotes)
{
foreach (IBodyElement e in fn.BodyElements)
{
if (e is XWPFParagraph)
{
String txt = ((XWPFParagraph)e).Text;
if (txt.IndexOf("Footnote_sdt") > -1)
{
hits++;
}
}
}
}
Assert.AreEqual(1, hits, "Load footnotes once");
}
}
}
|
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for Additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
namespace NPOI.XWPF.UserModel
{
using NUnit.Framework;
using NPOI.XWPF;
using NPOI.OpenXmlFormats.Wordprocessing;
[TestFixture]
public class TestXWPFFootnotes
{
[Test]
public void TestAddFootnotesToDocument()
{
XWPFDocument docOut = new XWPFDocument();
int noteId = 1;
XWPFFootnotes footnotes = docOut.CreateFootnotes();
CT_FtnEdn ctNote = new CT_FtnEdn();
ctNote.id = (noteId.ToString());
ctNote.type = (ST_FtnEdn.normal);
footnotes.AddFootnote(ctNote);
XWPFDocument docIn = XWPFTestDataSamples.WriteOutAndReadBack(docOut);
XWPFFootnote note = docIn.GetFootnoteByID(noteId);
Assert.AreEqual(note.GetCTFtnEdn().type, ST_FtnEdn.normal);
}
}
}
|
apache-2.0
|
C#
|
54463a6d2977b2fe339585f0bfd6a62e56fbed82
|
Fix mouse position in game view
|
feliwir/openSage,feliwir/openSage
|
src/OpenSage.Viewer/UI/Views/GameView.cs
|
src/OpenSage.Viewer/UI/Views/GameView.cs
|
using System.Numerics;
using ImGuiNET;
namespace OpenSage.Viewer.UI.Views
{
internal abstract class GameView : AssetView
{
private readonly AssetViewContext _context;
protected GameView(AssetViewContext context)
{
_context = context;
}
public override void Draw(ref bool isGameViewFocused)
{
var windowPos = ImGui.GetCursorScreenPos();
var availableSize = ImGui.GetContentRegionAvailable();
_context.GamePanel.EnsureFrame(
new Mathematics.Rectangle(
(int) windowPos.X,
(int) windowPos.Y,
(int) availableSize.X,
(int) availableSize.Y));
_context.Game.Tick();
ImGuiNative.igSetItemAllowOverlap();
var imagePointer = _context.ImGuiRenderer.GetOrCreateImGuiBinding(
_context.GraphicsDevice.ResourceFactory,
_context.Game.Panel.Framebuffer.ColorTargets[0].Target);
if (ImGui.ImageButton(
imagePointer,
ImGui.GetContentRegionAvailable(),
Vector2.Zero,
Vector2.One,
0,
Vector4.Zero,
Vector4.One))
{
isGameViewFocused = true;
}
}
}
}
|
using System.Numerics;
using ImGuiNET;
namespace OpenSage.Viewer.UI.Views
{
internal abstract class GameView : AssetView
{
private readonly AssetViewContext _context;
protected GameView(AssetViewContext context)
{
_context = context;
}
public override void Draw(ref bool isGameViewFocused)
{
var windowPos = ImGui.GetWindowPosition();
var availableSize = ImGui.GetContentRegionAvailable();
_context.GamePanel.EnsureFrame(
new Mathematics.Rectangle(
(int) windowPos.X,
(int) windowPos.Y,
(int) availableSize.X,
(int) availableSize.Y));
_context.Game.Tick();
ImGuiNative.igSetItemAllowOverlap();
var imagePointer = _context.ImGuiRenderer.GetOrCreateImGuiBinding(
_context.GraphicsDevice.ResourceFactory,
_context.Game.Panel.Framebuffer.ColorTargets[0].Target);
if (ImGui.ImageButton(
imagePointer,
ImGui.GetContentRegionAvailable(),
Vector2.Zero,
Vector2.One,
0,
Vector4.Zero,
Vector4.One))
{
isGameViewFocused = true;
}
}
}
}
|
mit
|
C#
|
3d7793a1b4600660a0362bb200d1a699b0881359
|
Update RoundingPricingStrategy.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Finance/PricingStrategy/RoundingPricingStrategy.cs
|
TIKSN.Core/Finance/PricingStrategy/RoundingPricingStrategy.cs
|
using System;
namespace TIKSN.Finance.PricingStrategy
{
public class RoundingPricingStrategy : IPricingStrategy
{
private readonly int fitstImportantDigitsCount;
public RoundingPricingStrategy(int fitstImportantDigitsCount)
{
if (fitstImportantDigitsCount < 1)
{
throw new ArgumentException(nameof(fitstImportantDigitsCount));
}
this.fitstImportantDigitsCount = fitstImportantDigitsCount;
}
public Money EstimateMarketPrice(Money basePrice)
{
var estimatedPrice = this.EstimateMarketPrice(basePrice.Amount);
return new Money(basePrice.Currency, estimatedPrice);
}
public decimal EstimateMarketPrice(decimal basePrice)
{
var degree = (int)Math.Log10((double)basePrice);
var norm = (decimal)Math.Pow(10.0, degree);
var estimated = basePrice / norm;
estimated = Math.Round(estimated, this.fitstImportantDigitsCount - 1);
estimated *= norm;
return estimated;
}
}
}
|
using System;
namespace TIKSN.Finance.PricingStrategy
{
public class RoundingPricingStrategy : IPricingStrategy
{
private int fitstImportantDigitsCount;
public RoundingPricingStrategy(int fitstImportantDigitsCount)
{
if (fitstImportantDigitsCount < 1)
throw new ArgumentException(nameof(fitstImportantDigitsCount));
this.fitstImportantDigitsCount = fitstImportantDigitsCount;
}
public Money EstimateMarketPrice(Money basePrice)
{
var estimatedPrice = EstimateMarketPrice(basePrice.Amount);
return new Money(basePrice.Currency, estimatedPrice);
}
public decimal EstimateMarketPrice(decimal basePrice)
{
int degree = (int)Math.Log10((double)basePrice);
decimal norm = (decimal)Math.Pow(10.0, degree);
decimal estimated = basePrice / norm;
estimated = Math.Round(estimated, fitstImportantDigitsCount - 1);
estimated *= norm;
return estimated;
}
}
}
|
mit
|
C#
|
7fcbeb1d9e2da29f5ba995abc2e79a7625e6ef05
|
Remove the third useless behaviour of the Xmas Bell.
|
Noxalus/Xmas-Hell
|
Xmas-Hell/Xmas-Hell-Core/Entities/Bosses/XmasBell/XmasBell.cs
|
Xmas-Hell/Xmas-Hell-Core/Entities/Bosses/XmasBell/XmasBell.cs
|
using BulletML;
using Microsoft.Xna.Framework;
using XmasHell.Physics.Collision;
namespace XmasHell.Entities.Bosses.XmasBell
{
class XmasBell : Boss
{
public XmasBell(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, playerPositionDelegate)
{
// Spriter
SpriterFilename = "Graphics/Sprites/Bosses/XmasBell/xmas-bell";
// BulletML
BulletPatternFiles.Add("XmasBell/pattern1");
BulletPatternFiles.Add("XmasBell/pattern2");
BulletPatternFiles.Add("XmasBell/pattern4");
BulletPatternFiles.Add("XmasBell/pattern5");
// Behaviours
Behaviours.Add(new XmasBellBehaviour1(this));
Behaviours.Add(new XmasBellBehaviour2(this));
//Behaviours.Add(new XmasBellBehaviour3(this));
Behaviours.Add(new XmasBellBehaviour4(this));
Behaviours.Add(new XmasBellBehaviour5(this));
}
protected override void InitializePhysics()
{
base.InitializePhysics();
// Setup the physics
Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionCircle(this, "body.png", new Vector2(0f, 10f), 0.90f));
Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionConvexPolygon(this, "clapper.png", Vector2.Zero, 1f));
Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionConvexPolygon(this, "clapper-ball.png", Vector2.Zero, 1f));
}
protected override void UpdateBehaviourIndex()
{
base.UpdateBehaviourIndex();
//CurrentBehaviourIndex = 3;
}
}
}
|
using BulletML;
using Microsoft.Xna.Framework;
using XmasHell.Physics.Collision;
namespace XmasHell.Entities.Bosses.XmasBell
{
class XmasBell : Boss
{
public XmasBell(XmasHell game, PositionDelegate playerPositionDelegate) : base(game, playerPositionDelegate)
{
// Spriter
SpriterFilename = "Graphics/Sprites/Bosses/XmasBell/xmas-bell";
// BulletML
BulletPatternFiles.Add("XmasBell/pattern1");
BulletPatternFiles.Add("XmasBell/pattern2");
BulletPatternFiles.Add("XmasBell/pattern4");
BulletPatternFiles.Add("XmasBell/pattern5");
// Behaviours
Behaviours.Add(new XmasBellBehaviour1(this));
Behaviours.Add(new XmasBellBehaviour2(this));
Behaviours.Add(new XmasBellBehaviour3(this));
Behaviours.Add(new XmasBellBehaviour4(this));
Behaviours.Add(new XmasBellBehaviour5(this));
}
protected override void InitializePhysics()
{
base.InitializePhysics();
// Setup the physics
Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionCircle(this, "body.png", new Vector2(0f, 10f), 0.90f));
Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionConvexPolygon(this, "clapper.png", Vector2.Zero, 1f));
Game.GameManager.CollisionWorld.AddBossHitBox(new SpriterCollisionConvexPolygon(this, "clapper-ball.png", Vector2.Zero, 1f));
}
protected override void UpdateBehaviourIndex()
{
base.UpdateBehaviourIndex();
//CurrentBehaviourIndex = 3;
}
}
}
|
mit
|
C#
|
45fca0aa4a359db77ced4c63337a557a7a0e3810
|
Remove actions from Index view
|
BillChirico/Tipage,BillChirico/Tipage
|
src/Tipage.Web/Views/Shifts/Index.cshtml
|
src/Tipage.Web/Views/Shifts/Index.cshtml
|
@model IEnumerable<Tipage.Web.Models.Shift>
@{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Date
</th>
<th>
Total Tips
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
<a asp-action="Details" asp-route-id="@item.Id">@item.Start.ToString("d")</a>
</td>
<td>
@Html.DisplayFor(s => item.TotalTips)
</td>
</tr>
}
</tbody>
</table>
|
@model IEnumerable<Tipage.Web.Models.Shift>
@{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Date
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
<a asp-action="Details" asp-route-id="@item.Id">@item.Start.ToString("d")</a>
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
</td>
</tr>
}
</tbody>
</table>
|
mit
|
C#
|
f7b927ac81cb9081bf6aa883e9b456cc53cd4179
|
Reset cancellation registration field after disposal failure
|
bwatts/Totem,bwatts/Totem
|
Source/Totem/Runtime/ConnectionState.cs
|
Source/Totem/Runtime/ConnectionState.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Totem.Runtime
{
/// <summary>
/// Indicates the observable state of a connection
/// </summary>
public sealed class ConnectionState : Notion
{
private CancellationTokenRegistration _cancellationTokenRegistration;
private volatile ConnectionPhase _phase;
private bool _hasConnected;
public CancellationToken CancellationToken { get; private set; }
public ConnectionPhase Phase => _phase;
public bool IsDisconnected => _phase == ConnectionPhase.Disconnected;
public bool IsConnecting => _phase == ConnectionPhase.Connecting;
public bool IsConnected => _phase == ConnectionPhase.Connected;
public bool IsCancelled => _phase == ConnectionPhase.Cancelled;
public bool IsDisconnecting => _phase == ConnectionPhase.Disconnecting;
public bool IsReconnecting => _phase == ConnectionPhase.Reconnecting;
public bool IsReconnected => _phase == ConnectionPhase.Reconnected;
//
// Lifecycle
//
internal void OnConnecting(CancellationToken cancellationToken)
{
_phase = _hasConnected ? ConnectionPhase.Reconnecting : ConnectionPhase.Connecting;
CancellationToken = cancellationToken;
_cancellationTokenRegistration = cancellationToken.Register(OnCancelled);
}
internal void OnConnected()
{
if(_hasConnected)
{
_phase = ConnectionPhase.Reconnected;
}
else
{
_phase = ConnectionPhase.Connected;
_hasConnected = true;
}
}
internal void OnDisconnecting()
{
_phase = ConnectionPhase.Disconnecting;
UnregisterCancellationToken();
}
internal void OnDisconnected()
{
_phase = ConnectionPhase.Disconnected;
}
private void OnCancelled()
{
_phase = ConnectionPhase.Cancelled;
UnregisterCancellationToken();
}
private void UnregisterCancellationToken()
{
try
{
_cancellationTokenRegistration.Dispose();
}
catch(NullReferenceException)
{
// Every once in a while .NET throws an exception while disposing.
//
// We can't do anything about it, so ignore it.
}
_cancellationTokenRegistration = default(CancellationTokenRegistration);
}
//
// Expectations
//
public void ExpectPhase(ConnectionPhase phase)
{
Expect(_phase).Is(phase, "Connection is in the wrong phase");
}
public void ExpectPhases(params ConnectionPhase[] phases)
{
Expect(phases.Contains(_phase), "Connection is in the wrong phase");
}
public void ExpectDisconnected()
{
ExpectPhase(ConnectionPhase.Disconnected);
}
public void ExpectConnecting()
{
ExpectPhase(ConnectionPhase.Connecting);
}
public void ExpectConnected()
{
ExpectPhase(ConnectionPhase.Connected);
}
public void ExpectDisconnecting()
{
ExpectPhase(ConnectionPhase.Disconnecting);
}
public void ExpectCancelled()
{
ExpectPhase(ConnectionPhase.Cancelled);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Totem.Runtime
{
/// <summary>
/// Indicates the observable state of a connection
/// </summary>
public sealed class ConnectionState : Notion
{
private CancellationTokenRegistration _cancellationTokenRegistration;
private volatile ConnectionPhase _phase;
private bool _hasConnected;
public CancellationToken CancellationToken { get; private set; }
public ConnectionPhase Phase => _phase;
public bool IsDisconnected => _phase == ConnectionPhase.Disconnected;
public bool IsConnecting => _phase == ConnectionPhase.Connecting;
public bool IsConnected => _phase == ConnectionPhase.Connected;
public bool IsCancelled => _phase == ConnectionPhase.Cancelled;
public bool IsDisconnecting => _phase == ConnectionPhase.Disconnecting;
public bool IsReconnecting => _phase == ConnectionPhase.Reconnecting;
public bool IsReconnected => _phase == ConnectionPhase.Reconnected;
//
// Lifecycle
//
internal void OnConnecting(CancellationToken cancellationToken)
{
_phase = _hasConnected ? ConnectionPhase.Reconnecting : ConnectionPhase.Connecting;
CancellationToken = cancellationToken;
_cancellationTokenRegistration = cancellationToken.Register(OnCancelled);
}
internal void OnConnected()
{
if(_hasConnected)
{
_phase = ConnectionPhase.Reconnected;
}
else
{
_phase = ConnectionPhase.Connected;
_hasConnected = true;
}
}
internal void OnDisconnecting()
{
_phase = ConnectionPhase.Disconnecting;
UnregisterCancellationToken();
}
internal void OnDisconnected()
{
_phase = ConnectionPhase.Disconnected;
}
private void OnCancelled()
{
_phase = ConnectionPhase.Cancelled;
UnregisterCancellationToken();
}
private void UnregisterCancellationToken()
{
try
{
_cancellationTokenRegistration.Dispose();
_cancellationTokenRegistration = default(CancellationTokenRegistration);
}
catch(NullReferenceException)
{
// Every once in a while .NET throws an exception while disposing.
//
// We can't do anything about it, so ignore it.
}
}
//
// Expectations
//
public void ExpectPhase(ConnectionPhase phase)
{
Expect(_phase).Is(phase, "Connection is in the wrong phase");
}
public void ExpectPhases(params ConnectionPhase[] phases)
{
Expect(phases.Contains(_phase), "Connection is in the wrong phase");
}
public void ExpectDisconnected()
{
ExpectPhase(ConnectionPhase.Disconnected);
}
public void ExpectConnecting()
{
ExpectPhase(ConnectionPhase.Connecting);
}
public void ExpectConnected()
{
ExpectPhase(ConnectionPhase.Connected);
}
public void ExpectDisconnecting()
{
ExpectPhase(ConnectionPhase.Disconnecting);
}
public void ExpectCancelled()
{
ExpectPhase(ConnectionPhase.Cancelled);
}
}
}
|
mit
|
C#
|
df7816cad050957e329972f0126aad11a02afc02
|
Remove unneeded using.
|
Faithlife/Parsing
|
tools/Build/Build.cs
|
tools/Build/Build.cs
|
return BuildRunner.Execute(args, build =>
{
var gitLogin = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? "");
build.AddDotNetTargets(
new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = gitLogin,
GitAuthor = new GitAuthorInfo("Faithlife Build Bot", "faithlifebuildbot@users.noreply.github.com"),
SourceCodeUrl = "https://github.com/Faithlife/RepoName/tree/master/src",
},
PackageSettings = new DotNetPackageSettings
{
GitLogin = gitLogin,
PushTagOnPublish = x => $"v{x.Version}",
},
});
});
|
using Faithlife.Build;
return BuildRunner.Execute(args, build =>
{
var gitLogin = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? "");
build.AddDotNetTargets(
new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = gitLogin,
GitAuthor = new GitAuthorInfo("Faithlife Build Bot", "faithlifebuildbot@users.noreply.github.com"),
SourceCodeUrl = "https://github.com/Faithlife/RepoName/tree/master/src",
},
PackageSettings = new DotNetPackageSettings
{
GitLogin = gitLogin,
PushTagOnPublish = x => $"v{x.Version}",
},
});
});
|
mit
|
C#
|
1712406a3cd3ee44a807495aa092601a8d37bc8a
|
Fix unit test host
|
Thraka/SadConsole
|
Tests/SadConsole.Tests/BasicGameHost.cs
|
Tests/SadConsole.Tests/BasicGameHost.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using SadConsole.Input;
using SadConsole.Renderers;
namespace SadConsole.Tests
{
class BasicGameHost : GameHost
{
public BasicGameHost()
{
Instance = this;
}
public override IRenderer GetDefaultRenderer(IScreenSurface screenObject)
{
return null;
}
public override IKeyboardState GetKeyboardState()
{
throw new NotImplementedException();
}
public override IMouseState GetMouseState()
{
throw new NotImplementedException();
}
public override ITexture GetTexture(string resourcePath)
{
throw new NotImplementedException();
}
public override ITexture GetTexture(Stream textureStream)
{
throw new NotImplementedException();
}
public override IRenderer GetRenderer(string name)
{
return null;
}
public override void Run()
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using SadConsole.Input;
using SadConsole.Renderers;
namespace SadConsole.Tests
{
class BasicGameHost : GameHost
{
public BasicGameHost()
{
Instance = this;
}
public override IRenderer GetDefaultRenderer(IScreenSurface screenObject)
{
return null;
}
public override IKeyboardState GetKeyboardState()
{
throw new NotImplementedException();
}
public override IMouseState GetMouseState()
{
throw new NotImplementedException();
}
public override ITexture GetTexture(string resourcePath)
{
throw new NotImplementedException();
}
public override ITexture GetTexture(Stream textureStream)
{
throw new NotImplementedException();
}
public override void Run()
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
7b6568540966f69f8f65c10989355a7fd0942e96
|
Remove MIT license header
|
fredatgithub/WinFormTemplate
|
WinFormTemplate/ConfigurationOptions.cs
|
WinFormTemplate/ConfigurationOptions.cs
|
namespace WinFormTemplate
{
internal class ConfigurationOptions
{
public bool Option1Name { get; set; }
public bool Option2Name { get; set; }
public ConfigurationOptions()
{
}
}
}
|
/*
The MIT License(MIT)
Copyright(c) 2015 Freddy Juhel
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 WinFormTemplate
{
internal class ConfigurationOptions
{
public bool Option1Name { get; set; }
public bool Option2Name { get; set; }
public ConfigurationOptions()
{
}
}
}
|
mit
|
C#
|
5cb64a993009020afdb6ab842cbb1339e78fa108
|
Update model for transaction to not need the person id as it will get set from the jwt later
|
djangojazz/MoneyEntry
|
MoneyEntry.ExpensesAPI/Models/TransactionModel.cs
|
MoneyEntry.ExpensesAPI/Models/TransactionModel.cs
|
using MoneyEntry.DataAccess.EFCore.Expenses.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MoneyEntry.ExpensesAPI.Models
{
public class TransactionModel
{
public int TransactionId { get; set; }
[Required]
public decimal Amount { get; set; }
[Required, MaxLength(128)]
public string Description { get; set; }
[Required, Range(1,2)]
public int TypeId { get; set; }
[Required, Range(1,99)]
public int CategoryId { get; set; }
[Required, DataType(DataType.DateTime)]
public DateTime CreatedDate { get; set; }
public int PersonId { get; set; }
public bool Reconciled { get; set; }
}
}
|
using MoneyEntry.DataAccess.EFCore.Expenses.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MoneyEntry.ExpensesAPI.Models
{
public class TransactionModel
{
public int TransactionId { get; set; }
[Required]
public decimal Amount { get; set; }
[Required, MaxLength(128)]
public string Description { get; set; }
[Required, Range(1,2)]
public int TypeId { get; set; }
[Required, Range(1,99)]
public int CategoryId { get; set; }
[Required, DataType(DataType.DateTime)]
public DateTime CreatedDate { get; set; }
[Required, Range(1,10)]
public int PersonId { get; set; }
public bool Reconciled { get; set; }
}
}
|
bsd-3-clause
|
C#
|
99498089292d70ec6c487bbf11d2487da404e533
|
Update TimeWindow.cs
|
LordMike/TMDbLib
|
TMDbLib/Objects/Trending/TimeWindow.cs
|
TMDbLib/Objects/Trending/TimeWindow.cs
|
namespace TMDbLib.Objects.Trending
{
public enum TimeWindow
{
[EnumValue("day")]
Day,
[EnumValue("week")]
Week
}
}
|
namespace TMDbLib.Objects.Trending
{
public enum TimeWindow
{
Day, Week
}
}
|
mit
|
C#
|
8359ed4215c486abf80a07741409c8317e6a6a26
|
Update test
|
GeirGrusom/daemos,GeirGrusom/daemos
|
UnitTests/TransactionProcessorTests.cs
|
UnitTests/TransactionProcessorTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using NSubstitute;
using NUnit.Framework;
using Transact;
namespace UnitTests
{
[TestFixture]
public class TransactionProcessorTests
{
[Test]
public async Task RunAsync_ExpiresTransaction()
{
var cancel = new CancellationTokenSource();
var storage = Substitute.For<ITransactionStorage>();
var scriptRunner = Substitute.For<IScriptRunner>();
var processor = new TransactionProcessor(storage, scriptRunner);
var transaction = new Transaction(Guid.NewGuid(), 0, DateTime.UtcNow, null, null, null, null, TransactionState.Initialized, null, storage);
storage.GetExpiringTransactions(Arg.Any<DateTime>(), CancellationToken.None)
.Returns(new[] {transaction}, Enumerable.Empty<Transaction>());
await processor.RunAsync(cancel.Token);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using NSubstitute;
using NUnit.Framework;
using Transact;
namespace UnitTests
{
[TestFixture]
public class TransactionProcessorTests
{
[Test]
public async Task RunAsync_ExpiresTransaction()
{
var cancel = new CancellationTokenSource();
var storage = Substitute.For<ITransactionStorage>();
var scriptRunner = Substitute.For<IScriptRunner>();
var processor = new TransactionProcessor(storage, scriptRunner);
await processor.RunAsync(cancel.Token);
}
}
}
|
mit
|
C#
|
66c27d2dbc78c56d3331494a1380d1cdb0d9b219
|
Bump version number of FirebaseJobDispatcher to 0.8.5
|
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents
|
Android/FirebaseJobDispatcher/build.cake
|
Android/FirebaseJobDispatcher/build.cake
|
#load "../../common.cake"
var TARGET = Argument ("t", Argument ("target", "Default"));
var ANDROID_VERSION = "0.8.5";
var ANDROID_NUGET_VERSION = "0.8.5.0-beta1";
var ANDROID_URL = string.Format ("https://jcenter.bintray.com/com/firebase/firebase-jobdispatcher/{0}/firebase-jobdispatcher-{0}.aar", ANDROID_VERSION);
var ANDROID_FILE = "firebase-dispatcher.aar";
var buildSpec = new BuildSpec () {
Libs = new ISolutionBuilder [] {
new DefaultSolutionBuilder {
BuildsOn = BuildPlatforms.Mac | BuildPlatforms.Windows,
SolutionPath = "./Xamarin.Firebase.JobDispatcher.sln",
OutputFiles = new [] {
new OutputFileCopy {
FromFile = "./source/Firebase.JobDispatcher/bin/Release/Xamarin.Firebase.JobDispatcher.dll",
}
}
}
},
Samples = new ISolutionBuilder [] {
new DefaultSolutionBuilder { SolutionPath = "./Xamarin.Firebase.JobDispatcher.sln" },
},
NuGets = new [] {
new NuGetInfo { NuSpec = "./nuget/Xamarin.Firebase.JobDispatcher.nuspec", Version = ANDROID_NUGET_VERSION },
},
};
Task ("externals")
.Does (() =>
{
if (!DirectoryExists ("./externals/"))
CreateDirectory ("./externals/");
DownloadFile (ANDROID_URL, "./externals/" + ANDROID_FILE);
StartProcess ("/usr/bin/zip", "-d ./externals/firebase-dispatcher.aar annotations.zip");
});
Task ("clean").IsDependentOn ("clean-base").Does (() =>
{
DeleteFiles ("./externals/*.aar");
});
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
RunTarget (TARGET);
|
#load "../../common.cake"
var TARGET = Argument ("t", Argument ("target", "Default"));
var ANDROID_VERSION = "0.8.3";
var ANDROID_NUGET_VERSION = "0.8.3.0-beta1";
var ANDROID_URL = string.Format ("https://jcenter.bintray.com/com/firebase/firebase-jobdispatcher/{0}/firebase-jobdispatcher-{0}.aar", ANDROID_VERSION);
var ANDROID_FILE = "firebase-dispatcher.aar";
var buildSpec = new BuildSpec () {
Libs = new ISolutionBuilder [] {
new DefaultSolutionBuilder {
BuildsOn = BuildPlatforms.Mac | BuildPlatforms.Windows,
SolutionPath = "./Xamarin.Firebase.JobDispatcher.sln",
OutputFiles = new [] {
new OutputFileCopy {
FromFile = "./source/Firebase.JobDispatcher/bin/Release/Xamarin.Firebase.JobDispatcher.dll",
}
}
}
},
Samples = new ISolutionBuilder [] {
new DefaultSolutionBuilder { SolutionPath = "./Xamarin.Firebase.JobDispatcher.sln" },
},
NuGets = new [] {
new NuGetInfo { NuSpec = "./nuget/Xamarin.Firebase.JobDispatcher.nuspec", Version = ANDROID_NUGET_VERSION },
},
};
Task ("externals")
.Does (() =>
{
if (!DirectoryExists ("./externals/"))
CreateDirectory ("./externals/");
DownloadFile (ANDROID_URL, "./externals/" + ANDROID_FILE);
StartProcess ("/usr/bin/zip", "-d ./externals/firebase-dispatcher.aar annotations.zip");
});
Task ("clean").IsDependentOn ("clean-base").Does (() =>
{
DeleteFiles ("./externals/*.aar");
});
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
RunTarget (TARGET);
|
mit
|
C#
|
7a18e4671393dfd278655716c66889a0e18988b4
|
Update SubscriptionService
|
lucasdavid/Gamedalf,lucasdavid/Gamedalf
|
Gamedalf.Services/SubscriptionService.cs
|
Gamedalf.Services/SubscriptionService.cs
|
using Gamedalf.Core.Data;
using Gamedalf.Core.Models;
using Gamedalf.Services.Infrastructure;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
namespace Gamedalf.Services
{
public class SubscriptionService : Service<Subscription>
{
public SubscriptionService(ApplicationDbContext db) : base(db){}
public virtual Subscription Latest()
{
return Db.Subscriptions.FirstOrDefault();
}
public async Task<ICollection<Subscription>> ReverseAll()
{
return await Db.Subscriptions
.OrderByDescending(s => s.Id)
.ToListAsync();
}
}
}
|
using Gamedalf.Core.Models;
using Gamedalf.Services.Infrastructure;
using System.Threading.Tasks;
using System.Linq;
using Gamedalf.Core.Data;
namespace Gamedalf.Services
{
public class SubscriptionService : Service<Subscription>
{
public SubscriptionService(ApplicationDbContext db) : base(db){}
public virtual Subscription Last()
{
return Db.Subscriptions
.Last();
}
}
}
|
mit
|
C#
|
2ca24225e245fe19062166aa330fa72536631a61
|
Improve Identifier.GetVariableString
|
occar421/OpenTKAnalyzer
|
src/OpenTKAnalyzer/OpenTKAnalyzer/Utility/Identifier.cs
|
src/OpenTKAnalyzer/OpenTKAnalyzer/Utility/Identifier.cs
|
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenTKAnalyzer.Utility
{
static public class Identifier
{
/// <summary>
/// Get identity string of variable.
/// </summary>
/// <param name="expression">expression node</param>
/// <param name="semanticModel">semantic Model</param>
/// <returns>indentity string : [Namespace].[Class].[MemberName] or ([Namespace].[Class].[Method]).[LocalVariableName]</returns>
static public string GetVariableString(ExpressionSyntax expression, SemanticModel semanticModel)
{
if (semanticModel == null)
{
throw new ArgumentNullException(nameof(semanticModel));
}
if (expression == null)
{
return null;
}
var walker = new NamingWalker(semanticModel);
walker.Visit(expression);
return walker.Identity;
}
class NamingWalker : CSharpSyntaxWalker
{
SemanticModel semanticModel;
string prefix = string.Empty;
string id = string.Empty;
string suffix = string.Empty;
public string Identity => string.IsNullOrEmpty(id) ? null : prefix + id + suffix;
public NamingWalker(SemanticModel semanticModel)
{
this.semanticModel = semanticModel;
}
public override void DefaultVisit(SyntaxNode node)
{
var symbol = semanticModel.GetSymbolInfo(node).Symbol;
if (symbol?.Kind == SymbolKind.Local)
{
string methodName = symbol.ContainingSymbol.Name;
var className = string.Empty;
for (var cs = symbol.ContainingType; cs != null; cs = cs.ContainingType)
{
className = cs.Name + "." + className;
}
var namespaceName = string.Empty;
for (var ns = symbol.ContainingNamespace; ns != null && ns.Name != string.Empty; ns = ns.ContainingNamespace)
{
namespaceName = ns.Name + "." + namespaceName;
}
id = $"({namespaceName}{className}{methodName}).{symbol.Name}";
}
else if (symbol?.Kind == SymbolKind.Method)
{
var str = symbol.ToString();
id = str.Substring(0, str.Length - 2);
}
else
{
id = symbol?.ToString();
}
}
public override void VisitInvocationExpression(InvocationExpressionSyntax node)
{
// no code here
}
public override void VisitElementAccessExpression(ElementAccessExpressionSyntax node)
{
Visit(node.Expression);
suffix = node.ArgumentList.WithoutTrivia().ToFullString() + suffix;
}
}
}
}
|
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenTKAnalyzer.Utility
{
static public class Identifier
{
/// <summary>
/// Get identity string of variable.
/// </summary>
/// <param name="expression">expression node</param>
/// <param name="semanticModel">semantic Model</param>
/// <returns>indentity string</returns>
static public string GetVariableString(ExpressionSyntax expression, SemanticModel semanticModel)
{
if (expression == null)
{
return null;
}
if (expression is ElementAccessExpressionSyntax)
{
var identifierSymbol = semanticModel.GetSymbolInfo(expression.ChildNodes().First()).Symbol;
var index = expression.ChildNodes().Skip(1).FirstOrDefault()?.WithoutTrivia();
return identifierSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + index.ToFullString();
}
if (expression is BinaryExpressionSyntax)
{
return null;
}
if (expression is PostfixUnaryExpressionSyntax)
{
return null;
}
if (NumericValueParser.ParseFromExpressionDoubleOrNull(expression as ExpressionSyntax).HasValue) // constant
{
return null;
}
if (expression is PrefixUnaryExpressionSyntax)
{
return null;
}
else
{
return semanticModel.GetSymbolInfo(expression).Symbol?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
}
}
}
}
|
mit
|
C#
|
1e582fa76aee8275ecc43fd1e12472b1e720f230
|
Bump version
|
oozcitak/imagelistview
|
ImageListView/Properties/AssemblyInfo.cs
|
ImageListView/Properties/AssemblyInfo.cs
|
// ImageListView - A listview control for image files
// Copyright (C) 2009 Ozgur Ozcitak
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Ozgur Ozcitak (ozcitak@yahoo.com)
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ImageListView")]
[assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Özgür Özçıtak")]
[assembly: AssemblyProduct("ImageListView")]
[assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")]
[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("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")]
// 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("13.7.3.0")]
[assembly: AssemblyFileVersion("13.7.3.0")]
|
// ImageListView - A listview control for image files
// Copyright (C) 2009 Ozgur Ozcitak
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Ozgur Ozcitak (ozcitak@yahoo.com)
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ImageListView")]
[assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Özgür Özçıtak")]
[assembly: AssemblyProduct("ImageListView")]
[assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")]
[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("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")]
// 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("13.7.2.0")]
[assembly: AssemblyFileVersion("13.7.2.0")]
|
apache-2.0
|
C#
|
821b2007143be27580d6bcfe8050ca3a5c137847
|
bump up the instance count of dedicated event posts job
|
exceptionless/Exceptionless,exceptionless/Exceptionless,exceptionless/Exceptionless,exceptionless/Exceptionless
|
Source/Jobs/EventPost/Program.cs
|
Source/Jobs/EventPost/Program.cs
|
using System;
using Exceptionless.Core;
using Exceptionless.Core.Extensions;
using Foundatio.Extensions;
using Foundatio.Jobs;
using Foundatio.ServiceProviders;
namespace EventPostsJob {
public class Program {
public static int Main() {
AppDomain.CurrentDomain.SetDataDirectory();
var loggerFactory = Settings.Current.GetLoggerFactory();
var serviceProvider = ServiceProvider.GetServiceProvider(Settings.JobBootstrappedServiceProvider, loggerFactory);
var job = serviceProvider.GetService<Exceptionless.Core.Jobs.EventPostsJob>();
return new JobRunner(job, loggerFactory, initialDelay: TimeSpan.FromSeconds(2), interval: TimeSpan.Zero, instanceCount: 2).RunInConsole();
}
}
}
|
using System;
using Exceptionless.Core;
using Exceptionless.Core.Extensions;
using Foundatio.Extensions;
using Foundatio.Jobs;
using Foundatio.ServiceProviders;
namespace EventPostsJob {
public class Program {
public static int Main() {
AppDomain.CurrentDomain.SetDataDirectory();
var loggerFactory = Settings.Current.GetLoggerFactory();
var serviceProvider = ServiceProvider.GetServiceProvider(Settings.JobBootstrappedServiceProvider, loggerFactory);
var job = serviceProvider.GetService<Exceptionless.Core.Jobs.EventPostsJob>();
return new JobRunner(job, loggerFactory, initialDelay: TimeSpan.FromSeconds(2), interval: TimeSpan.Zero).RunInConsole();
}
}
}
|
apache-2.0
|
C#
|
0b2d07a6a61590dc24587a3cde6dd63a0ce09387
|
Allow strerror to work with either strerror_r signature
|
brett25/corefx,seanshpark/corefx,richlander/corefx,larsbj1988/corefx,scott156/corefx,dtrebbien/corefx,Petermarcu/corefx,lydonchandra/corefx,janhenke/corefx,shahid-pk/corefx,rubo/corefx,KrisLee/corefx,arronei/corefx,Priya91/corefx-1,vidhya-bv/corefx-sorting,SGuyGe/corefx,larsbj1988/corefx,dsplaisted/corefx,manu-silicon/corefx,n1ghtmare/corefx,tstringer/corefx,Winsto/corefx,matthubin/corefx,nbarbettini/corefx,krk/corefx,xuweixuwei/corefx,nbarbettini/corefx,gregg-miskelly/corefx,cydhaselton/corefx,Winsto/corefx,zhenlan/corefx,yizhang82/corefx,bpschoch/corefx,MaggieTsang/corefx,thiagodin/corefx,matthubin/corefx,dotnet-bot/corefx,fernando-rodriguez/corefx,fgreinacher/corefx,alphonsekurian/corefx,jhendrixMSFT/corefx,viniciustaveira/corefx,benpye/corefx,mellinoe/corefx,lydonchandra/corefx,mmitche/corefx,Chrisboh/corefx,alexperovich/corefx,rubo/corefx,akivafr123/corefx,Jiayili1/corefx,tijoytom/corefx,thiagodin/corefx,vidhya-bv/corefx-sorting,zhenlan/corefx,adamralph/corefx,scott156/corefx,heXelium/corefx,tijoytom/corefx,SGuyGe/corefx,ravimeda/corefx,mokchhya/corefx,n1ghtmare/corefx,khdang/corefx,matthubin/corefx,zhenlan/corefx,wtgodbe/corefx,thiagodin/corefx,ellismg/corefx,elijah6/corefx,claudelee/corefx,MaggieTsang/corefx,mazong1123/corefx,stephenmichaelf/corefx,ViktorHofer/corefx,oceanho/corefx,dhoehna/corefx,alphonsekurian/corefx,wtgodbe/corefx,richlander/corefx,rjxby/corefx,cartermp/corefx,benjamin-bader/corefx,marksmeltzer/corefx,bpschoch/corefx,dotnet-bot/corefx,chenkennt/corefx,andyhebear/corefx,oceanho/corefx,destinyclown/corefx,axelheer/corefx,jcme/corefx,misterzik/corefx,zhangwenquan/corefx,DnlHarvey/corefx,SGuyGe/corefx,gregg-miskelly/corefx,elijah6/corefx,gregg-miskelly/corefx,s0ne0me/corefx,ptoonen/corefx,rajansingh10/corefx,zmaruo/corefx,DnlHarvey/corefx,Ermiar/corefx,akivafr123/corefx,mokchhya/corefx,Chrisboh/corefx,zhenlan/corefx,Winsto/corefx,lggomez/corefx,marksmeltzer/corefx,rjxby/corefx,krytarowski/corefx,misterzik/corefx,dkorolev/corefx,stephenmichaelf/corefx,alphonsekurian/corefx,iamjasonp/corefx,weltkante/corefx,rjxby/corefx,BrennanConroy/corefx,shmao/corefx,vs-team/corefx,huanjie/corefx,stone-li/corefx,jeremymeng/corefx,MaggieTsang/corefx,stormleoxia/corefx,comdiv/corefx,vijaykota/corefx,dkorolev/corefx,mazong1123/corefx,cartermp/corefx,alphonsekurian/corefx,PatrickMcDonald/corefx,s0ne0me/corefx,Jiayili1/corefx,shmao/corefx,YoupHulsebos/corefx,nbarbettini/corefx,manu-silicon/corefx,dsplaisted/corefx,uhaciogullari/corefx,yizhang82/corefx,marksmeltzer/corefx,tstringer/corefx,mmitche/corefx,yizhang82/corefx,brett25/corefx,jlin177/corefx,fffej/corefx,jeremymeng/corefx,benjamin-bader/corefx,kkurni/corefx,larsbj1988/corefx,bitcrazed/corefx,kyulee1/corefx,alphonsekurian/corefx,cydhaselton/corefx,KrisLee/corefx,vs-team/corefx,misterzik/corefx,MaggieTsang/corefx,janhenke/corefx,krk/corefx,erpframework/corefx,shana/corefx,alexperovich/corefx,mafiya69/corefx,jeremymeng/corefx,YoupHulsebos/corefx,heXelium/corefx,Jiayili1/corefx,cartermp/corefx,stormleoxia/corefx,anjumrizwi/corefx,ravimeda/corefx,alexperovich/corefx,Chrisboh/corefx,claudelee/corefx,benpye/corefx,nelsonsar/corefx,mazong1123/corefx,elijah6/corefx,Frank125/corefx,shahid-pk/corefx,fgreinacher/corefx,rubo/corefx,spoiledsport/corefx,ericstj/corefx,krytarowski/corefx,comdiv/corefx,iamjasonp/corefx,ravimeda/corefx,shmao/corefx,lggomez/corefx,bitcrazed/corefx,dotnet-bot/corefx,Petermarcu/corefx,KrisLee/corefx,rubo/corefx,cnbin/corefx,pallavit/corefx,adamralph/corefx,tstringer/corefx,shahid-pk/corefx,vidhya-bv/corefx-sorting,alexandrnikitin/corefx,nchikanov/corefx,JosephTremoulet/corefx,mmitche/corefx,shimingsg/corefx,PatrickMcDonald/corefx,ptoonen/corefx,mokchhya/corefx,richlander/corefx,dhoehna/corefx,jeremymeng/corefx,chaitrakeshav/corefx,gabrielPeart/corefx,stephenmichaelf/corefx,mellinoe/corefx,ravimeda/corefx,vrassouli/corefx,ptoonen/corefx,destinyclown/corefx,viniciustaveira/corefx,mellinoe/corefx,Alcaro/corefx,uhaciogullari/corefx,jmhardison/corefx,shrutigarg/corefx,pgavlin/corefx,ptoonen/corefx,richlander/corefx,ellismg/corefx,shrutigarg/corefx,zhangwenquan/corefx,tstringer/corefx,nelsonsar/corefx,cydhaselton/corefx,krk/corefx,elijah6/corefx,SGuyGe/corefx,janhenke/corefx,elijah6/corefx,alexperovich/corefx,PatrickMcDonald/corefx,jlin177/corefx,billwert/corefx,benpye/corefx,axelheer/corefx,YoupHulsebos/corefx,jhendrixMSFT/corefx,tijoytom/corefx,wtgodbe/corefx,pallavit/corefx,jmhardison/corefx,CherryCxldn/corefx,Petermarcu/corefx,dtrebbien/corefx,erpframework/corefx,rjxby/corefx,scott156/corefx,tijoytom/corefx,shimingsg/corefx,andyhebear/corefx,comdiv/corefx,nchikanov/corefx,akivafr123/corefx,shahid-pk/corefx,viniciustaveira/corefx,ericstj/corefx,nbarbettini/corefx,VPashkov/corefx,jlin177/corefx,cydhaselton/corefx,JosephTremoulet/corefx,benjamin-bader/corefx,krk/corefx,shiftkey-tester/corefx,ptoonen/corefx,yizhang82/corefx,mazong1123/corefx,cartermp/corefx,ericstj/corefx,arronei/corefx,shiftkey-tester/corefx,benpye/corefx,YoupHulsebos/corefx,vs-team/corefx,Frank125/corefx,MaggieTsang/corefx,cydhaselton/corefx,huanjie/corefx,bpschoch/corefx,Priya91/corefx-1,shimingsg/corefx,rahku/corefx,chaitrakeshav/corefx,ViktorHofer/corefx,stormleoxia/corefx,benjamin-bader/corefx,krk/corefx,fgreinacher/corefx,dkorolev/corefx,pallavit/corefx,rahku/corefx,dhoehna/corefx,dotnet-bot/corefx,nchikanov/corefx,gkhanna79/corefx,jhendrixMSFT/corefx,brett25/corefx,Jiayili1/corefx,ViktorHofer/corefx,rahku/corefx,jcme/corefx,pallavit/corefx,josguil/corefx,JosephTremoulet/corefx,kkurni/corefx,jlin177/corefx,VPashkov/corefx,cnbin/corefx,lggomez/corefx,n1ghtmare/corefx,alexperovich/corefx,krk/corefx,chenxizhang/corefx,Frank125/corefx,weltkante/corefx,seanshpark/corefx,zhangwenquan/corefx,CloudLens/corefx,Petermarcu/corefx,rahku/corefx,dhoehna/corefx,shana/corefx,ViktorHofer/corefx,rahku/corefx,dsplaisted/corefx,Alcaro/corefx,ptoonen/corefx,popolan1986/corefx,stone-li/corefx,jhendrixMSFT/corefx,josguil/corefx,EverlessDrop41/corefx,matthubin/corefx,axelheer/corefx,vrassouli/corefx,nchikanov/corefx,iamjasonp/corefx,krk/corefx,alphonsekurian/corefx,BrennanConroy/corefx,n1ghtmare/corefx,gkhanna79/corefx,cartermp/corefx,alexperovich/corefx,rjxby/corefx,ellismg/corefx,rajansingh10/corefx,brett25/corefx,Jiayili1/corefx,manu-silicon/corefx,viniciustaveira/corefx,zmaruo/corefx,JosephTremoulet/corefx,alexandrnikitin/corefx,vijaykota/corefx,iamjasonp/corefx,mellinoe/corefx,gkhanna79/corefx,mellinoe/corefx,mafiya69/corefx,ravimeda/corefx,manu-silicon/corefx,lggomez/corefx,zmaruo/corefx,stephenmichaelf/corefx,ptoonen/corefx,axelheer/corefx,JosephTremoulet/corefx,pallavit/corefx,parjong/corefx,s0ne0me/corefx,the-dwyer/corefx,anjumrizwi/corefx,shmao/corefx,adamralph/corefx,Chrisboh/corefx,parjong/corefx,EverlessDrop41/corefx,popolan1986/corefx,stephenmichaelf/corefx,690486439/corefx,690486439/corefx,CherryCxldn/corefx,chenxizhang/corefx,weltkante/corefx,janhenke/corefx,parjong/corefx,s0ne0me/corefx,rajansingh10/corefx,ericstj/corefx,Yanjing123/corefx,stormleoxia/corefx,nbarbettini/corefx,stone-li/corefx,mmitche/corefx,rjxby/corefx,mazong1123/corefx,larsbj1988/corefx,jcme/corefx,mazong1123/corefx,krytarowski/corefx,iamjasonp/corefx,Yanjing123/corefx,nchikanov/corefx,VPashkov/corefx,Ermiar/corefx,gabrielPeart/corefx,nelsonsar/corefx,mafiya69/corefx,oceanho/corefx,Petermarcu/corefx,the-dwyer/corefx,stone-li/corefx,690486439/corefx,billwert/corefx,the-dwyer/corefx,andyhebear/corefx,oceanho/corefx,jhendrixMSFT/corefx,mokchhya/corefx,fffej/corefx,josguil/corefx,jcme/corefx,chenxizhang/corefx,kkurni/corefx,claudelee/corefx,marksmeltzer/corefx,thiagodin/corefx,mafiya69/corefx,fffej/corefx,chenkennt/corefx,Petermarcu/corefx,mmitche/corefx,comdiv/corefx,gkhanna79/corefx,ericstj/corefx,twsouthwick/corefx,Priya91/corefx-1,lggomez/corefx,khdang/corefx,VPashkov/corefx,bitcrazed/corefx,wtgodbe/corefx,parjong/corefx,benjamin-bader/corefx,bitcrazed/corefx,axelheer/corefx,manu-silicon/corefx,ericstj/corefx,huanjie/corefx,shmao/corefx,billwert/corefx,kyulee1/corefx,shimingsg/corefx,dtrebbien/corefx,mmitche/corefx,fernando-rodriguez/corefx,cnbin/corefx,stone-li/corefx,yizhang82/corefx,shiftkey-tester/corefx,bpschoch/corefx,YoupHulsebos/corefx,mazong1123/corefx,parjong/corefx,vijaykota/corefx,chaitrakeshav/corefx,Priya91/corefx-1,JosephTremoulet/corefx,marksmeltzer/corefx,stone-li/corefx,jeremymeng/corefx,billwert/corefx,zhenlan/corefx,vs-team/corefx,PatrickMcDonald/corefx,kkurni/corefx,KrisLee/corefx,chenkennt/corefx,dotnet-bot/corefx,alexperovich/corefx,n1ghtmare/corefx,stephenmichaelf/corefx,mafiya69/corefx,kyulee1/corefx,shana/corefx,lydonchandra/corefx,yizhang82/corefx,akivafr123/corefx,the-dwyer/corefx,josguil/corefx,stephenmichaelf/corefx,pgavlin/corefx,shmao/corefx,khdang/corefx,twsouthwick/corefx,tijoytom/corefx,ViktorHofer/corefx,shrutigarg/corefx,kkurni/corefx,alexandrnikitin/corefx,vrassouli/corefx,shahid-pk/corefx,CherryCxldn/corefx,alexandrnikitin/corefx,ellismg/corefx,rajansingh10/corefx,Alcaro/corefx,ravimeda/corefx,arronei/corefx,erpframework/corefx,kkurni/corefx,twsouthwick/corefx,the-dwyer/corefx,jhendrixMSFT/corefx,cydhaselton/corefx,EverlessDrop41/corefx,seanshpark/corefx,Frank125/corefx,andyhebear/corefx,ViktorHofer/corefx,huanjie/corefx,krytarowski/corefx,richlander/corefx,weltkante/corefx,wtgodbe/corefx,cydhaselton/corefx,tstringer/corefx,janhenke/corefx,zhangwenquan/corefx,claudelee/corefx,benpye/corefx,benjamin-bader/corefx,DnlHarvey/corefx,jcme/corefx,dtrebbien/corefx,shana/corefx,dkorolev/corefx,mokchhya/corefx,khdang/corefx,vrassouli/corefx,Priya91/corefx-1,vidhya-bv/corefx-sorting,zmaruo/corefx,lydonchandra/corefx,jmhardison/corefx,ravimeda/corefx,krytarowski/corefx,Ermiar/corefx,richlander/corefx,Yanjing123/corefx,Alcaro/corefx,gkhanna79/corefx,parjong/corefx,khdang/corefx,Ermiar/corefx,Priya91/corefx-1,axelheer/corefx,mmitche/corefx,shimingsg/corefx,marksmeltzer/corefx,Chrisboh/corefx,rubo/corefx,spoiledsport/corefx,gkhanna79/corefx,SGuyGe/corefx,parjong/corefx,benpye/corefx,scott156/corefx,shahid-pk/corefx,nchikanov/corefx,vidhya-bv/corefx-sorting,shimingsg/corefx,iamjasonp/corefx,nchikanov/corefx,manu-silicon/corefx,YoupHulsebos/corefx,nelsonsar/corefx,manu-silicon/corefx,nbarbettini/corefx,ViktorHofer/corefx,pallavit/corefx,jcme/corefx,pgavlin/corefx,rahku/corefx,wtgodbe/corefx,khdang/corefx,cnbin/corefx,mokchhya/corefx,lggomez/corefx,bitcrazed/corefx,tijoytom/corefx,xuweixuwei/corefx,Yanjing123/corefx,kyulee1/corefx,Chrisboh/corefx,spoiledsport/corefx,elijah6/corefx,xuweixuwei/corefx,jmhardison/corefx,mafiya69/corefx,seanshpark/corefx,rahku/corefx,weltkante/corefx,ellismg/corefx,uhaciogullari/corefx,fffej/corefx,weltkante/corefx,alphonsekurian/corefx,iamjasonp/corefx,690486439/corefx,uhaciogullari/corefx,DnlHarvey/corefx,MaggieTsang/corefx,tijoytom/corefx,dotnet-bot/corefx,DnlHarvey/corefx,yizhang82/corefx,ericstj/corefx,Jiayili1/corefx,akivafr123/corefx,billwert/corefx,YoupHulsebos/corefx,shimingsg/corefx,richlander/corefx,billwert/corefx,Petermarcu/corefx,seanshpark/corefx,wtgodbe/corefx,gabrielPeart/corefx,dhoehna/corefx,SGuyGe/corefx,CherryCxldn/corefx,heXelium/corefx,seanshpark/corefx,popolan1986/corefx,destinyclown/corefx,Ermiar/corefx,Jiayili1/corefx,Ermiar/corefx,DnlHarvey/corefx,chaitrakeshav/corefx,690486439/corefx,fernando-rodriguez/corefx,elijah6/corefx,rjxby/corefx,gregg-miskelly/corefx,cartermp/corefx,jlin177/corefx,dhoehna/corefx,CloudLens/corefx,twsouthwick/corefx,erpframework/corefx,jlin177/corefx,krytarowski/corefx,weltkante/corefx,twsouthwick/corefx,mellinoe/corefx,CloudLens/corefx,shmao/corefx,anjumrizwi/corefx,ellismg/corefx,billwert/corefx,MaggieTsang/corefx,JosephTremoulet/corefx,jhendrixMSFT/corefx,PatrickMcDonald/corefx,dotnet-bot/corefx,dhoehna/corefx,josguil/corefx,janhenke/corefx,zhenlan/corefx,krytarowski/corefx,jlin177/corefx,marksmeltzer/corefx,nbarbettini/corefx,shiftkey-tester/corefx,the-dwyer/corefx,josguil/corefx,zhenlan/corefx,CloudLens/corefx,tstringer/corefx,fgreinacher/corefx,heXelium/corefx,gabrielPeart/corefx,seanshpark/corefx,gkhanna79/corefx,Yanjing123/corefx,twsouthwick/corefx,pgavlin/corefx,BrennanConroy/corefx,lggomez/corefx,the-dwyer/corefx,stone-li/corefx,Ermiar/corefx,anjumrizwi/corefx,shrutigarg/corefx,alexandrnikitin/corefx,twsouthwick/corefx,DnlHarvey/corefx
|
src/Common/src/Interop/Unix/libc/Interop.strerror.cs
|
src/Common/src/Interop/Unix/libc/Interop.strerror.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
using size_t = System.IntPtr;
internal static partial class Interop
{
internal static partial class libc
{
internal static string strerror(int errno)
{
string result = s_isGnu.Value ? strerror_gnu(errno) : strerror_xsi(errno);
// System.Diagnostics.Debug.WriteLine("strerror: " + result + "\n" + System.Environment.StackTrace); // uncomment to aid debugging
return result;
}
// strerror is not thread-safe; instead, there is the strerror_r function, which is thread-safe.
// However, there are two versions of strerror_r:
// - GNU: char* strerror_r(int, char*, size_t);
// - XSI: int strerror_r(int, char*, size_T);
// The former may or may not use the supplied buffer, and returns the error message string.
// The latter stores the error message string into the supplied buffer.
// Due to the different return values, we don't want to just choose one signature
// and try to use a heuristic to deduce which version we're dealing with, as that
// could result in a stack imbalance due to the varied return result size on 64-bit. Instead,
// we detect whether we're compiled against GNU's libc by trying to invoke its
// version-getting method, and invoke the right signature based on that.
private static Lazy<bool> s_isGnu = new Lazy<bool>(() =>
{
try
{
// Just try to call the P/Invoke. If it succeeds, this is GNU libc.
gnu_get_libc_version();
return true;
}
catch
{
// Otherwise, it's not.
return false;
}
});
private const int MaxErrorMessageLength = 1024; // length long enough for most any Unix error messages
private static unsafe string strerror_gnu(int errno)
{
byte* buffer = stackalloc byte[MaxErrorMessageLength];
return strerror_r_gnu(errno, buffer, (IntPtr)MaxErrorMessageLength);
}
private static unsafe string strerror_xsi(int errno)
{
byte* buffer = stackalloc byte[MaxErrorMessageLength];
int ignored = strerror_r_xsi(errno, buffer, (size_t)MaxErrorMessageLength);
// We ignore the return value of strerror_r. The only three valid return values are 0
// for success, EINVAL for an unknown errno value, and ERANGE if there's not enough
// buffer space provided. For EINVAL, it'll still fill the buffer with a reasonable error
// string (e.g. "Unknown error: 0x123"), and for ERANGE, it'll fill the buffer with as much
// of the error as can it, null-terminated. For now we don't grow the buffer, we could
// in the future if desired.
return Marshal.PtrToStringAnsi((IntPtr)buffer);
}
[DllImport(Libraries.Libc, EntryPoint = "strerror_r")]
private static extern unsafe string strerror_r_gnu(int errnum, byte* buf, size_t buflen);
[DllImport(Libraries.Libc, EntryPoint = "strerror_r")]
private static extern unsafe int strerror_r_xsi(int errnum, byte* buf, size_t buflen);
[DllImport(Libraries.Libc)]
private static extern string gnu_get_libc_version();
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
using size_t = System.IntPtr;
internal static partial class Interop
{
internal static partial class libc
{
internal unsafe static string strerror(int errno) // thread-safe version of strerror that internally uses strerror_r, which is thread-safe
{
const int bufferLength = 1024; // length long enough for most any Unix error messages
byte* buffer = stackalloc byte[bufferLength];
IntPtr errorPtr = (IntPtr)strerror_r(errno, buffer, (IntPtr)bufferLength);
return Marshal.PtrToStringAnsi(errorPtr); // TODO: Use the proper Encoding
}
[DllImport(Libraries.Libc)]
private static extern unsafe byte* strerror_r(int errnum, byte* buf, size_t buflen); // GNU-specific
}
}
|
mit
|
C#
|
4d98e817ca208bd2919b5e4b835038f50f342a44
|
Update EvolveConfigurationException base message
|
lecaillon/Evolve
|
src/Evolve/Exception/EvolveConfigurationException.cs
|
src/Evolve/Exception/EvolveConfigurationException.cs
|
using System;
namespace Evolve
{
public class EvolveConfigurationException : EvolveException
{
private const string EvolveConfigurationError = "Evolve configuration error: ";
public EvolveConfigurationException(string message) : base(EvolveConfigurationError + message) { }
public EvolveConfigurationException(string message, Exception innerException) : base(EvolveConfigurationError + message, innerException) { }
}
}
|
using System;
namespace Evolve
{
public class EvolveConfigurationException : EvolveException
{
public EvolveConfigurationException(string message) : base(message) { }
public EvolveConfigurationException(string message, Exception innerException) : base(message, innerException) { }
}
}
|
mit
|
C#
|
0d5b9862fbee1192ebdbaba6ee88035766d40841
|
Change model reference with old namespace to new
|
erooijak/oogstplanner,erooijak/oogstplanner,erooijak/oogstplanner,erooijak/oogstplanner
|
Oogstplanner.Web/Views/Crop/Index.cshtml
|
Oogstplanner.Web/Views/Crop/Index.cshtml
|
@model IEnumerable<Crop>
@{
ViewBag.Title = "Gewassen";
}
<div id="top"></div>
<div id="yearCalendar">
<h1>Dit zijn de gewassen in onze database:</h1>
<table class="table table-striped">
<tr>
<th>Naam</th><th>Ras</th><th>Categorie</th><th>Opp. per 1</th>
<th>Opp. per zak</th><th>Prijs per zakje</th><th>Zaaimaanden</th><th>Oogstmaanden</th>
</tr>
<tbody>
@foreach (var crop in Model) {
<tr>
<td>@crop.Name</td><td>@crop.Race</td><td>@crop.Category</td><td>@crop.AreaPerCrop</td>
<td>@crop.AreaPerBag</td><td>@crop.PricePerBag</td>
<td>@crop.SowingMonths</td><td>@crop.HarvestingMonths</td>
</tr>
}
</tbody>
</table>
</div>
@Html.ActionLink("Terug naar Zaaien en oogsten", "Index", "Home", null, null)
|
@model IEnumerable<Oogstplanner.Models.Crop>
@{
ViewBag.Title = "Gewassen";
}
<div id="top"></div>
<div id="yearCalendar">
<h1>Dit zijn de gewassen in onze database:</h1>
<table class="table table-striped">
<tr>
<th>Naam</th><th>Ras</th><th>Categorie</th><th>Opp. per 1</th>
<th>Opp. per zak</th><th>Prijs per zakje</th><th>Zaaimaanden</th><th>Oogstmaanden</th>
</tr>
<tbody>
@foreach (var crop in Model) {
<tr>
<td>@crop.Name</td><td>@crop.Race</td><td>@crop.Category</td><td>@crop.AreaPerCrop</td>
<td>@crop.AreaPerBag</td><td>@crop.PricePerBag</td>
<td>@crop.SowingMonths</td><td>@crop.HarvestingMonths</td>
</tr>
}
</tbody>
</table>
</div>
@Html.ActionLink("Terug naar Zaaien en oogsten", "Index", "Home", null, null)
|
mit
|
C#
|
7df76bd97b9ee632493a4a704e18f8715ee887eb
|
fix ImageSharpConverter to use ResizeMode.Pad
|
signumsoftware/framework,signumsoftware/framework
|
Signum.Engine.Extensions/Word/ImageSharpConverter.cs
|
Signum.Engine.Extensions/Word/ImageSharpConverter.cs
|
using DocumentFormat.OpenXml.Packaging;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Processing;
using System.IO;
#pragma warning disable CA1416 // Validate platform compatibility
namespace Signum.Engine.Word;
public class ImageSharpConverter : IImageConverter<Image>
{
public static readonly ImageSharpConverter Instance = new ImageSharpConverter();
public Image FromStream(Stream stream)
{
return Image.Load(stream);
}
public (int width, int height) GetSize(Image image)
{
var size = image.Size();
return (size.Width, size.Height);
}
public Image Resize(Image image, int maxWidth, int maxHeight)
{
return image.Clone(x =>
{
x.Resize(new ResizeOptions
{
Size = new Size(maxWidth, maxHeight),
Mode = ResizeMode.Pad,
})
.BackgroundColor(Color.White);
});
}
public void Save(Image image, Stream str, ImagePartType imagePartType)
{
image.Save(str, ToImageFormat(imagePartType));
}
private static IImageEncoder ToImageFormat(ImagePartType imagePartType)
{
switch (imagePartType)
{
case ImagePartType.Bmp: return new SixLabors.ImageSharp.Formats.Bmp.BmpEncoder();
case ImagePartType.Emf: throw new NotSupportedException(imagePartType.ToString());
case ImagePartType.Gif: return new SixLabors.ImageSharp.Formats.Gif.GifEncoder();
case ImagePartType.Icon: throw new NotSupportedException(imagePartType.ToString());
case ImagePartType.Jpeg: return new SixLabors.ImageSharp.Formats.Jpeg.JpegEncoder();
case ImagePartType.Png: return new SixLabors.ImageSharp.Formats.Png.PngEncoder();
case ImagePartType.Tiff: return new SixLabors.ImageSharp.Formats.Tiff.TiffEncoder();
case ImagePartType.Wmf: throw new NotSupportedException(imagePartType.ToString());
}
throw new InvalidOperationException("Unexpected {0}".FormatWith(imagePartType));
}
}
|
using DocumentFormat.OpenXml.Packaging;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Processing;
using System.IO;
#pragma warning disable CA1416 // Validate platform compatibility
namespace Signum.Engine.Word;
public class ImageSharpConverter : IImageConverter<Image>
{
public static readonly ImageSharpConverter Instance = new ImageSharpConverter();
public Image FromStream(Stream stream)
{
return Image.Load(stream);
}
public (int width, int height) GetSize(Image image)
{
var size = image.Size();
return (size.Width, size.Height);
}
public Image Resize(Image image, int maxWidth, int maxHeight)
{
return image.Clone(x =>
{
x.Resize(new ResizeOptions
{
Size = new Size(maxWidth, maxHeight),
Mode = ResizeMode.Max,
})
.BackgroundColor(Color.White);
});
}
public void Save(Image image, Stream str, ImagePartType imagePartType)
{
image.Save(str, ToImageFormat(imagePartType));
}
private static IImageEncoder ToImageFormat(ImagePartType imagePartType)
{
switch (imagePartType)
{
case ImagePartType.Bmp: return new SixLabors.ImageSharp.Formats.Bmp.BmpEncoder();
case ImagePartType.Emf: throw new NotSupportedException(imagePartType.ToString());
case ImagePartType.Gif: return new SixLabors.ImageSharp.Formats.Gif.GifEncoder();
case ImagePartType.Icon: throw new NotSupportedException(imagePartType.ToString());
case ImagePartType.Jpeg: return new SixLabors.ImageSharp.Formats.Jpeg.JpegEncoder();
case ImagePartType.Png: return new SixLabors.ImageSharp.Formats.Png.PngEncoder();
case ImagePartType.Tiff: return new SixLabors.ImageSharp.Formats.Tiff.TiffEncoder();
case ImagePartType.Wmf: throw new NotSupportedException(imagePartType.ToString());
}
throw new InvalidOperationException("Unexpected {0}".FormatWith(imagePartType));
}
}
|
mit
|
C#
|
47b03a524e4dc342cabf09795def2ad55e08a580
|
fix #638 try to infer id of Document() if Object() is missing
|
TheFireCookie/elasticsearch-net,joehmchan/elasticsearch-net,azubanov/elasticsearch-net,LeoYao/elasticsearch-net,gayancc/elasticsearch-net,adam-mccoy/elasticsearch-net,LeoYao/elasticsearch-net,CSGOpenSource/elasticsearch-net,KodrAus/elasticsearch-net,Grastveit/NEST,tkirill/elasticsearch-net,adam-mccoy/elasticsearch-net,gayancc/elasticsearch-net,junlapong/elasticsearch-net,faisal00813/elasticsearch-net,alanprot/elasticsearch-net,cstlaurent/elasticsearch-net,junlapong/elasticsearch-net,LeoYao/elasticsearch-net,tkirill/elasticsearch-net,jonyadamit/elasticsearch-net,alanprot/elasticsearch-net,joehmchan/elasticsearch-net,UdiBen/elasticsearch-net,SeanKilleen/elasticsearch-net,robertlyson/elasticsearch-net,mac2000/elasticsearch-net,DavidSSL/elasticsearch-net,KodrAus/elasticsearch-net,SeanKilleen/elasticsearch-net,ststeiger/elasticsearch-net,ststeiger/elasticsearch-net,UdiBen/elasticsearch-net,abibell/elasticsearch-net,geofeedia/elasticsearch-net,TheFireCookie/elasticsearch-net,CSGOpenSource/elasticsearch-net,faisal00813/elasticsearch-net,TheFireCookie/elasticsearch-net,gayancc/elasticsearch-net,wawrzyn/elasticsearch-net,mac2000/elasticsearch-net,robrich/elasticsearch-net,KodrAus/elasticsearch-net,RossLieberman/NEST,amyzheng424/elasticsearch-net,Grastveit/NEST,geofeedia/elasticsearch-net,elastic/elasticsearch-net,starckgates/elasticsearch-net,azubanov/elasticsearch-net,RossLieberman/NEST,RossLieberman/NEST,jonyadamit/elasticsearch-net,DavidSSL/elasticsearch-net,alanprot/elasticsearch-net,robertlyson/elasticsearch-net,robertlyson/elasticsearch-net,starckgates/elasticsearch-net,robrich/elasticsearch-net,wawrzyn/elasticsearch-net,CSGOpenSource/elasticsearch-net,DavidSSL/elasticsearch-net,mac2000/elasticsearch-net,Grastveit/NEST,junlapong/elasticsearch-net,UdiBen/elasticsearch-net,faisal00813/elasticsearch-net,SeanKilleen/elasticsearch-net,starckgates/elasticsearch-net,cstlaurent/elasticsearch-net,abibell/elasticsearch-net,amyzheng424/elasticsearch-net,amyzheng424/elasticsearch-net,cstlaurent/elasticsearch-net,robrich/elasticsearch-net,wawrzyn/elasticsearch-net,alanprot/elasticsearch-net,jonyadamit/elasticsearch-net,abibell/elasticsearch-net,tkirill/elasticsearch-net,elastic/elasticsearch-net,ststeiger/elasticsearch-net,geofeedia/elasticsearch-net,azubanov/elasticsearch-net,joehmchan/elasticsearch-net,adam-mccoy/elasticsearch-net
|
src/Tests/Nest.Tests.Integration/Core/UpdateTests.cs
|
src/Tests/Nest.Tests.Integration/Core/UpdateTests.cs
|
using NUnit.Framework;
using Nest.Tests.MockData.Domain;
namespace Nest.Tests.Integration.Core
{
[TestFixture]
public class UpdateIntegrationTests : IntegrationTests
{
[Test]
public void TestUpdate()
{
var project = this._client.Source<ElasticsearchProject>(s => s.Id(1));
Assert.NotNull(project);
Assert.Greater(project.LOC, 0);
var loc = project.LOC;
this._client.Update<ElasticsearchProject>(u => u
.Object(project)
.Script("ctx._source.loc += 10")
.RetryOnConflict(5)
.Refresh()
);
project = this._client.Source<ElasticsearchProject>(s => s.Id(1));
Assert.AreEqual(project.LOC, loc + 10);
Assert.AreNotEqual(project.Version, "1");
}
public class ElasticsearchProjectLocUpdate
{
public int Id { get; set; }
[ElasticProperty(Name="loc",AddSortField=true)]
public int LOC { get; set; }
}
[Test]
public void DocAsUpsert()
{
var project = this._client.Source<ElasticsearchProject>(s => s.Id(2));
Assert.NotNull(project);
Assert.Greater(project.LOC, 0);
var loc = project.LOC;
this._client.Update<ElasticsearchProject, ElasticsearchProjectLocUpdate>(u => u
.Document(new ElasticsearchProjectLocUpdate
{
Id = project.Id,
LOC = project.LOC + 10
})
.DocAsUpsert()
.Refresh()
);
project = this._client.Source<ElasticsearchProject>(s => s.Id(2));
Assert.AreEqual(project.LOC, loc + 10);
Assert.AreNotEqual(project.Version, "1");
}
}
}
|
using NUnit.Framework;
using Nest.Tests.MockData.Domain;
namespace Nest.Tests.Integration.Core
{
[TestFixture]
public class UpdateIntegrationTests : IntegrationTests
{
[Test]
public void TestUpdate()
{
var project = this._client.Source<ElasticsearchProject>(s => s.Id(1));
Assert.NotNull(project);
Assert.Greater(project.LOC, 0);
var loc = project.LOC;
this._client.Update<ElasticsearchProject>(u => u
.Object(project)
.Script("ctx._source.loc += 10")
.RetryOnConflict(5)
.Refresh()
);
project = this._client.Source<ElasticsearchProject>(s => s.Id(1));
Assert.AreEqual(project.LOC, loc + 10);
Assert.AreNotEqual(project.Version, "1");
}
[Test]
public void DocAsUpsert()
{
var project = this._client.Source<ElasticsearchProject>(s => s.Id(1));
Assert.NotNull(project);
Assert.Greater(project.LOC, 0);
var loc = project.LOC;
this._client.Update<ElasticsearchProject>(u => u
.Document(project)
.DocAsUpsert()
.Refresh()
);
project = this._client.Source<ElasticsearchProject>(s => s.Id(1));
Assert.AreEqual(project.LOC, loc + 10);
Assert.AreNotEqual(project.Version, "1");
}
}
}
|
apache-2.0
|
C#
|
89e61f740b00fc8b86da52ed75e6edcb122cb84e
|
Fix last bug in parameters
|
christophwille/viennarealtime,christophwille/viennarealtime
|
Source/WienerLinien.Api/Routing/RoutingUrlBuilder.cs
|
Source/WienerLinien.Api/Routing/RoutingUrlBuilder.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WienerLinien.Api.Routing
{
public static class RoutingUrlBuilder
{
private const string BaseUrl = "http://www.wienerlinien.at/ogd_routing/XML_TRIP_REQUEST2?";
public static string Build(RoutingRequest request)
{
const string urlFormatString = BaseUrl +
"type_origin=stopID&name_origin={0}&type_destination=stopID&name_destination={1}&ptOptionsActive=1&itOptionsActive=1" +
"&itdDate={2:yyyyMMdd}&itdTime={2:HHmm}&routeType={3}" +
"&outputFormat=JSON";
// &itdTripDateTimeDepArr={4}
var url = String.Format(urlFormatString,
request.FromStation, request.ToStation,
request.When, RouteTypeToQueryStringParameter(request.RouteType));
return url;
}
private static string RouteTypeToQueryStringParameter(RouteTypeOption option)
{
switch (option)
{
case RouteTypeOption.LeastTime:
return "LEASTTIME";
break;
case RouteTypeOption.LeastInterchange:
return "LEASTINTERCHANGE";
break;
case RouteTypeOption.LeastWalking:
return "LEASTWALKING";
break;
default:
throw new ArgumentOutOfRangeException("option");
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WienerLinien.Api.Routing
{
public static class RoutingUrlBuilder
{
private const string BaseUrl = "http://www.wienerlinien.at/ogd_routing/XML_TRIP_REQUEST2?";
public static string Build(RoutingRequest request)
{
const string urlFormatString = BaseUrl +
"type_origin=stopID&name_origin={0}&type_destination=stopID&name_destination={1}&ptOptionsActive=1&itOptionsActive=1" +
"&itdDate={2:yyyyddMM}&idtTime={2:HHmm}&routeType={3}" +
"&outputFormat=JSON";
// &itdTripDateTimeDepArr={4}
var url = String.Format(urlFormatString,
request.FromStation, request.ToStation,
request.When, RouteTypeToQueryStringParameter(request.RouteType));
return url;
}
private static string RouteTypeToQueryStringParameter(RouteTypeOption option)
{
switch (option)
{
case RouteTypeOption.LeastTime:
return "LEASTTIME";
break;
case RouteTypeOption.LeastInterchange:
return "LEASTINTERCHANGE";
break;
case RouteTypeOption.LeastWalking:
return "LEASTWALKING";
break;
default:
throw new ArgumentOutOfRangeException("option");
}
}
}
}
|
mit
|
C#
|
d0185a33bb126b305c15624b72504632f948b465
|
fix welcome
|
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
|
src/backend/SO115App.Models/Classi/Condivise/Sede.cs
|
src/backend/SO115App.Models/Classi/Condivise/Sede.cs
|
//-----------------------------------------------------------------------
// <copyright file="Sede.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
using MongoDB.Bson.Serialization.Attributes;
namespace SO115App.API.Models.Classi.Condivise
{
[BsonIgnoreExtraElements]
public class Sede
{
private bool VisualizzazioneCentrale = true;
private string _descrizione;
public Sede(string codice, string descrizione, string indirizzo, Coordinate coordinate, bool visualizzazioneCentrale = true)
{
this.Codice = codice;
this.Descrizione = descrizione;
this.Indirizzo = indirizzo;
this.Coordinate = coordinate;
this.VisualizzazioneCentrale = visualizzazioneCentrale;
}
/// <summary>
/// Codice Sede
/// </summary>
public string Codice { get; set; }
/// <summary>
/// Descrizione Sede
/// </summary>
public string Descrizione
{
get
{
if (VisualizzazioneCentrale) return _descrizione
.Replace("Comando VV.F.", "Centrale")
.Replace("COMANDO VV.F.", "CENTRALE");
else return _descrizione;
}
set => _descrizione = value;
}
/// <summary>
/// Coordinate
/// </summary>
public Coordinate Coordinate { get; set; }
/// <summary>
/// Indirizzo della Sede
/// </summary>
public string Indirizzo { get; set; }
}
}
|
//-----------------------------------------------------------------------
// <copyright file="Sede.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
namespace SO115App.API.Models.Classi.Condivise
{
public class Sede
{
private bool VisualizzazioneCentrale = true;
private string _descrizione;
public Sede(string codice, string descrizione, string indirizzo, Coordinate coordinate, bool visualizzazioneCentrale = true)
{
this.Codice = codice;
this.Descrizione = descrizione;
this.Indirizzo = indirizzo;
this.Coordinate = coordinate;
this.VisualizzazioneCentrale = visualizzazioneCentrale;
}
/// <summary>
/// Codice Sede
/// </summary>
public string Codice { get; set; }
/// <summary>
/// Descrizione Sede
/// </summary>
public string Descrizione
{
get
{
if (VisualizzazioneCentrale) return _descrizione
.Replace("Comando VV.F.", "Centrale")
.Replace("COMANDO VV.F.", "CENTRALE");
else return _descrizione;
}
set => _descrizione = value;
}
/// <summary>
/// Coordinate
/// </summary>
public Coordinate Coordinate { get; set; }
/// <summary>
/// Indirizzo della Sede
/// </summary>
public string Indirizzo { get; set; }
}
}
|
agpl-3.0
|
C#
|
8cd283a6f9689135b0b63958286e28e350742ed1
|
Fix crash in test app
|
glasseyes/libpalaso,glasseyes/libpalaso,hatton/libpalaso,sillsdev/libpalaso,JohnThomson/libpalaso,ermshiperete/libpalaso,ermshiperete/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,mccarthyrb/libpalaso,JohnThomson/libpalaso,mccarthyrb/libpalaso,gtryus/libpalaso,andrew-polk/libpalaso,ddaspit/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,ermshiperete/libpalaso,mccarthyrb/libpalaso,sillsdev/libpalaso,JohnThomson/libpalaso,gtryus/libpalaso,JohnThomson/libpalaso,ddaspit/libpalaso,gmartin7/libpalaso,gmartin7/libpalaso,sillsdev/libpalaso,hatton/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,glasseyes/libpalaso,gtryus/libpalaso,andrew-polk/libpalaso,hatton/libpalaso,ddaspit/libpalaso,hatton/libpalaso,gmartin7/libpalaso,andrew-polk/libpalaso,gmartin7/libpalaso,tombogle/libpalaso,gtryus/libpalaso,tombogle/libpalaso
|
TestApps/TestAppKeyboard/KeyboardForm.cs
|
TestApps/TestAppKeyboard/KeyboardForm.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Palaso.UI.WindowsForms.Keyboarding;
using Palaso.UI.WindowsForms.Keyboarding.Interfaces;
using Palaso.WritingSystems;
namespace TestAppKeyboard
{
public partial class KeyboardForm : Form, IWindowsLanguageProfileSink
{
public KeyboardForm()
{
InitializeComponent();
if (DesignMode)
return;
KeyboardController.Initialize();
KeyboardController.Register(testAreaA, this);
KeyboardController.Register(testAreaB, this);
KeyboardController.Register(testAreaC, this);
LoadKeyboards(this.keyboardsA);
LoadKeyboards(this.keyboardsB);
LoadKeyboards(this.keyboardsC);
LoadKeyboards(this.currentKeyboard);
}
public void LoadKeyboards(ComboBox comboBox)
{
var keyboards = Keyboard.Controller.AllAvailableKeyboards;
foreach (var keyboard in keyboards)
{
comboBox.Items.Add(keyboard);
Console.WriteLine("added keyboard id: {0}, name: {1}", keyboard.Id, keyboard.Name);
}
comboBox.SelectedIndex = 0;
}
private void testAreaA_Enter(object sender, EventArgs e)
{
if (cbOnEnter.Checked)
{
var wantKeyboard = (KeyboardDescription)keyboardsA.SelectedItem;
Console.WriteLine("Enter A: Set to {0}", wantKeyboard);
Keyboard.Controller.SetKeyboard(wantKeyboard);
} else {
Console.WriteLine("Enter A");
}
}
private void testAreaB_Enter(object sender, EventArgs e)
{
if (cbOnEnter.Checked)
{
var wantKeyboard = (KeyboardDescription)keyboardsB.SelectedItem;
Console.WriteLine("Enter B: Set to {0}", wantKeyboard);
Keyboard.Controller.SetKeyboard(wantKeyboard);
} else {
Console.WriteLine("Enter B");
}
}
private void testAreaC_Enter(object sender, EventArgs e)
{
if (cbOnEnter.Checked)
{
var wantKeyboard = (KeyboardDescription)keyboardsC.SelectedItem;
Console.WriteLine("Enter C: Set to {0}", wantKeyboard);
Keyboard.Controller.SetKeyboard(wantKeyboard);
} else {
Console.WriteLine("Enter C");
}
}
#region IWindowsLanguageProfileSink Members
public void OnInputLanguageChanged(IKeyboardDefinition previousKeyboard, IKeyboardDefinition newKeyboard)
{
Console.WriteLine("TestAppKeyboard.OnLanguageChanged: previous {0}, new {1}",
previousKeyboard != null ? previousKeyboard.Layout : "<null>",
newKeyboard != null ? newKeyboard.Layout : "<null>");
lblCurrentKeyboard.Text = newKeyboard != null ? newKeyboard.Layout : "<null>";
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Palaso.UI.WindowsForms.Keyboarding;
using Palaso.UI.WindowsForms.Keyboarding.Interfaces;
using Palaso.WritingSystems;
namespace TestAppKeyboard
{
public partial class KeyboardForm : Form, IWindowsLanguageProfileSink
{
public KeyboardForm()
{
InitializeComponent();
if (DesignMode)
return;
KeyboardController.Initialize();
KeyboardController.Register(testAreaA, this);
KeyboardController.Register(testAreaB, this);
KeyboardController.Register(testAreaC, this);
LoadKeyboards(this.keyboardsA);
LoadKeyboards(this.keyboardsB);
LoadKeyboards(this.keyboardsC);
LoadKeyboards(this.currentKeyboard);
}
public void LoadKeyboards(ComboBox comboBox)
{
var keyboards = Keyboard.Controller.AllAvailableKeyboards;
foreach (var keyboard in keyboards)
{
comboBox.Items.Add(keyboard);
Console.WriteLine("added keyboard id: {0}, name: {1}", keyboard.Id, keyboard.Name);
}
comboBox.SelectedIndex = 0;
}
private void testAreaA_Enter(object sender, EventArgs e)
{
if (cbOnEnter.Checked)
{
var wantKeyboard = (KeyboardDescription)keyboardsA.SelectedItem;
Console.WriteLine("Enter A: Set to {0}", wantKeyboard);
Keyboard.Controller.SetKeyboard(wantKeyboard);
} else {
Console.WriteLine("Enter A");
}
}
private void testAreaB_Enter(object sender, EventArgs e)
{
if (cbOnEnter.Checked)
{
var wantKeyboard = (KeyboardDescription)keyboardsB.SelectedItem;
Console.WriteLine("Enter B: Set to {0}", wantKeyboard);
Keyboard.Controller.SetKeyboard(wantKeyboard);
} else {
Console.WriteLine("Enter B");
}
}
private void testAreaC_Enter(object sender, EventArgs e)
{
if (cbOnEnter.Checked)
{
var wantKeyboard = (KeyboardDescription)keyboardsC.SelectedItem;
Console.WriteLine("Enter C: Set to {0}", wantKeyboard);
Keyboard.Controller.SetKeyboard(wantKeyboard);
} else {
Console.WriteLine("Enter C");
}
}
#region IWindowsLanguageProfileSink Members
public void OnInputLanguageChanged(IKeyboardDefinition previousKeyboard, IKeyboardDefinition newKeyboard)
{
Console.WriteLine("TestAppKeyboard.OnLanguageChanged: previous {0}, new {1}",
previousKeyboard != null ? previousKeyboard.Layout : "<null>",
newKeyboard != null ? newKeyboard.Layout : "<null>");
lblCurrentKeyboard.Text = newKeyboard.Layout;
}
#endregion
}
}
|
mit
|
C#
|
a275612c9be5677994b5289dd78b81fb61ba25b0
|
Fix sample
|
mrahhal/MR.AspNetCore.Jobs,mrahhal/MR.AspNetCore.Jobs
|
samples/Basic/Models/AppDbContext.cs
|
samples/Basic/Models/AppDbContext.cs
|
using Microsoft.EntityFrameworkCore;
namespace Basic.Models
{
public class AppDbContext : DbContext
{
public AppDbContext()
{
}
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{
}
public DbSet<Blog> Blogs { get; set; }
}
}
|
using Microsoft.EntityFrameworkCore;
namespace Basic.Models
{
public class AppDbContext : DbContext
{
public AppDbContext()
{
}
public AppDbContext(DbContextOptions options) : base(options)
{
}
public DbSet<Blog> Blogs { get; set; }
}
}
|
mit
|
C#
|
e8fa6b38bfa9b3f7dd94c891752b54a49677cbe4
|
Update Program.cs
|
mattgwagner/Cash-Flow-Projection,mattgwagner/Cash-Flow-Projection,mattgwagner/Cash-Flow-Projection,mattgwagner/Cash-Flow-Projection
|
src/Cash-Flow-Projection/Program.cs
|
src/Cash-Flow-Projection/Program.cs
|
namespace Cash_Flow_Projection
{
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
|
using Microsoft.AspNetCore.Hosting;
using System.IO;
namespace Cash_Flow_Projection
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.CaptureStartupErrors(true)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
|
mit
|
C#
|
db184bffc4eddddab6c854ceb1507ab6b0bcc582
|
Update CommandOfT.cs
|
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
src/Core2D/ViewModels/CommandOfT.cs
|
src/Core2D/ViewModels/CommandOfT.cs
|
#nullable enable
using System;
using System.Windows.Input;
namespace Core2D.ViewModels;
public class Command<T> : ICommand
{
private readonly Action<T?> _execute;
private readonly Func<T?, bool> _canExecute;
public event EventHandler? CanExecuteChanged;
public Command(Action<T?> execute, Func<T?, bool>? canExecute = null)
{
_execute = execute;
_canExecute = canExecute ?? (_ => true);
}
public bool CanExecute(object? parameter)
{
return _canExecute.Invoke((T?)parameter);
}
public void Execute(object? parameter)
{
_execute.Invoke((T?)parameter);
}
}
|
#nullable enable
using System;
using System.Windows.Input;
namespace Core2D.ViewModels;
public class Command<T> : ICommand
{
private readonly Action<T?> _execute;
private readonly Func<T?, bool> _canExecute;
public event EventHandler? CanExecuteChanged;
public Command(Action<T?> execute, Func<T?, bool>? canExecute = null)
{
_execute = execute;
_canExecute = canExecute ?? (_ => true);
}
public bool CanExecute(object? parameter)
{
return _canExecute.Invoke((T?)parameter);
}
public void Execute(object? parameter)
{
_execute.Invoke((T?)parameter);
}
}
|
mit
|
C#
|
ec77ad096b82c3496004293191ad83bade1a3608
|
Stop movement when swing triggered
|
Soulai/GlobalGameJam2017
|
Assets/Scripts/Player/PlayerMovement.cs
|
Assets/Scripts/Player/PlayerMovement.cs
|
using UnityEngine;
namespace Player
{
public class PlayerMovement : MonoBehaviour
{
private Transform _transform;
private Rigidbody _rigidbody;
private Animator _animator;
private bool _swingInProgress;
public string AxisPrefix;
private void Start()
{
_transform = transform;
_rigidbody = GetComponent<Rigidbody>();
_animator = GetComponentInChildren<Animator>();
_swingInProgress = false;
}
private void Update()
{
HandleRotation();
HandleThrust();
if ((Input.GetButtonDown(AxisPrefix + "-Fire1")) && (!_swingInProgress))
{
_swingInProgress = true;
}
}
private void HandleRotation()
{
float stickValue = Input.GetAxis(AxisPrefix + "-Horizontal");
stickValue = Mathf.Abs(stickValue) > Rotation_Threshold ? stickValue : 0.0f;
float updatedY = _transform.eulerAngles.y + (stickValue * Maximum_Rotation_Speed);
_transform.localRotation = Quaternion.Euler(_transform.eulerAngles.x, updatedY, _transform.eulerAngles.z);
}
private void HandleThrust()
{
float stickValue = Input.GetAxis(AxisPrefix + "-Vertical");
if ((Mathf.Abs(stickValue) < Movement_Threshold) || (_swingInProgress))
{
stickValue = 0.0f;
}
Vector3 planarVector = new Vector3(_transform.forward.x, 0.0f, _transform.forward.z);
Vector3 movementVector = planarVector.normalized * stickValue * Maximum_Movement_Speed;
_animator.SetBool("IsMoving", stickValue > Movement_Threshold);
_rigidbody.velocity = new Vector3(movementVector.x, _rigidbody.velocity.y, movementVector.z);
}
private const float Rotation_Threshold = 0.25f;
private const float Maximum_Rotation_Speed = 2.0f;
private const float Movement_Threshold = 0.1f;
private const float Maximum_Movement_Speed = 5.0f;
}
}
|
using UnityEngine;
namespace Player
{
public class PlayerMovement : MonoBehaviour
{
private Transform _transform;
private Rigidbody _rigidbody;
private Animator _animator;
public string AxisPrefix;
private void Start()
{
_transform = transform;
_rigidbody = GetComponent<Rigidbody>();
_animator = GetComponentInChildren<Animator>();
}
private void Update()
{
HandleRotation();
HandleThrust();
}
private void HandleRotation()
{
float stickValue = Input.GetAxis(AxisPrefix + "-Horizontal");
float delta = Mathf.Abs(stickValue) > Rotation_Threshold ? stickValue : 0.0f;
float updatedY = _transform.eulerAngles.y + (delta * Maximum_Rotation_Speed);
_transform.localRotation = Quaternion.Euler(_transform.eulerAngles.x, updatedY, _transform.eulerAngles.z);
}
private void HandleThrust()
{
float stickValue = Input.GetAxis(AxisPrefix + "-Vertical");
float delta = Mathf.Abs(stickValue) > Movement_Threshold ? stickValue : 0.0f;
Vector3 planarVector = new Vector3(_transform.forward.x, 0.0f, _transform.forward.z);
Vector3 movementVector = planarVector.normalized * delta * Maximum_Movement_Speed;
_animator.SetBool("IsMoving", delta > Movement_Threshold);
_rigidbody.velocity = new Vector3(movementVector.x, _rigidbody.velocity.y, movementVector.z);
}
private const float Rotation_Threshold = 0.25f;
private const float Maximum_Rotation_Speed = 2.0f;
private const float Movement_Threshold = 0.1f;
private const float Maximum_Movement_Speed = 5.0f;
}
}
|
mit
|
C#
|
eb1888dee11586f356bcea3e8b845497f08feccb
|
Update OrderHandlers.cs
|
SimonCropp/HandlerOrdering
|
src/HandlerOrdering/OrderHandlers.cs
|
src/HandlerOrdering/OrderHandlers.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using HandlerOrdering;
using NServiceBus;
class OrderHandlers :
INeedInitialization
{
public void Customize(EndpointConfiguration configuration)
{
if (configuration.GetApplyInterfaceHandlerOrdering())
{
ApplyInterfaceHandlerOrdering(configuration);
}
}
public void ApplyInterfaceHandlerOrdering(EndpointConfiguration configuration)
{
var handlerDependencies = GetHandlerDependencies(configuration);
var sorted = new TypeSorter(handlerDependencies).Sorted;
configuration.ExecuteTheseHandlersFirst(sorted);
}
static Dictionary<Type, List<Type>> GetHandlerDependencies(EndpointConfiguration configuration)
{
var field = typeof(EndpointConfiguration)
.GetField("scannedTypes", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
throw new Exception($"Could not extract 'scannedTypes' field from {nameof(EndpointConfiguration)}. Raise an issue here https://github.com/NServiceBusExtensions/NServiceBus.HandlerOrdering/issues/new");
}
var types = (List<Type>) field.GetValue(configuration);
return GetHandlerDependencies(types);
}
internal static Dictionary<Type, List<Type>> GetHandlerDependencies(List<Type> types)
{
var dictionary = new Dictionary<Type, List<Type>>();
foreach (var type in types)
{
var interfaces = type.GetInterfaces();
foreach (var face in interfaces)
{
if (!face.IsGenericType)
{
continue;
}
if (face.GetGenericTypeDefinition() != typeof(IWantToRunAfter<>))
{
continue;
}
if (!dictionary.TryGetValue(type, out var dependencies))
{
dictionary[type] = dependencies = new List<Type>();
}
dependencies.Add(face.GenericTypeArguments.First());
}
}
return dictionary;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using HandlerOrdering;
using NServiceBus;
class OrderHandlers :
INeedInitialization
{
public void Customize(EndpointConfiguration configuration)
{
if (configuration.GetApplyInterfaceHandlerOrdering())
{
ApplyInterfaceHandlerOrdering(configuration);
}
}
public void ApplyInterfaceHandlerOrdering(EndpointConfiguration configuration)
{
var handlerDependencies = GetHandlerDependencies(endpointConfiguration);
var sorted = new TypeSorter(handlerDependencies).Sorted;
configuration.ExecuteTheseHandlersFirst(sorted);
}
static Dictionary<Type, List<Type>> GetHandlerDependencies(EndpointConfiguration configuration)
{
var field = typeof(EndpointConfiguration)
.GetField("scannedTypes", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
throw new Exception($"Could not extract 'scannedTypes' field from {nameof(EndpointConfiguration)}. Raise an issue here https://github.com/NServiceBusExtensions/NServiceBus.HandlerOrdering/issues/new");
}
var types = (List<Type>) field.GetValue(configuration);
return GetHandlerDependencies(types);
}
internal static Dictionary<Type, List<Type>> GetHandlerDependencies(List<Type> types)
{
var dictionary = new Dictionary<Type, List<Type>>();
foreach (var type in types)
{
var interfaces = type.GetInterfaces();
foreach (var face in interfaces)
{
if (!face.IsGenericType)
{
continue;
}
if (face.GetGenericTypeDefinition() != typeof(IWantToRunAfter<>))
{
continue;
}
if (!dictionary.TryGetValue(type, out var dependencies))
{
dictionary[type] = dependencies = new List<Type>();
}
dependencies.Add(face.GenericTypeArguments.First());
}
}
return dictionary;
}
}
|
mit
|
C#
|
b039eaa3c86bc0b407c1a1893655c9d53daa0239
|
Fix bug: Clearing the cache says "All items have been cleared from the recent packages list." Work items: 986
|
mdavid/nuget,mdavid/nuget
|
src/Options/GeneralOptionControl.cs
|
src/Options/GeneralOptionControl.cs
|
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using NuGet.VisualStudio;
namespace NuGet.Options {
public partial class GeneralOptionControl : UserControl {
private IRecentPackageRepository _recentPackageRepository;
private IProductUpdateSettings _productUpdateSettings;
public GeneralOptionControl() {
InitializeComponent();
_productUpdateSettings = ServiceLocator.GetInstance<IProductUpdateSettings>();
Debug.Assert(_productUpdateSettings != null);
_recentPackageRepository = ServiceLocator.GetInstance<IRecentPackageRepository>();
Debug.Assert(_recentPackageRepository != null);
}
private void OnClearRecentPackagesClick(object sender, EventArgs e) {
_recentPackageRepository.Clear();
MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearRecentPackages, Resources.ShowWarning_Title);
}
internal void OnActivated() {
checkForUpdate.Checked = _productUpdateSettings.ShouldCheckForUpdate;
browsePackageCacheButton.Enabled = clearPackageCacheButton.Enabled = Directory.Exists(MachineCache.Default.Source);
}
internal void OnApply() {
_productUpdateSettings.ShouldCheckForUpdate = checkForUpdate.Checked;
}
private void OnClearPackageCacheClick(object sender, EventArgs e) {
MachineCache.Default.Clear();
MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearPackageCache, Resources.ShowWarning_Title);
}
private void OnBrowsePackageCacheClick(object sender, EventArgs e) {
if (Directory.Exists(MachineCache.Default.Source)) {
Process.Start(MachineCache.Default.Source);
}
}
}
}
|
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using NuGet.VisualStudio;
namespace NuGet.Options {
public partial class GeneralOptionControl : UserControl {
private IRecentPackageRepository _recentPackageRepository;
private IProductUpdateSettings _productUpdateSettings;
public GeneralOptionControl() {
InitializeComponent();
_productUpdateSettings = ServiceLocator.GetInstance<IProductUpdateSettings>();
Debug.Assert(_productUpdateSettings != null);
_recentPackageRepository = ServiceLocator.GetInstance<IRecentPackageRepository>();
Debug.Assert(_recentPackageRepository != null);
}
private void OnClearRecentPackagesClick(object sender, EventArgs e) {
_recentPackageRepository.Clear();
MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearRecentPackages, Resources.ShowWarning_Title);
}
internal void OnActivated() {
checkForUpdate.Checked = _productUpdateSettings.ShouldCheckForUpdate;
browsePackageCacheButton.Enabled = clearPackageCacheButton.Enabled = Directory.Exists(MachineCache.Default.Source);
}
internal void OnApply() {
_productUpdateSettings.ShouldCheckForUpdate = checkForUpdate.Checked;
}
private void OnClearPackageCacheClick(object sender, EventArgs e) {
MachineCache.Default.Clear();
MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearRecentPackages, Resources.ShowWarning_Title);
}
private void OnBrowsePackageCacheClick(object sender, EventArgs e) {
if (Directory.Exists(MachineCache.Default.Source)) {
Process.Start(MachineCache.Default.Source);
}
}
}
}
|
apache-2.0
|
C#
|
851a4702f21b96bc2d5f804cc8587b6077cb3dc8
|
Fix the bug when validation can't verify custom ValidationAttribute
|
loyalchen/MYMCore
|
src/MYMCore/Behavioral/Validation.cs
|
src/MYMCore/Behavioral/Validation.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
namespace MYMCore.Behavioral {
public class Validation {
public static bool IsValidate<T>(T t, out List<ValidationResult> result) {
var content = new ValidationContext(t);
result = new List<ValidationResult>();
return Validator.TryValidateObject(t, content, result, true);
}
public static bool IsValidateProperty<T>(T t, string field, object validateValue, out List<ValidationResult> result) {
var content = new ValidationContext(t);
content.MemberName = field;
result = new List<ValidationResult>();
return Validator.TryValidateProperty(validateValue, content, result);
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
namespace MYMCore.Behavioral {
public class Validation {
public static bool IsValidate<T>(T t, out List<ValidationResult> result) {
var content = new ValidationContext(t);
result = new List<ValidationResult>();
return Validator.TryValidateObject(t, content, result);
}
public static bool IsValidateProperty<T>(T t, string field, object validateValue, out List<ValidationResult> result) {
var content = new ValidationContext(t);
content.MemberName = field;
result = new List<ValidationResult>();
return Validator.TryValidateProperty(validateValue, content, result);
}
}
}
|
mit
|
C#
|
e90c6f59d01c22f742259227b0ff4d3bd8866f68
|
remove another local test
|
mattgwagner/CertiPay.Common
|
CertiPay.Common.Tests/UtilitiesTests.cs
|
CertiPay.Common.Tests/UtilitiesTests.cs
|
using NUnit.Framework;
namespace CertiPay.Common.Tests
{
public class UtilitiesTests
{
[Test, Ignore("This doesn't work on AppVeyor since we patch the properties")]
public void ShouldMatchVersionOfCaller()
{
Assert.AreEqual("0.9.9.local", Utilities.Version<UtilitiesTests>());
}
}
}
|
using NUnit.Framework;
namespace CertiPay.Common.Tests
{
public class UtilitiesTests
{
[Test]
public void ShouldMatchVersionOfCaller()
{
Assert.AreEqual("0.9.9.local", Utilities.Version<UtilitiesTests>());
}
}
}
|
mit
|
C#
|
01a6dfb72bee935584f7e87951edd426b9cf2c7c
|
Add comments for Status enum values
|
pnmcosta/KInspector,petrsvihlik/KInspector,xpekatt/KInspector,KenticoBSoltis/KInspector,petrsvihlik/KInspector,anibalvelarde/KInspector,ChristopherJennings/KInspector,philipproplesch/KInspector,KenticoBSoltis/KInspector,philipproplesch/KInspector,xpekatt/KInspector,JosefDvorak/KInspector,TheEskhaton/KInspector,ChristopherJennings/KInspector,pnmcosta/KInspector,JosefDvorak/KInspector,martbrow/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,martbrow/KInspector,KenticoBSoltis/KInspector,pnmcosta/KInspector,anibalvelarde/KInspector,anibalvelarde/KInspector,Kentico/KInspector,martbrow/KInspector,TheEskhaton/KInspector,xpekatt/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,JosefDvorak/KInspector,philipproplesch/KInspector,Kentico/KInspector,TheEskhaton/KInspector,petrsvihlik/KInspector
|
KInspector.Core/Status.cs
|
KInspector.Core/Status.cs
|
namespace KInspector.Core
{
/// <summary>
/// Result's status flag
/// </summary>
public enum Status
{
/// <summary>
/// Used in cases when displaying general information.
/// </summary>
Info = 0,
/// <summary>
/// Indicates issues without any problems.
/// </summary>
Good = 1,
/// <summary>
/// Indicates issue that may be a problem.
/// </summary>
Warning = 2,
/// <summary>
/// Indicates error that needs to be fixed.
/// </summary>
Error = 3
}
}
|
namespace KInspector.Core
{
/// <summary>
/// Result's status flag
/// </summary>
public enum Status
{
Info = 0,
Good = 1,
Warning = 2,
Error = 3
}
}
|
mit
|
C#
|
9c947b42db9f93e51416b6e447e94a98c2b5fa3c
|
Remove disconnect
|
jenyayel/nespresso-dispenser,jenyayel/nespresso-dispenser
|
AzureFunctions/SlackCommandMQTT/run.csx
|
AzureFunctions/SlackCommandMQTT/run.csx
|
using System;
using System.Net;
using System.Net.Http.Headers;
using System.Text;
using System.Configuration;
using System.Threading;
using uPLibrary.Networking.M2Mqtt;
using uPLibrary.Networking.M2Mqtt.Messages;
private static readonly string[] _validCommands = new string[] { "1", "2", "3", "4", "5" };
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
{
if (req.Method == HttpMethod.Get)
return req.CreateResponse(HttpStatusCode.OK); // test/ping requests
var data = await req.Content.ReadAsFormDataAsync();
log.Info($"Triggered WebHook with text data '{data["text"]}' by '{data["user_name"]}'");
if (ConfigurationManager.AppSettings["command_token"] != data["token"])
{
log.Info($"Not valid token {data["token"]}");
return req.CreateResponse(HttpStatusCode.Unauthorized, $"Not valid token");
}
if (!_validCommands.Contains(data["text"]))
{
return req.CreateResponse(HttpStatusCode.OK, $"{data["user_name"]}, the only valid commands are '{String.Join(", ", _validCommands)}'.");
}
var client = new MqttClient(ConfigurationManager.AppSettings["mqtt_host"], 16742, false, null, null, MqttSslProtocols.None);
var clientId = Guid.NewGuid().ToString();
log.Info($"Client {clientId} connecting");
var connectResponse = client.Connect(
Guid.NewGuid().ToString(),
ConfigurationManager.AppSettings["mqtt_user"],
ConfigurationManager.AppSettings["mqtt_password"]);
log.Info($"Client {clientId} connection result {connectResponse}");
var messageId = client.Publish(
ConfigurationManager.AppSettings["mqqt_topic"],
Encoding.ASCII.GetBytes(data["text"]),
MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE,
false);
log.Info($"Published message {messageId}");
return req.CreateResponse(HttpStatusCode.OK, $"I'm opening capsule '{data["text"]}'");
}
|
using System;
using System.Net;
using System.Net.Http.Headers;
using System.Text;
using System.Configuration;
using System.Threading;
using uPLibrary.Networking.M2Mqtt;
using uPLibrary.Networking.M2Mqtt.Messages;
private static readonly string[] _validCommands = new string[] { "1", "2", "3", "4", "5" };
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
{
if (req.Method == HttpMethod.Get)
return req.CreateResponse(HttpStatusCode.OK); // test/ping requests
var data = await req.Content.ReadAsFormDataAsync();
log.Info($"Triggered WebHook with text data '{data["text"]}' by '{data["user_name"]}'");
if (ConfigurationManager.AppSettings["command_token"] != data["token"])
{
log.Info($"Not valid token {data["token"]}");
return req.CreateResponse(HttpStatusCode.Unauthorized, $"Not valid token");
}
if (!_validCommands.Contains(data["text"]))
{
return req.CreateResponse(HttpStatusCode.OK, $"{data["user_name"]}, the only valid commands are '{String.Join(", ", _validCommands)}'.");
}
var client = new MqttClient(ConfigurationManager.AppSettings["mqtt_host"], 16742, false, null, null, MqttSslProtocols.None);
var clientId = Guid.NewGuid().ToString();
log.Info($"Client {clientId} connecting");
var connectResponse = client.Connect(
Guid.NewGuid().ToString(),
ConfigurationManager.AppSettings["mqtt_user"],
ConfigurationManager.AppSettings["mqtt_password"]);
log.Info($"Client {clientId} connection result {connectResponse}");
var messageId = client.Publish(
ConfigurationManager.AppSettings["mqqt_topic"],
Encoding.ASCII.GetBytes(data["text"]),
MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE,
false);
log.Info($"Published message {messageId}");
client.Disconnect();
return req.CreateResponse(HttpStatusCode.OK, $"I'm opening capsule '{data["text"]}'");
}
|
mit
|
C#
|
e3afc4586d6cf3272e530dfdcb31e407c7ae118a
|
add death script and triggers
|
vankovilija/everyoneisafriend,vankovilija/everyoneisafriend,vankovilija/everyoneisafriend
|
Assets/Health.cs
|
Assets/Health.cs
|
using UnityEngine;
using System.Collections;
public class Health : MonoBehaviour {
void die() {
transform.position = GetComponent<PlayerControl> ().spawnPosition;
}
}
|
using UnityEngine;
using System.Collections;
public class Health : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void die() {
transform.position = GetComponent<PlayerControl> ().spawnPosition;
}
}
|
mit
|
C#
|
b13dce89a0c8d51e4cf717d7c8f83aaef4d30071
|
Update stamina counter every frame
|
harjup/Xyz
|
src/Xyz/Assets/Xyz/Scripts/Player.cs
|
src/Xyz/Assets/Xyz/Scripts/Player.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Assets.Scripts.Managers;
using Assets.Xyz.Scripts;
using TreeEditor;
public class Player : MonoBehaviour
{
private Move _move;
private ChaserContainer _chaserContainer;
private InputManager _inputManager;
private StaminaCounter _staminaCounter;
private const float StaminaMax = 3f;
private float _stamina;
public void Start()
{
_move = GetComponent<Move>();
_chaserContainer = transform.GetComponentInChildren<ChaserContainer>();
_inputManager = InputManager.Instance;
_stamina = StaminaMax;
_staminaCounter = StaminaCounter.Instance;
}
public void Update()
{
var grabbedChaserCount = GetGrabbedChasers().Count;
if (grabbedChaserCount > 0)
{
_stamina -= Time.smoothDeltaTime;
if (_stamina < 0f)
{
_move.Knockout();
}
}
else if (_stamina < StaminaMax)
{
_stamina += Time.smoothDeltaTime * 2f;
}
else if (_stamina > StaminaMax)
{
_stamina = StaminaMax;
}
_staminaCounter.SetImagePercent(_stamina / StaminaMax);
}
public void AddChaser(Chaser chaser)
{
_chaserContainer.AddChaser(chaser);
}
public List<Chaser> GetGrabbedChasers()
{
return _chaserContainer.GetChasers();
}
public void PushPlayer(Vector3 velocity)
{
_move.AddVelocity(velocity);
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Assets.Scripts.Managers;
using Assets.Xyz.Scripts;
using TreeEditor;
public class Player : MonoBehaviour
{
private Move _move;
private ChaserContainer _chaserContainer;
private InputManager _inputManager;
private StaminaCounter _staminaCounter;
private const float StaminaMax = 3f;
private float _stamina;
public void Start()
{
_move = GetComponent<Move>();
_chaserContainer = transform.GetComponentInChildren<ChaserContainer>();
_inputManager = InputManager.Instance;
_stamina = StaminaMax;
_staminaCounter = StaminaCounter.Instance;
}
public void Update()
{
var grabbedChaserCount = GetGrabbedChasers().Count;
if (grabbedChaserCount > 0)
{
_stamina -= Time.smoothDeltaTime;
_staminaCounter.SetImagePercent(_stamina / StaminaMax);
if (_stamina < 0f)
{
_move.Knockout();
}
}
else if (_stamina < StaminaMax)
{
_stamina += Time.smoothDeltaTime * 2f;
}
else if (_stamina > StaminaMax)
{
_stamina = StaminaMax;
}
}
public void AddChaser(Chaser chaser)
{
_chaserContainer.AddChaser(chaser);
}
public List<Chaser> GetGrabbedChasers()
{
return _chaserContainer.GetChasers();
}
public void PushPlayer(Vector3 velocity)
{
_move.AddVelocity(velocity);
}
}
|
mit
|
C#
|
343f59ea82a22ab2d88e83f6b84cb4eec721934c
|
Add ICmpRenderer support
|
RockyTV/Duality.IronPython
|
CorePlugin/ScriptExecutor.cs
|
CorePlugin/ScriptExecutor.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Duality;
using RockyTV.Duality.Plugins.IronPython.Resources;
using IronPython.Hosting;
using IronPython.Runtime;
using IronPython.Compiler;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using Duality.Editor;
using Duality.Drawing;
namespace RockyTV.Duality.Plugins.IronPython
{
[EditorHintCategory(Properties.ResNames.CategoryScripts)]
[EditorHintImage(Properties.ResNames.IconScriptGo)]
public class PythonScriptExecutor : Component, ICmpInitializable, ICmpUpdatable, ICmpRenderer
{
public ContentRef<PythonScript> Script { get; set; }
[DontSerialize]
private PythonExecutionEngine _engine;
protected PythonExecutionEngine Engine
{
get { return _engine; }
}
protected virtual float Delta
{
get { return Time.MsPFMult * Time.TimeMult; }
}
public float BoundRadius
{
get
{
if (_engine != null)
if (_engine.HasMethod("bound_radius"))
return Convert.ToSingle(_engine.GetVariable("bound_radius"));
return 0.0f;
}
}
public void OnInit(InitContext context)
{
if (Script.IsExplicitNull || !Script.IsAvailable) return;
if (context == InitContext.Loaded)
{
_engine = new PythonExecutionEngine(Script.Res.Content);
_engine.SetVariable("game_object", GameObj);
}
if (_engine != null)
if (_engine.HasMethod("start"))
_engine.CallMethod("start", context);
}
public void OnUpdate()
{
if (_engine != null)
if (_engine.HasMethod("update"))
_engine.CallMethod("update", Delta);
}
public void OnShutdown(ShutdownContext context)
{
if (context == ShutdownContext.Deactivate)
GameObj.DisposeLater();
}
public bool IsVisible(IDrawDevice device)
{
if (_engine != null)
{
if (_engine.HasMethod("isVisible"))
{
bool isVisible;
if (bool.TryParse(Convert.ToString(_engine.CallFunction("isVisible", device)), out isVisible))
return isVisible;
}
}
return false;
}
public void Draw(IDrawDevice device)
{
if (_engine != null)
if (_engine.HasMethod("draw"))
_engine.CallMethod("draw", device);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Duality;
using RockyTV.Duality.Plugins.IronPython.Resources;
using IronPython.Hosting;
using IronPython.Runtime;
using IronPython.Compiler;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using Duality.Editor;
namespace RockyTV.Duality.Plugins.IronPython
{
[EditorHintCategory(Properties.ResNames.CategoryScripts)]
[EditorHintImage(Properties.ResNames.IconScriptGo)]
public class PythonScriptExecutor : Component, ICmpInitializable, ICmpUpdatable
{
public ContentRef<PythonScript> Script { get; set; }
[DontSerialize]
private PythonExecutionEngine _engine;
protected PythonExecutionEngine Engine
{
get { return _engine; }
}
protected virtual float Delta
{
get { return Time.MsPFMult * Time.TimeMult; }
}
public void OnInit(InitContext context)
{
if (Script.IsExplicitNull || !Script.IsAvailable) return;
if (context == InitContext.Loaded)
{
_engine = new PythonExecutionEngine(Script.Res.Content);
_engine.SetVariable("game_object", GameObj);
}
if (_engine != null)
if (_engine.HasMethod("start"))
_engine.CallMethod("start", context);
}
public void OnUpdate()
{
if (_engine != null)
if (_engine.HasMethod("update"))
_engine.CallMethod("update", Delta);
}
public void OnShutdown(ShutdownContext context)
{
if (context == ShutdownContext.Deactivate)
GameObj.DisposeLater();
}
}
}
|
mit
|
C#
|
ef3774caa26ffea96a3a39e5623b590c40b90fa5
|
replace underscore with nbsp in card Text
|
HearthSim/HearthDb
|
HearthDb/Card.cs
|
HearthDb/Card.cs
|
#region
using System;
using System.Linq;
using HearthDb.CardDefs;
using HearthDb.Enums;
using static HearthDb.Enums.GameTag;
#endregion
namespace HearthDb
{
public class Card
{
internal Card(Entity entity)
{
Entity = entity;
}
public Entity Entity { get; }
public string Id => Entity.CardId;
public string Name => GetLocName(DefaultLanguage);
public string Text => GetLocText(DefaultLanguage);
public string FlavorText => GetLocFlavorText(DefaultLanguage);
public CardClass Class => (CardClass)Entity.GetTag(CLASS);
public Rarity Rarity => (Rarity)Entity.GetTag(RARITY);
public CardType Type => (CardType)Entity.GetTag(CARDTYPE);
public Race Race => (Race)Entity.GetTag(CARDRACE);
public CardSet Set => (CardSet)Entity.GetTag(CARD_SET);
public Faction Faction => (Faction)Entity.GetTag(FACTION);
public int Cost => Entity.GetTag(COST);
public int Attack => Entity.GetTag(ATK);
public int Health => Entity.GetTag(HEALTH);
public int Durability => Entity.GetTag(DURABILITY);
public string[] Mechanics
{
get
{
var mechanics = Dictionaries.Mechanics.Keys.Where(mechanic => Entity.GetTag(mechanic) > 0).Select(x => Dictionaries.Mechanics[x]);
var refMechanics =
Dictionaries.ReferencedMechanics.Keys.Where(mechanic => Entity.GetTag(mechanic) > 0)
.Select(x => Dictionaries.ReferencedMechanics[x]);
return mechanics.Concat(refMechanics).ToArray();
}
}
public string ArtistName => Entity.GetInnerValue(ARTISTNAME);
public string[] EntourageCardIds => Entity.EntourageCards.Select(x => x.CardId).ToArray();
public Locale DefaultLanguage { get; set; } = Locale.enUS;
public bool Collectible => Convert.ToBoolean(Entity.GetTag(GameTag.Collectible));
public string GetLocName(Locale lang) => Entity.GetLocString(CARDNAME, lang);
public string GetLocText(Locale lang) => Entity.GetLocString(CARDTEXT_INHAND, lang)?.Replace("_", "\u00A0").Trim();
public string GetLocFlavorText(Locale lang) => Entity.GetLocString(FLAVORTEXT, lang);
}
}
|
#region
using System;
using System.Linq;
using HearthDb.CardDefs;
using HearthDb.Enums;
using static HearthDb.Enums.GameTag;
#endregion
namespace HearthDb
{
public class Card
{
internal Card(Entity entity)
{
Entity = entity;
}
public Entity Entity { get; }
public string Id => Entity.CardId;
public string Name => GetLocName(DefaultLanguage);
public string Text => GetLocText(DefaultLanguage);
public string FlavorText => GetLocFlavorText(DefaultLanguage);
public CardClass Class => (CardClass)Entity.GetTag(CLASS);
public Rarity Rarity => (Rarity)Entity.GetTag(RARITY);
public CardType Type => (CardType)Entity.GetTag(CARDTYPE);
public Race Race => (Race)Entity.GetTag(CARDRACE);
public CardSet Set => (CardSet)Entity.GetTag(CARD_SET);
public Faction Faction => (Faction)Entity.GetTag(FACTION);
public int Cost => Entity.GetTag(COST);
public int Attack => Entity.GetTag(ATK);
public int Health => Entity.GetTag(HEALTH);
public int Durability => Entity.GetTag(DURABILITY);
public string[] Mechanics
{
get
{
var mechanics = Dictionaries.Mechanics.Keys.Where(mechanic => Entity.GetTag(mechanic) > 0).Select(x => Dictionaries.Mechanics[x]);
var refMechanics =
Dictionaries.ReferencedMechanics.Keys.Where(mechanic => Entity.GetTag(mechanic) > 0)
.Select(x => Dictionaries.ReferencedMechanics[x]);
return mechanics.Concat(refMechanics).ToArray();
}
}
public string ArtistName => Entity.GetInnerValue(ARTISTNAME);
public string[] EntourageCardIds => Entity.EntourageCards.Select(x => x.CardId).ToArray();
public Locale DefaultLanguage { get; set; } = Locale.enUS;
public bool Collectible => Convert.ToBoolean(Entity.GetTag(GameTag.Collectible));
public string GetLocName(Locale lang) => Entity.GetLocString(CARDNAME, lang);
public string GetLocText(Locale lang) => Entity.GetLocString(CARDTEXT_INHAND, lang)?.Trim();
public string GetLocFlavorText(Locale lang) => Entity.GetLocString(FLAVORTEXT, lang);
}
}
|
mit
|
C#
|
aafc0d4eacb9aee85377e5634d591d85ed62e656
|
test suite: extract TestSuite interface and run ITestSuite from Build
|
stephenlautier/.netcore-labs
|
experimental/Slabs.Experimental.Console/TestSuite.cs
|
experimental/Slabs.Experimental.Console/TestSuite.cs
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Slabs.Experimental.ConsoleClient
{
public class TestSuiteBuilder
{
private readonly string _name;
private List<List<TestEntity>> TestGroups { get; }
private List<TestEntity> _currentParallelGroup;
public TestSuiteBuilder(string name)
{
TestGroups = new List<List<TestEntity>>();
_name = name;
}
public ITestSuite Build()
{
return new TestSuite(_name, TestGroups);
}
internal TestSuiteBuilder Add<TTest>(string name) where TTest : ITest, new()
{
var group = new List<TestEntity>
{
ToTestEntity(name, typeof(TTest))
};
TestGroups.Add(group);
_currentParallelGroup = null;
return this;
}
public TestSuiteBuilder AddParallel<TTest>(string name) where TTest : ITest, new()
{
var testEntity = ToTestEntity(name, typeof(TTest));
if (_currentParallelGroup == null)
{
var group = new List<TestEntity>
{
testEntity
};
TestGroups.Add(group);
_currentParallelGroup = group;
}
else
{
_currentParallelGroup.Add(testEntity);
}
return this;
}
static TestEntity ToTestEntity(string key, Type type)
{
return new TestEntity
{
Name = key,
Type = type
};
}
}
public interface ITestSuite
{
string Name { get; }
Task Run();
}
public class TestSuite : ITestSuite
{
public string Name { get; }
private readonly List<List<TestEntity>> _tests;
internal TestSuite(string name, List<List<TestEntity>> tests)
{
Name = name;
_tests = tests;
}
public async Task Run()
{
Console.WriteLine($"[TestSuite] Running test suite '{Name}'");
foreach (var testGroup in _tests)
{
IList<Task> promises = new List<Task>();
foreach (var testEntity in testGroup)
{
Console.WriteLine($"[TestSuite] Running '{testEntity.Name}'");
var test = (ITest)Activator.CreateInstance(testEntity.Type);
var task = test.Execute();
promises.Add(task);
}
// parallized test groups
await Task.WhenAll(promises);
}
}
}
/// <summary>
/// Describe a test unit.
/// </summary>
public interface ITest
{
/// <summary>
/// Method which gets executed by the runner.
/// </summary>
/// <returns></returns>
Task Execute();
}
internal class TestEntity
{
public string Name { get; set; }
public Type Type { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Slabs.Experimental.ConsoleClient
{
public class TestSuiteBuilder
{
private readonly string _name;
private List<List<TestEntity>> TestGroups { get; }
private List<TestEntity> _currentParallelGroup;
public TestSuiteBuilder(string name)
{
TestGroups = new List<List<TestEntity>>();
_name = name;
}
public TestSuite Build()
{
return new TestSuite(_name, TestGroups);
}
internal TestSuiteBuilder Add<TTest>(string name) where TTest : ITest, new()
{
var group = new List<TestEntity>
{
ToTestEntity(name, typeof(TTest))
};
TestGroups.Add(group);
_currentParallelGroup = null;
return this;
}
public TestSuiteBuilder AddParallel<TTest>(string name) where TTest : ITest, new()
{
var testEntity = ToTestEntity(name, typeof(TTest));
if (_currentParallelGroup == null)
{
var group = new List<TestEntity>
{
testEntity
};
TestGroups.Add(group);
_currentParallelGroup = group;
}
else
{
_currentParallelGroup.Add(testEntity);
}
return this;
}
static TestEntity ToTestEntity(string key, Type type)
{
return new TestEntity
{
Name = key,
Type = type
};
}
}
public class TestSuite
{
public string Name { get; }
private readonly List<List<TestEntity>> _tests;
public TestSuite(string name, List<List<TestEntity>> tests)
{
Name = name;
_tests = tests;
}
public async Task Run()
{
Console.WriteLine($"[TestSuite] Running test suite '{Name}'");
foreach (var testGroup in _tests)
{
IList<Task> promises = new List<Task>();
foreach (var testEntity in testGroup)
{
Console.WriteLine($"[TestSuite] Running '{testEntity.Name}'");
var test = (ITest)Activator.CreateInstance(testEntity.Type);
var task = test.Execute();
promises.Add(task);
}
// parallized test groups
await Task.WhenAll(promises);
}
}
}
/// <summary>
/// Describe a test unit.
/// </summary>
public interface ITest
{
/// <summary>
/// Method which gets executed by the runner.
/// </summary>
/// <returns></returns>
Task Execute();
}
internal class TestEntity
{
public string Name { get; set; }
public Type Type { get; set; }
}
}
|
mit
|
C#
|
a700ee1e883687ead370b1fa1ed7ce6fd032b058
|
Update CurrentAngle on NVRInteractableRotator every frame This ensures that CurrentAngle remains up to date even if the object is rotated by some external force other than the user (e.g. a motor force, or updating the rotation in the editor during runtime for debugging). Previously the CurrentAngle would only be updated in OnNewPosesApplied, which is not called in the above cases.
|
DreamRealityInteractive/NewtonVR,noirb/NewtonVR,TomorrowTodayLabs/NewtonVR
|
Assets/NewtonVR/NVRInteractableRotator.cs
|
Assets/NewtonVR/NVRInteractableRotator.cs
|
using UnityEngine;
using System.Collections;
namespace NewtonVR
{
public class NVRInteractableRotator : NVRInteractable
{
public float CurrentAngle;
protected virtual float DeltaMagic { get { return 1f; } }
protected Transform InitialAttachPoint;
protected override void Awake()
{
base.Awake();
this.Rigidbody.maxAngularVelocity = 100f;
}
protected override void Update()
{
base.Update();
CurrentAngle = Quaternion.Angle(Quaternion.identity, this.transform.rotation);
}
public override void OnNewPosesApplied()
{
base.OnNewPosesApplied();
if (IsAttached == true)
{
Vector3 PositionDelta = (AttachedHand.transform.position - InitialAttachPoint.position) * DeltaMagic;
this.Rigidbody.AddForceAtPosition(PositionDelta, InitialAttachPoint.position, ForceMode.VelocityChange);
}
CurrentAngle = Quaternion.Angle(Quaternion.identity, this.transform.rotation);
}
public override void BeginInteraction(NVRHand hand)
{
base.BeginInteraction(hand);
InitialAttachPoint = new GameObject(string.Format("[{0}] InitialAttachPoint", this.gameObject.name)).transform;
//InitialAttachPoint = GameObject.CreatePrimitive(PrimitiveType.Cube).transform;
InitialAttachPoint.position = hand.transform.position;
InitialAttachPoint.rotation = hand.transform.rotation;
InitialAttachPoint.localScale = Vector3.one * 0.25f;
InitialAttachPoint.parent = this.transform;
ClosestHeldPoint = (InitialAttachPoint.position - this.transform.position);
}
public override void EndInteraction()
{
base.EndInteraction();
if (InitialAttachPoint != null)
Destroy(InitialAttachPoint.gameObject);
}
protected override void DropIfTooFar()
{
float distance = Vector3.Distance(AttachedHand.transform.position, (this.transform.position + ClosestHeldPoint));
if (distance > DropDistance)
{
DroppedBecauseOfDistance();
}
}
}
}
|
using UnityEngine;
using System.Collections;
namespace NewtonVR
{
public class NVRInteractableRotator : NVRInteractable
{
public float CurrentAngle;
protected virtual float DeltaMagic { get { return 1f; } }
protected Transform InitialAttachPoint;
protected override void Awake()
{
base.Awake();
this.Rigidbody.maxAngularVelocity = 100f;
}
public override void OnNewPosesApplied()
{
base.OnNewPosesApplied();
if (IsAttached == true)
{
Vector3 PositionDelta = (AttachedHand.transform.position - InitialAttachPoint.position) * DeltaMagic;
this.Rigidbody.AddForceAtPosition(PositionDelta, InitialAttachPoint.position, ForceMode.VelocityChange);
}
CurrentAngle = Quaternion.Angle(Quaternion.identity, this.transform.rotation);
}
public override void BeginInteraction(NVRHand hand)
{
base.BeginInteraction(hand);
InitialAttachPoint = new GameObject(string.Format("[{0}] InitialAttachPoint", this.gameObject.name)).transform;
//InitialAttachPoint = GameObject.CreatePrimitive(PrimitiveType.Cube).transform;
InitialAttachPoint.position = hand.transform.position;
InitialAttachPoint.rotation = hand.transform.rotation;
InitialAttachPoint.localScale = Vector3.one * 0.25f;
InitialAttachPoint.parent = this.transform;
ClosestHeldPoint = (InitialAttachPoint.position - this.transform.position);
}
public override void EndInteraction()
{
base.EndInteraction();
if (InitialAttachPoint != null)
Destroy(InitialAttachPoint.gameObject);
}
protected override void DropIfTooFar()
{
float distance = Vector3.Distance(AttachedHand.transform.position, (this.transform.position + ClosestHeldPoint));
if (distance > DropDistance)
{
DroppedBecauseOfDistance();
}
}
}
}
|
mit
|
C#
|
24211323e77994fdd4e286e23f340e3f40eb67c0
|
Edite Aricle.cs Model. Added ImagePath property.
|
AleksandarKostadinov/Blog-Project-Soft-Tech,AleksandarKostadinov/Blog-Project-Soft-Tech
|
BlogProject/BlogProject/Models/Article.cs
|
BlogProject/BlogProject/Models/Article.cs
|
namespace BlogProject.Models
{
using System.ComponentModel.DataAnnotations;
public class Article
{
public int Id { get; set; }
[Required]
[StringLength(50)]
public string Title { get; set; }
[Required]
public string Content { get; set; }
public string ImagePath { get; set; }
public string AuthorId { get; set; }
public virtual ApplicationUser Author { get; set; }
public bool IsAuthor(string authorId)
{
return this.AuthorId == authorId;
}
}
}
|
namespace BlogProject.Models
{
using System.ComponentModel.DataAnnotations;
public class Article
{
public int Id { get; set; }
[Required]
[StringLength(50)]
public string Title { get; set; }
[Required]
public string Content { get; set; }
public string AuthorId { get; set; }
public virtual ApplicationUser Author { get; set; }
public bool IsAuthor(string authorId)
{
return this.AuthorId == authorId;
}
}
}
|
mit
|
C#
|
234c48495b549d6b1e9ebb9bded7042181463ca9
|
Fix the possibility of a NullReferenceException
|
GGG-KILLER/GUtils.NET
|
GUtils.MVVM/ViewModelBase.cs
|
GUtils.MVVM/ViewModelBase.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace GUtils.MVVM
{
/// <summary>
/// Implements a few utility functions for a ViewModel base
/// </summary>
public abstract class ViewModelBase : INotifyPropertyChanged
{
/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Does the logic for calling <see cref="PropertyChanged"/> if the value has changed (and
/// also sets the value of the field)
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="field"></param>
/// <param name="newValue"></param>
/// <param name="propertyName"></param>
[MethodImpl ( MethodImplOptions.NoInlining )]
protected virtual void SetField<T> ( ref T field, T newValue, [CallerMemberName] String propertyName = null )
{
if ( EqualityComparer<T>.Default.Equals ( field, newValue ) )
return;
field = newValue;
this.OnPropertyChanged ( propertyName );
}
/// <summary>
/// Invokes <see cref="PropertyChanged"/>
/// </summary>
/// <param name="propertyName"></param>
/// <exception cref="ArgumentNullException">
/// Invoked if a <paramref name="propertyName"/> is not provided (and the value isn't
/// auto-filled by the compiler)
/// </exception>
[MethodImpl ( MethodImplOptions.NoInlining )]
protected virtual void OnPropertyChanged ( [CallerMemberName] String propertyName = null ) =>
this.PropertyChanged?.Invoke (
this,
new PropertyChangedEventArgs ( propertyName ?? throw new ArgumentNullException ( nameof ( propertyName ) ) ) );
}
}
|
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace GUtils.MVVM
{
/// <summary>
/// Implements a few utility functions for a ViewModel base
/// </summary>
public abstract class ViewModelBase : INotifyPropertyChanged
{
/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Does the logic for calling <see cref="PropertyChanged"/> if the value has changed (and
/// also sets the value of the field)
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="field"></param>
/// <param name="newValue"></param>
/// <param name="propertyName"></param>
[MethodImpl ( MethodImplOptions.NoInlining )]
protected virtual void SetField<T> ( ref T field, T newValue, [CallerMemberName] String propertyName = null )
{
if ( field.Equals ( newValue ) )
return;
field = newValue;
this.OnPropertyChanged ( propertyName );
}
/// <summary>
/// Invokes <see cref="PropertyChanged"/>
/// </summary>
/// <param name="propertyName"></param>
/// <exception cref="ArgumentNullException">
/// Invoked if a <paramref name="propertyName"/> is not provided (and the value isn't
/// auto-filled by the compiler)
/// </exception>
[MethodImpl ( MethodImplOptions.NoInlining )]
protected virtual void OnPropertyChanged ( [CallerMemberName] String propertyName = null ) =>
this.PropertyChanged?.Invoke (
this,
new PropertyChangedEventArgs ( propertyName ?? throw new ArgumentNullException ( nameof ( propertyName ) ) ) );
}
}
|
mit
|
C#
|
04dffc8e41c2138a4f7aef59961b89f7c79034a0
|
Update Portal.cs
|
williambl/Haunt
|
Haunt/Assets/Scripts/Enviroment/Portal.cs
|
Haunt/Assets/Scripts/Enviroment/Portal.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Portal : MonoBehaviour {
/// <summary>
/// The level to go to.
/// </summary>
public int destination;
GameManager manager;
void Start ()
{
if(manager == null)
manager = GameObject.Find ("Manager").GetComponent<GameManager> ();
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.layer == 9 || other.gameObject.layer == 12) {
manager.GotoLevel (destination);
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Portal : MonoBehaviour {
/// <summary>
/// The level to go to.
/// </summary>
public int destination;
GameManager manager;
void Start ()
{
manager = GameObject.Find ("Manager").GetComponent<GameManager> ();
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.layer == 9 || other.gameObject.layer == 12) {
manager.GotoLevel (destination);
}
}
}
|
mit
|
C#
|
a16c786ba02ff7b0aa3b5219f5ab58c6ba3335c0
|
extend BoxFileLock from BoxEntity, not from BoxItem
|
varungu/box-windows-sdk-v2,marek-vysoky/box-windows-sdk-v2,box/box-windows-sdk-v2,iLovebooks100per/box-windows-sdk-v2,JogyBlack/box-windows-sdk-v2
|
Box.V2/Models/BoxFileLock.cs
|
Box.V2/Models/BoxFileLock.cs
|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Box.V2.Models
{
/// <summary>
/// Box representation of a file
/// </summary>
public class BoxFileLock : BoxEntity
{
public const string FieldCreatedAt = "created_at";
public const string FieldCreatedBy = "created_by";
public const string FieldExpiresAt = "expires_at";
public const string FieldIsDownloadPrevented = "is_download_prevented";
/// <summary>
/// The time the lock was created
/// </summary>
[JsonProperty(PropertyName = FieldCreatedAt)]
public DateTime? CreatedAt { get; private set; }
/// <summary>
/// The user who created this lock
/// </summary>
[JsonProperty(PropertyName = FieldCreatedBy)]
public BoxUser CreatedBy { get; private set; }
/// <summary>
/// The expiration date of this lock
/// </summary>
[JsonProperty(PropertyName = FieldExpiresAt)]
public DateTime? ExpiresAt { get; set; }
/// <summary>
/// Is download prevented for this lock?
/// </summary>
[JsonProperty(PropertyName = FieldIsDownloadPrevented)]
public bool IsDownloadPrevented { get; set; }
}
}
|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Box.V2.Models
{
/// <summary>
/// Box representation of a file
/// </summary>
public class BoxFileLock : BoxItem
{
public const string FieldExpiresAt = "expires_at";
public const string FieldIsDownloadPrevented = "is_download_prevented";
/// <summary>
/// The expiration date of this lock
/// </summary>
[JsonProperty(PropertyName = FieldExpiresAt)]
public DateTime? ExpiresAt { get; set; }
/// <summary>
/// Is download prevented for this lock?
/// </summary>
[JsonProperty(PropertyName = FieldIsDownloadPrevented)]
public bool IsDownloadPrevented { get; set; }
}
}
|
apache-2.0
|
C#
|
5872a2a64be1c23eb5e81145f354b41cff495a03
|
Use Name for lookup
|
AMDL/amdl2maml
|
amdl2maml/Converter/TopicData.cs
|
amdl2maml/Converter/TopicData.cs
|
using System;
namespace Amdl.Maml.Converter
{
/// <summary>
/// AMDL topic data.
/// </summary>
public class TopicData
{
///// <summary>
///// Creates a new instance of the <see cref="TopicData"/> class.
///// </summary>
///// <param name="id">Topic ID.</param>
//public TopicData(Guid id)
//{
// Id = id;
//}
/// <summary>
/// Creates a new instance of the <see cref="TopicData"/> class.
/// </summary>
/// <param name="name">Topic name.</param>
public TopicData(string name)
{
Name = name;
}
/// <summary>
/// Gets or sets the ID.
/// </summary>
/// <value>Topic ID.</value>
public Guid Id { get; set; }
/// <summary>
/// Gets the name.
/// </summary>
/// <value>Topic Name.</value>
public string Name { get; private set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>Topic Type.</value>
public TopicType Type { get; set; }
/// <summary>
/// Gets the title.
/// </summary>
/// <value>Topic title.</value>
public string Title { get; internal set; }
/// <summary>
/// Gets or sets the relative path.
/// </summary>
/// <value>Relative path.</value>
public string RelativePath { get; set; }
}
}
|
using System;
namespace Amdl.Maml.Converter
{
/// <summary>
/// AMDL topic data.
/// </summary>
public class TopicData
{
/// <summary>
/// Creates a new instance of the <see cref="TopicData"/> class.
/// </summary>
/// <param name="id">Topic ID.</param>
public TopicData(Guid id)
{
Id = id;
}
/// <summary>
/// Gets the ID.
/// </summary>
/// <value>Topic ID.</value>
public Guid Id { get; private set; }
///// <summary>
///// Gets the name.
///// </summary>
///// <value>Topic Name.</value>
//public string Name { get; private set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>Topic Type.</value>
public TopicType Type { get; set; }
/// <summary>
/// Gets the title.
/// </summary>
/// <value>Topic title.</value>
public string Title { get; internal set; }
/// <summary>
/// Gets or sets the relative path.
/// </summary>
/// <value>Relative path.</value>
public string RelativePath { get; set; }
}
}
|
apache-2.0
|
C#
|
3363e0b3d575c5a3fa433ce154e189383fd49d6d
|
Remove unused namespace
|
phaetto/serviceable-objects
|
Serviceable.Objects.Remote/Composition/Host/Commands/RunAndBlock.cs
|
Serviceable.Objects.Remote/Composition/Host/Commands/RunAndBlock.cs
|
namespace Serviceable.Objects.Remote.Composition.Host.Commands
{
public sealed class RunAndBlock : ICommand<ApplicationHost, ApplicationHost>
{
public ApplicationHost Execute(ApplicationHost context)
{
context.GraphContext.Configure();
context.GraphContext.Setup();
context.GraphContext.Initialize();
context.CancellationTokenSource.Token.Register(CancellationRequested, context);
context.EventWaitHandle.WaitOne();
return context;
}
private static void CancellationRequested(object context)
{
((ApplicationHost) context).EventWaitHandle.Set();
}
}
}
|
namespace Serviceable.Objects.Remote.Composition.Host.Commands
{
using System;
public sealed class RunAndBlock : ICommand<ApplicationHost, ApplicationHost>
{
public ApplicationHost Execute(ApplicationHost context)
{
context.GraphContext.Configure();
context.GraphContext.Setup();
context.GraphContext.Initialize();
context.CancellationTokenSource.Token.Register(CancellationRequested, context);
context.EventWaitHandle.WaitOne();
return context;
}
private static void CancellationRequested(object context)
{
((ApplicationHost) context).EventWaitHandle.Set();
}
}
}
|
mit
|
C#
|
cac776956bc30991c8f5b39db12e7ad638a35d65
|
Hide sensitive data when configured
|
thinktecture/relayserver,thinktecture/relayserver,thinktecture/relayserver
|
Thinktecture.Relay.Server/Communication/RabbitMq/RabbitMqFactory.cs
|
Thinktecture.Relay.Server/Communication/RabbitMq/RabbitMqFactory.cs
|
using System;
using System.Configuration;
using RabbitMQ.Client;
using Serilog;
using Thinktecture.Relay.Server.Config;
namespace Thinktecture.Relay.Server.Communication.RabbitMq
{
internal class RabbitMqFactory : IRabbitMqFactory
{
private readonly IConnectionFactory _factory;
private readonly IConfiguration _configuration;
private readonly ILogger _logger;
public RabbitMqFactory(IConnectionFactory factory, IConfiguration configuration, ILogger logger)
{
_factory = factory ?? throw new ArgumentNullException(nameof(factory));
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
_logger = logger;
}
public IConnection CreateConnection()
{
var connectionString = _configuration.RabbitMqConnectionString;
if (connectionString == null)
{
_logger?.Fatal("Not connection string found for RabbitMQ. Can not create a bus. Aborting...");
throw new ConfigurationErrorsException("Could not find a connection string for RabbitMQ. Please add a connection string in the <connectionStrings> section of the application's configuration file. For example: <add name=\"RabbitMQ\" connectionString=\"host=localhost\" />");
}
try
{
_factory.Uri = new Uri(connectionString);
if (!_configuration.LogSensitiveData && !String.IsNullOrWhiteSpace(_factory.Uri.UserInfo))
{
connectionString = connectionString.Replace($"{_factory.Uri.UserInfo}@", "*** BLOCKED ***@");
}
if (_configuration.RabbitMqAutomaticRecoveryEnabled && _factory is ConnectionFactory connectionFactory)
{
connectionFactory.AutomaticRecoveryEnabled = true;
}
if (_configuration.RabbitMqClusterHosts == null)
{
_logger?.Verbose("Creating RabbitMQ connection. connection-string={RabbitConnectionString}, automatic-recovery-enabled={RabbitAutomaticRecoveryEnabled}", connectionString, _configuration.RabbitMqAutomaticRecoveryEnabled);
return _factory.CreateConnection();
}
_logger?.Verbose("Creating RabbitMQ cluster connection. connection-string={RabbitConnectionString}, cluster-hosts={RabbitClusterHosts}, automatic-recovery-enabled={RabbitAutomaticRecoveryEnabled}", connectionString, _configuration.RabbitMqClusterHosts, _configuration.RabbitMqAutomaticRecoveryEnabled);
return _factory.CreateConnection(AmqpTcpEndpoint.ParseMultiple(_configuration.RabbitMqClusterHosts));
}
catch (Exception ex)
{
_logger?.Fatal(ex, "Cannot connect to RabbitMQ using the provided configuration.");
throw;
}
}
}
}
|
using System;
using System.Configuration;
using RabbitMQ.Client;
using Serilog;
using Thinktecture.Relay.Server.Config;
namespace Thinktecture.Relay.Server.Communication.RabbitMq
{
internal class RabbitMqFactory : IRabbitMqFactory
{
private readonly IConnectionFactory _factory;
private readonly IConfiguration _configuration;
private readonly ILogger _logger;
public RabbitMqFactory(IConnectionFactory factory, IConfiguration configuration, ILogger logger)
{
_factory = factory ?? throw new ArgumentNullException(nameof(factory));
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
_logger = logger;
}
public IConnection CreateConnection()
{
var connectionString = _configuration.RabbitMqConnectionString;
if (connectionString == null)
{
_logger?.Fatal("Not connection string found for RabbitMQ. Can not create a bus. Aborting...");
throw new ConfigurationErrorsException("Could not find a connection string for RabbitMQ. Please add a connection string in the <connectionStrings> section of the application's configuration file. For example: <add name=\"RabbitMQ\" connectionString=\"host=localhost\" />");
}
try
{
_factory.Uri = new Uri(connectionString);
if (_configuration.RabbitMqAutomaticRecoveryEnabled && _factory is ConnectionFactory connectionFactory)
{
connectionFactory.AutomaticRecoveryEnabled = true;
}
if (_configuration.RabbitMqClusterHosts == null)
{
_logger?.Verbose("Creating RabbitMQ connection. connection-string={RabbitConnectionString}, automatic-recovery-enabled={RabbitAutomaticRecoveryEnabled}", _configuration.RabbitMqConnectionString, _configuration.RabbitMqAutomaticRecoveryEnabled);
return _factory.CreateConnection();
}
_logger?.Verbose("Creating RabbitMQ cluster connection. connection-string={RabbitConnectionString}, cluster-hosts={RabbitClusterHosts}, automatic-recovery-enabled={RabbitAutomaticRecoveryEnabled}", _configuration.RabbitMqConnectionString, _configuration.RabbitMqClusterHosts, _configuration.RabbitMqAutomaticRecoveryEnabled);
return _factory.CreateConnection(AmqpTcpEndpoint.ParseMultiple(_configuration.RabbitMqClusterHosts));
}
catch (Exception ex)
{
_logger?.Fatal(ex, "Cannot connect to RabbitMQ using the provided configuration.");
throw;
}
}
}
}
|
bsd-3-clause
|
C#
|
c053cace42e75db74c17258cdfcee99b25f56457
|
comment interface for now
|
rtfpessoa/padi-dstm
|
Client/Program.cs
|
Client/Program.cs
|
using CommonTypes;
using System;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Windows.Forms;
namespace Client
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main()
{
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Form1());
TcpChannel channelServ = new TcpChannel(9997);
ChannelServices.RegisterChannel(channelServ, true);
IMainServer mainServer = (IMainServer)Activator.GetObject(typeof(IMainServer), Config.REMOTE_MAINSERVER_URL);
int txid = mainServer.StartTransaction();
IServer server = (IServer)Activator.GetObject(typeof(IServer), Config.REMOTE_SERVER_URL);
server.ReadValue(txid, 1);
}
}
}
|
using CommonTypes;
using System;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Windows.Forms;
namespace Client
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
TcpChannel channelServ = new TcpChannel(9997);
ChannelServices.RegisterChannel(channelServ, true);
IMainServer mainServer = (IMainServer)Activator.GetObject(typeof(IMainServer), Config.REMOTE_MAINSERVER_URL);
int txid = mainServer.StartTransaction();
IServer server = (IServer)Activator.GetObject(typeof(IServer), Config.REMOTE_SERVER_URL);
server.ReadValue(txid, 1);
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.