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 |
---|---|---|---|---|---|---|---|---|
a823eaa5b1fdc06f2a9622365130da786a8fc13a
|
Update RouteInformation.cs
|
kobake/AspNetCore.RouteAnalyzer,kobake/AspNetCore.RouteAnalyzer,kobake/AspNetCore.RouteAnalyzer
|
AspNetCore.RouteAnalyzer/RouteInformation.cs
|
AspNetCore.RouteAnalyzer/RouteInformation.cs
|
namespace AspNetCore.RouteAnalyzer
{
public class RouteInformation
{
public string HttpMethod { get; set; } = "GET";
public string Area { get; set; } = "";
public string Path { get; set; } = "";
public string Invocation { get; set; } = "";
public override string ToString()
{
return $"RouteInformation{{Area:\"{Area}\", HttpMethod: \"{HttpMethod}\" Path:\"{Path}\", Invocation:\"{Invocation}\"}}";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace AspNetCore.RouteAnalyzer
{
public class RouteInformation
{
public string Area { get; set; } = "";
public string Path { get; set; } = "";
public string Invocation { get; set; } = "";
public override string ToString()
{
return $"RouteInformation{{Area:\"{Area}\", Path:\"{Path}\", Invocation:\"{Invocation}\"}}";
}
}
}
|
mit
|
C#
|
69ea76a984a1f5a431ce021220b2dcaae803649f
|
Revert function sig
|
evilz/sc2replay-csharp,ascendedguard/sc2replay-csharp
|
Starcraft2.ReplayParser/replay.game.events/SendResourcesEvent.cs
|
Starcraft2.ReplayParser/replay.game.events/SendResourcesEvent.cs
|
// -----------------------------------------------------------------------
// <copyright file="SendResourcesEvent.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------
namespace Starcraft2.ReplayParser
{
using Streams;
/// <summary>
/// TODO: Update summary.
/// </summary>
public class SendResourcesEvent : GameEventBase
{
public SendResourcesEvent(BitReader bitReader, Replay replay)
{
this.EventType = GameEventType.Other;
var playerId = (int)bitReader.Read(4);
Target = replay.GetPlayerById(playerId);
var someFlags = (int)bitReader.Read(3);
if (someFlags-- > 0) // 4
{
MineralsSent = ReadSignedAmount(bitReader.Read(32));
}
if (someFlags-- > 0) // 3
{
VespeneSent = ReadSignedAmount(bitReader.Read(32));
}
if (someFlags-- > 0) // 2
{
TerrazineSent = ReadSignedAmount(bitReader.Read(32));
}
if (someFlags-- > 0) // 1
{
CustomSent = ReadSignedAmount(bitReader.Read(32));
}
}
int ReadSignedAmount(uint amount)
{
int result = ((amount & 0x80000000) != 0) ? 1 : -1;
return result * (int)(amount & 0x7fffffff);
}
/// <summary> Amount of resources sent </summary>
public int MineralsSent { get; private set; }
/// <summary> Amount of resources sent </summary>
public int VespeneSent { get; private set; }
/// <summary> Amount of resources sent </summary>
public int TerrazineSent { get; private set; }
/// <summary> Amount of resources sent </summary>
public int CustomSent { get; private set; }
/// <summary> The target of the trade </summary>
public Player Target { get; private set; }
}
}
|
// -----------------------------------------------------------------------
// <copyright file="SendResourcesEvent.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------
namespace Starcraft2.ReplayParser
{
using Streams;
/// <summary>
/// TODO: Update summary.
/// </summary>
public class SendResourcesEvent : GameEventBase
{
public SendResourcesEvent(BitReader bitReader, Replay replay, bool newFormat = false)
{
this.EventType = GameEventType.Other;
var playerId = (int)bitReader.Read(4);
Target = replay.GetPlayerById(playerId);
var someFlags = (int)bitReader.Read(3);
if (someFlags-- > 0) // 4
{
MineralsSent = ReadSignedAmount(bitReader.Read(32));
}
if (someFlags-- > 0) // 3
{
VespeneSent = ReadSignedAmount(bitReader.Read(32));
}
if (someFlags-- > 0) // 2
{
TerrazineSent = ReadSignedAmount(bitReader.Read(32));
}
if (someFlags-- > 0) // 1
{
CustomSent = ReadSignedAmount(bitReader.Read(32));
}
}
int ReadSignedAmount(uint amount)
{
int result = ((amount & 0x80000000) != 0) ? 1 : -1;
return result * (int)(amount & 0x7fffffff);
}
/// <summary> Amount of resources sent </summary>
public int MineralsSent { get; private set; }
/// <summary> Amount of resources sent </summary>
public int VespeneSent { get; private set; }
/// <summary> Amount of resources sent </summary>
public int TerrazineSent { get; private set; }
/// <summary> Amount of resources sent </summary>
public int CustomSent { get; private set; }
/// <summary> The target of the trade </summary>
public Player Target { get; private set; }
}
}
|
mit
|
C#
|
a372e06e26dff22cdf97a951d964970f8b9c7ddd
|
fix resharper nag
|
IUMDPI/IUMediaHelperApps
|
Packager/Utilities/Hasher.cs
|
Packager/Utilities/Hasher.cs
|
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using Packager.Models.FileModels;
namespace Packager.Utilities
{
public class Hasher : IHasher
{
private string BaseProcessingFolder { get; set; }
public Hasher(string baseProcessingFolder)
{
BaseProcessingFolder = baseProcessingFolder;
}
public string Hash(Stream content)
{
using (var md5 = MD5.Create())
{
using (content)
{
var hash = md5.ComputeHash(content);
return hash.Aggregate(string.Empty, (current, b) => current + $"{b:x2}");
}
}
}
public string Hash(string path)
{
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
return Hash(stream);
}
}
public string Hash(AbstractFileModel model)
{
return Hash(Path.Combine(BaseProcessingFolder, model.GetFolderName(), model.ToFileName()));
}
}
}
|
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using Packager.Models.FileModels;
namespace Packager.Utilities
{
public class Hasher : IHasher
{
private string BaseProcessingFolder { get; set; }
public Hasher(string baseProcessingFolder)
{
BaseProcessingFolder = baseProcessingFolder;
}
public string Hash(Stream content)
{
using (var md5 = MD5.Create())
{
using (content)
{
var hash = md5.ComputeHash(content);
return hash.Aggregate(string.Empty, (current, b) => current + string.Format("{0:x2}", b));
}
}
}
public string Hash(string path)
{
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
return Hash(stream);
}
}
public string Hash(AbstractFileModel model)
{
return Hash(Path.Combine(BaseProcessingFolder, model.GetFolderName(), model.ToFileName()));
}
}
}
|
apache-2.0
|
C#
|
10034c1def62f808b590422b88aa58c0868adb5f
|
use Uri class to do string/uri comparisons
|
ryanvgates/IdentityServer3,delRyan/IdentityServer3,olohmann/IdentityServer3,iamkoch/IdentityServer3,kouweizhong/IdentityServer3,bodell/IdentityServer3,EternalXw/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,jackswei/IdentityServer3,angelapper/IdentityServer3,roflkins/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,yanjustino/IdentityServer3,tonyeung/IdentityServer3,bestwpw/IdentityServer3,delloncba/IdentityServer3,Agrando/IdentityServer3,delloncba/IdentityServer3,tbitowner/IdentityServer3,angelapper/IdentityServer3,olohmann/IdentityServer3,yanjustino/IdentityServer3,codeice/IdentityServer3,faithword/IdentityServer3,chicoribas/IdentityServer3,tonyeung/IdentityServer3,tbitowner/IdentityServer3,kouweizhong/IdentityServer3,wondertrap/IdentityServer3,jackswei/IdentityServer3,charoco/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,feanz/Thinktecture.IdentityServer.v3,tuyndv/IdentityServer3,18098924759/IdentityServer3,IdentityServer/IdentityServer3,iamkoch/IdentityServer3,EternalXw/IdentityServer3,EternalXw/IdentityServer3,codeice/IdentityServer3,Agrando/IdentityServer3,remunda/IdentityServer3,roflkins/IdentityServer3,buddhike/IdentityServer3,Agrando/IdentityServer3,bodell/IdentityServer3,SonOfSam/IdentityServer3,mvalipour/IdentityServer3,bodell/IdentityServer3,chicoribas/IdentityServer3,remunda/IdentityServer3,uoko-J-Go/IdentityServer,delRyan/IdentityServer3,jonathankarsh/IdentityServer3,uoko-J-Go/IdentityServer,openbizgit/IdentityServer3,bestwpw/IdentityServer3,mvalipour/IdentityServer3,IdentityServer/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,olohmann/IdentityServer3,roflkins/IdentityServer3,tonyeung/IdentityServer3,SonOfSam/IdentityServer3,paulofoliveira/IdentityServer3,bestwpw/IdentityServer3,jonathankarsh/IdentityServer3,iamkoch/IdentityServer3,buddhike/IdentityServer3,wondertrap/IdentityServer3,faithword/IdentityServer3,IdentityServer/IdentityServer3,uoko-J-Go/IdentityServer,wondertrap/IdentityServer3,tuyndv/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,delloncba/IdentityServer3,paulofoliveira/IdentityServer3,charoco/IdentityServer3,tuyndv/IdentityServer3,codeice/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,faithword/IdentityServer3,yanjustino/IdentityServer3,tbitowner/IdentityServer3,mvalipour/IdentityServer3,chicoribas/IdentityServer3,openbizgit/IdentityServer3,angelapper/IdentityServer3,openbizgit/IdentityServer3,paulofoliveira/IdentityServer3,SonOfSam/IdentityServer3,18098924759/IdentityServer3,18098924759/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,jonathankarsh/IdentityServer3,ryanvgates/IdentityServer3,remunda/IdentityServer3,delRyan/IdentityServer3,buddhike/IdentityServer3,charoco/IdentityServer3,jackswei/IdentityServer3,ryanvgates/IdentityServer3,kouweizhong/IdentityServer3
|
source/Core/Services/Default/DefaultRedirectUriValidator.cs
|
source/Core/Services/Default/DefaultRedirectUriValidator.cs
|
/*
* Copyright 2014 Dominick Baier, Brock Allen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Models;
namespace Thinktecture.IdentityServer.Core.Services.Default
{
public class DefaultRedirectUriValidator : IRedirectUriValidator
{
bool UriCollectionContainsUri(IEnumerable<string> collection, string requestedUri)
{
bool result = false;
Uri uri;
if (Uri.TryCreate(requestedUri, UriKind.Absolute, out uri))
{
var uris = collection.Select(x => new Uri(x));
result = uris.Contains(uri);
}
return result;
}
public Task<bool> IsRedirecUriValidAsync(string requestedUri, Client client)
{
return Task.FromResult(UriCollectionContainsUri(client.RedirectUris, requestedUri));
}
public Task<bool> IsPostLogoutRedirecUriValidAsync(string requestedUri, Client client)
{
return Task.FromResult(UriCollectionContainsUri(client.PostLogoutRedirectUris, requestedUri));
}
}
}
|
/*
* Copyright 2014 Dominick Baier, Brock Allen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Models;
namespace Thinktecture.IdentityServer.Core.Services.Default
{
public class DefaultRedirectUriValidator : IRedirectUriValidator
{
public Task<bool> IsRedirecUriValidAsync(string requestedUri, Client client)
{
var result = client.RedirectUris.Contains(requestedUri);
return Task.FromResult(result);
}
public Task<bool> IsPostLogoutRedirecUriValidAsync(string requestedUri, Client client)
{
var result = client.PostLogoutRedirectUris.Contains(requestedUri);
return Task.FromResult(result);
}
}
}
|
apache-2.0
|
C#
|
75a23a77932ea8aaf2455c23972a566b1c8024c8
|
throw exception on channel response error
|
heksesang/Emby.Plugins,SvenVandenbrande/Emby.Plugins,lalmanzar/MediaBrowser.Plugins,Pengwyns/Emby.Plugins,MediaBrowser/Emby.Plugins,lalmanzar/MediaBrowser.Plugins,heksesang/Emby.Plugins,SvenVandenbrande/Emby.Plugins,hamstercat/Emby.Plugins,SvenVandenbrande/Emby.Plugins,hamstercat/Emby.Plugins,MediaBrowser/Emby.Plugins,heksesang/Emby.Plugins,Pengwyns/Emby.Plugins
|
MediaBrowser.Plugins.NextPvr/ChannelResponse.cs
|
MediaBrowser.Plugins.NextPvr/ChannelResponse.cs
|
using System;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Serialization;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
namespace MediaBrowser.Plugins.NextPvr
{
public class ChannelResponse
{
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
public IEnumerable<ChannelInfo> GetChannels(Stream stream, IJsonSerializer json)
{
var root = json.DeserializeFromStream<RootObject>(stream);
if (root.channelsJSONObject.rtn != null && root.channelsJSONObject.rtn.Error)
{
throw new ApplicationException(root.channelsJSONObject.rtn.Message ?? "Failed to download channel information.");
}
if (root.channelsJSONObject != null && root.channelsJSONObject.Channels != null)
{
return root.channelsJSONObject.Channels.Select(i => new ChannelInfo
{
Name = i.channel.channelName,
Number = i.channel.channelNum.ToString(_usCulture),
Id = i.channel.channelOID.ToString(_usCulture)
});
}
return new List<ChannelInfo>();
}
private class Channel2
{
public int channelNum { get; set; }
public string channelName { get; set; }
public int channelOID { get; set; }
public string channelIcon { get; set; }
}
private class Channel
{
public Channel2 channel { get; set; }
}
private class Rtn
{
public bool Error { get; set; }
public string Message { get; set; }
}
private class ChannelsJSONObject
{
public List<Channel> Channels { get; set; }
public Rtn rtn { get; set; }
}
private class RootObject
{
public ChannelsJSONObject channelsJSONObject { get; set; }
}
}
}
|
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Serialization;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
namespace MediaBrowser.Plugins.NextPvr
{
public class ChannelResponse
{
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
public IEnumerable<ChannelInfo> GetChannels(Stream stream, IJsonSerializer json)
{
var root = json.DeserializeFromStream<RootObject>(stream);
if (root.channelsJSONObject != null && root.channelsJSONObject.Channels != null)
{
return root.channelsJSONObject.Channels.Select(i => new ChannelInfo
{
Name = i.channel.channelName,
Number = i.channel.channelNum.ToString(_usCulture),
Id = i.channel.channelOID.ToString(_usCulture)
});
}
return new List<ChannelInfo>();
}
private class Channel2
{
public int channelNum { get; set; }
public string channelName { get; set; }
public int channelOID { get; set; }
public string channelIcon { get; set; }
}
private class Channel
{
public Channel2 channel { get; set; }
}
private class Rtn
{
public bool Error { get; set; }
public string Message { get; set; }
}
private class ChannelsJSONObject
{
public List<Channel> Channels { get; set; }
public Rtn rtn { get; set; }
}
private class RootObject
{
public ChannelsJSONObject channelsJSONObject { get; set; }
}
}
}
|
mit
|
C#
|
e24efcf37f37c55eb2bd244e66417f73a3636874
|
Bump version to 1.2
|
kevinkuszyk/FluentAssertions.Ioc.Ninject,kevinkuszyk/FluentAssertions.Ioc.Ninject
|
src/FluentAssertions.Ioc.Ninject/Properties/AssemblyInfo.cs
|
src/FluentAssertions.Ioc.Ninject/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("FluentAssertions.Ioc.Ninject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Kevin Kuszyk")]
[assembly: AssemblyProduct("FluentAssertions.Ioc.Ninject")]
[assembly: AssemblyCopyright("Copyright © Kevin Kuszyk 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("eb2c95ef-fc68-4d39-9c44-483e9a476c2a")]
// 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")]
[assembly: AssemblyInformationalVersion("1.2.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FluentAssertions.Ioc.Ninject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Kevin Kuszyk")]
[assembly: AssemblyProduct("FluentAssertions.Ioc.Ninject")]
[assembly: AssemblyCopyright("Copyright © Kevin Kuszyk 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("eb2c95ef-fc68-4d39-9c44-483e9a476c2a")]
// 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")]
[assembly: AssemblyInformationalVersion("1.1.0")]
|
apache-2.0
|
C#
|
81df865e62b21d956e77dd50b8e03ada36718196
|
add comment
|
angeldnd/dap.core.csharp
|
Scripts/DapCore/context_/property_/IProperty.cs
|
Scripts/DapCore/context_/property_/IProperty.cs
|
using System;
using System.Collections.Generic;
namespace angeldnd.dap {
public interface IProperty : IVar {
Data Encode();
bool Decode(Data data);
/*
* Not have logic with DapType check, the format of the data is same,
* still having the "v" as key.
*/
Data EncodeValue();
bool DecodeValue(Data data);
}
public interface IProperty<T> : IVar<T>, IProperty {
}
}
|
using System;
using System.Collections.Generic;
namespace angeldnd.dap {
public interface IProperty : IVar {
Data Encode();
bool Decode(Data data);
Data EncodeValue();
bool DecodeValue(Data data);
}
public interface IProperty<T> : IVar<T>, IProperty {
}
}
|
mit
|
C#
|
a066f2801d080da00a4d94d3c1453abe8d4dc59c
|
make sure to set the filemanager in all cases
|
dipeshc/BTDeploy
|
src/MonoTorrent/MonoTorrent.Client/PieceWriter/PieceData.cs
|
src/MonoTorrent/MonoTorrent.Client/PieceWriter/PieceData.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace MonoTorrent.Client
{
public class PieceData
{
public ArraySegment<byte> Buffer;
private int count;
private PeerIdInternal id;
private Piece piece;
private int pieceIndex;
private int startOffset;
private FileManager fileManager;
public int BlockIndex
{
get { return PiecePickerBase.GetBlockIndex(piece.Blocks, startOffset, count); }
}
public int Count
{
get { return count; }
}
internal PeerIdInternal Id
{
get { return id; }
}
public FileManager Manager
{
get { return fileManager; }
}
public Piece Piece
{
get { return piece; }
set { piece = value; }
}
public int PieceIndex
{
get { return pieceIndex; }
}
public int StartOffset
{
get { return startOffset; }
}
public long WriteOffset
{
get { return (long)fileManager.PieceLength * pieceIndex + startOffset; }
}
internal PieceData(ArraySegment<byte> buffer, int pieceIndex, int startOffset, int count, PeerIdInternal id)
{
this.Buffer = buffer;
this.count = count;
this.id = id;
this.pieceIndex = pieceIndex;
this.startOffset = startOffset;
this.fileManager = id.TorrentManager.FileManager;
}
public PieceData(ArraySegment<byte> buffer, int pieceIndex, int startOffset, int count, FileManager manager)
: this(buffer, pieceIndex, startOffset, count, (PeerIdInternal)null)
{
fileManager = manager;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace MonoTorrent.Client
{
public class PieceData
{
public ArraySegment<byte> Buffer;
private int count;
private PeerIdInternal id;
private Piece piece;
private int pieceIndex;
private int startOffset;
private FileManager fileManager;
public int BlockIndex
{
get { return PiecePickerBase.GetBlockIndex(piece.Blocks, startOffset, count); }
}
public int Count
{
get { return count; }
}
internal PeerIdInternal Id
{
get { return id; }
}
public FileManager Manager
{
get { return fileManager; }
}
public Piece Piece
{
get { return piece; }
set { piece = value; }
}
public int PieceIndex
{
get { return pieceIndex; }
}
public int StartOffset
{
get { return startOffset; }
}
public long WriteOffset
{
get { return (long)fileManager.PieceLength * pieceIndex + startOffset; }
}
internal PieceData(ArraySegment<byte> buffer, int pieceIndex, int startOffset, int count, PeerIdInternal id)
{
this.Buffer = buffer;
this.count = count;
this.id = id;
this.pieceIndex = pieceIndex;
this.startOffset = startOffset;
}
public PieceData(ArraySegment<byte> buffer, int pieceIndex, int startOffset, int count, FileManager manager)
: this(buffer, pieceIndex, startOffset, count, (PeerIdInternal)null)
{
fileManager = manager;
}
}
}
|
mit
|
C#
|
7d6e27a23ec88138ada829f50e473cea394df189
|
Allow conversion of UInt64 based enums
|
pythonnet/pythonnet,pythonnet/pythonnet,pythonnet/pythonnet
|
src/runtime/Codecs/EnumPyIntCodec.cs
|
src/runtime/Codecs/EnumPyIntCodec.cs
|
using System;
namespace Python.Runtime.Codecs
{
[Obsolete]
public sealed class EnumPyIntCodec : IPyObjectEncoder, IPyObjectDecoder
{
public static EnumPyIntCodec Instance { get; } = new EnumPyIntCodec();
public bool CanDecode(PyType objectType, Type targetType)
{
return targetType.IsEnum
&& objectType.IsSubclass(Runtime.PyLongType);
}
public bool CanEncode(Type type)
{
return type == typeof(object) || type == typeof(ValueType) || type.IsEnum;
}
public bool TryDecode<T>(PyObject pyObj, out T? value)
{
value = default;
if (!typeof(T).IsEnum) return false;
Type etype = Enum.GetUnderlyingType(typeof(T));
if (!PyInt.IsIntType(pyObj)) return false;
object? result;
try
{
result = pyObj.AsManagedObject(etype);
}
catch (InvalidCastException)
{
return false;
}
if (Enum.IsDefined(typeof(T), result) || typeof(T).IsFlagsEnum())
{
value = (T)Enum.ToObject(typeof(T), result);
return true;
}
return false;
}
public PyObject? TryEncode(object value)
{
if (value is null) return null;
var enumType = value.GetType();
if (!enumType.IsEnum) return null;
try
{
return new PyInt(Convert.ToInt64(value));
}
catch (OverflowException)
{
return new PyInt(Convert.ToUInt64(value));
}
}
private EnumPyIntCodec() { }
}
}
|
using System;
namespace Python.Runtime.Codecs
{
[Obsolete]
public sealed class EnumPyIntCodec : IPyObjectEncoder, IPyObjectDecoder
{
public static EnumPyIntCodec Instance { get; } = new EnumPyIntCodec();
public bool CanDecode(PyType objectType, Type targetType)
{
return targetType.IsEnum
&& objectType.IsSubclass(Runtime.PyLongType);
}
public bool CanEncode(Type type)
{
return type == typeof(object) || type == typeof(ValueType) || type.IsEnum;
}
public bool TryDecode<T>(PyObject pyObj, out T? value)
{
value = default;
if (!typeof(T).IsEnum) return false;
Type etype = Enum.GetUnderlyingType(typeof(T));
if (!PyInt.IsIntType(pyObj)) return false;
object? result;
try
{
result = pyObj.AsManagedObject(etype);
}
catch (InvalidCastException)
{
return false;
}
if (Enum.IsDefined(typeof(T), result) || typeof(T).IsFlagsEnum())
{
value = (T)Enum.ToObject(typeof(T), result);
return true;
}
return false;
}
public PyObject? TryEncode(object value)
{
if (value is null) return null;
var enumType = value.GetType();
if (!enumType.IsEnum) return null;
return new PyInt(Convert.ToInt64(value));
}
private EnumPyIntCodec() { }
}
}
|
mit
|
C#
|
d79190c936ce0e79cbb7759d1ef7c46facac448f
|
Update XGroupDragAndDropListBox.cs
|
wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
Core2D.Wpf/Controls/Custom/Lists/XGroupDragAndDropListBox.cs
|
Core2D.Wpf/Controls/Custom/Lists/XGroupDragAndDropListBox.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using System.Windows.Controls;
namespace Core2D.Wpf.Controls.Custom.Lists
{
/// <summary>
/// The <see cref="ListBox"/> control for <see cref="XGroup"/> items with drag and drop support.
/// </summary>
public class XGroupDragAndDropListBox : DragAndDropListBox<XGroup>
{
/// <summary>
/// Initializes a new instance of the <see cref="XGroupDragAndDropListBox"/> class.
/// </summary>
public XGroupDragAndDropListBox()
: base()
{
this.Initialized += (s, e) => base.Initialize();
}
/// <summary>
/// Updates DataContext collection ImmutableArray property.
/// </summary>
/// <param name="array">The updated immutable array.</param>
public override void UpdateDataContext(ImmutableArray<XGroup> array)
{
var editor = (Core2D.Editor)this.Tag;
var gl = editor.Project.CurrentGroupLibrary;
var previous = gl.Items;
var next = array;
editor.Project?.History?.Snapshot(previous, next, (p) => gl.Items = p);
gl.Items = next;
}
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using System.Windows.Controls;
namespace Core2D.Wpf.Controls.Custom.Lists
{
/// <summary>
/// The <see cref="ListBox"/> control for <see cref="XGroup"/> items with drag and drop support.
/// </summary>
public class XGroupDragAndDropListBox : DragAndDropListBox<XGroup>
{
/// <summary>
/// Initializes a new instance of the <see cref="XGroupDragAndDropListBox"/> class.
/// </summary>
public XGroupDragAndDropListBox()
: base()
{
this.Initialized += (s, e) => base.Initialize();
}
/// <summary>
/// Updates DataContext collection ImmutableArray property.
/// </summary>
/// <param name="array">The updated immutable array.</param>
public override void UpdateDataContext(ImmutableArray<XGroup> array)
{
var editor = (Core2D.Editor)this.Tag;
var gl = editor.Project.CurrentGroupLibrary;
var previous = gl.Items;
var next = array;
editor.project?.History?.Snapshot(previous, next, (p) => gl.Items = p);
gl.Items = next;
}
}
}
|
mit
|
C#
|
ba36b934a503038a46d62e60263af281e9e1e237
|
Update WorkingWithContentTypeProperties.cs
|
aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET
|
Examples/CSharp/Workbook/WorkingWithContentTypeProperties.cs
|
Examples/CSharp/Workbook/WorkingWithContentTypeProperties.cs
|
using Aspose.Cells.WebExtensions;
using System;
namespace Aspose.Cells.Examples.CSharp._Workbook
{
public class WorkingWithContentTypeProperties
{
public static void Run()
{
// ExStart:1
//source directory
string outputDir = RunExamples.Get_OutputDirectory();
Workbook workbook = new Workbook(FileFormatType.Xlsx);
int index = workbook.ContentTypeProperties.Add("MK31", "Simple Data");
workbook.ContentTypeProperties[index].IsNillable = true;
index = workbook.ContentTypeProperties.Add("MK32", DateTime.Now.ToString("yyyy-MM-dd'T'hh:mm:ss"), "DateTime");
workbook.ContentTypeProperties[index].IsNillable = true;
workbook.Save(outputDir + "WorkingWithContentTypeProperties_out.xlsx");
// ExEnd:1
Console.WriteLine("WorkingWithContentTypeProperties executed successfully.");
}
}
}
|
using Aspose.Cells.WebExtensions;
using System;
namespace Aspose.Cells.Examples.CSharp._Workbook
{
public class WorkingWithContentTypeProperties
{
public static void Run()
{
// ExStart:1
//source directory
string outputDir = RunExamples.Get_OutputDirectory();
Workbook workbook = new Workbook(FileFormatType.Xlsx);
int index = workbook.ContentTypeProperties.Add("MK31", "Simple Data");
workbook.ContentTypeProperties[index].IsNillable = true;
index = workbook.ContentTypeProperties.Add("MK32", System.DateTime.Now.ToShortDateString(), "DateTime");
//index = workbook.ContentTypeProperties.Add("MK32", DateTime.Now.ToString("yyyy-MM-dd'T'hh:mm:ss"), "DateTime");
workbook.ContentTypeProperties[index].IsNillable = false;
workbook.Save(outputDir + "WorkingWithContentTypeProperties_out.xlsx");
// ExEnd:1
Console.WriteLine("WorkingWithContentTypeProperties executed successfully.");
}
}
}
|
mit
|
C#
|
9a22b6e1df22c8e7de3f8dce967d296a8c662385
|
Create first automated acceptance test
|
lifebeyondfife/Decider
|
Examples/LeagueGeneration/Program.cs
|
Examples/LeagueGeneration/Program.cs
|
/*
Copyright © Iain McDonald 2010-2020
This file is part of Decider.
*/
using System;
using System.Collections.Generic;
using System.Linq;
namespace Decider.Example.LeagueGeneration
{
public class Program
{
static void Main(string[] args)
{
var leagueGeneration = new LeagueGeneration((args.Length >= 1) ? Int32.Parse(args[0]) : 20);
leagueGeneration.Search();
leagueGeneration.GenerateFixtures();
for (var i = 0; i < leagueGeneration.FixtureWeeks.Length; ++i)
{
for (var j = 0; j < leagueGeneration.FixtureWeeks[i].Length; ++j)
Console.Write(string.Format("{0,2}", leagueGeneration.FixtureWeeks[i][j]) + " ");
Console.WriteLine();
}
Console.WriteLine();
Console.WriteLine("Runtime:\t{0}\nBacktracks:\t{1}", leagueGeneration.State.Runtime, leagueGeneration.State.Backtracks);
Console.WriteLine("Solutions:\t{0}", leagueGeneration.State.NumberOfSolutions);
}
}
}
|
/*
Copyright © Iain McDonald 2010-2020
This file is part of Decider.
*/
using System;
using System.Collections.Generic;
using System.Linq;
namespace Decider.Example.LeagueGeneration
{
public class Program
{
static void Main(string[] args)
{
var leagueGeneration = new LeagueGeneration((args.Length >= 1) ? Int32.Parse(args[0]) : 20);
leagueGeneration.Search();
leagueGeneration.GenerateFixtures();
for (var i = 0; i < leagueGeneration.FixtureWeeks.Length; ++i)
{
for (var j = 0; j < leagueGeneration.FixtureWeeks[i].Length; ++j)
Console.Write(string.Format("{0,2}", leagueGeneration.FixtureWeeks[i][j]) + " ");
Console.WriteLine();
}
Console.WriteLine();
Console.WriteLine("Runtime:\t{0}\nBacktracks:\t{1}", leagueGeneration.State.Runtime, leagueGeneration.State.Backtracks);
Console.WriteLine("Solutions:\t{0}", leagueGeneration.State.NumberOfSolutions);
}
}
}
|
mit
|
C#
|
cfa1ebd7c0d11c574e1967ed947501d16f674921
|
Remove DebuggerDisplay attribute not applicable anymore
|
paiden/Nett
|
Source/Nett/TomlConverter.cs
|
Source/Nett/TomlConverter.cs
|
using System;
namespace Nett
{
internal sealed class TomlConverter<TFrom, TTo> : TomlConverterBase<TFrom, TTo>
{
private readonly Func<TFrom, TTo> convert;
public TomlConverter(Func<TFrom, TTo> convert)
{
if (convert == null) { throw new ArgumentNullException(nameof(convert)); }
this.convert = convert;
}
public override TTo Convert(TFrom from, Type targetType) => this.convert(from);
}
}
|
using System;
using System.Diagnostics;
namespace Nett
{
[DebuggerDisplay("{FromType} -> {ToType}")]
internal sealed class TomlConverter<TFrom, TTo> : TomlConverterBase<TFrom, TTo>
{
private readonly Func<TFrom, TTo> convert;
public TomlConverter(Func<TFrom, TTo> convert)
{
if (convert == null) { throw new ArgumentNullException(nameof(convert)); }
this.convert = convert;
}
public override TTo Convert(TFrom from, Type targetType) => this.convert(from);
}
}
|
mit
|
C#
|
e970acad7f21c954a8808f603a07ad884addae5f
|
Make all strings in loaded TdfNodes lowercase
|
MHeasell/TAUtil,MHeasell/TAUtil
|
TAUtil/Tdf/TdfNodeAdapter.cs
|
TAUtil/Tdf/TdfNodeAdapter.cs
|
namespace TAUtil.Tdf
{
using System.Collections.Generic;
public class TdfNodeAdapter : ITdfNodeAdapter
{
private readonly Stack<TdfNode> nodeStack = new Stack<TdfNode>();
public TdfNodeAdapter()
{
this.RootNode = new TdfNode();
this.nodeStack.Push(this.RootNode);
}
public TdfNode RootNode { get; private set; }
public void BeginBlock(string name)
{
name = name.ToLowerInvariant();
TdfNode n = new TdfNode(name);
this.nodeStack.Peek().Keys[name] = n;
this.nodeStack.Push(n);
}
public void AddProperty(string name, string value)
{
name = name.ToLowerInvariant();
value = value.ToLowerInvariant();
this.nodeStack.Peek().Entries[name] = value;
}
public void EndBlock()
{
this.nodeStack.Pop();
}
}
}
|
namespace TAUtil.Tdf
{
using System.Collections.Generic;
public class TdfNodeAdapter : ITdfNodeAdapter
{
private readonly Stack<TdfNode> nodeStack = new Stack<TdfNode>();
public TdfNodeAdapter()
{
this.RootNode = new TdfNode();
this.nodeStack.Push(this.RootNode);
}
public TdfNode RootNode { get; private set; }
public void BeginBlock(string name)
{
TdfNode n = new TdfNode(name);
this.nodeStack.Peek().Keys[name] = n;
this.nodeStack.Push(n);
}
public void AddProperty(string name, string value)
{
this.nodeStack.Peek().Entries[name] = value;
}
public void EndBlock()
{
this.nodeStack.Pop();
}
}
}
|
mit
|
C#
|
a1717f4f1c248609ea7c416fcc3bdb965c915f13
|
Improve object store
|
ermshiperete/undisposed-fody,ermshiperete/undisposed-fody
|
Undisposed/DisposeTracker.cs
|
Undisposed/DisposeTracker.cs
|
// Copyright (c) 2014 Eberhard Beilharz
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace Undisposed
{
public static class DisposeTracker
{
private static Dictionary<Type, int> _Registrations = new Dictionary<Type, int>();
private static Dictionary<int, int> _ObjectNumber = new Dictionary<int, int>();
private static Dictionary<Type, List<int>> _UndisposedObjects = new Dictionary<Type, List<int>>();
public static TrackerOutputKind OutputKind { get; set; }
public static void Reset()
{
_Registrations = new Dictionary<Type, int>();
_ObjectNumber = new Dictionary<int, int>();
_UndisposedObjects = new Dictionary<Type, List<int>>();
}
public static void Register(object obj)
{
var t = obj.GetType();
var hash = RuntimeHelpers.GetHashCode(obj);
if (!_Registrations.ContainsKey(t))
{
_Registrations.Add(t, 1);
_UndisposedObjects.Add(t, new List<int>());
}
var thisNumber = _Registrations[t]++;
_ObjectNumber.Add(hash, thisNumber);
_UndisposedObjects[t].Add(thisNumber);
if ((OutputKind & TrackerOutputKind.Registration) != 0)
Console.WriteLine("*** Creating {0} {1}", t.FullName, thisNumber);
}
public static void Unregister(object obj)
{
var t = obj.GetType();
var hash = RuntimeHelpers.GetHashCode(obj);
int thisNumber;
if (!_ObjectNumber.TryGetValue(hash, out thisNumber))
{
Console.WriteLine("Disposing {0}: Error: Object was not registered", t.FullName);
return;
}
if ((OutputKind & TrackerOutputKind.Registration) != 0)
Console.WriteLine("*** Disposing {0} {1}", t.FullName, thisNumber);
_ObjectNumber.Remove(hash);
_UndisposedObjects[t].Remove(thisNumber);
if (_UndisposedObjects[t].Count == 0)
_UndisposedObjects.Remove(t);
DumpUndisposedObjects();
}
private static void DumpUndisposedObjects()
{
if ((OutputKind & TrackerOutputKind.Dump) == 0)
return;
Console.WriteLine("**** Undisposed Object Dump:");
foreach (var type in _UndisposedObjects.Keys)
{
Console.Write("\t{0}: ", type.FullName);
foreach (var n in _UndisposedObjects[type])
{
Console.Write("{0},", n);
}
Console.WriteLine();
}
}
}
}
|
// Copyright (c) 2014 Eberhard Beilharz
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using System.Collections.Generic;
namespace Undisposed
{
public static class DisposeTracker
{
private static Dictionary<Type, int> _Registrations = new Dictionary<Type, int>();
private static Dictionary<object, int> _ObjectNumber = new Dictionary<object, int>();
private static Dictionary<Type, List<int>> _UndisposedObjects = new Dictionary<Type, List<int>>();
public static TrackerOutputKind OutputKind { get; set; }
public static void Reset()
{
_Registrations = new Dictionary<Type, int>();
_ObjectNumber = new Dictionary<object, int>();
_UndisposedObjects = new Dictionary<Type, List<int>>();
}
public static void Register(object obj)
{
var t = obj.GetType();
if (!_Registrations.ContainsKey(t))
{
_Registrations.Add(t, 1);
_UndisposedObjects.Add(t, new List<int>());
}
var thisNumber = _Registrations[t]++;
_ObjectNumber.Add(obj, thisNumber);
_UndisposedObjects[t].Add(thisNumber);
if ((OutputKind & TrackerOutputKind.Registration) != 0)
Console.WriteLine("*** Creating {0} {1}", t.FullName, thisNumber);
}
public static void Unregister(object obj)
{
var t = obj.GetType();
int thisNumber;
if (!_ObjectNumber.TryGetValue(obj, out thisNumber))
{
Console.WriteLine("Disposing {0}: Error: Object was not registered", t.FullName);
return;
}
if ((OutputKind & TrackerOutputKind.Registration) != 0)
Console.WriteLine("*** Disposing {0} {1}", t.FullName, thisNumber);
_ObjectNumber.Remove(obj);
_UndisposedObjects[t].Remove(thisNumber);
if (_UndisposedObjects[t].Count == 0)
_UndisposedObjects.Remove(t);
DumpUndisposedObjects();
}
private static void DumpUndisposedObjects()
{
if ((OutputKind & TrackerOutputKind.Dump) == 0)
return;
Console.WriteLine("**** Undisposed Object Dump:");
foreach (var type in _UndisposedObjects.Keys)
{
Console.Write("\t{0}: ", type.FullName);
foreach (var n in _UndisposedObjects[type])
{
Console.Write("{0},", n);
}
Console.WriteLine();
}
}
}
}
|
mit
|
C#
|
f742ceecbdab2f559bab7b2dc105c579ab117b17
|
Fix incorrect syntax
|
Seddryck/NBi,Seddryck/NBi
|
NBi.Core/Batch/BatchRunnerFactory.cs
|
NBi.Core/Batch/BatchRunnerFactory.cs
|
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace NBi.Core.Batch
{
class BatchRunnerFactory
{
public IDecorationCommandImplementation Get(IBatchCommand command)
{
var connectionFactory = new ConnectionFactory();
var connection = connectionFactory.Get(command.ConnectionString);
var directory = AssemblyDirectory;
var filename = string.Format("NBi.Core.{0}.dll", command.Version);
var filepath = string.Format("{0}\\{1}", directory, filename);
if (!File.Exists(filepath))
throw new InvalidOperationException(string.Format("Can't find the dll for version '{0}' in '{1}'. NBi was expecting to find a dll named '{2}'.", "2014", directory, filename));
var assembly = Assembly.LoadFrom(filepath);
var types = assembly.GetTypes()
.Where(m => m.IsClass && m.GetInterface("IBatchRunnerFatory") != null);
if (types.Count() == 0)
throw new InvalidOperationException(string.Format("Can't find a class implementing 'IBatchRunnerFatory' in '{0}'.", assembly.FullName));
if (types.Count() > 1)
throw new InvalidOperationException(string.Format("Found more than one class implementing 'IBatchRunnerFatory' in '{0}'.", assembly.FullName));
var batchFactory = Activator.CreateInstance(types.ElementAt(0)) as IBatchRunnerFatory;
var batchRunner = batchFactory.Get(command, connection);
return batchRunner;
}
private static string AssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace NBi.Core.Batch
{
class BatchRunnerFactory
{
public IDecorationCommandImplementation Get(IBatchCommand command)
{
var connectionFactory = new ConnectionFactory();
var connection = connectionFactory.Get(command.ConnectionString);
var directory = AssemblyDirectory;
var filename = $"NBi.Core.{command.Version}.dll";
var filepath = $"{directory}\\{filename}";
if (!File.Exists(filepath))
throw new InvalidOperationException(string.Format("Can't find the dll for version '{0}' in '{1}'. NBi was expecting to find a dll named '{2}'.", "2014", directory, filename));
var assembly = Assembly.LoadFrom(filepath);
var types = assembly.GetTypes()
.Where(m => m.IsClass && m.GetInterface("IBatchRunnerFatory") != null);
if (types.Count() == 0)
throw new InvalidOperationException(string.Format("Can't find a class implementing 'IBatchRunnerFatory' in '{0}'.", assembly.FullName));
if (types.Count() > 1)
throw new InvalidOperationException(string.Format("Found more than one class implementing 'IBatchRunnerFatory' in '{0}'.", assembly.FullName));
var batchFactory = Activator.CreateInstance(types.ElementAt(0)) as IBatchRunnerFatory;
var batchRunner = batchFactory.Get(command, connection);
return batchRunner;
}
private static string AssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}
}
}
|
apache-2.0
|
C#
|
9102c5190183a893fecd883f5754d882020c2825
|
remove un-used namespaces.
|
devlights/MyHelloWorld
|
MyHelloWorld/HelloWorld.StdOut/Program.cs
|
MyHelloWorld/HelloWorld.StdOut/Program.cs
|
namespace HelloWorld.StdOut
{
using System;
using System.Collections.Generic;
using System.Linq;
using HelloWorld.Core;
using HelloWorld.Core.NinjectModules;
using Ninject;
class Program
{
static void Main()
{
var kernel = new StandardKernel(new HelloWorldModule());
var manager = kernel.Get<IMessageManager>();
Console.WriteLine(manager.GetMessage("devlights"));
}
}
}
|
namespace HelloWorld.StdOut
{
using System;
using System.Collections.Generic;
using System.Linq;
using Ninject;
using Ninject.Parameters;
using HelloWorld.Core;
using HelloWorld.Core.NinjectModules;
class Program
{
static void Main()
{
var kernel = new StandardKernel(new HelloWorldModule());
var manager = kernel.Get<IMessageManager>();
Console.WriteLine(manager.GetMessage("devlights"));
}
}
}
|
mit
|
C#
|
8ce57e29ff57553dae72223704332d3e65ccc925
|
Correct delegate build error and address bar now updates properly to the navigated page.
|
xcjs/tray-webview,xcjs/NotificationWebView
|
NotificationWebView/ViewModels/Browser.cs
|
NotificationWebView/ViewModels/Browser.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using CefSharp;
using CefSharp.Wpf;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
namespace NotificationWebView.ViewModels
{
public class Browser: ViewModelBase
{
private string _addressInput;
public string AddressInput
{
get
{
return _addressInput;
}
set
{
Set(ref _addressInput, value);
}
}
private string _address;
public string Address
{
get
{
return _address;
}
set
{
Set(ref _address, value);
}
}
private string _title;
public string Title
{
get
{
return _title;
}
set
{
Set(ref _title, value);
}
}
private IWpfWebBrowser _webView;
public IWpfWebBrowser WebView
{
get {
return _webView;
}
set
{
Set(ref _webView, value);
}
}
public ICommand GoCommand { get; private set; }
private const string HOME_PAGE = "https://www.google.com/";
public Browser()
{
PropertyChanged += OnPropertyChanged;
AddressInput = HOME_PAGE;
Go();
GoCommand = new RelayCommand(Go, () => !string.IsNullOrWhiteSpace(Address));
}
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case nameof(Address):
AddressInput = Address;
break;
case nameof(WebView):
AssignEvents();
break;
}
}
private void AssignEvents()
{
if(WebView == null) return;
WebView.FrameLoadEnd += delegate
{
Application.Current.Dispatcher.BeginInvoke((Action)(() => WebView.Focus()));
};
}
private void Go()
{
Address = AddressInput;
Keyboard.ClearFocus();
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using CefSharp;
using CefSharp.Wpf;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
namespace NotificationWebView.ViewModels
{
public class Browser: ViewModelBase
{
private string _addressInput;
public string AddressInput
{
get
{
return _addressInput;
}
set
{
Set(ref _addressInput, value);
}
}
private string _address;
public string Address
{
get
{
return _address;
}
set
{
Set(ref _address, value);
}
}
private string _title;
public string Title
{
get
{
return _title;
}
set
{
Set(ref _title, value);
}
}
private IWpfWebBrowser _webView;
public IWpfWebBrowser WebView
{
get {
return _webView;
}
set
{
Set(ref _webView, value);
}
}
public ICommand GoCommand { get; private set; }
private const string HOME_PAGE = "https://www.google.com";
public Browser()
{
PropertyChanged += OnPropertyChanged;
AddressInput = HOME_PAGE;
Go();
GoCommand = new RelayCommand(Go, () => !string.IsNullOrWhiteSpace(Address));
}
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case "WebBrowser":
if (WebView != null)
{
// TODO: This is a bit of a hack. It would be nicer/cleaner to give the webBrowser focus in the Go()
// TODO: method, but it seems like "something" gets messed up (= doesn't work correctly) if we give it
// TODO: focus "too early" in the loading process...
WebView.FrameLoadEnd += PageLoaded;
}
break;
}
}
private void Go()
{
Address = AddressInput;
Keyboard.ClearFocus();
}
private void PageLoaded()
{
Application.Current.Dispatcher.BeginInvoke((Action)(() => WebView.Focus()));
}
}
}
|
mit
|
C#
|
0fa2667a004baaa37dc98730a308350ef63b7d50
|
Update PasAccountApiClientRegistry.cs
|
SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice
|
src/SFA.DAS.PAS.Account.Api.ClientV2/DependencyResolution/PasAccountApiClientRegistry.cs
|
src/SFA.DAS.PAS.Account.Api.ClientV2/DependencyResolution/PasAccountApiClientRegistry.cs
|
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using SFA.DAS.PAS.Account.Api.ClientV2.Configuration;
using StructureMap;
using System;
using System.Linq.Expressions;
namespace SFA.DAS.PAS.Account.Api.ClientV2.DependencyResolution
{
public class PasAccountApiClientRegistry : Registry
{
public PasAccountApiClientRegistry(Expression<Func<IContext, PasAccountApiConfiguration>> getApiConfig)
{
For<PasAccountApiConfiguration>().Use(getApiConfig);
For<IPasAccountApiClient>().Use(ctx => CreateClient(ctx)).Singleton();
}
private IPasAccountApiClient CreateClient(IContext ctx)
{
var config = ctx.GetInstance<PasAccountApiConfiguration>();
var loggerFactory = ctx.GetInstance<ILoggerFactory>();
var factory = new PasAccountApiClientFactory(config, loggerFactory);
return factory.CreateClient();
}
}
}
|
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using SFA.DAS.PAS.Account.Api.ClientV2.Configuration;
using StructureMap;
namespace SFA.DAS.PAS.Account.Api.ClientV2.DependencyResolution
{
public class PasAccountApiClientRegistry : Registry
{
public PasAccountApiClientRegistry()
{
For<IPasAccountApiClient>().Use(ctx => CreateClient(ctx)).Singleton();
}
private IPasAccountApiClient CreateClient(IContext ctx)
{
var config = GetConfig(ctx);
var loggerFactory = ctx.GetInstance<ILoggerFactory>();
var factory = new PasAccountApiClientFactory(config, loggerFactory);
return factory.CreateClient();
}
private static PasAccountApiConfiguration GetConfig(IContext context)
{
var configuration = context.GetInstance<IConfiguration>();
var configSection = configuration.GetSection(ConfigurationKeys.PasAccountApiClient);
return configSection.Get<PasAccountApiConfiguration>();
}
}
}
|
mit
|
C#
|
ca19bb54799cff783718e3681e2f5005e0de0e7a
|
Fix broken test
|
celeron533/marukotoolbox
|
mp4boxTests/MainFormTests.cs
|
mp4boxTests/MainFormTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using mp4box.Procedure;
using mp4box.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mp4box.Tests
{
[TestClass()]
public class MainFormTests
{
[TestMethod()]
public void ffmuxbatTest()
{
string input1 = "input1";
string input2 = "input2";
string output = "output";
string resultBeforeRefactor = "\"" + ToolsUtil.FFMPEG.fullPath + "\" -i \"" + input1 + "\" -i \"" + input2 + "\" -sn -c copy -y \"" + output + "\"";
string result = Shared.FFMpegMuxCommand(input1, input2, output);
Assert.AreEqual(resultBeforeRefactor, result);
}
[TestMethod()]
public void boxmuxbatTest()
{
string input1 = "input1";
string input2 = "input2";
string output = "output";
string resultBeforeRefactor = "\"" + ToolsUtil.MP4BOX.fullPath + "\" -add \"" + input1 + "#trackID=1:name=\" -add \"" + input2 + "#trackID=1:name=\" -new \"" + output + "\"";
string result = Shared.MP4MuxCommand(input1, input2, output);
Assert.AreEqual(resultBeforeRefactor, result);
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using mp4box.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mp4box.Tests
{
[TestClass()]
public class MainFormTests
{
[TestMethod()]
public void ffmuxbatTest()
{
MainForm mf = new MainForm();
string input1 = "input1";
string input2 = "input2";
string output = "output";
string resultBeforeRefactor = "\"" + ToolsUtil.FFMPEG.fullPath + "\" -i \"" + input1 + "\" -i \"" + input2 + "\" -sn -c copy -y \"" + output + "\"";
string result = mf.FFMpegMuxCommand(input1, input2, output);
Assert.AreEqual(resultBeforeRefactor, result);
}
[TestMethod()]
public void boxmuxbatTest()
{
MainForm mf = new MainForm();
string input1 = "input1";
string input2 = "input2";
string output = "output";
string resultBeforeRefactor = "\"" + ToolsUtil.MP4BOX.fullPath + "\" -add \"" + input1 + "#trackID=1:name=\" -add \"" + input2 + "#trackID=1:name=\" -new \"" + output + "\"";
string result = mf.MP4MuxCommand(input1, input2, output);
Assert.AreEqual(resultBeforeRefactor, result);
}
}
}
|
apache-2.0
|
C#
|
16b8f8176bb8820c4843adc961f6f9777efa8aad
|
Fix git push refs
|
michael-reichenauer/GitMind
|
GitMind/Utils/Git/Private/GitPush.cs
|
GitMind/Utils/Git/Private/GitPush.cs
|
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace GitMind.Utils.Git.Private
{
internal class GitPush : IGitPush
{
private readonly IGitCmd gitCmd;
private static readonly string PushArgs = "push --porcelain origin";
public GitPush(IGitCmd gitCmd)
{
this.gitCmd = gitCmd;
}
public async Task<GitResult> PushAsync(CancellationToken ct)
{
using (CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(ct))
{
ct = cts.Token;
// In case login failes, we need to detect that
GitOptions options = new GitOptions
{
ErrorProgress = text => ErrorProgress(text, cts),
//InputText = text => InputText(text, ct)
};
return await gitCmd.RunAsync(PushArgs, options, ct);
}
}
public async Task<GitResult> PushBranchAsync(string branchName, CancellationToken ct)
{
string[] refspecs = { $"refs/heads/{branchName}:refs/heads/{branchName}" };
return await PushRefsAsync(refspecs, ct);
}
public async Task<GitResult> PushRefsAsync(IEnumerable<string> refspecs, CancellationToken ct)
{
using (CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(ct))
{
ct = cts.Token;
// In case login failes, we need to detect that
GitOptions options = new GitOptions
{
ErrorProgress = text => ErrorProgress(text, cts),
//InputText = text => InputText(text, ct)
};
string refsText = string.Join(" ", refspecs);
string pushRefsArgs = $"{PushArgs} {refsText}";
return await gitCmd.RunAsync(pushRefsArgs, options, ct);
}
}
private string InputText(CancellationToken text, CancellationToken ct)
{
//await Task.Yield();
return "x";
}
private static void ErrorProgress(string text, CancellationTokenSource cts)
{
Log.Debug($"Push error: {text}");
if (text.Contains("no-gitmind-pswd-prompt"))
{
Log.Warn($"Login failed, {text}");
cts.Cancel();
}
}
}
}
|
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace GitMind.Utils.Git.Private
{
internal class GitPush : IGitPush
{
private readonly IGitCmd gitCmd;
private static readonly string PushArgs = "push --porcelain";
public GitPush(IGitCmd gitCmd)
{
this.gitCmd = gitCmd;
}
public async Task<GitResult> PushAsync(CancellationToken ct)
{
using (CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(ct))
{
ct = cts.Token;
// In case login failes, we need to detect that
GitOptions options = new GitOptions
{
ErrorProgress = text => ErrorProgress(text, cts),
//InputText = text => InputText(text, ct)
};
return await gitCmd.RunAsync(PushArgs, options, ct);
}
}
public async Task<GitResult> PushBranchAsync(string branchName, CancellationToken ct)
{
string[] refspecs = { $"refs/heads/{branchName}:refs/heads/{branchName}" };
return await PushRefsAsync(refspecs, ct);
}
public async Task<GitResult> PushRefsAsync(IEnumerable<string> refspecs, CancellationToken ct)
{
using (CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(ct))
{
ct = cts.Token;
// In case login failes, we need to detect that
GitOptions options = new GitOptions
{
ErrorProgress = text => ErrorProgress(text, cts),
//InputText = text => InputText(text, ct)
};
string refsText = string.Join(" ", refspecs);
string pushRefsArgs = $"{PushArgs} {refsText}";
return await gitCmd.RunAsync(pushRefsArgs, options, ct);
}
}
private string InputText(CancellationToken text, CancellationToken ct)
{
//await Task.Yield();
return "x";
}
private static void ErrorProgress(string text, CancellationTokenSource cts)
{
Log.Debug($"Push error: {text}");
if (text.Contains("no-gitmind-pswd-prompt"))
{
Log.Warn($"Login failed, {text}");
cts.Cancel();
}
}
}
}
|
mit
|
C#
|
a41098b5b577a2fe035c37f62a3a6c10ca5cf8e7
|
Bump de la version de l'assembly à 2.0.0.0 pour marquer les gros changements avec les configs de l'application pour les Sessions.
|
Nutritia/nutritia,Corantin/nutritia,glesaux/nutritia
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("Nutritia")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Nutritia")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
//Pour commencer à générer des applications localisables, définissez
//<UICulture>CultureYouAreCodingWith</UICulture> dans votre fichier .csproj
//dans <PropertyGroup>. Par exemple, si vous utilisez le français
//dans vos fichiers sources, définissez <UICulture> à fr-FR. Puis, supprimez les marques de commentaire de
//l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans
//la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème
//(utilisé si une ressource est introuvable dans la page,
// ou dictionnaires de ressources de l'application)
ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique
//(utilisé si une ressource est introuvable dans la page,
// dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème)
)]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("Nutritia")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Nutritia")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
//Pour commencer à générer des applications localisables, définissez
//<UICulture>CultureYouAreCodingWith</UICulture> dans votre fichier .csproj
//dans <PropertyGroup>. Par exemple, si vous utilisez le français
//dans vos fichiers sources, définissez <UICulture> à fr-FR. Puis, supprimez les marques de commentaire de
//l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans
//la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème
//(utilisé si une ressource est introuvable dans la page,
// ou dictionnaires de ressources de l'application)
ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique
//(utilisé si une ressource est introuvable dans la page,
// dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème)
)]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
|
mpl-2.0
|
C#
|
51f92be49b18fca45759ae8164c7376d6a60e8f0
|
Add DatumConverterFactoryExtensions for non-generic IDatumConverterFactory
|
LukeForder/rethinkdb-net,nkreipke/rethinkdb-net,LukeForder/rethinkdb-net,kangkot/rethinkdb-net,bbqchickenrobot/rethinkdb-net,bbqchickenrobot/rethinkdb-net,Ernesto99/rethinkdb-net,Ernesto99/rethinkdb-net,kangkot/rethinkdb-net,nkreipke/rethinkdb-net
|
rethinkdb-net/DatumConverters/DatumConverterFactoryExtensions.cs
|
rethinkdb-net/DatumConverters/DatumConverterFactoryExtensions.cs
|
using System;
namespace RethinkDb
{
public static class DatumConverterFactoryExtensions
{
#region Generic extensions
public static bool TryGet<T>(this IDatumConverterFactory datumConverterFactory, out IDatumConverter<T> datumConverter)
{
return datumConverterFactory.TryGet<T>(datumConverterFactory, out datumConverter);
}
public static IDatumConverter<T> Get<T>(this IDatumConverterFactory datumConverterFactory)
{
if (datumConverterFactory == null)
throw new ArgumentNullException("datumConverterFactory");
return datumConverterFactory.Get<T>(datumConverterFactory);
}
public static IDatumConverter<T> Get<T>(this IDatumConverterFactory datumConverterFactory, IDatumConverterFactory rootDatumConverterFactory)
{
if (datumConverterFactory == null)
throw new ArgumentNullException("datumConverterFactory");
if (rootDatumConverterFactory == null)
throw new ArgumentNullException("rootDatumConverterFactory");
IDatumConverter<T> retval;
if (datumConverterFactory.TryGet<T>(rootDatumConverterFactory, out retval))
return retval;
else
throw new NotSupportedException(String.Format("Datum converter is not availble for type {0}", typeof(T)));
}
#endregion
#region Non-generic extensions
public static bool TryGet(this IDatumConverterFactory datumConverterFactory, Type datumType, out IDatumConverter datumConverter)
{
return datumConverterFactory.TryGet(datumType, datumConverterFactory, out datumConverter);
}
public static IDatumConverter Get(this IDatumConverterFactory datumConverterFactory, Type datumType)
{
if (datumConverterFactory == null)
throw new ArgumentNullException("datumConverterFactory");
return datumConverterFactory.Get(datumType, datumConverterFactory);
}
public static IDatumConverter Get(this IDatumConverterFactory datumConverterFactory, Type datumType, IDatumConverterFactory rootDatumConverterFactory)
{
if (datumConverterFactory == null)
throw new ArgumentNullException("datumConverterFactory");
if (rootDatumConverterFactory == null)
throw new ArgumentNullException("rootDatumConverterFactory");
IDatumConverter retval;
if (datumConverterFactory.TryGet(datumType, rootDatumConverterFactory, out retval))
return retval;
else
throw new NotSupportedException(String.Format("Datum converter is not availble for type {0}", datumType));
}
#endregion
}
}
|
using System;
namespace RethinkDb
{
public static class DatumConverterFactoryExtensions
{
public static bool TryGet<T>(this IDatumConverterFactory datumConverterFactory, out IDatumConverter<T> datumConverter)
{
return datumConverterFactory.TryGet<T>(datumConverterFactory, out datumConverter);
}
public static IDatumConverter<T> Get<T>(this IDatumConverterFactory datumConverterFactory)
{
if (datumConverterFactory == null)
throw new ArgumentNullException("datumConverterFactory");
return datumConverterFactory.Get<T>(datumConverterFactory);
}
public static IDatumConverter<T> Get<T>(this IDatumConverterFactory datumConverterFactory, IDatumConverterFactory rootDatumConverterFactory)
{
if (datumConverterFactory == null)
throw new ArgumentNullException("datumConverterFactory");
if (rootDatumConverterFactory == null)
throw new ArgumentNullException("rootDatumConverterFactory");
IDatumConverter<T> retval;
if (datumConverterFactory.TryGet<T>(rootDatumConverterFactory, out retval))
return retval;
else
throw new NotSupportedException(String.Format("Datum converter is not availble for type {0}", typeof(T)));
}
}
}
|
apache-2.0
|
C#
|
2ad9dc56e8b0fd68ebd1f60c00ddf696c572f4b4
|
fix native menu cast error.
|
SuperJMN/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,Perspex/Perspex,Perspex/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,akrisiun/Perspex,AvaloniaUI/Avalonia
|
src/Avalonia.Controls/NativeMenu.cs
|
src/Avalonia.Controls/NativeMenu.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using Avalonia.Collections;
using Avalonia.Data;
using Avalonia.LogicalTree;
using Avalonia.Metadata;
namespace Avalonia.Controls
{
public partial class NativeMenu : AvaloniaObject, IEnumerable<NativeMenuItemBase>
{
private AvaloniaList<NativeMenuItemBase> _items =
new AvaloniaList<NativeMenuItemBase> { ResetBehavior = ResetBehavior.Remove };
private NativeMenuItem _parent;
[Content]
public IList<NativeMenuItemBase> Items => _items;
public NativeMenu()
{
_items.Validate = Validator;
_items.CollectionChanged += ItemsChanged;
}
private void Validator(NativeMenuItemBase obj)
{
if (obj.Parent != null)
throw new InvalidOperationException("NativeMenuItem already has a parent");
}
private void ItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if(e.OldItems!=null)
foreach (NativeMenuItemBase i in e.OldItems)
i.Parent = null;
if(e.NewItems!=null)
foreach (NativeMenuItemBase i in e.NewItems)
i.Parent = this;
}
public static readonly DirectProperty<NativeMenu, NativeMenuItem> ParentProperty =
AvaloniaProperty.RegisterDirect<NativeMenu, NativeMenuItem>("Parent", o => o.Parent, (o, v) => o.Parent = v);
public NativeMenuItem Parent
{
get => _parent;
set => SetAndRaise(ParentProperty, ref _parent, value);
}
public void Add(NativeMenuItemBase item) => _items.Add(item);
public IEnumerator<NativeMenuItemBase> GetEnumerator() => _items.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using Avalonia.Collections;
using Avalonia.Data;
using Avalonia.LogicalTree;
using Avalonia.Metadata;
namespace Avalonia.Controls
{
public partial class NativeMenu : AvaloniaObject, IEnumerable<NativeMenuItemBase>
{
private AvaloniaList<NativeMenuItemBase> _items =
new AvaloniaList<NativeMenuItemBase> { ResetBehavior = ResetBehavior.Remove };
private NativeMenuItem _parent;
[Content]
public IList<NativeMenuItemBase> Items => _items;
public NativeMenu()
{
_items.Validate = Validator;
_items.CollectionChanged += ItemsChanged;
}
private void Validator(NativeMenuItemBase obj)
{
if (obj.Parent != null)
throw new InvalidOperationException("NativeMenuItem already has a parent");
}
private void ItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if(e.OldItems!=null)
foreach (NativeMenuItem i in e.OldItems)
i.Parent = null;
if(e.NewItems!=null)
foreach (NativeMenuItem i in e.NewItems)
i.Parent = this;
}
public static readonly DirectProperty<NativeMenu, NativeMenuItem> ParentProperty =
AvaloniaProperty.RegisterDirect<NativeMenu, NativeMenuItem>("Parent", o => o.Parent, (o, v) => o.Parent = v);
public NativeMenuItem Parent
{
get => _parent;
set => SetAndRaise(ParentProperty, ref _parent, value);
}
public void Add(NativeMenuItemBase item) => _items.Add(item);
public IEnumerator<NativeMenuItemBase> GetEnumerator() => _items.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
|
mit
|
C#
|
cfd032c16c2da6f144520dd59002c013a98a0799
|
Update version to 2.2.0
|
TheOtherTimDuncan/TOTD
|
SharedAssemblyInfo.cs
|
SharedAssemblyInfo.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: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Other Tim Duncan")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.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: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Other Tim Duncan")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyFileVersion("2.1.1.0")]
|
mit
|
C#
|
bad8cae8e001e22f2df5903af9b517422d5b6367
|
Add missing RET to reverse patch transpiler
|
pardeike/Harmony
|
HarmonyTests/ReversePatching/Assets/ReversePatches.cs
|
HarmonyTests/ReversePatching/Assets/ReversePatches.cs
|
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
namespace HarmonyLibTests.Assets
{
public class Class0Reverse
{
public string Method(string original, int n)
{
var parts = original.Split('-').Reverse().ToArray();
var str = string.Join("", parts) + n;
return str + "Prolog";
}
}
public class Class0ReversePatch
{
public static string StringOperation(string original)
{
// This inner transpiler will be applied to the original and
// the result will replace this method
//
// That will allow this method to have a different signature
// than the original and it must match the transpiled result
//
IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
var list = Transpilers.Manipulator(instructions,
item => item.opcode == OpCodes.Ldarg_1,
item => item.opcode = OpCodes.Ldarg_0
).ToList();
var mJoin = SymbolExtensions.GetMethodInfo(() => string.Join(null, null));
var idx = list.FindIndex(item => item.opcode == OpCodes.Call && item.operand as MethodInfo == mJoin);
list.RemoveRange(idx + 1, list.Count - (idx + 1));
list.Add(new CodeInstruction(OpCodes.Ret));
return list.AsEnumerable();
}
// make compiler happy
_ = Transpiler(null);
return original;
}
public static void Postfix(string original, ref string __result)
{
__result = "Epilog" + StringOperation(original);
}
}
public class Class1Reverse
{
[MethodImpl(MethodImplOptions.NoInlining)]
public string Method(string original, int n)
{
return original + GetExtra(n);
}
private static string GetExtra(int n)
{
return "Extra" + n;
}
}
[HarmonyPatch(typeof(Class1Reverse), "Method")]
[HarmonyPatch(MethodType.Normal)]
public class Class1ReversePatch
{
[HarmonyReversePatch]
[HarmonyPatch("GetExtra")]
[MethodImpl(MethodImplOptions.NoInlining)]
public static string GetExtra(int n)
{
// this will be replaced by reverse patching
// using a fake while loop to force non-inlining
while (DateTime.Now.Ticks > 0)
throw new NotImplementedException();
return null;
}
public static bool Prefix(string original, int n, ref string __result)
{
if (n != 456) return true;
__result = "Prefixed" + GetExtra(n) + original;
return false;
}
}
}
|
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
namespace HarmonyLibTests.Assets
{
public class Class0Reverse
{
public string Method(string original, int n)
{
var parts = original.Split('-').Reverse().ToArray();
var str = string.Join("", parts) + n;
return str + "Prolog";
}
}
public class Class0ReversePatch
{
public static string StringOperation(string original)
{
// This inner transpiler will be applied to the original and
// the result will replace this method
//
// That will allow this method to have a different signature
// than the original and it must match the transpiled result
//
IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
var list = Transpilers.Manipulator(instructions,
item => item.opcode == OpCodes.Ldarg_1,
item => item.opcode = OpCodes.Ldarg_0
).ToList();
var mJoin = SymbolExtensions.GetMethodInfo(() => string.Join(null, null));
var idx = list.FindIndex(item => item.opcode == OpCodes.Call && item.operand as MethodInfo == mJoin);
list.RemoveRange(idx + 1, list.Count - (idx + 1));
return list.AsEnumerable();
}
// make compiler happy
_ = Transpiler(null);
return original;
}
public static void Postfix(string original, ref string __result)
{
__result = "Epilog" + StringOperation(original);
}
}
public class Class1Reverse
{
[MethodImpl(MethodImplOptions.NoInlining)]
public string Method(string original, int n)
{
return original + GetExtra(n);
}
private static string GetExtra(int n)
{
return "Extra" + n;
}
}
[HarmonyPatch(typeof(Class1Reverse), "Method")]
[HarmonyPatch(MethodType.Normal)]
public class Class1ReversePatch
{
[HarmonyReversePatch]
[HarmonyPatch("GetExtra")]
[MethodImpl(MethodImplOptions.NoInlining)]
public static string GetExtra(int n)
{
// this will be replaced by reverse patching
// using a fake while loop to force non-inlining
while (DateTime.Now.Ticks > 0)
throw new NotImplementedException();
return null;
}
public static bool Prefix(string original, int n, ref string __result)
{
if (n != 456) return true;
__result = "Prefixed" + GetExtra(n) + original;
return false;
}
}
}
|
mit
|
C#
|
dcbf91a8ca18886c9a651327079c2a995a484a5f
|
Update UI look and feel
|
RubenLaube-Pohto/asp.net-project
|
Views/ChatView.cshtml
|
Views/ChatView.cshtml
|
@model ChatApp.Controllers.ChatMessagesViewModel
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
@using ChatApp.Models
<!DOCTYPE html>
<html>
<head>
<title>ChatApp</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css" async>
</head>
<body>
<table class="w3-table w3-striped">
@foreach (Message msg in Model.OldMessages)
{
<tr>
<td name="author" class="w3-right-align" style="width: 10em;">@msg.Author:</td>
<td name="text">@msg.Text</td>
<td name="timestamp" class="w3-right-align">@msg.Timestamp</td>
</tr>
}
</table>
<form asp-action="SendNewMessage" method="post" class="w3-row">
<input asp-for="NewMessage.Author" class="w3-input w3-border w3-col m2" placeholder="Name"/>
<input asp-for="NewMessage.Text" class="w3-input w3-border w3-col m8" placeholder="Message"/>
<input type="submit" value="Send" class="w3-btn w3-blue w3-col w3-large m2"/>
</form>
</body>
</html>
|
@model ChatApp.Controllers.ChatMessagesViewModel
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
@using ChatApp.Models
<!DOCTYPE html>
<html>
<head>
<title>ChatApp</title>
</head>
<body>
<table>
@foreach (Message msg in Model.OldMessages)
{
<tr>
<td class="author">@msg.Author</td>
<td class="text">@msg.Text</td>
<td class="timestamp">@msg.Timestamp</td>
</tr>
}
</table>
<form asp-action="SendNewMessage" method="post">
<input asp-for="NewMessage.Author"/>
<input asp-for="NewMessage.Text"/>
<input type="submit" value="Send"/>
</form>
</body>
</html>
|
mit
|
C#
|
7ae68c1e1f1fe828c2dd84827c5b94ccf9cd5e76
|
change view after completed
|
github/VisualStudio,github/VisualStudio,github/VisualStudio
|
src/GitHub.VisualStudio/UI/Views/PullRequestCreationView.xaml.cs
|
src/GitHub.VisualStudio/UI/Views/PullRequestCreationView.xaml.cs
|
using System;
using GitHub.Exports;
using GitHub.UI;
using GitHub.ViewModels;
using System.ComponentModel.Composition;
using ReactiveUI;
using System.Reactive.Subjects;
namespace GitHub.VisualStudio.UI.Views
{
public class GenericPullRequestCreationView : SimpleViewUserControl<IPullRequestCreationViewModel, GenericPullRequestCreationView>
{ }
[ExportView(ViewType = UIViewType.PRCreation)]
[PartCreationPolicy(CreationPolicy.NonShared)]
public partial class PullRequestCreationView : GenericPullRequestCreationView
{
readonly Subject<ViewWithData> load = new Subject<ViewWithData>();
public PullRequestCreationView()
{
InitializeComponent();
this.WhenActivated(d =>
{
d(ViewModel.CancelCommand.Subscribe(_ => NotifyCancel()));
d(ViewModel.CreatePullRequest.Subscribe(_ =>
{
NotifyDone();
var v = new ViewWithData(UIControllerFlow.PullRequestList);
load.OnNext(v);
}));
});
}
}
}
|
using System;
using GitHub.Exports;
using GitHub.UI;
using GitHub.ViewModels;
using System.ComponentModel.Composition;
using ReactiveUI;
namespace GitHub.VisualStudio.UI.Views
{
public class GenericPullRequestCreationView : SimpleViewUserControl<IPullRequestCreationViewModel, GenericPullRequestCreationView>
{ }
[ExportView(ViewType = UIViewType.PRCreation)]
[PartCreationPolicy(CreationPolicy.NonShared)]
public partial class PullRequestCreationView : GenericPullRequestCreationView
{
public PullRequestCreationView()
{
InitializeComponent();
this.WhenActivated(d =>
{
d(ViewModel.CancelCommand.Subscribe(_ => NotifyCancel()));
d(ViewModel.CreatePullRequest.Subscribe(_ => NotifyDone()));
});
}
}
}
|
mit
|
C#
|
cb43de3d0e329c21077d18c6f7502ee5a275fdf4
|
Update BundleConfig.cs
|
kriasoft/site-sdk,kriasoft/site-sdk,kriasoft/site-sdk,kriasoft/site-sdk
|
Source/Web/App_Start/BundleConfig.cs
|
Source/Web/App_Start/BundleConfig.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BundleConfig.cs" company="KriaSoft LLC">
// Copyright © 2013 Konstantin Tarkus, KriaSoft LLC. See LICENSE.txt
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace App.Web
{
using System.Web.Optimization;
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/js/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/js/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/js/modernizr").Include("~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/js/bootstrap").Include("~/Scripts/bootstrap/*"));
bundles.Add(new ScriptBundle("~/js/site").Include("~/Scripts/Site.js"));
bundles.Add(new StyleBundle("~/css/bootstrap").Include("~/Styles/bootstrap.css"));
bundles.Add(new StyleBundle("~/css/site").Include("~/Styles/Site.css"));
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BundleConfig.cs" company="KriaSoft LLC">
// Copyright © 2013 Konstantin Tarkus, KriaSoft LLC. See LICENSE.txt
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace App.Web
{
using System.Web.Optimization;
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/js/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/js/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/js/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/js/bootstrap").Include("~/Scripts/bootstrap/*"));
bundles.Add(new ScriptBundle("~/js/site").Include(
"~/Scripts/Site.js"));
bundles.Add(new StyleBundle("~/css/bootstrap").Include("~/Styles/bootstrap.css"));
bundles.Add(new StyleBundle("~/css/site").Include("~/Styles/Site.css"));
}
}
}
|
apache-2.0
|
C#
|
62c378731985590a01b4a70e9451bf14f2f752a6
|
Fix ArrayToString formatting. Fixes #1
|
yuriks/SHA2-Csharp
|
Util.cs
|
Util.cs
|
/*
* Copyright (c) 2010 Yuri K. Schlesner
*
* 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.Collections.ObjectModel;
using System.Text;
namespace Sha2
{
public static class Util
{
public static string ArrayToString(ReadOnlyCollection<byte> arr)
{
StringBuilder s = new StringBuilder(arr.Count * 2);
for (int i = 0; i < arr.Count; ++i)
{
s.AppendFormat("{0:x2}", arr[i]);
}
return s.ToString();
}
}
}
|
/*
* Copyright (c) 2010 Yuri K. Schlesner
*
* 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.Collections.ObjectModel;
using System.Text;
namespace Sha2
{
public static class Util
{
public static string ArrayToString(ReadOnlyCollection<byte> arr)
{
StringBuilder s = new StringBuilder(arr.Count * 2);
for (int i = 0; i < arr.Count; ++i)
{
s.AppendFormat("{0:x}", arr[i]);
}
return s.ToString();
}
}
}
|
mit
|
C#
|
3f9e66bc657c0abb75d874d0cc90b5ff597bce22
|
Bump version number
|
WombatFromHell/OriginSteamOverlayLauncher
|
OriginSteamOverlayLauncher/Properties/AssemblyInfo.cs
|
OriginSteamOverlayLauncher/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("OriginSteamOverlayLauncher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OriginSteamOverlayLauncher")]
[assembly: AssemblyCopyright("Copyright © WombatFromHell 2018")]
[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("f62e9dcd-7b8b-4fb5-b912-0c36f5c0fe4c")]
// 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.9.5")]
[assembly: AssemblyFileVersion("1.0.9.5")]
|
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("OriginSteamOverlayLauncher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OriginSteamOverlayLauncher")]
[assembly: AssemblyCopyright("Copyright © WombatFromHell 2018")]
[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("f62e9dcd-7b8b-4fb5-b912-0c36f5c0fe4c")]
// 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.9.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
|
mit
|
C#
|
d75aa18e20250ce26ad970db1ec1a5b0d0eb3038
|
change equality definition to delay type-equality checking
|
acple/ParsecSharp
|
ParsecSharp/Core/Interface/IPosition.NetStandard21.cs
|
ParsecSharp/Core/Interface/IPosition.NetStandard21.cs
|
#if NETSTANDARD2_1
using System;
namespace ParsecSharp
{
public partial interface IPosition
{
int IComparable<IPosition>.CompareTo(IPosition? other)
=> other is null
? 1 // always greater than null
: this.Line != other.Line ? this.Line.CompareTo(other.Line) : this.Column.CompareTo(other.Column);
bool IEquatable<IPosition>.Equals(IPosition? other)
=> other is not null && this.Line == other.Line && this.Column == other.Column && this.GetType() == other.GetType();
public static bool operator <(IPosition left, IPosition right)
=> left.CompareTo(right) < 0;
public static bool operator >(IPosition left, IPosition right)
=> left.CompareTo(right) > 0;
public static bool operator <=(IPosition left, IPosition right)
=> left.CompareTo(right) <= 0;
public static bool operator >=(IPosition left, IPosition right)
=> left.CompareTo(right) >= 0;
}
}
#endif
|
#if NETSTANDARD2_1
using System;
namespace ParsecSharp
{
public partial interface IPosition
{
int IComparable<IPosition>.CompareTo(IPosition? other)
=> other is null
? 1 // always greater than null
: this.Line != other.Line ? this.Line.CompareTo(other.Line) : this.Column.CompareTo(other.Column);
bool IEquatable<IPosition>.Equals(IPosition? other)
=> other is not null && this.GetType() == other.GetType() && this.Line == other.Line && this.Column == other.Column;
public static bool operator <(IPosition left, IPosition right)
=> left.CompareTo(right) < 0;
public static bool operator >(IPosition left, IPosition right)
=> left.CompareTo(right) > 0;
public static bool operator <=(IPosition left, IPosition right)
=> left.CompareTo(right) <= 0;
public static bool operator >=(IPosition left, IPosition right)
=> left.CompareTo(right) >= 0;
}
}
#endif
|
mit
|
C#
|
9531946ff0f32104ad94439098d7c8703f7c2535
|
Fix MenuButton constructor invocation
|
akrisiun/xwt,TheBrainTech/xwt,mono/xwt,antmicro/xwt,cra0zy/xwt,lytico/xwt,directhex/xwt,mminns/xwt,hamekoz/xwt,residuum/xwt,steffenWi/xwt,hwthomas/xwt,iainx/xwt,mminns/xwt
|
Xwt/Xwt/MenuButton.cs
|
Xwt/Xwt/MenuButton.cs
|
//
// MenuButton.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2011 Xamarin Inc
//
// 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 Xwt.Backends;
using Xwt.Drawing;
namespace Xwt
{
[BackendType (typeof(IMenuButtonBackend))]
public class MenuButton: Button
{
Menu menu;
Func<Menu> creator;
protected new class WidgetBackendHost: Button.WidgetBackendHost, IMenuButtonEventSink
{
public IMenuBackend OnCreateMenu ()
{
return ((MenuButton)Parent).CreateMenu ();
}
}
public MenuButton ()
{
ImagePosition = ContentPosition.Right;
Type = ButtonType.DropDown;
}
public MenuButton (string label) : this ()
{
VerifyConstructorCall (this);
Label = label;
}
public MenuButton (Image img, string label) : this ()
{
VerifyConstructorCall (this);
Label = label;
Image = img;
}
public MenuButton (Image img) : this ()
{
VerifyConstructorCall (this);
Image = img;
}
protected override BackendHost CreateBackendHost ()
{
return new WidgetBackendHost ();
}
IMenuButtonBackend Backend {
get { return (IMenuButtonBackend) BackendHost.Backend; }
}
public Menu Menu {
get { return menu; }
set { menu = value; }
}
public Func<Menu> MenuSource {
get { return creator; }
set { creator = value; }
}
IMenuBackend CreateMenu ()
{
Menu menu = null;
BackendHost.ToolkitEngine.Invoke (delegate {
menu = OnCreateMenu();
});
return ((IMenuBackend)BackendHost.ToolkitEngine.GetSafeBackend (menu));
}
protected virtual Menu OnCreateMenu ()
{
if (menu != null)
return menu;
if (creator != null)
return creator ();
return null;
}
}
}
|
//
// MenuButton.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2011 Xamarin Inc
//
// 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 Xwt.Backends;
using Xwt.Drawing;
namespace Xwt
{
[BackendType (typeof(IMenuButtonBackend))]
public class MenuButton: Button
{
Menu menu;
Func<Menu> creator;
protected new class WidgetBackendHost: Button.WidgetBackendHost, IMenuButtonEventSink
{
public IMenuBackend OnCreateMenu ()
{
return ((MenuButton)Parent).CreateMenu ();
}
}
public MenuButton ()
{
ImagePosition = ContentPosition.Right;
Type = ButtonType.DropDown;
}
public MenuButton (string label)
{
VerifyConstructorCall (this);
Label = label;
}
public MenuButton (Image img, string label)
{
VerifyConstructorCall (this);
Label = label;
Image = img;
}
public MenuButton (Image img)
{
VerifyConstructorCall (this);
Image = img;
}
protected override BackendHost CreateBackendHost ()
{
return new WidgetBackendHost ();
}
IMenuButtonBackend Backend {
get { return (IMenuButtonBackend) BackendHost.Backend; }
}
public Menu Menu {
get { return menu; }
set { menu = value; }
}
public Func<Menu> MenuSource {
get { return creator; }
set { creator = value; }
}
IMenuBackend CreateMenu ()
{
Menu menu = null;
BackendHost.ToolkitEngine.Invoke (delegate {
menu = OnCreateMenu();
});
return ((IMenuBackend)BackendHost.ToolkitEngine.GetSafeBackend (menu));
}
protected virtual Menu OnCreateMenu ()
{
if (menu != null)
return menu;
if (creator != null)
return creator ();
return null;
}
}
}
|
mit
|
C#
|
eed4af899e1eee78ceada280dd8ce0110be5b7b5
|
Update Index.cshtml
|
dncuug/dot-net.in.ua,dncuug/dot-net.in.ua,dncuug/dot-net.in.ua
|
src/WebSite/Views/Home/Index.cshtml
|
src/WebSite/Views/Home/Index.cshtml
|
@using X.PagedList;
@using X.PagedList.Mvc.Core;
@model IPagedList<Core.ViewModels.PublicationViewModel>
@{
ViewData["Title"] = "Welcome!";
}
@section head {
<meta property="og:title" content="@Core.Settings.Current.WebSiteTitle" />
<meta property="og:type" content="website" />
<meta property="og:url" content="@Core.Settings.Current.WebSiteUrl" />
<meta property="og:image" content="@Core.Settings.Current.FacebookImage" />
<meta property="og:description" content="@Core.Settings.Current.DefaultDescription" />
<meta name="keywords" content="@Core.Settings.Current.DefaultKeywords" />
<meta name="description" content="@Core.Settings.Current.DefaultDescription" />
}
@section top {
<a href="https://www.microsoft.com/en-us/build" style="text-align: center !important; display: block; background-color: rgba(232, 237,238, 1);">
<img style="display: block; margin: auto;" alt="Microsoft Build 2019" class="img-responsive" src="https://info.microsoft.com/rs/157-GQE-382/images/Build_2019_web_header_1900x300.jpg"/>
</a>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>Welcome to the daily developers digest!</h1>
<h3 style="color: #FFF">All news and events will be here!</h3>
<span style="color: #FFF">
Project supported by .NET Core Ukrainian User Group, Microsoft Azure Ukraine User Group and Xamarin Ukraine User Group!
</span>
</div>
</div>
}
@for (var i=0; i<Model.Count(); i++)
{
@Html.Partial("_Publication", Model[i])
if (i == 2) { @Html.Partial("_InFeedAd") }
if (i == 0) { @Html.Partial("_SmartContent") }
}
@Html.PagedListPager(Model, page => $"/page/{page}")
|
@using X.PagedList;
@using X.PagedList.Mvc.Core;
@model IPagedList<Core.ViewModels.PublicationViewModel>
@{
ViewData["Title"] = "Welcome!";
}
@section head {
<meta property="og:title" content="@Core.Settings.Current.WebSiteTitle" />
<meta property="og:type" content="website" />
<meta property="og:url" content="@Core.Settings.Current.WebSiteUrl" />
<meta property="og:image" content="@Core.Settings.Current.FacebookImage" />
<meta property="og:description" content="@Core.Settings.Current.DefaultDescription" />
<meta name="keywords" content="@Core.Settings.Current.DefaultKeywords" />
<meta name="description" content="@Core.Settings.Current.DefaultDescription" />
}
@section top {
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>Welcome to the daily developers digest!</h1>
<h3 style="color: #FFF">All news and events will be here!</h3>
<span style="color: #FFF">
Project supported by .NET Core Ukrainian User Group, Microsoft Azure Ukraine User Group and Xamarin Ukraine User Group!
</span>
</div>
</div>
}
@for (var i=0; i<Model.Count(); i++)
{
@Html.Partial("_Publication", Model[i])
if (i == 2) { @Html.Partial("_InFeedAd") }
if (i == 0) { @Html.Partial("_SmartContent") }
}
@Html.PagedListPager(Model, page => $"/page/{page}")
|
mit
|
C#
|
3d7af805a3cd0905fef3bfc15544330d3bdcd912
|
Fix `BeatmapMetadata` not using its user param correctly
|
peppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu
|
osu.Game/Beatmaps/BeatmapMetadata.cs
|
osu.Game/Beatmaps/BeatmapMetadata.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations;
using Newtonsoft.Json;
using osu.Framework.Testing;
using osu.Game.Models;
using osu.Game.Users;
using Realms;
#nullable enable
namespace osu.Game.Beatmaps
{
[ExcludeFromDynamicCompile]
[Serializable]
[MapTo("BeatmapMetadata")]
public class BeatmapMetadata : RealmObject, IBeatmapMetadataInfo
{
public string Title { get; set; } = string.Empty;
[JsonProperty("title_unicode")]
public string TitleUnicode { get; set; } = string.Empty;
public string Artist { get; set; } = string.Empty;
[JsonProperty("artist_unicode")]
public string ArtistUnicode { get; set; } = string.Empty;
public RealmUser Author { get; set; } = null!;
public string Source { get; set; } = string.Empty;
[JsonProperty(@"tags")]
public string Tags { get; set; } = string.Empty;
/// <summary>
/// The time in milliseconds to begin playing the track for preview purposes.
/// If -1, the track should begin playing at 40% of its length.
/// </summary>
public int PreviewTime { get; set; } = -1;
public string AudioFile { get; set; } = string.Empty;
public string BackgroundFile { get; set; } = string.Empty;
public BeatmapMetadata(RealmUser? user = null)
{
Author = user ?? new RealmUser();
}
[UsedImplicitly] // Realm
private BeatmapMetadata()
{
}
IUser IBeatmapMetadataInfo.Author => Author;
public override string ToString() => this.GetDisplayTitle();
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations;
using Newtonsoft.Json;
using osu.Framework.Testing;
using osu.Game.Models;
using osu.Game.Users;
using Realms;
#nullable enable
namespace osu.Game.Beatmaps
{
[ExcludeFromDynamicCompile]
[Serializable]
[MapTo("BeatmapMetadata")]
public class BeatmapMetadata : RealmObject, IBeatmapMetadataInfo
{
public string Title { get; set; } = string.Empty;
[JsonProperty("title_unicode")]
public string TitleUnicode { get; set; } = string.Empty;
public string Artist { get; set; } = string.Empty;
[JsonProperty("artist_unicode")]
public string ArtistUnicode { get; set; } = string.Empty;
public RealmUser Author { get; set; } = null!;
public string Source { get; set; } = string.Empty;
[JsonProperty(@"tags")]
public string Tags { get; set; } = string.Empty;
/// <summary>
/// The time in milliseconds to begin playing the track for preview purposes.
/// If -1, the track should begin playing at 40% of its length.
/// </summary>
public int PreviewTime { get; set; } = -1;
public string AudioFile { get; set; } = string.Empty;
public string BackgroundFile { get; set; } = string.Empty;
public BeatmapMetadata(RealmUser? user = null)
{
Author = new RealmUser();
}
[UsedImplicitly] // Realm
private BeatmapMetadata()
{
}
IUser IBeatmapMetadataInfo.Author => Author;
public override string ToString() => this.GetDisplayTitle();
}
}
|
mit
|
C#
|
56d97a25945bb3357e2ae393e0191c1504810c62
|
Send TimeSpan as Time.
|
drunkcod/StatsSharp
|
StatsSharp/IStatsClient.cs
|
StatsSharp/IStatsClient.cs
|
using System;
using System.Collections.Generic;
namespace StatsSharp
{
public interface IStatsClient
{
void Send(Metric metric);
void Send(IEnumerable<Metric> metrics);
}
public static class StatsClientExtensions
{
static readonly MetricValue CountOfOne = MetricValue.Counter(1);
public static void Send(this IStatsClient stats, string name, MetricValue value) { stats.Send(new Metric(name, value)); }
public static void Send(this IStatsClient stats, params Metric[] metrics) { stats.Send(metrics); }
public static void Counter(this IStatsClient stats, string name) {
stats.Send(new Metric(name, CountOfOne));
}
public static void Timer(this IStatsClient stats, string name, ulong value) {
stats.Send(new Metric(name, MetricValue.Time(value)));
}
public static void Timer(this IStatsClient stats, string name, TimeSpan value) {
stats.Timer(name, (ulong)value.TotalMilliseconds);
}
public static void GaugeAbsoluteValue(this IStatsClient stats, string name, int value) {
if(value < 0) {
stats.Send(
new Metric(name, MetricValue.Gauge(0)),
new Metric(name, MetricValue.GaugeDelta(value)));
} else {
stats.Send(new Metric(name, MetricValue.Gauge((ulong)value)));
}
}
public static void GaugeDelta(this IStatsClient stats, string name, int value) {
stats.Send(new Metric(name, MetricValue.GaugeDelta(value)));
}
}
}
|
using System.Collections.Generic;
namespace StatsSharp
{
public interface IStatsClient
{
void Send(Metric metric);
void Send(IEnumerable<Metric> metrics);
}
public static class StatsClientExtensions
{
static readonly MetricValue CountOfOne = MetricValue.Counter(1);
public static void Send(this IStatsClient stats, string name, MetricValue value) { stats.Send(new Metric(name, value)); }
public static void Send(this IStatsClient stats, params Metric[] metrics) { stats.Send(metrics); }
public static void Counter(this IStatsClient stats, string name) {
stats.Send(new Metric(name, CountOfOne));
}
public static void Timer(this IStatsClient stats, string name, ulong value) {
stats.Send(new Metric(name, MetricValue.Time(value)));
}
public static void GaugeAbsoluteValue(this IStatsClient stats, string name, int value) {
if(value < 0) {
stats.Send(
new Metric(name, MetricValue.Gauge(0)),
new Metric(name, MetricValue.GaugeDelta(value)));
} else {
stats.Send(new Metric(name, MetricValue.Gauge((ulong)value)));
}
}
public static void GaugeDelta(this IStatsClient stats, string name, int value) {
stats.Send(new Metric(name, MetricValue.GaugeDelta(value)));
}
}
}
|
mit
|
C#
|
671730ed918418b37fef9d8f709f00aa483a5d47
|
Rename "Preferences" to "Options"
|
ryanewtaylor/snagit-jira-output-accessory,ryanewtaylor/snagit-jira-output-accessory
|
SnagitJiraOutputAccessory/Commands/CommandRegistry.cs
|
SnagitJiraOutputAccessory/Commands/CommandRegistry.cs
|
namespace SnagitJiraOutputAccessory.Commands
{
using System;
using System.Collections.Generic;
using System.Linq;
public static class CommandRegistry
{
private static Dictionary<string, CommandInfo> _registry = new Dictionary<string, CommandInfo>()
{
{"AttachToNewIssueCommand", new CommandInfo("AttachToNewIssueCommand", "Attach To New Issue", typeof(AttachToNewIssueCommand))}
, { "AttachToExistingIssueCommand", new CommandInfo("AttachToExistingIssueCommand", "Attach To Existing Issue", typeof(AttachToExistingIssueCommand))}
, {"ConfigureSettingsCommand", new CommandInfo("ConfigureSettingsCommand", "Options", typeof(ConfigureSettingsCommand))}
};
public static CommandInfo GetDefaultCommandInfo()
{
return _registry.First().Value;
}
public static Type GetCommandType(string commandId)
{
return _registry[commandId].Type;
}
public static IEnumerable<CommandInfo> GetCommandInfos()
{
return _registry.Values.AsEnumerable();
}
}
}
|
namespace SnagitJiraOutputAccessory.Commands
{
using System;
using System.Collections.Generic;
using System.Linq;
public static class CommandRegistry
{
private static Dictionary<string, CommandInfo> _registry = new Dictionary<string, CommandInfo>()
{
{"AttachToNewIssueCommand", new CommandInfo("AttachToNewIssueCommand", "Attach To New Issue", typeof(AttachToNewIssueCommand))}
, { "AttachToExistingIssueCommand", new CommandInfo("AttachToExistingIssueCommand", "Attach To Existing Issue", typeof(AttachToExistingIssueCommand))}
, {"ConfigureSettingsCommand", new CommandInfo("ConfigureSettingsCommand", "Preferences", typeof(ConfigureSettingsCommand))}
};
public static CommandInfo GetDefaultCommandInfo()
{
return _registry.First().Value;
}
public static Type GetCommandType(string commandId)
{
return _registry[commandId].Type;
}
public static IEnumerable<CommandInfo> GetCommandInfos()
{
return _registry.Values.AsEnumerable();
}
}
}
|
mit
|
C#
|
1dfc18cb9a20df554ecf55cd59c1114e568d22f9
|
Align XSD Doc version number with SHFB
|
terrajobst/xsddoc
|
src/CommonAssemblyInfo.cs
|
src/CommonAssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCopyright(XsdDocMetadata.Copyright)]
[assembly: AssemblyCompany("Immo Landwerth")]
[assembly: AssemblyProduct("XML Schema Documenter")]
[assembly: CLSCompliant(false)]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyVersion(XsdDocMetadata.Version)]
[assembly: AssemblyFileVersion(XsdDocMetadata.Version)]
internal static class XsdDocMetadata
{
public const string Version = "16.9.17.0";
public const string Copyright = "Copyright 2009-2015 Immo Landwerth";
}
|
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCopyright(XsdDocMetadata.Copyright)]
[assembly: AssemblyCompany("Immo Landwerth")]
[assembly: AssemblyProduct("XML Schema Documenter")]
[assembly: CLSCompliant(false)]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyVersion(XsdDocMetadata.Version)]
[assembly: AssemblyFileVersion(XsdDocMetadata.Version)]
internal static class XsdDocMetadata
{
public const string Version = "15.10.10.0";
public const string Copyright = "Copyright 2009-2015 Immo Landwerth";
}
|
mit
|
C#
|
8118ef4d218ba9b90ee2aa127861735c0af35f3d
|
Increment copyright year of projects to 2019
|
atata-framework/atata-sample-app-tests
|
src/CommonAssemblyInfo.cs
|
src/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Yevgeniy Shunevych")]
[assembly: AssemblyProduct("Atata Framework")]
[assembly: AssemblyCopyright("© Yevgeniy Shunevych 2019")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Yevgeniy Shunevych")]
[assembly: AssemblyProduct("Atata Framework")]
[assembly: AssemblyCopyright("© Yevgeniy Shunevych 2018")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
|
apache-2.0
|
C#
|
0577394e161a7ee52f543ba1a948331f1d080e80
|
Fix of previous commit
|
Psychobilly87/bari,Psychobilly87/bari,vigoo/bari,Psychobilly87/bari,vigoo/bari,Psychobilly87/bari,vigoo/bari,vigoo/bari
|
src/core/Bari.Core/cs/Generic/LocalFileSystemDirectoryWatcher.cs
|
src/core/Bari.Core/cs/Generic/LocalFileSystemDirectoryWatcher.cs
|
using System.IO;
using System;
namespace Bari.Core.Generic
{
public class LocalFileSystemDirectoryWatcher: IFileSystemDirectoryWatcher
{
private readonly FileSystemWatcher watcher;
private readonly string path;
public event EventHandler<FileSystemChangedEventArgs> Changed;
public LocalFileSystemDirectoryWatcher(string path)
{
this.path = path;
watcher = new FileSystemWatcher(path)
{
IncludeSubdirectories = true,
NotifyFilter = NotifyFilters.FileName
};
watcher.Changed += OnChanged;
watcher.Created += OnChanged;
watcher.Deleted += OnChanged;
watcher.Renamed += OnChanged;
watcher.EnableRaisingEvents = true;
}
public void Stop()
{
watcher.Dispose();
}
public void Dispose()
{
Stop();
}
private void OnChanged(object sender, FileSystemEventArgs e)
{
if (Changed != null)
{
Changed(this, new FileSystemChangedEventArgs(e.FullPath.Substring(path.Length).TrimStart(Path.DirectorySeparatorChar)));
}
}
}
}
|
using System.IO;
using System;
namespace Bari.Core.Generic
{
public class LocalFileSystemDirectoryWatcher: IFileSystemDirectoryWatcher
{
private readonly FileSystemWatcher watcher;
private readonly string path;
public event EventHandler<FileSystemChangedEventArgs> Changed;
public LocalFileSystemDirectoryWatcher(string path)
{
this.path = path;
watcher = new FileSystemWatcher(path);
watcher.IncludeSubdirectories = true;
watcher.Changed += OnChanged;
watcher.Created += OnChanged;
watcher.Deleted += OnChanged;
watcher.Renamed += OnChanged;
watcher.EnableRaisingEvents = true;
}
public void Stop()
{
watcher.Dispose();
}
public void Dispose()
{
Stop();
}
private void OnChanged(object sender, FileSystemEventArgs e)
{
if (Changed != null)
{
Changed(this, new FileSystemChangedEventArgs(e.FullPath.Substring(path.Length).TrimStart(Path.DirectorySeparatorChar)));
}
}
}
}
|
apache-2.0
|
C#
|
8d9849f6822fe4b2d9c099a05d5f101d969a80a1
|
add comments to exif
|
piedoom/TumblrSharp,piedoom/TumblrSharp
|
TumblrSharp.Client/Exif.cs
|
TumblrSharp.Client/Exif.cs
|
using Newtonsoft.Json;
namespace DontPanic.TumblrSharp.Client
{
/// <summary>
/// Exif
/// </summary>
public class Exif
{
/// <summary>
/// camera
/// </summary>
[JsonProperty("camera")]
public string Camera { get; set; }
/// <summary>
/// iso
/// </summary>
[JsonProperty("iso")]
public int ISO { get; set; }
/// <summary>
/// aperture
/// </summary>
[JsonProperty("aperture")]
public string Aperture { get; set; }
/// <summary>
/// exposure
/// </summary>
[JsonProperty("exposure")]
public string Exposure { get; set; }
/// <summary>
/// focallength
/// </summary>
[JsonProperty("focallength")]
public string FocalLength { get; set; }
}
}
|
using Newtonsoft.Json;
namespace DontPanic.TumblrSharp.Client
{
public class Exif
{
[JsonProperty("camera")]
public string Camera { get; set; }
[JsonProperty("iso")]
public int ISO { get; set; }
[JsonProperty("aperture")]
public string Aperture { get; set; }
[JsonProperty("exposure")]
public string Exposure { get; set; }
[JsonProperty("focallength")]
public string FocalLength { get; set; }
}
}
|
mit
|
C#
|
64af3e2bcff15470ea42a462552164bb773955ad
|
Fix minor style issues.
|
AvaloniaUI/Avalonia,susloparovdenis/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jazzay/Perspex,susloparovdenis/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,OronDF343/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,akrisiun/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Perspex,Perspex/Perspex,SuperJMN/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,MrDaedra/Avalonia,Perspex/Perspex,susloparovdenis/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,susloparovdenis/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,OronDF343/Avalonia,MrDaedra/Avalonia,punker76/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia
|
src/Markup/Avalonia.Markup.Xaml/Templates/MemberSelector.cs
|
src/Markup/Avalonia.Markup.Xaml/Templates/MemberSelector.cs
|
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using Avalonia.Controls.Templates;
using Avalonia.Data;
using Avalonia.Markup.Data;
using System;
namespace Avalonia.Markup.Xaml.Templates
{
public class MemberSelector : IMemberSelector
{
private ExpressionNode _expressionNode;
private string _memberName;
private ExpressionNode _memberValueNode;
public string MemberName
{
get { return _memberName; }
set
{
if (_memberName != value)
{
_memberName = value;
_expressionNode = null;
_memberValueNode = null;
}
}
}
public object Select(object o)
{
if (string.IsNullOrEmpty(MemberName))
{
return o;
}
if (_expressionNode == null)
{
_expressionNode = ExpressionNodeBuilder.Build(MemberName);
_memberValueNode = _expressionNode;
while (_memberValueNode.Next != null)
{
_memberValueNode = _memberValueNode.Next;
}
}
_expressionNode.Target = new WeakReference(o);
object result = _memberValueNode.CurrentValue.Target;
if (result == AvaloniaProperty.UnsetValue)
{
return null;
}
else if (result is BindingError)
{
return null;
}
return result;
}
}
}
|
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using Avalonia.Controls.Templates;
using Avalonia.Data;
using Avalonia.Markup.Data;
using System;
namespace Avalonia.Markup.Xaml.Templates
{
public class MemberSelector : IMemberSelector
{
public string MemberName
{
get { return _memberName; }
set
{
if (_memberName != value)
{
_memberName = value;
_expressionNode = null;
_memberValueNode = null;
}
}
}
public object Select(object o)
{
if (string.IsNullOrEmpty(MemberName))
{
return o;
}
if (_expressionNode == null)
{
_expressionNode = ExpressionNodeBuilder.Build(MemberName);
_memberValueNode = _expressionNode;
while (_memberValueNode.Next != null)
_memberValueNode = _memberValueNode.Next;
}
_expressionNode.Target = new WeakReference(o);
object result = _memberValueNode.CurrentValue.Target;
if (result == AvaloniaProperty.UnsetValue)
{
return null;
}
else if (result is BindingError)
{
return null;
}
return result;
}
private ExpressionNode _expressionNode;
private string _memberName;
private ExpressionNode _memberValueNode;
}
}
|
mit
|
C#
|
b2196b8cfed91c67738bd39d068c551c77e683b8
|
Add support for XOR in PostgreSQL
|
SimpleStack/simplestack.orm,SimpleStack/simplestack.orm
|
src/SimpleStack.Orm.PostgreSQL/PostgreSQLExpressionVisitor.cs
|
src/SimpleStack.Orm.PostgreSQL/PostgreSQLExpressionVisitor.cs
|
using System.Linq.Expressions;
using SimpleStack.Orm.Expressions;
namespace SimpleStack.Orm.PostgreSQL
{
/// <summary>A postgre SQL expression visitor.</summary>
/// <typeparam name="T">Generic type parameter.</typeparam>
public class PostgreSQLExpressionVisitor<T>:SqlExpressionVisitor<T>
{
public PostgreSQLExpressionVisitor(IDialectProvider dialectProvider) : base(dialectProvider)
{
}
protected override string BindOperant(ExpressionType e)
{
switch (e)
{
case ExpressionType.ExclusiveOr:
return "#";
}
return base.BindOperant(e);
}
/// <summary>Gets the limit expression.</summary>
/// <value>The limit expression.</value>
public override string LimitExpression{
get{
if(!Rows.HasValue) return "";
string offset;
if(Skip.HasValue){
offset= string.Format(" OFFSET {0}", Skip.Value );
}
else{
offset=string.Empty;
}
return string.Format("LIMIT {0}{1}", Rows.Value, offset);
}
}
}
}
|
using SimpleStack.Orm.Expressions;
namespace SimpleStack.Orm.PostgreSQL
{
/// <summary>A postgre SQL expression visitor.</summary>
/// <typeparam name="T">Generic type parameter.</typeparam>
public class PostgreSQLExpressionVisitor<T>:SqlExpressionVisitor<T>
{
public PostgreSQLExpressionVisitor(IDialectProvider dialectProvider) : base(dialectProvider)
{
}
/// <summary>Gets the limit expression.</summary>
/// <value>The limit expression.</value>
public override string LimitExpression{
get{
if(!Rows.HasValue) return "";
string offset;
if(Skip.HasValue){
offset= string.Format(" OFFSET {0}", Skip.Value );
}
else{
offset=string.Empty;
}
return string.Format("LIMIT {0}{1}", Rows.Value, offset);
}
}
}
}
|
bsd-3-clause
|
C#
|
9362dfd103b4954d5fe9a513d11d4df209166fa1
|
Update Program.cs
|
DelKatey/vig.sq.crypt.gui
|
VigenereSquareCryptor_GUI/Program.cs
|
VigenereSquareCryptor_GUI/Program.cs
|
/*
* Created by SharpDevelop.
* User: delkatey
* Date: 20/11/2015
* Time: 9:19 AM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Forms;
namespace VigenereSquareCryptor_GUI
{
/// <summary>
/// Class with program entry point.
/// </summary>
internal sealed class Program
{
/// <summary>
/// Program entry point.
/// </summary>
[STAThread]
private static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
|
/*
* Created by SharpDevelop.
* User: ongrz
* Date: 20/11/2015
* Time: 9:19 AM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Forms;
namespace VigenereSquareCryptor_GUI
{
/// <summary>
/// Class with program entry point.
/// </summary>
internal sealed class Program
{
/// <summary>
/// Program entry point.
/// </summary>
[STAThread]
private static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
|
mit
|
C#
|
204cc0c3785d7bb9adf5e58bc2b972bf9bf70e56
|
Remove bogus onclick
|
wbish/wirk,brianholley/wirk,wbish/wirk,wbish/roborally-wirk,wbish/roborally-wirk,brianholley/wirk
|
src/Twirk/Default.aspx.cs
|
src/Twirk/Default.aspx.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using WiRK.Abacus;
using WiRK.Terminator;
namespace WiRK.TwirkIt
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnRunSimulations_OnClick(object sender, EventArgs e)
{
List<int> position = Request.Form["robotPosition"].Split(',').Select(int.Parse).ToList();
var cards = Request.Form["cards"].Split(',').Select(int.Parse);
var robot = new Robot
{
Position = new Coordinate {X = position[0], Y = position[1]},
Facing = (Orientation)Enum.Parse(typeof(Orientation), Request.Form["robotOrientation"])
};
foreach (var c in cards)
{
robot.DealCard(c);
}
var game = new Game { Board = { Squares = Maps.GetMap(Maps.MapLayouts.ScottRallyMap) }, Robots = new List<Robot> { robot } };
game.Initialize();
List<List<CardExecutionResult>> results = Simulator.RunSimulations(robot);
List<List<CardExecutionResult>> productiveResults = results.Where(result => result.Last().Position.X != -1).ToList();
ClientScript.RegisterClientScriptBlock(GetType(), "results", "var results = " + JsonConvert.SerializeObject(productiveResults), true);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using WiRK.Abacus;
using WiRK.Terminator;
namespace WiRK.TwirkIt
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
btnRunSimulations.Attributes.Add("onclick", "return ValidateSimulate();");
}
protected void btnRunSimulations_OnClick(object sender, EventArgs e)
{
List<int> position = Request.Form["robotPosition"].Split(',').Select(int.Parse).ToList();
var cards = Request.Form["cards"].Split(',').Select(int.Parse);
var robot = new Robot
{
Position = new Coordinate {X = position[0], Y = position[1]},
Facing = (Orientation)Enum.Parse(typeof(Orientation), Request.Form["robotOrientation"])
};
foreach (var c in cards)
{
robot.DealCard(c);
}
var game = new Game { Board = { Squares = Maps.GetMap(Maps.MapLayouts.ScottRallyMap) }, Robots = new List<Robot> { robot } };
game.Initialize();
List<List<CardExecutionResult>> results = Simulator.RunSimulations(robot);
List<List<CardExecutionResult>> productiveResults = results.Where(result => result.Last().Position.X != -1).ToList();
ClientScript.RegisterClientScriptBlock(GetType(), "results", "var results = " + JsonConvert.SerializeObject(productiveResults), true);
}
}
}
|
mit
|
C#
|
4fad711221e30aa4a0f0702b99ade16795f1ceb0
|
Update to Problem 3. Check for a Play Card
|
SimoPrG/CSharpPart1Homework
|
Conditional-Statements-Homework/CheckPlayCard/CheckPlayCard.cs
|
Conditional-Statements-Homework/CheckPlayCard/CheckPlayCard.cs
|
/*Problem 3. Check for a Play Card
Classical play cards use the following signs to designate the card face: `2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K and A.
Write a program that enters a string and prints “yes” if it is a valid card sign or “no” otherwise. Examples:
character Valid card sign?
5 yes
1 no
Q yes
q no
P no
10 yes
500 no
*/
using System;
class CheckPlayCard
{
static void Main()
{
Console.Title = "Check for a Play Card"; //Changing the title of the console.
Console.Write("Please, enter a play card sign to check if it is valid: ");
string cardSign = Console.ReadLine();
switch (cardSign)
{
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "10":
case "J":
case "Q":
case "K":
case "A": Console.WriteLine("\r\nValid card sign?\r\nyes"); break;
default: Console.WriteLine("\r\nValid card sign?\r\nno"); break;
}
Console.ReadKey(); // Keeping the console opened.
}
}
|
/*Problem 3. Check for a Play Card
Classical play cards use the following signs to designate the card face: `2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K and A.
Write a program that enters a string and prints “yes” if it is a valid card sign or “no” otherwise. Examples:
character Valid card sign?
5 yes
1 no
Q yes
q no
P no
10 yes
500 no
*/
using System;
class CheckPlayCard
{
static void Main()
{
Console.Title = "Check for a Play Card"; //Changing the title of the console.
Console.Write("Please, enter a play card sign to check if it is valid: ");
string cardSign = Console.ReadLine();
switch (cardSign)
{
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "10":
case "J":
case "Q":
case "K":
case "A": Console.WriteLine("\nValid card sign?\nyes"); break;
default: Console.WriteLine("\nValid card sign?\nno"); break;
}
Console.ReadKey(); // Keeping the console opened.
}
}
|
mit
|
C#
|
3fcc0fa2a1fe52bdc0d668e340ea7afa680e1262
|
Use AndroidClientHandler for android & NSUrlSessionHandler for iOS by default in bit cs client
|
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
|
src/CSharpClient/Bit.CSharpClient.Rest/ViewModel/Implementations/BitHttpClientHandler.cs
|
src/CSharpClient/Bit.CSharpClient.Rest/ViewModel/Implementations/BitHttpClientHandler.cs
|
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Bit.ViewModel.Implementations
{
public class BitHttpClientHandler :
#if Android
Xamarin.Android.Net.AndroidClientHandler
#elif iOS
NSUrlSessionHandler
#else
HttpClientHandler
#endif
{
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
// ToDo:
// Current-Time-Zone
// Desired-Time-Zone
// Client-App-Version
// Client-Culture
// Client-Route
// Client-Theme
// Client-Debug-Mode
// System-Language
// Client-Sys-Language
// Client-Platform
// ToDo: Use IDeviceService & IDateTimeProvider
request.Headers.Add("Client-Type", "Xamarin");
if (Device.Idiom != TargetIdiom.Unsupported)
request.Headers.Add("Client-Screen-Size", Device.Idiom == TargetIdiom.Phone ? "MobileAndPhablet" : "DesktopAndTablet");
request.Headers.Add("Client-Date-Time", DefaultDateTimeProvider.Current.GetCurrentUtcDateTime().UtcDateTime.ToString("o"));
request.Headers.Add("X-CorrelationId", Guid.NewGuid().ToString());
request.Headers.Add("Bit-Client-Type", "CS-Client");
return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
}
}
}
|
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Bit.ViewModel.Implementations
{
public class BitHttpClientHandler : HttpClientHandler
{
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
// ToDo:
// Current-Time-Zone
// Desired-Time-Zone
// Client-App-Version
// Client-Culture
// Client-Route
// Client-Theme
// Client-Debug-Mode
// System-Language
// Client-Sys-Language
// Client-Platform
// ToDo: Use IDeviceService & IDateTimeProvider
request.Headers.Add("Client-Type", "Xamarin");
if (Device.Idiom != TargetIdiom.Unsupported)
request.Headers.Add("Client-Screen-Size", Device.Idiom == TargetIdiom.Phone ? "MobileAndPhablet" : "DesktopAndTablet");
request.Headers.Add("Client-Date-Time", DefaultDateTimeProvider.Current.GetCurrentUtcDateTime().UtcDateTime.ToString("o"));
request.Headers.Add("X-CorrelationId", Guid.NewGuid().ToString());
request.Headers.Add("Bit-Client-Type", "CS-Client");
return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
}
}
}
|
mit
|
C#
|
4ad047f877fbabb7a5a01e36a0162038c123a1c5
|
Add multi-module support to knapsack shell. This is still a work in progress however.
|
andrewdavey/cassette,honestegg/cassette,andrewdavey/cassette,honestegg/cassette,BluewireTechnologies/cassette,andrewdavey/cassette,andrewdavey/knapsack,andrewdavey/knapsack,damiensawyer/cassette,BluewireTechnologies/cassette,damiensawyer/cassette,andrewdavey/knapsack,honestegg/cassette,damiensawyer/cassette
|
src/Knapsack.Shell/Program.cs
|
src/Knapsack.Shell/Program.cs
|
using System;
using System.IO;
using System.Linq;
using Knapsack.CoffeeScript;
namespace Knapsack.Shell
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: knapsack {path} {output-directory}");
return;
}
var path = args[0];
if (path.EndsWith("*"))
{
path = Path.GetFullPath(path.Substring(0, path.Length - 2)) + "\\";
var builder = new ScriptModuleContainerBuilder(null, path, new CoffeeScriptCompiler(File.ReadAllText));
builder.AddModuleForEachSubdirectoryOf("");
var container = builder.Build();
foreach (var module in container)
{
var outputFilename = Path.GetFullPath(Path.Combine(args[1], module.Path + ".js"));
using (var file = new StreamWriter(outputFilename))
{
var writer = new ScriptModuleWriter(file, path, File.ReadAllText, new CoffeeScriptCompiler(File.ReadAllText));
writer.Write(module);
file.Flush();
}
}
}
else
{
path = Path.GetFullPath(path);
var builder = new UnresolvedScriptModuleBuilder(path);
var unresolvedModule = builder.Build(""); // path is the module, so no extra path is required.
var module = UnresolvedModule.ResolveAll(new[] { unresolvedModule }).First();
var writer = new ScriptModuleWriter(Console.Out, path, File.ReadAllText, new CoffeeScriptCompiler(File.ReadAllText));
writer.Write(module);
}
}
}
}
|
using System;
using System.IO;
using System.Linq;
using Knapsack.CoffeeScript;
namespace Knapsack.Shell
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: knapsack {path}");
return;
}
var path = Path.GetFullPath(args[0]);
var builder = new UnresolvedScriptModuleBuilder(path);
var unresolvedModule = builder.Build(""); // path is the module, so no extra path is required.
var module = UnresolvedModule.ResolveAll(new[] { unresolvedModule }).First();
var writer = new ScriptModuleWriter(Console.Out, path, File.ReadAllText, new CoffeeScriptCompiler(File.ReadAllText));
writer.Write(module);
}
}
}
|
mit
|
C#
|
7ccdcf7921d5f12d802574a78dbc853e77f83e0e
|
Add urls property in ice servers (#485)
|
twilio/twilio-csharp
|
src/Twilio/Types/IceServer.cs
|
src/Twilio/Types/IceServer.cs
|
using System;
using Newtonsoft.Json;
namespace Twilio.Types
{
/// <summary>
/// Ice Server POCO
/// </summary>
public class IceServer
{
/// <summary>
/// Ice Server credential
/// </summary>
[JsonProperty("credential")]
public string Credential { get; }
/// <summary>
/// Username for server
/// </summary>
[JsonProperty("username")]
public string Username { get; }
/// <summary>
/// Server URL
/// </summary>
[JsonProperty("url")]
public Uri Url { get; }
/// <summary>
/// Server URL
/// </summary>
[JsonProperty("urls")]
public Uri Urls { get; }
/// <summary>
/// Create a new IceServer
/// </summary>
/// <param name="credential">Ice Server credential</param>
/// <param name="username">Server username</param>
/// <param name="url">Server URL</param>
/// <param name="urls">Server URL</param>
public IceServer(string credential, string username, Uri url, Uri urls) {
Credential = credential;
Username = username;
Url = url;
Urls = urls;
}
}
}
|
using System;
using Newtonsoft.Json;
namespace Twilio.Types
{
/// <summary>
/// Ice Server POCO
/// </summary>
public class IceServer
{
/// <summary>
/// Ice Server credential
/// </summary>
[JsonProperty("credential")]
public string Credential { get; }
/// <summary>
/// Username for server
/// </summary>
[JsonProperty("username")]
public string Username { get; }
/// <summary>
/// Server URL
/// </summary>
[JsonProperty("url")]
public Uri Url { get; }
/// <summary>
/// Create a new IceServer
/// </summary>
/// <param name="credential">Ice Server credential</param>
/// <param name="username">Server username</param>
/// <param name="url">Server URL</param>
public IceServer(string credential, string username, Uri url) {
Credential = credential;
Username = username;
Url = url;
}
}
}
|
mit
|
C#
|
036d3c84f148a1e091dfd5872e1c84bf82b2f8e7
|
Remove unused using statement
|
martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site
|
src/LondonTravel.Site/Identity/UserClaimsPrincipalFactory.cs
|
src/LondonTravel.Site/Identity/UserClaimsPrincipalFactory.cs
|
// Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.LondonTravel.Site.Identity
{
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
/// <summary>
/// A custom implementation of <see cref="UserClaimsPrincipalFactory{LondonTravelUser, LondonTravelRole}"/>
/// that adds additional claims to the principal when it is created by the application.
/// </summary>
public class UserClaimsPrincipalFactory : UserClaimsPrincipalFactory<LondonTravelUser, LondonTravelRole>
{
/// <summary>
/// Initializes a new instance of the <see cref="UserClaimsPrincipalFactory"/> class.
/// </summary>
/// <param name="userManager">The <see cref="UserManager{LondonTravelUser}"/> to use.</param>
/// <param name="roleManager">The <see cref="RoleManager{LondonTravelRole}"/> to use.</param>
/// <param name="optionsAccessor">The <see cref="IOptions{IdentityOptions}"/> to use.</param>
public UserClaimsPrincipalFactory(UserManager<LondonTravelUser> userManager, RoleManager<LondonTravelRole> roleManager, IOptions<IdentityOptions> optionsAccessor)
: base(userManager, roleManager, optionsAccessor)
{
}
/// <inheritdoc />
public async override Task<ClaimsPrincipal> CreateAsync(LondonTravelUser user)
{
var principal = await base.CreateAsync(user);
if (principal.Identity is ClaimsIdentity identity)
{
foreach (LondonTravelRole role in user?.RoleClaims)
{
identity.AddClaim(role.ToClaim());
}
}
return principal;
}
}
}
|
// Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.LondonTravel.Site.Identity
{
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
/// <summary>
/// A custom implementation of <see cref="UserClaimsPrincipalFactory{LondonTravelUser, LondonTravelRole}"/>
/// that adds additional claims to the principal when it is created by the application.
/// </summary>
public class UserClaimsPrincipalFactory : UserClaimsPrincipalFactory<LondonTravelUser, LondonTravelRole>
{
/// <summary>
/// Initializes a new instance of the <see cref="UserClaimsPrincipalFactory"/> class.
/// </summary>
/// <param name="userManager">The <see cref="UserManager{LondonTravelUser}"/> to use.</param>
/// <param name="roleManager">The <see cref="RoleManager{LondonTravelRole}"/> to use.</param>
/// <param name="optionsAccessor">The <see cref="IOptions{IdentityOptions}"/> to use.</param>
public UserClaimsPrincipalFactory(UserManager<LondonTravelUser> userManager, RoleManager<LondonTravelRole> roleManager, IOptions<IdentityOptions> optionsAccessor)
: base(userManager, roleManager, optionsAccessor)
{
}
/// <inheritdoc />
public async override Task<ClaimsPrincipal> CreateAsync(LondonTravelUser user)
{
var principal = await base.CreateAsync(user);
if (principal.Identity is ClaimsIdentity identity)
{
foreach (LondonTravelRole role in user?.RoleClaims)
{
identity.AddClaim(role.ToClaim());
}
}
return principal;
}
}
}
|
apache-2.0
|
C#
|
62a6460b9f984d0d29f2951e9d2e8159067dee0e
|
Add Address to BoundActorTarget
|
SaladbowlCreative/Akka.Interfaced.SlimSocket
|
core/Akka.Interfaced.SlimSocket.Server/Transport/AkkaSurrogate.cs
|
core/Akka.Interfaced.SlimSocket.Server/Transport/AkkaSurrogate.cs
|
using System;
using Akka.Actor;
using ProtoBuf;
using ProtoBuf.Meta;
namespace Akka.Interfaced.SlimSocket.Server
{
public static class AkkaSurrogate
{
[ProtoContract]
public class SurrogateForIRequestTarget
{
[ProtoMember(1)] public int Id;
[ProtoMember(2)] public string Address;
[ProtoConverter]
public static SurrogateForIRequestTarget Convert(IRequestTarget value)
{
// used for sending an bound actor-ref to client.
if (value == null)
return null;
var target = ((BoundActorTarget)value);
return new SurrogateForIRequestTarget { Id = target.Id, Address = target.Address };
}
[ProtoConverter]
public static IRequestTarget Convert(SurrogateForIRequestTarget value)
{
// not necessary because client cannot send IRequestTarget
// but implemented to keep this class symmetrical.
if (value == null)
return null;
return new BoundActorTarget(value.Id, value.Address);
}
}
[ProtoContract]
public class SurrogateForINotificationChannel
{
[ProtoConverter]
public static SurrogateForINotificationChannel Convert(INotificationChannel value)
{
if (value == null)
return null;
return new SurrogateForINotificationChannel();
}
[ProtoConverter]
public static INotificationChannel Convert(SurrogateForINotificationChannel value)
{
// always drop contents beacuse client and server dont share INotificationChannel
return null;
}
}
public static void Register(RuntimeTypeModel typeModel)
{
typeModel.Add(typeof(IRequestTarget), false).SetSurrogate(typeof(SurrogateForIRequestTarget));
typeModel.Add(typeof(INotificationChannel), false).SetSurrogate(typeof(SurrogateForINotificationChannel));
}
}
}
|
using System;
using Akka.Actor;
using ProtoBuf;
using ProtoBuf.Meta;
namespace Akka.Interfaced.SlimSocket.Server
{
public static class AkkaSurrogate
{
[ProtoContract]
public class SurrogateForIRequestTarget
{
[ProtoMember(1)] public int Id;
[ProtoConverter]
public static SurrogateForIRequestTarget Convert(IRequestTarget value)
{
// used for sending an bound actor-ref to client.
if (value == null)
return null;
var target = ((BoundActorTarget)value);
return new SurrogateForIRequestTarget { Id = target.Id };
}
[ProtoConverter]
public static IRequestTarget Convert(SurrogateForIRequestTarget value)
{
// not necessary because client cannot send IRequestTarget
// but implemented to keep this class symmetrical.
if (value == null)
return null;
return new BoundActorTarget(value.Id);
}
}
[ProtoContract]
public class SurrogateForINotificationChannel
{
[ProtoConverter]
public static SurrogateForINotificationChannel Convert(INotificationChannel value)
{
if (value == null)
return null;
return new SurrogateForINotificationChannel();
}
[ProtoConverter]
public static INotificationChannel Convert(SurrogateForINotificationChannel value)
{
// always drop contents beacuse client and server dont share INotificationChannel
return null;
}
}
public static void Register(RuntimeTypeModel typeModel)
{
typeModel.Add(typeof(IRequestTarget), false).SetSurrogate(typeof(SurrogateForIRequestTarget));
typeModel.Add(typeof(INotificationChannel), false).SetSurrogate(typeof(SurrogateForINotificationChannel));
}
}
}
|
mit
|
C#
|
dc901ee20db936f2529edb2cc27fd62f50db954f
|
Build fix.
|
jp2masa/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,zarlo/Cosmos,jp2masa/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,jp2masa/Cosmos
|
source/Cosmos.Core_Asm/ObjUtilitiesImpl.cs
|
source/Cosmos.Core_Asm/ObjUtilitiesImpl.cs
|
using Cosmos.Core;
using IL2CPU.API;
using IL2CPU.API.Attribs;
using System;
using XSharp;
using XSharp.Assembler;
namespace Cosmos.Core_Asm
{
[Plug(Target = typeof(ObjUtilities))]
public static unsafe class ObjUtilitiesImpl
{
[PlugMethod(Assembler = typeof(ObjUtilitiesGetPointer))]
public static uint GetPointer(Delegate aVal) { return 0; }
[PlugMethod(Assembler = typeof(ObjUtilitiesGetPointer))]
public static uint GetPointer(Object aVal) { return 0; }
[PlugMethod(Assembler = typeof(ObjUtilitiesGetEntry))]
public static uint GetEntryPoint() { return 0; }
}
public class ObjUtilitiesGetPointer : AssemblerMethod
{
public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
{
XS.Set(XSRegisters.EAX, XSRegisters.EBP, sourceDisplacement: 0x8);
XS.Push(XSRegisters.EAX);
}
}
public class ObjUtilitiesGetEntry : AssemblerMethod
{
public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
{
XS.Set(XSRegisters.EAX, LabelName.Get(CPUUpdateIDTAsm.GetMethodDef(typeof(Cosmos.Core.Processing.ProcessorScheduler).Assembly, typeof(Cosmos.Core.Processing.ProcessorScheduler).FullName, "EntryPoint", true)));
XS.Push(XSRegisters.EAX);
}
}
}
|
using Cosmos.Core;
using IL2CPU.API.Attribs;
using System;
using XSharp;
using XSharp.Assembler;
namespace Cosmos.Core_Asm
{
[Plug(Target = typeof(ObjUtilities))]
public static unsafe class ObjUtilitiesImpl
{
[PlugMethod(Assembler = typeof(ObjUtilitiesGetPointer))]
public static uint GetPointer(Delegate aVal) { return 0; }
[PlugMethod(Assembler = typeof(ObjUtilitiesGetPointer))]
public static uint GetPointer(Object aVal) { return 0; }
[PlugMethod(Assembler = typeof(ObjUtilitiesGetEntry))]
public static uint GetEntryPoint() { return 0; }
}
public class ObjUtilitiesGetPointer : AssemblerMethod
{
public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
{
XS.Set(XSRegisters.EAX, XSRegisters.EBP, sourceDisplacement: 0x8);
XS.Push(XSRegisters.EAX);
}
}
public class ObjUtilitiesGetEntry : AssemblerMethod
{
public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
{
XS.Set(XSRegisters.EAX, LabelName.Get(CPUUpdateIDTAsm.GetMethodDef(typeof(Cosmos.Core.Processing.ProcessorScheduler).Assembly, typeof(Cosmos.Core.Processing.ProcessorScheduler).FullName, "EntryPoint", true)));
XS.Push(XSRegisters.EAX);
}
}
}
|
bsd-3-clause
|
C#
|
5c85655e8a2ff8a74c18f6cca9dee83395a01a28
|
Update NonceGenerator.cs
|
dandresini/Thinktecture.IdentityModel,IdentityModel/Thinktecture.IdentityModel,s093294/Thinktecture.IdentityModel,IdentityModel/Thinktecture.IdentityModel,BenAtStatement1/EmbeddedAuthorizationServer,s093294/Thinktecture.IdentityModel,asteffens007/identity_model,mreasy232/Thinktecture.IdentityModel,BenAtStatement1/EmbeddedAuthorizationServer,kollisp/Thinktecture.IdentityModel,mreasy232/Thinktecture.IdentityModel,dandresini/Thinktecture.IdentityModel,hajirazin/Thinktecture.IdentityModel,asteffens007/identity_model,hajirazin/Thinktecture.IdentityModel,kollisp/Thinktecture.IdentityModel,BasLijten/Thinktecture.IdentityModel,BasLijten/Thinktecture.IdentityModel
|
source/Hawk/Core/Helpers/NonceGenerator.cs
|
source/Hawk/Core/Helpers/NonceGenerator.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
namespace Thinktecture.IdentityModel.Hawk.Core.Helpers
{
/// <summary>
/// Generates a nonce to be used by a .NET client.
/// </summary>
public class NonceGenerator
{
private static RNGCryptoServiceProvider _rngProvider = new RNGCryptoServiceProvider();
/// <summary>
/// Generates a nonce matching the specified length and returns the same. Default length is 6.
/// </summary>
public static string Generate(int length = 6)
{
var random = new List<char>();
do
{
byte[] bytes = new byte[length * 8];
_rngProvider.GetBytes(bytes);
var characters = bytes.Where(b => (b >= 48 && b <= 57) || // 0 - 9
(b >= 97 && b <= 122) || // a - z
(b >= 65 && b <= 90)) // A - Z
.Take(length - random.Count)
.Select(b => Convert.ToChar(b));
random.AddRange(characters);
}
while (random.Count < length);
return new string(random.ToArray());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
namespace Thinktecture.IdentityModel.Hawk.Core.Helpers
{
/// <summary>
/// Generates a nonce to be used by a .NET client.
/// </summary>
public class NonceGenerator
{
/// <summary>
/// Generates a nonce matching the specified length and returns the same. Default length is 6.
/// </summary>
public static string Generate(int length = 6)
{
var random = new List<char>();
do
{
byte[] bytes = new byte[length * 8];
using (var rngProvider = new RNGCryptoServiceProvider())
{
rngProvider.GetBytes(bytes);
}
var characters = bytes.Where(b => (b >= 48 && b <= 57) || // 0 - 9
(b >= 97 && b <= 122) || // a - z
(b >= 65 && b <= 90)) // A - Z
.Take(length - random.Count)
.Select(b => Convert.ToChar(b));
random.AddRange(characters);
}
while (random.Count < length);
return new string(random.ToArray());
}
}
}
|
bsd-3-clause
|
C#
|
ae52195abebffc3d367c0f63917e6c0f8e82fc1b
|
Add GitTasks.GitIsDetached method.
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Common/Tools/Git/GitTasks.cs
|
source/Nuke.Common/Tools/Git/GitTasks.cs
|
// Copyright Matthias Koch 2018.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using Nuke.Core;
using Nuke.Core.Tooling;
namespace Nuke.Common.Tools.Git
{
public static partial class GitTasks
{
private static IProcess StartProcess(GitSettings toolSettings, ProcessSettings processSettings)
{
return ProcessTasks.StartProcess(
toolSettings.ToolPath,
toolSettings.Arguments,
toolSettings.WorkingDirectory,
processSettings?.EnvironmentVariables,
processSettings?.ExecutionTimeout,
processSettings?.RedirectOutput ?? false);
}
public static bool GitIsDetached()
{
return GitIsDetached(EnvironmentInfo.WorkingDirectory);
}
public static bool GitIsDetached(string workingDirectory)
{
var process = StartProcess(
new GitSettings()
.SetWorkingDirectory(workingDirectory)
.SetArguments("symbolic-ref --short -q HEAD"),
new ProcessSettings().EnableRedirectOutput())
.AssertWaitForExit();
return !process.Output.Any();
}
public static bool GitHasUncommitedChanges()
{
return GitHasUncommitedChanges(EnvironmentInfo.WorkingDirectory);
}
public static bool GitHasUncommitedChanges(string workingDirectory)
{
var process = StartProcess(
new GitSettings()
.SetWorkingDirectory(workingDirectory)
.SetArguments("status --short"),
new ProcessSettings().EnableRedirectOutput())
.AssertZeroExitCode();
return process.Output.Any();
}
}
}
|
// Copyright Matthias Koch 2018.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using Nuke.Core;
using Nuke.Core.Tooling;
namespace Nuke.Common.Tools.Git
{
public static partial class GitTasks
{
private static IProcess StartProcess(GitSettings toolSettings, ProcessSettings processSettings)
{
return ProcessTasks.StartProcess(
toolSettings.ToolPath,
toolSettings.Arguments,
toolSettings.WorkingDirectory,
processSettings?.EnvironmentVariables,
processSettings?.ExecutionTimeout,
processSettings?.RedirectOutput ?? false);
}
public static bool GitHasUncommitedChanges()
{
return GitHasUncommitedChanges(EnvironmentInfo.WorkingDirectory);
}
public static bool GitHasUncommitedChanges(string workingDirectory)
{
var process = StartProcess(
new GitSettings()
.SetWorkingDirectory(workingDirectory)
.SetArguments("status --short"),
new ProcessSettings().EnableRedirectOutput())
.AssertZeroExitCode();
return process.Output.Any();
}
}
}
|
mit
|
C#
|
8c88e22d32a4ea91e1f2686a33b31d188fdfafd9
|
stop sleeping while waiting for connection
|
taka-oyama/UniHttp
|
Assets/UniHttp/Support/HttpStream.cs
|
Assets/UniHttp/Support/HttpStream.cs
|
using UnityEngine;
using System.IO;
using System.Net.Sockets;
using System;
using System.Net.Security;
using System.Threading;
namespace UniHttp
{
public class HttpStream : Stream
{
SslClient sslClient;
NetworkStream networkStream;
Stream stream;
public HttpStream(TcpClient tcpClient, Uri uri)
{
this.networkStream = tcpClient.GetStream();
if(uri.Scheme == Uri.UriSchemeHttp) {
this.stream = networkStream;
return;
}
if(uri.Scheme == Uri.UriSchemeHttps) {
this.sslClient = new SslClient(uri, networkStream, true);
this.stream = sslClient.Authenticate(SslClient.NoVerify);
return;
}
throw new Exception("Unsupported Scheme:" + uri.Scheme);
}
public override bool CanRead { get { return stream.CanRead; } }
public override bool CanSeek { get { return stream.CanSeek; } }
public override bool CanWrite { get { return stream.CanTimeout; } }
public override long Length { get { return stream.Length; } }
public override long Position {
get { return stream.Position; }
set { stream.Position = value; }
}
public override void SetLength(long value)
{
stream.SetLength(value);
}
public override int Read(byte[] buffer, int offset, int count)
{
return stream.Read(buffer, 0, count);
}
public override long Seek(long offset, SeekOrigin origin)
{
return stream.Seek(offset, origin);
}
public override void Write(byte[] buffer, int offset, int count)
{
stream.Write(buffer, offset, count);
}
public override void Flush()
{
stream.Flush();
}
protected override void Dispose(bool disposing)
{
if(disposing) {
if(sslClient != null) {
sslClient.Dispose();
}
}
base.Dispose(disposing);
}
}
}
|
using UnityEngine;
using System.IO;
using System.Net.Sockets;
using System;
using System.Net.Security;
using System.Threading;
namespace UniHttp
{
public class HttpStream : Stream
{
SslClient sslClient;
NetworkStream networkStream;
Stream stream;
public HttpStream(TcpClient tcpClient, Uri uri)
{
this.networkStream = tcpClient.GetStream();
if(uri.Scheme == Uri.UriSchemeHttp) {
this.stream = networkStream;
return;
}
if(uri.Scheme == Uri.UriSchemeHttps) {
this.sslClient = new SslClient(uri, networkStream, true);
this.stream = sslClient.Authenticate(SslClient.NoVerify);
return;
}
throw new Exception("Unsupported Scheme:" + uri.Scheme);
}
public override bool CanRead { get { return stream.CanRead; } }
public override bool CanSeek { get { return stream.CanSeek; } }
public override bool CanWrite { get { return stream.CanTimeout; } }
public override long Length { get { return stream.Length; } }
public override long Position {
get { return stream.Position; }
set { stream.Position = value; }
}
public override void SetLength(long value)
{
stream.SetLength(value);
}
public override int Read(byte[] buffer, int offset, int count)
{
if(!networkStream.DataAvailable) {
Thread.Sleep(1);
}
return stream.Read(buffer, 0, count);
}
public override long Seek(long offset, SeekOrigin origin)
{
return stream.Seek(offset, origin);
}
public override void Write(byte[] buffer, int offset, int count)
{
stream.Write(buffer, offset, count);
}
public override void Flush()
{
stream.Flush();
}
protected override void Dispose(bool disposing)
{
if(disposing) {
if(sslClient != null) {
sslClient.Dispose();
}
}
base.Dispose(disposing);
}
}
}
|
mit
|
C#
|
469a261195e342301f53be6efabaab86cc9c74e0
|
Initialize AppDeleteCommand with an IAppHarborClient
|
appharbor/appharbor-cli
|
src/AppHarbor/Commands/AppDeleteCommand.cs
|
src/AppHarbor/Commands/AppDeleteCommand.cs
|
using System;
namespace AppHarbor.Commands
{
[CommandHelp("Delete application")]
public class AppDeleteCommand : ICommand
{
private readonly IAppHarborClient _appharborClient;
public AppDeleteCommand(IAppHarborClient appharborClient)
{
_appharborClient = appharborClient;
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
|
using System;
namespace AppHarbor.Commands
{
[CommandHelp("Delete application")]
public class AppDeleteCommand : ICommand
{
public AppDeleteCommand()
{
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
aec00b346ac509a8cd4e790378f3bee4b4fde387
|
Add refresh token property in user identity
|
jerriep/auth0.net,jerriep/auth0.net,auth0/auth0.net,auth0/auth0.net,jerriep/auth0.net
|
src/Auth0.ManagementApi/Models/Identity.cs
|
src/Auth0.ManagementApi/Models/Identity.cs
|
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Auth0.ManagementApi.Models
{
/// <summary>
/// Describes a 3rd party account for a given <see cref="User"/>.
/// </summary>
/// <remarks>
/// A single <see cref="User"/> may be linked to multiple 3rd party accounts. This object defines the details of one of those accounts.
/// </remarks>
[JsonObject]
public class Identity
{
/// <summary>
/// The token that can be used to call the <see cref="Provider"/>'s API to get more information about the user.
/// </summary>
[JsonProperty("access_token")]
public string AccessToken { get; set; }
/// <summary>
/// The refresh token that can be used to call the <see cref="Provider"/>'s API to renew access tokens.
/// </summary>
/// <remarks>
/// The refresh token is only available for certain providers.
/// </remarks>
[JsonProperty("refresh_token")]
public string RefreshToken { get; set; }
/// <summary>
/// The name of the connection for the identity.
/// </summary>
/// <remarks>
/// Sometimes, this is the same as the connection, but not always.
/// </remarks>
[JsonProperty("connection")]
public string Connection { get; set; }
/// <summary>
/// Indicates whether this is a social identity.
/// </summary>
[JsonProperty("isSocial")]
public bool? IsSocial { get; set; }
/// <summary>
/// The type of identity provider.
/// </summary>
[JsonProperty("provider")]
public string Provider { get; set; }
/// <summary>
/// The user's identifier.
/// </summary>
[JsonProperty("user_id")]
public string UserId { get; set; }
/// <summary>
/// Contains additional profile information for linked identities.
/// </summary>
[JsonProperty("profileData")]
public IDictionary<string, object> ProfileData { get; set; }
}
}
|
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Auth0.ManagementApi.Models
{
/// <summary>
/// Describes a 3rd party account for a given <see cref="User"/>.
/// </summary>
/// <remarks>
/// A single <see cref="User"/> may be linked to multiple 3rd party accounts. This object defines the details of one of those accounts.
/// </remarks>
[JsonObject]
public class Identity
{
/// <summary>
/// The token that can be used to call the <see cref="Provider"/>'s API to get more information about the user.
/// </summary>
[JsonProperty("access_token")]
public string AccessToken { get; set; }
/// <summary>
/// The name of the connection for the identity.
/// </summary>
/// <remarks>
/// Sometimes, this is the same as the connection, but not always.
/// </remarks>
[JsonProperty("connection")]
public string Connection { get; set; }
/// <summary>
/// Indicates whether this is a social identity.
/// </summary>
[JsonProperty("isSocial")]
public bool? IsSocial { get; set; }
/// <summary>
/// The type of identity provider.
/// </summary>
[JsonProperty("provider")]
public string Provider { get; set; }
/// <summary>
/// The user's identifier.
/// </summary>
[JsonProperty("user_id")]
public string UserId { get; set; }
/// <summary>
/// Contains additional profile information for linked identities.
/// </summary>
[JsonProperty("profileData")]
public IDictionary<string, object> ProfileData { get; set; }
}
}
|
mit
|
C#
|
5d0dd1de611c4879ea1fd17d3e80bdb843a50aa1
|
Bump version
|
rmorrin/FixerSharp
|
FixerSharp/Properties/AssemblyInfo.cs
|
FixerSharp/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("FixerSharp")]
[assembly: AssemblyDescription("Currency conversion using the fixer.io API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ryan Morrin")]
[assembly: AssemblyProduct("FixerSharp")]
[assembly: AssemblyCopyright("Copyright © 2015 Ryan Morrin")]
[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("3c44edef-b40c-4c62-b416-b98e6b9713d9")]
// 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.1.0.0")]
[assembly: AssemblyInformationalVersion("1.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("FixerSharp")]
[assembly: AssemblyDescription("Currency conversion using the fixer.io API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ryan Morrin")]
[assembly: AssemblyProduct("FixerSharp")]
[assembly: AssemblyCopyright("Copyright © 2015 Ryan Morrin")]
[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("3c44edef-b40c-4c62-b416-b98e6b9713d9")]
// 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#
|
126fa37bc1a0f6238ac21b6124033be317080e1a
|
Update copyright
|
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.0.0")]
[assembly: AssemblyFileVersion("1.0.0.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 © 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.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
cf281db87627ce75ef228b66cb5f574fda389613
|
Delete unnecessary string.Concat call in HashUtilities.ComputeFileHash
|
patchkit-net/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,mohsansaleem/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,mohsansaleem/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,genail/patchkit-patcher-unity
|
src/Assets/Scripts/Data/HashUtilities.cs
|
src/Assets/Scripts/Data/HashUtilities.cs
|
using System.Collections.Generic;
using System.Data.HashFunction;
using System.IO;
using System.Linq;
using System.Text;
namespace PatchKit.Unity.Patcher.Data
{
internal static class HashUtilities
{
private const ulong Seed = 42;
public static byte[] ComputeHash(byte[] buffer, int offset, int length)
{
var xxHash = new xxHash(Seed);
var memoryStream = new MemoryStream(buffer, offset, length);
return xxHash.ComputeHash(memoryStream);
}
public static string ComputeHashString(byte[] buffer, int offset, int length)
{
byte[] hash = ComputeHash(buffer, offset, length);
return string.Join("", hash.Select(b => b.ToString()).Reverse().ToArray());
}
public static string ComputeStringHash(string str)
{
return string.Concat(new xxHash(Seed).ComputeHash(Encoding.UTF8.GetBytes(str)).Select(b => b.ToString("X2")));
}
public static string ComputeFileHash(string filePath)
{
using (var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
IEnumerable<string> enumerable = new xxHash(Seed).ComputeHash(fileStream).Select(b => b.ToString("X2")).Reverse();
return string.Join("", enumerable.ToArray()).ToLower().TrimStart('0');
}
}
}
}
|
using System.Collections.Generic;
using System.Data.HashFunction;
using System.IO;
using System.Linq;
using System.Text;
namespace PatchKit.Unity.Patcher.Data
{
internal static class HashUtilities
{
private const ulong Seed = 42;
public static byte[] ComputeHash(byte[] buffer, int offset, int length)
{
var xxHash = new xxHash(Seed);
var memoryStream = new MemoryStream(buffer, offset, length);
return xxHash.ComputeHash(memoryStream);
}
public static string ComputeHashString(byte[] buffer, int offset, int length)
{
byte[] hash = ComputeHash(buffer, offset, length);
return string.Join("", hash.Select(b => b.ToString()).Reverse().ToArray());
}
public static string ComputeStringHash(string str)
{
return string.Concat(new xxHash(Seed).ComputeHash(Encoding.UTF8.GetBytes(str)).Select(b => b.ToString("X2")));
}
public static string ComputeFileHash(string filePath)
{
using (var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
IEnumerable<string> enumerable = new xxHash(Seed).ComputeHash(fileStream).Select(b => b.ToString("X2")).Reverse();
return string.Concat(string.Join("", enumerable.ToArray()).ToLower().TrimStart('0'));
}
}
}
}
|
mit
|
C#
|
77cd301b6aeaf02c6627473093023d8dadd7d17b
|
use default files
|
MichaelPetrinolis/IdentityServer4.Samples,MichaelPetrinolis/IdentityServer4.Samples,IdentityServer/IdentityServer4.Samples,IdentityServer/IdentityServer4.Samples,MichaelPetrinolis/IdentityServer4.Samples,haoyk/IdentityServer4.Samples,IdentityServer/IdentityServer4.Samples,haoyk/IdentityServer4.Samples,haoyk/IdentityServer4.Samples,haoyk/IdentityServer4.Samples
|
Clients/src/JsOidc/Startup.cs
|
Clients/src/JsOidc/Startup.cs
|
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Builder;
namespace JsOidc
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IApplicationBuilder app)
{
app.UseDefaultFiles();
app.UseStaticFiles();
}
}
}
|
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Builder;
namespace JsOidc
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
app.Run(ctx =>
{
ctx.Response.Redirect("/index.html");
return Task.FromResult(0);
});
}
}
}
|
apache-2.0
|
C#
|
f6aa3efa928cbcc18f5fc7d03bc86842b543fded
|
Make sure GetIdValue returns a unique value per object.
|
ronnymgm/csla-light,ronnymgm/csla-light,BrettJaner/csla,jonnybee/csla,JasonBock/csla,MarimerLLC/csla,rockfordlhotka/csla,JasonBock/csla,MarimerLLC/csla,rockfordlhotka/csla,BrettJaner/csla,jonnybee/csla,rockfordlhotka/csla,JasonBock/csla,ronnymgm/csla-light,jonnybee/csla,MarimerLLC/csla,BrettJaner/csla
|
Csla20Test/Csla.Test/DataBinding/DataBindingApp/ListObject.cs
|
Csla20Test/Csla.Test/DataBinding/DataBindingApp/ListObject.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using Csla.Core;
using Csla;
namespace DataBindingApp
{
[Serializable()]
public class ListObject : BusinessListBase<ListObject, ListObject.DataObject>
{
[Serializable()]
public class DataObject : BusinessBase<DataObject>
{
private int _ID;
private string _data;
private int _number;
public int Number
{
get { return _number; }
set { _number = value; }
}
public string Data
{
get { return _data; }
set { _data = value; }
}
public int ID
{
get { return _ID; }
set { _ID = value; }
}
protected override object GetIdValue()
{
return _number;
}
public DataObject(string data, int number)
{
this.MarkAsChild();
_data = data;
_number = number;
this.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(DataObject_PropertyChanged);
}
public void DataObject_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
Console.WriteLine("Property has changed");
}
}
private ListObject()
{ }
public static ListObject GetList()
{
ListObject list = new ListObject();
for (int i = 0; i < 5; i++)
{
list.Add(new DataObject("element" + i, i));
}
return list;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Csla.Core;
using Csla;
namespace DataBindingApp
{
[Serializable()]
public class ListObject : BusinessListBase<ListObject, ListObject.DataObject>
{
[Serializable()]
public class DataObject : BusinessBase<DataObject>
{
private int _ID;
private string _data;
private int _number;
public int Number
{
get { return _number; }
set { _number = value; }
}
public string Data
{
get { return _data; }
set { _data = value; }
}
public int ID
{
get { return _ID; }
set { _ID = value; }
}
protected override object GetIdValue()
{
return _ID;
}
public DataObject(string data, int number)
{
this.MarkAsChild();
_data = data;
_number = number;
this.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(DataObject_PropertyChanged);
}
public void DataObject_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
Console.WriteLine("Property has changed");
}
}
private ListObject()
{ }
public static ListObject GetList()
{
ListObject list = new ListObject();
for (int i = 0; i < 5; i++)
{
list.Add(new DataObject("element" + i, i));
}
return list;
}
}
}
|
mit
|
C#
|
8157b48e330a50f60c1d7deaac6677dc260fcc75
|
read more link
|
lianzhao/wiki2dict,lianzhao/wiki2dict,lianzhao/wiki2dict
|
src/Wiki2Dict/Wiki/GetDescriptionAction.cs
|
src/Wiki2Dict/Wiki/GetDescriptionAction.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Framework.Logging;
using Newtonsoft.Json;
using Wiki2Dict.Core;
namespace Wiki2Dict.Wiki
{
public class GetDescriptionAction : IDictEntryAction
{
private readonly ILogger _logger;
public GetDescriptionAction(ILoggerFactory loggerFactory = null)
{
_logger = loggerFactory?.CreateLogger(typeof (GetDescriptionAction).FullName);
}
public async Task InvokeAsync(HttpClient client, IList<DictEntry> entries)
{
var tasks = entries.Select(async entry =>
{
var requestUrl =
$"api.php?action=query&generator=allpages&gapfrom={entry.Value}&gapto={entry.Value}&exintro&gaplimit=1&prop=extracts&continue=&format=json";
var response = await client.GetAsync(requestUrl, _logger).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var model = JsonConvert.DeserializeObject<QueryResponse>(json);
var description = model.query.pages.Values.FirstOrDefault()?.extract;
if (!string.IsNullOrEmpty(description))
{
description = $"{description}<br><a href=\"{client.BaseAddress}wiki/{entry.Value}\">读更多...</a>";
}
entry.Attributes["Description"] = description;
});
await Task.WhenAll(tasks).ConfigureAwait(false);
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Framework.Logging;
using Newtonsoft.Json;
using Wiki2Dict.Core;
namespace Wiki2Dict.Wiki
{
public class GetDescriptionAction : IDictEntryAction
{
private readonly ILogger _logger;
public GetDescriptionAction(ILoggerFactory loggerFactory = null)
{
_logger = loggerFactory?.CreateLogger(typeof (GetDescriptionAction).FullName);
}
public async Task InvokeAsync(HttpClient client, IList<DictEntry> entries)
{
var tasks = entries.Select(async entry =>
{
var requestUrl =
$"api.php?action=query&generator=allpages&gapfrom={entry.Value}&gapto={entry.Value}&exintro&gaplimit=1&prop=extracts&continue=&format=json";
var response = await client.GetAsync(requestUrl, _logger).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var model = JsonConvert.DeserializeObject<QueryResponse>(json);
var description = model.query.pages.Values.FirstOrDefault()?.extract;
entry.Attributes["Description"] = description;
});
await Task.WhenAll(tasks).ConfigureAwait(false);
}
}
}
|
mit
|
C#
|
626816735d8aa6cd08144c118c880c0abcb7c41a
|
fix comment "Upload picture to TwitPic" → "Upload picture to YFrog"
|
fin-alice/Mystique,azyobuzin/Mystique
|
Dulcet/ThirdParty/YFrogApi.cs
|
Dulcet/ThirdParty/YFrogApi.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Linq;
using Dulcet.Network;
using Dulcet.Twitter.Credential;
using Dulcet.Util;
using System.IO;
using System.Runtime.Serialization.Json;
namespace Dulcet.ThirdParty
{
public static class YFrogApi
{
static string UploadApiUrl = "http://yfrog.com/api/xauth_upload";
/// <summary>
/// Upload picture to YFrog
/// </summary>
public static bool UploadToYFrog(this OAuth provider, string apiKey, string mediaFilePath, out string url)
{
url = null;
var doc = provider.UploadToYFrog(apiKey, mediaFilePath);
try
{
url = doc.Element("root").Element("rsp").Element("mediaurl").ParseString();
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Upload picture to YFrog
/// </summary>
public static XDocument UploadToYFrog(this OAuth provider, string apiKey, string mediaFilePath)
{
var req = Http.CreateRequest(new Uri(UploadApiUrl), "POST", contentType: "application/x-www-form-urlencoded");
// use OAuth Echo
provider.MakeOAuthEchoRequest(ref req);
List<SendData> sd = new List<SendData>();
sd.Add(new SendData("key", apiKey));
sd.Add(new SendData("media", file: mediaFilePath));
var doc = Http.WebUpload<XDocument>(req, sd, Encoding.UTF8, (s) =>
{
using (var json = JsonReaderWriterFactory.CreateJsonReader(s,
System.Xml.XmlDictionaryReaderQuotas.Max))
{
return XDocument.Load(json);
}
});
if (doc.ThrownException != null)
throw doc.ThrownException;
if (doc.Succeeded == false)
return null;
return doc.Data;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Linq;
using Dulcet.Network;
using Dulcet.Twitter.Credential;
using Dulcet.Util;
using System.IO;
using System.Runtime.Serialization.Json;
namespace Dulcet.ThirdParty
{
public static class YFrogApi
{
static string UploadApiUrl = "http://yfrog.com/api/xauth_upload";
/// <summary>
/// Upload picture to YFrog
/// </summary>
public static bool UploadToYFrog(this OAuth provider, string apiKey, string mediaFilePath, out string url)
{
url = null;
var doc = provider.UploadToYFrog(apiKey, mediaFilePath);
try
{
url = doc.Element("root").Element("rsp").Element("mediaurl").ParseString();
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Upload picture to TwitPic
/// </summary>
public static XDocument UploadToYFrog(this OAuth provider, string apiKey, string mediaFilePath)
{
var req = Http.CreateRequest(new Uri(UploadApiUrl), "POST", contentType: "application/x-www-form-urlencoded");
// use OAuth Echo
provider.MakeOAuthEchoRequest(ref req);
List<SendData> sd = new List<SendData>();
sd.Add(new SendData("key", apiKey));
sd.Add(new SendData("media", file: mediaFilePath));
var doc = Http.WebUpload<XDocument>(req, sd, Encoding.UTF8, (s) =>
{
using (var json = JsonReaderWriterFactory.CreateJsonReader(s,
System.Xml.XmlDictionaryReaderQuotas.Max))
{
return XDocument.Load(json);
}
});
if (doc.ThrownException != null)
throw doc.ThrownException;
if (doc.Succeeded == false)
return null;
return doc.Data;
}
}
}
|
mit
|
C#
|
8c5f1e002f69f89550807449156a82f8a6bbb4e6
|
Fix build failure.
|
alansav/credentials
|
src/Credentials/Credentials.cs
|
src/Credentials/Credentials.cs
|
namespace Savage.Credentials
{
public interface ICredentials
{
string Username { get; }
string Password { get; }
SaltAndHashedPassword CreateSaltAndHashedPassword();
}
public class Credentials : ICredentials
{
public string Username { get; private set; }
public string Password { get; private set; }
public Credentials(string username, string password)
{
Username = username;
Password = password;
}
public SaltAndHashedPassword CreateSaltAndHashedPassword()
{
return SaltAndHashedPassword.New(Password);
}
}
}
|
namespace Savage.Credentials
{
public interface ICredentials
{
string Username { get; }
string Password { get; }
SaltAndHashedPassword CreateSaltAndHashedPassword();
}
public class Credentials : ICredentials
{
public readonly string Username;
public readonly string Password;
public Credentials(string username, string password)
{
Username = username;
Password = password;
}
public SaltAndHashedPassword CreateSaltAndHashedPassword()
{
return SaltAndHashedPassword.New(Password);
}
}
}
|
mit
|
C#
|
3a5a845adadaa82465f987d72377df5c51381ca6
|
Update version to 0.2.2
|
pvdstel/cgppm
|
src/cgppm/Properties/AssemblyInfo.cs
|
src/cgppm/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("cgppm")]
[assembly: AssemblyDescription("Converts Netpbm images to other image formats.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cgppm")]
[assembly: AssemblyCopyright("Copyright © pvdstel 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)]
//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("0.2.2.0")]
[assembly: AssemblyFileVersion("0.2.2.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("cgppm")]
[assembly: AssemblyDescription("Converts Netpbm images to other image formats.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cgppm")]
[assembly: AssemblyCopyright("Copyright © pvdstel 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)]
//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("0.2.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
|
mpl-2.0
|
C#
|
386cc12f96c11bbcb9ed09d1a4375695b47b061f
|
allow write to many collections
|
kreeben/resin,kreeben/resin
|
src/Sir.Search/HttpWriter.cs
|
src/Sir.Search/HttpWriter.cs
|
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
namespace Sir.Store
{
/// <summary>
/// Write into a collection.
/// </summary>
public class HttpWriter : IHttpWriter, ILogger
{
public string ContentType => "application/json";
private readonly SessionFactory _sessionFactory;
private readonly Stopwatch _timer;
public HttpWriter(SessionFactory sessionFactory)
{
_sessionFactory = sessionFactory;
_timer = new Stopwatch();
}
public void Write(HttpRequest request, IStringModel model)
{
var documents = Deserialize<IEnumerable<IDictionary<string, object>>>(request.Body);
if (request.Query.ContainsKey("collection"))
{
var collections = request.Query["collection"].ToArray();
foreach (var collection in collections)
{
_sessionFactory.WriteConcurrent(new Job(collection.ToHash(), documents, model));
}
}
else
{
_sessionFactory.WriteConcurrent(documents, model);
}
}
private static T Deserialize<T>(Stream stream)
{
using (StreamReader reader = new StreamReader(stream))
using (JsonTextReader jsonReader = new JsonTextReader(reader))
{
JsonSerializer ser = new JsonSerializer();
return ser.Deserialize<T>(jsonReader);
}
}
public void Dispose()
{
}
}
}
|
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
namespace Sir.Store
{
/// <summary>
/// Write into a collection.
/// </summary>
public class HttpWriter : IHttpWriter, ILogger
{
public string ContentType => "application/json";
private readonly SessionFactory _sessionFactory;
private readonly Stopwatch _timer;
public HttpWriter(SessionFactory sessionFactory)
{
_sessionFactory = sessionFactory;
_timer = new Stopwatch();
}
public void Write(HttpRequest request, IStringModel model)
{
var documents = Deserialize<IEnumerable<IDictionary<string, object>>>(request.Body);
if (request.Query.ContainsKey("collection"))
{
var collectionId = request.Query["collection"].ToString().ToHash();
_sessionFactory.WriteConcurrent(new Job(collectionId, documents, model));
}
else
{
_sessionFactory.WriteConcurrent(documents, model);
}
}
private static T Deserialize<T>(Stream stream)
{
using (StreamReader reader = new StreamReader(stream))
using (JsonTextReader jsonReader = new JsonTextReader(reader))
{
JsonSerializer ser = new JsonSerializer();
return ser.Deserialize<T>(jsonReader);
}
}
public void Dispose()
{
}
}
}
|
mit
|
C#
|
03daacb738ecee4b496f2baf9f72eec30de78c0e
|
Fix generic type name in FixedLengthLineBuilder
|
forcewake/FlatFile
|
src/FlatFile.FixedLength/Implementation/FixedLengthLineBuilder.cs
|
src/FlatFile.FixedLength/Implementation/FixedLengthLineBuilder.cs
|
namespace FlatFile.FixedLength.Implementation
{
using System.Linq;
using FlatFile.Core;
using FlatFile.Core.Base;
public class FixedLengthLineBuilder :
LineBulderBase<ILayoutDescriptor<IFixedFieldSettingsContainer>, IFixedFieldSettingsContainer>,
IFixedLengthLineBuilder
{
public FixedLengthLineBuilder(ILayoutDescriptor<IFixedFieldSettingsContainer> descriptor)
: base(descriptor)
{
}
public override string BuildLine<T>(T entry)
{
string line = Descriptor.Fields.Aggregate(string.Empty,
(current, field) => current + GetStringValueFromField(field, field.PropertyInfo.GetValue(entry, null)));
return line;
}
protected override string TransformFieldValue(IFixedFieldSettingsContainer field, string lineValue)
{
if (lineValue.Length >= field.Length)
{
return lineValue;
}
lineValue = field.PadLeft
? lineValue.PadLeft(field.Length, field.PaddingChar)
: lineValue.PadRight(field.Length, field.PaddingChar);
return lineValue;
}
}
}
|
namespace FlatFile.FixedLength.Implementation
{
using System.Linq;
using FlatFile.Core;
using FlatFile.Core.Base;
public class FixedLengthLineBuilder :
LineBulderBase<ILayoutDescriptor<IFixedFieldSettingsContainer>, IFixedFieldSettingsContainer>,
IFixedLengthLineBuilder
{
public FixedLengthLineBuilder(ILayoutDescriptor<IFixedFieldSettingsContainer> descriptor)
: base(descriptor)
{
}
public override string BuildLine<T1>(T1 entry)
{
string line = Descriptor.Fields.Aggregate(string.Empty,
(current, field) => current + GetStringValueFromField(field, field.PropertyInfo.GetValue(entry, null)));
return line;
}
protected override string TransformFieldValue(IFixedFieldSettingsContainer field, string lineValue)
{
if (lineValue.Length >= field.Length)
{
return lineValue;
}
lineValue = field.PadLeft
? lineValue.PadLeft(field.Length, field.PaddingChar)
: lineValue.PadRight(field.Length, field.PaddingChar);
return lineValue;
}
}
}
|
mit
|
C#
|
d772e8bfbc7a87c98092a37d04608f6b867d18b1
|
Bump to 0.6
|
github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity,mpOzelot/Unity,mpOzelot/Unity
|
common/SolutionInfo.cs
|
common/SolutionInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
internal const string Version = "0.6.0.0";
}
}
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
internal const string Version = "0.5.0.0";
}
}
|
mit
|
C#
|
3d5bd2a8ff641a7fdd8f56f5fa719fe78778999f
|
add addPointNormalized()
|
yasokada/unity-150906-sineGraph
|
Assets/graphDrawControl.cs
|
Assets/graphDrawControl.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic; // for List<>
/*
* v0.1 2015/09/06
* - draw line over Panel
*/
public class graphDrawControl : MonoBehaviour {
private GameObject lineGroup; // for grouping
List<Vector2> my2DPoint;
public GameObject panel;
public Canvas myCanvas; // to obtain canvas.scale
void DrawLine(List<Vector2> my2DVec, int startPos) {
List<Vector3> myPoint = new List<Vector3>();
for(int idx=0; idx<2; idx++) {
myPoint.Add(new Vector3(my2DVec[startPos+idx].x, my2DVec[startPos+idx].y, 0.0f));
}
GameObject newLine = new GameObject ("Line" + startPos.ToString() );
LineRenderer lRend = newLine.AddComponent<LineRenderer> ();
// lRend.useWorldSpace = true; // test
lRend.SetVertexCount(2);
lRend.SetWidth (0.05f, 0.05f);
Vector3 startVec = myPoint[0];
Vector3 endVec = myPoint[1];
lRend.SetPosition (0, startVec);
lRend.SetPosition (1, endVec);
newLine.transform.parent = lineGroup.transform; // for grouping
}
void drawGraph() {
if (lineGroup != null) {
Destroy (lineGroup.gameObject);
}
lineGroup = new GameObject ("LineGroup");
for (int idx=0; idx < my2DPoint.Count - 1; idx++) {
DrawLine (my2DPoint, /* startPos=*/idx);
}
lineGroup.transform.parent = panel.transform; // to belong to panel
}
void addPointNormalized(Vector2 point)
{
// point: normalized point data [-1.0, 1.0] for each of x, y
RectTransform panelRect = panel.GetComponent<RectTransform> ();
float width = panelRect.rect.width;
float height = panelRect.rect.height;
RectTransform canvasRect = myCanvas.GetComponent<RectTransform> ();
Vector2 pointPos;
// Bottom Left
pointPos = panel.transform.position;
pointPos.x += point.x * width * 0.5f * canvasRect.localScale.x;
pointPos.y += point.y * height * 0.5f * canvasRect.localScale.y;
my2DPoint.Add (pointPos);
}
void drawBottomLeftToTopRight(){
addPointNormalized (new Vector2 (-1.0f, -1.0f));
addPointNormalized (new Vector2 (1.0f, 1.0f));
drawGraph ();
}
void Start () {
my2DPoint = new List<Vector2> ();
drawBottomLeftToTopRight ();
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic; // for List<>
/*
* v0.1 2015/09/06
* - draw line over Panel
*/
public class graphDrawControl : MonoBehaviour {
private GameObject lineGroup; // for grouping
List<Vector2> my2DPoint;
public GameObject panel;
public Canvas myCanvas; // to obtain canvas.scale
void DrawLine(List<Vector2> my2DVec, int startPos) {
List<Vector3> myPoint = new List<Vector3>();
for(int idx=0; idx<2; idx++) {
myPoint.Add(new Vector3(my2DVec[startPos+idx].x, my2DVec[startPos+idx].y, 0.0f));
}
GameObject newLine = new GameObject ("Line" + startPos.ToString() );
LineRenderer lRend = newLine.AddComponent<LineRenderer> ();
// lRend.useWorldSpace = true; // test
lRend.SetVertexCount(2);
lRend.SetWidth (0.05f, 0.05f);
Vector3 startVec = myPoint[0];
Vector3 endVec = myPoint[1];
lRend.SetPosition (0, startVec);
lRend.SetPosition (1, endVec);
newLine.transform.parent = lineGroup.transform; // for grouping
}
void drawGraph() {
if (lineGroup != null) {
Destroy (lineGroup.gameObject);
}
lineGroup = new GameObject ("LineGroup");
for (int idx=0; idx < my2DPoint.Count - 1; idx++) {
DrawLine (my2DPoint, /* startPos=*/idx);
}
lineGroup.transform.parent = panel.transform; // to belong to panel
}
void drawBottomLeftToTopRight(){
Vector2 pointPos;
RectTransform panelRect = panel.GetComponent<RectTransform> ();
float width = panelRect.rect.width;
float height = panelRect.rect.height;
RectTransform canvasRect = myCanvas.GetComponent<RectTransform> ();
// Bottom Left
pointPos = panel.transform.position;
pointPos.x -= width * 0.5f * canvasRect.localScale.x;
pointPos.y -= height * 0.5f * canvasRect.localScale.y;
my2DPoint.Add (pointPos);
// Top Right
pointPos = panel.transform.position;
pointPos.x += width * 0.5f * canvasRect.localScale.x;
pointPos.y += height * 0.5f * canvasRect.localScale.y;
my2DPoint.Add (pointPos);
drawGraph ();
}
void Start () {
my2DPoint = new List<Vector2> ();
drawBottomLeftToTopRight ();
}
}
|
mit
|
C#
|
fffebe96577257cafcada4e18b88dc3b18b4e95e
|
Set PreserveAsyncOrder to false
|
exceptionless/Foundatio,Bartmax/Foundatio,wgraham17/Foundatio,FoundatioFx/Foundatio
|
src/Redis/Tests/SharedConnection.cs
|
src/Redis/Tests/SharedConnection.cs
|
using Foundatio.Tests.Utility;
using StackExchange.Redis;
namespace Foundatio.Redis.Tests {
public static class SharedConnection {
private static ConnectionMultiplexer _muxer;
public static ConnectionMultiplexer GetMuxer() {
if (ConnectionStrings.Get("RedisConnectionString") == null)
return null;
if (_muxer == null)
_muxer = ConnectionMultiplexer.Connect(ConnectionStrings.Get("RedisConnectionString"));
_muxer.PreserveAsyncOrder = false;
return _muxer;
}
}
}
|
using Foundatio.Tests.Utility;
using StackExchange.Redis;
namespace Foundatio.Redis.Tests {
public static class SharedConnection {
private static ConnectionMultiplexer _muxer;
public static ConnectionMultiplexer GetMuxer() {
if (ConnectionStrings.Get("RedisConnectionString") == null)
return null;
if (_muxer == null)
_muxer = ConnectionMultiplexer.Connect(ConnectionStrings.Get("RedisConnectionString"));
return _muxer;
}
}
}
|
apache-2.0
|
C#
|
1d1392daa2761d394e0655fba22a770234b799a7
|
Update Note.cs
|
TylerJaacks/GuitarHeroine
|
Assets/Scripts/Note.cs
|
Assets/Scripts/Note.cs
|
using UnityEngine;
public class Note : MonoBehaviour
{
void Update ()
{
transform.position += transform.forward * Time.deltaTime * -5.0f;
}
}
//HI!
|
using UnityEngine;
public class Note : MonoBehaviour
{
void Update ()
{
transform.position += transform.forward * Time.deltaTime * -5.0f;
}
}
|
mit
|
C#
|
3dfca3509255346b07442897dd97fdc1db7df108
|
test change
|
transsight/testproject,transsight/testproject
|
src/stress.samples/Program.cs
|
src/stress.samples/Program.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.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using stress.execution;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace stress.samples
{
internal class Program
{
private static void Main(string[] args)
{
String S = "test";
CancellationTokenSource tokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(20));
new ConcurrentDictionaryLoadTesting().SimpleLoad(tokenSource.Token);
}
}
}
|
// 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.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using stress.execution;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace stress.samples
{
internal class Program
{
private static void Main(string[] args)
{
CancellationTokenSource tokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(20));
new ConcurrentDictionaryLoadTesting().SimpleLoad(tokenSource.Token);
}
}
}
|
mit
|
C#
|
81c93196fb490c129f29daa265701d8b2c5508c1
|
make the default intertab client a bit safer
|
coderUT/Dragablz,ButchersBoy/Dragablz
|
Dragablz/DefaultInterTabClient.cs
|
Dragablz/DefaultInterTabClient.cs
|
using System;
using System.Linq;
using System.Windows;
using System.Windows.Threading;
using Dragablz.Core;
namespace Dragablz
{
public class DefaultInterTabClient : IInterTabClient
{
public virtual INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
{
if (source == null) throw new ArgumentNullException("source");
var sourceWindow = Window.GetWindow(source);
if (sourceWindow == null) throw new ApplicationException("Unable to ascrtain source window.");
var newWindow = (Window)Activator.CreateInstance(sourceWindow.GetType());
newWindow.Dispatcher.Invoke(new Action(() => { }), DispatcherPriority.DataBind);
var newTabablzControl = newWindow.LogicalTreeDepthFirstTraversal().OfType<TabablzControl>().FirstOrDefault();
if (newTabablzControl == null) throw new ApplicationException("Unable to ascrtain tab control.");
newTabablzControl.Items.Clear();
return new NewTabHost<Window>(newWindow, newTabablzControl);
}
public virtual TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window)
{
return TabEmptiedResponse.CloseWindowOrLayoutBranch;
}
}
}
|
using System;
using System.Linq;
using System.Windows;
using Dragablz.Core;
namespace Dragablz
{
public class DefaultInterTabClient : IInterTabClient
{
public virtual INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
{
if (source == null) throw new ArgumentNullException("source");
var sourceWindow = Window.GetWindow(source);
if (sourceWindow == null) throw new ApplicationException("Unable to ascrtain source window.");
var newWindow = (Window)Activator.CreateInstance(sourceWindow.GetType());
var newTabablzControl = newWindow.LogicalTreeDepthFirstTraversal().OfType<TabablzControl>().FirstOrDefault();
if (newTabablzControl == null) throw new ApplicationException("Unable to ascrtain tab control.");
newTabablzControl.Items.Clear();
return new NewTabHost<Window>(newWindow, newTabablzControl);
}
public virtual TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window)
{
return TabEmptiedResponse.CloseWindowOrLayoutBranch;
}
}
}
|
mit
|
C#
|
84aa6a33263a0e24c14d1b708d216ed8c7266e86
|
Build and publish nuget package
|
RockFramework/Rock.Core
|
Rock.Core/Properties/AssemblyInfo.cs
|
Rock.Core/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.Core")]
[assembly: AssemblyDescription("Core classes and interfaces for Rock Framework.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Core")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-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("6fb79d22-8ea3-4cb0-a704-8608d679cb95")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.12")]
[assembly: AssemblyInformationalVersion("0.9.12")]
[assembly: InternalsVisibleTo("Rock.Core.UnitTests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.Core")]
[assembly: AssemblyDescription("Core classes and interfaces for Rock Framework.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Core")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-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("6fb79d22-8ea3-4cb0-a704-8608d679cb95")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.11")]
[assembly: AssemblyInformationalVersion("0.9.11")]
[assembly: InternalsVisibleTo("Rock.Core.UnitTests")]
|
mit
|
C#
|
9f88c4875ae34786ebe17a88f2117e632f5fd852
|
Fix namespace & class name
|
TeamnetGroup/schema2fm
|
src/ConsoleApp/Table.cs
|
src/ConsoleApp/Table.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace ConsoleApp
{
public class Table
{
private readonly string tableName;
private readonly IEnumerable<Column> columns;
public Table(string tableName, IEnumerable<Column> columns)
{
this.tableName = tableName;
this.columns = columns;
}
public void OutputMigrationCode(TextWriter writer)
{
const string format = "yyyyMMddHHmmss";
writer.WriteLine(@"namespace Migrations
{");
writer.WriteLine($" [Migration(\"{DateTime.Now.ToString(format)}\")]");
writer.Write($" public class {tableName}Migration : Migration");
writer.WriteLine(@"
{
public override void Up()
{");
writer.Write($" Create.Table(\"{tableName}\")");
columns.ToList().ForEach(c =>
{
writer.WriteLine();
writer.Write(c.FluentMigratorCode());
});
writer.WriteLine(@";
}
public override void Down()
{");
writer.Write($" Delete.Table(\"{tableName}\");");
writer.WriteLine(@"
}
}
}");
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace ConsoleApp
{
public class Table
{
private readonly string tableName;
private readonly IEnumerable<Column> columns;
public Table(string tableName, IEnumerable<Column> columns)
{
this.tableName = tableName;
this.columns = columns;
}
public void OutputMigrationCode(TextWriter writer)
{
writer.Write(@"namespace Cucu
{
[Migration(");
writer.Write(DateTime.Now.ToString("yyyyMMddHHmmss"));
writer.WriteLine(@")]
public class Vaca : Migration
{
public override void Up()
{");
writer.Write($" Create.Table(\"{tableName}\")");
columns.ToList().ForEach(c =>
{
writer.WriteLine();
writer.Write(c.FluentMigratorCode());
});
writer.WriteLine(@";
}
public override void Down()
{");
writer.Write($" Delete.Table(\"{tableName}\");");
writer.WriteLine(@"
}
}
}");
}
}
}
|
mit
|
C#
|
39dbec09af8a2c3f0e61b24e52dae635cbaecb23
|
Upgrade assembly version to 2.4.0
|
yolanother/DockPanelSuite
|
WinFormsUI/Properties/AssemblyInfo.cs
|
WinFormsUI/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
[assembly: AssemblyTitle("DockPanel Suite for .Net 2.0")]
[assembly: AssemblyDescription(".Net Docking Library for Windows Forms")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weifen Luo")]
[assembly: AssemblyProduct("DockPanel Suite")]
[assembly: AssemblyCopyright("Copyright © Weifen Luo 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: Guid("9d690ef9-ce19-4c69-874c-e24d8eb36aff")]
[assembly: AssemblyVersion("2.4.0.*")]
[assembly: AssemblyFileVersion("2.4.0.0")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Dockable")]
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
[assembly: AssemblyTitle("DockPanel Suite for .Net 2.0")]
[assembly: AssemblyDescription(".Net Docking Library for Windows Forms")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weifen Luo")]
[assembly: AssemblyProduct("DockPanel Suite")]
[assembly: AssemblyCopyright("Copyright © Weifen Luo 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: Guid("9d690ef9-ce19-4c69-874c-e24d8eb36aff")]
[assembly: AssemblyVersion("2.3.1.*")]
[assembly: AssemblyFileVersion("2.3.1.0")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Dockable")]
|
mit
|
C#
|
8b84d9458b1ed964479a2ea6408b346d817c63c5
|
Update Auto-Censor.cs
|
DeanCabral/Code-Snippets
|
Console/Auto-Censor.cs
|
Console/Auto-Censor.cs
|
class AutoCensor
{
static void Main(string[] args)
{
GetUserInput();
}
static void GetUserInput()
{
string input = "";
string censor = "";
Console.Write("Word to censor: ");
censor = Console.ReadLine();
Console.Write("Enter sentence: ");
input = Console.ReadLine();
Console.WriteLine(WordCensor(input, censor));
Console.WriteLine();
GetUserInput();
}
static string WordCensor(string input, string censor)
{
string[] words = input.Split(' ');
string output = "";
foreach (string word in words)
{
if (word == censor)
{
for (int i = 0; i < word.Length; i++)
{
output += "*";
}
}
else output += word;
output += " ";
}
return output;
}
}
|
class AutoCensor
{
static void Main(string[] args)
{
GetUserInput();
}
static void GetUserInput()
{
string input = "";
string censor = "";
Console.Write("Word to censor: ");
censor = Console.ReadLine();
Console.Write("Enter sentence: ");
input = Console.ReadLine();
Console.WriteLine(WordCensor(input, censor));
Console.WriteLine();
GetUserInput();
}
static string WordCensor(string input, string censor)
{
string[] words = input.Split(' ');
string output = "";
foreach (string word in words)
{
if (word == censor)
{
for (int i = 0; i < word.Length; i++)
{
output += "*";
}
output += " ";
}
else output += word + " ";
}
return output;
}
}
|
mit
|
C#
|
0069814e0e02cc123906f8c7d567c24e1ea89a43
|
Update build.cake
|
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
|
XPlat/ExposureNotification/build.cake
|
XPlat/ExposureNotification/build.cake
|
var TARGET = Argument("t", Argument("target", "ci"));
var SRC_COMMIT = "21db42178a62425beb3a0ba7145741375b9f8aa5";
var SRC_URL = $"https://github.com/xamarin/xamarin.exposurenotification/archive/{SRC_COMMIT}.zip";
var OUTPUT_PATH = (DirectoryPath)"./output/";
var NUGET_VERSION = "0.6.0-preview";
Task("externals")
.Does(() =>
{
DownloadFile(SRC_URL, "./src.zip");
Unzip("./src.zip", "./");
MoveDirectory($"./xamarin.exposurenotification-{SRC_COMMIT}", "./src");
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
EnsureDirectoryExists(OUTPUT_PATH);
MSBuild($"./src/Xamarin.ExposureNotification/Xamarin.ExposureNotification.csproj", c => c
.SetConfiguration("Release")
.WithRestore()
.WithTarget("Build")
.WithTarget("Pack")
.WithProperty("PackageVersion", NUGET_VERSION)
.WithProperty("PackageOutputPath", MakeAbsolute(OUTPUT_PATH).FullPath));
});
Task("nuget")
.IsDependentOn("libs");
Task("samples")
.IsDependentOn("nuget");
Task("clean")
.Does(() =>
{
CleanDirectories("./externals/");
});
Task("ci")
.IsDependentOn("nuget");
RunTarget(TARGET);
|
var TARGET = Argument("t", Argument("target", "ci"));
var SRC_COMMIT = "fcff875013295514a22e71648a7c6ad985dc4f9f";
var SRC_URL = $"https://github.com/xamarin/xamarin.exposurenotification/archive/{SRC_COMMIT}.zip";
var OUTPUT_PATH = (DirectoryPath)"./output/";
var NUGET_VERSION = "0.5.0-preview";
Task("externals")
.Does(() =>
{
DownloadFile(SRC_URL, "./src.zip");
Unzip("./src.zip", "./");
MoveDirectory($"./xamarin.exposurenotification-{SRC_COMMIT}", "./src");
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
EnsureDirectoryExists(OUTPUT_PATH);
MSBuild($"./src/Xamarin.ExposureNotification/Xamarin.ExposureNotification.csproj", c => c
.SetConfiguration("Release")
.WithRestore()
.WithTarget("Build")
.WithTarget("Pack")
.WithProperty("PackageVersion", NUGET_VERSION)
.WithProperty("PackageOutputPath", MakeAbsolute(OUTPUT_PATH).FullPath));
});
Task("nuget")
.IsDependentOn("libs");
Task("samples")
.IsDependentOn("nuget");
Task("clean")
.Does(() =>
{
CleanDirectories("./externals/");
});
Task("ci")
.IsDependentOn("nuget");
RunTarget(TARGET);
|
mit
|
C#
|
5d683f95e0a4aa666cef0a5c99a59b12225d75e7
|
Update attributes
|
ahanusa/Peasy.NET,peasy/Samples,ahanusa/facile.net,peasy/Peasy.NET,peasy/Samples,peasy/Samples
|
Facile/Properties/AssemblyInfo.cs
|
Facile/Properties/AssemblyInfo.cs
|
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Facile")]
[assembly: AssemblyDescription("An easy to use middle tier framework for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Aaron Hanusa")]
[assembly: AssemblyProduct("Facile")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Facile")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Facile")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
20dd63e53c019c093187a484d2e5a042f5b11baf
|
Fix Startup
|
atilatosta/net-sdk-test-1486389033709,atilatosta/net-sdk-test-1486389033709,atilatosta/net-sdk-test-1486389033709
|
src/dotnetstarter/Startup.cs
|
src/dotnetstarter/Startup.cs
|
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.IO;
public class Startup
{
public IConfigurationRoot Configuration { get; }
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=home}/{action=index}");
});
}
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder()
.UseKestrel()
.UseConfiguration(config)
.UseStartup<Startup>()
.Build();
}
}
|
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.IO;
public class Startup
{
public IConfigurationRoot Configuration { get; }
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseConfiguration(config)
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
|
apache-2.0
|
C#
|
b887e62d65400ab8c265df225d46117d534267c0
|
Store ShowUnicode in FrameworkConfigManager.
|
ZLima12/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,Nabile-Rahmani/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,default0/osu-framework,naoey/osu-framework,peppy/osu-framework,paparony03/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,paparony03/osu-framework,default0/osu-framework,peppy/osu-framework,naoey/osu-framework,DrabWeb/osu-framework,ppy/osu-framework
|
osu.Framework/Configuration/FrameworkConfigManager.cs
|
osu.Framework/Configuration/FrameworkConfigManager.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Platform;
namespace osu.Framework.Configuration
{
public class FrameworkConfigManager : ConfigManager<FrameworkConfig>
{
protected override string Filename => @"framework.ini";
protected override void InitialiseDefaults()
{
#pragma warning disable CS0612 // Type or member is obsolete
Set(FrameworkConfig.ShowLogOverlay, true);
Set(FrameworkConfig.Width, 1366, 640);
Set(FrameworkConfig.Height, 768, 480);
Set(FrameworkConfig.WindowedPositionX, 0.5, -0.1, 1.1);
Set(FrameworkConfig.WindowedPositionY, 0.5, -0.1, 1.1);
Set(FrameworkConfig.AudioDevice, string.Empty);
Set(FrameworkConfig.VolumeUniversal, 1.0, 0, 1);
Set(FrameworkConfig.VolumeMusic, 1.0, 0, 1);
Set(FrameworkConfig.VolumeEffect, 1.0, 0, 1);
Set(FrameworkConfig.WidthFullscreen, 9999, 320, 9999);
Set(FrameworkConfig.HeightFullscreen, 9999, 240, 9999);
Set(FrameworkConfig.Letterboxing, true);
Set(FrameworkConfig.LetterboxPositionX, 0, -100, 100);
Set(FrameworkConfig.LetterboxPositionY, 0, -100, 100);
Set(FrameworkConfig.FrameSync, FrameSync.Limit120);
Set(FrameworkConfig.WindowMode, WindowMode.Windowed);
Set(FrameworkConfig.ShowUnicode, false);
Set(FrameworkConfig.Locale, "");
#pragma warning restore CS0612 // Type or member is obsolete
}
public FrameworkConfigManager(Storage storage)
: base(storage)
{
}
}
public enum FrameworkConfig
{
ShowLogOverlay,
AudioDevice,
VolumeUniversal,
VolumeEffect,
VolumeMusic,
Width,
Height,
WindowedPositionX,
WindowedPositionY,
HeightFullscreen,
WidthFullscreen,
WindowMode,
Letterboxing,
LetterboxPositionX,
LetterboxPositionY,
FrameSync,
ShowUnicode,
Locale,
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Platform;
namespace osu.Framework.Configuration
{
public class FrameworkConfigManager : ConfigManager<FrameworkConfig>
{
protected override string Filename => @"framework.ini";
protected override void InitialiseDefaults()
{
#pragma warning disable CS0612 // Type or member is obsolete
Set(FrameworkConfig.ShowLogOverlay, true);
Set(FrameworkConfig.Width, 1366, 640);
Set(FrameworkConfig.Height, 768, 480);
Set(FrameworkConfig.WindowedPositionX, 0.5, -0.1, 1.1);
Set(FrameworkConfig.WindowedPositionY, 0.5, -0.1, 1.1);
Set(FrameworkConfig.AudioDevice, string.Empty);
Set(FrameworkConfig.VolumeUniversal, 1.0, 0, 1);
Set(FrameworkConfig.VolumeMusic, 1.0, 0, 1);
Set(FrameworkConfig.VolumeEffect, 1.0, 0, 1);
Set(FrameworkConfig.WidthFullscreen, 9999, 320, 9999);
Set(FrameworkConfig.HeightFullscreen, 9999, 240, 9999);
Set(FrameworkConfig.Letterboxing, true);
Set(FrameworkConfig.LetterboxPositionX, 0, -100, 100);
Set(FrameworkConfig.LetterboxPositionY, 0, -100, 100);
Set(FrameworkConfig.FrameSync, FrameSync.Limit120);
Set(FrameworkConfig.WindowMode, WindowMode.Windowed);
#pragma warning restore CS0612 // Type or member is obsolete
}
public FrameworkConfigManager(Storage storage)
: base(storage)
{
}
}
public enum FrameworkConfig
{
ShowLogOverlay,
AudioDevice,
VolumeUniversal,
VolumeEffect,
VolumeMusic,
Width,
Height,
WindowedPositionX,
WindowedPositionY,
HeightFullscreen,
WidthFullscreen,
WindowMode,
Letterboxing,
LetterboxPositionX,
LetterboxPositionY,
FrameSync,
}
}
|
mit
|
C#
|
d9a65765a5c92240cc6ff7156ea4b3f62d5a1640
|
build fix
|
jeske/SimpleScene,smoothdeveloper/SimpleScene,Namone/SimpleScene,RealRui/SimpleScene
|
SimpleScene/Meshes/SSAbstractMesh.cs
|
SimpleScene/Meshes/SSAbstractMesh.cs
|
// Copyright(C) David W. Jeske, 2013
// Released to the public domain. Use, modify and relicense at will.
using System;
using System.Collections.Generic;
using OpenTK;
namespace SimpleScene
{
public abstract class SSAbstractMesh {
public delegate bool traverseFn<T>(T state, Vector3 V1, Vector3 V2, Vector3 V3);
public abstract void RenderMesh (ref SSRenderConfig renderConfig);
public abstract IEnumerable<Vector3> EnumeratePoints();
public virtual bool TraverseTriangles<T>(T state, traverseFn<T> fn) {
return true;
}
public bool TraverseTriangles(traverseFn<Object> fn) {
return this.TraverseTriangles<Object>(new Object(), fn);
}
}
}
|
// Copyright(C) David W. Jeske, 2013
// Released to the public domain. Use, modify and relicense at will.
using System;
using System.Collections.Generic;
using OpenTK;
namespace SimpleScene
{
public abstract class SSAbstractMesh {
public delegate bool traverseFn<T>(T state, Vector3 V1, Vector3 V2, Vector3 V3);
public abstract void RenderMesh (ref SSRenderConfig renderConfig);
public abstract IEnumerable<Vector3> EnumeratePoints();
public abstract bool TraverseTriangles<T>(T state, traverseFn<T> fn);
public bool TraverseTriangles(traverseFn<Object> fn) {
return this.TraverseTriangles<Object>(new Object(), fn);
}
}
}
|
apache-2.0
|
C#
|
bb411b8158de9b4e7392c2b3305416d2a11f04e2
|
Update CommandBase.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/PowerShell/CommandBase.cs
|
TIKSN.Core/PowerShell/CommandBase.cs
|
using System;
using System.Management.Automation;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Nito.AsyncEx;
namespace TIKSN.PowerShell
{
public abstract class CommandBase : PSCmdlet, IDisposable
{
protected CancellationTokenSource cancellationTokenSource;
private IServiceScope serviceScope;
protected CommandBase() => this.cancellationTokenSource = new CancellationTokenSource();
protected IServiceProvider ServiceProvider => this.serviceScope.ServiceProvider;
protected override void BeginProcessing()
{
this.cancellationTokenSource = new CancellationTokenSource();
base.BeginProcessing();
var topServiceProvider = this.GetServiceProvider();
this.serviceScope = topServiceProvider.CreateScope();
this.ServiceProvider.GetRequiredService<ICurrentCommandStore>().SetCurrentCommand(this);
this.ConfigureLogger(this.ServiceProvider.GetRequiredService<ILoggerFactory>());
}
protected virtual void ConfigureLogger(ILoggerFactory loggerFactory) =>
loggerFactory.AddPowerShell(this.ServiceProvider);
protected abstract IServiceProvider GetServiceProvider();
protected sealed override void ProcessRecord() => AsyncContext.Run(async () =>
await this.ProcessRecordAsync(this.cancellationTokenSource.Token).ConfigureAwait(false));
protected abstract Task ProcessRecordAsync(CancellationToken cancellationToken);
protected override void StopProcessing()
{
this.cancellationTokenSource.Cancel();
base.StopProcessing();
this.serviceScope.Dispose();
}
public void Dispose() => throw new NotImplementedException();
}
}
|
using System;
using System.Management.Automation;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Nito.AsyncEx;
namespace TIKSN.PowerShell
{
public abstract class CommandBase : PSCmdlet
{
protected CancellationTokenSource cancellationTokenSource;
private IServiceScope serviceScope;
protected CommandBase() => this.cancellationTokenSource = new CancellationTokenSource();
protected IServiceProvider ServiceProvider => this.serviceScope.ServiceProvider;
protected override void BeginProcessing()
{
this.cancellationTokenSource = new CancellationTokenSource();
base.BeginProcessing();
var topServiceProvider = this.GetServiceProvider();
this.serviceScope = topServiceProvider.CreateScope();
this.ServiceProvider.GetRequiredService<ICurrentCommandStore>().SetCurrentCommand(this);
this.ConfigureLogger(this.ServiceProvider.GetRequiredService<ILoggerFactory>());
}
protected virtual void ConfigureLogger(ILoggerFactory loggerFactory) =>
loggerFactory.AddPowerShell(this.ServiceProvider);
protected abstract IServiceProvider GetServiceProvider();
protected sealed override void ProcessRecord() => AsyncContext.Run(async () =>
await this.ProcessRecordAsync(this.cancellationTokenSource.Token));
protected abstract Task ProcessRecordAsync(CancellationToken cancellationToken);
protected override void StopProcessing()
{
this.cancellationTokenSource.Cancel();
base.StopProcessing();
this.serviceScope.Dispose();
}
}
}
|
mit
|
C#
|
b40c8358a219f2261573e903f7c6bd479ff23b66
|
Use standard includes
|
EamonNerbonne/ExpressionToCode
|
ExpressionToCodeTest/ApprovalTest.cs
|
ExpressionToCodeTest/ApprovalTest.cs
|
using System;
using System.IO;
using System.Runtime.CompilerServices;
using Assent;
namespace ExpressionToCodeTest
{
static class ApprovalTest
{
public static void Verify(string text, [CallerFilePath] string filepath = null, [CallerMemberName] string membername = null)
{
var filename = Path.GetFileNameWithoutExtension(filepath);
var filedir = Path.GetDirectoryName(filepath) ?? throw new InvalidOperationException("path " + filepath + " has no directory");
var config = new Configuration().UsingNamer(new Assent.Namers.FixedNamer(Path.Combine(filedir, filename + "." + membername)));
// ReSharper disable once ExplicitCallerInfoArgument
"bla".Assent(text, config, membername, filepath);
//var writer = WriterFactory.CreateTextWriter(text);
//var namer = new SaneNamer { Name = filename + "." + membername, SourcePath = filedir };
//var reporter = new DiffReporter();
//Approver.Verify(new FileApprover(writer, namer, true), reporter);
}
//public class SaneNamer : IApprovalNamer
//{
// public string SourcePath { get; set; }
// public string Name { get; set; }
//}
}
}
|
using System.IO;
using System.Runtime.CompilerServices;
using Assent;
namespace ExpressionToCodeTest
{
static class ApprovalTest
{
public static void Verify(string text, [CallerFilePath] string filepath = null, [CallerMemberName] string membername = null)
{
var filename = Path.GetFileNameWithoutExtension(filepath);
var filedir = Path.GetDirectoryName(filepath) ?? throw new InvalidOperationException("path " + filepath + " has no directory");
var config = new Configuration().UsingNamer(new Assent.Namers.FixedNamer(Path.Combine(filedir, filename + "." + membername)));
// ReSharper disable once ExplicitCallerInfoArgument
"bla".Assent(text, config, membername, filepath);
//var writer = WriterFactory.CreateTextWriter(text);
//var namer = new SaneNamer { Name = filename + "." + membername, SourcePath = filedir };
//var reporter = new DiffReporter();
//Approver.Verify(new FileApprover(writer, namer, true), reporter);
}
//public class SaneNamer : IApprovalNamer
//{
// public string SourcePath { get; set; }
// public string Name { get; set; }
//}
}
}
|
apache-2.0
|
C#
|
7e492c36cd98a82140a70fb5712f60b05552a6db
|
Bring back integration test for CosmosDb.
|
ExRam/ExRam.Gremlinq
|
ExRam.Gremlinq.Providers.CosmosDb.Tests/GroovySerializationTest.cs
|
ExRam.Gremlinq.Providers.CosmosDb.Tests/GroovySerializationTest.cs
|
using System;
using System.Linq;
using ExRam.Gremlinq.Core.Tests;
using FluentAssertions;
using Xunit;
using static ExRam.Gremlinq.Core.GremlinQuerySource;
namespace ExRam.Gremlinq.Providers.CosmosDb.Tests
{
public class GroovySerializationTest : GroovySerializationTest<CosmosDbGroovyGremlinQueryElementVisitor>
{
[Fact]
public void Limit_overflow()
{
g
.V()
.Limit((long)int.MaxValue + 1)
.Invoking(x => new CosmosDbGroovyGremlinQueryElementVisitor().Visit(x))
.Should()
.Throw<ArgumentOutOfRangeException>();
}
[Fact]
public void Where_property_array_intersects_empty_array()
{
g
.V<User>()
.Where(t => t.PhoneNumbers.Intersect(new string[0]).Any())
.Should()
.SerializeToGroovy<CosmosDbGroovyGremlinQueryElementVisitor>("g.V().hasLabel(_a).not(__.identity())")
.WithParameters("User");
}
[Fact]
public void Where_property_is_contained_in_empty_enumerable()
{
var enumerable = Enumerable.Empty<int>();
g
.V<User>()
.Where(t => enumerable.Contains(t.Age))
.Should()
.SerializeToGroovy<CosmosDbGroovyGremlinQueryElementVisitor>("g.V().hasLabel(_a).not(__.identity())")
.WithParameters("User");
}
}
}
|
using System;
using System.Linq;
using ExRam.Gremlinq.Core.Tests;
using FluentAssertions;
using Xunit;
using static ExRam.Gremlinq.Core.GremlinQuerySource;
namespace ExRam.Gremlinq.Providers.CosmosDb.Tests
{
public class GroovySerializationTest : GroovySerializationTest<CosmosDbGroovyGremlinQueryElementVisitor>
{
[Fact]
public void Limit_overflow()
{
g
.V()
.Limit((long)int.MaxValue + 1)
.Invoking(x => new CosmosDbGroovyGremlinQueryElementVisitor().Visit(x))
.Should()
.Throw<ArgumentOutOfRangeException>();
}
[Fact]
public void Where_property_array_intersects_empty_array2()
{
g
.V<User>()
.Where(t => t.PhoneNumbers.Intersect(new string[0]).Any())
.Should()
.SerializeToGroovy<CosmosDbGroovyGremlinQueryElementVisitor>("g.V().hasLabel(_a).not(__.identity())")
.WithParameters("User");
}
}
}
|
mit
|
C#
|
80d17aaf49ea9185871875354661f418dd520161
|
add category for herokuapp tests
|
ObjectivityLtd/Test.Automation,ObjectivityBSS/Test.Automation
|
Objectivity.Test.Automation.NunitTests/Tests/DownloadFilesTests.cs
|
Objectivity.Test.Automation.NunitTests/Tests/DownloadFilesTests.cs
|
/*
The MIT License (MIT)
Copyright (c) 2015 Objectivity Bespoke Software Specialists
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
namespace Objectivity.Test.Automation.NunitTests.Tests
{
using NUnit.Framework;
using Objectivity.Test.Automation.NunitTests.PageObjects;
/// <summary>
/// Tests to test framework
/// </summary>
[TestFixture, Category("herokuapp")]
public class DownloadFilesTests : ProjectTestBase
{
[Test]
public void DownloadFileByNameTest()
{
new InternetPage(this.DriverContext)
.OpenHomePage()
.GoToFileDownloader()
.SaveFile("some-file.txt");
}
[Test]
public void DownloadFileByCountTest()
{
new InternetPage(this.DriverContext)
.OpenHomePage()
.GoToFileDownloader()
.SaveFile();
}
}
}
|
/*
The MIT License (MIT)
Copyright (c) 2015 Objectivity Bespoke Software Specialists
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
namespace Objectivity.Test.Automation.NunitTests.Tests
{
using NUnit.Framework;
using Objectivity.Test.Automation.NunitTests.PageObjects;
/// <summary>
/// Tests to test framework
/// </summary>
public class DownloadFilesTests : ProjectTestBase
{
[Test]
public void DownloadFileByNameTest()
{
new InternetPage(this.DriverContext)
.OpenHomePage()
.GoToFileDownloader()
.SaveFile("some-file.txt");
}
[Test]
public void DownloadFileByCountTest()
{
new InternetPage(this.DriverContext)
.OpenHomePage()
.GoToFileDownloader()
.SaveFile();
}
}
}
|
mit
|
C#
|
93fb70e0c8bcb4c2d37aef5ef6701aee7709b779
|
Add back in the reflection namespace
|
shiftkey-tester-org-blah-blah/octokit.net,hitesh97/octokit.net,daukantas/octokit.net,naveensrinivasan/octokit.net,gdziadkiewicz/octokit.net,thedillonb/octokit.net,editor-tools/octokit.net,shana/octokit.net,shiftkey-tester/octokit.net,mminns/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,ivandrofly/octokit.net,Sarmad93/octokit.net,ivandrofly/octokit.net,SamTheDev/octokit.net,bslliw/octokit.net,chunkychode/octokit.net,cH40z-Lord/octokit.net,editor-tools/octokit.net,gdziadkiewicz/octokit.net,dampir/octokit.net,brramos/octokit.net,Sarmad93/octokit.net,M-Zuber/octokit.net,shiftkey-tester/octokit.net,gabrielweyer/octokit.net,octokit-net-test-org/octokit.net,SamTheDev/octokit.net,gabrielweyer/octokit.net,devkhan/octokit.net,eriawan/octokit.net,geek0r/octokit.net,octokit/octokit.net,shiftkey/octokit.net,adamralph/octokit.net,fake-organization/octokit.net,khellang/octokit.net,nsnnnnrn/octokit.net,alfhenrik/octokit.net,hahmed/octokit.net,TattsGroup/octokit.net,khellang/octokit.net,TattsGroup/octokit.net,M-Zuber/octokit.net,dampir/octokit.net,rlugojr/octokit.net,takumikub/octokit.net,thedillonb/octokit.net,rlugojr/octokit.net,SmithAndr/octokit.net,octokit/octokit.net,shiftkey/octokit.net,chunkychode/octokit.net,shana/octokit.net,nsrnnnnn/octokit.net,SmithAndr/octokit.net,devkhan/octokit.net,mminns/octokit.net,hahmed/octokit.net,octokit-net-test-org/octokit.net,alfhenrik/octokit.net,eriawan/octokit.net
|
Octokit/Helpers/EnumExtensions.cs
|
Octokit/Helpers/EnumExtensions.cs
|
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using Octokit.Internal;
namespace Octokit
{
static class EnumExtensions
{
[SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
internal static string ToParameter(this Enum prop)
{
if (prop == null) return null;
var propString = prop.ToString();
var member = prop.GetType().GetMember(propString).FirstOrDefault();
if (member == null) return null;
var attribute = member.GetCustomAttributes(typeof(ParameterAttribute), false)
.Cast<ParameterAttribute>()
.FirstOrDefault();
return attribute != null ? attribute.Value : propString.ToLowerInvariant();
}
}
}
|
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Octokit.Internal;
namespace Octokit
{
static class EnumExtensions
{
[SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
internal static string ToParameter(this Enum prop)
{
if (prop == null) return null;
var propString = prop.ToString();
var member = prop.GetType().GetMember(propString).FirstOrDefault();
if (member == null) return null;
var attribute = member.GetCustomAttributes(typeof(ParameterAttribute), false)
.Cast<ParameterAttribute>()
.FirstOrDefault();
return attribute != null ? attribute.Value : propString.ToLowerInvariant();
}
}
}
|
mit
|
C#
|
fae21101aa54a06c773e089d0e4f4581fa4375d7
|
Update Index.cshtml
|
Bloyteg/RWXViewer,Bloyteg/RWXViewer,Bloyteg/RWXViewer,Bloyteg/RWXViewer
|
RWXViewer/Views/Home/Index.cshtml
|
RWXViewer/Views/Home/Index.cshtml
|
@{
ViewBag.Title = "RWX Viewer by Byte";
}
@section scripts
{
<script src="@Url.Content("~/Scripts/gl-matrix.js")"></script>
<script src="@Url.Content("~/Scripts/knockout-3.1.0.js")"></script>
<script src="@Url.Content("~/Scripts/require.js")" data-main="/Scripts/RWXViewer"></script>
<script src="@Url.Content("~/Scripts/config.js")"></script>
}
<div id="header">
<div id="headerContent">
<h1>RWX Viewer by Byte</h1>
</div>
</div>
<div id="content">
<div id="modelSelector" class="infoBar">
<label for="selectWorld">World:</label>
<select class="uiSelect" id="selectWorld" data-bind="options: worlds, optionsText: 'Name', optionsCaption: '(None)', value: selectedWorld, enabled: worlds().length > 0"></select>
<label for="selectModel">Object:</label>
<select class="uiSelect" id="selectModel" data-bind="options: models, optionsText: 'Name', optionsCaption: '(None)', value: selectedModel, enable: selectedWorld"></select>
</div>
<canvas id="viewport" width="960" height="540">
Your browser does not support the HTML 5 Canvas element.
</canvas>
<div class="infoBar">
Left Mouse: Rotate<br />
Right Mouse: Pan<br />
Mouse Wheel: Zoom
</div>
</div>
|
@{
ViewBag.Title = "RWX Viewer by Byte";
}
@section scripts
{
<script src="@Url.Content("~/Scripts/gl-matrix.js")"></script>
<script src="@Url.Content("~/Scripts/knockout-3.1.0.js")"></script>
<script src="@Url.Content("~/Scripts/require.js")" data-main="/Scripts/RWXViewer"></script>
<script src="@Url.Content("~/Scripts/config.js")"></script>
}
<div id="header">
<div id="headerContent">
<h1>RWX Viewer by Byte</h1>
</div>
</div>
<div id="content">
<div id="modelSelector" class="infoBar">
<label for="selectWorld">World:</label>
<select class="uiSelect" id="selectWorld" disabled data-bind="options: worlds, optionsText: 'Name', optionsCaption: '(None)', value: selectedWorld"></select>
<label for="selectModel">Object:</label>
<select class="uiSelect" id="selectModel" disabled data-bind="options: models, optionsText: 'Name', optionsCaption: '(None)', value: selectedModel, enable: selectedWorld"></select>
</div>
<canvas id="viewport" width="960" height="540">
Your browser does not support the HTML 5 Canvas element.
</canvas>
<div class="infoBar">
Left Mouse: Rotate<br />
Right Mouse: Pan<br />
Mouse Wheel: Zoom
</div>
</div>
|
apache-2.0
|
C#
|
d6051cfd1dae00b2d120c38c828b93b6455cbae5
|
Fix indenting.
|
RogerKratz/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,nhibernate/nhibernate-core,lnu/nhibernate-core,fredericDelaporte/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,livioc/nhibernate-core,livioc/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,lnu/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,nkreipke/nhibernate-core,ngbrown/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,alobakov/nhibernate-core,gliljas/nhibernate-core,ngbrown/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core
|
src/NHibernate/Intercept/DefaultDynamicLazyFieldInterceptor.cs
|
src/NHibernate/Intercept/DefaultDynamicLazyFieldInterceptor.cs
|
using System;
using System.Reflection;
using NHibernate.Proxy.DynamicProxy;
using NHibernate.Util;
namespace NHibernate.Intercept
{
[Serializable]
public class DefaultDynamicLazyFieldInterceptor : IFieldInterceptorAccessor, Proxy.DynamicProxy.IInterceptor
{
public IFieldInterceptor FieldInterceptor { get; set; }
public object Intercept(InvocationInfo info)
{
var methodName = info.TargetMethod.Name;
if (FieldInterceptor != null)
{
if (ReflectHelper.IsPropertyGet(info.TargetMethod))
{
if("get_FieldInterceptor".Equals(methodName))
{
return FieldInterceptor;
}
object propValue = info.InvokeMethodOnTarget();
var result = FieldInterceptor.Intercept(info.Target, ReflectHelper.GetPropertyName(info.TargetMethod), propValue);
if (result != AbstractFieldInterceptor.InvokeImplementation)
{
return result;
}
}
else if (ReflectHelper.IsPropertySet(info.TargetMethod))
{
if ("set_FieldInterceptor".Equals(methodName))
{
FieldInterceptor = (IFieldInterceptor)info.Arguments[0];
return null;
}
FieldInterceptor.MarkDirty();
FieldInterceptor.Intercept(info.Target, ReflectHelper.GetPropertyName(info.TargetMethod), info.Arguments[0]);
}
}
else
{
if ("set_FieldInterceptor".Equals(methodName))
{
FieldInterceptor = (IFieldInterceptor)info.Arguments[0];
return null;
}
}
object returnValue;
try
{
returnValue = info.InvokeMethodOnTarget();
}
catch (TargetInvocationException ex)
{
throw ReflectHelper.UnwrapTargetInvocationException(ex);
}
return returnValue;
}
}
}
|
using System;
using System.Reflection;
using NHibernate.Proxy.DynamicProxy;
using NHibernate.Util;
namespace NHibernate.Intercept
{
[Serializable]
public class DefaultDynamicLazyFieldInterceptor : IFieldInterceptorAccessor, Proxy.DynamicProxy.IInterceptor
{
public IFieldInterceptor FieldInterceptor { get; set; }
public object Intercept(InvocationInfo info)
{
var methodName = info.TargetMethod.Name;
if (FieldInterceptor != null)
{
if (ReflectHelper.IsPropertyGet(info.TargetMethod))
{
if("get_FieldInterceptor".Equals(methodName))
{
return FieldInterceptor;
}
object propValue = info.InvokeMethodOnTarget();
var result = FieldInterceptor.Intercept(info.Target, ReflectHelper.GetPropertyName(info.TargetMethod), propValue);
if (result != AbstractFieldInterceptor.InvokeImplementation)
{
return result;
}
}
else if (ReflectHelper.IsPropertySet(info.TargetMethod))
{
if ("set_FieldInterceptor".Equals(methodName))
{
FieldInterceptor = (IFieldInterceptor)info.Arguments[0];
return null;
}
FieldInterceptor.MarkDirty();
FieldInterceptor.Intercept(info.Target, ReflectHelper.GetPropertyName(info.TargetMethod), info.Arguments[0]);
}
}
else
{
if ("set_FieldInterceptor".Equals(methodName))
{
FieldInterceptor = (IFieldInterceptor)info.Arguments[0];
return null;
}
}
object returnValue;
try
{
returnValue = info.InvokeMethodOnTarget();
}
catch (TargetInvocationException ex)
{
throw ReflectHelper.UnwrapTargetInvocationException(ex);
}
return returnValue;
}
}
}
|
lgpl-2.1
|
C#
|
32d7ed8ea99c6fc2b14eeacb0528a0b7daece9ba
|
add UdpClient related
|
yasokada/unity-150923-udpRs232c,yasokada/unity-150831-udpMonitor
|
Assets/udpMonitorScript.cs
|
Assets/udpMonitorScript.cs
|
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
public class udpMonitorScript : MonoBehaviour {
Thread monThr; // monitor Thread
public Toggle ToggleComm;
private string ipadr1;
private string ipadr2;
private int port;
void Start () {
ToggleComm.isOn = false; // false at first
monThr = new Thread (new ThreadStart (FuncMonData));
monThr.Start ();
}
void Monitor() {
UdpClient client = new UdpClient (port);
client.Client.ReceiveTimeout = 300; // msec
client.Client.Blocking = false;
while (ToggleComm.isOn) {
try {
}
catch (Exception err) {
}
// without this sleep, on android, the app will freeze at Unity splash screen
Thread.Sleep(20);
}
client.Close ();
}
private bool readSetting() {
// TODO: return false if reading fails
ipadr1 = SettingKeeperControl.str_ipadr1;
ipadr2 = SettingKeeperControl.str_ipadr2;
port = SettingKeeperControl.port;
return true;
}
private void FuncMonData()
{
Debug.Log ("Start FuncMonData");
while (true) {
while(ToggleComm.isOn == false) {
Thread.Sleep(100);
continue;
}
readSetting();
Monitor();
}
}
}
|
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Threading;
public class udpMonitorScript : MonoBehaviour {
Thread monThr; // monitor Thread
public Toggle ToggleComm;
private string ipadr1;
private string ipadr2;
private int port;
void Start () {
ToggleComm.isOn = false; // false at first
monThr = new Thread (new ThreadStart (FuncMonData));
monThr.Start ();
}
void Monitor() {
Debug.Log ("start monitor");
while (ToggleComm.isOn) {
Thread.Sleep(100);
}
Debug.Log ("end monitor");
}
private bool readSetting() {
// TODO: return false if reading fails
ipadr1 = SettingKeeperControl.str_ipadr1;
ipadr2 = SettingKeeperControl.str_ipadr2;
port = SettingKeeperControl.port;
return true;
}
private void FuncMonData()
{
Debug.Log ("Start FuncMonData");
while (true) {
while(ToggleComm.isOn == false) {
Thread.Sleep(100);
continue;
}
readSetting();
Monitor();
}
}
}
|
mit
|
C#
|
ce2e83e6eda099730ac4890030dcc960a90e4906
|
Update Count with dapper calls
|
generik0/Smooth.IoC.Dapper.Repository.UnitOfWork,generik0/Smooth.IoC.Dapper.Repository.UnitOfWork
|
src/Smooth.IoC.Dapper.Repository.UnitOfWork/RepositoryCount.cs
|
src/Smooth.IoC.Dapper.Repository.UnitOfWork/RepositoryCount.cs
|
using System;
using System.Threading.Tasks;
using Dapper;
using Smooth.IoC.Repository.UnitOfWork.Data;
using Smooth.IoC.UnitOfWork;
namespace Smooth.IoC.Repository.UnitOfWork
{
public abstract partial class Repository<TEntity, TPk>
where TEntity : class
where TPk : IComparable
{
public virtual int Count(ISession session)
{
if (_container.IsIEntity<TEntity, TPk>())
{
return
session.QuerySingleOrDefault<int>(
$"SELECT count(*) FROM {Sql.Table<TEntity>(session.SqlDialect)}");
}
return session.Count<TEntity>();
}
public virtual int Count(IUnitOfWork uow)
{
if (_container.IsIEntity<TEntity, TPk>())
{
return
uow.Connection.QuerySingleOrDefault<int>(
$"SELECT count(*) FROM {Sql.Table<TEntity>(uow.SqlDialect)}", uow.Transaction);
}
return uow.Count<TEntity>();
}
public virtual int Count<TSesssion>() where TSesssion : class, ISession
{
using (var uow = Factory.Create<IUnitOfWork ,TSesssion>())
{
return Count(uow);
}
}
public virtual Task<int> CountAsync(ISession session)
{
if (_container.IsIEntity<TEntity, TPk>())
{
return session.QuerySingleOrDefaultAsync<int>(
$"SELECT count(*) FROM {Sql.Table<TEntity>(session.SqlDialect)}");
}
return session.CountAsync<TEntity>();
}
public virtual Task<int> CountAsync(IUnitOfWork uow)
{
if (_container.IsIEntity<TEntity, TPk>())
{
return uow.Connection.QuerySingleOrDefaultAsync<int>(
$"SELECT count(*) FROM {Sql.Table<TEntity>(uow.SqlDialect)}");
}
return uow.CountAsync<TEntity>();
}
public virtual Task<int> CountAsync<TSesssion>() where TSesssion : class, ISession
{
using (var uow = Factory.Create<IUnitOfWork, TSesssion>())
{
return CountAsync(uow);
}
}
}
}
|
using System;
using System.Threading.Tasks;
using Smooth.IoC.Repository.UnitOfWork.Data;
using Smooth.IoC.UnitOfWork;
namespace Smooth.IoC.Repository.UnitOfWork
{
public abstract partial class Repository<TEntity, TPk>
where TEntity : class
where TPk : IComparable
{
public virtual int Count(ISession session)
{
return session.Count<TEntity>();
}
public virtual int Count(IUnitOfWork uow)
{
return uow.Count<TEntity>();
}
public virtual int Count<TSesssion>() where TSesssion : class, ISession
{
using (var session = Factory.Create<TSesssion>())
{
return Count(session);
}
}
public virtual async Task<int> CountAsync(ISession session)
{
return await session.CountAsync<TEntity>();
}
public virtual async Task<int> CountAsync(IUnitOfWork uow)
{
return await uow.CountAsync<TEntity>();
}
public virtual Task<int> CountAsync<TSesssion>() where TSesssion : class, ISession
{
using (var session = Factory.Create<TSesssion>())
{
return CountAsync(session);
}
}
}
}
|
mit
|
C#
|
ccb2341434475dced47eddeaff849ab89eeeb5ba
|
Update default encoding to utf8 for supporting non-us symbols
|
sdesyllas/MailChimp.Net
|
MailChimp.Net.Api/PostHelpers.cs
|
MailChimp.Net.Api/PostHelpers.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace MailChimp.Net.Api
{
class PostHelpers
{
public static string PostJson(string url, string data)
{
var bytes = Encoding.UTF8.GetBytes(data);
using (var client = new WebClient())
{
client.Headers.Add("Content-Type", "application/json");
var response = client.UploadData(url, "POST", bytes);
return Encoding.Default.GetString(response);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace MailChimp.Net.Api
{
class PostHelpers
{
public static string PostJson(string url, string data)
{
var bytes = Encoding.Default.GetBytes(data);
using (var client = new WebClient())
{
client.Headers.Add("Content-Type", "application/json");
var response = client.UploadData(url, "POST", bytes);
return Encoding.Default.GetString(response);
}
}
}
}
|
mit
|
C#
|
bca75e418da7d73965a0d26b04c12606adb2b42e
|
add lootEvent.Stop(reason)
|
Notulp/Pluton,Notulp/Pluton
|
Pluton/Events/LootEvent.cs
|
Pluton/Events/LootEvent.cs
|
using System;
namespace Pluton.Events
{
public class LootEvent : CountedInstance
{
public bool Cancel = false;
public string cancelReason = "A plugin stops you from looting that!";
public readonly Player Looter;
public readonly PlayerLoot pLoot;
public LootEvent(PlayerLoot pl, Player looter)
{
Looter = looter;
pLoot = pl;
}
public void Stop(string reason = "A plugin stops you from looting that!")
{
cancelReason = reason;
Cancel = true;
}
}
}
|
using System;
namespace Pluton.Events
{
public class LootEvent : CountedInstance
{
public bool Cancel = false;
public string cancelReason = "A plugin stops you from looting that!";
public readonly Player Looter;
public readonly PlayerLoot pLoot;
public LootEvent(PlayerLoot pl, Player looter)
{
Looter = looter;
pLoot = pl;
}
}
}
|
mit
|
C#
|
df7dc7cecdf1f1e020f53f2352f9c115735080a7
|
Update assembly version number
|
sevenshadow/sevenshadow-tagnifi
|
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("SevenShadow.TagniFi")]
[assembly: AssemblyDescription("Code to call the Tagnifi API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Seven Shadow LLC")]
[assembly: AssemblyProduct("SevenShadow.TagniFi")]
[assembly: AssemblyCopyright("Copyright Seven Shadow LLC 2015 -2016")]
[assembly: AssemblyTrademark("Seven Shadow LLC")]
[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("5cf03065-6e01-484f-8318-4faa0aa82465")]
// 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.4.0")]
[assembly: AssemblyFileVersion("1.0.4.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("SevenShadow.TagniFi")]
[assembly: AssemblyDescription("Code to call the Tagnifi API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SevenShadow.TagniFi")]
[assembly: AssemblyCopyright("Copyright Seven Shadow LLC 2015 -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("5cf03065-6e01-484f-8318-4faa0aa82465")]
// 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.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
|
mit
|
C#
|
fc96711b3464fb46050eb34e04532cc3f4ebd540
|
Handle hastebin failure in the CodePaste module
|
mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX
|
Modix/Modules/CodePasteModule.cs
|
Modix/Modules/CodePasteModule.cs
|
using Discord.Commands;
using Modix.Services.AutoCodePaste;
using System.Net;
using System.Threading.Tasks;
namespace Modix.Modules
{
[Name("Code Paste"), Summary("Paste some code to the internet.")]
public class CodePasteModule : ModuleBase
{
private CodePasteService _service;
public CodePasteModule(CodePasteService service)
{
_service = service;
}
[Command("paste"), Summary("Paste the rest of your message to the internet, and return the URL.")]
public async Task Run([Remainder] string code)
{
string url = null;
string error = null;
try
{
url = await _service.UploadCode(Context.Message, code);
}
catch (WebException ex)
{
url = null;
error = ex.Message;
}
if (url != null)
{
var embed = _service.BuildEmbed(Context.User, code, url);
await ReplyAsync(Context.User.Mention, false, embed);
await Context.Message.DeleteAsync();
}
else
{
await ReplyAsync(error);
}
}
}
}
|
using Discord.Commands;
using Modix.Services.AutoCodePaste;
using System.Threading.Tasks;
namespace Modix.Modules
{
[Name("Code Paste"), Summary("Paste some code to the internet.")]
public class CodePasteModule : ModuleBase
{
private CodePasteService _service;
public CodePasteModule(CodePasteService service) {
_service = service;
}
[Command("paste"), Summary("Paste the rest of your message to the internet, and return the URL.")]
public async Task Run([Remainder] string code)
{
string url = await _service.UploadCode(Context.Message, code);
var embed = _service.BuildEmbed(Context.User, code, url);
await ReplyAsync(Context.User.Mention, false, embed);
await Context.Message.DeleteAsync();
}
}
}
|
mit
|
C#
|
36067a1e6cf9135e4ef91e5f6815f573b0c3f8f7
|
Bump version
|
nixxquality/WebMConverter,Yuisbean/WebMConverter,o11c/WebMConverter
|
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("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[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("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.7.1")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[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("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.7.0")]
|
mit
|
C#
|
35a8150bbf2e84a0103528253834ea3148c6e4b1
|
use SortDirection from issues
|
darrelmiller/octokit.net,SmithAndr/octokit.net,gabrielweyer/octokit.net,ivandrofly/octokit.net,mminns/octokit.net,adamralph/octokit.net,alfhenrik/octokit.net,khellang/octokit.net,editor-tools/octokit.net,michaKFromParis/octokit.net,thedillonb/octokit.net,shana/octokit.net,bslliw/octokit.net,naveensrinivasan/octokit.net,chunkychode/octokit.net,forki/octokit.net,nsrnnnnn/octokit.net,gdziadkiewicz/octokit.net,geek0r/octokit.net,rlugojr/octokit.net,gabrielweyer/octokit.net,SmithAndr/octokit.net,devkhan/octokit.net,hitesh97/octokit.net,gdziadkiewicz/octokit.net,dampir/octokit.net,octokit-net-test/octokit.net,eriawan/octokit.net,mminns/octokit.net,TattsGroup/octokit.net,daukantas/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,shiftkey/octokit.net,Red-Folder/octokit.net,octokit-net-test-org/octokit.net,SamTheDev/octokit.net,devkhan/octokit.net,alfhenrik/octokit.net,SamTheDev/octokit.net,shiftkey-tester/octokit.net,hahmed/octokit.net,kdolan/octokit.net,shiftkey/octokit.net,fffej/octokit.net,chunkychode/octokit.net,cH40z-Lord/octokit.net,M-Zuber/octokit.net,dlsteuer/octokit.net,Sarmad93/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,brramos/octokit.net,eriawan/octokit.net,octokit/octokit.net,shiftkey-tester/octokit.net,thedillonb/octokit.net,octokit-net-test-org/octokit.net,Sarmad93/octokit.net,M-Zuber/octokit.net,ChrisMissal/octokit.net,TattsGroup/octokit.net,editor-tools/octokit.net,ivandrofly/octokit.net,dampir/octokit.net,kolbasov/octokit.net,octokit/octokit.net,magoswiat/octokit.net,shana/octokit.net,nsnnnnrn/octokit.net,fake-organization/octokit.net,SLdragon1989/octokit.net,rlugojr/octokit.net,khellang/octokit.net,hahmed/octokit.net,takumikub/octokit.net
|
Octokit/Models/Request/SearchTerm.cs
|
Octokit/Models/Request/SearchTerm.cs
|
namespace Octokit
{
/// <summary>
/// Searching GitHub
/// </summary>
public class SearchTerm
{
public SearchTerm(string term)
{
Term = term;
Page = 1;
PerPage = 100;
}
/// <summary>
/// The search terms. This can be any combination of the supported repository search parameters:
/// http://developer.github.com/v3/search/#search-code
/// </summary>
public string Term { get; set; }
/// <summary>
/// Optional Sort field. One of stars, forks, or updated. If not provided, results are sorted by best match.
/// </summary>
public SearchSort? Sort { get; set; }
/// <summary>
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
/// </summary>
public SortDirection? Order { get; set; }
/// <summary>
/// Page of paginated results
/// </summary>
public int Page { get; set; }
/// <summary>
/// Number of items per page
/// </summary>
public int PerPage { get; set; }
/// <summary>
/// get the params in the correct format...
/// </summary>
/// <returns></returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString")]
public System.Collections.Generic.IDictionary<string, string> Parameters
{
get
{
var d = new System.Collections.Generic.Dictionary<string, string>();
d.Add("q", Term);
d.Add("page", Page.ToString());
d.Add("per_page ", PerPage.ToString());
if (Sort.HasValue)
d.Add("sort", Sort.Value.ToString());
if (Order.HasValue)
d.Add("order", Order.Value.ToString());
return d;
}
}
}
public enum SearchSort
{
Stars,
Forks,
Updated
}
}
|
namespace Octokit
{
/// <summary>
/// Searching GitHub
/// </summary>
public class SearchTerm
{
public SearchTerm(string term)
{
Term = term;
Page = 1;
PerPage = 100;
}
/// <summary>
/// The search terms. This can be any combination of the supported repository search parameters:
/// http://developer.github.com/v3/search/#search-code
/// </summary>
public string Term { get; set; }
/// <summary>
/// Optional Sort field. One of stars, forks, or updated. If not provided, results are sorted by best match.
/// </summary>
public SearchSort? Sort { get; set; }
/// <summary>
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
/// </summary>
public SearchOrder? Order { get; set; }
/// <summary>
/// Page of paginated results
/// </summary>
public int Page { get; set; }
/// <summary>
/// Number of items per page
/// </summary>
public int PerPage { get; set; }
/// <summary>
/// get the params in the correct format...
/// </summary>
/// <returns></returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString")]
public System.Collections.Generic.IDictionary<string, string> Parameters
{
get
{
var d = new System.Collections.Generic.Dictionary<string, string>();
d.Add("q", Term);
d.Add("page", Page.ToString());
d.Add("per_page ", PerPage.ToString());
if (Sort.HasValue)
d.Add("sort", Sort.Value.ToString());
if (Order.HasValue)
d.Add("order", Order.Value.ToString());
return d;
}
}
}
public enum SearchSort
{
Stars,
Forks,
Updated
}
public enum SearchOrder
{
Ascending,
Descending
}
}
|
mit
|
C#
|
4e20847855444cb0b559e2672ee603ffd562dceb
|
Fix failing test ... by removing it
|
PhilboBaggins/ci-experiments-dotnetcore,PhilboBaggins/ci-experiments-dotnetcore
|
UnitTestProject1/UnitTest1.cs
|
UnitTestProject1/UnitTest1.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Assert.AreEqual(ClassLibrary1.Class1.ReturnFive(), 5);
Assert.AreEqual(ClassLibrary1.Class1.ReturnSix(), 6);
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Assert.AreEqual(ClassLibrary1.Class1.ReturnFive(), 5);
Assert.AreEqual(ClassLibrary1.Class1.ReturnSix(), 6);
}
[TestMethod]
public void ShouldFail()
{
Assert.AreEqual(ClassLibrary1.Class1.ReturnFive(),
ClassLibrary1.Class1.ReturnSix());
}
}
}
|
unlicense
|
C#
|
fe25c6fd1bf3a11e65a71d3b875df01229441bee
|
Convert struct to class
|
MHeasell/Mappy,MHeasell/Mappy
|
Mappy/Models/ComboBoxViewModel.cs
|
Mappy/Models/ComboBoxViewModel.cs
|
namespace Mappy.Models
{
using System.Collections.Generic;
public class ComboBoxViewModel
{
public static readonly ComboBoxViewModel Empty = new ComboBoxViewModel(new List<string>(), -1);
public ComboBoxViewModel(IList<string> items)
: this(items, items.Count > 0 ? 0 : -1)
{
}
public ComboBoxViewModel(IList<string> items, int selectedIndex)
{
this.Items = items;
this.SelectedIndex = selectedIndex;
}
public IList<string> Items { get; }
public int SelectedIndex { get; }
public string SelectedItem => this.SelectedIndex == -1 ? null : this.Items[this.SelectedIndex];
public ComboBoxViewModel Select(int index) => new ComboBoxViewModel(this.Items, index);
}
}
|
namespace Mappy.Models
{
using System.Collections.Generic;
public struct ComboBoxViewModel
{
public static readonly ComboBoxViewModel Empty = new ComboBoxViewModel(new List<string>(), -1);
public ComboBoxViewModel(IList<string> items)
: this(items, items.Count > 0 ? 0 : -1)
{
}
public ComboBoxViewModel(IList<string> items, int selectedIndex)
{
this.Items = items;
this.SelectedIndex = selectedIndex;
}
public IList<string> Items { get; }
public int SelectedIndex { get; }
public string SelectedItem => this.SelectedIndex == -1 ? null : this.Items[this.SelectedIndex];
public ComboBoxViewModel Select(int index) => new ComboBoxViewModel(this.Items, index);
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.