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 |
---|---|---|---|---|---|---|---|---|
f16c6b6769245ec77018ee9cd51ff943c32a35de | Update RadialExtent.cs | ADAPT/ADAPT | source/ADAPT/Prescriptions/RadialExtent.cs | source/ADAPT/Prescriptions/RadialExtent.cs | /*******************************************************************************
* Copyright (C) 2015, 2018 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:
*
*
*******************************************************************************/
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel.Representations;
using AgGateway.ADAPT.ApplicationDataModel.Shapes;
namespace AgGateway.ADAPT.ApplicationDataModel.Prescriptions
{
public class RadialExtent
{
public RadialExtent()
{
}
public NumericRepresentationValue StartAngle { get; set; }
public NumericRepresentationValue EndAngle { get; set; }
public int? SectionId { get; set; }
public NumericRepresentationValue InnerRadius { get; set; }
public NumericRepresentationValue OuterRadius { get; set; }
public Point RotCtr { get; set; }
}
}
| /*******************************************************************************
* 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:
*
*
*******************************************************************************/
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel.Representations;
using AgGateway.ADAPT.ApplicationDataModel.Shapes;
namespace AgGateway.ADAPT.ApplicationDataModel.Prescriptions
{
public class RadialExtent
{
public RadialExtent()
{
}
public NumericRepresentationValue StartAngle { get; set; }
public NumericRepresentationValue EndAngle { get; set; }
public int? SectionId { get; set; }
public NumericRepresentationValue InnerRadius { get; set; }
public NumericRepresentationValue OuterRadius { get; set; }
public Point RotCtr { get; set; }
}
}
| epl-1.0 | C# |
7312058d4180d50015f35a159cc1965273293855 | Fix Bitrise timestamp calculation | nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke | source/Nuke.Common/BuildServers/Bitrise.cs | source/Nuke.Common/BuildServers/Bitrise.cs | // Copyright Matthias Koch, Sebastian Karasek 2018.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using JetBrains.Annotations;
using static Nuke.Common.EnvironmentInfo;
namespace Nuke.Common.BuildServers
{
/// <summary>
/// Interface according to the <a href="http://devcenter.bitrise.io/faq/available-environment-variables/#exposed-by-bitriseio">official website</a>.
/// </summary>
[PublicAPI]
[BuildServer]
public class Bitrise
{
private static Lazy<Bitrise> s_instance = new Lazy<Bitrise>(() => new Bitrise());
public static Bitrise Instance => NukeBuild.Instance?.Host == HostType.Bitrise ? s_instance.Value : null;
internal static bool IsRunningBitrise => Environment.GetEnvironmentVariable("BITRISE_BUILD_URL") != null;
private static DateTime ConvertUnixTimestamp(long timestamp)
{
return new DateTime(year: 1970, month: 1, day: 1, hour: 0, minute: 0, second: 0, kind: DateTimeKind.Utc)
.AddSeconds(timestamp)
.ToLocalTime();
}
internal Bitrise()
{
}
public string BuildUrl => Variable("BITRISE_BUILD_URL");
public long BuildNumber => Variable<long>("BITRISE_BUILD_NUMBER");
public string AppTitle => Variable("BITRISE_APP_TITLE");
public string AppUrl => Variable("BITRISE_APP_URL");
public string AppSlug => Variable("BITRISE_APP_SLUG");
public string BuildSlug => Variable("BITRISE_BUILD_SLUG");
public DateTime BuildTriggerTimestamp => ConvertUnixTimestamp(Variable<long>("BITRISE_BUILD_TRIGGER_TIMESTAMP"));
public string RepositoryUrl => Variable("GIT_REPOSITORY_URL");
public string GitBranch => Variable("BITRISE_GIT_BRANCH");
[CanBeNull] public string GitTag => Variable("BITRISE_GIT_TAG");
[CanBeNull] public string GitCommit => Variable("BITRISE_GIT_COMMIT");
[CanBeNull] public string GitMessage => Variable("BITRISE_GIT_MESSAGE");
[CanBeNull] public long? PullRequest => Variable<long?>("BITRISE_PULL_REQUEST");
[CanBeNull] public string ProvisionUrl => Variable("BITRISE_PROVISION_URL");
[CanBeNull] public string CertificateUrl => Variable("BITRISE_CERTIFICATE_URL");
[CanBeNull] public string CertificatePassphrase => Variable("BITRISE_CERTIFICATE_PASSPHRASE");
}
}
| // Copyright Matthias Koch, Sebastian Karasek 2018.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using JetBrains.Annotations;
using static Nuke.Common.EnvironmentInfo;
namespace Nuke.Common.BuildServers
{
/// <summary>
/// Interface according to the <a href="http://devcenter.bitrise.io/faq/available-environment-variables/#exposed-by-bitriseio">official website</a>.
/// </summary>
[PublicAPI]
[BuildServer]
public class Bitrise
{
private static Lazy<Bitrise> s_instance = new Lazy<Bitrise>(() => new Bitrise());
public static Bitrise Instance => NukeBuild.Instance?.Host == HostType.Bitrise ? s_instance.Value : null;
internal static bool IsRunningBitrise => Environment.GetEnvironmentVariable("BITRISE_BUILD_URL") != null;
private static DateTime ConvertUnixTimestamp(long timestamp)
{
return new DateTime(year: 1970, month: 1, day: 1, hour: 0, minute: 0, second: 0, kind: DateTimeKind.Utc)
.AddSeconds(value: 1501444668)
.ToLocalTime();
}
internal Bitrise()
{
}
public string BuildUrl => Variable("BITRISE_BUILD_URL");
public long BuildNumber => Variable<long>("BITRISE_BUILD_NUMBER");
public string AppTitle => Variable("BITRISE_APP_TITLE");
public string AppUrl => Variable("BITRISE_APP_URL");
public string AppSlug => Variable("BITRISE_APP_SLUG");
public string BuildSlug => Variable("BITRISE_BUILD_SLUG");
public DateTime BuildTriggerTimestamp => ConvertUnixTimestamp(Variable<long>("BITRISE_BUILD_TRIGGER_TIMESTAMP"));
public string RepositoryUrl => Variable("GIT_REPOSITORY_URL");
public string GitBranch => Variable("BITRISE_GIT_BRANCH");
[CanBeNull] public string GitTag => Variable("BITRISE_GIT_TAG");
[CanBeNull] public string GitCommit => Variable("BITRISE_GIT_COMMIT");
[CanBeNull] public string GitMessage => Variable("BITRISE_GIT_MESSAGE");
[CanBeNull] public long? PullRequest => Variable<long?>("BITRISE_PULL_REQUEST");
[CanBeNull] public string ProvisionUrl => Variable("BITRISE_PROVISION_URL");
[CanBeNull] public string CertificateUrl => Variable("BITRISE_CERTIFICATE_URL");
[CanBeNull] public string CertificatePassphrase => Variable("BITRISE_CERTIFICATE_PASSPHRASE");
}
}
| mit | C# |
3f27de649d0e7cb6e4aafe48fc67c8ddc7a869d3 | remove access modifier from interface | FuchsiaSoft/FLUFFS | FLUFFS-core/BinaryDigger/IBinaryReader.cs | FLUFFS-core/BinaryDigger/IBinaryReader.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BinaryDigger
{
interface IBinaryReader
{
string ReadContents();
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BinaryDigger
{
interface IBinaryReader
{
public string ReadContents();
}
}
| agpl-3.0 | C# |
39a3efca7cdd3ed50135fa67054c14f487f3201c | update query | rcamp021/InSeasonWebAPI | InSeasonAPI/Controllers/DataController.cs | InSeasonAPI/Controllers/DataController.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using InSeasonAPI.Models;
using Newtonsoft.Json;
namespace InSeasonAPI.Controllers
{
public class DataController : ApiController
{
/// <summary>
///
/// </summary>
/// <param name="animal"></param>
/// <param name="date"></param>
/// <param name="countyID"></param>
/// <returns></returns>
[Route("GetCounty/{animal}/{date}/{countyID}")]
public async System.Threading.Tasks.Task<IHttpActionResult> Get(string animal, DateTime date, string countyID)
{
using (StreamReader reader = new StreamReader(System.Web.HttpContext.Current.Server.MapPath(string.Format("~/App_Data/animals/{0}.json", animal))))
{
Hunting animalobj= await System.Threading.Tasks.Task.Factory.StartNew(() => JsonConvert.DeserializeObject<Hunting>(reader.ReadToEnd()));
// string[] splitdate = date.Split('-');
// string newdate = splitdate[]
var dates = animalobj.seasons.Select(x => x.range.Where(y => Convert.ToDateTime(y.season.date.starts) >= date && Convert.ToDateTime(y.season.date.ends) <= date));
return null;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using InSeasonAPI.Models;
using Newtonsoft.Json;
namespace InSeasonAPI.Controllers
{
public class DataController : ApiController
{
/// <summary>
///
/// </summary>
/// <param name="animal"></param>
/// <param name="date"></param>
/// <param name="countyID"></param>
/// <returns></returns>
[Route("GetCounty/{animal}/{date}/{countyID}")]
public async System.Threading.Tasks.Task<IHttpActionResult> Get(string animal, DateTime date, string countyID)
{
using (StreamReader reader = new StreamReader(System.Web.HttpContext.Current.Server.MapPath(string.Format("~/App_Data/animals/{0}.json", animal))))
{
Hunting animalobj= await System.Threading.Tasks.Task.Factory.StartNew(() => JsonConvert.DeserializeObject<Hunting>(reader.ReadToEnd()));
// string newDate = Convert.ToDateTime(date);
var dates = animalobj.seasons.season.range.Where(x => Convert.ToDateTime(x.season.date.starts) >= date &&
Convert.ToDateTime(x.season.date.ends) <= date);
return null;
}
}
}
}
| mit | C# |
ff1735522174e0bf8e007cf692f0078eec7776e8 | Change etag from DateTime to string, to reflect updated api. | aloneguid/storage | src/Azure/Storage.Net.Microsoft.Azure.DataLake.Store/Gen2/Models/DirectoryItem.cs | src/Azure/Storage.Net.Microsoft.Azure.DataLake.Store/Gen2/Models/DirectoryItem.cs | using System;
using Newtonsoft.Json;
namespace Storage.Net.Microsoft.Azure.DataLake.Store.Gen2.Models
{
public class DirectoryItem
{
[JsonProperty("contentLength")] public int? ContentLength { get; set; }
[JsonProperty("etag")] public string Etag { get; set; }
[JsonProperty("group")] public string Group { get; set; }
[JsonProperty("isDirectory")] public bool IsDirectory { get; set; }
[JsonProperty("lastModified")] public DateTime LastModified { get; set; }
[JsonProperty("name")] public string Name { get; set; }
[JsonProperty("owner")] public string Owner { get; set; }
[JsonProperty("permissions")] public string Permissions { get; set; }
}
} | using System;
using Newtonsoft.Json;
namespace Storage.Net.Microsoft.Azure.DataLake.Store.Gen2.Models
{
public class DirectoryItem
{
[JsonProperty("contentLength")] public int? ContentLength { get; set; }
[JsonProperty("etag")] public DateTime Etag { get; set; }
[JsonProperty("group")] public string Group { get; set; }
[JsonProperty("isDirectory")] public bool IsDirectory { get; set; }
[JsonProperty("lastModified")] public DateTime LastModified { get; set; }
[JsonProperty("name")] public string Name { get; set; }
[JsonProperty("owner")] public string Owner { get; set; }
[JsonProperty("permissions")] public string Permissions { get; set; }
}
} | mit | C# |
b8a7f006a98178a141322d44882a0a56b994f410 | fix base address | RedSpiderMkV/LANMachines | LANMachines/LanMachines/LanPingerAsync.cs | LANMachines/LanMachines/LanPingerAsync.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Text;
namespace LanMachines
{
public class LanPingerAsync
{
#region Public Methods
public LanPingerAsync(int pingerCount)
{
initialiseLanPingerList(pingerCount);
initialiseIpBase();
} // end method
#endregion
#region Private Methods
private void initialiseIpBase()
{
NetworkInterface networkInterface = NetworkInterface.GetAllNetworkInterfaces().FirstOrDefault();
if (networkInterface == null)
{
ipAddressBase_m = null;
}
else
{
string gateWayAddress = networkInterface.GetIPProperties().GatewayAddresses.FirstOrDefault().Address.ToString();
string[] parts = gateWayAddress.Split('.');
if (parts.Length < 3)
{
ipAddressBase_m = null;
}
else
{
ipAddressBase_m = String.Format("{0}.{1}.{2}", parts[0], parts[1], parts[2]);
} // end if
} // end if
} // end method
private void initialiseLanPingerList(int pingerCount)
{
lanPingers_m = new List<Ping>();
for (int i = 0; i < pingerCount; i++)
{
lanPingers_m.Add(new Ping());
} // end method
} // end method
#endregion
#region Private Data
private string ipAddressBase_m;
private List<Ping> lanPingers_m;
#endregion
} // end class
} // end namespace
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Text;
namespace LanMachines
{
public class LanPingerAsync
{
#region Public Methods
public LanPingerAsync(int pingerCount)
{
initialiseLanPingerList(pingerCount);
initialiseIpBase();
} // end method
#endregion
#region Private Methods
private void initialiseIpBase()
{
NetworkInterface networkInterface = NetworkInterface.GetAllNetworkInterfaces().FirstOrDefault();
if (networkInterface == null)
{
ipAddressBase_m = null;
}
else
{
ipAddressBase_m = networkInterface.GetIPProperties().GatewayAddresses.FirstOrDefault().Address.ToString();
} // end if
} // end method
private void initialiseLanPingerList(int pingerCount)
{
lanPingers_m = new List<Ping>();
for (int i = 0; i < pingerCount; i++)
{
lanPingers_m.Add(new Ping());
} // end method
} // end method
#endregion
#region Private Data
private string ipAddressBase_m;
private List<Ping> lanPingers_m;
#endregion
} // end class
} // end namespace
| mit | C# |
17c58678cf195eb95d873d456a07a88eaaa1d7ff | Update SelectionInfo.cs | smoogipooo/osu,johnneijzen/osu,peppy/osu,ZLima12/osu,naoey/osu,DrabWeb/osu,2yangk23/osu,peppy/osu,UselessToucan/osu,peppy/osu,peppy/osu-new,EVAST9919/osu,ppy/osu,ZLima12/osu,NeoAdonis/osu,naoey/osu,smoogipoo/osu,ppy/osu,DrabWeb/osu,EVAST9919/osu,johnneijzen/osu,NeoAdonis/osu,Nabile-Rahmani/osu,UselessToucan/osu,NeoAdonis/osu,DrabWeb/osu,naoey/osu,2yangk23/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,Frontear/osuKyzer,UselessToucan/osu | osu.Game/Rulesets/Edit/Layers/Selection/SelectionInfo.cs | osu.Game/Rulesets/Edit/Layers/Selection/SelectionInfo.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Edit.Layers.Selection
{
public class SelectionInfo
{
/// <summary>
/// The objects that are captured by the selection.
/// </summary>
public IEnumerable<DrawableHitObject> Objects;
/// <summary>
/// The screen space quad of the selection box surrounding <see cref="Objects"/>.
/// </summary>
public Quad SelectionQuad;
}
}
| using System.Collections.Generic;
using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Edit.Layers.Selection
{
public class SelectionInfo
{
/// <summary>
/// The objects that are captured by the selection.
/// </summary>
public IEnumerable<DrawableHitObject> Objects;
/// <summary>
/// The screen space quad of the selection box surrounding <see cref="Objects"/>.
/// </summary>
public Quad SelectionQuad;
}
}
| mit | C# |
79d58dc890f2773864c764fbd2462d0b044fc4b0 | Bump version | gonzalocasas/NetMetrixSDK | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// 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("NetMetrixSDK")]
[assembly: AssemblyDescription("Net-Metrix SDK for Windows Phone applications")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Gonzalo Casas")]
[assembly: AssemblyProduct("NetMetrix SDK")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d26acda3-5465-4207-8fd0-a1bbedd41bbc")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// 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("NetMetrixSDK")]
[assembly: AssemblyDescription("Net-Metrix SDK for Windows Phone applications")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Gonzalo Casas")]
[assembly: AssemblyProduct("NetMetrix SDK")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d26acda3-5465-4207-8fd0-a1bbedd41bbc")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
| mit | C# |
045851afe86021920ae0af71ea0b9656e75542a9 | bump version to 1.2.1 | Claymore/SharpMediaWiki | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaWiki API interface")]
[assembly: AssemblyDescription("C# interface to the MediaWiki API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Alexey Bobyakov")]
[assembly: AssemblyProduct("SharpMediaWiki")]
[assembly: AssemblyCopyright("Copyright © Alexey Bobyakov 2009")]
[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("703c75c5-c1f7-47d9-ac68-b6bf87e735bb")]
// 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.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaWiki API interface")]
[assembly: AssemblyDescription("C# interface to the MediaWiki API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Alexey Bobyakov")]
[assembly: AssemblyProduct("SharpMediaWiki")]
[assembly: AssemblyCopyright("Copyright © Alexey Bobyakov 2009")]
[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("703c75c5-c1f7-47d9-ac68-b6bf87e735bb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
| bsd-3-clause | C# |
959e7c0d243e970130152ecbdd631735b6c86427 | fix AssemblyInfo.cs | rin01/Rsqldrv | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rsqldrv")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hewlett-Packard")]
[assembly: AssemblyProduct("Rsqldrv")]
[assembly: AssemblyCopyright("Copyright © Hewlett-Packard 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c213ca51-e3c5-44de-b56b-14342b76ad72")]
// 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("Rsql")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hewlett-Packard")]
[assembly: AssemblyProduct("Rsql")]
[assembly: AssemblyCopyright("Copyright © Hewlett-Packard 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c213ca51-e3c5-44de-b56b-14342b76ad72")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| apache-2.0 | C# |
1a6a3298c633c6503022deb2e34024d154787a27 | simplify async Main with C#7.1 | schulz3000/deepstreamNet,schulz3000/deepstreamNet | src/DeepStreamNet.ConsoleSample/Program.cs | src/DeepStreamNet.ConsoleSample/Program.cs | using System;
using System.Threading.Tasks;
namespace DeepStreamNet.Core.ConsoleSample
{
public static class Program
{
public static async Task Main(string[] args)
{
var client = new DeepStreamClient("localhost", 6020);
if (await client.LoginAsync())
{
var disp = await client.Events.SubscribeAsync("test", Console.WriteLine);
await Task.Delay(2000);
client.Events.Publish("test", "Hello World");
await Task.Delay(30000);
Console.ReadKey();
await disp.DisposeAsync();
}
client.Dispose();
Console.Read();
}
}
}
| using System;
using System.Threading.Tasks;
namespace DeepStreamNet.Core.ConsoleSample
{
public static class Program
{
public static void Main(string[] args)
{
MainAsync(args).GetAwaiter().GetResult();
Console.Read();
}
static Task MainAsync(string[] args)
{
return Exec();
}
async static Task Exec()
{
var client = new DeepStreamClient("localhost", 6020);
if (await client.LoginAsync())
{
var disp = await client.Events.SubscribeAsync("test", Console.WriteLine);
await Task.Delay(2000);
client.Events.Publish("test", "Hello World");
await Task.Delay(30000);
Console.ReadKey();
await disp.DisposeAsync();
}
client.Dispose();
}
}
}
| mit | C# |
fbf4d5a0a4a4cf84f617fc4014715fc16acf36fc | Update ShapeRenderer.cs | wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D | src/Draw2D.Core/Renderers/ShapeRenderer.cs | src/Draw2D.Core/Renderers/ShapeRenderer.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.Generic;
using Draw2D.Core.Shapes;
using Draw2D.Core.Style;
namespace Draw2D.Core.Renderers
{
public abstract class ShapeRenderer : ObservableObject
{
public abstract ISet<ShapeObject> Selected { get; set; }
public abstract void InvalidateCache(DrawStyle style);
public abstract void InvalidateCache(MatrixObject matrix);
public abstract void InvalidateCache(ShapeObject shape, DrawStyle style, double dx, double dy);
public abstract object PushMatrix(object dc, MatrixObject matrix);
public abstract void PopMatrix(object dc, object state);
public abstract void DrawLine(object dc, IPoint start, IPoint point, DrawStyle style, double dx, double dy);
public abstract void DrawCubicBezier(object dc, IPoint start, IPoint point1, IPoint point2, IPoint point3, DrawStyle style, double dx, double dy);
public abstract void DrawQuadraticBezier(object dc, IPoint start, IPoint point1, IPoint point2, DrawStyle style, double dx, double dy);
public abstract void DrawPath(object dc, IPath path, DrawStyle style, double dx, double dy);
public abstract void DrawRectangle(object dc, IPoint tl, IPoint br, DrawStyle style, double dx, double dy);
public abstract void DrawEllipse(object dc, IPoint tl, IPoint br, DrawStyle style, double dx, double dy);
public abstract void DrawText(object dc, IPoint tl, IPoint br, string text, DrawStyle style, double dx, double dy);
}
}
| // 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.Generic;
using Draw2D.Core.Shapes;
using Draw2D.Core.Style;
namespace Draw2D.Core.Renderers
{
public abstract class ShapeRenderer : ObservableObject
{
public abstract ISet<ShapeObject> Selected { get; set; }
public abstract void InvalidateCache(DrawStyle style);
public abstract void InvalidateCache(MatrixObject matrix);
public abstract void InvalidateCache(ShapeObject shape, DrawStyle style, double dx, double dy);
public abstract object PushMatrix(object dc, MatrixObject matrix);
public abstract void PopMatrix(object dc, object state);
public abstract void DrawLine(object dc, IPoint start, IPoint point, DrawStyle style, double dx, double dy);
public abstract void DrawCubicBezier(object dc, IPoint start, IPoint point1, IPoint point2, IPoint poin3, DrawStyle style, double dx, double dy);
public abstract void DrawQuadraticBezier(object dc, IPoint start, IPoint point1, IPoint point2, DrawStyle style, double dx, double dy);
public abstract void DrawPath(object dc, IPath path, DrawStyle style, double dx, double dy);
public abstract void DrawRectangle(object dc, IPoint tl, IPoint br, DrawStyle style, double dx, double dy);
public abstract void DrawEllipse(object dc, IPoint tl, IPoint br, DrawStyle style, double dx, double dy);
public abstract void DrawText(object dc, IPoint tl, IPoint br, string text, DrawStyle style, double dx, double dy);
}
}
| mit | C# |
9a364d546b7006b7a9a4538b316cfd04f8fd4e88 | update gravatar (#145) | MabroukENG/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,beraybentesen/planetxamarin,MabroukENG/planetxamarin,MabroukENG/planetxamarin | src/Firehose.Web/Authors/MichaelRidland.cs | src/Firehose.Web/Authors/MichaelRidland.cs | using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MichaelRidland : IAmAXamarinMVP
{
public string FirstName => "Michael";
public string LastName => "Ridland";
public string StateOrRegion => "Sydney, Australia";
public string EmailAddress => "[email protected]";
public string ShortBioOrTagLine => "Xamarin Contractor/Consultant | Founder XAM Consulting (xam-consulting.com) | Creator of FreshMvvm";
public Uri WebSite => new Uri("http://www.michaelridland.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.michaelridland.com/feed/"); }
}
public string TwitterHandle => "rid00z";
public string GravatarHash => "3c07e56045d18f4f290eb4983031309d";
public string GitHubHandle => "rid00z";
public GeoPosition Position => new GeoPosition(-25.348875, 131.035000);
}
}
| using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MichaelRidland : IAmAXamarinMVP
{
public string FirstName => "Michael";
public string LastName => "Ridland";
public string StateOrRegion => "Sydney, Australia";
public string EmailAddress => "[email protected]";
public string ShortBioOrTagLine => "";
public Uri WebSite => new Uri("http://www.michaelridland.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.michaelridland.com/feed/"); }
}
public string TwitterHandle => "rid00z";
public string GravatarHash => "";
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(-33.8688200, 151.2092960);
}
}
| mit | C# |
047db6d5f4695240525679bdff2c04ba6c523342 | Change with this submission | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/MusicStore/Models/MusicStoreContext.cs | src/MusicStore/Models/MusicStoreContext.cs | using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Framework.OptionsModel;
namespace MusicStore.Models
{
public class MusicStoreContext : DbContext
{
public MusicStoreContext(IServiceProvider serviceProvider, IOptionsAccessor<MusicStoreDbContextOptions> optionsAccessor)
: base(serviceProvider, optionsAccessor.Options)
{
}
public DbSet<Album> Albums { get; set; }
public DbSet<Artist> Artists { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<Genre> Genres { get; set; }
public DbSet<CartItem> CartItems { get; set; }
public DbSet<OrderDetail> OrderDetails { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<Album>().Key(a => a.AlbumId);
builder.Entity<Artist>().Key(a => a.ArtistId);
builder.Entity<Order>().Key(o => o.OrderId).StorageName("Order");
builder.Entity<Genre>().Key(g => g.GenreId);
builder.Entity<CartItem>().Key(c => c.CartItemId);
builder.Entity<OrderDetail>().Key(o => o.OrderDetailId);
}
}
public class MusicStoreDbContextOptions : DbContextOptions
{
}
} | using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Framework.OptionsModel;
namespace MusicStore.Models
{
public class MusicStoreContext : DbContext
{
public MusicStoreContext(IServiceProvider serviceProvider, IOptionsAccessor<MusicStoreDbContextOptions> optionsAccessor)
: base(serviceProvider, optionsAccessor.Options)
{
}
public DbSet<Album> Albums { get; set; }
public DbSet<Artist> Artists { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<Genre> Genres { get; set; }
public DbSet<CartItem> CartItems { get; set; }
public DbSet<OrderDetail> OrderDetails { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<Album>().Key(a => a.AlbumId);
builder.Entity<Artist>().Key(a => a.ArtistId);
builder.Entity<Order>().Key(o => o.OrderId).StorageName("[Order]");
builder.Entity<Genre>().Key(g => g.GenreId);
builder.Entity<CartItem>().Key(c => c.CartItemId);
builder.Entity<OrderDetail>().Key(o => o.OrderDetailId);
}
}
public class MusicStoreDbContextOptions : DbContextOptions
{
}
} | apache-2.0 | C# |
ee396d0f8e24d7c21beafb6859886cce47f14c46 | Add integration test app | brian-dot-net/writeasync,brian-dot-net/writeasync,brian-dot-net/writeasync | projects/QueueSample/source/QueueSample.App/Program.cs | projects/QueueSample/source/QueueSample.App/Program.cs | //-----------------------------------------------------------------------
// <copyright file="Program.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace QueueSample
{
using System;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
internal sealed class Program
{
private static void Main(string[] args)
{
InputQueue<int> queue = new InputQueue<int>();
using (CancellationTokenSource cts = new CancellationTokenSource())
{
Task enqueueTask = PrintException(EnqueueLoopAsync(queue, cts.Token));
Task dequeueTask = PrintException(DequeueLoopAsync(queue, cts.Token));
Console.WriteLine("Press ENTER to cancel.");
Console.ReadLine();
cts.Cancel();
Task.WaitAll(enqueueTask, dequeueTask);
}
}
private static async Task EnqueueLoopAsync(InputQueue<int> queue, CancellationToken token)
{
await Task.Yield();
int i = 0;
while (!token.IsCancellationRequested)
{
++i;
queue.Enqueue(i);
await Task.Delay(1);
}
}
private static async Task DequeueLoopAsync(InputQueue<int> queue, CancellationToken token)
{
int previous = 0;
while (!token.IsCancellationRequested)
{
int current = await queue.DequeueAsync();
if (current - previous != 1)
{
string message = string.Format(CultureInfo.InvariantCulture, "Invalid data! Current is {0} but previous was {1}.", current, previous);
throw new InvalidOperationException(message);
}
}
}
private static async Task PrintException(Task task)
{
try
{
await task;
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
}
}
| //-----------------------------------------------------------------------
// <copyright file="Program.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace QueueSample
{
using System;
internal sealed class Program
{
private static void Main(string[] args)
{
}
}
}
| unlicense | C# |
d63b1d62b13914462cfee7ed6137395179e66eb0 | Fix AbandonedCall test | MakMukhi/grpc,philcleveland/grpc,kpayson64/grpc,PeterFaiman/ruby-grpc-minimal,matt-kwong/grpc,vsco/grpc,deepaklukose/grpc,stanley-cheung/grpc,fuchsia-mirror/third_party-grpc,7anner/grpc,thunderboltsid/grpc,matt-kwong/grpc,murgatroid99/grpc,nicolasnoble/grpc,arkmaxim/grpc,fuchsia-mirror/third_party-grpc,carl-mastrangelo/grpc,7anner/grpc,ipylypiv/grpc,firebase/grpc,pszemus/grpc,firebase/grpc,VcamX/grpc,ejona86/grpc,apolcyn/grpc,jtattermusch/grpc,vjpai/grpc,quizlet/grpc,jtattermusch/grpc,fuchsia-mirror/third_party-grpc,MakMukhi/grpc,apolcyn/grpc,zhimingxie/grpc,fuchsia-mirror/third_party-grpc,yang-g/grpc,ananthonline/grpc,soltanmm-google/grpc,muxi/grpc,a11r/grpc,royalharsh/grpc,kskalski/grpc,carl-mastrangelo/grpc,ananthonline/grpc,dgquintas/grpc,donnadionne/grpc,ppietrasa/grpc,rjshade/grpc,tamihiro/grpc,wcevans/grpc,kskalski/grpc,7anner/grpc,muxi/grpc,stanley-cheung/grpc,thinkerou/grpc,arkmaxim/grpc,muxi/grpc,greasypizza/grpc,dklempner/grpc,kpayson64/grpc,sreecha/grpc,Vizerai/grpc,donnadionne/grpc,jcanizales/grpc,PeterFaiman/ruby-grpc-minimal,baylabs/grpc,msiedlarek/grpc,pszemus/grpc,kumaralokgithub/grpc,Crevil/grpc,perumaalgoog/grpc,thunderboltsid/grpc,quizlet/grpc,zhimingxie/grpc,firebase/grpc,mehrdada/grpc,ppietrasa/grpc,philcleveland/grpc,tamihiro/grpc,chrisdunelm/grpc,msmania/grpc,deepaklukose/grpc,matt-kwong/grpc,greasypizza/grpc,ejona86/grpc,perumaalgoog/grpc,donnadionne/grpc,bogdandrutu/grpc,Vizerai/grpc,fuchsia-mirror/third_party-grpc,a11r/grpc,mehrdada/grpc,nicolasnoble/grpc,ncteisen/grpc,vjpai/grpc,nicolasnoble/grpc,goldenbull/grpc,infinit/grpc,perumaalgoog/grpc,ananthonline/grpc,wcevans/grpc,ananthonline/grpc,sreecha/grpc,chrisdunelm/grpc,ejona86/grpc,msmania/grpc,geffzhang/grpc,yugui/grpc,grani/grpc,a11r/grpc,7anner/grpc,vsco/grpc,geffzhang/grpc,a-veitch/grpc,goldenbull/grpc,sreecha/grpc,bogdandrutu/grpc,thunderboltsid/grpc,Crevil/grpc,carl-mastrangelo/grpc,ejona86/grpc,carl-mastrangelo/grpc,carl-mastrangelo/grpc,dgquintas/grpc,apolcyn/grpc,thunderboltsid/grpc,firebase/grpc,7anner/grpc,rjshade/grpc,dgquintas/grpc,quizlet/grpc,leifurhauks/grpc,pszemus/grpc,podsvirov/grpc,rjshade/grpc,a-veitch/grpc,simonkuang/grpc,yongni/grpc,geffzhang/grpc,dgquintas/grpc,msiedlarek/grpc,firebase/grpc,sreecha/grpc,thinkerou/grpc,baylabs/grpc,rjshade/grpc,PeterFaiman/ruby-grpc-minimal,makdharma/grpc,greasypizza/grpc,ctiller/grpc,chrisdunelm/grpc,tengyifei/grpc,malexzx/grpc,leifurhauks/grpc,wcevans/grpc,maxwell-demon/grpc,yugui/grpc,yugui/grpc,VcamX/grpc,geffzhang/grpc,jcanizales/grpc,y-zeng/grpc,vjpai/grpc,andrewpollock/grpc,makdharma/grpc,philcleveland/grpc,yang-g/grpc,grani/grpc,donnadionne/grpc,zhimingxie/grpc,jboeuf/grpc,baylabs/grpc,stanley-cheung/grpc,pmarks-net/grpc,miselin/grpc,bogdandrutu/grpc,malexzx/grpc,msmania/grpc,chrisdunelm/grpc,perumaalgoog/grpc,a-veitch/grpc,jtattermusch/grpc,ctiller/grpc,a-veitch/grpc,yongni/grpc,VcamX/grpc,sreecha/grpc,adelez/grpc,chrisdunelm/grpc,matt-kwong/grpc,tengyifei/grpc,soltanmm-google/grpc,deepaklukose/grpc,pmarks-net/grpc,ctiller/grpc,ncteisen/grpc,thunderboltsid/grpc,yugui/grpc,andrewpollock/grpc,andrewpollock/grpc,yugui/grpc,Vizerai/grpc,grani/grpc,adelez/grpc,hstefan/grpc,jtattermusch/grpc,podsvirov/grpc,geffzhang/grpc,soltanmm-google/grpc,a11r/grpc,greasypizza/grpc,nicolasnoble/grpc,ctiller/grpc,PeterFaiman/ruby-grpc-minimal,nicolasnoble/grpc,dklempner/grpc,podsvirov/grpc,sreecha/grpc,dgquintas/grpc,yang-g/grpc,jtattermusch/grpc,sreecha/grpc,y-zeng/grpc,ctiller/grpc,stanley-cheung/grpc,leifurhauks/grpc,arkmaxim/grpc,mehrdada/grpc,y-zeng/grpc,andrewpollock/grpc,kriswuollett/grpc,ppietrasa/grpc,ejona86/grpc,greasypizza/grpc,firebase/grpc,PeterFaiman/ruby-grpc-minimal,mehrdada/grpc,nicolasnoble/grpc,bogdandrutu/grpc,royalharsh/grpc,muxi/grpc,pmarks-net/grpc,pszemus/grpc,yongni/grpc,kriswuollett/grpc,LuminateWireless/grpc,kriswuollett/grpc,carl-mastrangelo/grpc,VcamX/grpc,grpc/grpc,ncteisen/grpc,murgatroid99/grpc,ncteisen/grpc,goldenbull/grpc,kpayson64/grpc,geffzhang/grpc,thunderboltsid/grpc,soltanmm-google/grpc,apolcyn/grpc,kskalski/grpc,jboeuf/grpc,nicolasnoble/grpc,a11r/grpc,ctiller/grpc,wcevans/grpc,soltanmm/grpc,makdharma/grpc,royalharsh/grpc,adelez/grpc,bogdandrutu/grpc,greasypizza/grpc,vjpai/grpc,dklempner/grpc,miselin/grpc,vsco/grpc,LuminateWireless/grpc,ananthonline/grpc,muxi/grpc,thinkerou/grpc,muxi/grpc,y-zeng/grpc,andrewpollock/grpc,infinit/grpc,rjshade/grpc,yugui/grpc,Vizerai/grpc,simonkuang/grpc,andrewpollock/grpc,pmarks-net/grpc,tengyifei/grpc,y-zeng/grpc,LuminateWireless/grpc,VcamX/grpc,bogdandrutu/grpc,murgatroid99/grpc,hstefan/grpc,thinkerou/grpc,ipylypiv/grpc,7anner/grpc,donnadionne/grpc,soltanmm/grpc,makdharma/grpc,Crevil/grpc,maxwell-demon/grpc,arkmaxim/grpc,rjshade/grpc,grpc/grpc,kriswuollett/grpc,matt-kwong/grpc,vsco/grpc,maxwell-demon/grpc,pmarks-net/grpc,ctiller/grpc,donnadionne/grpc,royalharsh/grpc,mehrdada/grpc,ananthonline/grpc,arkmaxim/grpc,Crevil/grpc,firebase/grpc,miselin/grpc,tengyifei/grpc,dklempner/grpc,goldenbull/grpc,kriswuollett/grpc,baylabs/grpc,fuchsia-mirror/third_party-grpc,donnadionne/grpc,malexzx/grpc,fuchsia-mirror/third_party-grpc,y-zeng/grpc,maxwell-demon/grpc,jtattermusch/grpc,grani/grpc,carl-mastrangelo/grpc,dklempner/grpc,hstefan/grpc,sreecha/grpc,philcleveland/grpc,firebase/grpc,ejona86/grpc,quizlet/grpc,goldenbull/grpc,daniel-j-born/grpc,deepaklukose/grpc,royalharsh/grpc,simonkuang/grpc,adelez/grpc,soltanmm-google/grpc,chrisdunelm/grpc,rjshade/grpc,simonkuang/grpc,jboeuf/grpc,leifurhauks/grpc,leifurhauks/grpc,vjpai/grpc,yang-g/grpc,tamihiro/grpc,vjpai/grpc,MakMukhi/grpc,zhimingxie/grpc,stanley-cheung/grpc,yongni/grpc,fuchsia-mirror/third_party-grpc,donnadionne/grpc,ipylypiv/grpc,matt-kwong/grpc,PeterFaiman/ruby-grpc-minimal,yongni/grpc,daniel-j-born/grpc,apolcyn/grpc,msmania/grpc,MakMukhi/grpc,7anner/grpc,kriswuollett/grpc,quizlet/grpc,msiedlarek/grpc,jtattermusch/grpc,jtattermusch/grpc,jboeuf/grpc,adelez/grpc,soltanmm/grpc,apolcyn/grpc,apolcyn/grpc,chrisdunelm/grpc,hstefan/grpc,deepaklukose/grpc,maxwell-demon/grpc,Vizerai/grpc,arkmaxim/grpc,sreecha/grpc,VcamX/grpc,MakMukhi/grpc,firebase/grpc,daniel-j-born/grpc,miselin/grpc,soltanmm-google/grpc,LuminateWireless/grpc,tamihiro/grpc,leifurhauks/grpc,y-zeng/grpc,nicolasnoble/grpc,mehrdada/grpc,deepaklukose/grpc,dgquintas/grpc,makdharma/grpc,yang-g/grpc,dklempner/grpc,grpc/grpc,grani/grpc,grpc/grpc,pszemus/grpc,vjpai/grpc,philcleveland/grpc,perumaalgoog/grpc,ipylypiv/grpc,podsvirov/grpc,philcleveland/grpc,makdharma/grpc,carl-mastrangelo/grpc,jcanizales/grpc,yang-g/grpc,vjpai/grpc,dgquintas/grpc,thinkerou/grpc,soltanmm/grpc,thinkerou/grpc,soltanmm-google/grpc,apolcyn/grpc,miselin/grpc,jcanizales/grpc,dklempner/grpc,andrewpollock/grpc,ananthonline/grpc,ctiller/grpc,infinit/grpc,bogdandrutu/grpc,infinit/grpc,wcevans/grpc,adelez/grpc,simonkuang/grpc,geffzhang/grpc,podsvirov/grpc,chrisdunelm/grpc,Vizerai/grpc,zhimingxie/grpc,simonkuang/grpc,arkmaxim/grpc,malexzx/grpc,apolcyn/grpc,nicolasnoble/grpc,yongni/grpc,mehrdada/grpc,kumaralokgithub/grpc,ejona86/grpc,LuminateWireless/grpc,grpc/grpc,soltanmm/grpc,MakMukhi/grpc,Vizerai/grpc,jboeuf/grpc,kumaralokgithub/grpc,stanley-cheung/grpc,ncteisen/grpc,daniel-j-born/grpc,7anner/grpc,LuminateWireless/grpc,msmania/grpc,LuminateWireless/grpc,podsvirov/grpc,ncteisen/grpc,zhimingxie/grpc,chrisdunelm/grpc,ppietrasa/grpc,bogdandrutu/grpc,ncteisen/grpc,donnadionne/grpc,pmarks-net/grpc,thinkerou/grpc,y-zeng/grpc,deepaklukose/grpc,msiedlarek/grpc,msiedlarek/grpc,msiedlarek/grpc,grpc/grpc,donnadionne/grpc,hstefan/grpc,infinit/grpc,ncteisen/grpc,murgatroid99/grpc,thunderboltsid/grpc,murgatroid99/grpc,kskalski/grpc,philcleveland/grpc,deepaklukose/grpc,jboeuf/grpc,thinkerou/grpc,thinkerou/grpc,andrewpollock/grpc,msmania/grpc,perumaalgoog/grpc,quizlet/grpc,donnadionne/grpc,greasypizza/grpc,matt-kwong/grpc,ipylypiv/grpc,yongni/grpc,tengyifei/grpc,msmania/grpc,Vizerai/grpc,infinit/grpc,MakMukhi/grpc,soltanmm/grpc,philcleveland/grpc,greasypizza/grpc,ipylypiv/grpc,sreecha/grpc,daniel-j-born/grpc,vsco/grpc,a-veitch/grpc,hstefan/grpc,kpayson64/grpc,mehrdada/grpc,yongni/grpc,fuchsia-mirror/third_party-grpc,simonkuang/grpc,baylabs/grpc,goldenbull/grpc,ananthonline/grpc,jcanizales/grpc,kskalski/grpc,matt-kwong/grpc,pszemus/grpc,infinit/grpc,thinkerou/grpc,carl-mastrangelo/grpc,jboeuf/grpc,kriswuollett/grpc,dgquintas/grpc,ncteisen/grpc,a11r/grpc,soltanmm/grpc,msiedlarek/grpc,stanley-cheung/grpc,msmania/grpc,ejona86/grpc,jboeuf/grpc,vjpai/grpc,perumaalgoog/grpc,soltanmm-google/grpc,adelez/grpc,ncteisen/grpc,jboeuf/grpc,royalharsh/grpc,malexzx/grpc,msiedlarek/grpc,murgatroid99/grpc,tengyifei/grpc,ananthonline/grpc,andrewpollock/grpc,podsvirov/grpc,thunderboltsid/grpc,matt-kwong/grpc,nicolasnoble/grpc,PeterFaiman/ruby-grpc-minimal,kskalski/grpc,muxi/grpc,bogdandrutu/grpc,muxi/grpc,thinkerou/grpc,Vizerai/grpc,a-veitch/grpc,msiedlarek/grpc,jboeuf/grpc,thinkerou/grpc,hstefan/grpc,kskalski/grpc,grani/grpc,arkmaxim/grpc,Crevil/grpc,maxwell-demon/grpc,soltanmm/grpc,mehrdada/grpc,jtattermusch/grpc,ejona86/grpc,greasypizza/grpc,mehrdada/grpc,rjshade/grpc,a11r/grpc,a11r/grpc,tengyifei/grpc,malexzx/grpc,ctiller/grpc,malexzx/grpc,yang-g/grpc,jtattermusch/grpc,simonkuang/grpc,wcevans/grpc,kpayson64/grpc,adelez/grpc,royalharsh/grpc,kpayson64/grpc,fuchsia-mirror/third_party-grpc,ctiller/grpc,dgquintas/grpc,PeterFaiman/ruby-grpc-minimal,stanley-cheung/grpc,ppietrasa/grpc,kpayson64/grpc,zhimingxie/grpc,goldenbull/grpc,pmarks-net/grpc,ppietrasa/grpc,zhimingxie/grpc,PeterFaiman/ruby-grpc-minimal,miselin/grpc,dklempner/grpc,soltanmm/grpc,kumaralokgithub/grpc,MakMukhi/grpc,malexzx/grpc,dklempner/grpc,vsco/grpc,kpayson64/grpc,kpayson64/grpc,tengyifei/grpc,Vizerai/grpc,yugui/grpc,a-veitch/grpc,ctiller/grpc,daniel-j-born/grpc,perumaalgoog/grpc,stanley-cheung/grpc,vjpai/grpc,Crevil/grpc,ppietrasa/grpc,Crevil/grpc,muxi/grpc,stanley-cheung/grpc,baylabs/grpc,VcamX/grpc,yongni/grpc,baylabs/grpc,jcanizales/grpc,geffzhang/grpc,infinit/grpc,podsvirov/grpc,jtattermusch/grpc,VcamX/grpc,ejona86/grpc,leifurhauks/grpc,ejona86/grpc,ctiller/grpc,VcamX/grpc,sreecha/grpc,LuminateWireless/grpc,kumaralokgithub/grpc,arkmaxim/grpc,chrisdunelm/grpc,zhimingxie/grpc,royalharsh/grpc,daniel-j-born/grpc,royalharsh/grpc,Crevil/grpc,yang-g/grpc,daniel-j-born/grpc,kriswuollett/grpc,goldenbull/grpc,perumaalgoog/grpc,PeterFaiman/ruby-grpc-minimal,thunderboltsid/grpc,kskalski/grpc,grpc/grpc,hstefan/grpc,donnadionne/grpc,vjpai/grpc,nicolasnoble/grpc,maxwell-demon/grpc,geffzhang/grpc,pszemus/grpc,stanley-cheung/grpc,rjshade/grpc,leifurhauks/grpc,vsco/grpc,a-veitch/grpc,a-veitch/grpc,makdharma/grpc,simonkuang/grpc,hstefan/grpc,vjpai/grpc,muxi/grpc,tamihiro/grpc,grani/grpc,sreecha/grpc,grani/grpc,muxi/grpc,firebase/grpc,pszemus/grpc,LuminateWireless/grpc,vsco/grpc,daniel-j-born/grpc,baylabs/grpc,yang-g/grpc,wcevans/grpc,podsvirov/grpc,jtattermusch/grpc,ncteisen/grpc,grpc/grpc,ipylypiv/grpc,firebase/grpc,carl-mastrangelo/grpc,murgatroid99/grpc,jcanizales/grpc,ppietrasa/grpc,quizlet/grpc,y-zeng/grpc,malexzx/grpc,goldenbull/grpc,maxwell-demon/grpc,jboeuf/grpc,pmarks-net/grpc,ejona86/grpc,miselin/grpc,murgatroid99/grpc,soltanmm-google/grpc,ppietrasa/grpc,kumaralokgithub/grpc,vsco/grpc,makdharma/grpc,murgatroid99/grpc,wcevans/grpc,miselin/grpc,7anner/grpc,tamihiro/grpc,maxwell-demon/grpc,tamihiro/grpc,murgatroid99/grpc,kpayson64/grpc,yugui/grpc,jcanizales/grpc,carl-mastrangelo/grpc,tamihiro/grpc,chrisdunelm/grpc,a11r/grpc,pszemus/grpc,nicolasnoble/grpc,MakMukhi/grpc,ipylypiv/grpc,pszemus/grpc,quizlet/grpc,Vizerai/grpc,msmania/grpc,jboeuf/grpc,stanley-cheung/grpc,kskalski/grpc,carl-mastrangelo/grpc,grani/grpc,makdharma/grpc,kpayson64/grpc,miselin/grpc,pszemus/grpc,Crevil/grpc,tengyifei/grpc,tamihiro/grpc,kumaralokgithub/grpc,pszemus/grpc,pmarks-net/grpc,baylabs/grpc,dgquintas/grpc,mehrdada/grpc,ipylypiv/grpc,kriswuollett/grpc,wcevans/grpc,grpc/grpc,mehrdada/grpc,quizlet/grpc,infinit/grpc,firebase/grpc,yugui/grpc,kumaralokgithub/grpc,muxi/grpc,dgquintas/grpc,grpc/grpc,kumaralokgithub/grpc,grpc/grpc,adelez/grpc,ncteisen/grpc,philcleveland/grpc,jcanizales/grpc,leifurhauks/grpc,deepaklukose/grpc,grpc/grpc | src/csharp/Grpc.Core.Tests/ShutdownTest.cs | src/csharp/Grpc.Core.Tests/ShutdownTest.cs | #region Copyright notice and license
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
using Grpc.Core.Internal;
using Grpc.Core.Utils;
using NUnit.Framework;
namespace Grpc.Core.Tests
{
public class ShutdownTest
{
const string Host = "127.0.0.1";
MockServiceHelper helper;
Server server;
Channel channel;
[SetUp]
public void Init()
{
helper = new MockServiceHelper(Host);
server = helper.GetServer();
server.Start();
channel = helper.GetChannel();
}
[Test]
public async Task AbandonedCall_ServerKillAsync()
{
var readyToShutdown = new TaskCompletionSource<object>();
helper.DuplexStreamingHandler = new DuplexStreamingServerMethod<string, string>(async (requestStream, responseStream, context) =>
{
readyToShutdown.SetResult(null);
await requestStream.ToListAsync();
});
var call = Calls.AsyncDuplexStreamingCall(helper.CreateDuplexStreamingCall());
await readyToShutdown.Task; // make sure handler is running
await channel.ShutdownAsync(); // channel.ShutdownAsync() works even if there's a pending call.
await server.KillAsync(); // server.ShutdownAsync() would hang waiting for the call to finish.
}
}
}
| #region Copyright notice and license
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
using Grpc.Core.Internal;
using Grpc.Core.Utils;
using NUnit.Framework;
namespace Grpc.Core.Tests
{
public class ShutdownTest
{
const string Host = "127.0.0.1";
MockServiceHelper helper;
Server server;
Channel channel;
[SetUp]
public void Init()
{
helper = new MockServiceHelper(Host);
server = helper.GetServer();
server.Start();
channel = helper.GetChannel();
}
[Test]
public async Task AbandonedCall()
{
helper.DuplexStreamingHandler = new DuplexStreamingServerMethod<string, string>(async (requestStream, responseStream, context) =>
{
await requestStream.ToListAsync();
});
var call = Calls.AsyncDuplexStreamingCall(helper.CreateDuplexStreamingCall(new CallOptions(deadline: DateTime.UtcNow.AddMilliseconds(1))));
channel.ShutdownAsync().Wait();
server.ShutdownAsync().Wait();
}
}
}
| bsd-3-clause | C# |
2a1cbfd6a7cec21c2c268a78222ec8accce86201 | Fix syntax error in InternationalStreet example | smartystreets/smartystreets-dotnet-sdk | src/examples/InternationalStreetExample.cs | src/examples/InternationalStreetExample.cs | namespace Examples
{
using System;
using SmartyStreets;
using SmartyStreets.InternationalStreetApi;
internal static class InternationalStreetExample
{
public static void Run()
{
// We recommend storing your secret keys in environment variables.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
var client = new ClientBuilder(authId, authToken).BuildInternationalStreetApiClient();
// Documentation for input fields can be found at:
// https://smartystreetscom/docs/cloud/international-street-api#http-input-fields
// Geocoding must be expressly set to get latitude and longitude.
var lookup = new Lookup("Rua Padre Antonio D'Angelo 121 Casa Verde, Sao Paulo", "Brazil")
{
InputId = "ID-8675309", // Optional ID from your system
Geocode = true,
Organization = "John Doe",
Address1 = "Rua Padre Antonio D'Angelo 121",
Address2 = "Casa Verde",
Locality = "Sao Paulo",
AdministrativeArea = "SP",
Country = "Brazil",
PostalCode = "02516-050"
};
client.Send(lookup);
var candidates = lookup.Result;
var firstCandidate = candidates[0];
Console.WriteLine("Input ID: " + firstCandidate.InputId);
Console.WriteLine("Address is " + firstCandidate.Analysis.VerificationStatus);
Console.WriteLine("Address precision: " + firstCandidate.Analysis.AddressPrecision + "\n");
Console.WriteLine("First Line: " + firstCandidate.Address1);
Console.WriteLine("Second Line: " + firstCandidate.Address2);
Console.WriteLine("Third Line: " + firstCandidate.Address3);
Console.WriteLine("Fourth Line: " + firstCandidate.Address4);
Console.WriteLine("Address Format: " + firstCandidate.Metadata.AddressFormat);
Console.WriteLine("Latitude: " + firstCandidate.Metadata.Latitude);
Console.WriteLine("Longitude: " + firstCandidate.Metadata.Longitude);
}
}
}
| namespace Examples
{
using System;
using SmartyStreets;
using SmartyStreets.InternationalStreetApi;
internal static class InternationalStreetExample
{
public static void Run()
{
// We recommend storing your secret keys in environment variables.
var authId = Environment.GetEnvironmentVariable("SMARTY_AUTH_ID");
var authToken = Environment.GetEnvironmentVariable("SMARTY_AUTH_TOKEN");
var client = new ClientBuilder(authId, authToken).BuildInternationalStreetApiClient();
// Documentation for input fields can be found at:
// https://smartystreetscom/docs/cloud/international-street-api#http-input-fields
// Geocoding must be expressly set to get latitude and longitude.
var lookup = new Lookup("Rua Padre Antonio D'Angelo 121 Casa Verde, Sao Paulo", "Brazil")
{
InputId = "ID-8675309", // Optional ID from your system
Geocode = true,
Organization = "John Doe",
Address1 = "Rua Padre Antonio D'Angelo 121",
Address2 = "Casa Verde",
Locality = "Sao Paulo",
AdministrativeArea = "SP",
Country = "Brazil",
PostalCode = "02516-050"
};
client.Send(lookup);
var candidates = lookup.Result;
var firstCandidate = candidates[0];
Console.WriteLine("Input ID: " + firstCandidate.InputId)
Console.WriteLine("Address is " + firstCandidate.Analysis.VerificationStatus);
Console.WriteLine("Address precision: " + firstCandidate.Analysis.AddressPrecision + "\n");
Console.WriteLine("First Line: " + firstCandidate.Address1);
Console.WriteLine("Second Line: " + firstCandidate.Address2);
Console.WriteLine("Third Line: " + firstCandidate.Address3);
Console.WriteLine("Fourth Line: " + firstCandidate.Address4);
Console.WriteLine("Address Format: " + firstCandidate.Metadata.AddressFormat);
Console.WriteLine("Latitude: " + firstCandidate.Metadata.Latitude);
Console.WriteLine("Longitude: " + firstCandidate.Metadata.Longitude);
}
}
} | apache-2.0 | C# |
ab3f19ecc4f67cbc5d2244f82a9976a42dc0dadd | Fix get worker filename | henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer | src/HstWbInstaller.Imager.GuiApp/Helpers/WorkerHelper.cs | src/HstWbInstaller.Imager.GuiApp/Helpers/WorkerHelper.cs | namespace HstWbInstaller.Imager.GuiApp.Helpers
{
using System.IO;
using Core.Helpers;
public static class WorkerHelper
{
public static string GetWorkerFileName()
{
var executingFile = ApplicationDataHelper.GetExecutingFile();
return Path.GetExtension(executingFile) switch
{
".dll" => $"{Path.GetFileNameWithoutExtension(executingFile)}.exe",
_ => Path.GetFileName(executingFile)
};
}
}
} | namespace HstWbInstaller.Imager.GuiApp.Helpers
{
using System.IO;
using Core.Helpers;
public static class WorkerHelper
{
public static string GetWorkerFileName()
{
var executingFile = ApplicationDataHelper.GetExecutingFile();
return $"{Path.GetFileNameWithoutExtension(executingFile)}.exe";
}
}
} | mit | C# |
5cd1cf75198b70a79419f3b168022539d2be36e6 | Update dimensionless measurement | Blue0500/JoshuaKearney.Measurements | src/JoshuaKearney.Measurements/Measurements/DimensionlessMeasurement.cs | src/JoshuaKearney.Measurements/Measurements/DimensionlessMeasurement.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JoshuaKearney.Measurements {
public abstract class DimensionlessMeasurement<T> : Measurement<T> where T : DimensionlessMeasurement<T> {
public double ToDouble() => this.ToDouble(this.MeasurementProvider.DefaultUnit);
protected static Unit<T> DefaultUnit { get; } = new Unit<T>("", "", 1);
public Frequency Divide(Time measurement2) {
return new Frequency(this, measurement2);
}
public static implicit operator double(DimensionlessMeasurement<T> measurement) {
return measurement?.ToDouble() ?? double.NaN;
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JoshuaKearney.Measurements {
public abstract class DimensionlessMeasurement<T> : Measurement<T> where T : Measurement<T> {
public double ToDouble() => this.ToDouble(this.MeasurementProvider.DefaultUnit);
public Frequency Divide(Time measurement2) {
return new Frequency(this, measurement2);
}
public static implicit operator double(DimensionlessMeasurement<T> measurement) {
return measurement?.ToDouble() ?? 0;
}
private static class Units {
public static Unit<DoubleMeasurement> DefaultUnit { get; } = new Unit<DoubleMeasurement>("", "", 1);
}
}
} | mit | C# |
6239a79c99754d1772491036bfa3c9a7dd00fe6a | Add LayoutKind | shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,weltkante/roslyn,bartdesmet/roslyn,diryboy/roslyn,diryboy/roslyn,bartdesmet/roslyn,sharwell/roslyn,dotnet/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,sharwell/roslyn,KevinRansom/roslyn,weltkante/roslyn | src/VisualStudio/CSharp/Impl/ProjectSystemShim/HACK_VariantStructure.cs | src/VisualStudio/CSharp/Impl/ProjectSystemShim/HACK_VariantStructure.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
{
/// <summary>
/// This is a terrible, terrible hack around the C# project system in
/// CCscMSBuildHostObject::SetDelaySign. To indicate a value of "unset"
/// for boolean options, they create variant of type VT_BOOL with the boolean
/// field being a value of "4". The CLR, if it marshals this variant, marshals
/// it as a "true" which is indistinguishable from a real VARIANT_TRUE. So
/// instead we define this structure of the same layout, and marshal the variant
/// as this structure. We can then pick out this broken pattern, and convert
/// it to null instead of true.
/// </summary>
[StructLayout(LayoutKind.Auto)]
internal struct HACK_VariantStructure
{
private readonly short _type;
private readonly short _padding1;
private readonly short _padding2;
private readonly short _padding3;
private readonly short _booleanValue;
private readonly IntPtr _padding4; // this will be aligned to the IntPtr-sized address
public unsafe object ConvertToObject()
{
if (_type == (short)VarEnum.VT_BOOL && _booleanValue == 4)
{
return null;
}
// Can't take an address of this since it might move, so....
var localCopy = this;
return Marshal.GetObjectForNativeVariant((IntPtr)(&localCopy));
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
{
/// <summary>
/// This is a terrible, terrible hack around the C# project system in
/// CCscMSBuildHostObject::SetDelaySign. To indicate a value of "unset"
/// for boolean options, they create variant of type VT_BOOL with the boolean
/// field being a value of "4". The CLR, if it marshals this variant, marshals
/// it as a "true" which is indistinguishable from a real VARIANT_TRUE. So
/// instead we define this structure of the same layout, and marshal the variant
/// as this structure. We can then pick out this broken pattern, and convert
/// it to null instead of true.
/// </summary>
[StructLayout]
internal struct HACK_VariantStructure
{
private readonly short _type;
private readonly short _padding1;
private readonly short _padding2;
private readonly short _padding3;
private readonly short _booleanValue;
private readonly IntPtr _padding4; // this will be aligned to the IntPtr-sized address
public unsafe object ConvertToObject()
{
if (_type == (short)VarEnum.VT_BOOL && _booleanValue == 4)
{
return null;
}
// Can't take an address of this since it might move, so....
var localCopy = this;
return Marshal.GetObjectForNativeVariant((IntPtr)(&localCopy));
}
}
}
| mit | C# |
abfa0dc0cc3f8dc283f92c4f4737b99663a9b262 | Fix bug parsing args for rules. | BrettJaner/csla,jonnybee/csla,jonnybee/csla,ronnymgm/csla-light,MarimerLLC/csla,rockfordlhotka/csla,BrettJaner/csla,MarimerLLC/csla,jonnybee/csla,ronnymgm/csla-light,MarimerLLC/csla,ronnymgm/csla-light,JasonBock/csla,rockfordlhotka/csla,JasonBock/csla,rockfordlhotka/csla,BrettJaner/csla,JasonBock/csla | cslacs/Csla/Validation/RuleDescription.cs | cslacs/Csla/Validation/RuleDescription.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace Csla.Validation
{
/// <summary>
/// Parses a rule:// URI to provide
/// easy access to the parts of the URI.
/// </summary>
public class RuleDescription
{
private string _scheme;
private string _methodName;
private string _propertyName;
private Dictionary<string, string> _arguments;
/// <summary>
/// Creates an instance of the object
/// by parsing the provided rule:// URI.
/// </summary>
/// <param name="ruleString">The rule:// URI.</param>
public RuleDescription(string ruleString)
{
Uri uri = new Uri(ruleString);
_scheme = uri.GetLeftPart(UriPartial.Scheme);
_methodName = uri.Host;
_propertyName = uri.LocalPath.Substring(1);
string args = uri.Query;
if (!(string.IsNullOrEmpty(args)))
{
if (args.StartsWith("?"))
{
args = args.Remove(0, 1);
}
_arguments = new Dictionary<string, string>();
string[] argArray = args.Split('&');
foreach (string arg in argArray)
{
string[] argParams = arg.Split('=');
_arguments.Add(
System.Uri.UnescapeDataString(argParams[0]),
System.Uri.UnescapeDataString(argParams[1]));
}
}
}
/// <summary>
/// Parses a rule:// URI.
/// </summary>
/// <param name="ruleString">
/// Text representation of a rule:// URI.</param>
/// <returns>A populated RuleDescription object.</returns>
public static RuleDescription Parse(string ruleString)
{
return new RuleDescription(ruleString);
}
/// <summary>
/// Gets the scheme of the URI
/// (should always be rule://).
/// </summary>
public string Scheme
{
get { return _scheme; }
}
/// <summary>
/// Gets the name of the rule method.
/// </summary>
public string MethodName
{
get { return _methodName; }
}
/// <summary>
/// Gets the name of the property with which
/// the rule is associated.
/// </summary>
public string PropertyName
{
get { return _propertyName; }
}
/// <summary>
/// Gets a Dictionary containing the
/// name/value arguments provided to
/// the rule method.
/// </summary>
public Dictionary<string, string> Arguments
{
get { return _arguments; }
}
}
} | using System;
using System.Collections.Generic;
using System.Text;
namespace Csla.Validation
{
/// <summary>
/// Parses a rule:// URI to provide
/// easy access to the parts of the URI.
/// </summary>
public class RuleDescription
{
private string _scheme;
private string _methodName;
private string _propertyName;
private Dictionary<string, string> _arguments;
/// <summary>
/// Creates an instance of the object
/// by parsing the provided rule:// URI.
/// </summary>
/// <param name="ruleString">The rule:// URI.</param>
public RuleDescription(string ruleString)
{
Uri uri = new Uri(ruleString);
_scheme = uri.GetLeftPart(UriPartial.Scheme);
_methodName = uri.Host;
_propertyName = uri.LocalPath.Substring(1);
string args = uri.Query;
_arguments = new Dictionary<string, string>();
string[] argArray = args.Split('&');
foreach (string arg in argArray)
{
string[] argParams = arg.Split('=');
_arguments.Add(
Uri.UnescapeDataString(argParams[0]),
Uri.UnescapeDataString(argParams[1]));
}
}
/// <summary>
/// Parses a rule:// URI.
/// </summary>
/// <param name="ruleString">
/// Text representation of a rule:// URI.</param>
/// <returns>A populated RuleDescription object.</returns>
public static RuleDescription Parse(string ruleString)
{
return new RuleDescription(ruleString);
}
/// <summary>
/// Gets the scheme of the URI
/// (should always be rule://).
/// </summary>
public string Scheme
{
get { return _scheme; }
}
/// <summary>
/// Gets the name of the rule method.
/// </summary>
public string MethodName
{
get { return _methodName; }
}
/// <summary>
/// Gets the name of the property with which
/// the rule is associated.
/// </summary>
public string PropertyName
{
get { return _propertyName; }
}
/// <summary>
/// Gets a Dictionary containing the
/// name/value arguments provided to
/// the rule method.
/// </summary>
public Dictionary<string, string> Arguments
{
get { return _arguments; }
}
}
} | mit | C# |
e31adfd061779b521639cb17d8b053e454118813 | Add missing unit test | cucumber-ltd/shouty.net | Shouty.Tests/CoordinateTest.cs | Shouty.Tests/CoordinateTest.cs | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shouty;
namespace Shouty.Tests
{
[TestClass]
public class CoordinateTest
{
[TestMethod]
public void ItCalculatesTheDistanceFromItself()
{
Coordinate a = new Coordinate(0, 0);
Assert.AreEqual(0, a.DistanceFrom(a));
}
[TestMethod]
public void ItCalculatesTheDistanceFromAnotherCoordinateAlongXAxis()
{
Coordinate a = new Coordinate(0, 0);
Coordinate b = new Coordinate(1000, 0);
Assert.AreEqual(1000, a.DistanceFrom(b));
}
}
}
| using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shouty;
namespace Shouty.Tests
{
[TestClass]
public class CoordinateTest
{
[TestMethod]
public void ItCalculatesTheDistanceFromAnotherCoordinateAlongXAxis()
{
Coordinate a = new Coordinate(0, 0);
Coordinate b = new Coordinate(1000, 0);
Assert.AreEqual(1000, a.DistanceFrom(b));
}
}
}
| mit | C# |
e372516383c3d37d59c1c9e69260777c5ead41c1 | Add delay to A button on main menu | Nigh7Sh4de/shatterfall,Nigh7Sh4de/shatterfall | shatterfall/Assets/Scripts/selector.cs | shatterfall/Assets/Scripts/selector.cs | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class selector : MonoBehaviour {
public static int option;
public List<GameObject> uiChoices;
private float ready = 0;
private float READY_DELAY = 0.2f;
public bool selectable;
public GameObject howToPlay;
public AudioClip selectSound;
private AudioSource source;
private float TOGGLE_THRESHOLD = 0.6f;
// Use this for initialization
void Start () {
source = GetComponent<AudioSource>();
option = 0;
transform.localScale = uiChoices [0].transform.localScale * 9f;
selectable = true;
howToPlay.SetActive (false);
ready = 0;
}
void toggleInstructions() {
if (!howToPlay.activeSelf) {
selectable = false;
howToPlay.SetActive(true);
} else {
howToPlay.SetActive(false);
selectable = true;
}
}
IEnumerator loadMainScene() {
selectable = false;
float fadeTime = GameObject.Find ("Fader").GetComponent<Fading> ().BeginFade (1);
yield return new WaitForSeconds (fadeTime);
Application.LoadLevel ("main");
}
// Update is called once per frame
void Update () {
if (ready > 0)
ready -= Time.deltaTime;
if ((Input.GetKey (KeyCode.UpArrow) || (Input.GetAxis ("MoveVertical") > TOGGLE_THRESHOLD)) && ready <= 0 && selectable) {
source.PlayOneShot (selectSound, 1F);
ready = READY_DELAY;
if (option == 0) {
option = uiChoices.Count - 1;
} else {
option--;
}
}
if ((Input.GetKey(KeyCode.DownArrow) || (Input.GetAxis("MoveVertical") < -TOGGLE_THRESHOLD)) && ready <= 0 && selectable)
{
source.PlayOneShot (selectSound, 1F);
ready = READY_DELAY;
if (option == uiChoices.Count - 1) {
option = 0;
} else {
option++;
}
}
transform.position = uiChoices [option].transform.position + new Vector3 (-uiChoices [option].transform.localScale.x * 0.55f, uiChoices [option].transform.localScale.x * 0.2f, 0);
if ((Input.GetKeyDown (KeyCode.Space) || Input.GetAxis ("Jump") > 0) && ready <= 0) {
ready = READY_DELAY;
if (option < 3 && selectable) {
source.PlayOneShot (selectSound, 1F);
StartCoroutine(loadMainScene());
} else {
source.PlayOneShot (selectSound, 1F);
toggleInstructions ();
}
}
}
} | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class selector : MonoBehaviour {
public static int option;
public List<GameObject> uiChoices;
private float ready = 0;
private float READY_DELAY = 0.2f;
public bool selectable;
public GameObject howToPlay;
public AudioClip selectSound;
private AudioSource source;
private float TOGGLE_THRESHOLD = 0.6f;
// Use this for initialization
void Start () {
source = GetComponent<AudioSource>();
option = 0;
transform.localScale = uiChoices [0].transform.localScale * 9f;
selectable = true;
howToPlay.SetActive (false);
}
void toggleInstructions() {
if (!howToPlay.activeSelf) {
selectable = false;
howToPlay.SetActive(true);
} else {
howToPlay.SetActive(false);
selectable = true;
}
}
IEnumerator loadMainScene() {
selectable = false;
float fadeTime = GameObject.Find ("Fader").GetComponent<Fading> ().BeginFade (1);
yield return new WaitForSeconds (fadeTime);
Application.LoadLevel ("main");
}
// Update is called once per frame
void Update () {
if (ready > 0)
ready -= Time.deltaTime;
if ((Input.GetKey (KeyCode.UpArrow) || (Input.GetAxis ("MoveVertical") > TOGGLE_THRESHOLD)) && ready <= 0 && selectable) {
source.PlayOneShot (selectSound, 1F);
ready = READY_DELAY;
if (option == 0) {
option = uiChoices.Count - 1;
} else {
option--;
}
}
if ((Input.GetKey(KeyCode.DownArrow) || (Input.GetAxis("MoveVertical") < -TOGGLE_THRESHOLD)) && ready <= 0 && selectable)
{
source.PlayOneShot (selectSound, 1F);
ready = READY_DELAY;
if (option == uiChoices.Count - 1) {
option = 0;
} else {
option++;
}
}
transform.position = uiChoices [option].transform.position + new Vector3 (-uiChoices [option].transform.localScale.x * 0.55f, uiChoices [option].transform.localScale.x * 0.2f, 0);
if ((Input.GetKeyDown (KeyCode.Space) || Input.GetAxis ("Jump") > 0)) {
if (option < 3 && selectable) {
source.PlayOneShot (selectSound, 1F);
StartCoroutine(loadMainScene());
} else {
source.PlayOneShot (selectSound, 1F);
toggleInstructions ();
}
}
}
} | mit | C# |
d319ffdf64806ecd2a1823ab3e7bfc1927ace554 | test fix | osoykan/Stove,stoveproject/Stove | test/Stove.NHibernate.Tests/Entities/ProductDapperMap.cs | test/Stove.NHibernate.Tests/Entities/ProductDapperMap.cs | using DapperExtensions.Mapper;
namespace Stove.NHibernate.Tests.Entities
{
public sealed class ProductDapperMap : ClassMapper<Product>
{
public ProductDapperMap()
{
Table("Product");
Map(x => x.Id).Key(KeyType.Identity);
AutoMap();
}
}
}
| using DapperExtensions.Mapper;
namespace Stove.NHibernate.Tests.Entities
{
public sealed class ProductDapperMap : ClassMapper<Product>
{
public ProductDapperMap()
{
Table("Product");
AutoMap();
}
}
}
| mit | C# |
49908164c01d2dac33f0d2b25956de570fc9656a | Fix AssemblyInfo | HangfireIO/Hangfire.Azure.ServiceBusQueue,dersia/Hangfire.Azure.ServiceBusQueue,barclayadam/Hangfire.Azure.ServiceBusQueue | HangFire.Azure.ServiceBusQueue/Properties/AssemblyInfo.cs | HangFire.Azure.ServiceBusQueue/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("HangFire.Azure.ServiceBusQueue")]
[assembly: AssemblyDescription("ServiceBus Queue support for SQL Server job storage implementation")]
[assembly: AssemblyProduct("HangFire")]
[assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")]
[assembly: ComVisible(false)]
[assembly: Guid("90fafb33-186a-47f9-84d8-fd516496a697")]
[assembly: AssemblyVersion("0.0.1")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[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("HangFire.Azure.ServiceBusQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HangFire.Azure.ServiceBusQueue")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("90fafb33-186a-47f9-84d8-fd516496a697")]
// 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# |
707d404085e5ed2cd259b21e7fb09c41942b6fdf | Update ProtectCellsWorksheet.cs | asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET | Examples/CSharp/Worksheets/Security/ProtectCellsWorksheet.cs | Examples/CSharp/Worksheets/Security/ProtectCellsWorksheet.cs | using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Worksheets.Security
{
public class ProtectCellsWorksheet
{
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 directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Create a new workbook.
Workbook wb = new Workbook();
// Create a worksheet object and obtain the first sheet.
Worksheet sheet = wb.Worksheets[0];
// Define the style object.
Style style;
//Define the styleflag object
StyleFlag styleflag;
// Loop through all the columns in the worksheet and unlock them.
for (int i = 0; i <= 255; i++)
{
style = sheet.Cells.Columns[(byte)i].Style;
style.IsLocked = false;
styleflag = new StyleFlag();
styleflag.Locked = true;
sheet.Cells.Columns[(byte)i].ApplyStyle(style, styleflag);
}
// Lock the three cells...i.e. A1, B1, C1.
style = sheet.Cells["A1"].GetStyle();
style.IsLocked = true;
sheet.Cells["A1"].SetStyle(style);
style = sheet.Cells["B1"].GetStyle();
style.IsLocked = true;
sheet.Cells["B1"].SetStyle(style);
style = sheet.Cells["C1"].GetStyle();
style.IsLocked = true;
sheet.Cells["C1"].SetStyle(style);
// Finally, Protect the sheet now.
sheet.Protect(ProtectionType.All);
// Save the excel file.
wb.Save(dataDir + "output.out.xls", SaveFormat.Excel97To2003);
//ExEnd:1
}
}
}
| using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Worksheets.Security
{
public class ProtectCellsWorksheet
{
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 directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Create a new workbook.
Workbook wb = new Workbook();
// Create a worksheet object and obtain the first sheet.
Worksheet sheet = wb.Worksheets[0];
// Define the style object.
Style style;
//Define the styleflag object
StyleFlag styleflag;
// Loop through all the columns in the worksheet and unlock them.
for (int i = 0; i <= 255; i++)
{
style = sheet.Cells.Columns[(byte)i].Style;
style.IsLocked = false;
styleflag = new StyleFlag();
styleflag.Locked = true;
sheet.Cells.Columns[(byte)i].ApplyStyle(style, styleflag);
}
// Lock the three cells...i.e. A1, B1, C1.
style = sheet.Cells["A1"].GetStyle();
style.IsLocked = true;
sheet.Cells["A1"].SetStyle(style);
style = sheet.Cells["B1"].GetStyle();
style.IsLocked = true;
sheet.Cells["B1"].SetStyle(style);
style = sheet.Cells["C1"].GetStyle();
style.IsLocked = true;
sheet.Cells["C1"].SetStyle(style);
// Finally, Protect the sheet now.
sheet.Protect(ProtectionType.All);
// Save the excel file.
wb.Save(dataDir + "output.out.xls", SaveFormat.Excel97To2003);
}
}
} | mit | C# |
584241baa9e08a3b6143b713525e2fabb6edfcea | Convert Subject<Unit> extension to IObserver<Unit> extension. | inconspicuous-creations/Inconspicuous.Framework,inconspicuous-creations/Inconspicuous.Framework | Inconspicuous.Framework/Providers/Utility/UniRxExtensions.cs | Inconspicuous.Framework/Providers/Utility/UniRxExtensions.cs | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using UniRx;
namespace Inconspicuous.Framework {
public static class UniRxExtensions {
public static IObservable<T> Dump<T>(this IObservable<T> observable) {
return observable
.Do(x => UnityEngine.Debug.Log(x.ToString()))
.Finally(() => UnityEngine.Debug.Log("Completed"));
}
public static IObservable<string> AsObservable(this INotifyPropertyChanged notifyPropertyChanged) {
return Observable.FromEvent<PropertyChangedEventHandler, string>(
x => new PropertyChangedEventHandler((_, args) => x(args.PropertyName)),
x => notifyPropertyChanged.PropertyChanged += x,
x => notifyPropertyChanged.PropertyChanged -= x);
}
public static IObservable<Unit> AsObservable(this INotifyPropertyChanged notifyPropertyChanged, string name) {
return Observable.FromEvent(
x => new PropertyChangedEventHandler((_, args) => { if(name == args.PropertyName) { x(); } }),
x => notifyPropertyChanged.PropertyChanged += x,
x => notifyPropertyChanged.PropertyChanged -= x);
}
public static IObservable<T> AsObservable<T>(this INotifyPropertyChanged notifyPropertyChanged, string name, Func<T> selector) {
return Observable.FromEvent(
x => new PropertyChangedEventHandler((_, args) => { if(name == args.PropertyName) { x(); } }),
x => notifyPropertyChanged.PropertyChanged += x,
x => notifyPropertyChanged.PropertyChanged -= x)
.Select(_ => selector());
}
public static IObservable<NotifyCollectionChangedEventArgs> CollectionAsObservable(this INotifyCollectionChanged notifyCollectionChanged) {
return Observable.FromEvent<NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>(
x => new NotifyCollectionChangedEventHandler((_, y) => x(y)),
x => notifyCollectionChanged.CollectionChanged += x,
x => notifyCollectionChanged.CollectionChanged -= x);
}
public static T AddTo<T>(this T disposable, CompositeDisposable compositeDisposable) where T : IDisposable {
compositeDisposable.Add(disposable);
return disposable;
}
public static void OnNext(this IObserver<Unit> subject) {
subject.OnNext(Unit.Default);
}
public static CompositeDisposable TryGetOrClearFromMap<T>(this Dictionary<T, CompositeDisposable> disposables, T key) {
var disposable = default(CompositeDisposable);
disposables.TryGetValue(key, out disposable);
if(disposable != null) {
disposable.Clear();
} else {
disposable = new CompositeDisposable();
disposables[key] = disposable;
}
return disposable;
}
}
}
| using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using UniRx;
namespace Inconspicuous.Framework {
public static class UniRxExtensions {
public static IObservable<T> Dump<T>(this IObservable<T> observable) {
return observable
.Do(x => UnityEngine.Debug.Log(x.ToString()))
.Finally(() => UnityEngine.Debug.Log("Completed"));
}
public static IObservable<string> AsObservable(this INotifyPropertyChanged notifyPropertyChanged) {
return Observable.FromEvent<PropertyChangedEventHandler, string>(
x => new PropertyChangedEventHandler((_, args) => x(args.PropertyName)),
x => notifyPropertyChanged.PropertyChanged += x,
x => notifyPropertyChanged.PropertyChanged -= x);
}
public static IObservable<Unit> AsObservable(this INotifyPropertyChanged notifyPropertyChanged, string name) {
return Observable.FromEvent(
x => new PropertyChangedEventHandler((_, args) => { if(name == args.PropertyName) { x(); } }),
x => notifyPropertyChanged.PropertyChanged += x,
x => notifyPropertyChanged.PropertyChanged -= x);
}
public static IObservable<T> AsObservable<T>(this INotifyPropertyChanged notifyPropertyChanged, string name, Func<T> selector) {
return Observable.FromEvent(
x => new PropertyChangedEventHandler((_, args) => { if(name == args.PropertyName) { x(); } }),
x => notifyPropertyChanged.PropertyChanged += x,
x => notifyPropertyChanged.PropertyChanged -= x)
.Select(_ => selector());
}
public static IObservable<NotifyCollectionChangedEventArgs> CollectionAsObservable(this INotifyCollectionChanged notifyCollectionChanged) {
return Observable.FromEvent<NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>(
x => new NotifyCollectionChangedEventHandler((_, y) => x(y)),
x => notifyCollectionChanged.CollectionChanged += x,
x => notifyCollectionChanged.CollectionChanged -= x);
}
public static T AddTo<T>(this T disposable, CompositeDisposable compositeDisposable) where T : IDisposable {
compositeDisposable.Add(disposable);
return disposable;
}
public static void OnNext(this Subject<Unit> subject) {
subject.OnNext(Unit.Default);
}
public static CompositeDisposable TryGetOrClearFromMap<T>(this Dictionary<T, CompositeDisposable> disposables, T key) {
var disposable = default(CompositeDisposable);
disposables.TryGetValue(key, out disposable);
if(disposable != null) {
disposable.Clear();
} else {
disposable = new CompositeDisposable();
disposables[key] = disposable;
}
return disposable;
}
}
}
| mit | C# |
c5ce38d651b3b3cf859537b7bdd5aeb7d34859b4 | Use String.IsNullOrEmpty | tmds/Tmds.DBus | Address.cs | Address.cs | // Copyright 2006 Alp Toker <[email protected]>
// This software is made available under the MIT License
// See COPYING for details
using System;
namespace NDesk.DBus
{
public class Address
{
//this method is not pretty
//not worth improving until there is a spec for this format
//TODO: confirm that return value represents parse errors
public static bool Parse (string addr, out string path, out bool abstr)
{
//(unix:(path|abstract)=.*,guid=.*|tcp:host=.*(,port=.*)?);? ...
path = null;
abstr = false;
if (String.IsNullOrEmpty (addr))
return false;
string[] parts;
parts = addr.Split (':');
if (parts[0] == "unix") {
parts = parts[1].Split (',');
parts = parts[0].Split ('=');
if (parts[0] == "path")
abstr = false;
else if (parts[0] == "abstract")
abstr = true;
else
return false;
path = parts[1];
} else {
return false;
}
return true;
}
}
}
| // Copyright 2006 Alp Toker <[email protected]>
// This software is made available under the MIT License
// See COPYING for details
using System;
namespace NDesk.DBus
{
public class Address
{
//this method is not pretty
//not worth improving until there is a spec for this format
//TODO: confirm that return value represents parse errors
public static bool Parse (string addr, out string path, out bool abstr)
{
//(unix:(path|abstract)=.*,guid=.*|tcp:host=.*(,port=.*)?);? ...
path = null;
abstr = false;
if (addr == null || addr == "")
return false;
string[] parts;
parts = addr.Split (':');
if (parts[0] == "unix") {
parts = parts[1].Split (',');
parts = parts[0].Split ('=');
if (parts[0] == "path")
abstr = false;
else if (parts[0] == "abstract")
abstr = true;
else
return false;
path = parts[1];
} else {
return false;
}
return true;
}
}
}
| mit | C# |
1cf77e452397415ce1a3e736b559fcea45f2bada | Update DirectInputPadPlugin.Build.cs | katze7514/UEDirectInputPadPlugin,katze7514/UEDirectInputPadPlugin | Source/DirectInputPadPlugin/DirectInputPadPlugin.Build.cs | Source/DirectInputPadPlugin/DirectInputPadPlugin.Build.cs | // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
namespace UnrealBuildTool.Rules
{
public class DirectInputPadPlugin : ModuleRules
{
public DirectInputPadPlugin(ReadOnlyTargetRules Target):base(Target)
{
PublicIncludePaths.AddRange(
new string[] {
// "DirectInputPadPlugin/Public",
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// "DirectInputPadPlugin/Private",
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"ApplicationCore",
"Engine",
"InputDevice",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Slate",
"SlateCore",
"InputCore",
// ... add private dependencies that you statically link with here ...
}
);
if (Target.bBuildEditor)
{
PrivateDependencyModuleNames.AddRange(new string[]{ "MainFrame", });
}
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
}
| // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
namespace UnrealBuildTool.Rules
{
public class DirectInputPadPlugin : ModuleRules
{
public DirectInputPadPlugin(ReadOnlyTargetRules Target):base(Target)
{
PublicIncludePaths.AddRange(
new string[] {
"DirectInputPadPlugin/Public",
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
"DirectInputPadPlugin/Private",
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"ApplicationCore",
"Engine",
"InputDevice",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Slate",
"SlateCore",
"InputCore",
// ... add private dependencies that you statically link with here ...
}
);
if (Target.bBuildEditor)
{
PrivateDependencyModuleNames.AddRange(new string[]{ "MainFrame", });
}
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
}
| mit | C# |
38727451100c4fce35052a47d8354c1cbb37902c | Update ICorrelationService.cs | tiksn/TIKSN-Framework | TIKSN.Core/Integration/Correlation/ICorrelationService.cs | TIKSN.Core/Integration/Correlation/ICorrelationService.cs | namespace TIKSN.Integration.Correlation
{
/// <summary>
/// Service for generating and parsing <see cref="CorrelationID" />.
/// </summary>
public interface ICorrelationService
{
/// <summary>
/// Creates <see cref="CorrelationID" /> from string representation.
/// </summary>
/// <param name="stringRepresentation"></param>
/// <returns></returns>
CorrelationID Create(string stringRepresentation);
/// <summary>
/// Creates <see cref="CorrelationID" /> from binary representation.
/// </summary>
/// <param name="byteArrayRepresentation"></param>
/// <returns></returns>
CorrelationID Create(byte[] byteArrayRepresentation);
/// <summary>
/// Generates new <see cref="CorrelationID" />
/// </summary>
/// <returns></returns>
CorrelationID Generate();
}
}
| namespace TIKSN.Integration.Correlation
{
/// <summary>
/// Service for generating and parsing <see cref="CorrelationID"/>.
/// </summary>
public interface ICorrelationService
{
/// <summary>
/// Creates <see cref="CorrelationID"/> from string representation.
/// </summary>
/// <param name="stringRepresentation"></param>
/// <returns></returns>
CorrelationID Create(string stringRepresentation);
/// <summary>
/// Creates <see cref="CorrelationID"/> from binary representation.
/// </summary>
/// <param name="byteArrayRepresentation"></param>
/// <returns></returns>
CorrelationID Create(byte[] byteArrayRepresentation);
/// <summary>
/// Generates new <see cref="CorrelationID"/>
/// </summary>
/// <returns></returns>
CorrelationID Generate();
}
} | mit | C# |
30ebe1aa59ed71d076c712982c817555dfa48d1c | Add missing CAf. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Tor/Http/Extensions/HttpContentExtensions.cs | WalletWasabi/Tor/Http/Extensions/HttpContentExtensions.cs | using Newtonsoft.Json;
using System.Net.Http;
using System.Threading.Tasks;
using WalletWasabi.JsonConverters;
using WalletWasabi.WebClients.Wasabi;
namespace WalletWasabi.Tor.Http.Extensions
{
public static class HttpContentExtensions
{
public static async Task<T> ReadAsJsonAsync<T>(this HttpContent me)
{
if (me is null)
{
return default;
}
var settings = new JsonSerializerSettings
{
Converters = new[] { new RoundStateResponseJsonConverter(WasabiClient.ApiVersion) }
};
var jsonString = await me.ReadAsStringAsync().ConfigureAwait(false);
return JsonConvert.DeserializeObject<T>(jsonString, settings);
}
}
}
| using Newtonsoft.Json;
using System.Net.Http;
using System.Threading.Tasks;
using WalletWasabi.JsonConverters;
using WalletWasabi.WebClients.Wasabi;
namespace WalletWasabi.Tor.Http.Extensions
{
public static class HttpContentExtensions
{
public static async Task<T> ReadAsJsonAsync<T>(this HttpContent me)
{
if (me is null)
{
return default;
}
var settings = new JsonSerializerSettings
{
Converters = new[] { new RoundStateResponseJsonConverter(WasabiClient.ApiVersion) }
};
var jsonString = await me.ReadAsStringAsync();
return JsonConvert.DeserializeObject<T>(jsonString, settings);
}
}
}
| mit | C# |
2be8a167071ee20fa4105666604c611f408fbf8d | Set version to match NuGet | cshung/clrmd,Microsoft/clrmd,stjeong/clrmd,Microsoft/clrmd,jazzdelightsme/clrmd,tomasr/clrmd,cshung/clrmd,stefangossner/clrmd | src/Microsoft.Diagnostics.Runtime/Properties/AssemblyInfo.cs | src/Microsoft.Diagnostics.Runtime/Properties/AssemblyInfo.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.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("Microsoft.Diagnostics.Runtime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft.Diagnostics.Runtime")]
[assembly: AssemblyCopyright("Copyright \u00A9 Microsoft")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("94432a8e-3e06-4776-b9b2-3684a62bb96a")]
[assembly: AssemblyVersion("0.8.31.0")]
[assembly: AssemblyFileVersion("0.8.31.0")]
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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("Microsoft.Diagnostics.Runtime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft.Diagnostics.Runtime")]
[assembly: AssemblyCopyright("Copyright \u00A9 Microsoft")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("94432a8e-3e06-4776-b9b2-3684a62bb96a")]
[assembly: AssemblyVersion("0.9.3.0")]
[assembly: AssemblyFileVersion("0.9.3.0")]
| mit | C# |
4831fbd77c60a2972a4a8f63e6204f44f8969256 | Use the LanguageServiceCompiler when building the project. | chrisber/typescript-addin,mrward/typescript-addin,chrisber/typescript-addin,mrward/typescript-addin | src/TypeScriptBinding/CompileTypeScriptFilesOnBuildAction.cs | src/TypeScriptBinding/CompileTypeScriptFilesOnBuildAction.cs | //
// CompileTypeScriptFilesOnBuildFileAction.cs
//
// Author:
// Matt Ward <[email protected]>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class CompileTypeScriptFilesOnBuildAction : CompileTypeScriptAction
{
public void CompileFiles(IBuildable buildable)
{
ClearOutputWindow();
foreach (TypeScriptProject project in buildable.GetTypeScriptProjects()) {
if (project.CompileOnBuild) {
CompileFiles(project);
}
}
}
void CompileFiles(TypeScriptProject project)
{
FileName[] fileNames = project.GetTypeScriptFileNames().ToArray();
if (fileNames.Length == 0)
return;
CompileFiles(project, fileNames);
}
void CompileFiles(TypeScriptProject project, FileName[] fileNames)
{
ReportCompileStarting(project);
bool errors = false;
TypeScriptContext context = TypeScriptService.ContextProvider.GetContext(fileNames.First());
var compiler = new LanguageServiceCompiler(context);
foreach (FileName fileName in fileNames) {
LanguageServiceCompilerResult result = compiler.Compile(fileName, project);
UpdateProject(project, result.GetGeneratedFiles());
if (result.HasErrors) {
errors = true;
Report(result.GetError());
}
}
ReportCompileFinished(errors);
}
void ReportCompileStarting(TypeScriptProject project)
{
Report("Compiling TypeScript files for project: {0}", project.Name);
}
void UpdateProject(TypeScriptProject project, IEnumerable<GeneratedTypeScriptFile> generatedFiles)
{
using (var updater = new ProjectBrowserUpdater()) {
project.AddMissingFiles(generatedFiles);
}
}
}
}
| //
// CompileTypeScriptFilesOnBuildFileAction.cs
//
// Author:
// Matt Ward <[email protected]>
//
// Copyright (C) 2013 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.TypeScriptBinding.Hosting;
namespace ICSharpCode.TypeScriptBinding
{
public class CompileTypeScriptFilesOnBuildAction : CompileTypeScriptAction
{
public void CompileFiles(IBuildable buildable)
{
ClearOutputWindow();
foreach (TypeScriptProject project in buildable.GetTypeScriptProjects()) {
if (project.CompileOnBuild) {
CompileFiles(project);
}
}
}
void CompileFiles(TypeScriptProject project)
{
FileName[] fileNames = project.GetTypeScriptFileNames().ToArray();
if (fileNames.Length == 0)
return;
CompileFiles(project, fileNames);
}
void CompileFiles(TypeScriptProject project, FileName[] fileNames)
{
ReportCompileStarting(project);
var compiler = new TypeScriptCompiler(project);
compiler.AddFiles(fileNames);
Report(compiler.GetCommandLine());
TypeScriptCompilerResult result = compiler.Compile();
UpdateProject(project, result.GeneratedFiles);
ReportCompileFinished(result.HasErrors);
}
void ReportCompileStarting(TypeScriptProject project)
{
Report("Compiling TypeScript files for project: {0}", project.Name);
}
void UpdateProject(TypeScriptProject project, IEnumerable<GeneratedTypeScriptFile> generatedFiles)
{
using (var updater = new ProjectBrowserUpdater()) {
project.AddMissingFiles(generatedFiles);
}
}
}
}
| mit | C# |
7045eb196ca51bded0bd2ebef995714901f0e578 | Use InvariantContains instead of Contains when looking for culture in the querystring | tcmorris/Umbraco-CMS,madsoulswe/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,abryukhov/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abjerner/Umbraco-CMS,NikRimington/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,NikRimington/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,NikRimington/Umbraco-CMS,marcemarc/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,madsoulswe/Umbraco-CMS,leekelleher/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,rasmuseeg/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,bjarnef/Umbraco-CMS,hfloyd/Umbraco-CMS,abjerner/Umbraco-CMS,rasmuseeg/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS | src/Umbraco.Web/WebApi/Filters/HttpQueryStringModelBinder.cs | src/Umbraco.Web/WebApi/Filters/HttpQueryStringModelBinder.cs | using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Formatting;
using System.Web.Http.Controllers;
using System.Web.Http.ModelBinding;
using Umbraco.Core;
namespace Umbraco.Web.WebApi.Filters
{
/// <summary>
/// Allows an Action to execute with an arbitrary number of QueryStrings
/// </summary>
/// <remarks>
/// Just like you can POST an arbitrary number of parameters to an Action, you can't GET an arbitrary number
/// but this will allow you to do it
/// </remarks>
public sealed class HttpQueryStringModelBinder : IModelBinder
{
public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)
{
//get the query strings from the request properties
if (actionContext.Request.Properties.ContainsKey("MS_QueryNameValuePairs"))
{
if (actionContext.Request.Properties["MS_QueryNameValuePairs"] is IEnumerable<KeyValuePair<string, string>> queryStrings)
{
var queryStringKeys = queryStrings.Select(kvp => kvp.Key).ToArray();
var additionalParameters = new Dictionary<string, string>();
if(queryStringKeys.InvariantContains("culture") == false) {
additionalParameters["culture"] = actionContext.Request.ClientCulture();
}
var formData = new FormDataCollection(queryStrings.Union(additionalParameters));
bindingContext.Model = formData;
return true;
}
}
return false;
}
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Formatting;
using System.Web.Http.Controllers;
using System.Web.Http.ModelBinding;
namespace Umbraco.Web.WebApi.Filters
{
/// <summary>
/// Allows an Action to execute with an arbitrary number of QueryStrings
/// </summary>
/// <remarks>
/// Just like you can POST an arbitrary number of parameters to an Action, you can't GET an arbitrary number
/// but this will allow you to do it
/// </remarks>
public sealed class HttpQueryStringModelBinder : IModelBinder
{
public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)
{
//get the query strings from the request properties
if (actionContext.Request.Properties.ContainsKey("MS_QueryNameValuePairs"))
{
if (actionContext.Request.Properties["MS_QueryNameValuePairs"] is IEnumerable<KeyValuePair<string, string>> queryStrings)
{
var queryStringKeys = queryStrings.Select(kvp => kvp.Key).ToArray();
var additionalParameters = new Dictionary<string, string>();
if(queryStringKeys.Contains("culture") == false) {
additionalParameters["culture"] = actionContext.Request.ClientCulture();
}
var formData = new FormDataCollection(queryStrings.Union(additionalParameters));
bindingContext.Model = formData;
return true;
}
}
return false;
}
}
}
| mit | C# |
a984ea77a8c58df6aa703b5c615e451eac9f20b5 | Switch over target on which server is open for | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | test/TestServer/Program.cs | test/TestServer/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace TestServer
{
class Program
{
static void Main(string[] args)
{
RunEchoServer().Wait();
}
private static async Task RunEchoServer()
{
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://localhost:12345/");
listener.Start();
Console.WriteLine("Started");
while (true)
{
HttpListenerContext context = listener.GetContext();
if (!context.Request.IsWebSocketRequest)
{
context.Response.Close();
continue;
}
Console.WriteLine("Accepted");
var wsContext = await context.AcceptWebSocketAsync(null);
var webSocket = wsContext.WebSocket;
byte[] buffer = new byte[1024];
WebSocketReceiveResult received = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
while (received.MessageType != WebSocketMessageType.Close)
{
// Console.WriteLine("Echo, " + received.Count + ", " + received.MessageType + ", " + received.EndOfMessage);
// Echo anything we receive
await webSocket.SendAsync(new ArraySegment<byte>(buffer, 0, received.Count), received.MessageType, received.EndOfMessage, CancellationToken.None);
received = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
}
await webSocket.CloseAsync(received.CloseStatus.Value, received.CloseStatusDescription, CancellationToken.None);
webSocket.Dispose();
Console.WriteLine("Finished");
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace TestServer
{
class Program
{
static void Main(string[] args)
{
RunEchoServer().Wait();
}
private static async Task RunEchoServer()
{
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://*:12345/");
listener.Start();
Console.WriteLine("Started");
while (true)
{
HttpListenerContext context = listener.GetContext();
if (!context.Request.IsWebSocketRequest)
{
context.Response.Close();
continue;
}
Console.WriteLine("Accepted");
var wsContext = await context.AcceptWebSocketAsync(null);
var webSocket = wsContext.WebSocket;
byte[] buffer = new byte[1024];
WebSocketReceiveResult received = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
while (received.MessageType != WebSocketMessageType.Close)
{
// Console.WriteLine("Echo, " + received.Count + ", " + received.MessageType + ", " + received.EndOfMessage);
// Echo anything we receive
await webSocket.SendAsync(new ArraySegment<byte>(buffer, 0, received.Count), received.MessageType, received.EndOfMessage, CancellationToken.None);
received = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
}
await webSocket.CloseAsync(received.CloseStatus.Value, received.CloseStatusDescription, CancellationToken.None);
webSocket.Dispose();
Console.WriteLine("Finished");
}
}
}
}
| apache-2.0 | C# |
4bebadd259d81ef315a08020b1abb0e231b71b3f | Update template | haivp3010/ludo-js-project | sources/Assets/Scripts/HorseControl.cs | sources/Assets/Scripts/HorseControl.cs | //using UnityEngine;
//using System.Collections;
//public class HorseControl : MonoBehaviour
//{
// public Animator anim;
// private GameObject clicked;
// public float speed;
// public static Dice dice1 = new Dice();
// private int i = 0;
// private int iClick = dice1.Number;
// public int horseNumber; // 0 - 15
// private int position;
// private HorseColor color;
// void Start()
// {
// anim = gameObject.GetComponent<Animator>();
// color = GameLogic.GetHorseColor(horseNumber);
// position = PositionControl.GetStartPosition(color);
// }
// void Update()
// {
// var step = speed * Time.deltaTime;
// if (clicked != null)
// {
// anim.enabled = true;
// int nextPosition = PositionControl.GetNextPosition(color, position);
// if (nextPosition == -1)
// StopMoving();
// else
// {
// clicked.transform.position = Vector3.MoveTowards(clicked.transform.position, PositionControl.GetRealPosition(nextPosition), step);
// if (clicked.transform.position == PositionControl.GetRealPosition(nextPosition))
// {
// i++;
// position = nextPosition;
// if (i >= iClick)
// StopMoving();
// }
// }
// }
// }
// private void StopMoving()
// {
// clicked = null;
// anim.enabled = false;
// }
// private void OnMouseDown()
// {
// if (clicked == null)
// {
// clicked = gameObject;
// i = 0;
// }
// }
// private void OnMouseEnter()
// {
// anim.enabled = true;
// Debug.Log("MouseEnter");
// }
// private void OnMouseExit()
// {
// anim.enabled = false;
// Debug.Log("MouseExit");
// }
//}
| using UnityEngine;
using System.Collections;
public class HorseControl : MonoBehaviour
{
public Animator anim;
private GameObject clicked;
public float speed;
public static Dice dice1 = new Dice();
private int i = 0;
private int iClick = dice1.Number;
public int horseNumber; // 0 - 15
private int position;
private HorseColor color;
void Start()
{
anim = gameObject.GetComponent<Animator>();
color = GameLogic.GetHorseColor(horseNumber);
position = PositionControl.GetStartPosition(color);
}
void Update()
{
var step = speed * Time.deltaTime;
if (clicked != null)
{
anim.enabled = true;
int nextPosition = PositionControl.GetNextPosition(color, position);
if (nextPosition == -1)
StopMoving();
else
{
clicked.transform.position = Vector3.MoveTowards(clicked.transform.position, PositionControl.GetRealPosition(nextPosition), step);
if (clicked.transform.position == PositionControl.GetRealPosition(nextPosition))
{
i++;
position = nextPosition;
if (i >= iClick)
StopMoving();
}
}
}
}
private void StopMoving()
{
clicked = null;
anim.enabled = false;
}
private void OnMouseDown()
{
if (clicked == null)
{
clicked = gameObject;
i = 0;
}
}
private void OnMouseEnter()
{
anim.enabled = true;
Debug.Log("MouseEnter");
}
private void OnMouseExit()
{
anim.enabled = false;
Debug.Log("MouseExit");
}
}
| mit | C# |
e9a4b0f73d874ee3f62b3d8a79b6f930e1743624 | add getIsOn() | yasokada/unity-150905-dynamicDisplay | Assets/PanelDisplayControl.cs | Assets/PanelDisplayControl.cs | using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class PanelDisplayControl : MonoBehaviour {
public GameObject PageSelect;
bool getIsOn(int idx_st1) {
Toggle selected = null;
string name;
foreach (Transform child in PageSelect.transform) {
name = child.gameObject.name;
if (name.Contains(idx_st1.ToString())) { // e.g. "SelP1", "SelP2"...
selected = child.gameObject.GetComponent(typeof(Toggle)) as Toggle;
break;
}
}
return selected.isOn;
}
public void ToggleValueChanged(int idx_st1) {
bool isOn = getIsOn (idx_st1);
Debug.Log (isOn.ToString ());
}
}
| using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class PanelDisplayControl : MonoBehaviour {
public GameObject PageSelect;
public void ToggleValueChanged(int idx_st1) {
Toggle selected = null;
string name;
foreach (Transform child in PageSelect.transform) {
name = child.gameObject.name;
if (name.Contains(idx_st1.ToString())) { // e.g. "SelP1", "SelP2"...
selected = child.gameObject.GetComponent(typeof(Toggle)) as Toggle;
break;
}
}
Debug.Log(idx_st1.ToString() + " is " + selected.isOn);
}
}
| mit | C# |
621555f1c68d334f42881bf796947b89725c53f2 | Use default(TField) | nikeee/HolzShots | src/HolzShots.Common/ReflectionUtil.cs | src/HolzShots.Common/ReflectionUtil.cs | using System;
using System.Reflection;
namespace HolzShots.Common
{
static class ReflectionUtil
{
/// <summary>
/// Uses reflection to get the field value from an object.
/// </summary>
/// <param name="instance">The instance object.</param>
/// <param name="fieldName">The field's name which is to be fetched.</param>
/// <returns>The field value from the object.</returns>
internal static TField GetInstanceField<TU, TField>(TU instance, string fieldName)
where TU : class
{
if (instance == null)
throw new ArgumentNullException(nameof(instance));
const BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.NonPublic;
var field = typeof(TU).GetField(fieldName, bindFlags);
return field == null
? default(TField)
: (TField)field.GetValue(instance);
}
internal static void SetInstanceField<TU, TField>(TU instance, string fieldName, TField value)
where TU : class
{
if (instance == null)
throw new ArgumentNullException(nameof(instance));
const BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.NonPublic;
var field = typeof(TU).GetField(fieldName, bindFlags);
return field == null
? throw new ArgumentException()
: field.SetValue(instance, value);
}
}
}
| using System;
using System.Reflection;
namespace HolzShots.Common
{
static class ReflectionUtil
{
/// <summary>
/// Uses reflection to get the field value from an object.
/// </summary>
/// <param name="instance">The instance object.</param>
/// <param name="fieldName">The field's name which is to be fetched.</param>
/// <returns>The field value from the object.</returns>
internal static TField GetInstanceField<TU, TField>(TU instance, string fieldName)
where TU : class
{
if (instance == null)
throw new ArgumentNullException(nameof(instance));
const BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.NonPublic;
var field = typeof(TU).GetField(fieldName, bindFlags);
return field == null
? default
: (TField)field.GetValue(instance);
}
internal static void SetInstanceField<TU, TField>(TU instance, string fieldName, TField value)
where TU : class
{
if (instance == null)
throw new ArgumentNullException(nameof(instance));
const BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.NonPublic;
var field = typeof(TU).GetField(fieldName, bindFlags);
return field == null
? throw new ArgumentException()
: field.SetValue(instance, value);
}
}
}
| agpl-3.0 | C# |
e5f5c95c6588cd5b810003721d59a244d5712f2f | change AssemblyVersion | martinusso/Ini.Net | src/Ini.Net/Properties/AssemblyInfo.cs | src/Ini.Net/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Ini.Net")]
[assembly: AssemblyDescription("A simple .NET library for managing INI files")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ini.Net")]
[assembly: AssemblyCopyright("Copyright © Breno Martinusso 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("0481f08c-f9fd-4f26-b62c-fc07de64a327")]
[assembly: AssemblyVersion("1.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("Ini.Net")]
[assembly: AssemblyDescription("A simple .NET library for managing INI files")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ini.Net")]
[assembly: AssemblyCopyright("Copyright © Breno Martinusso 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("0481f08c-f9fd-4f26-b62c-fc07de64a327")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1")]
[assembly: AssemblyFileVersion("0.1")]
| mit | C# |
743705578fcba60d0926ed73ba2af96e251f49e4 | modify unit test | ouraspnet/cap,dotnetcore/CAP,dotnetcore/CAP,dotnetcore/CAP | test/DotNetCore.CAP.Test/ConsumerInvokerFactoryTest.cs | test/DotNetCore.CAP.Test/ConsumerInvokerFactoryTest.cs | using System;
using System.Linq;
using System.Reflection;
using DotNetCore.CAP.Abstractions;
using DotNetCore.CAP.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Xunit;
namespace DotNetCore.CAP.Test
{
public class ConsumerInvokerFactoryTest
{
private IConsumerInvokerFactory consumerInvokerFactory;
public ConsumerInvokerFactoryTest()
{
var services = new ServiceCollection();
services.AddLogging();
services.AddSingleton<IContentSerializer, JsonContentSerializer>();
var provider = services.BuildServiceProvider();
var logFactory = provider.GetRequiredService<ILoggerFactory>();
var binder = new ModelBinderFactory();
consumerInvokerFactory = new ConsumerInvokerFactory(logFactory, binder, provider);
}
[Fact]
public void CreateInvokerTest()
{
var methodInfo = typeof(Sample).GetRuntimeMethods()
.Single(x => x.Name == nameof(Sample.ThrowException));
var description = new ConsumerExecutorDescriptor
{
MethodInfo = methodInfo,
ImplTypeInfo = typeof(Sample).GetTypeInfo()
};
var messageContext = new MessageContext();
var context = new ConsumerContext(description, messageContext);
var invoker = consumerInvokerFactory.CreateInvoker(context);
Assert.NotNull(invoker);
}
[Theory]
[InlineData(nameof(Sample.ThrowException))]
[InlineData(nameof(Sample.AsyncMethod))]
public async void InvokeMethodTest(string methodName)
{
var methodInfo = typeof(Sample).GetRuntimeMethods()
.Single(x => x.Name == methodName);
var description = new ConsumerExecutorDescriptor
{
MethodInfo = methodInfo,
ImplTypeInfo = typeof(Sample).GetTypeInfo()
};
var messageContext = new MessageContext();
var context = new ConsumerContext(description, messageContext);
var invoker = consumerInvokerFactory.CreateInvoker(context);
await Assert.ThrowsAsync(typeof(Exception), async () =>
{
await invoker.InvokeAsync();
});
}
}
} | using System;
using System.Linq;
using System.Reflection;
using DotNetCore.CAP.Abstractions;
using DotNetCore.CAP.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Xunit;
namespace DotNetCore.CAP.Test
{
public class ConsumerInvokerFactoryTest
{
private IConsumerInvokerFactory consumerInvokerFactory;
public ConsumerInvokerFactoryTest()
{
var services = new ServiceCollection();
services.AddLogging();
var provider = services.BuildServiceProvider();
var logFactory = provider.GetRequiredService<ILoggerFactory>();
var binder = new ModelBinderFactory();
consumerInvokerFactory = new ConsumerInvokerFactory(logFactory, binder, provider);
}
[Fact]
public void CreateInvokerTest()
{
var methodInfo = typeof(Sample).GetRuntimeMethods()
.Single(x => x.Name == nameof(Sample.ThrowException));
var description = new ConsumerExecutorDescriptor
{
MethodInfo = methodInfo,
ImplTypeInfo = typeof(Sample).GetTypeInfo()
};
var messageContext = new MessageContext();
var context = new ConsumerContext(description, messageContext);
var invoker = consumerInvokerFactory.CreateInvoker(context);
Assert.NotNull(invoker);
}
[Theory]
[InlineData(nameof(Sample.ThrowException))]
[InlineData(nameof(Sample.AsyncMethod))]
public async void InvokeMethodTest(string methodName)
{
var methodInfo = typeof(Sample).GetRuntimeMethods()
.Single(x => x.Name == methodName);
var description = new ConsumerExecutorDescriptor
{
MethodInfo = methodInfo,
ImplTypeInfo = typeof(Sample).GetTypeInfo()
};
var messageContext = new MessageContext();
var context = new ConsumerContext(description, messageContext);
var invoker = consumerInvokerFactory.CreateInvoker(context);
await Assert.ThrowsAsync(typeof(Exception), async () =>
{
await invoker.InvokeAsync();
});
}
}
} | mit | C# |
f0333aa826bdc31fd28a78b4b714b44d9340b9f0 | Make slack user immutable | noobot/SlackConnector | src/SlackConnector/Models/SlackUser.cs | src/SlackConnector/Models/SlackUser.cs | namespace SlackConnector.Models
{
public class SlackUser
{
public string Id { get; internal set; }
public string Name { get; internal set; }
public string Email { get; internal set; }
public string FirstName { get; internal set; }
public string LastName { get; internal set; }
public string Image { get; internal set; }
public string WhatIDo { get; internal set; }
public bool Deleted { get; internal set; }
public long TimeZoneOffset { get; internal set; }
public bool? Online { get; internal set; }
public bool IsBot { get; internal set; }
public bool IsGuest { get; internal set; }
public string StatusText { get; internal set; }
public bool IsAdmin { get; internal set; }
public string FormattedUserId
{
get
{
if (!string.IsNullOrEmpty(Id))
{
return "<@" + Id + ">";
}
return string.Empty;
}
}
}
} | namespace SlackConnector.Models
{
public class SlackUser
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Image { get; set; }
public string WhatIDo { get; set; }
public bool Deleted { get; set; }
public long TimeZoneOffset { get; set; }
public bool? Online { get; set; }
public bool IsBot { get; set; }
public bool IsGuest { get; set; }
public string StatusText { get; set; }
public bool IsAdmin { get; set; }
public string FormattedUserId
{
get
{
if (!string.IsNullOrEmpty(Id))
{
return "<@" + Id + ">";
}
return string.Empty;
}
}
}
} | mit | C# |
42877cdd81f3f2dc3f23a3bd17565a4125cc513f | Remove unused usings | extremecodetv/SocksSharp | src/SocksSharp/Proxy/ProxyException.cs | src/SocksSharp/Proxy/ProxyException.cs | using System;
namespace SocksSharp.Proxy
{
/// <summary>
/// Represents errors that occur during proxy execution.
/// </summary>
public class ProxyException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ProxyException"/> with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a <see langword="null"/> reference.</param>
public ProxyException(string message, Exception innerException = null)
: base(message, innerException) { }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SocksSharp.Proxy
{
/// <summary>
/// Represents errors that occur during proxy execution.
/// </summary>
public class ProxyException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ProxyException"/> with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a <see langword="null"/> reference.</param>
public ProxyException(string message, Exception innerException = null)
: base(message, innerException) { }
}
}
| mit | C# |
f63ece73e80f4c18e99ff988897302ea4f584194 | add AllFailingTestsClipboardReporter | modernist/APIComparer,ParticularLabs/APIComparer,ParticularLabs/APIComparer,modernist/APIComparer | APIComparer.Tests/AssemblyInfo.cs | APIComparer.Tests/AssemblyInfo.cs | using ApprovalTests.Reporters;
#if(DEBUG)
[assembly: UseReporter(typeof(AllFailingTestsClipboardReporter), typeof(DiffReporter))]
#endif | using ApprovalTests.Reporters;
[assembly: UseReporter(typeof(DiffReporter))] | mit | C# |
be3c80d39091781009ad530da0fe7b9e53cfd13f | Add a "Naked" outfit | virtuallynaked/virtually-naked,virtuallynaked/virtually-naked | Viewer/src/actor/Outfit.cs | Viewer/src/actor/Outfit.cs | using System.Collections.Generic;
using System.Linq;
public class Outfit {
public class OutfitElement {
public string Figure { get; }
public string Label { get; }
public bool IsInitiallyVisible { get; }
public OutfitElement(string figure, string label, bool isInitiallyVisible) {
Figure = figure;
Label = label;
IsInitiallyVisible = isInitiallyVisible;
}
}
public static Outfit BandeauBikiniOutfit = new Outfit("Bandeau Bikini", new List<OutfitElement> {
new OutfitElement("bandeau-bikini-top", "Top", true),
new OutfitElement("bandeau-bikini-bottoms", "Bottoms", true)
});
public static Outfit BreakfastInBedOutfit = new Outfit("Breakfast In Bed Pajamas", new List<OutfitElement> {
new OutfitElement("breakfast-in-bed-tank", "Tank", true),
new OutfitElement("breakfast-in-bed-shorts", "Shorts", true)
});
public static Outfit RelaxedSundayOutfit = new Outfit("Relaxed Sunday", new List<OutfitElement> {
new OutfitElement("relaxed-sunday-tank", "Tank", true),
new OutfitElement("relaxed-sunday-shorts", "Shorts", true),
new OutfitElement("relaxed-sunday-shoes", "Shoes", true)
});
public static Outfit SummerDressSetOutfit = new Outfit("Summer Dress Set", new List<OutfitElement> {
new OutfitElement("summer-dress-dress", "Dress", true),
new OutfitElement("summer-dress-shoes", "Shoes", true)
});
public static Outfit UpscaleShopperOutfit = new Outfit("Upscale Shopper", new List<OutfitElement> {
new OutfitElement("upscale-shopper-blazer", "Blazer", true),
new OutfitElement("upscale-shopper-blouse", "Blouse", true),
new OutfitElement("upscale-shopper-pants", "Pants", true),
new OutfitElement("upscale-shopper-heels", "Heels", true)
});
public static Outfit SweetHomeOutfit = new Outfit("Sweet Home", new List<OutfitElement> {
new OutfitElement("sweet-home-tshirt", "T-Shirt", true),
new OutfitElement("sweet-home-panties", "Panties", true),
new OutfitElement("sweet-home-shorts", "Shorts", false),
new OutfitElement("sweet-home-thigh-socks", "Thigh Socks", true),
new OutfitElement("sweet-home-shin-socks", "Shin Socks", false),
new OutfitElement("sweet-home-ankle-socks", "Ankle Socks", false)
});
public static Outfit Naked = new Outfit("Naked", new List<OutfitElement> { });
public static List<Outfit> Outfits = new List<Outfit> {
BandeauBikiniOutfit,
BreakfastInBedOutfit,
RelaxedSundayOutfit,
SummerDressSetOutfit,
UpscaleShopperOutfit,
SweetHomeOutfit,
Naked
};
public bool IsMatch(FigureFacade[] figures) {
var isMatch = figures.Select(figure => figure.Definition.Name)
.SequenceEqual(Elements.Select(element => element.Figure));
return isMatch;
}
public string Label { get; }
public List<OutfitElement> Elements { get; }
public Outfit(string label, List<OutfitElement> figures) {
Label = label;
Elements = figures;
}
}
| using System.Collections.Generic;
using System.Linq;
public class Outfit {
public class OutfitElement {
public string Figure { get; }
public string Label { get; }
public bool IsInitiallyVisible { get; }
public OutfitElement(string figure, string label, bool isInitiallyVisible) {
Figure = figure;
Label = label;
IsInitiallyVisible = isInitiallyVisible;
}
}
public static Outfit BandeauBikiniOutfit = new Outfit("Bandeau Bikini", new List<OutfitElement> {
new OutfitElement("bandeau-bikini-top", "Top", true),
new OutfitElement("bandeau-bikini-bottoms", "Bottoms", true)
});
public static Outfit BreakfastInBedOutfit = new Outfit("Breakfast In Bed Pajamas", new List<OutfitElement> {
new OutfitElement("breakfast-in-bed-tank", "Tank", true),
new OutfitElement("breakfast-in-bed-shorts", "Shorts", true)
});
public static Outfit RelaxedSundayOutfit = new Outfit("Relaxed Sunday", new List<OutfitElement> {
new OutfitElement("relaxed-sunday-tank", "Tank", true),
new OutfitElement("relaxed-sunday-shorts", "Shorts", true),
new OutfitElement("relaxed-sunday-shoes", "Shoes", true)
});
public static Outfit SummerDressSetOutfit = new Outfit("Summer Dress Set", new List<OutfitElement> {
new OutfitElement("summer-dress-dress", "Dress", true),
new OutfitElement("summer-dress-shoes", "Shoes", true)
});
public static Outfit UpscaleShopperOutfit = new Outfit("Upscale Shopper", new List<OutfitElement> {
new OutfitElement("upscale-shopper-blazer", "Blazer", true),
new OutfitElement("upscale-shopper-blouse", "Blouse", true),
new OutfitElement("upscale-shopper-pants", "Pants", true),
new OutfitElement("upscale-shopper-heels", "Heels", true)
});
public static Outfit SweetHomeOutfit = new Outfit("Sweet Home", new List<OutfitElement> {
new OutfitElement("sweet-home-tshirt", "T-Shirt", true),
new OutfitElement("sweet-home-panties", "Panties", true),
new OutfitElement("sweet-home-shorts", "Shorts", false),
new OutfitElement("sweet-home-thigh-socks", "Thigh Socks", true),
new OutfitElement("sweet-home-shin-socks", "Shin Socks", false),
new OutfitElement("sweet-home-ankle-socks", "Ankle Socks", false)
});
public static List<Outfit> Outfits = new List<Outfit> {
BandeauBikiniOutfit,
BreakfastInBedOutfit,
RelaxedSundayOutfit,
SummerDressSetOutfit,
UpscaleShopperOutfit,
SweetHomeOutfit
};
public bool IsMatch(FigureFacade[] figures) {
var isMatch = figures.Select(figure => figure.Definition.Name)
.SequenceEqual(Elements.Select(element => element.Figure));
return isMatch;
}
public string Label { get; }
public List<OutfitElement> Elements { get; }
public Outfit(string label, List<OutfitElement> figures) {
Label = label;
Elements = figures;
}
}
| mit | C# |
f06e6232bef3925984905a7120a9d9b749fe8510 | Solve build related issue | Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist | Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs | Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs | using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
_dbContext.SaveChanges();
}
}
}
| using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
_dbContext.SaveChanges();
}
}
}
| mit | C# |
cc73813109652efbef46b2c19f576b106a72ac09 | Update server side API for single multiple answer question | Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist | Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs | Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs | using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
}
}
| using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
}
}
| mit | C# |
b052a9f65e51e755c397b16341ab2d280741c1cf | Correct OpenAPI spec link Fix #206 | openchargemap/ocm-system,openchargemap/ocm-system,openchargemap/ocm-system,openchargemap/ocm-system | API/OCM.Net/OCM.API.Web/Controllers/MiscEndpointController.cs | API/OCM.Net/OCM.API.Web/Controllers/MiscEndpointController.cs | using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace OCM.API.Web.Standard.Controllers
{
[ApiController]
public class MiscEndpointController : ControllerBase
{
private readonly ILogger _logger;
public MiscEndpointController(ILogger<MiscEndpointController> logger)
{
_logger = logger;
}
[HttpGet]
[Route("/map")]
public IActionResult Get()
{
return Redirect("https://map.openchargemap.io");
}
[HttpGet]
[Route("/v3/openapi")]
public IActionResult GetOpenAPIDefinition()
{
return Redirect("https://raw.githubusercontent.com/openchargemap/ocm-docs/master/Model/schema/ocm-openapi-spec.yaml");
}
}
}
| using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace OCM.API.Web.Standard.Controllers
{
[ApiController]
public class MiscEndpointController : ControllerBase
{
private readonly ILogger _logger;
public MiscEndpointController(ILogger<MiscEndpointController> logger)
{
_logger = logger;
}
[HttpGet]
[Route("/map")]
public IActionResult Get()
{
return Redirect("https://map.openchargemap.io");
}
[HttpGet]
[Route("/v3/openapi")]
public IActionResult GetOpenAPIDefinition()
{
return Redirect("https://raw.githubusercontent.com/openchargemap/ocm-docs/master/Model/schema/ocm-api-schema.yaml");
}
}
}
| mit | C# |
b82736fbbc6daea838fc5dfa07bb3389e0eebcb0 | Add comment | Remi-Tech/compass-core | Compass.Domain/Services/KafkaProducer/KafkaProducerService.cs | Compass.Domain/Services/KafkaProducer/KafkaProducerService.cs | using System;
using System.Collections.Generic;
using System.Text;
using Compass.Domain.Models;
using Compass.Shared;
using Confluent.Kafka;
using Confluent.Kafka.Serialization;
using Newtonsoft.Json;
namespace Compass.Domain.Services.KafkaProducer
{
/// <summary>
/// This class is registered in the DI framework as a singleton
/// across the application lifecycle (not per request). The reason
/// for this is to absorb the overhead of establishing the
/// connection to Kafka once. With this approach, the time to
/// produce events to Kafka is single-digit millisecond.
/// </summary>
public class KafkaProducerService : IKafkaProducerService
{
private readonly ICompassEnvironment _compassEnvironment;
private readonly Producer<Null, string> _producer;
public KafkaProducerService(
ICompassEnvironment compassEnvironment
)
{
_compassEnvironment = compassEnvironment;
_producer = new Producer<Null, string>(GetProducerConfig(), null, new StringSerializer(Encoding.UTF8));
}
public void Produce(CompassEvent compassEvent)
{
try
{
_producer.ProduceAsync(_compassEnvironment.GetKafkaTopic(), null, JsonConvert.SerializeObject(compassEvent));
_producer.Flush(_compassEnvironment.GetKafkaProducerTimeout());
}
catch (Exception e)
{
// TODO: Log
Console.WriteLine(e);
}
}
private Dictionary<string, object> GetProducerConfig()
{
return new Dictionary<string, object> { { "bootstrap.servers", _compassEnvironment.GetKafkaBrokerList() } };
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using Compass.Domain.Models;
using Compass.Shared;
using Confluent.Kafka;
using Confluent.Kafka.Serialization;
using Newtonsoft.Json;
namespace Compass.Domain.Services.KafkaProducer
{
/// <summary>
/// This class is registered in the DI framework as a singleton
/// across the application lifecycle (not per request). The reason
/// for this is to absorb the overhead of establishing the
/// connection to Kafka once. With this approach, the time to
/// produce events to Kafka is single-digit millisecond.
/// </summary>
public class KafkaProducerService : IKafkaProducerService
{
private readonly ICompassEnvironment _compassEnvironment;
private readonly Producer<Null, string> _producer;
public KafkaProducerService(
ICompassEnvironment compassEnvironment
)
{
_compassEnvironment = compassEnvironment;
_producer = new Producer<Null, string>(GetProducerConfig(), null, new StringSerializer(Encoding.UTF8));
}
public void Produce(CompassEvent compassEvent)
{
try
{
_producer.ProduceAsync(_compassEnvironment.GetKafkaTopic(), null, JsonConvert.SerializeObject(compassEvent));
_producer.Flush(_compassEnvironment.GetKafkaProducerTimeout());
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
private Dictionary<string, object> GetProducerConfig()
{
return new Dictionary<string, object> { { "bootstrap.servers", _compassEnvironment.GetKafkaBrokerList() } };
}
}
}
| apache-2.0 | C# |
a0900f2e425bd99082513ab22e850b5067589683 | Split out message printing into PrintMessage() | tmds/Tmds.DBus | Monitor.cs | Monitor.cs | // Copyright 2006 Alp Toker <[email protected]>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.Collections.Generic;
using NDesk.DBus;
using org.freedesktop.DBus;
public class ManagedDBusTest
{
public static void Main (string[] args)
{
string addr = Address.SessionBus;
if (args.Length == 1) {
string arg = args[0];
switch (arg)
{
case "--system":
addr = Address.SystemBus;
break;
case "--session":
addr = Address.SessionBus;
break;
default:
Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]");
Console.Error.WriteLine (" If no watch expressions are provided, defaults will be used.");
return;
}
}
Connection conn = new Connection (false);
conn.Open (addr);
conn.Authenticate ();
ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
string name = "org.freedesktop.DBus";
Bus bus = conn.GetObject<Bus> (name, opath);
bus.NameAcquired += delegate (string acquired_name) {
Console.WriteLine ("NameAcquired: " + acquired_name);
};
bus.Hello ();
//hack to process the NameAcquired signal synchronously
conn.HandleSignal (conn.ReadMessage ());
if (args.Length > 1) {
//install custom match rules only
for (int i = 1 ; i != args.Length ; i++)
bus.AddMatch (args[i]);
} else {
//no custom match rules, install the defaults
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error));
}
while (true) {
Message msg = conn.ReadMessage ();
PrintMessage (msg);
Console.WriteLine ();
}
}
public static void PrintMessage (Message msg)
{
Console.WriteLine ("Message:");
Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType);
//foreach (HeaderField hf in msg.HeaderFields)
// Console.WriteLine ("\t" + hf.Code + ": " + hf.Value);
foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields)
Console.WriteLine ("\t" + field.Key + ": " + field.Value);
if (msg.Body != null) {
Console.WriteLine ("\tBody:");
MessageReader reader = new MessageReader (msg);
//TODO: this needs to be done more intelligently
try {
foreach (DType dtype in msg.Signature.Data) {
if (dtype == DType.Invalid)
continue;
object arg;
reader.GetValue (dtype, out arg);
Console.WriteLine ("\t\t" + dtype + ": " + arg);
}
} catch {
Console.WriteLine ("\t\tmonitor is too dumb to decode message body");
}
}
}
}
| // Copyright 2006 Alp Toker <[email protected]>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.Collections.Generic;
using NDesk.DBus;
using org.freedesktop.DBus;
public class ManagedDBusTest
{
public static void Main (string[] args)
{
string addr = Address.SessionBus;
if (args.Length == 1) {
string arg = args[0];
switch (arg)
{
case "--system":
addr = Address.SystemBus;
break;
case "--session":
addr = Address.SessionBus;
break;
default:
Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]");
Console.Error.WriteLine (" If no watch expressions are provided, defaults will be used.");
return;
}
}
Connection conn = new Connection (false);
conn.Open (addr);
conn.Authenticate ();
ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
string name = "org.freedesktop.DBus";
Bus bus = conn.GetObject<Bus> (name, opath);
bus.NameAcquired += delegate (string acquired_name) {
Console.WriteLine ("NameAcquired: " + acquired_name);
};
bus.Hello ();
//hack to process the NameAcquired signal synchronously
conn.HandleSignal (conn.ReadMessage ());
if (args.Length > 1) {
//install custom match rules only
for (int i = 1 ; i != args.Length ; i++)
bus.AddMatch (args[i]);
} else {
//no custom match rules, install the defaults
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error));
}
while (true) {
Message msg = conn.ReadMessage ();
Console.WriteLine ("Message:");
Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType);
//foreach (HeaderField hf in msg.HeaderFields)
// Console.WriteLine ("\t" + hf.Code + ": " + hf.Value);
foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields)
Console.WriteLine ("\t" + field.Key + ": " + field.Value);
if (msg.Body != null) {
Console.WriteLine ("\tBody:");
MessageReader reader = new MessageReader (msg);
//TODO: this needs to be done more intelligently
try {
foreach (DType dtype in msg.Signature.Data) {
if (dtype == DType.Invalid)
continue;
object arg;
reader.GetValue (dtype, out arg);
Console.WriteLine ("\t\t" + dtype + ": " + arg);
}
} catch {
Console.WriteLine ("\t\tmonitor is too dumb to decode message body");
}
}
Console.WriteLine ();
}
}
}
| mit | C# |
7ca8109d3fd82076e73d3aa094b8f2ab259097d1 | Update FunModule - use var to be consistent with the rest of the codebase | mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX | Modix/Modules/FunModule.cs | Modix/Modules/FunModule.cs | using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Serilog;
namespace Modix.Modules
{
[Name("Fun"), Summary("A bunch of miscellaneous, fun commands")]
public class FunModule : ModuleBase
{
[Command("jumbo"), Summary("Jumbofy an emoji")]
public async Task Jumbo(string emoji)
{
string emojiUrl = null;
if (Emote.TryParse(emoji, out var found))
{
emojiUrl = found.Url;
}
else
{
var codepoint = char.ConvertToUtf32(emoji, 0);
var codepointHex = codepoint.ToString("X").ToLower();
emojiUrl = $"https://raw.githubusercontent.com/twitter/twemoji/gh-pages/2/72x72/{codepointHex}.png";
}
try
{
var client = new HttpClient();
var req = await client.GetStreamAsync(emojiUrl);
await Context.Channel.SendFileAsync(req, Path.GetFileName(emojiUrl), Context.User.Mention);
try
{
await Context.Message.DeleteAsync();
}
catch (HttpRequestException)
{
Log.Information("Couldn't delete message after jumbofying.");
}
}
catch (HttpRequestException)
{
await ReplyAsync($"Sorry {Context.User.Mention}, I don't recognize that emoji.");
}
}
}
}
| using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Serilog;
namespace Modix.Modules
{
[Name("Fun"), Summary("A bunch of miscellaneous, fun commands")]
public class FunModule : ModuleBase
{
[Command("jumbo"), Summary("Jumbofy an emoji")]
public async Task Jumbo(string emoji)
{
string emojiUrl = null;
if (Emote.TryParse(emoji, out var found))
{
emojiUrl = found.Url;
}
else
{
int codepoint = Char.ConvertToUtf32(emoji, 0);
string codepointHex = codepoint.ToString("X").ToLower();
emojiUrl = $"https://raw.githubusercontent.com/twitter/twemoji/gh-pages/2/72x72/{codepointHex}.png";
}
try
{
HttpClient client = new HttpClient();
var req = await client.GetStreamAsync(emojiUrl);
await Context.Channel.SendFileAsync(req, Path.GetFileName(emojiUrl), Context.User.Mention);
try
{
await Context.Message.DeleteAsync();
}
catch (HttpRequestException)
{
Log.Information("Couldn't delete message after jumbofying.");
}
}
catch (HttpRequestException)
{
await ReplyAsync($"Sorry {Context.User.Mention}, I don't recognize that emoji.");
}
}
}
}
| mit | C# |
0f9bcadf70660c46ec23df9ce326dbd3cdaa8468 | Reduce error correction level | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/ViewModels/AddressViewModel.cs | WalletWasabi.Gui/ViewModels/AddressViewModel.cs | using Avalonia;
using Gma.QrCodeNet.Encoding;
using ReactiveUI;
using System;
using System.Threading.Tasks;
using WalletWasabi.KeyManagement;
namespace WalletWasabi.Gui.ViewModels
{
public class AddressViewModel : ViewModelBase
{
private bool _isExpanded;
private bool _generating;
private bool _isBusy;
private bool[,] _qrCode;
public HdPubKey Model { get; }
public AddressViewModel(HdPubKey model)
{
Model = model;
this.WhenAnyValue(x => x.IsExpanded).Subscribe(async expanded =>
{
if (expanded && !_generating && QrCode is null)
{
IsBusy = true;
_generating = true;
QrCode = await Task.Run(() =>
{
var encoder = new QrEncoder(ErrorCorrectionLevel.M);
encoder.TryEncode(Address, out var qrCode);
return qrCode.Matrix.InternalArray;
});
IsBusy = false;
}
});
}
public bool IsBusy
{
get { return _isBusy; }
set { this.RaiseAndSetIfChanged(ref _isBusy, value); }
}
public bool IsExpanded
{
get { return _isExpanded; }
set { this.RaiseAndSetIfChanged(ref _isExpanded, value); }
}
public string Label => Model.Label;
public string Address => Model.GetP2wpkhAddress(Global.Network).ToString();
public bool[,] QrCode
{
get => _qrCode;
set => this.RaiseAndSetIfChanged(ref _qrCode, value);
}
public void CopyToClipboard()
{
Application.Current.Clipboard.SetTextAsync(Address).GetAwaiter().GetResult();
}
}
}
| using Avalonia;
using Gma.QrCodeNet.Encoding;
using ReactiveUI;
using System;
using System.Threading.Tasks;
using WalletWasabi.KeyManagement;
namespace WalletWasabi.Gui.ViewModels
{
public class AddressViewModel : ViewModelBase
{
private bool _isExpanded;
private bool _generating;
private bool _isBusy;
private bool[,] _qrCode;
public HdPubKey Model { get; }
public AddressViewModel(HdPubKey model)
{
Model = model;
this.WhenAnyValue(x => x.IsExpanded).Subscribe(async expanded =>
{
if (expanded && !_generating && QrCode is null)
{
IsBusy = true;
_generating = true;
QrCode = await Task.Run(() =>
{
var encoder = new QrEncoder(ErrorCorrectionLevel.H);
encoder.TryEncode(Address, out var qrCode);
return qrCode.Matrix.InternalArray;
});
IsBusy = false;
}
});
}
public bool IsBusy
{
get { return _isBusy; }
set { this.RaiseAndSetIfChanged(ref _isBusy, value); }
}
public bool IsExpanded
{
get { return _isExpanded; }
set { this.RaiseAndSetIfChanged(ref _isExpanded, value); }
}
public string Label => Model.Label;
public string Address => Model.GetP2wpkhAddress(Global.Network).ToString();
public bool[,] QrCode
{
get => _qrCode;
set => this.RaiseAndSetIfChanged(ref _qrCode, value);
}
public void CopyToClipboard()
{
Application.Current.Clipboard.SetTextAsync(Address).GetAwaiter().GetResult();
}
}
}
| mit | C# |
109fdc478cc881acbd5cf138f7b0d08ac8238bb2 | Fix form registration | tvanfosson/azure-web-jobs-demo,tvanfosson/azure-web-jobs-demo,tvanfosson/azure-web-jobs-demo | WebJobsDemo/WebApp/Views/Home/Subscribed.cshtml | WebJobsDemo/WebApp/Views/Home/Subscribed.cshtml | @{
ViewBag.Title = "View Subscription";
}
@model SubscriptionViewModel
<div class="jumbotron">
<h1>View Subscription</h1>
<p class="lead">See the results of the WebJobs subscription handlers</p>
</div>
@if (Model.Id != Guid.Empty)
{
<h1>Subscription Details</h1>
<ul class="list-group">
<li class="list-group-item">Name: @Model.FirstName @Model.LastName</li>
<li class="list-group-item">Subscription Key: @Model.SubscriptionKey</li>
<li class="list-group-item">Created On: @Model.CreatedOn</li>
<li class="list-group-item">Confirmation Sent On: @Model.ConfirmationSentOn</li>
<li class="list-group-item">Confirmed: @(Model.Confirmed ? "Yes" : "No")</li>
</ul>
using (Html.BeginForm("Subscribed", "Home"))
{
@Html.HiddenFor(m => m.EmailAddress)
@Html.HiddenFor(m => m.SubscriptionKey)
<div class="form-group">
<div>
<button type="submit" class="btn btn-default">Refresh</button>
</div>
</div>
}
}
<h1>Search</h1>
@if (Model.PerformedLookup)
{
<p>No subscription found!</p>
}
@using (Html.BeginForm("Subscribed", "Home"))
{
<div class="form-group">
@Html.LabelFor(m => m.EmailAddress, new { @class = "control-label" })
<div>
@Html.TextBoxFor(m => m.EmailAddress, new { @class = "form-control", placeholder = "Email Address" })
@Html.ValidationMessageFor(m => m.EmailAddress)
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.SubscriptionKey, new { @class = "control-label" })
<div>
@Html.TextBoxFor(m => m.SubscriptionKey, new { @class = "form-control", placeholder = "Subscription Key", value = Model.SubscriptionKey == Guid.Empty ? "" : Model.SubscriptionKey.ToString() })
@Html.ValidationMessageFor(m => m.SubscriptionKey)
</div>
</div>
<div class="form-group">
<div>
<button type="submit" class="btn btn-default">Look Up</button>
</div>
</div>
} | @{
ViewBag.Title = "View Subscription";
}
@model SubscriptionViewModel
<div class="jumbotron">
<h1>View Subscription</h1>
<p class="lead">See the results of the WebJobs subscription handlers</p>
</div>
@if (Model.Id != Guid.Empty)
{
<h1>Subscription Details</h1>
<ul class="list-group">
<li class="list-group-item">Name: @Model.FirstName @Model.LastName</li>
<li class="list-group-item">Subscription Key: @Model.SubscriptionKey</li>
<li class="list-group-item">Created On: @Model.CreatedOn</li>
<li class="list-group-item">Confirmation Sent On: @Model.ConfirmationSentOn</li>
<li class="list-group-item">Confirmed: @(Model.Confirmed ? "Yes" : "No")</li>
</ul>
using (Html.BeginForm())
{
@Html.HiddenFor(m => m.EmailAddress)
@Html.HiddenFor(m => m.SubscriptionKey)
<div class="form-group">
<div>
<button type="submit" class="btn btn-default">Refresh</button>
</div>
</div>
}
}
<h1>Search</h1>
@if (Model.PerformedLookup)
{
<p>No subscription found!</p>
}
@using (Html.BeginForm())
{
<div class="form-group">
@Html.LabelFor(m => m.EmailAddress, new { @class = "control-label" })
<div>
@Html.TextBoxFor(m => m.EmailAddress, new { @class = "form-control", placeholder = "Email Address" })
@Html.ValidationMessageFor(m => m.EmailAddress)
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.SubscriptionKey, new { @class = "control-label" })
<div>
@Html.TextBoxFor(m => m.SubscriptionKey, new { @class = "form-control", placeholder = "Subscription Key", value = Model.SubscriptionKey == Guid.Empty ? "" : Model.SubscriptionKey.ToString() })
@Html.ValidationMessageFor(m => m.SubscriptionKey)
</div>
</div>
<div class="form-group">
<div>
<button type="submit" class="btn btn-default">Look Up</button>
</div>
</div>
} | mit | C# |
5e6de2076d599f3ea6bbe2a425123abf764f8228 | Update Resources.cs | win120a/ACClassRoomUtil,win120a/ACClassRoomUtil | LoginPasswordUtil/C-Sharp-Version/Resources.cs | LoginPasswordUtil/C-Sharp-Version/Resources.cs | /*
Copyright (C) 2011-2014 AC Inc. (Andy Cheung)
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.
*/
/*
This is my first draft of this (C# version), it may not pass the build.
And this is the dll extension (ACLPUResouces.dll)'s source code.
*/
using System;
namespace ACLoginPasswordUtil
{
public class Resources
{
public String baseCmd = "net.exe";
public String netCmd = " user Administrator ";
public String armv7a = "key";
public String tail = ".";
}
}
| /*
Copyright (C) 2011-2014 AC Inc. (Andy Cheung)
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.
*/
/*
This is my first draft of this (C# version), it may not pass the build.
And this is the dll extension (ACLPUResouces.dll)'s source code.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ACLoginPasswordUtil
{
public class Resources
{
public String baseCmd = "net.exe";
public String netCmd = " user Administrator ";
public String armv7a = "key";
public String tail = ".";
}
}
| apache-2.0 | C# |
220fa1f0c2d77e77b5bae09c489a93b3b9c44082 | Make Serializer<T> public | VictorScherbakov/DataTanker | DataTanker/Core/Serializer.cs | DataTanker/Core/Serializer.cs | namespace DataTanker
{
using System;
/// <summary>
/// Simple implementation of ISerializer using specified methods.
/// </summary>
/// <typeparam name="T"></typeparam>
public class Serializer<T> : ISerializer<T>
{
private readonly Func<T, byte[]> _serialize;
private readonly Func<byte[], T> _deserialize;
/// <summary>
/// Initializes a new instance of the Serializer using specified serialization routines.
/// </summary>
/// <param name="serialize"></param>
/// <param name="deserialize"></param>
public Serializer(Func<T, byte[]> serialize, Func<byte[], T> deserialize)
{
if (serialize == null)
throw new ArgumentNullException(nameof(serialize));
if (deserialize == null)
throw new ArgumentNullException(nameof(deserialize));
_serialize = serialize;
_deserialize = deserialize;
}
/// <summary>
/// Converts specified bytes to the instance of T.
/// </summary>
/// <param name="bytes">Bytes to convert</param>
/// <returns>Resulted instance</returns>
public T Deserialize(byte[] bytes)
{
return _deserialize(bytes);
}
/// <summary>
/// Converts specified instance of T to byte array.
/// </summary>
/// <param name="obj">Instance to convert</param>
/// <returns>Resulted bytes</returns>
public byte[] Serialize(T obj)
{
return _serialize(obj);
}
}
}
| namespace DataTanker
{
using System;
/// <summary>
/// Simple implementation of ISerializer using specified methods.
/// </summary>
/// <typeparam name="T"></typeparam>
internal class Serializer<T> : ISerializer<T>
{
private readonly Func<T, byte[]> _serialize;
private readonly Func<byte[], T> _deserialize;
/// <summary>
/// Initializes a new instance of the Serializer using specified serialization routines.
/// </summary>
/// <param name="serialize"></param>
/// <param name="deserialize"></param>
public Serializer(Func<T, byte[]> serialize, Func<byte[], T> deserialize)
{
if (serialize == null)
throw new ArgumentNullException(nameof(serialize));
if (deserialize == null)
throw new ArgumentNullException(nameof(deserialize));
_serialize = serialize;
_deserialize = deserialize;
}
/// <summary>
/// Converts specified bytes to the instance of T.
/// </summary>
/// <param name="bytes">Bytes to convert</param>
/// <returns>Resulted instance</returns>
public T Deserialize(byte[] bytes)
{
return _deserialize(bytes);
}
/// <summary>
/// Converts specified instance of T to byte array.
/// </summary>
/// <param name="obj">Instance to convert</param>
/// <returns>Resulted bytes</returns>
public byte[] Serialize(T obj)
{
return _serialize(obj);
}
}
}
| mit | C# |
e300c3eee86611c41cd7f124bb6fc2ebad92b7c9 | Make version string specifially a string | jakeclawson/Pinta,PintaProject/Pinta,Mailaender/Pinta,Mailaender/Pinta,Fenex/Pinta,PintaProject/Pinta,PintaProject/Pinta,jakeclawson/Pinta,Fenex/Pinta | Pinta/AddinSetupService.cs | Pinta/AddinSetupService.cs | //
// AddinSetupService.cs
//
// Author:
// Lluis Sanchez Gual <[email protected]>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Mono.Addins;
using Mono.Addins.Setup;
using Pinta.Core;
using Mono.Unix;
namespace Pinta
{
public class AddinSetupService: SetupService
{
internal AddinSetupService (AddinRegistry r): base (r)
{
}
public bool AreRepositoriesRegistered ()
{
string url = GetPlatformRepositoryUrl ();
return Repositories.ContainsRepository (url);
}
public void RegisterRepositories (bool enable)
{
string url = GetPlatformRepositoryUrl ();
if (!Repositories.ContainsRepository (url)) {
var rep = Repositories.RegisterRepository (null, url, false);
rep.Name = Catalog.GetString ("Pinta Platform Dependent Add-in Repository");
if (!enable)
Repositories.SetRepositoryEnabled (url, false);
}
url = GetAllRepositoryUrl ();
if (!Repositories.ContainsRepository (url)) {
var rep2 = Repositories.RegisterRepository (null, url, false);
rep2.Name = Catalog.GetString ("Pinta Platform Independent Add-in Repository");
if (!enable)
Repositories.SetRepositoryEnabled (url, false);
}
}
public string GetPlatformRepositoryUrl ()
{
string platform;
if (SystemManager.GetOperatingSystem () == OS.Windows)
platform = "Win";
else if (SystemManager.GetOperatingSystem () == OS.Mac)
platform = "Mac";
else
platform = "Linux";
//TODO: Need to change version number here
return "http://178.79.177.109:8080/Stable/" + platform + "/" + "1.5" + "/main.mrep";
}
public string GetAllRepositoryUrl ()
{
//TODO: Need to change version number here
return "http://178.79.177.109:8080/Stable/All/" + "1.5" + "/main.mrep";
}
}
}
| //
// AddinSetupService.cs
//
// Author:
// Lluis Sanchez Gual <[email protected]>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Mono.Addins;
using Mono.Addins.Setup;
using Pinta.Core;
using Mono.Unix;
namespace Pinta
{
public class AddinSetupService: SetupService
{
internal AddinSetupService (AddinRegistry r): base (r)
{
}
public bool AreRepositoriesRegistered ()
{
string url = GetPlatformRepositoryUrl ();
return Repositories.ContainsRepository (url);
}
public void RegisterRepositories (bool enable)
{
string url = GetPlatformRepositoryUrl ();
if (!Repositories.ContainsRepository (url)) {
var rep = Repositories.RegisterRepository (null, url, false);
rep.Name = Catalog.GetString ("Pinta Platform Dependent Add-in Repository");
if (!enable)
Repositories.SetRepositoryEnabled (url, false);
}
url = GetAllRepositoryUrl ();
if (!Repositories.ContainsRepository (url)) {
var rep2 = Repositories.RegisterRepository (null, url, false);
rep2.Name = Catalog.GetString ("Pinta Platform Independent Add-in Repository");
if (!enable)
Repositories.SetRepositoryEnabled (url, false);
}
}
public string GetPlatformRepositoryUrl ()
{
string platform;
if (SystemManager.GetOperatingSystem () == OS.Windows)
platform = "Win";
else if (SystemManager.GetOperatingSystem () == OS.Mac)
platform = "Mac";
else
platform = "Linux";
//TODO: Need to change version number here
return "http://178.79.177.109:8080/Stable/" + platform + "/" + 1.5 + "/main.mrep";
}
public string GetAllRepositoryUrl ()
{
//TODO: Need to change version number here
return "http://178.79.177.109:8080/Stable/All/" + 1.5 + "/main.mrep";
}
}
}
| mit | C# |
3bb209ef9fef3607481679f32406fb4f8468fc1f | Update assembly version number to v1.1 | Cinegy/TsAnalyser | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TsAnalyser")]
[assembly: AssemblyDescription("RTP and TS Analyser")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cinegy GmbH")]
[assembly: AssemblyProduct("TsAnalyser")]
[assembly: AssemblyCopyright("Copyright © Cinegy GmbH 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4583a25c-d61a-44a3-b839-a55b091f6187")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
| 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("TsAnalyser")]
[assembly: AssemblyDescription("RTP and TS Analyser")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cinegy GmbH")]
[assembly: AssemblyProduct("TsAnalyser")]
[assembly: AssemblyCopyright("Copyright © Cinegy GmbH 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4583a25c-d61a-44a3-b839-a55b091f6187")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| apache-2.0 | C# |
3e9d484f81f2917b31699d34900afc4ec4299a6e | Change AssemblyVersion, Fix AssemblyDescription | daitel/QFE | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QFE")]
[assembly: AssemblyDescription("Simple helper app for virtual atc. Table with icao, wind, qnh, qfe and tl.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QFE")]
[assembly: AssemblyCopyright("(c) 2015 Nikita Fedoseev")]
[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("d1e6d732-bbd6-44ed-b0bc-f7c58b6a37a6")]
// 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.2.*")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QFE")]
[assembly: AssemblyDescription("Simple helper app for virual atc. Table with icao, wind, qnh, qfe and tl.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QFE")]
[assembly: AssemblyCopyright("(c) 2015 Nikita Fedoseev")]
[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("d1e6d732-bbd6-44ed-b0bc-f7c58b6a37a6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.*")]
| mit | C# |
0d294a226df4b6aae078a64d94c355d21f20c755 | Bump minor version | hartez/PneumaticTube | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PneumaticTube")]
[assembly: AssemblyDescription("Command line Dropbox uploader for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CodeWise LLC")]
[assembly: AssemblyProduct("PneumaticTube")]
[assembly: AssemblyCopyright("Copyright © CodeWise LLC and E.Z. Hart 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2502610f-3a6b-45ab-816e-81e2347d4e33")]
// 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.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")] | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PneumaticTube")]
[assembly: AssemblyDescription("Command line Dropbox uploader for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CodeWise LLC")]
[assembly: AssemblyProduct("PneumaticTube")]
[assembly: AssemblyCopyright("Copyright © CodeWise LLC and E.Z. Hart 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2502610f-3a6b-45ab-816e-81e2347d4e33")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")] | mit | C# |
74d4e13e04da186bb257b518824f8733a57e6c04 | Update AssemblyInfo.cs | appium/appium-dotnet-driver,Astro03/appium-dotnet-driver,rajfidel/appium-dotnet-driver,suryarend/appium-dotnet-driver,Brillio/appium-dotnet-driver,rajfidel/appium-dotnet-driver | appium-dotnet-driver/Properties/AssemblyInfo.cs | appium-dotnet-driver/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("appium-dotnet-driver")]
[assembly: AssemblyDescription ("Appium Dotnet Driver")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Appium Contributors")]
[assembly: AssemblyProduct ("Appium-Dotnet-Driver")]
[assembly: AssemblyCopyright ("Copyright © 2014")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.0.1")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("lib")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("baba")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| apache-2.0 | C# |
45ecca74dbc370783d75ad7da638bb4d58c2c0c5 | Fix powershell file extension. | daviddumas/pgina,MutonUfoAI/pgina,pgina/pgina,daviddumas/pgina,pgina/pgina,stefanwerfling/pgina,MutonUfoAI/pgina,stefanwerfling/pgina,stefanwerfling/pgina,daviddumas/pgina,pgina/pgina,MutonUfoAI/pgina | Plugins/ScriptRunner/ScriptRunner/AddScript.cs | Plugins/ScriptRunner/ScriptRunner/AddScript.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;
namespace pGina.Plugin.ScriptRunner
{
public partial class AddScript : Form
{
internal Script ScriptData { get; set; }
public AddScript()
{
InitializeComponent();
InitUI();
}
private void InitUI()
{
this.batchRB.Checked = true;
this.userSessionCB.Checked = true;
}
private void browseFileBtn_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.InitialDirectory = @"C:\";
if (this.batchRB.Checked)
{
dlg.Filter = "Batch scripts (*.bat)|*.bat";
}
else
{
dlg.Filter = "PowerShell scripts (*.ps1)|*.ps1";
}
if (dlg.ShowDialog() == DialogResult.OK)
{
this.fileTB.Text = dlg.FileName;
}
}
private void cancelBtn_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
private void okBtn_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
string fn = this.fileTB.Text.Trim();
if (this.batchRB.Checked)
{
this.ScriptData = new BatchScript(fn);
}
else
{
this.ScriptData = new PowerShellScript(fn);
}
this.ScriptData.UserSession = this.userSessionCB.Checked;
this.ScriptData.SystemSession = this.systemSessionCB.Checked;
this.Close();
}
}
}
| 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;
namespace pGina.Plugin.ScriptRunner
{
public partial class AddScript : Form
{
internal Script ScriptData { get; set; }
public AddScript()
{
InitializeComponent();
InitUI();
}
private void InitUI()
{
this.batchRB.Checked = true;
this.userSessionCB.Checked = true;
}
private void browseFileBtn_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.InitialDirectory = @"C:\";
if (this.batchRB.Checked)
{
dlg.Filter = "Batch scripts (*.bat)|*.bat";
}
else
{
dlg.Filter = "PowerShell scripts (*.ps)|*.ps";
}
if (dlg.ShowDialog() == DialogResult.OK)
{
this.fileTB.Text = dlg.FileName;
}
}
private void cancelBtn_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
private void okBtn_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
string fn = this.fileTB.Text.Trim();
if (this.batchRB.Checked)
{
this.ScriptData = new BatchScript(fn);
}
else
{
this.ScriptData = new PowerShellScript(fn);
}
this.ScriptData.UserSession = this.userSessionCB.Checked;
this.ScriptData.SystemSession = this.systemSessionCB.Checked;
this.Close();
}
}
}
| bsd-3-clause | C# |
f54e51672897455a01f2859650384256dc56f860 | Update ScreenshotController.cs | Yarmolaev/TelegramCommandBot | TeleCommand/Controller/ScreenshotController.cs | TeleCommand/Controller/ScreenshotController.cs | using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;
namespace de.yarmolaev.TelegramCommandBot.Controller
{
class ScreenshotController
{
/// <summary>
/// Makes a screenshot
/// </summary>
/// <returns>Path to the made screenshot</returns>
public static string GetScreenshot()
{
int screenLeft = SystemInformation.VirtualScreen.Left;
int screenTop = SystemInformation.VirtualScreen.Top;
int screenWidth = SystemInformation.VirtualScreen.Width;
int screenHeight = SystemInformation.VirtualScreen.Height;
using (Bitmap bmp = new Bitmap(screenWidth, screenHeight))
{
using (Graphics g = Graphics.FromImage(bmp))
{
g.CopyFromScreen(screenLeft, screenTop, 0, 0, bmp.Size);
}
return SaveImage(bmp);
}
}
/// <summary>
/// Saves a binmap with current timestamp in mydocuments/TCB/<timestamp>.jpg
/// </summary>
/// <param name="bmp">Bitmap to be saved</param>
/// <returns>Path to the saved image</returns>
private static string SaveImage(Bitmap bmp)
{
DateTime now = DateTime.Now;
string filename = now.ToString("yyyy_MM_dd_HH_mm_ss_fff")+".jpg";
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "TCB");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
path = Path.Combine(path, filename);
try
{
bmp.Save(path, ImageFormat.Jpeg);
return path;
}catch(Exception e)
{
return null;
}
}
}
}
| using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;
namespace de.yarmolaev.TelegramCommandBot.Controller
{
class ScreenshotController
{
/// <summary>
/// Makes a screenshot
/// </summary>
/// <returns>Path to the made screenshot</returns>
public static string GetScreenshot()
{
int screenLeft = SystemInformation.VirtualScreen.Left;
int screenTop = SystemInformation.VirtualScreen.Top;
int screenWidth = SystemInformation.VirtualScreen.Width;
int screenHeight = SystemInformation.VirtualScreen.Height;
using (Bitmap bmp = new Bitmap(screenWidth, screenHeight))
{
using (Graphics g = Graphics.FromImage(bmp))
{
g.CopyFromScreen(screenLeft, screenTop, 0, 0, bmp.Size);
}
return SaveImage(bmp);
}
}
/// <summary>
/// Saves a binmap with current timestamp in mydocuments/TCB/<timestamp>.jpg
/// </summary>
/// <param name="bmp">Bitmap to be saved</param>
/// <returns>Path to the saved image</returns>
private static string SaveImage(Bitmap bmp)
{
DateTime now = DateTime.Now;
string filename = now.ToString("yyyy_MM_dd_HH_mm_ss")+".jpg";
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "TCB");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
path = Path.Combine(path, filename);
try
{
bmp.Save(path, ImageFormat.Jpeg);
return path;
}catch(Exception e)
{
return null;
}
}
}
}
| mit | C# |
ffc8a3e00f86399894b2629938ff97df59935ac2 | check status from cancel registration | tomascassidy/BrockAllen.MembershipReboot,eric-swann-q2/BrockAllen.MembershipReboot,rvdkooy/BrockAllen.MembershipReboot,DosGuru/MembershipReboot,rajendra1809/BrockAllen.MembershipReboot,brockallen/BrockAllen.MembershipReboot,vankooch/BrockAllen.MembershipReboot,vinneyk/BrockAllen.MembershipReboot | src/BrockAllen.MembershipReboot.Mvc/Areas/UserAccount/Views/Register/Cancel.cshtml | src/BrockAllen.MembershipReboot.Mvc/Areas/UserAccount/Views/Register/Cancel.cshtml | @model bool
@{
ViewBag.Title = "Cancel";
}
@if (Model)
{
<h2>Registration Cancelled</h2>
<p>
Your account has been closed.
If you would like to re-register click @Html.ActionLink("here", "Index", "Register").
</p>
<p>Thanks!</p>
}
else
{
<h2>There was an error canceling your account.</h2>
} | @{
ViewBag.Title = "Cancel";
}
<h2>Registration Cancelled</h2>
<p>
Your account has been closed.
If you would like to re-register click @Html.ActionLink("here", "Index", "Register").
</p>
<p>Thanks!</p> | bsd-3-clause | C# |
3775b5968de544abf14f646b19e79cc8912f42d7 | Fix potential memory leaks with FlatProgressBar color brush | chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck | Core/Controls/FlatProgressBar.cs | Core/Controls/FlatProgressBar.cs | using System.Drawing;
using System.Windows.Forms;
namespace TweetDck.Core.Controls{
public partial class FlatProgressBar : ProgressBar{
private readonly SolidBrush brush;
public FlatProgressBar(){
brush = new SolidBrush(Color.White);
SetStyle(ControlStyles.UserPaint,true);
SetStyle(ControlStyles.OptimizedDoubleBuffer,true);
}
public void SetValueInstant(int value){
ControlExtensions.SetValueInstant(this,value);
}
protected override void OnPaint(PaintEventArgs e){
if (brush.Color != ForeColor){
brush.Color = ForeColor;
}
Rectangle rect = e.ClipRectangle;
rect.Width = (int)(rect.Width*((double)Value/Maximum));
e.Graphics.FillRectangle(brush,rect);
}
protected override void Dispose(bool disposing){
base.Dispose(disposing);
if (disposing){
brush.Dispose();
}
}
}
}
| using System.Drawing;
using System.Windows.Forms;
namespace TweetDck.Core.Controls{
public partial class FlatProgressBar : ProgressBar{
private SolidBrush brush;
public FlatProgressBar(){
SetStyle(ControlStyles.UserPaint,true);
SetStyle(ControlStyles.OptimizedDoubleBuffer,true);
}
public void SetValueInstant(int value){
ControlExtensions.SetValueInstant(this,value);
}
protected override void OnPaint(PaintEventArgs e){
if (brush == null || brush.Color != ForeColor){
brush = new SolidBrush(ForeColor);
}
Rectangle rect = e.ClipRectangle;
rect.Width = (int)(rect.Width*((double)Value/Maximum));
e.Graphics.FillRectangle(brush,rect);
}
protected override void Dispose(bool disposing){
if (brush != null)brush.Dispose();
base.Dispose(disposing);
}
}
}
| mit | C# |
8c39e61c7aea677c625522258ca8f60de555f2eb | Fix spelling | thedillonb/octokit.net,ivandrofly/octokit.net,gdziadkiewicz/octokit.net,Sarmad93/octokit.net,alfhenrik/octokit.net,octokit/octokit.net,M-Zuber/octokit.net,chunkychode/octokit.net,rlugojr/octokit.net,Sarmad93/octokit.net,SmithAndr/octokit.net,TattsGroup/octokit.net,khellang/octokit.net,alfhenrik/octokit.net,dampir/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,octokit-net-test-org/octokit.net,TattsGroup/octokit.net,shana/octokit.net,octokit/octokit.net,rlugojr/octokit.net,dampir/octokit.net,SamTheDev/octokit.net,SamTheDev/octokit.net,chunkychode/octokit.net,ivandrofly/octokit.net,devkhan/octokit.net,eriawan/octokit.net,editor-tools/octokit.net,SmithAndr/octokit.net,shiftkey-tester/octokit.net,shiftkey/octokit.net,M-Zuber/octokit.net,gdziadkiewicz/octokit.net,editor-tools/octokit.net,thedillonb/octokit.net,eriawan/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,adamralph/octokit.net,shana/octokit.net,shiftkey/octokit.net,devkhan/octokit.net,khellang/octokit.net,shiftkey-tester/octokit.net,octokit-net-test-org/octokit.net | Octokit.Tests.Integration/Helpers/ReferenceExtensionsTests.cs | Octokit.Tests.Integration/Helpers/ReferenceExtensionsTests.cs | using Octokit.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Octokit.Tests.Integration.Helpers
{
public class ReferenceExtensionsTests
{
[IntegrationTest]
public async Task CreateABranch()
{
var client = Helper.GetAuthenticatedClient();
var fixture = client.Git.Reference;
using (var context = await client.CreateRepositoryContext("public-repo"))
{
var branchFromMaster = await fixture.CreateBranch(context.RepositoryOwner, context.RepositoryName, "patch-1");
var branchFromPath = await fixture.CreateBranch(context.RepositoryOwner, context.RepositoryName, "patch-2", branchFromMaster);
var allBranchNames = (await client.Repository.GetAllBranches(context.RepositoryOwner, context.RepositoryName)).Select(b => b.Name);
Assert.Contains("patch-1", allBrancheNames);
Assert.Contains("patch-2", allBrancheNames);
}
}
}
}
| using Octokit.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Octokit.Tests.Integration.Helpers
{
public class ReferenceExtensionsTests
{
[IntegrationTest]
public async Task CreateABranch()
{
var client = Helper.GetAuthenticatedClient();
var fixture = client.Git.Reference;
using (var context = await client.CreateRepositoryContext("public-repo"))
{
var branchFromMaster = await fixture.CreateBranch(context.RepositoryOwner, context.RepositoryName, "patch-1");
var branchFromPath = await fixture.CreateBranch(context.RepositoryOwner, context.RepositoryName, "patch-2", branchFromMaster);
var allBrancheNames = (await client.Repository.GetAllBranches(context.RepositoryOwner, context.RepositoryName)).Select(b => b.Name);
Assert.Contains("patch-1", allBrancheNames);
Assert.Contains("patch-2", allBrancheNames);
}
}
}
}
| mit | C# |
eb1e747452d1c01d00b0c9a2d1cf7a34d1608675 | Use index initializer. | mthamil/SharpEssentials | SharpEssentials.Tests.Unit/SharpEssentials/Collections/DictionaryExtensionsTests.cs | SharpEssentials.Tests.Unit/SharpEssentials/Collections/DictionaryExtensionsTests.cs | using System.Collections.Generic;
using SharpEssentials.Collections;
using Xunit;
namespace SharpEssentials.Tests.Unit.SharpEssentials.Collections
{
public class DictionaryExtensionsTests
{
[Fact]
public void Test_TryGetValue_Key_Exists()
{
// Arrange.
var dict = new Dictionary<int, string> { [5] = "value" };
// Act.
var result = dict.TryGetValue(5);
// Assert.
Assert.True(result.HasValue);
Assert.Equal("value", result.Value);
}
[Fact]
public void Test_TryGetValue_Key_DoesNotExist()
{
// Arrange.
var dict = new Dictionary<int, string> { [5] = "value" };
// Act.
var result = dict.TryGetValue(2);
// Assert.
Assert.False(result.HasValue);
}
}
} | using System.Collections.Generic;
using SharpEssentials.Collections;
using Xunit;
namespace SharpEssentials.Tests.Unit.SharpEssentials.Collections
{
public class DictionaryExtensionsTests
{
[Fact]
public void Test_TryGetValue_Key_Exists()
{
// Arrange.
var dict = new Dictionary<int, string> { { 5, "value" } };
// Act.
var result = dict.TryGetValue(5);
// Assert.
Assert.True(result.HasValue);
Assert.Equal("value", result.Value);
}
[Fact]
public void Test_TryGetValue_Key_DoesNotExist()
{
// Arrange.
var dict = new Dictionary<int, string> { { 5, "value" } };
// Act.
var result = dict.TryGetValue(2);
// Assert.
Assert.False(result.HasValue);
}
}
} | apache-2.0 | C# |
a31bbcaf98daef396aeae7bb6a9abd71244ffc5b | Remove method from DiceException, as it's probably not needed | skizzerz/DiceRoller | DiceRollerCs/DiceException.cs | DiceRollerCs/DiceException.cs | using System;
using System.Runtime.Serialization;
namespace Dice
{
/// <summary>
/// Represents an error with the user-inputted dice expression. These errors should generally
/// be made visible to the user in some fashion to let them know to adjust their dice expression.
/// Errors which indicate bugs in the library or are programmer errors do not use this exception type.
/// </summary>
public class DiceException : Exception
{
public DiceErrorCode ErrorCode { get; protected set; }
public DiceException(DiceErrorCode error)
: base(error.GetDescriptionString())
{
ErrorCode = error;
}
public DiceException(DiceErrorCode error, object param)
: base(String.Format(error.GetDescriptionString(), param))
{
ErrorCode = error;
}
public DiceException(DiceErrorCode error, Exception innerException)
: base(error.GetDescriptionString(), innerException)
{
ErrorCode = error;
}
public DiceException(DiceErrorCode error, object param, Exception innerException)
: base(String.Format(error.GetDescriptionString(), param), innerException)
{
ErrorCode = error;
}
}
}
| using System;
using System.Runtime.Serialization;
namespace Dice
{
/// <summary>
/// Represents an error with the user-inputted dice expression. These errors should generally
/// be made visible to the user in some fashion to let them know to adjust their dice expression.
/// Errors which indicate bugs in the library or are programmer errors do not use this exception type.
/// </summary>
public class DiceException : Exception
{
public DiceErrorCode ErrorCode { get; protected set; }
public DiceException(DiceErrorCode error)
: base(error.GetDescriptionString())
{
ErrorCode = error;
}
public DiceException(DiceErrorCode error, object param)
: base(String.Format(error.GetDescriptionString(), param))
{
ErrorCode = error;
}
public DiceException(DiceErrorCode error, Exception innerException)
: base(error.GetDescriptionString(), innerException)
{
ErrorCode = error;
}
public DiceException(DiceErrorCode error, object param, Exception innerException)
: base(String.Format(error.GetDescriptionString(), param), innerException)
{
ErrorCode = error;
}
protected DiceException(SerializationInfo info, StreamingContext context)
: base(info, context) { }
}
}
| mit | C# |
07aa2918a3446a3bdabbb40b07e2663528d5afd8 | Add unit test for AuthSettings class | solomobro/Instagram,solomobro/Instagram,solomobro/Instagram | src/Solomobro.Instagram.Tests/WebApi/AuthSettingsTests.cs | src/Solomobro.Instagram.Tests/WebApi/AuthSettingsTests.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Solomobro.Instagram.WebApiDemo.Settings;
namespace Solomobro.Instagram.Tests.WebApi
{
[TestFixture]
public class AuthSettingsTests
{
const string Settings = @"#Instagram Settings
InstaWebsiteUrl=https://github.com/solomobro/Instagram
InstaClientId=<CLIENT-ID>
InstaClientSecret=<CLIENT-SECRET>
InstaRedirectUrl=http://localhost:56841/api/authorize";
[Test]
public void AllAuthSettingsPropertiesAreSet()
{
Assert.That(AuthSettings.InstaClientId, Is.Null);
Assert.That(AuthSettings.InstaClientSecret, Is.Null);
Assert.That(AuthSettings.InstaRedirectUrl, Is.Null);
Assert.That(AuthSettings.InstaWebsiteUrl, Is.Null);
using (var memStream = new MemoryStream(Encoding.ASCII.GetBytes(Settings)))
{
AuthSettings.LoadSettings(memStream);
}
Assert.That(AuthSettings.InstaClientId, Is.Not.Null);
Assert.That(AuthSettings.InstaClientSecret, Is.Not.Null);
Assert.That(AuthSettings.InstaRedirectUrl, Is.Not.Null);
Assert.That(AuthSettings.InstaWebsiteUrl, Is.Not.Null);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace Solomobro.Instagram.Tests.WebApi
{
[TestFixture]
public class AuthSettingsTests
{
//WebApiDemo.Settings.EnvironmentManager.
}
}
| apache-2.0 | C# |
a0b1b04a9a7d095c8ecd8058b80a017cecf4a51f | clean up code | IvanZheng/IFramework,IvanZheng/IFramework,IvanZheng/IFramework | Src/Sample/Sample.CommandServiceCore/CommandInputExtension/FormDataInputFormatter.cs | Src/Sample/Sample.CommandServiceCore/CommandInputExtension/FormDataInputFormatter.cs | using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Net.Http.Headers;
namespace Sample.CommandServiceCore.CommandInputExtension
{
public class FormDataInputFormatter : TextInputFormatter
{
private const string MultipartFormData = "multipart/form-data";
private const string ApplicationFormUrlEncodedFormMediaType = "application/x-www-form-urlencoded";
public FormDataInputFormatter()
{
SupportedMediaTypes.Add(new MediaTypeHeaderValue(ApplicationFormUrlEncodedFormMediaType));
SupportedMediaTypes.Add(new MediaTypeHeaderValue(MultipartFormData));
SupportedEncodings.Add(UTF8EncodingWithoutBOM);
SupportedEncodings.Add(UTF16EncodingLittleEndian);
}
public override Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context, Encoding encoding)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
encoding = encoding ?? SelectCharacterEncoding(context);
if (encoding == null)
{
throw new ArgumentNullException(nameof(encoding));
}
var request = context.HttpContext.Request;
try
{
object inputModel = null;
var formCollection = request.Form.ToDictionary(f => f.Key, f => f.Value.ToString());
if (formCollection.Count > 0 && FormUrlEncodedJson.TryParse(formCollection, out var jObject))
{
inputModel = jObject.ToObject(context.ModelType);
}
return Task.FromResult(inputModel != null ? InputFormatterResult.Success(inputModel) : InputFormatterResult.Failure());
}
catch (Exception)
{
return Task.FromResult(InputFormatterResult.Failure());
}
}
}
} | using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Net.Http.Headers;
namespace Sample.CommandServiceCore.CommandInputExtension
{
public class FormDataInputFormatter : TextInputFormatter
{
private const string MultipartFormData = "multipart/form-data";
private const string ApplicationFormUrlEncodedFormMediaType = "application/x-www-form-urlencoded";
public FormDataInputFormatter()
{
SupportedMediaTypes.Add(new MediaTypeHeaderValue(ApplicationFormUrlEncodedFormMediaType));
SupportedMediaTypes.Add(new MediaTypeHeaderValue(MultipartFormData));
SupportedEncodings.Add(UTF8EncodingWithoutBOM);
SupportedEncodings.Add(UTF16EncodingLittleEndian);
}
public override Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context, Encoding encoding)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
encoding = encoding ?? SelectCharacterEncoding(context);
if (encoding == null)
{
throw new ArgumentNullException(nameof(encoding));
}
var request = context.HttpContext.Request;
try
{
object inputModel = null;
if (FormUrlEncodedJson.TryParse(request.Form.ToDictionary(f => f.Key, f => f.Value.ToString()), out var jObject))
{
inputModel = jObject.ToObject(context.ModelType);
}
return Task.FromResult(inputModel != null ? InputFormatterResult.Success(inputModel) : InputFormatterResult.Failure());
}
catch (Exception)
{
return Task.FromResult(InputFormatterResult.Failure());
}
}
}
} | mit | C# |
e395fd9e742e6d73c2e39a32fff863a26da10373 | Update LoginForm.cs | redeqn/RedConn | RedConn/LoginForm.cs | RedConn/LoginForm.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace RedConn
{
public partial class LoginForm : Form
{
public LoginForm(bool isDeterminateCompletionByEvent = false)
{
InitializeComponent();
IE.Navigate("https://150617-dot-starkappcloud.appspot.com/app/?api=1");
if (isDeterminateCompletionByEvent) return;
while (IE.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
}
public void ShowLogin()
{
IE.Refresh();
mShowAllowed = true;
this.ShowDialog();
}
private bool mShowAllowed = false;
protected override void SetVisibleCore(bool value)
{
if (!mShowAllowed) value = false;
base.SetVisibleCore(value);
}
public WebBrowser Explorer
{
get { return this.IE; }
}
private void Browser_Load(object sender, EventArgs e)
{
}
private void LoginForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
this.Hide();
e.Cancel = true;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace RedConn
{
public partial class LoginForm : Form
{
public LoginForm(bool isForAutoCAD = false)
{
InitializeComponent();
IE.Navigate("https://150617-dot-starkappcloud.appspot.com/app/?api=1");
if (isForAutoCAD) return;
while (IE.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
}
public void ShowLogin()
{
IE.Refresh();
mShowAllowed = true;
this.ShowDialog();
}
private bool mShowAllowed = false;
protected override void SetVisibleCore(bool value)
{
if (!mShowAllowed) value = false;
base.SetVisibleCore(value);
}
public WebBrowser Explorer
{
get { return this.IE; }
}
private void Browser_Load(object sender, EventArgs e)
{
}
private void LoginForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
this.Hide();
e.Cancel = true;
}
}
}
}
| mit | C# |
12c973ccb3ff97e2b9bc71a7ff20bf0ff8ebf0c0 | fix bug | at0717/FFmpegSharp | FFmpegSharp/Filters/FilterBase.cs | FFmpegSharp/Filters/FilterBase.cs | using System;
using FFmpegSharp.Media;
namespace FFmpegSharp.Filters
{
public abstract class FilterBase : IFilter
{
public MediaStream Source = null;
public int Rank { get; protected set; }
public string Name { get; protected set; }
protected FilterType FilterType { get; set; }
protected FilterBase()
{
Rank = 9;
}
protected virtual void ValidateVideoStream()
{
if(null == Source)
throw new ApplicationException("source file is null.");
if(null == Source.VideoInfo)
throw new ApplicationException("non video stream found in source file.");
}
protected virtual void ValidateAudioStream()
{
if (null == Source)
throw new ApplicationException("source file is null.");
if (null == Source.AudioInfo)
throw new ApplicationException("non audio stream found in source file.");
}
public string Execute()
{
switch (FilterType)
{
case FilterType.Audio:
ValidateAudioStream();
break;
case FilterType.Video:
ValidateVideoStream();
break;
default:
throw new ApplicationException("unknown filter type.");
}
return ToString();
}
}
}
| using System;
using FFmpegSharp.Media;
namespace FFmpegSharp.Filters
{
public abstract class FilterBase : IFilter
{
public MediaStream Source = null;
public int Rank { get; protected set; }
public string Name { get; protected set; }
protected FilterType FilterType { get; set; }
protected FilterBase()
{
Rank = 9;
}
protected virtual void ValidateVideoStream()
{
if(null == Source)
throw new ApplicationException("source file is null.");
if(null == Source.VideoInfo)
throw new ApplicationException("non video stream found in source file.");
}
protected virtual void ValidateAudioStream()
{
if (null == Source)
throw new ApplicationException("source file is null.");
if (null == Source.VideoInfo)
throw new ApplicationException("non audio stream found in source file.");
}
public string Execute()
{
switch (FilterType)
{
case FilterType.Audio:
ValidateAudioStream();
break;
case FilterType.Video:
ValidateVideoStream();
break;
default:
throw new ApplicationException("unknown filter type.");
}
return ToString();
}
}
} | mit | C# |
eb93bd911a4fcad5aee1132f8b2520f492f820a2 | Fix of svg format | TheCodeCleaner/HostMe | HostMe/StaticContentController.cs | HostMe/StaticContentController.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using log4net;
namespace HostMe
{
public class StaticContentController : ApiController
{
private readonly ILog _logger = Logger.GetLogger();
private static readonly Dictionary<string, string> MediaTypesFixes
= new Dictionary<string, string> { {".svg", "image/svg+xml" } };
public static string SiteRootPath { get; set; }
[EnableCors("*", "*", "*")]
[Route("{*path}")]
public HttpResponseMessage GetContent(string path)
{
_logger.Info("Got request. path = " + path);
var absolutePath = GetAbsolutePath(path);
_logger.Info("Absolute path = " + absolutePath);
try
{
var response = PrepareResponseForPath(absolutePath);
_logger.InfoFormat("Response for {0} sent!", path);
return response;
}
catch (Exception exception)
{
_logger.Warn(absolutePath + " could not be parsed.", exception);
_logger.Warn("Responding with Bad Request!");
throw new HttpResponseException(HttpStatusCode.BadRequest);
}
}
private HttpResponseMessage PrepareResponseForPath(string path)
{
var content = File.ReadAllBytes(path);
_logger.Info("Content read from: " + path);
var filePath = Path.GetFileName(path);
var extension = Path.GetExtension(filePath);
var mediaType = MimeMapping.GetMimeMapping(filePath);
if (MediaTypesFixes.ContainsKey(extension))
mediaType = MediaTypesFixes[extension];
_logger.Info("Media Type found = " + mediaType);
var response = new HttpResponseMessage
{
Content = new ByteArrayContent(content)
};
response.Content.Headers.ContentType = new MediaTypeHeaderValue(mediaType);
return response;
}
private static string GetAbsolutePath(string path)
{
if (path == null)
path = "index.html";
return Path.Combine(SiteRootPath, path);
}
}
}
| using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using log4net;
namespace HostMe
{
public class StaticContentController : ApiController
{
private readonly ILog _logger = Logger.GetLogger();
public static string SiteRootPath { get; set; }
[EnableCors("*", "*", "*")]
[Route("{*path}")]
public HttpResponseMessage GetContent(string path)
{
_logger.Info("Got request. path = " + path);
var absolutePath = GetAbsolutePath(path);
_logger.Info("Absolute path = " + absolutePath);
try
{
var response = PrepareResponseForPath(absolutePath);
_logger.InfoFormat("Response for {0} sent!", path);
return response;
}
catch (Exception exception)
{
_logger.Warn(absolutePath + " could not be parsed.", exception);
_logger.Warn("Responding with Bad Request!");
throw new HttpResponseException(HttpStatusCode.BadRequest);
}
}
private HttpResponseMessage PrepareResponseForPath(string path)
{
var content = File.ReadAllBytes(path);
_logger.Info("Content read from: " + path);
var mediaType = MimeMapping.GetMimeMapping(Path.GetFileName(path));
_logger.Info("Media Type found = " + mediaType);
var response = new HttpResponseMessage
{
Content = new ByteArrayContent(content)
};
response.Content.Headers.ContentType = new MediaTypeHeaderValue(mediaType);
return response;
}
private static string GetAbsolutePath(string path)
{
if (path == null)
path = "index.html";
return Path.Combine(SiteRootPath, path);
}
}
}
| mit | C# |
b4a190f2698acc79bb32f1482229f5ffbc3b0905 | Clean a few things | mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp | binding/Binding/SkiaApi.cs | binding/Binding/SkiaApi.cs | using System;
namespace SkiaSharp
{
internal partial class SkiaApi
{
#if __TVOS__ && __UNIFIED__
private const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
#elif __WATCHOS__ && __UNIFIED__
private const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
#elif __IOS__ && __UNIFIED__
private const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
#elif __ANDROID__
private const string SKIA = "libSkiaSharp.so";
#elif __MACOS__
private const string SKIA = "libSkiaSharp.dylib";
#elif WINDOWS_UWP
private const string SKIA = "libSkiaSharp.dll";
#elif __TIZEN__
private const string SKIA = "libSkiaSharp.so";
#else
private const string SKIA = "libSkiaSharp";
#endif
#if USE_DELEGATES
private static readonly Lazy<IntPtr> libSkiaSharpHandle =
new Lazy<IntPtr> (() => LibraryLoader.LoadLocalLibrary<SkiaApi> (SKIA));
private static T Get<T> (string name) where T : Delegate =>
LibraryLoader.GetSymbolDelegate<T> (libSkiaSharpHandle.Value, name);
#endif
}
}
| using System;
namespace SkiaSharp
{
internal partial class SkiaApi
{
#if __TVOS__ && __UNIFIED__
private const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
#elif __WATCHOS__ && __UNIFIED__
private const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
#elif __IOS__ && __UNIFIED__
private const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
#elif __ANDROID__
private const string SKIA = "libSkiaSharp.so";
#elif __MACOS__
private const string SKIA = "libSkiaSharp.dylib";
#elif __DESKTOP__
private const string SKIA = "libSkiaSharp";
#elif WINDOWS_UWP
private const string SKIA = "libSkiaSharp.dll";
#elif NET_STANDARD
private const string SKIA = "libSkiaSharp";
#else
private const string SKIA = "libSkiaSharp";
#endif
#if USE_DELEGATES
private static IntPtr libSkiaSharpHandle;
private static T Get<T> (string name)
where T : Delegate
{
if (libSkiaSharpHandle == IntPtr.Zero)
libSkiaSharpHandle = LibraryLoader.LoadLocalLibrary<SkiaApi> (SKIA);
return LibraryLoader.GetSymbolDelegate<T> (libSkiaSharpHandle, name);
}
#endif
}
}
| mit | C# |
86fa38aa5f6118db2a8911306bdc5c0528763d82 | Change "ByteArray" to "Byte Array". Work Item #1985 | CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork | trunk/Solutions/CslaGenFork/Metadata/TypeCodeEx.cs | trunk/Solutions/CslaGenFork/Metadata/TypeCodeEx.cs | using System.ComponentModel;
using CslaGenerator.Design;
namespace CslaGenerator.Metadata
{
/// <summary>
/// Summary description for TypeCodeEx.
/// </summary>
[TypeConverter(typeof(EnumDescriptionConverter))]
public enum TypeCodeEx
{
Empty,
[Description("Custom Type")]
CustomType,
Boolean,
Byte,
[Description("Byte Array")]
ByteArray,
Char,
DateTime,
DateTimeOffset,
DBNull,
Decimal,
Double,
Guid,
Int16,
Int32,
Int64,
Object,
SByte,
Single,
SmartDate,
String,
TimeSpan,
UInt16,
UInt32,
UInt64
}
} | using System.ComponentModel;
using CslaGenerator.Design;
namespace CslaGenerator.Metadata
{
/// <summary>
/// Summary description for TypeCodeEx.
/// </summary>
[TypeConverter(typeof(EnumDescriptionConverter))]
public enum TypeCodeEx
{
Empty,
[Description("Custom Type")]
CustomType,
Boolean,
Byte,
ByteArray,
Char,
DateTime,
DateTimeOffset,
DBNull,
Decimal,
Double,
Guid,
Int16,
Int32,
Int64,
Object,
SByte,
Single,
SmartDate,
String,
TimeSpan,
UInt16,
UInt32,
UInt64
}
} | mit | C# |
e9ce7cab8129a1fc886cbdc61b89d456e138b542 | Fix typos | earalov/Skylines-ElevatedTrainStationTrack | Options.cs | Options.cs |
using MetroOverhaul.Detours;
using MetroOverhaul.OptionsFramework.Attibutes;
namespace MetroOverhaul
{
[Options("MetroOverhaul")]
public class Options
{
private const string WIP = "WIP features";
private const string STYLES = "Additional styles";
public Options()
{
#if DEBUG
steelTracks = false;
steelTracksNoBar = false;
#endif
concreteTracksNoBar = true;
improvedPassengerTrainAi = true;
improvedMetroTrainAi = true;
metroUi = true;
replaceExistingNetworks = false;
}
[Checkbox("Concrete tracks (no fence)", STYLES)]
public bool concreteTracksNoBar { set; get; }
[Checkbox("Metro track customization UI (requires reloading from main menu)")]
public bool metroUi { set; get; }
[Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", null, nameof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))]
public bool improvedPassengerTrainAi { set; get; }
[Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", null, nameof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))]
public bool improvedMetroTrainAi { set; get; }
[Checkbox("Replace vanilla metro tracks with MOM tracks", WIP)]
public bool replaceExistingNetworks { set; get; }
#if DEBUG
[Checkbox("Steel tracks", STYLES)]
public bool steelTracks { set; get; }
[Checkbox("Steel tracks (no fence)", STYLES)]
public bool steelTracksNoBar { set; get; }
#endif
}
} |
using MetroOverhaul.Detours;
using MetroOverhaul.OptionsFramework.Attibutes;
namespace MetroOverhaul
{
[Options("MetroOverhaul")]
public class Options
{
private const string WIP = "WIP features";
private const string STYLES = "Additional tyles";
public Options()
{
#if DEBUG
steelTracks = false;
steelTracksNoBar = false;
#endif
concreteTracksNoBar = true;
improvedPassengerTrainAi = true;
improvedMetroTrainAi = true;
metroUi = true;
replaceExistingNetworks = false;
}
[Checkbox("Concrete tracks (no fence)", STYLES)]
public bool concreteTracksNoBar { set; get; }
[Checkbox("Metro track customization UI (requires reloading from main menu)")]
public bool metroUi { set; get; }
[Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", nameof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))]
public bool improvedPassengerTrainAi { set; get; }
[Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", nameof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))]
public bool improvedMetroTrainAi { set; get; }
[Checkbox("Replace vanilla metro tracks with MOM tracks", WIP)]
public bool replaceExistingNetworks { set; get; }
#if DEBUG
[Checkbox("Steel tracks", STYLES)]
public bool steelTracks { set; get; }
[Checkbox("Steel tracks (no fence)", STYLES)]
public bool steelTracksNoBar { set; get; }
#endif
}
} | mit | C# |
790a66a4188412b8aac95ff4a6f8118fa794e03a | Update PromoContext.cs | denmerc/mongoSamples | MongoSampleTests/PromoContext.cs | MongoSampleTests/PromoContext.cs | using Domain;
using MongoDB.Bson.Serialization;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MongoSampleTests
{
public class PromoContext
{
private const string connectionString = "";
private const string databaseName = "promo";
private const string TagsCollectionName = "tags";
//public MongoDatabase Database;
private MongoClient client { get; set; }
protected MongoServer server { get; set; }
protected MongoDatabase database { get; set; }
public PromoContext()
{
// create some fixtures and a connection
client = new MongoClient(connectionString);
server = client.GetServer();
database = server.GetDatabase(databaseName);
}
public MongoCollection<Tag> Tags
{
get
{
return database.GetCollection<Tag>("tags");
}
}
public MongoCollection<Filter> Filters
{
get
{
return database.GetCollection<Filter>("filters");
}
}
public MongoCollection<Analytic> Analytics
{
get
{
return database.GetCollection<Analytic>("analytics");
}
}
}
}
| using Domain;
using MongoDB.Bson.Serialization;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MongoSampleTests
{
public class PromoContext
{
private const string connectionString = "mongodb://promoUser:[email protected]:27829/promo";
private const string databaseName = "promo";
private const string TagsCollectionName = "tags";
//public MongoDatabase Database;
private MongoClient client { get; set; }
protected MongoServer server { get; set; }
protected MongoDatabase database { get; set; }
public PromoContext()
{
// create some fixtures and a connection
client = new MongoClient(connectionString);
server = client.GetServer();
database = server.GetDatabase(databaseName);
}
public MongoCollection<Tag> Tags
{
get
{
return database.GetCollection<Tag>("tags");
}
}
public MongoCollection<Filter> Filters
{
get
{
return database.GetCollection<Filter>("filters");
}
}
public MongoCollection<Analytic> Analytics
{
get
{
return database.GetCollection<Analytic>("analytics");
}
}
}
}
| apache-2.0 | C# |
273ed5678f8cb6583e67e17a050532a33454d19f | Set default values (to avoid null references for invalid user data) | nwoolls/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner | MultiMiner.Xgminer/MiningPool.cs | MultiMiner.Xgminer/MiningPool.cs | using System;
namespace MultiMiner.Xgminer
{
//marked Serializable to allow deep cloning of CoinConfiguration
[Serializable]
public class MiningPool
{
public MiningPool()
{
//set defaults
Host = String.Empty;
Username = String.Empty;
Password = String.Empty;
}
public string Host { get; set; }
public int Port { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public int Quota { get; set; } //see bfgminer README about quotas
}
}
| using System;
namespace MultiMiner.Xgminer
{
//marked Serializable to allow deep cloning of CoinConfiguration
[Serializable]
public class MiningPool
{
public string Host { get; set; }
public int Port { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public int Quota { get; set; } //see bfgminer README about quotas
}
}
| mit | C# |
f85be6a0c091abc80e6ab8f6d15a81d5ae4794b9 | fix typo in ApiController XMLDoc | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNetCore.Mvc.Core/ApiControllerAttribute.cs | src/Microsoft.AspNetCore.Mvc.Core/ApiControllerAttribute.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc
{
/// <summary>
/// Indicates that a type and all derived types are used to serve HTTP API responses. The presence of
/// this attribute can be used to target conventions, filters and other behaviors based on the purpose
/// of the controller.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class ApiControllerAttribute : ControllerAttribute, IApiBehaviorMetadata
{
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc
{
/// <summary>
/// Indicates that a type and all derived types are used to serve HTTP API responses. The presense of
/// this attribute can be used to target conventions, filters and other behaviors based on the purpose
/// of the controller.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class ApiControllerAttribute : ControllerAttribute, IApiBehaviorMetadata
{
}
}
| apache-2.0 | C# |
162e50b1128f8b3f9ab936035ce7a89ab91fabc1 | Fix package id version checking during pack - The logic wasn't in sync with nuget.exe | jaredpar/cli,jonsequitur/cli,mlorbetske/cli,naamunds/cli,ravimeda/cli,gkhanna79/cli,AbhitejJohn/cli,harshjain2/cli,EdwardBlair/cli,FubarDevelopment/cli,jonsequitur/cli,blackdwarf/cli,AbhitejJohn/cli,mylibero/cli,krwq/cli,marono/cli,ravimeda/cli,FubarDevelopment/cli,mylibero/cli,mylibero/cli,livarcocc/cli-1,mlorbetske/cli,krwq/cli,JohnChen0/cli,naamunds/cli,danquirk/cli,gkhanna79/cli,krwq/cli,MichaelSimons/cli,MichaelSimons/cli,EdwardBlair/cli,livarcocc/cli-1,blackdwarf/cli,JohnChen0/cli,gkhanna79/cli,weshaggard/cli,schellap/cli,marono/cli,nguerrera/cli,svick/cli,weshaggard/cli,naamunds/cli,weshaggard/cli,mlorbetske/cli,MichaelSimons/cli,jaredpar/cli,jkotas/cli,gkhanna79/cli,dasMulli/cli,mylibero/cli,borgdylan/dotnet-cli,svick/cli,schellap/cli,jaredpar/cli,jkotas/cli,stuartleeks/dotnet-cli,anurse/Cli,borgdylan/dotnet-cli,JohnChen0/cli,blackdwarf/cli,jaredpar/cli,FubarDevelopment/cli,johnbeisner/cli,Faizan2304/cli,jonsequitur/cli,jaredpar/cli,harshjain2/cli,marono/cli,gkhanna79/cli,schellap/cli,dasMulli/cli,naamunds/cli,blackdwarf/cli,JohnChen0/cli,AbhitejJohn/cli,danquirk/cli,borgdylan/dotnet-cli,danquirk/cli,jaredpar/cli,dasMulli/cli,borgdylan/dotnet-cli,svick/cli,Faizan2304/cli,mlorbetske/cli,nguerrera/cli,stuartleeks/dotnet-cli,MichaelSimons/cli,nguerrera/cli,jonsequitur/cli,weshaggard/cli,harshjain2/cli,krwq/cli,schellap/cli,stuartleeks/dotnet-cli,schellap/cli,marono/cli,jkotas/cli,stuartleeks/dotnet-cli,MichaelSimons/cli,borgdylan/dotnet-cli,mylibero/cli,jkotas/cli,krwq/cli,livarcocc/cli-1,ravimeda/cli,danquirk/cli,johnbeisner/cli,stuartleeks/dotnet-cli,naamunds/cli,schellap/cli,nguerrera/cli,AbhitejJohn/cli,Faizan2304/cli,danquirk/cli,FubarDevelopment/cli,johnbeisner/cli,weshaggard/cli,jkotas/cli,EdwardBlair/cli,marono/cli | src/Microsoft.DotNet.Tools.Pack/NuGet/PackageIdValidator.cs | src/Microsoft.DotNet.Tools.Pack/NuGet/PackageIdValidator.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.Globalization;
using System.Text.RegularExpressions;
namespace NuGet
{
public static class PackageIdValidator
{
private static readonly Regex _idRegex = new Regex(@"^\w+([_.-]\w+)*$", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
internal const int MaxPackageIdLength = 100;
public static bool IsValidPackageId(string packageId)
{
if (packageId == null)
{
throw new ArgumentNullException("packageId");
}
return _idRegex.IsMatch(packageId);
}
public static void ValidatePackageId(string packageId)
{
if (packageId.Length > MaxPackageIdLength)
{
// TODO: Resources
throw new ArgumentException("NuGetResources.Manifest_IdMaxLengthExceeded");
}
if (!IsValidPackageId(packageId))
{
// TODO: Resources
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "NuGetResources.InvalidPackageId", packageId));
}
}
}
} | // 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.Globalization;
namespace NuGet
{
public static class PackageIdValidator
{
internal const int MaxPackageIdLength = 100;
public static bool IsValidPackageId(string packageId)
{
if (string.IsNullOrWhiteSpace(packageId))
{
throw new ArgumentException(nameof(packageId));
}
// Rules:
// Should start with a character
// Can be followed by '.' or '-'. Cannot have 2 of these special characters consecutively.
// Cannot end with '-' or '.'
var firstChar = packageId[0];
if (!char.IsLetterOrDigit(firstChar) && firstChar != '_')
{
// Should start with a char/digit/_.
return false;
}
var lastChar = packageId[packageId.Length - 1];
if (lastChar == '-' || lastChar == '.')
{
// Should not end with a '-' or '.'.
return false;
}
for (int index = 1; index < packageId.Length - 1; index++)
{
var ch = packageId[index];
if (!char.IsLetterOrDigit(ch) && ch != '-' && ch != '.')
{
return false;
}
if ((ch == '-' || ch == '.') && ch == packageId[index - 1])
{
// Cannot have two successive '-' or '.' in the name.
return false;
}
}
return true;
}
public static void ValidatePackageId(string packageId)
{
if (packageId.Length > MaxPackageIdLength)
{
// TODO: Resources
throw new ArgumentException("NuGetResources.Manifest_IdMaxLengthExceeded");
}
if (!IsValidPackageId(packageId))
{
// TODO: Resources
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "NuGetResources.InvalidPackageId", packageId));
}
}
}
} | mit | C# |
a0c1da647ed06478559cca86f783262b12510f52 | Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0. | autofac/Autofac.Extras.CommonServiceLocator | Properties/VersionAssemblyInfo.cs | Properties/VersionAssemblyInfo.cs | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.1.0")]
[assembly: AssemblyConfiguration("Release built on 2013-12-03 10:23")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Extras.CommonServiceLocator 3.0.1")]
| //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.1.0")]
[assembly: AssemblyConfiguration("Release built on 2013-10-23 22:48")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Extras.CommonServiceLocator 3.0.1")]
| mit | C# |
28652caeb6156522b2ee211868d5e1e966edc306 | Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0. | autofac/Autofac.Extras.AggregateService | Properties/VersionAssemblyInfo.cs | Properties/VersionAssemblyInfo.cs | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.2.0")]
[assembly: AssemblyConfiguration("Release built on 2013-12-03 10:23")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Extras.AggregateService 3.0.2")]
| //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.2.0")]
[assembly: AssemblyConfiguration("Release built on 2013-10-23 22:48")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Extras.AggregateService 3.0.2")]
| mit | C# |
468e2a8fa6bbc93a912e0a5049077ee36bca7ebf | Add an improved string representation of PackageBuild instances | markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation | Opus.Core/PackageBuildList.cs | Opus.Core/PackageBuildList.cs | // <copyright file="PackageBuildList.cs" company="Mark Final">
// Opus
// </copyright>
// <summary>Opus Core</summary>
// <author>Mark Final</author>
namespace Opus.Core
{
public class PackageBuild
{
public PackageBuild(PackageIdentifier id)
{
this.Name = id.Name;
this.Versions = new UniqueList<PackageIdentifier>();
this.Versions.Add(id);
this.SelectedVersion = id;
}
public string Name
{
get;
private set;
}
public UniqueList<PackageIdentifier> Versions
{
get;
private set;
}
public PackageIdentifier SelectedVersion
{
get;
set;
}
public override string ToString()
{
System.Text.StringBuilder builder = new System.Text.StringBuilder();
builder.AppendFormat("{0}: Package '{1}' with {2} versions", base.ToString(), this.Name, this.Versions.Count);
return builder.ToString();
}
}
public class PackageBuildList : UniqueList<PackageBuild>
{
public PackageBuild GetPackage(string name)
{
foreach (PackageBuild i in this)
{
if (i.Name == name)
{
return i;
}
}
return null;
}
}
} | // <copyright file="PackageBuildList.cs" company="Mark Final">
// Opus
// </copyright>
// <summary>Opus Core</summary>
// <author>Mark Final</author>
namespace Opus.Core
{
public class PackageBuild
{
public PackageBuild(PackageIdentifier id)
{
this.Name = id.Name;
this.Versions = new UniqueList<PackageIdentifier>();
this.Versions.Add(id);
this.SelectedVersion = id;
}
public string Name
{
get;
private set;
}
public UniqueList<PackageIdentifier> Versions
{
get;
private set;
}
public PackageIdentifier SelectedVersion
{
get;
set;
}
}
public class PackageBuildList : UniqueList<PackageBuild>
{
public PackageBuild GetPackage(string name)
{
foreach (PackageBuild i in this)
{
if (i.Name == name)
{
return i;
}
}
return null;
}
}
} | bsd-3-clause | C# |
ba215f8700f4487b3d6d325379c5087145eae6c8 | fix name to follow the class name | dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,NikRimington/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,NikRimington/Umbraco-CMS,madsoulswe/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,NikRimington/Umbraco-CMS,abryukhov/Umbraco-CMS,leekelleher/Umbraco-CMS,abryukhov/Umbraco-CMS,tcmorris/Umbraco-CMS,madsoulswe/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,mattbrailsford/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,leekelleher/Umbraco-CMS,madsoulswe/Umbraco-CMS,marcemarc/Umbraco-CMS | src/Umbraco.Web/Models/ContentEditing/DataTypeReferences.cs | src/Umbraco.Web/Models/ContentEditing/DataTypeReferences.cs | using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "dataTypeReferences", Namespace = "")]
public class DataTypeReferences
{
[DataMember(Name = "documentTypes")]
public IEnumerable<ContentTypeReferences> DocumentTypes { get; set; } = Enumerable.Empty<ContentTypeReferences>();
[DataMember(Name = "mediaTypes")]
public IEnumerable<ContentTypeReferences> MediaTypes { get; set; } = Enumerable.Empty<ContentTypeReferences>();
[DataMember(Name = "memberTypes")]
public IEnumerable<ContentTypeReferences> MemberTypes { get; set; } = Enumerable.Empty<ContentTypeReferences>();
[DataContract(Name = "contentType", Namespace = "")]
public class ContentTypeReferences : EntityBasic
{
[DataMember(Name = "properties")]
public object Properties { get; set; }
[DataContract(Name = "property", Namespace = "")]
public class PropertyTypeReferences
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
}
}
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "dataTypeUsages", Namespace = "")]
public class DataTypeReferences
{
[DataMember(Name = "documentTypes")]
public IEnumerable<ContentTypeReferences> DocumentTypes { get; set; } = Enumerable.Empty<ContentTypeReferences>();
[DataMember(Name = "mediaTypes")]
public IEnumerable<ContentTypeReferences> MediaTypes { get; set; } = Enumerable.Empty<ContentTypeReferences>();
[DataMember(Name = "memberTypes")]
public IEnumerable<ContentTypeReferences> MemberTypes { get; set; } = Enumerable.Empty<ContentTypeReferences>();
[DataContract(Name = "contentType", Namespace = "")]
public class ContentTypeReferences : EntityBasic
{
[DataMember(Name = "properties")]
public object Properties { get; set; }
[DataContract(Name = "property", Namespace = "")]
public class PropertyTypeReferences
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
}
}
}
}
| mit | C# |
3e0b43eeb7d31ed56c0fab33d665be5aa3f6ab86 | Update ExtractImagesFromWorksheets.cs | asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET | Examples/CSharp/Articles/ExtractImagesFromWorksheets.cs | Examples/CSharp/Articles/ExtractImagesFromWorksheets.cs | using System.IO;
using Aspose.Cells;
using Aspose.Cells.Rendering;
namespace Aspose.Cells.Examples.Articles
{
public class ExtractImagesFromWorksheets
{
public static void Main()
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Open a template Excel file
Workbook workbook = new Workbook(dataDir+ "book1.xls");
//Get the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Get the first Picture in the first worksheet
Aspose.Cells.Drawing.Picture pic = worksheet.Pictures[0];
//Set the output image file path
string fileName = dataDir+ "aspose-logo.out.Jpg";
string picformat = pic.ImageFormat.ToString();
//Note: you may evaluate the image format before specifying the image path
//Define ImageOrPrintOptions
ImageOrPrintOptions printoption = new ImageOrPrintOptions();
//Specify the image format
printoption.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
//Save the image
pic.ToImage(fileName, printoption);
//ExEnd:1
}
}
}
| using System.IO;
using Aspose.Cells;
using Aspose.Cells.Rendering;
namespace Aspose.Cells.Examples.Articles
{
public class ExtractImagesFromWorksheets
{
public static void Main()
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Open a template Excel file
Workbook workbook = new Workbook(dataDir+ "book1.xls");
//Get the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Get the first Picture in the first worksheet
Aspose.Cells.Drawing.Picture pic = worksheet.Pictures[0];
//Set the output image file path
string fileName = dataDir+ "aspose-logo.out.Jpg";
string picformat = pic.ImageFormat.ToString();
//Note: you may evaluate the image format before specifying the image path
//Define ImageOrPrintOptions
ImageOrPrintOptions printoption = new ImageOrPrintOptions();
//Specify the image format
printoption.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
//Save the image
pic.ToImage(fileName, printoption);
}
}
} | mit | C# |
3113f214bfd2a988de675fc2c1dd9aba84ac56d0 | add method to return a string of the webpage, decoded according to http headers | martinlindhe/ServiceTests,martinlindhe/ServiceTests | ServiceUnitTest/HttpTester.cs | ServiceUnitTest/HttpTester.cs | using System;
using System.Net;
using System.IO;
using System.Text;
using Punku;
// TODO make user agent changeable
namespace ServiceUnitTest
{
public class HttpTester
{
public static void Main ()
{
Console.WriteLine ("wowo");
var xx = HttpTester.FetchContentAsString ("http://battle.x/http_tester_webserver/xml.php");
Console.WriteLine (xx);
}
private static HttpWebResponse PerformFetch (string url)
{
if (!url.IsUrl ())
throw new FormatException ("not a URL");
var request = (HttpWebRequest)WebRequest.Create (url);
// disable auto redirect
request.AllowAutoRedirect = false;
// set timeout to 10 seconds
request.Timeout = 100000;
// send client headers
// IE 6
request.UserAgent = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
WebResponse response = request.GetResponse ();
return (HttpWebResponse)response;
}
/**
* @return HTTP status code for URL
*/
public static HttpStatusCode FetchStatusCode (string url)
{
try {
var response = PerformFetch (url);
// print response headers:
// Console.WriteLine (response.Headers);
var res = response.StatusCode;
response.Close ();
return res;
} catch (WebException ex) {
// HACK: for some reason, .NET throws an exception on 404 and 500 (maybe more)
HttpWebResponse webResponse = (HttpWebResponse)ex.Response;
var res = webResponse.StatusCode;
return res;
}
}
public static string FetchContentType (string url)
{
var response = PerformFetch (url);
return response.ContentType;
}
private static byte[] ReadResponseStream (Stream stream)
{
byte[] res = new byte[0];
using (var reader = new System.IO.BinaryReader (stream)) {
byte[] scratch = null;
while ((scratch = reader.ReadBytes (4096)).Length > 0) {
if (res.Length == 0)
res = scratch;
else {
byte[] temp = new byte[res.Length + scratch.Length];
Array.Copy (res, temp, res.Length);
Array.Copy (scratch, 0, temp, res.Length, scratch.Length);
res = temp;
}
}
}
return res;
}
public static byte[] FetchContent (string url)
{
var response = PerformFetch (url);
return ReadResponseStream (response.GetResponseStream ());
}
public static string FetchContentAsString (string url)
{
var response = PerformFetch (url);
byte[] bytes = ReadResponseStream (response.GetResponseStream ());
// TODO see HTTP headers for text encoding
// TODO handle non-utf8 encodings
return Encoding.UTF8.GetString (bytes);
}
}
}
| using System;
using System.Net;
using System.IO;
using Punku;
// TODO make user agent changeable
namespace ServiceUnitTest
{
public class HttpTester
{
public static void Main ()
{
Console.WriteLine ("wowo");
var xx = HttpTester.FetchStatusCode ("http://battle.x/http_tester_webserver/restricted.php");
Console.WriteLine (xx);
}
private static HttpWebResponse PerformFetch (string url)
{
if (!url.IsUrl ())
throw new FormatException ("not a URL");
var request = (HttpWebRequest)WebRequest.Create (url);
// disable auto redirect
request.AllowAutoRedirect = false;
// set timeout to 10 seconds
request.Timeout = 100000;
// send client headers
// IE 6
request.UserAgent = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
WebResponse response = request.GetResponse ();
return (HttpWebResponse)response;
}
/**
* @return HTTP status code for URL
*/
public static HttpStatusCode FetchStatusCode (string url)
{
try {
var response = PerformFetch (url);
// print response headers:
// Console.WriteLine (response.Headers);
var res = response.StatusCode;
response.Close ();
return res;
} catch (WebException ex) {
// HACK: for some reason, .NET throws an exception on 404 and 500 (maybe more)
HttpWebResponse webResponse = (HttpWebResponse)ex.Response;
var res = webResponse.StatusCode;
return res;
}
}
public static string FetchContentType (string url)
{
var response = PerformFetch (url);
return response.ContentType;
}
public static byte[] FetchContent (string url)
{
var response = PerformFetch (url);
byte[] res = new byte[0];
using (var reader = new System.IO.BinaryReader (response.GetResponseStream ())) {
byte[] scratch = null;
while ((scratch = reader.ReadBytes (4096)).Length > 0) {
if (res.Length == 0)
res = scratch;
else {
byte[] temp = new byte[res.Length + scratch.Length];
Array.Copy (res, temp, res.Length);
Array.Copy (scratch, 0, temp, res.Length, scratch.Length);
res = temp;
}
}
}
return res;
}
}
}
| mit | C# |
9cb3691aaf572da34622b3153e60c95f20513e42 | Fix commit b23c4ca2520d0778e5fc0a997cf32286a9bbec45 | StockSharp/StockSharp | Samples/Connectors/SampleConnection/ChartWindow.xaml.cs | Samples/Connectors/SampleConnection/ChartWindow.xaml.cs | namespace SampleConnection
{
using System;
using System.ComponentModel;
using System.Windows.Media;
using StockSharp.Algo;
using StockSharp.Algo.Candles;
using StockSharp.Xaml.Charting;
partial class ChartWindow
{
private readonly Connector _connector;
private readonly CandleSeries _candleSeries;
private readonly ChartCandleElement _candleElem;
private readonly Subscription _subscription;
public ChartWindow(CandleSeries candleSeries)
{
if (candleSeries == null)
throw new ArgumentNullException(nameof(candleSeries));
InitializeComponent();
Title = candleSeries.ToString();
_candleSeries = candleSeries;
_connector = MainWindow.Instance.MainPanel.Connector;
Chart.ChartTheme = ChartThemes.ExpressionDark;
var area = new ChartArea();
Chart.Areas.Add(area);
_candleElem = new ChartCandleElement
{
AntiAliasing = false,
UpFillColor = Colors.White,
UpBorderColor = Colors.Black,
DownFillColor = Colors.Black,
DownBorderColor = Colors.Black,
};
area.Elements.Add(_candleElem);
_connector.CandleSeriesProcessing += ProcessNewCandle;
_subscription = _connector.SubscribeCandles(_candleSeries);
}
public bool SeriesInactive { get; set; }
private void ProcessNewCandle(CandleSeries series, Candle candle)
{
if (series != _candleSeries)
return;
Chart.Draw(_candleElem, candle);
}
protected override void OnClosing(CancelEventArgs e)
{
_connector.CandleSeriesProcessing -= ProcessNewCandle;
if (!SeriesInactive && _subscription.State.IsActive())
_connector.UnSubscribe(_subscription);
base.OnClosing(e);
}
}
}
| namespace SampleConnection
{
using System;
using System.Windows.Media;
using StockSharp.Algo;
using StockSharp.Algo.Candles;
using StockSharp.Xaml.Charting;
partial class ChartWindow
{
private readonly Connector _connector;
private readonly CandleSeries _candleSeries;
private readonly ChartCandleElement _candleElem;
private readonly Subscription _subscription;
public ChartWindow(CandleSeries candleSeries)
{
if (candleSeries == null)
throw new ArgumentNullException(nameof(candleSeries));
InitializeComponent();
Title = candleSeries.ToString();
_candleSeries = candleSeries;
_connector = MainWindow.Instance.MainPanel.Connector;
Chart.ChartTheme = ChartThemes.ExpressionDark;
var area = new ChartArea();
Chart.Areas.Add(area);
_candleElem = new ChartCandleElement
{
AntiAliasing = false,
UpFillColor = Colors.White,
UpBorderColor = Colors.Black,
DownFillColor = Colors.Black,
DownBorderColor = Colors.Black,
};
area.Elements.Add(_candleElem);
_connector.CandleSeriesProcessing += ProcessNewCandle;
_subscription = _connector.SubscribeCandles(_candleSeries);
}
public bool SeriesInactive { get; set; }
private void ProcessNewCandle(CandleSeries series, Candle candle)
{
if (series != _candleSeries)
return;
Chart.Draw(_candleElem, candle);
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
_connector.CandleSeriesProcessing -= ProcessNewCandle;
if (!SeriesInactive && _subscription.State.IsActive())
_connector.UnSubscribeCandles(_candleSeries);
base.OnClosing(e);
}
}
}
| apache-2.0 | C# |
bac5088e04d6a12e065bd6c70aa5a6a30d4b7de8 | Add compatibility warning to VolatileNameTestMethodBuilder doc | sean-gilliam/AutoFixture,zvirja/AutoFixture,AutoFixture/AutoFixture,Pvlerick/AutoFixture | Src/AutoFixture.NUnit3/VolatileNameTestMethodBuilder.cs | Src/AutoFixture.NUnit3/VolatileNameTestMethodBuilder.cs | using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
using System.Diagnostics.CodeAnalysis;
using NUnit.Framework.Internal.Builders;
namespace Ploeh.AutoFixture.NUnit3
{
/// Creates <see cref="TestMethod"/> instances with name that includes actual argument values.
/// <para>
/// Notice, this strategy might break compatibility with some test runners that rely on stable test names
/// (e.g. Visual Studio with NUnit3TestAdapter, NCrunch), therefore use this strategy with caution.
/// </para>
public class VolatileNameTestMethodBuilder : ITestMethodBuilder
{
/// <inheritdoc />
public TestMethod Build(IMethodInfo method, Test suite, IEnumerable<object> parameterValues, int autoDataStartIndex)
{
if (method == null)
{
throw new ArgumentNullException(nameof(method));
}
if (parameterValues == null)
{
throw new ArgumentNullException(nameof(parameterValues));
}
return new NUnitTestCaseBuilder().BuildTestMethod(method, suite, GetParametersForMethod(parameterValues));
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
Justification = "This method is always expected to return an instance of the TestCaseParameters class.")]
private static TestCaseParameters GetParametersForMethod(IEnumerable<object> parameterValues)
{
try
{
return GetParametersForMethod(parameterValues.ToArray());
}
catch (Exception ex)
{
return new TestCaseParameters(ex);
}
}
private static TestCaseParameters GetParametersForMethod(object[] args)
{
return new TestCaseParameters(args);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
using System.Diagnostics.CodeAnalysis;
using NUnit.Framework.Internal.Builders;
namespace Ploeh.AutoFixture.NUnit3
{
/// Creates <see cref="TestMethod"/> instances with name that includes actual argument values.
/// Name is volatile and varies on the argument values.
public class VolatileNameTestMethodBuilder : ITestMethodBuilder
{
/// <inheritdoc />
public TestMethod Build(IMethodInfo method, Test suite, IEnumerable<object> parameterValues, int autoDataStartIndex)
{
if (method == null)
{
throw new ArgumentNullException(nameof(method));
}
if (parameterValues == null)
{
throw new ArgumentNullException(nameof(parameterValues));
}
return new NUnitTestCaseBuilder().BuildTestMethod(method, suite, GetParametersForMethod(parameterValues));
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
Justification = "This method is always expected to return an instance of the TestCaseParameters class.")]
private static TestCaseParameters GetParametersForMethod(IEnumerable<object> parameterValues)
{
try
{
return GetParametersForMethod(parameterValues.ToArray());
}
catch (Exception ex)
{
return new TestCaseParameters(ex);
}
}
private static TestCaseParameters GetParametersForMethod(object[] args)
{
return new TestCaseParameters(args);
}
}
}
| mit | C# |
52ededb390ff36f873c85e869b4007af235ad59e | Fix new warning around nullability | jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode | Drums/VDrumExplorer.Model/Schema/Json/HexInt32Converter.cs | Drums/VDrumExplorer.Model/Schema/Json/HexInt32Converter.cs | // Copyright 2020 Jon Skeet. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using Newtonsoft.Json;
using System;
using VDrumExplorer.Utility;
namespace VDrumExplorer.Model.Schema.Json
{
internal class HexInt32Converter : JsonConverter<HexInt32>
{
public override void WriteJson(JsonWriter writer, HexInt32? value, JsonSerializer serializer) =>
writer.WriteValue(value?.ToString());
public override HexInt32 ReadJson(JsonReader reader, Type objectType, HexInt32? existingValue, bool hasExistingValue, JsonSerializer serializer) =>
HexInt32.Parse(Preconditions.AssertNotNull((string?) reader.Value));
}
}
| // Copyright 2020 Jon Skeet. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using Newtonsoft.Json;
using System;
using VDrumExplorer.Utility;
namespace VDrumExplorer.Model.Schema.Json
{
internal class HexInt32Converter : JsonConverter<HexInt32>
{
public override void WriteJson(JsonWriter writer, HexInt32 value, JsonSerializer serializer) =>
writer.WriteValue(value.ToString());
public override HexInt32 ReadJson(JsonReader reader, Type objectType, HexInt32 existingValue, bool hasExistingValue, JsonSerializer serializer) =>
HexInt32.Parse(Preconditions.AssertNotNull((string?) reader.Value));
}
}
| apache-2.0 | C# |
113b03cbc3b86685806ea2572e5a591722e62135 | Bump version | octokit-net-test-org/octokit.net,ivandrofly/octokit.net,ChrisMissal/octokit.net,shiftkey/octokit.net,gabrielweyer/octokit.net,takumikub/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,kolbasov/octokit.net,octokit-net-test/octokit.net,nsnnnnrn/octokit.net,SmithAndr/octokit.net,SamTheDev/octokit.net,alfhenrik/octokit.net,fffej/octokit.net,mminns/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,Red-Folder/octokit.net,SmithAndr/octokit.net,dampir/octokit.net,shana/octokit.net,geek0r/octokit.net,naveensrinivasan/octokit.net,shana/octokit.net,M-Zuber/octokit.net,brramos/octokit.net,shiftkey-tester/octokit.net,ivandrofly/octokit.net,shiftkey/octokit.net,eriawan/octokit.net,fake-organization/octokit.net,hahmed/octokit.net,Sarmad93/octokit.net,hahmed/octokit.net,eriawan/octokit.net,bslliw/octokit.net,devkhan/octokit.net,rlugojr/octokit.net,thedillonb/octokit.net,M-Zuber/octokit.net,SamTheDev/octokit.net,alfhenrik/octokit.net,darrelmiller/octokit.net,TattsGroup/octokit.net,khellang/octokit.net,kdolan/octokit.net,SLdragon1989/octokit.net,daukantas/octokit.net,editor-tools/octokit.net,cH40z-Lord/octokit.net,Sarmad93/octokit.net,octokit/octokit.net,mminns/octokit.net,dlsteuer/octokit.net,forki/octokit.net,nsrnnnnn/octokit.net,rlugojr/octokit.net,octokit-net-test-org/octokit.net,chunkychode/octokit.net,thedillonb/octokit.net,hitesh97/octokit.net,khellang/octokit.net,gabrielweyer/octokit.net,magoswiat/octokit.net,octokit/octokit.net,devkhan/octokit.net,chunkychode/octokit.net,shiftkey-tester/octokit.net,adamralph/octokit.net,michaKFromParis/octokit.net,dampir/octokit.net,gdziadkiewicz/octokit.net,gdziadkiewicz/octokit.net,editor-tools/octokit.net,TattsGroup/octokit.net | SolutionInfo.cs | SolutionInfo.cs | // <auto-generated/>
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProductAttribute("Octokit")]
[assembly: AssemblyVersionAttribute("0.3.1")]
[assembly: AssemblyFileVersionAttribute("0.3.1")]
[assembly: ComVisibleAttribute(false)]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.3.1";
}
}
| // <auto-generated/>
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProductAttribute("Octokit")]
[assembly: AssemblyVersionAttribute("0.3.0")]
[assembly: AssemblyFileVersionAttribute("0.3.0")]
[assembly: ComVisibleAttribute(false)]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.3.0";
}
}
| mit | C# |
923043d2f16072bbd00c406276dbeb8b02cc3797 | Update Context.cs | Labs64/NetLicensingClient-csharp | NetLicensingClient/Context.cs | NetLicensingClient/Context.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetLicensingClient.Entities;
namespace NetLicensingClient
{
/// <summary>
/// Enumerates possible security modes for accessing the NetLicensing API
/// See https://netlicensing.io/wiki/security for details.
/// </summary>
public enum SecurityMode
{
BASIC_AUTHENTICATION,
APIKEY_IDENTIFICATION,
ANONYMOUS_IDENTIFICATION
};
/// <summary>
/// Holds the common context for all calls to the NetLicensingAPI RESTful, in particular server URL and login credentials.
/// </summary>
public class Context
{
/// <summary>
/// Server URL base of the NetLicensing RESTful API. Normally should be "https://go.netlicensing.io".
/// </summary>
public String baseUrl { get; set; }
/// <summary>
/// Login name of the user sending the requests when securityMode = BASIC_AUTHENTICATION.
/// </summary>
public String username { get; set; }
/// <summary>
/// Password of the user sending the requests when securityMode = BASIC_AUTHENTICATION.
/// </summary>
public String password { get; set; }
/// <summary>
/// API Key used to identify the request sender when securityMode = APIKEY_IDENTIFICATION.
/// </summary>
public String apiKey { get; set; }
/// <summary>
/// Determines the security mode used for accessing the NetLicensing API.
/// See https://netlicensing.io/wiki/security for details.
/// </summary>
public SecurityMode securityMode { get; set; }
/// <summary>
/// External number of the vendor.
/// </summary>
public String vendorNumber { get; set; }
/// <summary>
/// Use this call to form the redirection URL for NetLicensingShop.
/// </summary>
/// <param name="licenseeNumber">External number of the licensee that is going to shop</param>
/// <returns>URL that is to be used to redirect licensee to NetLicensingShop</returns>
public String getShopURL(String licenseeNumber)
{
StringBuilder sb = new StringBuilder();
sb.Append(baseUrl);
sb.Append(Constants.SHOP_PATH);
sb.Append("?vendorNumber=");
sb.Append(vendorNumber);
sb.Append("&licenseeNumber=");
sb.Append(licenseeNumber);
return sb.ToString();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetLicensingClient.Entities;
namespace NetLicensingClient
{
/// <summary>
/// Enumerates possible security modes for accessing the NetLicensing API
/// See https://www.labs64.de/confluence/display/NLICPUB/Security for details.
/// </summary>
public enum SecurityMode
{
BASIC_AUTHENTICATION,
APIKEY_IDENTIFICATION,
ANONYMOUS_IDENTIFICATION
};
/// <summary>
/// Holds the common context for all calls to the NetLicensingAPI RESTful, in particular server URL and login credentials.
/// </summary>
public class Context
{
/// <summary>
/// Server URL base of the NetLicensing RESTful API. Normally should be "https://go.netlicensing.io".
/// </summary>
public String baseUrl { get; set; }
/// <summary>
/// Login name of the user sending the requests when securityMode = BASIC_AUTHENTICATION.
/// </summary>
public String username { get; set; }
/// <summary>
/// Password of the user sending the requests when securityMode = BASIC_AUTHENTICATION.
/// </summary>
public String password { get; set; }
/// <summary>
/// API Key used to identify the request sender when securityMode = APIKEY_IDENTIFICATION.
/// </summary>
public String apiKey { get; set; }
/// <summary>
/// Determines the security mode used for accessing the NetLicensing API.
/// See https://www.labs64.de/confluence/x/pwCo#NetLicensingAPI%28RESTful%29-Security for details.
/// </summary>
public SecurityMode securityMode { get; set; }
/// <summary>
/// External number of the vendor.
/// </summary>
public String vendorNumber { get; set; }
/// <summary>
/// Use this call to form the redirection URL for NetLicensingShop.
/// </summary>
/// <param name="licenseeNumber">External number of the licensee that is going to shop</param>
/// <returns>URL that is to be used to redirect licensee to NetLicensingShop</returns>
public String getShopURL(String licenseeNumber)
{
StringBuilder sb = new StringBuilder();
sb.Append(baseUrl);
sb.Append(Constants.SHOP_PATH);
sb.Append("?vendorNumber=");
sb.Append(vendorNumber);
sb.Append("&licenseeNumber=");
sb.Append(licenseeNumber);
return sb.ToString();
}
}
}
| apache-2.0 | C# |
76e5e6a3aca1cc617facf6a4349f24fa6f018b6b | Update ApiCredentials.cs | wp-net/WordPressPCL,cobalto/WordPressPCL,cobalto/WordPressPCL,wp-net/WordPressPCL | WordPressPCL.Tests.Selfhosted/Utility/ApiCredentials.cs | WordPressPCL.Tests.Selfhosted/Utility/ApiCredentials.cs | namespace WordPressPCL.Tests.Selfhosted.Utility;
public class ApiCredentials
{
public static string WordPressUri = "http://localhost:8080/wp-json/";
public static string Username = "wordpress";
public static string Password = "wordpress";
}
| namespace WordPressPCL.Tests.Selfhosted.Utility;
public class ApiCredentials
{
public static string WordPressUri = "https://pcl.medienstudio.net/wp-json/";
public static string Username = "wordpress";
public static string Password = "eD9Q)t#v!k7R6SLum9N.";
}
| mit | C# |
90048213c3e195105084bb8c072f08efdf5be550 | add message that creates account doc to list of messages not to reprocess | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EAS.Portal/Application/Services/AccountDocumentServiceWithDuplicateCheck.cs | src/SFA.DAS.EAS.Portal/Application/Services/AccountDocumentServiceWithDuplicateCheck.cs | using SFA.DAS.EAS.Portal.Client.Database.Models;
using System.Threading;
using System.Threading.Tasks;
namespace SFA.DAS.EAS.Portal.Application.Services
{
public class AccountDocumentServiceWithDuplicateCheck : IAccountDocumentService
{
private readonly IAccountDocumentService _accountDocumentService;
private readonly IMessageContext _messageContext;
public AccountDocumentServiceWithDuplicateCheck(IAccountDocumentService accountDocumentService, IMessageContext messageContext)
{
_accountDocumentService = accountDocumentService;
_messageContext = messageContext;
}
public Task<AccountDocument> Get(long id, CancellationToken cancellationToken = default)
{
return _accountDocumentService.Get(id, cancellationToken);
}
public Task Save(AccountDocument accountDocument, CancellationToken cancellationToken = default)
{
accountDocument.DeleteOldMessages();
if (accountDocument.IsMessageProcessed(_messageContext.Id)) { return Task.CompletedTask; };
accountDocument.AddOutboxMessage(_messageContext.Id, _messageContext.CreatedDateTime);
return _accountDocumentService.Save(accountDocument, cancellationToken);
}
}
}
| using SFA.DAS.EAS.Portal.Client.Database.Models;
using System.Threading;
using System.Threading.Tasks;
namespace SFA.DAS.EAS.Portal.Application.Services
{
public class AccountDocumentServiceWithDuplicateCheck : IAccountDocumentService
{
private readonly IAccountDocumentService _accountDocumentService;
private readonly IMessageContext _messageContext;
public AccountDocumentServiceWithDuplicateCheck(IAccountDocumentService accountDocumentService, IMessageContext messageContext)
{
_accountDocumentService = accountDocumentService;
_messageContext = messageContext;
}
public Task<AccountDocument> Get(long id, CancellationToken cancellationToken = default)
{
return _accountDocumentService.Get(id, cancellationToken);
}
public Task Save(AccountDocument accountDocument, CancellationToken cancellationToken = default)
{
//todo: think we shouldn't ignore when new, otherwise will process duplicate
if (!accountDocument.IsNew) // We ignore for new accounts because the messageContext.Id is the Id for an event not related to account creation
{
accountDocument.DeleteOldMessages();
if (accountDocument.IsMessageProcessed(_messageContext.Id)) { return Task.CompletedTask; };
accountDocument.AddOutboxMessage(_messageContext.Id, _messageContext.CreatedDateTime);
}
return _accountDocumentService.Save(accountDocument, cancellationToken);
}
}
}
| mit | C# |
34d6e311e9771a50491d967d70ff4335aa204243 | Update FileSettingsServiceOptionsValidator.cs | tiksn/TIKSN-Framework | TIKSN.Core/Settings/FileSettingsServiceOptionsValidator.cs | TIKSN.Core/Settings/FileSettingsServiceOptionsValidator.cs | using FluentValidation;
using TIKSN.Configuration.Validator;
namespace TIKSN.Settings
{
public class
FileSettingsServiceOptionsValidator : PartialConfigurationFluentValidatorBase<FileSettingsServiceOptions>
{
public FileSettingsServiceOptionsValidator() => this.RuleFor(x => x.RelativePath).NotNull().NotEmpty();
}
}
| using FluentValidation;
using TIKSN.Configuration.Validator;
namespace TIKSN.Settings
{
public class FileSettingsServiceOptionsValidator : PartialConfigurationFluentValidatorBase<FileSettingsServiceOptions>
{
public FileSettingsServiceOptionsValidator()
{
RuleFor(x => x.RelativePath).NotNull().NotEmpty();
}
}
} | mit | C# |
7fa2673ca6dce792495438bec0079139fec7a570 | Refactor service bus configuration | kotorihq/kotori-core | KotoriCore/Configuration/ServiceBusConfiguration.cs | KotoriCore/Configuration/ServiceBusConfiguration.cs | namespace KotoriCore.Configuration
{
/// <summary>
/// Service bus configuration.
/// </summary>
public class ServiceBusConfiguration : IBusConfiguration
{
/// <summary>
/// Gets or sets the end point.
/// </summary>
/// <value>The end point.</value>
public string Endpoint { get; set; }
/// <summary>
/// Gets or sets the name of the shared access key.
/// </summary>
/// <value>The name of the shared access key.</value>
public string SharedAccessKeyName { get; set; }
/// <summary>
/// Gets or sets the shared access key.
/// </summary>
/// <value>The shared access key.</value>
public string SharedAccessKey { get; set; }
/// <summary>
/// Gets or sets the entity path.
/// </summary>
/// <value>The entity path.</value>
public string EntityPath { get; set; }
}
}
| namespace KotoriCore.Configuration
{
/// <summary>
/// Service bus configuration.
/// </summary>
public class ServiceBusConfiguration : IBusConfiguration
{
/// <summary>
/// Gets or sets the end point.
/// </summary>
/// <value>The end point.</value>
public string Endpoint { get; set; }
/// <summary>
/// Gets or sets the shared secret issuer.
/// </summary>
/// <value>The shared secret issuer.</value>
public string SharedSecretIssuer { get; set; }
/// <summary>
/// Gets or sets the shared secret value.
/// </summary>
/// <value>The shared secret value.</value>
public string SharedSecretValue { get; set; }
/// <summary>
/// Gets or sets the queue name.
/// </summary>
/// <value>The queue name.</value>
public string Queue { get; set; }
}
}
| mit | C# |
13e2979f4b4651a8c884cf4b078e3cd44cdfba86 | Add multidimensional matrix copy method. | scott-fleischman/algorithms-csharp | src/Algorithms.Collections/SquareMatrix.cs | src/Algorithms.Collections/SquareMatrix.cs | using System;
namespace Algorithms.Collections
{
public static class SquareMatrix
{
public static T[,] Multiply<T>(T[,] A, T[,] B, Func<T, T, T> add, Func<T, T, T> multiply)
{
ValidateAreEqualSquare(A, B);
int length = A.GetLength(0);
var C = new T[length, length];
for (int i = 0; i < length; i++)
{
for (int j = 0; j < length; j++)
{
C[i, j] = default(T);
for (int k = 0; k < length; k++)
C[i, j] = add(C[i, j], multiply(A[i, k], B[k, j]));
}
}
return C;
}
public static T[,] Add<T>(T[,] left, T[,] right, Func<T, T, T> add)
{
ValidateAreEqualSquare(left, right);
int length = left.GetLength(0);
var result = new T[length, length];
for (int row = 0; row < left.GetLength(0); row++)
{
for (int column = 0; column < left.GetLength(1); column++)
result[row, column] = add(left[row, column], right[row, column]);
}
return result;
}
private static void Copy<T>(T[,] source, int sourceRow, int sourceColumn, T[,] target, int targetRow, int targetColumn, int rowLength, int columnLength)
{
for (int rowOffset = 0; rowOffset < rowLength; rowOffset++)
{
for (int columnOffset = 0; columnOffset < columnLength; columnOffset++)
{
target[targetRow + rowOffset, targetColumn + columnOffset] =
source[sourceRow + rowOffset, sourceColumn + columnOffset];
}
}
}
private static void ValidateAreEqualSquare<T>(T[,] A, T[,] B)
{
if (!IsSquare(A))
throw new ArgumentException("A must be square", "A");
if (!IsSquare(B))
throw new ArgumentException("B must be square", "B");
int aSize = A.GetLength(0);
int bSize = B.GetLength(0);
if (aSize != bSize)
throw new ArgumentException("A and B must be the same size", "A");
}
private static bool IsSquare<T>(T[,] array)
{
int rowLength = array.GetLength(0);
int columnLength = array.GetLength(1);
return rowLength == columnLength;
}
}
}
| using System;
namespace Algorithms.Collections
{
public static class SquareMatrix
{
public static T[,] Multiply<T>(T[,] A, T[,] B, Func<T, T, T> add, Func<T, T, T> multiply)
{
ValidateAreEqualSquare(A, B);
int length = A.GetLength(0);
var C = new T[length, length];
for (int i = 0; i < length; i++)
{
for (int j = 0; j < length; j++)
{
C[i, j] = default(T);
for (int k = 0; k < length; k++)
C[i, j] = add(C[i, j], multiply(A[i, k], B[k, j]));
}
}
return C;
}
public static T[,] Add<T>(T[,] left, T[,] right, Func<T, T, T> add)
{
ValidateAreEqualSquare(left, right);
int length = left.GetLength(0);
var result = new T[length, length];
for (int row = 0; row < left.GetLength(0); row++)
{
for (int column = 0; column < left.GetLength(1); column++)
result[row, column] = add(left[row, column], right[row, column]);
}
return result;
}
private static void ValidateAreEqualSquare<T>(T[,] A, T[,] B)
{
if (!IsSquare(A))
throw new ArgumentException("A must be square", "A");
if (!IsSquare(B))
throw new ArgumentException("B must be square", "B");
int aSize = A.GetLength(0);
int bSize = B.GetLength(0);
if (aSize != bSize)
throw new ArgumentException("A and B must be the same size", "A");
}
private static bool IsSquare<T>(T[,] array)
{
int rowLength = array.GetLength(0);
int columnLength = array.GetLength(1);
return rowLength == columnLength;
}
}
}
| mit | C# |
d930423199d9bd57d6e794f61836e8efe6ce2e34 | Initialize LoginAuthCommand with an IMaskedInput | appharbor/appharbor-cli | src/AppHarbor/Commands/LoginAuthCommand.cs | src/AppHarbor/Commands/LoginAuthCommand.cs | using System.IO;
using RestSharp;
using RestSharp.Contrib;
namespace AppHarbor.Commands
{
[CommandHelp("Login to AppHarbor", alias: "login")]
public class LoginAuthCommand : ICommand
{
private readonly IAccessTokenConfiguration _accessTokenConfiguration;
private readonly IMaskedInput _maskedConsoleInput;
private readonly TextReader _reader;
private readonly TextWriter _writer;
public LoginAuthCommand(IAccessTokenConfiguration accessTokenConfiguration, IMaskedInput maskedConsoleInput, TextReader reader, TextWriter writer)
{
_accessTokenConfiguration = accessTokenConfiguration;
_maskedConsoleInput = maskedConsoleInput;
_reader = reader;
_writer = writer;
}
public void Execute(string[] arguments)
{
if (_accessTokenConfiguration.GetAccessToken() != null)
{
throw new CommandException("You're already logged in");
}
_writer.Write("Username: ");
var username = _reader.ReadLine();
_writer.Write("Password: ");
var password = _reader.ReadLine();
var accessToken = GetAccessToken(username, password);
_accessTokenConfiguration.SetAccessToken(accessToken);
_writer.WriteLine("Successfully logged in as {0}", username);
}
public virtual string GetAccessToken(string username, string password)
{
//NOTE: Remove when merged into AppHarbor.NET library
var restClient = new RestClient("https://appharbor-token-client.apphb.com");
var request = new RestRequest("/token", Method.POST);
request.AddParameter("username", username);
request.AddParameter("password", password);
var response = restClient.Execute(request);
var accessToken = HttpUtility.ParseQueryString(response.Content)["access_token"];
if (accessToken == null)
{
throw new CommandException("Couldn't log in. Try again");
}
return accessToken;
}
}
}
| using System.IO;
using RestSharp;
using RestSharp.Contrib;
namespace AppHarbor.Commands
{
[CommandHelp("Login to AppHarbor", alias: "login")]
public class LoginAuthCommand : ICommand
{
private readonly IAccessTokenConfiguration _accessTokenConfiguration;
private readonly TextReader _reader;
private readonly TextWriter _writer;
public LoginAuthCommand(IAccessTokenConfiguration accessTokenConfiguration, TextReader reader, TextWriter writer)
{
_accessTokenConfiguration = accessTokenConfiguration;
_reader = reader;
_writer = writer;
}
public void Execute(string[] arguments)
{
if (_accessTokenConfiguration.GetAccessToken() != null)
{
throw new CommandException("You're already logged in");
}
_writer.Write("Username: ");
var username = _reader.ReadLine();
_writer.Write("Password: ");
var password = _reader.ReadLine();
var accessToken = GetAccessToken(username, password);
_accessTokenConfiguration.SetAccessToken(accessToken);
_writer.WriteLine("Successfully logged in as {0}", username);
}
public virtual string GetAccessToken(string username, string password)
{
//NOTE: Remove when merged into AppHarbor.NET library
var restClient = new RestClient("https://appharbor-token-client.apphb.com");
var request = new RestRequest("/token", Method.POST);
request.AddParameter("username", username);
request.AddParameter("password", password);
var response = restClient.Execute(request);
var accessToken = HttpUtility.ParseQueryString(response.Content)["access_token"];
if (accessToken == null)
{
throw new CommandException("Couldn't log in. Try again");
}
return accessToken;
}
}
}
| mit | C# |
8a777d7953ec2fa5212aa2bb256add8d3b1b761d | Include max port | serilog/serilog-sinks-loggly | src/Serilog.Sinks.Loggly/Sinks/Loggly/LogglyConfigAdapter.cs | src/Serilog.Sinks.Loggly/Sinks/Loggly/LogglyConfigAdapter.cs | using System;
using Loggly.Config;
namespace Serilog.Sinks.Loggly
{
class LogglyConfigAdapter
{
public void ConfigureLogglyClient(LogglyConfiguration logglyConfiguration)
{
var config = LogglyConfig.Instance;
if (!string.IsNullOrWhiteSpace(logglyConfiguration.ApplicationName))
config.ApplicationName = logglyConfiguration.ApplicationName;
if (string.IsNullOrWhiteSpace(logglyConfiguration.CustomerToken))
throw new ArgumentNullException("CustomerToken", "CustomerToken is required");
config.CustomerToken = logglyConfiguration.CustomerToken;
config.IsEnabled = logglyConfiguration.IsEnabled;
foreach (var tag in logglyConfiguration.Tags)
{
config.TagConfig.Tags.Add(tag);
}
config.ThrowExceptions = logglyConfiguration.ThrowExceptions;
if (logglyConfiguration.LogTransport != TransportProtocol.Https)
config.Transport.LogTransport = (LogTransport)Enum.Parse(typeof(LogTransport), logglyConfiguration.LogTransport.ToString());
if (!string.IsNullOrWhiteSpace(logglyConfiguration.EndpointHostName))
config.Transport.EndpointHostname = logglyConfiguration.EndpointHostName;
if (logglyConfiguration.EndpointPort > 0 && logglyConfiguration.EndpointPort <= ushort.MaxValue)
config.Transport.EndpointPort = logglyConfiguration.EndpointPort;
config.Transport.IsOmitTimestamp = logglyConfiguration.OmitTimestamp;
config.Transport = config.Transport.GetCoercedToValidConfig();
}
}
}
| using System;
using Loggly.Config;
namespace Serilog.Sinks.Loggly
{
class LogglyConfigAdapter
{
public void ConfigureLogglyClient(LogglyConfiguration logglyConfiguration)
{
var config = LogglyConfig.Instance;
if (!string.IsNullOrWhiteSpace(logglyConfiguration.ApplicationName))
config.ApplicationName = logglyConfiguration.ApplicationName;
if (string.IsNullOrWhiteSpace(logglyConfiguration.CustomerToken))
throw new ArgumentNullException("CustomerToken", "CustomerToken is required");
config.CustomerToken = logglyConfiguration.CustomerToken;
config.IsEnabled = logglyConfiguration.IsEnabled;
foreach (var tag in logglyConfiguration.Tags)
{
config.TagConfig.Tags.Add(tag);
}
config.ThrowExceptions = logglyConfiguration.ThrowExceptions;
if (logglyConfiguration.LogTransport != TransportProtocol.Https)
config.Transport.LogTransport = (LogTransport)Enum.Parse(typeof(LogTransport), logglyConfiguration.LogTransport.ToString());
if (!string.IsNullOrWhiteSpace(logglyConfiguration.EndpointHostName))
config.Transport.EndpointHostname = logglyConfiguration.EndpointHostName;
if (logglyConfiguration.EndpointPort > 0 && logglyConfiguration.EndpointPort < ushort.MaxValue)
config.Transport.EndpointPort = logglyConfiguration.EndpointPort;
config.Transport.IsOmitTimestamp = logglyConfiguration.OmitTimestamp;
config.Transport = config.Transport.GetCoercedToValidConfig();
}
}
}
| apache-2.0 | C# |
485e632901ad295f7d9d4b6642db7167c67c454f | Split value interface into smaller interfaces. | Teodor92/QL-DSL | src/OffByOne.Ql/Values/Contracts/IValue.cs | src/OffByOne.Ql/Values/Contracts/IValue.cs | namespace OffByOne.Ql.Values.Contracts
{
public interface IValue
: IValueOperations<IValue>,
IValueOperations<IntegerValue>,
IValueOperations<DecimalValue>,
IValueOperations<MoneyValue>,
IValueOperations<DateValue>,
IValueOperations<BooleanValue>,
IValueOperations<StringValue>
{
IValue Parse(string value);
BooleanValue Not();
IValue Negative();
IValue Positive();
}
}
| namespace OffByOne.Ql.Values.Contracts
{
public interface IValue
{
IValue Parse(string value);
IValue Add(IValue other);
IValue Add(IntegerValue other);
IValue Add(DecimalValue other);
IValue Add(MoneyValue other);
IValue Add(DateValue other);
IValue Add(StringValue other);
IValue Add(BooleanValue other);
IValue Substract(IValue other);
IValue Substract(IntegerValue other);
IValue Substract(DecimalValue other);
IValue Substract(MoneyValue other);
IValue Substract(DateValue other);
IValue Substract(StringValue other);
IValue Substract(BooleanValue other);
IValue Divide(IValue other);
IValue Divide(IntegerValue other);
IValue Divide(DecimalValue other);
IValue Divide(MoneyValue other);
IValue Divide(DateValue other);
IValue Divide(StringValue other);
IValue Divide(BooleanValue other);
IValue Multiply(IValue other);
IValue Multiply(IntegerValue other);
IValue Multiply(DecimalValue other);
IValue Multiply(MoneyValue other);
IValue Multiply(DateValue other);
IValue Multiply(StringValue other);
IValue Multiply(BooleanValue other);
BooleanValue GreaterThanOrEqualTo(IValue other);
BooleanValue GreaterThanOrEqualTo(IntegerValue other);
BooleanValue GreaterThanOrEqualTo(DecimalValue other);
BooleanValue GreaterThanOrEqualTo(MoneyValue other);
BooleanValue GreaterThanOrEqualTo(DateValue other);
BooleanValue GreaterThanOrEqualTo(StringValue other);
BooleanValue GreaterThanOrEqualTo(BooleanValue other);
BooleanValue LessThanOrEqualTo(IValue other);
BooleanValue LessThanOrEqualTo(IntegerValue other);
BooleanValue LessThanOrEqualTo(DecimalValue other);
BooleanValue LessThanOrEqualTo(MoneyValue other);
BooleanValue LessThanOrEqualTo(DateValue other);
BooleanValue LessThanOrEqualTo(StringValue other);
BooleanValue LessThanOrEqualTo(BooleanValue other);
BooleanValue LessThan(IValue other);
BooleanValue LessThan(IntegerValue other);
BooleanValue LessThan(DecimalValue other);
BooleanValue LessThan(MoneyValue other);
BooleanValue LessThan(DateValue other);
BooleanValue LessThan(StringValue other);
BooleanValue LessThan(BooleanValue other);
BooleanValue GreaterThan(IValue other);
BooleanValue GreaterThan(IntegerValue other);
BooleanValue GreaterThan(DecimalValue other);
BooleanValue GreaterThan(MoneyValue other);
BooleanValue GreaterThan(DateValue other);
BooleanValue GreaterThan(StringValue other);
BooleanValue GreaterThan(BooleanValue other);
BooleanValue Equals(IValue other);
BooleanValue Equals(IntegerValue other);
BooleanValue Equals(DecimalValue other);
BooleanValue Equals(MoneyValue other);
BooleanValue Equals(DateValue other);
BooleanValue Equals(StringValue other);
BooleanValue Equals(BooleanValue other);
BooleanValue Or(IValue other);
BooleanValue Or(IntegerValue other);
BooleanValue Or(DecimalValue other);
BooleanValue Or(MoneyValue other);
BooleanValue Or(DateValue other);
BooleanValue Or(StringValue other);
BooleanValue Or(BooleanValue other);
BooleanValue And(IValue other);
BooleanValue And(IntegerValue other);
BooleanValue And(DecimalValue other);
BooleanValue And(MoneyValue other);
BooleanValue And(DateValue other);
BooleanValue And(StringValue other);
BooleanValue And(BooleanValue other);
BooleanValue Not();
IValue Negative();
IValue Positive();
}
}
| mit | C# |
19ce5e8f3f7cd4599fc760ed1fe3801efe23a558 | Remove some dead code | SergeyTeplyakov/CodeContracts,hubuk/CodeContracts,huoxudong125/CodeContracts,ndykman/CodeContracts,SergeyTeplyakov/CodeContracts,danielcweber/CodeContracts,ndykman/CodeContracts,huoxudong125/CodeContracts,SergeyTeplyakov/CodeContracts,huoxudong125/CodeContracts,huoxudong125/CodeContracts,huoxudong125/CodeContracts,ndykman/CodeContracts,hubuk/CodeContracts,Microsoft/CodeContracts,hubuk/CodeContracts,SergeyTeplyakov/CodeContracts,Microsoft/CodeContracts,hubuk/CodeContracts,danielcweber/CodeContracts,Microsoft/CodeContracts,danielcweber/CodeContracts,danielcweber/CodeContracts,Microsoft/CodeContracts,Microsoft/CodeContracts,hubuk/CodeContracts,huoxudong125/CodeContracts,huoxudong125/CodeContracts,danielcweber/CodeContracts,danielcweber/CodeContracts,ndykman/CodeContracts,Microsoft/CodeContracts,hubuk/CodeContracts,SergeyTeplyakov/CodeContracts,ndykman/CodeContracts,hubuk/CodeContracts,ndykman/CodeContracts,danielcweber/CodeContracts,SergeyTeplyakov/CodeContracts,ndykman/CodeContracts,Microsoft/CodeContracts,SergeyTeplyakov/CodeContracts | Microsoft.Research/AnalysisTypes/StringConstants.cs | Microsoft.Research/AnalysisTypes/StringConstants.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.Collections.Generic;
using System.Linq;
using System.Text;
namespace Microsoft.Research.CodeAnalysis
{
public static class StringConstants
{
public const string StringSeparator = "$%^";
public static class Contract
{
public const string ContractsNamespace = "System.Diagnostics.Contracts";
public const string Result = "Contract.Result";
public const string EnsuresWithHole = "Contract.Ensures({0});";
}
public static class XML
{
public const string Root = "CCCheckOutput";
public const string Assembly = "Assembly";
public const string Method = "Method";
public const string Message = "Message";
public const string Suggestion = "Suggestion";
public const string SuggestionKind = "SuggestionKind";
public const string Suggested = "Suggested";
public const string Statistics = "Statistics";
public const string FinalStatistics = "FinalStatistic";
public const string Check = "Check";
public const string Kind = "Kind";
public const string Name = "Name";
public const string Trace = "Trace";
public const string Result = "Result";
public const string Score = "Score";
public const string RelatedLocation = "RelatedLocation";
public const string SourceLocation = "SourceLocation";
public const string Justification = "Justification";
public const string Feature = "Feature";
public const string SuggestionExtraInfo = "SuggestionExtraInfo";
public const string Interface = "Interface";
public const string ProperMember = "Member";
public const string Extern = "Extern";
public const string Abstract = "Abstract";
public const string ConfidenceLevel = "ConfidenceLevel";
public const string SuggestionTurnedIntoWarning = "SuggestionTurnedIntoWarning_";
}
}
}
| // 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.Collections.Generic;
using System.Linq;
using System.Text;
namespace Microsoft.Research.CodeAnalysis
{
public static class StringConstants
{
public const string ClousotWait = "wait";
public const string StringSeparator = "$%^";
public static class Contract
{
public const string ContractsNamespace = "System.Diagnostics.Contracts";
public const string Result = "Contract.Result";
public const string EnsuresWithHole = "Contract.Ensures({0});";
}
public static class XML
{
public const string Root = "CCCheckOutput";
public const string Assembly = "Assembly";
public const string Method = "Method";
public const string Message = "Message";
public const string Suggestion = "Suggestion";
public const string SuggestionKind = "SuggestionKind";
public const string Suggested = "Suggested";
public const string Statistics = "Statistics";
public const string FinalStatistics = "FinalStatistic";
public const string Check = "Check";
public const string Kind = "Kind";
public const string Name = "Name";
public const string Trace = "Trace";
public const string Result = "Result";
public const string Score = "Score";
public const string RelatedLocation = "RelatedLocation";
public const string SourceLocation = "SourceLocation";
public const string Justification = "Justification";
public const string Feature = "Feature";
public const string SuggestionExtraInfo = "SuggestionExtraInfo";
public const string Interface = "Interface";
public const string ProperMember = "Member";
public const string Extern = "Extern";
public const string Abstract = "Abstract";
public const string ConfidenceLevel = "ConfidenceLevel";
public const string SuggestionTurnedIntoWarning = "SuggestionTurnedIntoWarning_";
}
}
}
| mit | C# |
d948e3ffa26eb708514ec04a53bb8305de0d55dc | Bump version | canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor | src/SyncTrayzor/Properties/AssemblyInfo.cs | src/SyncTrayzor/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("SyncTrayzor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SyncTrayzor")]
[assembly: AssemblyCopyright("Copyright © Antony Male 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("SyncTrayzor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SyncTrayzor")]
[assembly: AssemblyCopyright("Copyright © Antony Male 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
| mit | C# |
6203eb73f97b31503972bbe357e393287f3ecc74 | Add DisplayUnits to DiagnosticCounter reference assembly | shimingsg/corefx,ericstj/corefx,wtgodbe/corefx,wtgodbe/corefx,ericstj/corefx,ViktorHofer/corefx,ericstj/corefx,wtgodbe/corefx,shimingsg/corefx,BrennanConroy/corefx,wtgodbe/corefx,ViktorHofer/corefx,shimingsg/corefx,shimingsg/corefx,shimingsg/corefx,ViktorHofer/corefx,shimingsg/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ericstj/corefx,BrennanConroy/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ericstj/corefx,ericstj/corefx,wtgodbe/corefx,shimingsg/corefx,wtgodbe/corefx,ericstj/corefx,BrennanConroy/corefx,wtgodbe/corefx | src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.Counters.cs | src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.Counters.cs | namespace System.Diagnostics.Tracing
{
public abstract partial class DiagnosticCounter : System.IDisposable
{
internal DiagnosticCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { }
public void AddMetadata(string key, string value) { }
public void Dispose() { }
public string DisplayName { get { throw null; } set { } }
public string DisplayUnits { get { throw null; } set { } }
public string Name { get { throw null; } }
public System.Diagnostics.Tracing.EventSource EventSource { get { throw null; } }
}
public partial class PollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public PollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, Func<double> metricProvider) : base(name, eventSource) { }
}
public partial class IncrementingEventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingEventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) : base(name, eventSource) { }
public void Increment(double increment = 1) { }
public TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
}
public partial class IncrementingPollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingPollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, Func<double> totalValueProvider) : base(name, eventSource) { }
public TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
}
public partial class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public EventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) : base(name, eventSource) { }
public void WriteMetric(float value) { }
public void WriteMetric(double value) { }
}
}
| namespace System.Diagnostics.Tracing
{
public abstract partial class DiagnosticCounter : System.IDisposable
{
internal DiagnosticCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { }
public void AddMetadata(string key, string value) { }
public void Dispose() { }
public string DisplayName { get { throw null; } set { } }
public string Name { get { throw null; } }
public System.Diagnostics.Tracing.EventSource EventSource { get { throw null; } }
}
public partial class PollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public PollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, Func<double> metricProvider) : base(name, eventSource) { }
}
public partial class IncrementingEventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingEventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) : base(name, eventSource) { }
public void Increment(double increment = 1) { }
public TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
}
public partial class IncrementingPollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingPollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, Func<double> totalValueProvider) : base(name, eventSource) { }
public TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
}
public partial class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public EventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) : base(name, eventSource) { }
public void WriteMetric(float value) { }
public void WriteMetric(double value) { }
}
} | mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.